diff --git a/.agents/skills/diagnostics/SKILL.md b/.agents/skills/diagnostics/SKILL.md index e805f4212d1e..68596bb57e83 100644 --- a/.agents/skills/diagnostics/SKILL.md +++ b/.agents/skills/diagnostics/SKILL.md @@ -2,7 +2,8 @@ name: Diagnostics description: Instructions for declaring, formatting, emitting, testing, and styling - diagnostic messages (errors, warnings, notes) in the Carbon toolchain. + diagnostic messages (errors, warnings, and the labels that explain them) in + the Carbon toolchain. --- # Diagnostics in the Carbon Toolchain @@ -15,9 +16,9 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception The Carbon compiler features a highly-engineered, context-aware diagnostics framework designed to deliver precise, readable, and highly targetable -diagnostic output (errors, warnings, notes). This document establishes strict -rules for declaring, formatting, emitting, testing, and styling compiler -diagnostics. +diagnostic output (errors, warnings, and the labels that explain them). This +document establishes strict rules for declaring, formatting, emitting, testing, +and styling compiler diagnostics. --- @@ -39,8 +40,8 @@ Diagnostics are handled via three decoupled core components: [kind.def](../../../toolchain/diagnostics/kind.def). 2. **Emitters**: Specialized formatting pipelines (parameterized on custom phase location types `LocT` like `Token` or `LocId`) that convert raw tokens - to standardized physical source locations (file, line, column, and text - snippet). + to standardized physical source locations (file, line, column, and the text + of the line). 3. **Consumers**: Pipelines that process, track, filter, and sort diagnostics. The default `SortingConsumer` buffers and stable-sorts diagnostics based on their `last_byte_offset` matching compiler traversal order to ensure perfect @@ -86,7 +87,7 @@ declaration (`CARBON_DIAGNOSTIC` or `CARBON_DIAGNOSTIC_ON_SCOPE`). - **File Scope**: If the diagnostic is shared among multiple functions inside the _same_ file, declare it at **file scope** inside the anonymous namespace of the `.cpp` file. -- **Global Scope**: If a diagnostic (such as a shared helper note) is reused +- **Global Scope**: If a diagnostic (such as a shared helper label) is reused _across different physical files_, define it in a shared header (e.g. context/check helpers) and mark it `extern` where applicable, ensuring the macro is only invoked once. @@ -155,40 +156,66 @@ Custom structures can define how they serialize inside diagnostics using the ### Fluent Builder Pattern -For compound diagnostics requiring multiple sub-notes, carets, or custom code -overrides, use `Build` to chain actions fluently: +A diagnostic is one message plus the labels that mark the source explaining it. +Use `Build` to state the message and `Attach` to mark each place the reader has +to look, chained fluently: ```cpp +CARBON_DIAGNOSTIC_LABEL(ModifierPrevious, Info, "`{0}` previously appeared here", + Lex::TokenKind); + context.emitter() .Build(second_node, ModifierRepeated, context.token_kind(second_node)) - .Note(first_node, ModifierPrevious, context.token_kind(first_node)) - .OverrideSnippet("custom snippet...") + .Attach(first_node, ModifierPrevious, context.token_kind(first_node)) .Emit(); ``` +Labels are declared with `CARBON_DIAGNOSTIC_LABEL` where they are attached, and +are not registered in `kind.def`; `check_diagnostics.py` checks that each one is +attached and covered. A label is either `Primary` -- the range the message +itself is about -- or `Info`, for somewhere else the reader must look; those two +are the only categories, because anything not read against the code it names is +not a label. `Attach(loc)` with no label marks a range wordlessly, which is what +to use when a label would only restate the message. + +Every diagnostic should attach at least one label; a message with nothing +attached has nothing to show. See +[diagnostics.md](../../../toolchain/docs/diagnostics.md) for which range to pick +and when a label earns words. + > [!SAFETY] Emitter builders are marked `[[nodiscard]]`. To prevent a developer > from creating a builder but failing to terminal-chain `.Emit()`, the builder > uses an rvalue overload `Emit() &&` that triggers a compile-time > `static_assert(false)`. You must save the builder to an lvalue or execute the -> chain exactly as `emitter.Build(...).Note(...).Emit()`. +> chain exactly as `emitter.Build(...).Attach(...).Emit()`. ### RAII Context & Annotation Scopes -Manage large checking structures requiring blanket note context using RAII block +Manage large checking structures requiring blanket context using RAII block scopes: -- `ContextScope`: Automatically converts any diagnostics emitted within its - scope into sub-notes under a high-level operation descriptor: +- `ContextScope`: Attaches a context to every diagnostic emitted within its + scope, describing the higher-level operation that failed because of it. A + context is declared with `CARBON_DIAGNOSTIC_CONTEXT`, or + `CARBON_DIAGNOSTIC_SOFT_CONTEXT` for one dropped when the diagnostic + already has a context: ```cpp - ContextScope context_scope(&context.emitter(), [&](ContextBuilder& builder) { - builder.Context(eval_loc, InCallToEvalFn); - }); - // any checker error emitted here will automatically append the 'InCallToEvalFn' note + Diagnostics::ContextScope diagnostic_context( + &context.emitter(), [&](auto& builder) { + CARBON_DIAGNOSTIC_CONTEXT( + QualifiedDeclInIncompleteClassScope, + "cannot declare a member of incomplete class {0}", SemIR::TypeId); + builder.Attach(loc_id, QualifiedDeclInIncompleteClassScope, + context.classes().Get(class_id).self_type_id); + }); ``` -- `AnnotationScope`: RAII block scope that automatically attaches blanket note - annotations to all scoped diagnostics. + A context is not a label: its text stands alone as a sentence, which is why + it leads the diagnostic rather than following it. + +- `AnnotationScope`: RAII block scope that attaches labels to every diagnostic + emitted within it, using the same `Builder` as a direct emission. --- @@ -257,5 +284,15 @@ Carbon strictly enforces testing coverage at build-time. ``` 3. **Build Enforcement**: Failing to provide a diagnostic test check matcher - triggers a build compilation error on the target test + triggers a failure on the target test `//toolchain/diagnostics:coverage_test`. +4. **Label Enforcement**: A label is declared where it is attached rather than + in a central registry, so `coverage_test` has no list of labels to compare a + matched name against and leaves any name that isn't a kind alone. + [check_diagnostics.py](../../../toolchain/diagnostics/check_diagnostics.py) + is what checks them: it reads the declarations and the testdata directly, so + it catches a label with no test, a name matched on that is neither a kind + nor a label, and a kind registered in `kind.def` that nothing declares. It + runs as a pre-commit hook, which CI runs too, rather than as a bazel test -- + reading every source file is what it needs and what a test in the sandbox + cannot do. diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3f8be8e7ad1f..57dd3a630198 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -173,8 +173,9 @@ repos: (?x)^( toolchain/.*\.cpp| toolchain/.*\.h| + toolchain/.*/testdata/.*| toolchain/diagnostics/check_diagnostics\.py| - toolchain/diagnostics/diagnostic_kind\.def + toolchain/diagnostics/kind\.def )$ pass_filenames: false diff --git a/common/terminal/buffer.h b/common/terminal/buffer.h index b62170292cf8..6911b87bacaf 100644 --- a/common/terminal/buffer.h +++ b/common/terminal/buffer.h @@ -287,6 +287,12 @@ class Buffer { // // A cell's style is whatever was drawn there last, so crossing lines of // different styles do depend on order. + // + // TODO: Every line is drawn with one stroke, and a line meeting another + // joins it. Diagnostic rendering needs a heavier stroke, to mark the source + // a message is about, and a line that passes another without connecting, to + // reach a label past the marks between them. Add a weight to these calls + // and a crossing form of `DrawVerticalLine`. auto DrawHorizontalLine(int x, int y, int length, const Style& style, LineEnd start = LineEnd::Center, LineEnd end = LineEnd::Center) -> DrawEnd; @@ -391,6 +397,10 @@ class Buffer { // with such text, since which breaks a reflow may discard -- every newline, // or only those a previous wrapping introduced -- is a question about where // that text came from. + // + // TODO: A break can fall inside a piece of code the text quotes, splitting a + // type written with spaces in it across two rows. Take a quote character and + // keep what a pair of them encloses in one word, as a URL already is. auto DrawWrappedText(int x, int y, int margin, int max_width, llvm::StringRef text, const Style& style) -> DrawEnd; diff --git a/toolchain/check/BUILD b/toolchain/check/BUILD index 78d041173c25..eb6c141647a4 100644 --- a/toolchain/check/BUILD +++ b/toolchain/check/BUILD @@ -188,6 +188,7 @@ cc_library( "//toolchain/sem_ir:absolute_node_ref", "//toolchain/sem_ir:clang_decl", "//toolchain/sem_ir:cpp_file", + "//toolchain/sem_ir:diagnostic_loc_converter", "//toolchain/sem_ir:expr_info", "//toolchain/sem_ir:file", "//toolchain/sem_ir:formatter", @@ -261,6 +262,7 @@ cc_library( "//toolchain/base:timings", "//toolchain/diagnostics:emitter", "//toolchain/diagnostics:format_providers", + "//toolchain/diagnostics:renderer", "//toolchain/lex:token_index", "//toolchain/lex:token_kind", "//toolchain/lex:tokenized_buffer", diff --git a/toolchain/check/call.cpp b/toolchain/check/call.cpp index 16380add798c..78deb7af17dd 100644 --- a/toolchain/check/call.cpp +++ b/toolchain/check/call.cpp @@ -83,16 +83,17 @@ static auto ResolveCalleeInCall(Context& context, SemIR::LocId loc_id, " expecting {2} argument{2:s}", Diagnostics::IntAsSelect, Diagnostics::IntAsSelect, Diagnostics::IntAsSelect); - CARBON_DIAGNOSTIC(InCallToEntity, Note, - "calling {0:=0:function|=1:generic class|=2:generic " - "interface|=3:generic constraint}" - " declared here", - Diagnostics::IntAsSelect); + CARBON_DIAGNOSTIC_LABEL( + InCallToEntity, Info, + "calling {0:=0:function|=1:generic class|=2:generic " + "interface|=3:generic constraint}" + " declared here", + Diagnostics::IntAsSelect); context.emitter() .Build(loc_id, CallArgCountMismatch, arg_ids.size(), static_cast(entity_kind_for_diagnostic), expected_args_size) - .Note(entity.latest_decl_id(), InCallToEntity, - static_cast(entity_kind_for_diagnostic)) + .Attach(entity.latest_decl_id(), InCallToEntity, + static_cast(entity_kind_for_diagnostic)) .Emit(); return std::nullopt; } @@ -257,13 +258,13 @@ auto PerformCallToFunction(Context& context, SemIR::LocId loc_id, CARBON_DIAGNOSTIC(CallBeforeReturnTypeDeduced, Error, "call to `{0}` before its return type is deduced", SemIR::NameId); - CARBON_DIAGNOSTIC(ReturnTypeDeducedFromDefinition, Note, - "return type of `{0}` is deduced from its definition", - SemIR::NameId); + CARBON_DIAGNOSTIC_LABEL( + ReturnTypeDeducedFromDefinition, Info, + "return type of `{0}` is deduced from its definition", SemIR::NameId); context.emitter() .Build(loc_id, CallBeforeReturnTypeDeduced, callee.name_id) - .Note(callee.latest_decl_id(), ReturnTypeDeducedFromDefinition, - callee.name_id) + .Attach(callee.latest_decl_id(), ReturnTypeDeducedFromDefinition, + callee.name_id) .Emit(); return SemIR::ErrorInst::InstId; } @@ -283,9 +284,9 @@ auto PerformCallToFunction(Context& context, SemIR::LocId loc_id, if (callee.return_pattern_id.has_value()) { Diagnostics::AnnotationScope annotate_diagnostics( &context.emitter(), [&](auto& builder) { - CARBON_DIAGNOSTIC(IncompleteReturnTypeHere, Note, - "return type declared here"); - builder.Note(callee.return_pattern_id, IncompleteReturnTypeHere); + CARBON_DIAGNOSTIC_LABEL(IncompleteReturnTypeHere, Info, + "return type declared here"); + builder.Attach(callee.return_pattern_id, IncompleteReturnTypeHere); }); auto arg_type_id = CheckFunctionReturnPatternType( context, loc_id, callee.return_pattern_id, *callee_specific_id); @@ -488,7 +489,7 @@ static auto PerformCallHelper(Context& context, SemIR::LocId loc_id, } case CARBON_KIND(SemIR::CalleeCppOverloadSet overload): { - return PerformCallToCppFunction(context, loc_id, + return PerformCallToCppFunction(context, loc_id, callee_id, overload.cpp_overload_set_id, overload.self_id, arg_ids, is_desugared); } diff --git a/toolchain/check/check.cpp b/toolchain/check/check.cpp index 75860e728dcb..2ea83ffbe498 100644 --- a/toolchain/check/check.cpp +++ b/toolchain/check/check.cpp @@ -123,9 +123,9 @@ static auto TrackImport(Map& api_map, !insert_result.is_inserted()) { CARBON_DIAGNOSTIC(RepeatedImport, Error, "library imported more than once"); - CARBON_DIAGNOSTIC(FirstImported, Note, "first import here"); + CARBON_DIAGNOSTIC_LABEL(FirstImported, Info, "first import here"); unit_info.emitter.Build(import.node_id, RepeatedImport) - .Note(insert_result.value(), FirstImported) + .Attach(insert_result.value(), FirstImported) .Emit(); return; } @@ -311,20 +311,17 @@ static auto BuildApiMapAndDiagnosePackaging( bool is_api_with_impl_ext = !is_impl && filename.ends_with(ImplExt); auto want_ext = is_impl ? ImplExt : ApiExt; if (is_api_with_impl_ext || !filename.ends_with(want_ext)) { + // The diagnostic is about the file rather than anything in it, so + // there is no range to mark and the hint goes in the message: a label + // would have no location of its own to be drawn at. CARBON_DIAGNOSTIC( IncorrectExtension, Error, - "file extension of `{0:.impl|}.carbon` required for {0:`impl`|api}", - Diagnostics::BoolAsSelect); - auto diag = unit_info.emitter.Build( + "file extension of `{0:.impl|}.carbon` required for {0:`impl`|api}" + "{1:; `.impl.carbon` names an `impl` file|}", + Diagnostics::BoolAsSelect, Diagnostics::BoolAsSelect); + unit_info.emitter.Emit( packaging ? packaging->names.node_id : Parse::NodeId::None, - IncorrectExtension, is_impl); - if (is_api_with_impl_ext) { - CARBON_DIAGNOSTIC( - IncorrectExtensionImplNote, Note, - "file extension of `.impl.carbon` only allowed for `impl`"); - diag.Note(Parse::NodeId::None, IncorrectExtensionImplNote); - } - diag.Emit(); + IncorrectExtension, is_impl, is_api_with_impl_ext); } } } diff --git a/toolchain/check/check_fuzzer.cpp b/toolchain/check/check_fuzzer.cpp index e275d1c9e5bf..e423fb0bfad4 100644 --- a/toolchain/check/check_fuzzer.cpp +++ b/toolchain/check/check_fuzzer.cpp @@ -40,14 +40,25 @@ extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) { llvm::raw_null_ostream null_ostream; Driver driver(fs, install_paths, /*input_stream=*/nullptr, &null_ostream, - &null_ostream, /*fuzzing=*/true); + &null_ostream, /*error_file=*/{}, /*fuzzing=*/true); + + // Force Unicode and color output. The output stream isn't a terminal, so + // diagnostics would otherwise render as plain ASCII without color, and the + // fuzzer would never reach the renderer's handling of UTF-8 and double-width + // characters. + static constexpr llvm::StringLiteral RenderArgs[] = { + "--terminal-unicode=always", "--color=always"}; // TODO: Get checking to a point where it can handle invalid parse trees // without crashing. - if (!driver.RunCommand({"compile", "--phase=parse", TestFileName}).success) { + if (!driver + .RunCommand({RenderArgs[0], RenderArgs[1], "compile", + "--phase=parse", TestFileName}) + .success) { return 0; } - driver.RunCommand({"compile", "--phase=check", TestFileName}); + driver.RunCommand( + {RenderArgs[0], RenderArgs[1], "compile", "--phase=check", TestFileName}); return 0; } diff --git a/toolchain/check/check_unit.cpp b/toolchain/check/check_unit.cpp index 7dc2a9e1fc8a..9851da7991a0 100644 --- a/toolchain/check/check_unit.cpp +++ b/toolchain/check/check_unit.cpp @@ -34,6 +34,7 @@ #include "toolchain/check/type_structure.h" #include "toolchain/check/unused.h" #include "toolchain/diagnostics/diagnostic.h" +#include "toolchain/diagnostics/renderer.h" #include "toolchain/sem_ir/function.h" #include "toolchain/sem_ir/ids.h" #include "toolchain/sem_ir/import_ir.h" @@ -380,10 +381,10 @@ auto CheckUnit::ProcessNodeIds() -> bool { PrettyStackTraceFunction node_dumper([&](llvm::raw_ostream& output) { const auto& tree = tree_and_subtrees_getter_(); auto converted = tree.NodeToDiagnosticLoc(node_id, /*token_only=*/false); - converted.loc.FormatLocation(output); + output << Diagnostics::FormatLocation(converted.loc) << ": "; output << "Checking " << context_.parse_tree().node_kind(node_id) << "\n"; // Crash output has a tab indent; try to indent slightly past that. - converted.loc.FormatSnippet(output, /*indent=*/10); + Diagnostics::PrintSnippet(output, converted.loc, /*indent=*/10); }); while (auto maybe_node_id = traversal.Next()) { @@ -507,14 +508,14 @@ auto CheckUnit::CheckRequiredDefinitions() -> void { if (!ResolveSpecificDefinition(context_, loc, specific_id)) { CARBON_DIAGNOSTIC(MissingGenericFunctionDefinition, Error, "use of undefined generic function"); - CARBON_DIAGNOSTIC(MissingGenericFunctionDefinitionHere, Note, - "generic function declared here"); + CARBON_DIAGNOSTIC_LABEL(MissingGenericFunctionDefinitionHere, Info, + "generic function declared here"); auto generic_decl_id = context_.generics() .Get(context_.specifics().Get(specific_id).generic_id) .decl_id; emitter_.Build(loc, MissingGenericFunctionDefinition) - .Note(generic_decl_id, MissingGenericFunctionDefinitionHere) + .Attach(generic_decl_id, MissingGenericFunctionDefinitionHere) .Emit(); } } @@ -568,27 +569,28 @@ auto CheckUnit::CheckPoisonedConcreteImplLookupQueries() -> void { "found `impl` that would change the result of an earlier " "use of `{0} as {1}`", InstIdAsRawType, SpecificInterfaceIdAsRawType); - CARBON_DIAGNOSTIC( - PoisonedImplLookupConcreteResultNoteBadImpl, Note, + CARBON_DIAGNOSTIC_LABEL( + PoisonedImplLookupConcreteResultNoteBadImpl, Info, "the use would select the `impl` here but it was not found yet"); - CARBON_DIAGNOSTIC(PoisonedImplLookupConcreteResultNotePreviousImpl, - Note, "the use had selected the `impl` here"); + CARBON_DIAGNOSTIC_LABEL( + PoisonedImplLookupConcreteResultNotePreviousImpl, Info, + "the use had selected the `impl` here"); emitter_ .Build(poison.loc_id, PoisonedImplLookupConcreteResult, poison.query.query_self_inst_id, poison.query.query_specific_interface_id) - .Note(bad_impl.first_decl_id(), - PoisonedImplLookupConcreteResultNoteBadImpl) - .Note(prev_impl.first_decl_id(), - PoisonedImplLookupConcreteResultNotePreviousImpl) + .Attach(bad_impl.first_decl_id(), + PoisonedImplLookupConcreteResultNoteBadImpl) + .Attach(prev_impl.first_decl_id(), + PoisonedImplLookupConcreteResultNotePreviousImpl) .Emit(); } else { CARBON_DIAGNOSTIC( PoisonedImplLookupCustomResult, Error, "found `impl` for {0} as {1}, which has a custom witness", InstIdAsRawType, SpecificInterfaceIdAsRawType); - CARBON_DIAGNOSTIC( - PoisonedImplLookupCustomResultNoteBadImpl, Note, + CARBON_DIAGNOSTIC_LABEL( + PoisonedImplLookupCustomResultNoteBadImpl, Info, "the use tried to select the `impl` here, but a custom " "witness was already chosen"); @@ -596,8 +598,8 @@ auto CheckUnit::CheckPoisonedConcreteImplLookupQueries() -> void { .Build(poison.loc_id, PoisonedImplLookupCustomResult, poison.query.query_self_inst_id, poison.query.query_specific_interface_id) - .Note(prev_impl.first_decl_id(), - PoisonedImplLookupCustomResultNoteBadImpl) + .Attach(prev_impl.first_decl_id(), + PoisonedImplLookupCustomResultNoteBadImpl) .Emit(); } } diff --git a/toolchain/check/class.cpp b/toolchain/check/class.cpp index a79bd59d27bf..3be91387cf02 100644 --- a/toolchain/check/class.cpp +++ b/toolchain/check/class.cpp @@ -60,21 +60,22 @@ static auto CheckCompleteAdapterClassType( const auto& class_info = context.classes().Get(class_id); if (class_info.base_id.has_value()) { CARBON_DIAGNOSTIC(AdaptWithBase, Error, "adapter with base class"); - CARBON_DIAGNOSTIC(AdaptWithBaseHere, Note, "`base` declaration is here"); + CARBON_DIAGNOSTIC_LABEL(AdaptWithBaseHere, Info, + "`base` declaration is here"); context.emitter() .Build(class_info.adapt_id, AdaptWithBase) - .Note(class_info.base_id, AdaptWithBaseHere) + .Attach(class_info.base_id, AdaptWithBaseHere) .Emit(); return SemIR::ErrorInst::InstId; } if (!field_decls.empty()) { CARBON_DIAGNOSTIC(AdaptWithFields, Error, "adapter with fields"); - CARBON_DIAGNOSTIC(AdaptWithFieldHere, Note, - "first field declaration is here"); + CARBON_DIAGNOSTIC_LABEL(AdaptWithFieldHere, Info, + "first field declaration is here"); context.emitter() .Build(class_info.adapt_id, AdaptWithFields) - .Note(field_decls.front(), AdaptWithFieldHere) + .Attach(field_decls.front(), AdaptWithFieldHere) .Emit(); return SemIR::ErrorInst::InstId; } @@ -87,11 +88,11 @@ static auto CheckCompleteAdapterClassType( SemIR::Function::VirtualModifier::Virtual) { CARBON_DIAGNOSTIC(AdaptWithVirtual, Error, "adapter with virtual function"); - CARBON_DIAGNOSTIC(AdaptWithVirtualHere, Note, - "first virtual function declaration is here"); + CARBON_DIAGNOSTIC_LABEL(AdaptWithVirtualHere, Info, + "first virtual function declaration is here"); context.emitter() .Build(class_info.adapt_id, AdaptWithVirtual) - .Note(inst_id, AdaptWithVirtualHere) + .Attach(inst_id, AdaptWithVirtualHere) .Emit(); return SemIR::ErrorInst::InstId; } @@ -316,11 +317,12 @@ static auto BuildVtable(Context& context, Parse::ClassDefinitionId node_id, } else if (!implemented_impls.Lookup(fn_decl.function_id)) { CARBON_DIAGNOSTIC(OverrideWithoutVirtualInBase, Error, "override without compatible virtual in base class"); - CARBON_DIAGNOSTIC(OverrideCandidateArityMismatch, Note, - "base class function has {2:more|fewer} parameters " - "({0} vs {1} excluding `self`)", - Diagnostics::IntAsSelect, Diagnostics::IntAsSelect, - Diagnostics::BoolAsSelect); + CARBON_DIAGNOSTIC_LABEL( + OverrideCandidateArityMismatch, Info, + "base class function has {2:more|fewer} parameters " + "({0} vs {1} excluding `self`)", + Diagnostics::IntAsSelect, Diagnostics::IntAsSelect, + Diagnostics::BoolAsSelect); auto builder = context.emitter().Build(SemIR::LocId(inst_id), OverrideWithoutVirtualInBase); if (base_vtable_id.has_value()) { @@ -338,12 +340,12 @@ static auto BuildVtable(Context& context, Parse::ClassDefinitionId node_id, const auto& base_fn = context.sem_ir().functions().Get(fn_id); switch (CompareVirtualWithOverrider(base_fn, fn)) { case OverrideMatchResult::ArityMismatch: - builder.Note(base_fn.first_owning_decl_id, - OverrideCandidateArityMismatch, - base_fn.call_param_ranges.explicit_size() - 1, - fn.call_param_ranges.explicit_size() - 1, - base_fn.call_param_ranges.explicit_size() > - fn.call_param_ranges.explicit_size()); + builder.Attach(base_fn.first_owning_decl_id, + OverrideCandidateArityMismatch, + base_fn.call_param_ranges.explicit_size() - 1, + fn.call_param_ranges.explicit_size() - 1, + base_fn.call_param_ranges.explicit_size() > + fn.call_param_ranges.explicit_size()); break; case OverrideMatchResult::NameMismatch: // TODO: If the name is similar enough and the overrider otherwise diff --git a/toolchain/check/convert.cpp b/toolchain/check/convert.cpp index b7cad09234b1..24e2f0913a13 100644 --- a/toolchain/check/convert.cpp +++ b/toolchain/check/convert.cpp @@ -1492,8 +1492,9 @@ static auto PerformBuiltinConversion(Context& context, SemIR::LocId loc_id, // the type (or some part of it) is not copyable. Diagnostics::AnnotationScope annotate_diagnostics( &context.emitter(), [&](auto& builder) { - CARBON_DIAGNOSTIC(InCopy, Note, "in copy of {0}", TypeOfInstId); - builder.Note(value_id, InCopy, value_id); + CARBON_DIAGNOSTIC_LABEL(InCopy, Info, "in copy of {0}", + TypeOfInstId); + builder.Attach(value_id, InCopy, value_id); }); foundation_value_id = PerformBuiltinConversion( @@ -1861,9 +1862,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, target.diagnose, [&](auto& builder) { - CARBON_DIAGNOSTIC(CopyOfUncopyableType, Context, - "cannot copy value of type {0}", TypeOfInstId); - builder.Context(expr_id, CopyOfUncopyableType, expr_id); + CARBON_DIAGNOSTIC_CONTEXT(CopyOfUncopyableType, + "cannot copy value of type {0}", + TypeOfInstId); + builder.Attach(expr_id, CopyOfUncopyableType, expr_id); }); return copy_id; } @@ -1924,25 +1926,25 @@ static auto PerformUserDefinedConversion(Context& context, SemIR::LocId loc_id, : target.kind == ConversionTarget::ExplicitUnsafeAs ? 2 : 0; if (context.types().Is(target.type_id)) { - CARBON_DIAGNOSTIC( - ConversionFailureNonTypeToFacet, Context, + CARBON_DIAGNOSTIC_CONTEXT( + ConversionFailureNonTypeToFacet, "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); + builder.Attach(loc_id, ConversionFailureNonTypeToFacet, + target_kind_for_diag, expr_id, + target.type_id == SemIR::TypeType::TypeId, + target.type_id); } else { - CARBON_DIAGNOSTIC( - ConversionFailure, Context, + CARBON_DIAGNOSTIC_CONTEXT( + ConversionFailure, "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); + builder.Attach(loc_id, ConversionFailure, target_kind_for_diag, + expr_id, target.type_id); } }); @@ -2523,17 +2525,17 @@ auto Convert(Context& context, SemIR::LocId loc_id, SemIR::InstId expr_id, !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); + CARBON_DIAGNOSTIC_CONTEXT( + IncompleteTypeInValueConversion, + "forming value of incomplete type {0}", SemIR::TypeId); + CARBON_DIAGNOSTIC_CONTEXT(IncompleteTypeInConversion, + "invalid use of incomplete type {0}", + SemIR::TypeId); + builder.Attach(loc_id, + target.kind == ConversionTarget::Value + ? IncompleteTypeInValueConversion + : IncompleteTypeInConversion, + target.type_id); })) { return SemIR::ErrorInst::InstId; } diff --git a/toolchain/check/cpp/call.cpp b/toolchain/check/cpp/call.cpp index 5f2c42eab600..67f80e5355dd 100644 --- a/toolchain/check/cpp/call.cpp +++ b/toolchain/check/cpp/call.cpp @@ -52,6 +52,7 @@ static auto SplitCallArgumentList(Context& context, } auto PerformCallToCppFunction(Context& context, SemIR::LocId loc_id, + SemIR::InstId callee_expr_id, SemIR::CppOverloadSetId overload_set_id, SemIR::InstId self_id, llvm::ArrayRef arg_ids, @@ -59,8 +60,9 @@ auto PerformCallToCppFunction(Context& context, SemIR::LocId loc_id, auto [template_arg_ids, function_arg_ids] = SplitCallArgumentList(context, arg_ids); auto callee_id = PerformCppOverloadResolution( - context, loc_id, context.cpp_overload_sets().Get(overload_set_id), - template_arg_ids, self_id, function_arg_ids); + context, loc_id, callee_expr_id, + context.cpp_overload_sets().Get(overload_set_id), template_arg_ids, + self_id, function_arg_ids); SemIR::Callee callee = GetCallee(context.sem_ir(), callee_id); CARBON_KIND_SWITCH(callee) { case CARBON_KIND(SemIR::CalleeError _): { diff --git a/toolchain/check/cpp/call.h b/toolchain/check/cpp/call.h index 770bb4d4342d..5cf331c14685 100644 --- a/toolchain/check/cpp/call.h +++ b/toolchain/check/cpp/call.h @@ -31,6 +31,9 @@ auto ConvertArgsToTemplateArgs(Context& context, // function call in user code, so arguments to `ref` parameters aren't required // to have `ref` tags. // +// `callee_expr_id` is the expression naming the overload set, which is what a +// diagnostic about the call marks. +// // Chooses the best viable C++ function by performing Clang overloading // resolution over the overload set. // @@ -44,6 +47,7 @@ auto ConvertArgsToTemplateArgs(Context& context, // possible. Keeping the same behavior here for consistency and supporting // migrations so that the migrated callers from C++ remain valid. auto PerformCallToCppFunction(Context& context, SemIR::LocId loc_id, + SemIR::InstId callee_expr_id, SemIR::CppOverloadSetId overload_set_id, SemIR::InstId self_id, llvm::ArrayRef arg_ids, diff --git a/toolchain/check/cpp/diagnostic_consumer.cpp b/toolchain/check/cpp/diagnostic_consumer.cpp index e4f4d977e394..9e8218bbfb42 100644 --- a/toolchain/check/cpp/diagnostic_consumer.cpp +++ b/toolchain/check/cpp/diagnostic_consumer.cpp @@ -8,11 +8,11 @@ #include #include "clang/Basic/Diagnostic.h" +#include "clang/Basic/DiagnosticSema.h" #include "clang/Basic/SourceManager.h" #include "clang/Frontend/CompilerInvocation.h" -#include "clang/Frontend/TextDiagnostic.h" +#include "clang/Lex/Lexer.h" #include "common/check.h" -#include "common/raw_string_ostream.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" @@ -21,31 +21,27 @@ #include "toolchain/check/cpp/location.h" #include "toolchain/diagnostics/diagnostic.h" #include "toolchain/diagnostics/emitter.h" +#include "toolchain/sem_ir/diagnostic_loc_converter.h" namespace Carbon::Check { class CarbonClangDiagnosticConsumer; -// A diagnostic emitter that maps Clang SourceLocations to Carbon diagnostic +// A diagnostic emitter that maps Clang source ranges to Carbon diagnostic // locations. class ClangLocDiagnosticEmitter - : public Diagnostics::Emitter { + : public Diagnostics::Emitter { public: explicit ClangLocDiagnosticEmitter(Diagnostics::Consumer* consumer, const clang::SourceManager* source_manager) : Emitter(consumer), source_manager_(source_manager) {} protected: - auto ConvertLoc(clang::SourceLocation loc, ContextFnT /*context_fn*/) const + auto ConvertLoc(clang::CharSourceRange range, ContextFnT /*context_fn*/) const -> Diagnostics::ConvertedLoc override { Diagnostics::Loc result_loc; - if (source_manager_ && loc.isValid()) { - clang::PresumedLoc presumed_loc = source_manager_->getPresumedLoc(loc); - if (presumed_loc.isValid()) { - result_loc.filename = presumed_loc.getFilename(); - result_loc.line_number = presumed_loc.getLine(); - result_loc.column_number = presumed_loc.getColumn(); - } + if (source_manager_) { + result_loc = SemIR::ConvertClangRangeToLoc(*source_manager_, range); } return {.loc = result_loc, .last_byte_offset = -1}; } @@ -54,6 +50,34 @@ class ClangLocDiagnosticEmitter const clang::SourceManager* source_manager_; }; +// Attaches a label saying what Clang suggests be done to a range. Clang words +// these as an edit to make, so they read as an instruction rather than as a +// description of the code. +// +// TODO: Carry fix-its as data -- span, replacement, confidence -- in a form +// Carbon's own diagnostics can share, rather than wording the edit into a +// label here, and render both as a unified diff following GCC's example +// rather than Clang's. See future work in +// /toolchain/docs/diagnostics_rendering.md. +template +static auto AttachFixIt(BuilderT& builder, LocT loc, + const CppDiagnosticListener::FixIt& fix_it) -> void { + if (fix_it.text.empty()) { + CARBON_DIAGNOSTIC_LABEL(CppInteropFixItRemoval, Info, "remove this"); + builder.Attach(loc, CppInteropFixItRemoval); + return; + } + if (fix_it.range.getBegin() == fix_it.range.getEnd()) { + CARBON_DIAGNOSTIC_LABEL(CppInteropFixItInsertion, Info, "insert `{0}` here", + std::string); + builder.Attach(loc, CppInteropFixItInsertion, fix_it.text); + return; + } + CARBON_DIAGNOSTIC_LABEL(CppInteropFixItReplacement, Info, + "replace with `{0}`", std::string); + builder.Attach(loc, CppInteropFixItReplacement, fix_it.text); +} + // Returns the diagnostic to use for a given Clang diagnostic level. static auto GetDiagnostic(clang::DiagnosticsEngine::Level level) -> const Diagnostics::DiagnosticBase& { @@ -63,8 +87,13 @@ static auto GetDiagnostic(clang::DiagnosticsEngine::Level level) break; } case clang::DiagnosticsEngine::Note: { - CARBON_DIAGNOSTIC(CppInteropParseNote, Note, "{0}", std::string); - return CppInteropParseNote; + // A note explains the diagnostic it follows and is attached to that one + // as a label. One can still lead a buffer -- a flush can land between an + // error and its trailing notes, and Clang can emit a stray note -- and + // however wrong that is of Clang, it must not be why a compiler dies + // while reporting a problem. + CARBON_DIAGNOSTIC(CppInteropStrayNote, Warning, "{0}", std::string); + return CppInteropStrayNote; } case clang::DiagnosticsEngine::Remark: case clang::DiagnosticsEngine::Warning: { @@ -81,6 +110,158 @@ static auto GetDiagnostic(clang::DiagnosticsEngine::Level level) } } +// Returns whether `range` holds `loc`, which needs both to be spelled in the +// same file: two offsets from different files are unordered, and comparing them +// would report a containment that isn't one. +static auto Contains(const clang::SourceManager& source_manager, + clang::CharSourceRange range, clang::SourceLocation loc) + -> bool { + if (range.isInvalid()) { + return false; + } + CARBON_CHECK(range.isCharRange(), "Widen a token range before comparing."); + auto [file_id, offset] = source_manager.getDecomposedSpellingLoc(loc); + auto [begin_file_id, begin] = + source_manager.getDecomposedSpellingLoc(range.getBegin()); + auto [end_file_id, end] = + source_manager.getDecomposedSpellingLoc(range.getEnd()); + return begin_file_id == file_id && end_file_id == file_id && + begin <= offset && offset < end; +} + +// Returns whether `diag_id` is a Clang diagnostic whose text is written as +// `: `, with its first range +// marking the source that second half is about. +// +// These are the overload-resolution candidate notes, and each one is listed +// rather than being recognized by shape. Splitting on the first `: ` in any +// note that happens to carry a range would cut the wrong messages in the wrong +// place: a type or a path in the text supplies its own colon. +// +// TODO: Try to do this upstream instead. Clang has the structure here and +// loses it: `DiagnoseBadConversion` and its siblings know which half is the +// candidate and which is the reason, and know which argument the reason is +// about, and then format both halves into one string. A note carrying its two +// halves separately would serve Clang's own rendering as well, and would leave +// nothing here to take apart. Until then this list has to be revisited +// whenever the wording of one of these notes changes. +static auto SplitsIntoCandidateAndReason(unsigned diag_id) -> bool { + switch (diag_id) { + case clang::diag::note_ovl_candidate_arity: + case clang::diag::note_ovl_candidate_arity_one: + case clang::diag::note_ovl_candidate_bad_base_to_derived_conv: + case clang::diag::note_ovl_candidate_bad_conv: + case clang::diag::note_ovl_candidate_bad_conv_incomplete: + case clang::diag::note_ovl_candidate_bad_cvr: + case clang::diag::note_ovl_candidate_bad_cvr_this: + case clang::diag::note_ovl_candidate_bad_list_argument: + case clang::diag::note_ovl_candidate_bad_value_category: + return true; + default: + return false; + } +} + +// Returns the parameter list of the declaration named at `loc`, which is what +// a note marks when it has nothing of its own to mark. +// +// Clang leaves a function's parameter-list range empty when the function +// declares no parameters, so a note about how many arguments it takes marks +// nothing even though the list is written. The list is the parentheses after +// the name, holding at most `void`, and it is where the count comes from. +// +// Returns an invalid range where those parentheses aren't right there: the name +// may be an implicit function's, which has no list at all, or be followed by +// template arguments, and reaching further would mark something that isn't the +// list. +static auto FindEmptyParameterList(const clang::SourceManager& source_manager, + const clang::LangOptions& lang_opts, + clang::SourceLocation loc) + -> clang::CharSourceRange { + if (loc.isInvalid() || loc.isMacroID()) { + return clang::CharSourceRange(); + } + // `operator()`'s name holds parentheses of its own, and the parameter list + // is past them; the token after the name would be the name's `(`, not the + // list's. + clang::Token name; + if (clang::Lexer::getRawToken(loc, name, source_manager, lang_opts, + /*IgnoreWhiteSpace=*/true) || + (name.is(clang::tok::raw_identifier) && + name.getRawIdentifier() == "operator")) { + return clang::CharSourceRange(); + } + auto open = clang::Lexer::findNextToken(loc, source_manager, lang_opts); + if (!open || !open->is(clang::tok::l_paren)) { + return clang::CharSourceRange(); + } + auto close = clang::Lexer::findNextToken(open->getLocation(), source_manager, + lang_opts); + // An empty list is written as `()` or as `(void)`. The lexing here is raw, so + // `void` arrives as an identifier rather than as the keyword it is. + if (close && close->is(clang::tok::raw_identifier) && + close->getRawIdentifier() == "void") { + close = clang::Lexer::findNextToken(close->getLocation(), source_manager, + lang_opts); + } + if (!close || !close->is(clang::tok::r_paren)) { + return clang::CharSourceRange(); + } + return clang::CharSourceRange::getCharRange(open->getLocation(), + close->getEndLoc()); +} + +// Returns the label to attach for a Clang note, which says more about the +// diagnostic it follows rather than reporting a problem of its own. +static auto GetNoteLabel() -> const Diagnostics::LabelBase& { + CARBON_DIAGNOSTIC_LABEL(CppInteropParseNote, Info, "{0}", std::string); + return CppInteropParseNote; +} + +// Returns the label to attach for what a note says about the source it marks, +// as opposed to the declaration the note names. +static auto GetNoteReasonLabel() -> const Diagnostics::LabelBase& { + CARBON_DIAGNOSTIC_LABEL(CppInteropParseNoteReason, Info, "{0}", std::string); + return CppInteropParseNoteReason; +} + +// Attaches what `info` marks: the ranges Clang would underline, which say +// nothing the message doesn't and so only mark, and the changes it suggests, +// which explain rather than state and so carry words. +// +// A range belonging to the leading diagnostic is part of the problem; one +// belonging to a note explains it, the same as the note itself does. +// +// `to_loc` maps a Clang range onto whatever locations the builder takes. +template +static auto AttachMarks(BuilderT& builder, + const CppDiagnosticListener::Diagnostic& info, + bool is_note, ToLocT to_loc) -> void { + for (clang::CharSourceRange range : info.ranges) { + builder.Attach(to_loc(range), is_note + ? Diagnostics::LabelCategory::Info + : Diagnostics::LabelCategory::Primary); + } + for (const CppDiagnosticListener::FixIt& fix_it : info.fix_its) { + AttachFixIt(builder, to_loc(fix_it.range), fix_it); + } +} + +// Attaches `note_info`, a note trailing the diagnostic being built: its words +// on the declaration it names, its reason half -- when it split into one -- +// on the source that half is about, and then whatever it marks. +template +static auto AttachNote(BuilderT& builder, + const CppDiagnosticListener::Diagnostic& note_info, + ToLocT to_loc) -> void { + builder.Attach(to_loc(note_info.location), GetNoteLabel(), note_info.message); + if (!note_info.reason.empty()) { + builder.Attach(to_loc(note_info.reason_range), GetNoteReasonLabel(), + note_info.reason); + } + AttachMarks(builder, note_info, /*is_note=*/true, to_loc); +} + // A listener that emits Clang diagnostics directly to a provided Carbon // Diagnostics::Consumer when no Carbon Context is active. class FallbackDiagnosticListener : public CppDiagnosticListener { @@ -97,19 +278,16 @@ class FallbackDiagnosticListener : public CppDiagnosticListener { } ClangLocDiagnosticEmitter emitter(carbon_consumer_, diags[0].source_manager); + auto as_range = [](clang::CharSourceRange range) { return range; }; for (size_t i = 0; i != diags.size(); ++i) { const Diagnostic& info = diags[i]; auto builder = emitter.Build(info.location, GetDiagnostic(info.level), info.message); - builder.OverrideSnippet(info.snippet); + AttachMarks(builder, info, /*is_note=*/false, as_range); for (; i + 1 < diags.size() && diags[i + 1].level == clang::DiagnosticsEngine::Note; ++i) { - const Diagnostic& note_info = diags[i + 1]; - builder - .Note(note_info.location, GetDiagnostic(note_info.level), - note_info.message) - .OverrideSnippet(note_info.snippet); + AttachNote(builder, diags[i + 1], as_range); } builder.Emit(); } @@ -142,17 +320,14 @@ class ContextDiagnosticListener : public CppDiagnosticListener { auto builder = context_->emitter().Build(SemIR::LocId(import_ir_inst_id), GetDiagnostic(info.level), info.message); - builder.OverrideSnippet(info.snippet); + auto as_loc_id = [&](clang::CharSourceRange range) { + return SemIR::LocId(AddImportIRInst(context_->sem_ir(), range)); + }; + AttachMarks(builder, info, /*is_note=*/false, as_loc_id); for (; i + 1 < diags.size() && diags[i + 1].level == clang::DiagnosticsEngine::Note; ++i) { - const Diagnostic& note_info = diags[i + 1]; - SemIR::ImportIRInstId note_import_ir_inst_id = - AddImportIRInst(context_->sem_ir(), note_info.location); - builder - .Note(SemIR::LocId(note_import_ir_inst_id), - GetDiagnostic(note_info.level), note_info.message) - .OverrideSnippet(note_info.snippet); + AttachNote(builder, diags[i + 1], as_loc_id); } // TODO: This will apply all current Carbon annotation functions. We // should instead track how Clang's context notes and Carbon's annotation @@ -227,63 +402,118 @@ class CarbonClangDiagnosticConsumer : public clang::DiagnosticConsumer { llvm::SmallString<256> message; info.FormatDiagnostic(message); - // Render a code snippet including any highlighted ranges and fixit hints. - // TODO: Also include the #include stack and macro expansion stack in the - // diagnostic output in some way. - RawStringOstream snippet_stream; - if (!info.hasSourceManager()) { - // If we don't have a source manager, this is an error from early in the - // frontend. Don't produce a snippet. - CARBON_CHECK(info.getLocation().isInvalid()); - } else { - CodeContextRenderer(snippet_stream, invocation_->getLangOpts(), - invocation_->getDiagnosticOpts()) - .emitDiagnostic( - clang::FullSourceLoc(info.getLocation(), info.getSourceManager()), - diag_level, message, info.getRanges(), info.getFixItHints()); - } - + // What Clang would underline and what it suggests changing, kept as ranges + // rather than as text: the toolchain marks and labels them itself, so that + // a diagnostic from C++ reads like one from Carbon. The `#include` and + // macro-expansion stacks reach the location as `included from` and + // `expanded from macro defined at` steps, drawn like any other path a + // location was reached by. const clang::SourceManager* source_manager = info.hasSourceManager() ? &info.getSourceManager() : nullptr; + + // Clang's token ranges reach to the start of their last token rather than + // past it, so they are widened here. Everything downstream then measures a + // range by subtracting its ends, and an empty one is an insertion point + // rather than a range that happens to name one token. + auto as_char_range = [&](clang::CharSourceRange range) { + if (!source_manager) { + return range; + } + return clang::Lexer::getAsCharRange(range, *source_manager, + invocation_->getLangOpts()); + }; + llvm::SmallVector ranges; + for (clang::CharSourceRange range : info.getRanges()) { + ranges.push_back(as_char_range(range)); + } + llvm::SmallVector fix_its; + for (const clang::FixItHint& hint : info.getFixItHints()) { + // A hint copying code from elsewhere carries it in `InsertFromRange`, + // which nothing here reads; presented as the removal its empty + // `CodeToInsert` looks like, it would instruct the opposite edit. + // TODO: Map such a hint to an insertion of the text `InsertFromRange` + // names. + if (hint.isNull() || hint.InsertFromRange.isValid()) { + continue; + } + // Widening fails for a token range ending inside a macro; Clang's own + // rendering drops such a fix-it too. + clang::CharSourceRange range = as_char_range(hint.RemoveRange); + if (range.isInvalid()) { + continue; + } + fix_its.push_back({.range = range, .text = hint.CodeToInsert}); + } + + // A Clang location names a point, and is marked as the one column Clang's + // own caret marks. How far it reaches is said only by a range attached + // alongside it, and a location can name the middle of a token, as one in + // a format string does. + clang::SourceLocation begin = info.getLocation(); + clang::CharSourceRange location = + clang::CharSourceRange::getCharRange(begin, begin); + + // Clang draws a range holding the caret as part of the caret's own mark + // rather than beside it -- the `~~~~` of a `^~~~~` -- so such a range is + // what the message is about rather than something else it points at. The + // rest stay marks of their own. + // + // TODO: Also mark where the caret is within the range, as Clang's + // `~~~^~~~` does. That needs the renderer to be able to mark a point + // inside a range it underlines. + if (source_manager && begin.isValid()) { + auto* found = llvm::find_if(ranges, [&](clang::CharSourceRange range) { + return Contains(*source_manager, range, begin); + }); + if (found != ranges.end()) { + location = *found; + ranges.erase(found); + } + } + + if (!source_manager) { + // Without a source manager this is an error from early in the frontend, + // and there is nothing to mark. + CARBON_CHECK(info.getLocation().isInvalid()); + ranges.clear(); + fix_its.clear(); + } + + // A note that says one thing about the declaration it names and another + // about the source it marks becomes a label on each, rather than one + // sentence hung off the name. Which notes are written that way is stated + // by `SplitsIntoCandidateAndReason` rather than guessed at from the text. + llvm::StringRef head = message.str(); + llvm::StringRef reason; + clang::CharSourceRange reason_range; + if (source_manager && SplitsIntoCandidateAndReason(info.getID()) && + !ranges.empty()) { + if (ranges.front().isInvalid()) { + ranges.front() = FindEmptyParameterList( + *source_manager, invocation_->getLangOpts(), begin); + } + auto [before, after] = head.split(": "); + if (ranges.front().isValid() && !after.empty()) { + head = before; + reason = after; + reason_range = ranges.front(); + ranges.erase(ranges.begin()); + } + } + llvm::erase_if( + ranges, [](clang::CharSourceRange range) { return range.isInvalid(); }); + diagnostic_infos_.push_back({.level = diag_level, - .location = info.getLocation(), + .location = location, .source_manager = source_manager, - .message = message.str().str(), - .snippet = snippet_stream.TakeStr()}); + .message = head.str(), + .reason = reason.str(), + .reason_range = reason_range, + .ranges = std::move(ranges), + .fix_its = std::move(fix_its)}); } private: - // A diagnostics renderer based on clang's TextDiagnostic that captures just - // the code context (the snippet). - class CodeContextRenderer : public clang::TextDiagnostic { - protected: - using TextDiagnostic::TextDiagnostic; - - void emitDiagnosticMessage( - clang::FullSourceLoc /*loc*/, clang::PresumedLoc /*ploc*/, - clang::DiagnosticsEngine::Level /*level*/, llvm::StringRef /*message*/, - llvm::ArrayRef /*ranges*/, - clang::DiagOrStoredDiag /*info*/) override {} - void emitDiagnosticLoc( - clang::FullSourceLoc /*loc*/, clang::PresumedLoc /*ploc*/, - clang::DiagnosticsEngine::Level /*level*/, - llvm::ArrayRef /*ranges*/) override {} - - // emitCodeContext is inherited from clang::TextDiagnostic. - - void emitIncludeLocation(clang::FullSourceLoc /*loc*/, - clang::PresumedLoc /*ploc*/) override {} - void emitImportLocation(clang::FullSourceLoc /*loc*/, - clang::PresumedLoc /*ploc*/, - llvm::StringRef /*module_name*/) override {} - void emitBuildingModuleLocation(clang::FullSourceLoc /*loc*/, - clang::PresumedLoc /*ploc*/, - llvm::StringRef /*module_name*/) override {} - - // beginDiagnostic and endDiagnostic are inherited from - // clang::TextDiagnostic in case it wants to do any setup / teardown work. - }; - llvm::SmallVector diagnostic_infos_; llvm::SmallVector listeners_; FallbackDiagnosticListener fallback_listener_; diff --git a/toolchain/check/cpp/diagnostic_listener.h b/toolchain/check/cpp/diagnostic_listener.h index 710a1234c09c..6059b7302399 100644 --- a/toolchain/check/cpp/diagnostic_listener.h +++ b/toolchain/check/cpp/diagnostic_listener.h @@ -10,6 +10,7 @@ #include "clang/Basic/Diagnostic.h" #include "clang/Basic/SourceLocation.h" #include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/SmallVector.h" namespace clang { class SourceManager; @@ -26,12 +27,34 @@ class CarbonClangDiagnosticConsumer; // itself on destruction. class CppDiagnosticListener { public: + // A change Clang suggests: what to put in `range`, which is empty for an + // insertion and where `text` is empty for a deletion. + struct FixIt { + clang::CharSourceRange range; + std::string text; + }; + struct Diagnostic { clang::DiagnosticsEngine::Level level; - clang::SourceLocation location; + // Where the diagnostic points: the one column its location names, or the + // range holding that column when one was attached, which Clang draws as + // the caret's own `^~~~`. + clang::CharSourceRange location; const clang::SourceManager* source_manager = nullptr; std::string message; - std::string snippet; + // What a note says about `reason_range` rather than about the declaration + // it names, split off from `message`, or empty for a note that says only + // one thing. Clang words a candidate note as ": " and marks the source the second half is about, which is + // two labels here rather than one sentence hung off the name. + std::string reason; + clang::CharSourceRange reason_range; + // What Clang would underline, which becomes the ranges the diagnostic + // marks. Clang's own rendering of them is not kept: the toolchain draws + // these the way it draws its own. `reason_range` is not among them, since + // it carries words instead. + llvm::SmallVector ranges; + llvm::SmallVector fix_its; }; explicit CppDiagnosticListener(CarbonClangDiagnosticConsumer& consumer); diff --git a/toolchain/check/cpp/export.cpp b/toolchain/check/cpp/export.cpp index 5173aa7f268d..c44e8d8a3a44 100644 --- a/toolchain/check/cpp/export.cpp +++ b/toolchain/check/cpp/export.cpp @@ -1647,12 +1647,13 @@ auto ExportFunctionToCppPointerConversion( ExportedFunctionPtrTypeMismatch, Error, "can't convert exported {0:member |}function pointer to `{1}`", Diagnostics::BoolAsSelect, CppType); - CARBON_DIAGNOSTIC(ExportedFromFunction, Note, - "function exported with pointer type `{0}`", CppType); + CARBON_DIAGNOSTIC_LABEL(ExportedFromFunction, Info, + "function exported with pointer type `{0}`", + CppType); context.emitter() .Build(src_id, ExportedFunctionPtrTypeMismatch, src_ptr_type->isMemberFunctionPointerType(), dest_ptr_type) - .Note(function.first_decl_id(), ExportedFromFunction, src_ptr_type) + .Attach(function.first_decl_id(), ExportedFromFunction, src_ptr_type) .Emit(); } return false; diff --git a/toolchain/check/cpp/impl_lookup.cpp b/toolchain/check/cpp/impl_lookup.cpp index d2a42551f414..d1d86e785202 100644 --- a/toolchain/check/cpp/impl_lookup.cpp +++ b/toolchain/check/cpp/impl_lookup.cpp @@ -147,11 +147,12 @@ static auto BuildCopyWitness(Context& context, SemIR::LocId loc_id, auto class_type_id = SemIR::TypeId::ForTypeConstant(query_self_const_id); if (!Check::RequireCompleteType( context, class_type_id, SemIR::LocId::None, [&](auto& builder) { - CARBON_DIAGNOSTIC(IncompleteTypeInCopyWitness, Context, - "argument to C++ call has incomplete type {0}", - SemIR::TypeId); - builder.Context(loc_id, IncompleteTypeInCopyWitness, - class_type_id); + CARBON_DIAGNOSTIC_CONTEXT( + IncompleteTypeInCopyWitness, + "argument to C++ call has incomplete type {0}", + SemIR::TypeId); + builder.Attach(loc_id, IncompleteTypeInCopyWitness, + class_type_id); })) { return SemIR::ErrorInst::InstId; } diff --git a/toolchain/check/cpp/import.cpp b/toolchain/check/cpp/import.cpp index 4d2c2868b9c8..864b0b5c7a6a 100644 --- a/toolchain/check/cpp/import.cpp +++ b/toolchain/check/cpp/import.cpp @@ -2071,9 +2071,9 @@ static auto ImportFunctionDecl(Context& context, SemIR::LocId loc_id, if (IsCppThunkRequired(context, callee_info)) { Diagnostics::AnnotationScope annotate_diagnostics( &context.emitter(), [&](auto& builder) { - CARBON_DIAGNOSTIC(InCppThunk, Note, - "in thunk for C++ function used here"); - builder.Note(loc_id, InCppThunk); + CARBON_DIAGNOSTIC_LABEL(InCppThunk, Info, + "in thunk for C++ function used here"); + builder.Attach(loc_id, InCppThunk); }); DefineAsThunkCall(context, loc_id, callee_info, imported_function); } else { @@ -2138,9 +2138,10 @@ auto ImportFunctionPointerInvoke( } Diagnostics::AnnotationScope annotate_diagnostics( &context.emitter(), [&](auto& builder) { - CARBON_DIAGNOSTIC(InCppFunctionPointerThunk, Note, - "in thunk for C++ function pointer type used here"); - builder.Note(loc_id, InCppFunctionPointerThunk); + CARBON_DIAGNOSTIC_LABEL( + InCppFunctionPointerThunk, Info, + "in thunk for C++ function pointer type used here"); + builder.Attach(loc_id, InCppFunctionPointerThunk); }); CppCalleeFunctionInfo callee_info(context, info.clang_type); @@ -2744,9 +2745,10 @@ auto ImportNameFromCpp(Context& context, SemIR::LocId loc_id, -> SemIR::ScopeLookupResult { Diagnostics::AnnotationScope annotate_diagnostics( &context.emitter(), [&](auto& builder) { - CARBON_DIAGNOSTIC(InCppNameLookup, Note, - "in `Cpp` name lookup for `{0}`", SemIR::NameId); - builder.Note(loc_id, InCppNameLookup, name_id); + CARBON_DIAGNOSTIC_LABEL(InCppNameLookup, Info, + "in `Cpp` name lookup for `{0}`", + SemIR::NameId); + builder.Attach(loc_id, InCppNameLookup, name_id); }); if (IsIncompleteClass(context, scope_id)) { return SemIR::ScopeLookupResult::MakeError(); diff --git a/toolchain/check/cpp/location.cpp b/toolchain/check/cpp/location.cpp index 2f0e3e69e470..31c440404df9 100644 --- a/toolchain/check/cpp/location.cpp +++ b/toolchain/check/cpp/location.cpp @@ -6,6 +6,7 @@ #include "clang/AST/ASTContext.h" #include "clang/Basic/SourceManager.h" +#include "toolchain/lex/tokenized_buffer.h" #include "toolchain/sem_ir/absolute_node_ref.h" #include "toolchain/sem_ir/ids.h" @@ -68,8 +69,10 @@ auto GetCppLocation(Context& context, SemIR::LocId loc_id) SemIR::GetAbsoluteNodeRef(&context.sem_ir(), loc_id); const auto& final_node = absolute_node_refs.back(); if (final_node.is_cpp()) { - return final_node.file()->clang_source_locs().Get( - final_node.clang_source_loc_id()); + return final_node.file() + ->clang_source_locs() + .Get(final_node.clang_source_loc_id()) + .getBegin(); } if (!final_node.node_id().has_value()) { @@ -88,11 +91,55 @@ auto GetCppLocation(Context& context, SemIR::LocId loc_id) return start_loc.getLocWithOffset(offset); } -auto AddImportIRInst(SemIR::File& file, clang::SourceLocation clang_source_loc) +auto GetCppRange(Context& context, SemIR::LocId loc_id) + -> clang::CharSourceRange { + if (!context.sem_ir().cpp_file()) { + return clang::CharSourceRange(); + } + + llvm::SmallVector absolute_node_refs = + SemIR::GetAbsoluteNodeRef(&context.sem_ir(), loc_id); + const auto& final_node = absolute_node_refs.back(); + if (final_node.is_cpp()) { + auto loc = GetCppLocation(context, loc_id); + return clang::CharSourceRange::getTokenRange(loc, loc); + } + if (!final_node.node_id().has_value()) { + return clang::CharSourceRange(); + } + + auto [ir, start_loc] = GetFileInfo(context, final_node.check_ir_id()); + const auto& tokens = ir->parse_tree().tokens(); + auto token = ir->parse_tree().node_token(final_node.node_id()); + // Only the file being checked has its subtrees available, since a `Context` + // holds the one `TreeAndSubtrees`. + Lex::InclusiveTokenRange token_range = {.begin = token, .end = token}; + if (final_node.check_ir_id() == context.sem_ir().check_ir_id()) { + token_range = context.parse_tree_and_subtrees().GetSubtreeTokenRange( + final_node.node_id()); + } + return clang::CharSourceRange::getCharRange( + start_loc.getLocWithOffset(tokens.GetByteOffset(token_range.begin)), + start_loc.getLocWithOffset(tokens.GetByteOffset(token_range.end) + + tokens.GetTokenText(token_range.end).size())); +} + +auto AddImportIRInst(SemIR::File& file, clang::CharSourceRange clang_range) -> SemIR::ImportIRInstId { + // Stored as its two ends: every range reaching here is a character range, so + // `CharSourceRange`'s token-or-character bit would always say the same thing + // and cost a word to say it. Rebuilt as one where it is read. + CARBON_CHECK(!clang_range.isTokenRange(), + "A token range would lose which it was; widen it first."); SemIR::ClangSourceLocId clang_source_loc_id = - file.clang_source_locs().Add(clang_source_loc); + file.clang_source_locs().Add(clang_range.getAsRange()); return file.import_ir_insts().Add(SemIR::ImportIRInst(clang_source_loc_id)); } +auto AddImportIRInst(SemIR::File& file, clang::SourceLocation clang_source_loc) + -> SemIR::ImportIRInstId { + return AddImportIRInst(file, clang::CharSourceRange::getCharRange( + clang_source_loc, clang_source_loc)); +} + } // namespace Carbon::Check diff --git a/toolchain/check/cpp/location.h b/toolchain/check/cpp/location.h index 021059f9fc90..53660e70a8ae 100644 --- a/toolchain/check/cpp/location.h +++ b/toolchain/check/cpp/location.h @@ -14,8 +14,26 @@ namespace Carbon::Check { auto GetCppLocation(Context& context, SemIR::LocId loc_id) -> clang::SourceLocation; -// Adds an `ImportIRInst` referring to the given source location and returns a -// corresponding `ImportIRInstId` that can be used to construct a `LocId`. +// Maps a Carbon source location into the Clang range covering the source a +// Carbon diagnostic marked with it would underline, which is everything the +// node spans rather than the one token it names. +// +// In Carbon source this is a character range, since Clang finds the end of a +// token range by lexing the token there as C++. Only the file being checked has +// its subtrees available, so a location in an imported file gives the range of +// the one token `GetCppLocation` names. A location that is already in C++ gives +// a token range at that token, which Clang can measure. +auto GetCppRange(Context& context, SemIR::LocId loc_id) + -> clang::CharSourceRange; + +// Adds an `ImportIRInst` referring to the given source range and returns a +// corresponding `ImportIRInstId` that can be used to construct a `LocId`. The +// range is what a diagnostic marking the location underlines. +auto AddImportIRInst(SemIR::File& file, clang::CharSourceRange clang_range) + -> SemIR::ImportIRInstId; + +// The same for a Clang location, which is a point and marks the one column it +// names. auto AddImportIRInst(SemIR::File& file, clang::SourceLocation clang_source_loc) -> SemIR::ImportIRInstId; diff --git a/toolchain/check/cpp/operators.cpp b/toolchain/check/cpp/operators.cpp index 6b5e64228a07..4474311efae5 100644 --- a/toolchain/check/cpp/operators.cpp +++ b/toolchain/check/cpp/operators.cpp @@ -673,12 +673,12 @@ struct DiagnoseIncompleteOperandTypeInCppOperatorLookup { SemIR::LocId loc_id; void operator()(auto& builder) const { - CARBON_DIAGNOSTIC( - IncompleteOperandTypeInCppOperatorLookup, Context, + CARBON_DIAGNOSTIC_CONTEXT( + IncompleteOperandTypeInCppOperatorLookup, "looking up a C++ operator with incomplete operand type {0}", SemIR::TypeId); - builder.Context(loc_id, IncompleteOperandTypeInCppOperatorLookup, - arg_type_id); + builder.Attach(loc_id, IncompleteOperandTypeInCppOperatorLookup, + arg_type_id); } }; } // namespace diff --git a/toolchain/check/cpp/overload_resolution.cpp b/toolchain/check/cpp/overload_resolution.cpp index a06d6b376717..ecdc11cc6ff6 100644 --- a/toolchain/check/cpp/overload_resolution.cpp +++ b/toolchain/check/cpp/overload_resolution.cpp @@ -263,7 +263,7 @@ auto ComputeClangDeclSignatureFromBestViableFunction( } auto PerformCppOverloadResolution( - Context& context, SemIR::LocId loc_id, + Context& context, SemIR::LocId loc_id, SemIR::InstId callee_expr_id, const SemIR::CppOverloadSet& overload_set, llvm::ArrayRef template_arg_ids, SemIR::InstId self_id, llvm::ArrayRef arg_ids) -> SemIR::InstId { @@ -287,7 +287,13 @@ auto PerformCppOverloadResolution( } auto& arg_exprs = *maybe_arg_exprs; - clang::SourceLocation loc = GetCppLocation(context, loc_id); + // What a diagnostic about the call marks is the callee, not the call: the + // message names the callee, and the arguments it was given are described by + // the notes hanging off each candidate. This is where Clang points such a + // diagnostic too. + clang::CharSourceRange callee_range = + GetCppRange(context, SemIR::LocId(callee_expr_id)); + clang::SourceLocation loc = callee_range.getBegin(); // Add candidate functions from the name lookup. const auto& rewrite_info = overload_set.operator_rewrite_info; @@ -332,7 +338,8 @@ auto PerformCppOverloadResolution( candidate_set.NoteCandidates( clang::PartialDiagnosticAt( loc, sema.PDiag(clang::diag::err_ovl_no_viable_function_in_call) - << GetCppName(context, overload_set.name_id)), + << GetCppName(context, overload_set.name_id) + << callee_range), sema, clang::OCD_AllCandidates, arg_exprs); return SemIR::ErrorInst::InstId; } @@ -340,15 +347,27 @@ auto PerformCppOverloadResolution( candidate_set.NoteCandidates( clang::PartialDiagnosticAt( loc, sema.PDiag(clang::diag::err_ovl_ambiguous_call) - << GetCppName(context, overload_set.name_id)), + << GetCppName(context, overload_set.name_id) + << callee_range), sema, clang::OCD_AmbiguousCandidates, arg_exprs); return SemIR::ErrorInst::InstId; } case clang::OverloadingResult::OR_Deleted: { - sema.DiagnoseUseOfDeletedFunction( - loc, clang::SourceRange(loc, loc), - GetCppName(context, overload_set.name_id), candidate_set, - best_viable_fn->Function, arg_exprs); + // This is what `Sema::DiagnoseUseOfDeletedFunction` emits. That takes the + // callee's range as a `SourceRange`, whose end Clang would find by lexing + // the last Carbon token as C++. + clang::StringLiteral* deleted_message = + best_viable_fn->Function->getDeletedMessage(); + candidate_set.NoteCandidates( + clang::PartialDiagnosticAt( + loc, sema.PDiag(clang::diag::err_ovl_deleted_call) + << /*IsMember=*/false + << GetCppName(context, overload_set.name_id) + << (deleted_message != nullptr) + << (deleted_message ? deleted_message->getString() + : llvm::StringRef()) + << callee_range), + sema, clang::OCD_AllCandidates, arg_exprs); return SemIR::ErrorInst::InstId; } } diff --git a/toolchain/check/cpp/overload_resolution.h b/toolchain/check/cpp/overload_resolution.h index 49d7fe4ee9b7..ab2bb035fa9e 100644 --- a/toolchain/check/cpp/overload_resolution.h +++ b/toolchain/check/cpp/overload_resolution.h @@ -37,13 +37,17 @@ auto ComputeClangDeclSignatureFromBestViableFunction( // instruction referring to that function, or an error instruction if overload // resolution failed. // +// `callee_expr_id` is the expression naming the overload set, which is what a +// diagnostic about the resolution marks: the message names the callee, and what +// each candidate was given is described by the note hanging off it. +// // A set with a single non-templated function goes through the same rules for // overload resolution. This is to make sure that calls that have no viable // implicit conversion sequence are rejected even when an implicit conversion is // possible. Keeping the same behavior here for consistency and supporting // migrations so that the migrated callers from C++ remain valid. auto PerformCppOverloadResolution( - Context& context, SemIR::LocId loc_id, + Context& context, SemIR::LocId loc_id, SemIR::InstId callee_expr_id, const SemIR::CppOverloadSet& overload_set, llvm::ArrayRef template_arg_ids, SemIR::InstId self_id, llvm::ArrayRef arg_ids) -> SemIR::InstId; diff --git a/toolchain/check/decl_name_stack.cpp b/toolchain/check/decl_name_stack.cpp index f6c211264742..5ed4ed4de15d 100644 --- a/toolchain/check/decl_name_stack.cpp +++ b/toolchain/check/decl_name_stack.cpp @@ -393,11 +393,11 @@ static auto DiagnoseQualifiedDeclInIncompleteClassScope(Context& context, -> void { 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); + CARBON_DIAGNOSTIC_CONTEXT( + QualifiedDeclInIncompleteClassScope, + "cannot declare a member of incomplete class {0}", SemIR::TypeId); + builder.Attach(loc_id, QualifiedDeclInIncompleteClassScope, + context.classes().Get(class_id).self_type_id); }); DiagnoseIncompleteClass(context, class_id); } @@ -409,11 +409,11 @@ static auto DiagnoseQualifiedDeclInUndefinedInterfaceScope( SemIR::InstId interface_inst_id) -> void { 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); + CARBON_DIAGNOSTIC_CONTEXT( + QualifiedDeclInUndefinedInterfaceScope, + "cannot declare a member of undefined interface {0}", InstIdAsType); + builder.Attach(loc_id, QualifiedDeclInUndefinedInterfaceScope, + interface_inst_id); }); DiagnoseIncompleteInterface(context, interface_id); } @@ -426,11 +426,11 @@ static auto DiagnoseQualifiedDeclInImportedPackage(Context& context, -> void { CARBON_DIAGNOSTIC(QualifiedDeclOutsidePackage, Error, "imported packages cannot be used for declarations"); - CARBON_DIAGNOSTIC(QualifiedDeclOutsidePackageSource, Note, - "package imported here"); + CARBON_DIAGNOSTIC_LABEL(QualifiedDeclOutsidePackageSource, Info, + "package imported here"); context.emitter() .Build(use_loc_id, QualifiedDeclOutsidePackage) - .Note(import_loc_id, QualifiedDeclOutsidePackageSource) + .Attach(import_loc_id, QualifiedDeclOutsidePackageSource) .Emit(); } @@ -442,11 +442,11 @@ static auto DiagnoseQualifiedDeclInNonScope( CARBON_DIAGNOSTIC(QualifiedNameInNonScope, Error, "name qualifiers are only allowed for entities that " "provide a scope"); - CARBON_DIAGNOSTIC(QualifiedNameNonScopeEntity, Note, - "referenced non-scope entity declared here"); + CARBON_DIAGNOSTIC_LABEL(QualifiedNameNonScopeEntity, Info, + "referenced non-scope entity declared here"); context.emitter() .Build(use_loc_id, QualifiedNameInNonScope) - .Note(non_scope_entity_loc_id, QualifiedNameNonScopeEntity) + .Attach(non_scope_entity_loc_id, QualifiedNameNonScopeEntity) .Emit(); } diff --git a/toolchain/check/deduce.cpp b/toolchain/check/deduce.cpp index ad7d017498a1..9f0e5451aa39 100644 --- a/toolchain/check/deduce.cpp +++ b/toolchain/check/deduce.cpp @@ -213,11 +213,12 @@ class DeductionContext { auto& builder) -> void { if (auto param = context().insts().TryGetAs( param_id)) { - CARBON_DIAGNOSTIC(InitializingGenericParam, Note, - "initializing generic parameter `{0}` declared here", - SemIR::NameId); - builder.Note(loc_id, InitializingGenericParam, - context().entity_names().Get(param->entity_name_id).name_id); + CARBON_DIAGNOSTIC_LABEL( + InitializingGenericParam, Info, + "initializing generic parameter `{0}` declared here", SemIR::NameId); + builder.Attach( + loc_id, InitializingGenericParam, + context().entity_names().Get(param->entity_name_id).name_id); } else { NoteGenericHere(context(), generic_id_, builder); } @@ -241,9 +242,9 @@ class DeductionContext { static auto NoteGenericHere(Context& context, SemIR::GenericId generic_id, DiagnosticBuilder& diag) -> void { - CARBON_DIAGNOSTIC(DeductionGenericHere, Note, - "while deducing parameters of generic declared here"); - diag.Note(context.generics().Get(generic_id).decl_id, DeductionGenericHere); + CARBON_DIAGNOSTIC_LABEL(DeductionGenericHere, Info, + "while deducing parameters of generic declared here"); + diag.Attach(context.generics().Get(generic_id).decl_id, DeductionGenericHere); } DeductionContext::DeductionContext(Context* context, SemIR::LocId loc_id, @@ -549,12 +550,12 @@ auto DeductionContext::CheckDeductionIsComplete() -> bool { { Diagnostics::ContextScope diag_context( &context().emitter(), [&](auto& builder) { - CARBON_DIAGNOSTIC( - SubstitutingGenericParamType, Context, + CARBON_DIAGNOSTIC_CONTEXT( + SubstitutingGenericParamType, "constructed invalid specific for {0} from argument", SemIR::TypeId); - builder.Context(loc_id_, SubstitutingGenericParamType, - binding_type_id); + builder.Attach(loc_id_, SubstitutingGenericParamType, + binding_type_id); }); auto param_type_const_id = SubstConstant(context(), SemIR::LocId(binding_id), diff --git a/toolchain/check/diagnostic_emitter.cpp b/toolchain/check/diagnostic_emitter.cpp index 2452310d3310..63eeab478f4f 100644 --- a/toolchain/check/diagnostic_emitter.cpp +++ b/toolchain/check/diagnostic_emitter.cpp @@ -24,26 +24,28 @@ auto DiagnosticEmitter::ConvertLoc(LocIdForDiagnostics loc_id, auto [imports, converted] = loc_converter_.ConvertWithImports( loc_id.loc_id(), loc_id.is_token_only()); for (const auto& import : imports) { - CARBON_DIAGNOSTIC(InImport, LocationInfo, "in import"); - CARBON_DIAGNOSTIC(InCppInclude, LocationInfo, "in file included here"); - CARBON_DIAGNOSTIC(InCppModule, LocationInfo, "in module imported here"); - CARBON_DIAGNOSTIC(InCppMacroExpansion, LocationInfo, - "in expansion of macro defined here"); + // These are rendered as `: `, hanging off the location + // they were reached from, so each reads as a step in a path. + CARBON_DIAGNOSTIC_LOCATION_INFO(InImport, "imported from"); + CARBON_DIAGNOSTIC_LOCATION_INFO(InCppInclude, "included from"); + CARBON_DIAGNOSTIC_LOCATION_INFO(InCppModule, "imported from module at"); + CARBON_DIAGNOSTIC_LOCATION_INFO(InCppMacroExpansion, + "expanded from macro defined at"); switch (import.kind) { case Carbon::SemIR::DiagnosticLocConverter::ImportLoc::Import: - // TODO: Include the library name in the note. + // TODO: Include the library name in the label. context_fn(import.loc, InImport); break; case Carbon::SemIR::DiagnosticLocConverter::ImportLoc::CppInclude: - // TODO: Include the file name in the note. + // TODO: Include the file name in the label. context_fn(import.loc, InCppInclude); break; case Carbon::SemIR::DiagnosticLocConverter::ImportLoc::CppModuleImport: - // TODO: Include the module name in the note. + // TODO: Include the module name in the label. context_fn(import.loc, InCppModule); break; case Carbon::SemIR::DiagnosticLocConverter::ImportLoc::CppMacroExpansion: - // TODO: Include the macro name in the note. + // TODO: Include the macro name in the label. // TODO: Include the Clang-generated snippet here rather than with the // main diagnostic. context_fn(import.loc, InCppMacroExpansion); diff --git a/toolchain/check/diagnostic_helpers.h b/toolchain/check/diagnostic_helpers.h index 690428fb8431..b1676933c54a 100644 --- a/toolchain/check/diagnostic_helpers.h +++ b/toolchain/check/diagnostic_helpers.h @@ -51,7 +51,7 @@ using DiagnosticEmitterBase = Diagnostics::Emitter; using DiagnosticBuilder = DiagnosticEmitterBase::Builder; using DiagnosticContextBuilder = DiagnosticEmitterBase::ContextBuilder; -// A function that adds a Context message for a diagnostic. +// A function that adds a context label to a diagnostic. using DiagnosticContextFn = llvm::function_refvoid>; diff --git a/toolchain/check/eval.cpp b/toolchain/check/eval.cpp index 652d5c5a02fb..bc102803874e 100644 --- a/toolchain/check/eval.cpp +++ b/toolchain/check/eval.cpp @@ -3019,13 +3019,13 @@ static auto MakeConstantForCall(EvalContext& eval_context, evaluation_mode == SemIR::Function::EvaluationMode::MustEval) { CARBON_DIAGNOSTIC(NonConstantCallToCompTimeOnlyFunction, Error, "non-constant call to compile-time-only function"); - CARBON_DIAGNOSTIC(CompTimeOnlyFunctionHere, Note, - "compile-time-only function declared here"); + CARBON_DIAGNOSTIC_LABEL(CompTimeOnlyFunctionHere, Info, + "compile-time-only function declared here"); const auto& function = eval_context.functions().Get( std::get(callee).function_id); eval_context.emitter() .Build(inst_id, NonConstantCallToCompTimeOnlyFunction) - .Note(function.latest_decl_id(), CompTimeOnlyFunctionHere) + .Attach(function.latest_decl_id(), CompTimeOnlyFunctionHere) .Emit(); } return SemIR::ConstantId::NotConstant; @@ -3606,10 +3606,10 @@ auto TryEvalBlockForSpecific(Context& context, SemIR::LocId loc_id, Diagnostics::ContextScope diagnostic_context( &context.emitter(), [&](auto& builder) { - CARBON_DIAGNOSTIC(ResolvingSpecificHere, SoftContext, - "unable to monomorphize specific {0}", - SemIR::SpecificId); - builder.Context(loc_id, ResolvingSpecificHere, specific_id); + CARBON_DIAGNOSTIC_SOFT_CONTEXT(ResolvingSpecificHere, + "unable to monomorphize specific {0}", + SemIR::SpecificId); + builder.Attach(loc_id, ResolvingSpecificHere, specific_id); }); for (auto [i, inst_id, result_id] : @@ -3970,9 +3970,9 @@ static auto TryEvalCall(EvalContext& outer_eval_context, SemIR::LocId loc_id, Diagnostics::AnnotationScope annotate_diagnostics( &eval_context.emitter(), [&](auto& builder) { - CARBON_DIAGNOSTIC(InCallToEvalFn, Note, "in call to {0} here", - SemIR::NameId); - builder.Note(loc_id, InCallToEvalFn, function.name_id); + CARBON_DIAGNOSTIC_LABEL(InCallToEvalFn, Info, "in call to {0} here", + SemIR::NameId); + builder.Attach(loc_id, InCallToEvalFn, function.name_id); }); // Execute the function decl block followed by the body. diff --git a/toolchain/check/eval_inst.cpp b/toolchain/check/eval_inst.cpp index a48ec5585386..7958d8a148f2 100644 --- a/toolchain/check/eval_inst.cpp +++ b/toolchain/check/eval_inst.cpp @@ -610,14 +610,14 @@ auto EvalConstantInst(Context& context, SemIR::InstId inst_id, if (complete_type_id.is_concrete()) { 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); + CARBON_DIAGNOSTIC_CONTEXT(IncompleteTypeInMonomorphization, + "{0} evaluates to incomplete type {1}", + InstIdAsType, InstIdAsType); + builder.Attach(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 diff --git a/toolchain/check/function.cpp b/toolchain/check/function.cpp index e5594c2e8e02..fa651e951b0b 100644 --- a/toolchain/check/function.cpp +++ b/toolchain/check/function.cpp @@ -260,16 +260,16 @@ auto CheckFunctionReturnTypeMatches(Context& context, : context.emitter().Build(new_function.latest_decl_id(), FunctionRedeclReturnTypeDiffersNoReturn); if (prev_return_type_id.has_value()) { - CARBON_DIAGNOSTIC(FunctionRedeclReturnTypePrevious, Note, - "previously declared with return type {0}", - SemIR::TypeId); - diag.Note(prev_function.latest_decl_id(), - FunctionRedeclReturnTypePrevious, prev_return_type_id); + CARBON_DIAGNOSTIC_LABEL(FunctionRedeclReturnTypePrevious, Info, + "previously declared with return type {0}", + SemIR::TypeId); + diag.Attach(prev_function.latest_decl_id(), + FunctionRedeclReturnTypePrevious, prev_return_type_id); } else { - CARBON_DIAGNOSTIC(FunctionRedeclReturnTypePreviousNoReturn, Note, - "previously declared with no return type"); - diag.Note(prev_function.latest_decl_id(), - FunctionRedeclReturnTypePreviousNoReturn); + CARBON_DIAGNOSTIC_LABEL(FunctionRedeclReturnTypePreviousNoReturn, Info, + "previously declared with no return type"); + diag.Attach(prev_function.latest_decl_id(), + FunctionRedeclReturnTypePreviousNoReturn); } diag.Emit(); return false; @@ -307,16 +307,17 @@ static auto CheckFunctionEvaluationModeMatches( "function redeclaration differs because new function is " "{0:=-1:not `eval`|=-2:not `musteval`|=1:`eval`|=2:`musteval`}", Diagnostics::IntAsSelect); - CARBON_DIAGNOSTIC(FunctionRedeclEvaluationModePrevious, Note, - "previously {0:<0:not |:}declared as " - "{0:=-1:`eval`|=-2:`musteval`|=1:`eval`|=2:`musteval`}", - Diagnostics::IntAsSelect); + CARBON_DIAGNOSTIC_LABEL( + FunctionRedeclEvaluationModePrevious, Info, + "previously {0:<0:not |:}declared as " + "{0:=-1:`eval`|=-2:`musteval`|=1:`eval`|=2:`musteval`}", + Diagnostics::IntAsSelect); context.emitter() .Build(new_function.latest_decl_id(), FunctionRedeclEvaluationModeDiffers, new_eval_mode_index ? new_eval_mode_index : -prev_eval_mode_index) - .Note(prev_function.latest_decl_id(), - FunctionRedeclEvaluationModePrevious, - prev_eval_mode_index ? prev_eval_mode_index : -new_eval_mode_index) + .Attach( + prev_function.latest_decl_id(), FunctionRedeclEvaluationModePrevious, + prev_eval_mode_index ? prev_eval_mode_index : -new_eval_mode_index) .Emit(); return false; } @@ -356,18 +357,18 @@ auto CheckFunctionReturnPatternType(Context& context, SemIR::LocId loc_id, if (!RequireConcreteType( context, arg_type_id, SemIR::LocId(return_pattern_id), [&](auto& builder) { - CARBON_DIAGNOSTIC(IncompleteTypeInFunctionReturnType, Context, - "function returns incomplete type {0}", - SemIR::TypeId); - builder.Context(loc_id, IncompleteTypeInFunctionReturnType, - arg_type_id); + CARBON_DIAGNOSTIC_CONTEXT(IncompleteTypeInFunctionReturnType, + "function returns incomplete type {0}", + SemIR::TypeId); + builder.Attach(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); + CARBON_DIAGNOSTIC_CONTEXT(AbstractTypeInFunctionReturnType, + "function returns abstract type {0}", + SemIR::TypeId); + builder.Attach(loc_id, AbstractTypeInFunctionReturnType, + arg_type_id); })) { return SemIR::ErrorInst::TypeId; } @@ -419,12 +420,12 @@ auto CheckFunctionDefinitionSignature(Context& context, RequireCompleteType( context, context.insts().Get(param_ref_id).type_id(), SemIR::LocId(param_ref_id), [&](auto& builder) { - CARBON_DIAGNOSTIC( - IncompleteTypeInFunctionParam, Context, + CARBON_DIAGNOSTIC_CONTEXT( + IncompleteTypeInFunctionParam, "parameter has incomplete type {0} in function definition", TypeOfInstId); - builder.Context(param_ref_id, IncompleteTypeInFunctionParam, - param_ref_id); + builder.Attach(param_ref_id, IncompleteTypeInFunctionParam, + param_ref_id); }); } @@ -684,20 +685,21 @@ static auto CheckDefaults(Context& context, SemIR::Function& function) if (!state->patterns_missing_defaults.empty()) { CARBON_DIAGNOSTIC(RequiredPatternDefaultValueMissing, Error, "this pattern is missing a required default value."); - CARBON_DIAGNOSTIC(RequiredPatternDefaultValueFirstDefault, Note, - "all patterns to the right of this first pattern with " - "a default value must also specify a default value."); - CARBON_DIAGNOSTIC( - RequiredPatternDefaultValueMissingAdditional, Note, + CARBON_DIAGNOSTIC_LABEL(RequiredPatternDefaultValueFirstDefault, Info, + "all patterns to the right of this first pattern " + "with a default value must also specify a " + "default value."); + CARBON_DIAGNOSTIC_LABEL( + RequiredPatternDefaultValueMissingAdditional, Primary, "this pattern is also missing a required default value."); auto inst_ref = llvm::ArrayRef(state->patterns_missing_defaults); auto builder = context.emitter().Build( inst_ref.consume_front(), RequiredPatternDefaultValueMissing); for (auto inst_id : inst_ref) { - builder.Note(inst_id, RequiredPatternDefaultValueMissingAdditional); + builder.Attach(inst_id, RequiredPatternDefaultValueMissingAdditional); } - builder.Note(state->first_pattern_with_default, - RequiredPatternDefaultValueFirstDefault); + builder.Attach(state->first_pattern_with_default, + RequiredPatternDefaultValueFirstDefault); builder.Emit(); } diff --git a/toolchain/check/handle_binding_pattern.cpp b/toolchain/check/handle_binding_pattern.cpp index 801f3ce6945f..034e3cfb8d11 100644 --- a/toolchain/check/handle_binding_pattern.cpp +++ b/toolchain/check/handle_binding_pattern.cpp @@ -101,9 +101,9 @@ static auto IsValidParamForIntroducer(Context& context, SemIR::LocId loc_id, auto builder = context.emitter().Build(loc_id, GenericParamMustBeConstant); if (is_var) { - CARBON_DIAGNOSTIC(VarParamIsRuntime, Note, - "`var` parameters are runtime"); - builder.Note(loc_id, VarParamIsRuntime); + CARBON_DIAGNOSTIC_LABEL(VarParamIsRuntime, Info, + "`var` parameters are runtime"); + builder.Attach(loc_id, VarParamIsRuntime); } builder.Emit(); return false; @@ -372,12 +372,12 @@ static auto HandleAnyBindingPattern(Context& context, Parse::NodeId node_id, }; auto abstract_diagnostic_context = [&](auto& builder) { - CARBON_DIAGNOSTIC(AbstractTypeInVarPattern, Context, - "binding pattern has abstract type {0} in `var` " - "pattern", - SemIR::TypeId); - builder.Context(type_expr.node_id, AbstractTypeInVarPattern, - type_expr.type_component_id); + CARBON_DIAGNOSTIC_CONTEXT(AbstractTypeInVarPattern, + "binding pattern has abstract type {0} in `var` " + "pattern", + SemIR::TypeId); + builder.Attach(type_expr.node_id, AbstractTypeInVarPattern, + type_expr.type_component_id); }; // A `self` binding must be the first parameter in the explicit parameter @@ -516,12 +516,13 @@ static auto HandleAnyBindingPattern(Context& context, Parse::NodeId node_id, return context.TODO(node_id, "support local form bindings"); } auto incomplete_diagnostic_context = [&](auto& builder) { - CARBON_DIAGNOSTIC(IncompleteTypeInBindingDecl, Context, - "binding pattern has incomplete type {0} in name " - "binding declaration", - InstIdAsType); - builder.Context(type_expr.node_id, IncompleteTypeInBindingDecl, - type_expr.inst_id); + CARBON_DIAGNOSTIC_CONTEXT( + IncompleteTypeInBindingDecl, + "binding pattern has incomplete type {0} in name " + "binding declaration", + InstIdAsType); + builder.Attach(type_expr.node_id, IncompleteTypeInBindingDecl, + type_expr.inst_id); }; if (node_kind == Parse::NodeKind::VarBindingPattern) { if (!RequireConcreteType( diff --git a/toolchain/check/handle_class.cpp b/toolchain/check/handle_class.cpp index f2f70fcd3aed..75a627ab9f66 100644 --- a/toolchain/check/handle_class.cpp +++ b/toolchain/check/handle_class.cpp @@ -216,13 +216,13 @@ static auto DiagnoseClassSpecificDeclRepeated(Context& context, CARBON_DIAGNOSTIC(BaseDeclRepeated, Error, "multiple `base` declarations in class; multiple " "inheritance is not permitted"); - CARBON_DIAGNOSTIC(ClassSpecificDeclPrevious, Note, - "previous `{0}` declaration is here", Lex::TokenKind); + CARBON_DIAGNOSTIC_LABEL(ClassSpecificDeclPrevious, Info, + "previous `{0}` declaration is here", Lex::TokenKind); CARBON_CHECK(tok == Lex::TokenKind::Adapt || tok == Lex::TokenKind::Base); context.emitter() .Build(new_loc_id, tok == Lex::TokenKind::Adapt ? AdaptDeclRepeated : BaseDeclRepeated) - .Note(prev_loc_id, ClassSpecificDeclPrevious, tok) + .Attach(prev_loc_id, ClassSpecificDeclPrevious, tok) .Emit(); } @@ -260,18 +260,18 @@ auto HandleParseNode(Context& context, Parse::AdaptDeclId node_id) -> bool { 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); + CARBON_DIAGNOSTIC_CONTEXT(IncompleteTypeInAdaptDecl, + "adapted type {0} is an incomplete type", + InstIdAsType); + builder.Attach(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); + CARBON_DIAGNOSTIC_CONTEXT(AbstractTypeInAdaptDecl, + "adapted type {0} is an abstract type", + InstIdAsType); + builder.Attach(node_id, AbstractTypeInAdaptDecl, + adapted_type_inst_id); })) { adapted_type_id = SemIR::ErrorInst::TypeId; } @@ -336,9 +336,10 @@ static auto CheckBaseType(Context& context, Parse::NodeId node_id, 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); + CARBON_DIAGNOSTIC_CONTEXT(IncompleteTypeInBaseDecl, + "base {0} is an incomplete type", + InstIdAsType); + builder.Attach(node_id, IncompleteTypeInBaseDecl, base_type_inst_id); })) { return BaseInfo::Error; } diff --git a/toolchain/check/handle_export.cpp b/toolchain/check/handle_export.cpp index ad18d7949823..ad4b9eec0890 100644 --- a/toolchain/check/handle_export.cpp +++ b/toolchain/check/handle_export.cpp @@ -58,7 +58,7 @@ auto HandleParseNode(Context& context, Parse::ExportDeclId node_id) -> bool { if (inst.Is()) { CARBON_DIAGNOSTIC(ExportRedundant, Warning, "`export` matches previous `export`"); - CARBON_DIAGNOSTIC(ExportPrevious, Note, "previous `export` here"); + CARBON_DIAGNOSTIC_LABEL(ExportPrevious, Info, "previous `export` here"); context.emitter() .Build(node_id, ExportRedundant) // Use the location of the export itself, not the exported instruction. @@ -67,7 +67,7 @@ auto HandleParseNode(Context& context, Parse::ExportDeclId node_id) -> bool { // InstId prevents GetAbsoluteNodeIdImpl() from seeing the `ExportDecl` // instruction, which prevents it from chasing through it to the entity // being exported. It might be nice to make this more explicit. - .Note(context.insts().GetCanonicalLocId(inst_id), ExportPrevious) + .Attach(context.insts().GetCanonicalLocId(inst_id), ExportPrevious) .Emit(); return true; } @@ -76,11 +76,11 @@ auto HandleParseNode(Context& context, Parse::ExportDeclId node_id) -> bool { if (!import_ref) { CARBON_DIAGNOSTIC(ExportNotImportedEntity, Error, "only imported entities are valid for `export`"); - CARBON_DIAGNOSTIC(ExportNotImportedEntitySource, Note, - "name is declared here"); + CARBON_DIAGNOSTIC_LABEL(ExportNotImportedEntitySource, Info, + "name is declared here"); context.emitter() .Build(node_id, ExportNotImportedEntity) - .Note(inst_id, ExportNotImportedEntitySource) + .Attach(inst_id, ExportNotImportedEntitySource) .Emit(); return true; } diff --git a/toolchain/check/handle_impl.cpp b/toolchain/check/handle_impl.cpp index d11deea1f399..a7ac0ef0ecfa 100644 --- a/toolchain/check/handle_impl.cpp +++ b/toolchain/check/handle_impl.cpp @@ -89,9 +89,9 @@ auto HandleParseNode(Context& context, Parse::ImplTypeAsId node_id) -> bool { // If the explicit self type is the default, suggest removing it with a // diagnostic, but continue as if no error occurred since the self-type // is semantically valid. - CARBON_DIAGNOSTIC(ExtendImplSelfAsDefault, Note, - "remove the explicit `Self` type here"); - diag.Note(self_node, ExtendImplSelfAsDefault); + CARBON_DIAGNOSTIC_LABEL(ExtendImplSelfAsDefault, Info, + "remove the explicit `Self` type here"); + diag.Attach(self_node, ExtendImplSelfAsDefault); if (self_type.type_id != SemIR::ErrorInst::TypeId) { diag.Emit(); } @@ -350,13 +350,13 @@ static auto BuildImplDecl(Context& context, Parse::AnyImplDeclId node_id, if (is_final && context.match_first_context()) { CARBON_DIAGNOSTIC(FinalImplInMatchFirst, Error, "`final impl` in `match_first` block"); - CARBON_DIAGNOSTIC( - FinalImplInMatchFirstNote, Note, + CARBON_DIAGNOSTIC_LABEL( + FinalImplInMatchFirstNote, Info, "the `match_first` block can be modified as `final` instead"); context.emitter() .Build(node_id, FinalImplInMatchFirst) - .Note(context.match_first_context()->decl_id, - FinalImplInMatchFirstNote) + .Attach(context.match_first_context()->decl_id, + FinalImplInMatchFirstNote) .Emit(); impl_had_error = true; } @@ -383,12 +383,12 @@ static auto BuildImplDecl(Context& context, Parse::AnyImplDeclId node_id, CARBON_DIAGNOSTIC( ImplInTwoMatchFirst, Error, "impl declared in `match_first` more than once"); - CARBON_DIAGNOSTIC(ImplInTwoMatchFirstNote, Note, - "previous declaration here"); + CARBON_DIAGNOSTIC_LABEL(ImplInTwoMatchFirstNote, Info, + "previous declaration here"); context.emitter() .Build(node_id, ImplInTwoMatchFirst) - .Note(prev_impl.decl_loc_in_match_first, - ImplInTwoMatchFirstNote) + .Attach(prev_impl.decl_loc_in_match_first, + ImplInTwoMatchFirstNote) .Emit(); } impl_had_error = true; diff --git a/toolchain/check/handle_match_first.cpp b/toolchain/check/handle_match_first.cpp index 296f728ddd95..b6562fedc0fe 100644 --- a/toolchain/check/handle_match_first.cpp +++ b/toolchain/check/handle_match_first.cpp @@ -29,9 +29,9 @@ auto HandleParseNode(Context& context, MatchFirstInWrongScope, Error, "found `match_first` in invalid scope; expected namespace or class"); auto builder = context.emitter().Build(node_id, MatchFirstInWrongScope); - CARBON_DIAGNOSTIC(MatchFirstInWrongScopeNote, Note, - "in enclosing scope here"); - builder.Note(enclosing_scope_inst_id, MatchFirstInWrongScopeNote); + CARBON_DIAGNOSTIC_LABEL(MatchFirstInWrongScopeNote, Info, + "in enclosing scope here"); + builder.Attach(enclosing_scope_inst_id, MatchFirstInWrongScopeNote); builder.Emit(); context.node_stack().Push(node_id, SemIR::ErrorInst::InstId); return true; diff --git a/toolchain/check/handle_modifier.cpp b/toolchain/check/handle_modifier.cpp index 5512fa4b48bf..647a7a1907b2 100644 --- a/toolchain/check/handle_modifier.cpp +++ b/toolchain/check/handle_modifier.cpp @@ -9,8 +9,8 @@ namespace Carbon::Check { -CARBON_DIAGNOSTIC(ModifierPrevious, Note, "`{0}` previously appeared here", - Lex::TokenKind); +CARBON_DIAGNOSTIC_LABEL(ModifierPrevious, Info, + "`{0}` previously appeared here", Lex::TokenKind); static auto DiagnoseRepeated(Context& context, Parse::NodeId first_node, Parse::NodeId second_node) -> void { @@ -18,7 +18,7 @@ static auto DiagnoseRepeated(Context& context, Parse::NodeId first_node, Lex::TokenKind); context.emitter() .Build(second_node, ModifierRepeated, context.token_kind(second_node)) - .Note(first_node, ModifierPrevious, context.token_kind(first_node)) + .Attach(first_node, ModifierPrevious, context.token_kind(first_node)) .Emit(); } @@ -30,7 +30,7 @@ static auto DiagnoseNotAllowedWith(Context& context, Parse::NodeId first_node, context.emitter() .Build(second_node, ModifierNotAllowedWith, context.token_kind(second_node), context.token_kind(first_node)) - .Note(first_node, ModifierPrevious, context.token_kind(first_node)) + .Attach(first_node, ModifierPrevious, context.token_kind(first_node)) .Emit(); } @@ -97,8 +97,8 @@ static auto HandleModifier(Context& context, Parse::NodeId node_id, context.emitter() .Build(node_id, ModifierMustAppearBefore, context.token_kind(node_id), context.token_kind(closest_later_modifier)) - .Note(closest_later_modifier, ModifierPrevious, - context.token_kind(closest_later_modifier)) + .Attach(closest_later_modifier, ModifierPrevious, + context.token_kind(closest_later_modifier)) .Emit(); return false; } diff --git a/toolchain/check/handle_name.cpp b/toolchain/check/handle_name.cpp index 21b8ec372b03..7d9aa063f5b7 100644 --- a/toolchain/check/handle_name.cpp +++ b/toolchain/check/handle_name.cpp @@ -209,10 +209,10 @@ auto HandleParseNode(Context& context, Parse::DesignatorExprId node_id) // note to the current "name `.Self` not found" message. Diagnostics::AnnotationScope annotate_diagnostics( &context.emitter(), [&](auto& builder) { - CARBON_DIAGNOSTIC( - NoPeriodSelfForDesignator, Note, + CARBON_DIAGNOSTIC_LABEL( + NoPeriodSelfForDesignator, Info, "designator may only be used when `.Self` is in scope"); - builder.Note(SemIR::LocId::None, NoPeriodSelfForDesignator); + builder.Attach(SemIR::LocId::None, NoPeriodSelfForDesignator); }); period_self_id = HandleNameAsExpr(context, node_id, SemIR::NameId::PeriodSelf); diff --git a/toolchain/check/handle_operator.cpp b/toolchain/check/handle_operator.cpp index e0594ea2e9ab..47ccea51d6a2 100644 --- a/toolchain/check/handle_operator.cpp +++ b/toolchain/check/handle_operator.cpp @@ -391,10 +391,10 @@ auto HandleParseNode(Context& context, Parse::PrefixOperatorStarId node_id) // TODO: Check for any facet here, rather than only a type. if (not_pointer_type_id == SemIR::TypeType::TypeId) { - CARBON_DIAGNOSTIC( - DerefOfType, Note, + CARBON_DIAGNOSTIC_LABEL( + DerefOfType, Info, "to form a pointer type, write the `*` after the pointee type"); - builder.Note(LocIdForDiagnostics::TokenOnly(node_id), DerefOfType); + builder.Attach(LocIdForDiagnostics::TokenOnly(node_id), DerefOfType); } builder.Emit(); diff --git a/toolchain/check/handle_require.cpp b/toolchain/check/handle_require.cpp index 7fe593e36f70..d777961fc07a 100644 --- a/toolchain/check/handle_require.cpp +++ b/toolchain/check/handle_require.cpp @@ -246,12 +246,12 @@ static auto ValidateRequire(Context& context, SemIR::LocId full_require_loc_id, auto identified_facet_type_id = RequireIdentifiedFacetType( context, constraint_loc_id, self_type_id.AsConstantId(), constraint_type_id, [&](auto& builder) { - CARBON_DIAGNOSTIC( - RequireImplsUnidentifiedFacetType, Context, + CARBON_DIAGNOSTIC_CONTEXT( + RequireImplsUnidentifiedFacetType, "facet type {0} cannot be identified in `require` declaration", SemIR::TypeId); - builder.Context(constraint_loc_id, RequireImplsUnidentifiedFacetType, - constraint_type_id); + builder.Attach(constraint_loc_id, RequireImplsUnidentifiedFacetType, + constraint_type_id); }); if (!identified_facet_type_id.has_value()) { // The constraint can't be used. A diagnostic was emitted by @@ -351,12 +351,13 @@ auto HandleParseNode(Context& context, Parse::RequireDeclId node_id) -> bool { context, context.types().GetTypeIdForTypeInstId(constraint_type_inst_id), constraint_node_id, [&](auto& builder) { - CARBON_DIAGNOSTIC(RequireImplsIncompleteFacetType, Context, - "`extend require` of incomplete facet type {0}", - InstIdAsType); - builder.Context(constraint_node_id, - RequireImplsIncompleteFacetType, - constraint_type_inst_id); + CARBON_DIAGNOSTIC_CONTEXT( + RequireImplsIncompleteFacetType, + "`extend require` of incomplete facet type {0}", + InstIdAsType); + builder.Attach(constraint_node_id, + RequireImplsIncompleteFacetType, + constraint_type_inst_id); })) { return true; } diff --git a/toolchain/check/handle_struct.cpp b/toolchain/check/handle_struct.cpp index 692ef3617db6..7df96f3106a7 100644 --- a/toolchain/check/handle_struct.cpp +++ b/toolchain/check/handle_struct.cpp @@ -91,12 +91,12 @@ static auto DiagnoseDuplicateNames( "duplicated field name `{1}` in " "{0:struct type literal|struct literal}", Diagnostics::BoolAsSelect, SemIR::NameId); - CARBON_DIAGNOSTIC(StructNamePrevious, Note, - "field with the same name here"); + CARBON_DIAGNOSTIC_LABEL(StructNamePrevious, Info, + "field with the same name here"); context.emitter() .Build(result.value(), StructNameDuplicate, is_struct_type_literal, field.name_id) - .Note(field_name_node, StructNamePrevious) + .Attach(field_name_node, StructNamePrevious) .Emit(); return true; } diff --git a/toolchain/check/handle_where.cpp b/toolchain/check/handle_where.cpp index 944fd02201fd..85f8661c5e90 100644 --- a/toolchain/check/handle_where.cpp +++ b/toolchain/check/handle_where.cpp @@ -498,9 +498,9 @@ static auto DiagnoseNestedWhere(Context& context, SemIR::LocId loc_id, NestedWhereInsideWhere, Error, "found `where` expression nested on the right-hand side of `where`"); auto builder = context.emitter().Build(loc_id, NestedWhereInsideWhere); - CARBON_DIAGNOSTIC(NestedWhereInsideWhereOuterNote, Note, - "on right-hand side of `where` here"); - builder.Note(outer_loc_id, NestedWhereInsideWhereOuterNote); + CARBON_DIAGNOSTIC_LABEL(NestedWhereInsideWhereOuterNote, Info, + "on right-hand side of `where` here"); + builder.Attach(outer_loc_id, NestedWhereInsideWhereOuterNote); builder.Emit(); } diff --git a/toolchain/check/impl.cpp b/toolchain/check/impl.cpp index 2d5e23ccc7ae..47397a1b8b5a 100644 --- a/toolchain/check/impl.cpp +++ b/toolchain/check/impl.cpp @@ -39,11 +39,12 @@ namespace Carbon::Check { // Adds the location of the associated function to a diagnostic. static auto NoteAssociatedFunction(Context& context, DiagnosticBuilder& builder, SemIR::FunctionId function_id) -> void { - CARBON_DIAGNOSTIC(AssociatedFunctionHere, Note, - "associated function {0} declared here", SemIR::NameId); + CARBON_DIAGNOSTIC_LABEL(AssociatedFunctionHere, Info, + "associated function {0} declared here", + SemIR::NameId); const auto& function = context.functions().Get(function_id); - builder.Note(function.latest_decl_id(), AssociatedFunctionHere, - function.name_id); + builder.Attach(function.latest_decl_id(), AssociatedFunctionHere, + function.name_id); } auto CheckAssociatedFunctionImplementation( @@ -192,12 +193,12 @@ static auto VerifyImplRedecl(Context& context, const SemIR::Impl& new_impl, CARBON_DIAGNOSTIC(ImplRedefinition, Error, "redefinition of `impl {0} as {1}`", InstIdAsRawType, InstIdAsRawType); - CARBON_DIAGNOSTIC(ImplPreviousDefinition, Note, - "previous definition was here"); + CARBON_DIAGNOSTIC_LABEL(ImplPreviousDefinition, Info, + "previous definition was here"); context.emitter() .Build(new_impl.latest_decl_id(), ImplRedefinition, new_impl.self_id, new_impl.constraint_id) - .Note(prev_impl.definition_id, ImplPreviousDefinition) + .Attach(prev_impl.definition_id, ImplPreviousDefinition) .Emit(); return ImplRedeclType::DiagnosedInvalidRedecl; } @@ -288,11 +289,11 @@ static auto ApplyExtendImplAs(Context& context, SemIR::LocId loc_id, if (!RequireCompleteType( context, context.types().GetTypeIdForTypeInstId(impl.constraint_id), SemIR::LocId(impl.constraint_id), [&](auto& builder) { - CARBON_DIAGNOSTIC(ExtendImplAsIncomplete, Context, - "`extend impl as` incomplete facet type {0}", - InstIdAsType); - builder.Context(impl.latest_decl_id(), ExtendImplAsIncomplete, - impl.constraint_id); + CARBON_DIAGNOSTIC_CONTEXT( + ExtendImplAsIncomplete, + "`extend impl as` incomplete facet type {0}", InstIdAsType); + builder.Attach(impl.latest_decl_id(), ExtendImplAsIncomplete, + impl.constraint_id); })) { parent_scope.set_has_error(); return false; @@ -636,13 +637,13 @@ auto ImplWitnessStartDefinition(Context& context, SemIR::Impl& impl) -> void { if (!RequireCompleteType( context, context.types().GetTypeIdForTypeInstId(impl.constraint_id), SemIR::LocId(impl.constraint_id), [&](auto& builder) { - CARBON_DIAGNOSTIC( - ImplAsIncompleteFacetTypeDefinition, Context, + CARBON_DIAGNOSTIC_CONTEXT( + ImplAsIncompleteFacetTypeDefinition, "definition of impl as incomplete facet type {0}", InstIdAsType); - builder.Context(SemIR::LocId(impl.latest_decl_id()), - ImplAsIncompleteFacetTypeDefinition, - impl.constraint_id); + builder.Attach(SemIR::LocId(impl.latest_decl_id()), + ImplAsIncompleteFacetTypeDefinition, + impl.constraint_id); })) { FillImplWitnessWithErrors(context, impl); return; @@ -695,15 +696,15 @@ auto ImplWitnessStartDefinition(Context& context, SemIR::Impl& impl) -> void { "associated constant {0} not given a value in impl " "of interface {1}", SemIR::NameId, SemIR::NameId); - CARBON_DIAGNOSTIC(AssociatedConstantHere, Note, - "associated constant declared here"); + CARBON_DIAGNOSTIC_LABEL(AssociatedConstantHere, Info, + "associated constant declared here"); context.emitter() .Build(impl.definition_id, ImplAssociatedConstantNeedsValue, context.associated_constants() .Get(decl->assoc_const_id) .name_id, interface.name_id) - .Note(assoc_entity, AssociatedConstantHere) + .Attach(assoc_entity, AssociatedConstantHere) .Emit(); witness_value = SemIR::ErrorInst::InstId; @@ -999,11 +1000,10 @@ auto CheckConstraintIsInterface(Context& context, SemIR::LocId loc_id, context.constant_values().Get(self_id), context.types().GetTypeIdForTypeInstId(full_constraint_id), [&](auto& builder) { - CARBON_DIAGNOSTIC(ImplOfUnidentifiedFacetType, Context, - "facet type {0} cannot be identified in `impl as`", - InstIdAsType); - builder.Context(loc_id, ImplOfUnidentifiedFacetType, - full_constraint_id); + CARBON_DIAGNOSTIC_CONTEXT( + ImplOfUnidentifiedFacetType, + "facet type {0} cannot be identified in `impl as`", InstIdAsType); + builder.Attach(loc_id, ImplOfUnidentifiedFacetType, full_constraint_id); }); if (!identified_id.has_value()) { return SemIR::IdentifiedFacetTypeId::None; diff --git a/toolchain/check/impl_lookup.cpp b/toolchain/check/impl_lookup.cpp index 8d64dfcb9a59..c7c0cf63d15d 100644 --- a/toolchain/check/impl_lookup.cpp +++ b/toolchain/check/impl_lookup.cpp @@ -208,9 +208,10 @@ static auto FindAndDiagnoseImplLookupCycle( context.types().GetTypeIdForTypeConstantId(query_self_const_id)); for (const auto& active_entry : llvm::drop_begin(stack, i)) { if (active_entry.impl_loc.has_value()) { - CARBON_DIAGNOSTIC(ImplLookupCycleNote, Note, - "determining if this impl clause matches", ); - builder.Note(active_entry.impl_loc, ImplLookupCycleNote); + CARBON_DIAGNOSTIC_LABEL( + ImplLookupCycleNote, Info, + "determining if this impl clause matches", ); + builder.Attach(active_entry.impl_loc, ImplLookupCycleNote); } } builder.Emit(); @@ -866,12 +867,12 @@ auto LookupImplWitness(Context& context, SemIR::LocId loc_id, context, loc_id, query_self_const_id, context.types().GetTypeIdForTypeConstantId(query_facet_type_const_id), [&](auto& builder) { - CARBON_DIAGNOSTIC(ImplLookupInUnidentifiedFacetType, Context, - "facet type {0} can not be identified", - SemIR::TypeId); - builder.Context(loc_id, ImplLookupInUnidentifiedFacetType, - context.types().GetTypeIdForTypeConstantId( - query_facet_type_const_id)); + CARBON_DIAGNOSTIC_CONTEXT(ImplLookupInUnidentifiedFacetType, + "facet type {0} can not be identified", + SemIR::TypeId); + builder.Attach(loc_id, ImplLookupInUnidentifiedFacetType, + context.types().GetTypeIdForTypeConstantId( + query_facet_type_const_id)); }, diagnose); if (!required_identified_id.has_value()) { diff --git a/toolchain/check/impl_validation.cpp b/toolchain/check/impl_validation.cpp index f1c44e681f81..23957670e563 100644 --- a/toolchain/check/impl_validation.cpp +++ b/toolchain/check/impl_validation.cpp @@ -257,9 +257,9 @@ static auto DiagnoseNonFinalImplsWithSameTypeStructureOutsideMatchFirst( "structure as another non-final `impl`"); auto builder = context.emitter().Build(impl_b.latest_decl_id, ImplNonFinalSameTypeStructure); - CARBON_DIAGNOSTIC(ImplNonFinalSameTypeStructureNote, Note, - "other `impl` here"); - builder.Note(impl_a.latest_decl_id, ImplNonFinalSameTypeStructureNote); + CARBON_DIAGNOSTIC_LABEL(ImplNonFinalSameTypeStructureNote, Info, + "other `impl` here"); + builder.Attach(impl_a.latest_decl_id, ImplNonFinalSameTypeStructureNote); builder.Emit(); return true; } @@ -285,10 +285,10 @@ static auto DiagnoseUnmatchableNonFinalImplWithFinalImpl(Context& context, "`impl` will never be used"); auto builder = context.emitter().Build(query_impl.latest_decl_id, ImplFinalOverlapsNonFinal); - CARBON_DIAGNOSTIC( - ImplFinalOverlapsNonFinalNote, Note, + CARBON_DIAGNOSTIC_LABEL( + ImplFinalOverlapsNonFinalNote, Info, "`final impl` declared here would always be used instead"); - builder.Note(final_impl.latest_decl_id, ImplFinalOverlapsNonFinalNote); + builder.Attach(final_impl.latest_decl_id, ImplFinalOverlapsNonFinalNote); builder.Emit(); return true; } @@ -316,17 +316,17 @@ static auto DiagnoseFinalImplsOverlapInDifferentFiles(Context& context, CARBON_DIAGNOSTIC( FinalImplOverlapsDifferentFile, Error, "`final impl` overlaps with `final impl` from another file"); - CARBON_DIAGNOSTIC(FinalImplOverlapsDifferentFileNote, Note, - "imported `final impl` here"); + CARBON_DIAGNOSTIC_LABEL(FinalImplOverlapsDifferentFileNote, Info, + "imported `final impl` here"); if (impl_a.is_local) { auto builder = context.emitter().Build(impl_a.latest_decl_id, FinalImplOverlapsDifferentFile); - builder.Note(impl_b.latest_decl_id, FinalImplOverlapsDifferentFileNote); + builder.Attach(impl_b.latest_decl_id, FinalImplOverlapsDifferentFileNote); builder.Emit(); } else { auto builder = context.emitter().Build(impl_b.latest_decl_id, FinalImplOverlapsDifferentFile); - builder.Note(impl_a.latest_decl_id, FinalImplOverlapsDifferentFileNote); + builder.Attach(impl_a.latest_decl_id, FinalImplOverlapsDifferentFileNote); builder.Emit(); } return true; @@ -351,9 +351,9 @@ static auto DiagnoseFinalImplsOverlapOutsideMatchFirst(Context& context, "outside a `match_first` block"); auto builder = context.emitter().Build(impl_b.latest_decl_id, FinalImplOverlapsSameFile); - CARBON_DIAGNOSTIC(FinalImplOverlapsSameFileNote, Note, - "other `final impl` here"); - builder.Note(impl_a.latest_decl_id, FinalImplOverlapsSameFileNote); + CARBON_DIAGNOSTIC_LABEL(FinalImplOverlapsSameFileNote, Info, + "other `final impl` here"); + builder.Attach(impl_a.latest_decl_id, FinalImplOverlapsSameFileNote); builder.Emit(); return true; } diff --git a/toolchain/check/import.cpp b/toolchain/check/import.cpp index d7b4f5421be5..784ef68779ee 100644 --- a/toolchain/check/import.cpp +++ b/toolchain/check/import.cpp @@ -641,9 +641,9 @@ auto ImportNameFromOtherPackage( // Annotate diagnostics as occurring during this name lookup. Diagnostics::AnnotationScope annotate_diagnostics( &context.emitter(), [&](auto& builder) { - CARBON_DIAGNOSTIC(InNameLookup, Note, "in name lookup for `{0}`", - SemIR::NameId); - builder.Note(loc_id, InNameLookup, name_id); + CARBON_DIAGNOSTIC_LABEL(InNameLookup, Info, "in name lookup for `{0}`", + SemIR::NameId); + builder.Attach(loc_id, InNameLookup, name_id); }); // Although we track the result here and look in each IR, we pretty much use diff --git a/toolchain/check/literal.cpp b/toolchain/check/literal.cpp index 6bfc09d69bca..9d1e882b3d9d 100644 --- a/toolchain/check/literal.cpp +++ b/toolchain/check/literal.cpp @@ -173,10 +173,10 @@ auto MakeStringLiteral(Context& context, Parse::StringLiteralId node_id, auto str_type = MakeStringType(context, SemIR::LocId(node_id).AsDesugared()); 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); + CARBON_DIAGNOSTIC_CONTEXT(StringLiteralTypeIncomplete, + "type {0} is incomplete", InstIdAsType); + builder.Attach(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 227d442c598f..c5c0959f95b7 100644 --- a/toolchain/check/member_access.cpp +++ b/toolchain/check/member_access.cpp @@ -538,12 +538,12 @@ static auto PerformActionHelper(Context& context, SemIR::LocId loc_id, // scopes directly on the facet type. if (!RequireCompleteType( context, base_type_id, SemIR::LocId(base_id), [&](auto& builder) { - CARBON_DIAGNOSTIC( - IncompleteTypeInMemberAccessOfFacet, Context, + CARBON_DIAGNOSTIC_CONTEXT( + IncompleteTypeInMemberAccessOfFacet, "member access into facet of incomplete type {0}", SemIR::TypeId); - builder.Context(base_id, IncompleteTypeInMemberAccessOfFacet, - base_type_id); + builder.Attach(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. @@ -582,11 +582,11 @@ static auto PerformActionHelper(Context& context, SemIR::LocId loc_id, // done to give a better error than "invalid use of" an incomplete type? if (!RequireCompleteType( context, base_type_id, SemIR::LocId(base_id), [&](auto& builder) { - CARBON_DIAGNOSTIC( - IncompleteTypeInMemberAccess, Context, + CARBON_DIAGNOSTIC_CONTEXT( + IncompleteTypeInMemberAccess, "member access into object of incomplete type {0}", TypeOfInstId); - builder.Context(base_id, IncompleteTypeInMemberAccess, base_id); + builder.Attach(base_id, IncompleteTypeInMemberAccess, base_id); })) { return SemIR::ErrorInst::InstId; } diff --git a/toolchain/check/merge.cpp b/toolchain/check/merge.cpp index 93e73c6b95c7..93e0f958a4b6 100644 --- a/toolchain/check/merge.cpp +++ b/toolchain/check/merge.cpp @@ -14,7 +14,7 @@ namespace Carbon::Check { -CARBON_DIAGNOSTIC(RedeclPrevDecl, Note, "previously declared here"); +CARBON_DIAGNOSTIC_LABEL(RedeclPrevDecl, Info, "previously declared here"); // Diagnoses a redeclaration which is redundant. static auto DiagnoseRedundant(Context& context, Lex::TokenKind decl_kind, @@ -25,7 +25,7 @@ static auto DiagnoseRedundant(Context& context, Lex::TokenKind decl_kind, SemIR::NameId); context.emitter() .Build(new_loc_id, RedeclRedundant, decl_kind, name_id) - .Note(prev_loc_id, RedeclPrevDecl) + .Attach(prev_loc_id, RedeclPrevDecl) .Emit(); } @@ -35,10 +35,10 @@ static auto DiagnoseRedef(Context& context, Lex::TokenKind decl_kind, SemIR::LocId prev_loc_id) -> void { CARBON_DIAGNOSTIC(RedeclRedef, Error, "redefinition of `{0} {1}`", Lex::TokenKind, SemIR::NameId); - CARBON_DIAGNOSTIC(RedeclPrevDef, Note, "previously defined here"); + CARBON_DIAGNOSTIC_LABEL(RedeclPrevDef, Info, "previously defined here"); context.emitter() .Build(new_loc_id, RedeclRedef, decl_kind, name_id) - .Note(prev_loc_id, RedeclPrevDef) + .Attach(prev_loc_id, RedeclPrevDef) .Emit(); } @@ -52,7 +52,7 @@ static auto DiagnoseExternMismatch(Context& context, Lex::TokenKind decl_kind, Lex::TokenKind, SemIR::NameId); context.emitter() .Build(new_loc_id, RedeclExternMismatch, decl_kind, name_id) - .Note(prev_loc_id, RedeclPrevDecl) + .Attach(prev_loc_id, RedeclPrevDecl) .Emit(); } @@ -67,7 +67,7 @@ static auto DiagnoseExternLibraryInImporter(Context& context, Lex::TokenKind, SemIR::NameId); context.emitter() .Build(new_loc_id, ExternLibraryInImporter, decl_kind, name_id) - .Note(prev_loc_id, RedeclPrevDecl) + .Attach(prev_loc_id, RedeclPrevDecl) .Emit(); } @@ -79,11 +79,11 @@ static auto DiagnoseExternLibraryIncorrect(Context& context, ExternLibraryIncorrect, Error, "declaration in {0} doesn't match `extern library` declaration", SemIR::LibraryNameId); - CARBON_DIAGNOSTIC(ExternLibraryExpected, Note, - "previously declared with `extern library` here"); + CARBON_DIAGNOSTIC_LABEL(ExternLibraryExpected, Info, + "previously declared with `extern library` here"); context.emitter() .Build(new_loc_id, ExternLibraryIncorrect, context.sem_ir().library_id()) - .Note(prev_loc_id, ExternLibraryExpected) + .Attach(prev_loc_id, ExternLibraryExpected) .Emit(); } @@ -213,8 +213,8 @@ static auto CheckRedeclParam(Context& context, bool is_implicit_param, SemIR::InstId orig_prev_param_pattern_id, SemIR::SpecificId prev_specific_id, bool diagnose, bool check_syntax) -> bool { - CARBON_DIAGNOSTIC( - RedeclParamPrevious, Note, + CARBON_DIAGNOSTIC_LABEL( + RedeclParamPrevious, Info, "previous declaration's corresponding {0:implicit |}parameter here", Diagnostics::BoolAsSelect); auto emit_general_diagnostic = [&]() { @@ -227,8 +227,8 @@ static auto CheckRedeclParam(Context& context, bool is_implicit_param, context.emitter() .Build(orig_new_param_pattern_id, RedeclParamDiffers, is_implicit_param, param_index + 1) - .Note(orig_prev_param_pattern_id, RedeclParamPrevious, - is_implicit_param) + .Attach(orig_prev_param_pattern_id, RedeclParamPrevious, + is_implicit_param) .Emit(); }; @@ -279,8 +279,8 @@ static auto CheckRedeclParam(Context& context, bool is_implicit_param, .Build(orig_new_param_pattern_id, RedeclParamDiffersType, is_implicit_param, param_index + 1, prev_param_type_id, new_param_pattern.type_id()) - .Note(orig_prev_param_pattern_id, RedeclParamPrevious, - is_implicit_param) + .Attach(orig_prev_param_pattern_id, RedeclParamPrevious, + is_implicit_param) .Emit(); } return false; @@ -390,15 +390,16 @@ static auto CheckRedeclParams(Context& context, SemIR::LocId new_decl_loc_id, "redeclaration differs because of " "{1:|missing }{0:implicit |}parameter list", Diagnostics::BoolAsSelect, Diagnostics::BoolAsSelect); - CARBON_DIAGNOSTIC(RedeclParamListPrevious, Note, - "previously declared " - "{1:with|without} {0:implicit |}parameter list", - Diagnostics::BoolAsSelect, Diagnostics::BoolAsSelect); + CARBON_DIAGNOSTIC_LABEL(RedeclParamListPrevious, Info, + "previously declared " + "{1:with|without} {0:implicit |}parameter list", + Diagnostics::BoolAsSelect, + Diagnostics::BoolAsSelect); context.emitter() .Build(new_decl_loc_id, RedeclParamListDiffers, is_implicit_param, new_param_patterns_id.has_value()) - .Note(prev_decl_loc_id, RedeclParamListPrevious, is_implicit_param, - prev_param_patterns_id.has_value()) + .Attach(prev_decl_loc_id, RedeclParamListPrevious, is_implicit_param, + prev_param_patterns_id.has_value()) .Emit(); return false; } @@ -417,15 +418,15 @@ static auto CheckRedeclParams(Context& context, SemIR::LocId new_decl_loc_id, RedeclParamCountDiffers, Error, "redeclaration differs because of {0:implicit |}parameter count of {1}", Diagnostics::BoolAsSelect, int32_t); - CARBON_DIAGNOSTIC( - RedeclParamCountPrevious, Note, + CARBON_DIAGNOSTIC_LABEL( + RedeclParamCountPrevious, Info, "previously declared with {0:implicit |}parameter count of {1}", Diagnostics::BoolAsSelect, int32_t); context.emitter() .Build(new_decl_loc_id, RedeclParamCountDiffers, is_implicit_param, new_param_pattern_ids.size()) - .Note(prev_decl_loc_id, RedeclParamCountPrevious, is_implicit_param, - prev_param_pattern_ids.size()) + .Attach(prev_decl_loc_id, RedeclParamCountPrevious, is_implicit_param, + prev_param_pattern_ids.size()) .Emit(); return false; } @@ -536,11 +537,11 @@ static auto CheckRedeclParamSyntax(Context& context, } CARBON_DIAGNOSTIC(RedeclParamSyntaxDiffers, Error, "redeclaration syntax differs here"); - CARBON_DIAGNOSTIC(RedeclParamSyntaxPrevious, Note, - "comparing with previous declaration here"); + CARBON_DIAGNOSTIC_LABEL(RedeclParamSyntaxPrevious, Info, + "comparing with previous declaration here"); context.emitter() .Build(new_node_id, RedeclParamSyntaxDiffers) - .Note(prev_node_id, RedeclParamSyntaxPrevious) + .Attach(prev_node_id, RedeclParamSyntaxPrevious) .Emit(); return false; } @@ -839,7 +840,7 @@ auto TryMergeRedecl(Context& context, context.emitter() .Build(entity_info.new_entity.latest_decl_id(), DeducedReturnTypeRedecl) - .Note(prev_entity.latest_decl_id(), RedeclPrevDecl) + .Attach(prev_entity.latest_decl_id(), RedeclPrevDecl) .Emit(); return false; } diff --git a/toolchain/check/modifiers.cpp b/toolchain/check/modifiers.cpp index cdbfe1ddd40d..d03d99906e8f 100644 --- a/toolchain/check/modifiers.cpp +++ b/toolchain/check/modifiers.cpp @@ -44,8 +44,9 @@ static auto DiagnoseNotAllowed( auto diag = StartDiagnoseNotAllowed(context, diagnostic_base, modifier_node, decl_kind); if (context_loc_id.has_value()) { - CARBON_DIAGNOSTIC(ModifierNotInContext, Note, "containing definition here"); - diag.Note(context_loc_id, ModifierNotInContext); + CARBON_DIAGNOSTIC_LABEL(ModifierNotInContext, Info, + "containing definition here"); + diag.Attach(context_loc_id, ModifierNotInContext); } diag.Emit(); } diff --git a/toolchain/check/name_lookup.cpp b/toolchain/check/name_lookup.cpp index a2564fe7256a..4d8dc2ddd57d 100644 --- a/toolchain/check/name_lookup.cpp +++ b/toolchain/check/name_lookup.cpp @@ -266,11 +266,11 @@ static auto DiagnoseInvalidQualifiedNameAccess( ClassInvalidMemberAccess, Error, "cannot access {0:private|protected} member `{1}` of type {2}", Diagnostics::BoolAsSelect, SemIR::NameId, SemIR::TypeId); - CARBON_DIAGNOSTIC(ClassMemberDeclaration, Note, "declared here"); + CARBON_DIAGNOSTIC_LABEL(ClassMemberDeclaration, Info, "declared here"); context.emitter() .Build(loc_id, ClassInvalidMemberAccess, access_kind == SemIR::AccessKind::Private, name_id, scope_type_id) - .Note(member_loc_id, ClassMemberDeclaration) + .Attach(member_loc_id, ClassMemberDeclaration) .Emit(); } @@ -368,11 +368,11 @@ auto AppendLookupScopesForConstant(Context& context, SemIR::LocId loc_id, RequireCompleteType( context, context.types().GetTypeIdForTypeConstantId(lookup_const_id), loc_id, [&](auto& builder) { - CARBON_DIAGNOSTIC(QualifiedExprInIncompleteClassScope, Context, - "member access into incomplete class {0}", - InstIdAsType); - builder.Context(loc_id, QualifiedExprInIncompleteClassScope, - lookup_inst_id); + CARBON_DIAGNOSTIC_CONTEXT(QualifiedExprInIncompleteClassScope, + "member access into incomplete class {0}", + InstIdAsType); + builder.Attach(loc_id, QualifiedExprInIncompleteClassScope, + lookup_inst_id); }); } auto& class_info = context.classes().Get(class_ty->class_id); @@ -396,12 +396,12 @@ auto AppendLookupScopesForConstant(Context& context, SemIR::LocId loc_id, context, context.types().GetTypeIdForTypeConstantId(lookup_const_id), loc_id, [&](auto& builder) { - CARBON_DIAGNOSTIC( - QualifiedExprInIncompleteFacetTypeScope, Context, + CARBON_DIAGNOSTIC_CONTEXT( + QualifiedExprInIncompleteFacetTypeScope, "member access into incomplete facet type {0}", InstIdAsType); - builder.Context(loc_id, QualifiedExprInIncompleteFacetTypeScope, - lookup_inst_id); + builder.Attach(loc_id, QualifiedExprInIncompleteFacetTypeScope, + lookup_inst_id); })) { // Lookup into this scope should fail without producing an error since // `RequireCompleteFacetType` has already issued a diagnostic. @@ -710,10 +710,11 @@ auto DiagnoseDuplicateName(Context& context, SemIR::NameId name_id, CARBON_DIAGNOSTIC(NameDeclDuplicate, Error, "duplicate name `{0}` being declared in the same scope", SemIR::NameId); - CARBON_DIAGNOSTIC(NameDeclPrevious, Note, "name is previously declared here"); + CARBON_DIAGNOSTIC_LABEL(NameDeclPrevious, Info, + "name is previously declared here"); context.emitter() .Build(dup_def, NameDeclDuplicate, name_id) - .Note(prev_def, NameDeclPrevious) + .Attach(prev_def, NameDeclPrevious) .Emit(); } @@ -724,10 +725,10 @@ auto DiagnosePoisonedName(Context& context, SemIR::NameId name_id, "Trying to diagnose poisoned name with no poisoning location"); CARBON_DIAGNOSTIC(NameUseBeforeDecl, Error, "name `{0}` used before it was declared", SemIR::NameId); - CARBON_DIAGNOSTIC(NameUseBeforeDeclNote, Note, "declared here"); + CARBON_DIAGNOSTIC_LABEL(NameUseBeforeDeclNote, Info, "declared here"); context.emitter() .Build(poisoning_loc_id, NameUseBeforeDecl, name_id) - .Note(decl_name_loc_id, NameUseBeforeDeclNote) + .Attach(decl_name_loc_id, NameUseBeforeDeclNote) .Emit(); } diff --git a/toolchain/check/pattern_match.cpp b/toolchain/check/pattern_match.cpp index bf567c33b2a0..36efd3cbc1a6 100644 --- a/toolchain/check/pattern_match.cpp +++ b/toolchain/check/pattern_match.cpp @@ -278,9 +278,9 @@ auto MatchContext::Match(State state, WorkItem entry) -> void { Diagnostics::AnnotationScope annotate_diagnostics( &context_.emitter(), [&](auto& builder) { if (std::holds_alternative(state)) { - CARBON_DIAGNOSTIC(InCallToFunctionParam, Note, - "initializing function parameter"); - builder.Note(entry.pattern_id, InCallToFunctionParam); + CARBON_DIAGNOSTIC_LABEL(InCallToFunctionParam, Info, + "initializing function parameter"); + builder.Attach(entry.pattern_id, InCallToFunctionParam); } }); CARBON_CHECK(stack_.empty()); diff --git a/toolchain/check/return.cpp b/toolchain/check/return.cpp index 2010166eadca..64ae8700c783 100644 --- a/toolchain/check/return.cpp +++ b/toolchain/check/return.cpp @@ -58,35 +58,36 @@ static auto GetCurrentReturnedVar(Context& context) -> SemIR::InstId { // Produces a note that the given function has no explicit return type. static auto NoteNoReturnTypeProvided(DiagnosticBuilder& diag, const SemIR::Function& function) { - CARBON_DIAGNOSTIC(ReturnTypeOmittedNote, Note, - "there was no return type provided"); - diag.Note(function.latest_decl_id(), ReturnTypeOmittedNote); + CARBON_DIAGNOSTIC_LABEL(ReturnTypeOmittedNote, Info, + "there was no return type provided"); + diag.Attach(function.latest_decl_id(), ReturnTypeOmittedNote); } // Produces a note describing the return type of the given function, which // must be a function whose definition is currently being checked. static auto NoteReturnType(DiagnosticBuilder& diag, const SemIR::Function& function) { - CARBON_DIAGNOSTIC(ReturnTypeHereNote, Note, "return type of function is {0}", - InstIdAsType); - diag.Note(function.return_type_inst_id, ReturnTypeHereNote, - function.return_type_inst_id); + CARBON_DIAGNOSTIC_LABEL(ReturnTypeHereNote, Info, + "return type of function is {0}", InstIdAsType); + diag.Attach(function.return_type_inst_id, ReturnTypeHereNote, + function.return_type_inst_id); } // Produces a note that the return type of the given function is deduced, for a // function whose return type has not been deduced yet. static auto NoteReturnTypeIsDeduced(DiagnosticBuilder& diag, const SemIR::Function& function) { - CARBON_DIAGNOSTIC(ReturnTypeIsDeducedNote, Note, - "return type of function is deduced"); - diag.Note(function.latest_decl_id(), ReturnTypeIsDeducedNote); + CARBON_DIAGNOSTIC_LABEL(ReturnTypeIsDeducedNote, Info, + "return type of function is deduced"); + diag.Attach(function.latest_decl_id(), ReturnTypeIsDeducedNote); } // Produces a note pointing at the currently in scope `returned var`. static auto NoteReturnedVar(DiagnosticBuilder& diag, SemIR::InstId returned_var_id) { - CARBON_DIAGNOSTIC(ReturnedVarHere, Note, "`returned var` was declared here"); - diag.Note(returned_var_id, ReturnedVarHere); + CARBON_DIAGNOSTIC_LABEL(ReturnedVarHere, Info, + "`returned var` was declared here"); + diag.Attach(returned_var_id, ReturnedVarHere); } namespace { @@ -219,10 +220,10 @@ static auto CompletePendingReturns(Context& context, &context.emitter(), [&](DiagnosticBuilder& builder) { // TODO: Track the instruction the return type was deduced for and use // TypeOfInstId to preserve sugar. - CARBON_DIAGNOSTIC(ReturnTypeDeducedAs, Note, - "return type deduced as {0}", InstIdAsType); - builder.Note(function.return_type_inst_id, ReturnTypeDeducedAs, - function.return_type_inst_id); + CARBON_DIAGNOSTIC_LABEL(ReturnTypeDeducedAs, Info, + "return type deduced as {0}", InstIdAsType); + builder.Attach(function.return_type_inst_id, ReturnTypeDeducedAs, + function.return_type_inst_id); }); for (const auto& pending_return : pending_returns) { @@ -301,8 +302,9 @@ auto RegisterReturnedVar(Context& context, Parse::NodeId returned_node, "`returned var` declaration in function with " "non-initializing return form"); auto diag = context.emitter().Build(returned_node, ReturnedVarNotInit); - CARBON_DIAGNOSTIC(ReturnFormHereNote, Note, "return form declared here"); - diag.Note(function.return_form_inst_id, ReturnFormHereNote); + CARBON_DIAGNOSTIC_LABEL(ReturnFormHereNote, Info, + "return form declared here"); + diag.Attach(function.return_form_inst_id, ReturnFormHereNote); diag.Emit(); } @@ -446,12 +448,13 @@ auto DeduceReturnTypeAtEndOfBody(Context& context, DeducedReturnTypeMismatch, Error, "deduced return type {0} does not match return type deduced earlier", TypeOfInstId); - CARBON_DIAGNOSTIC(DeducedReturnTypeMismatchPrevious, Note, - "return type previously deduced as {0} here", - TypeOfInstId); + CARBON_DIAGNOSTIC_LABEL(DeducedReturnTypeMismatchPrevious, Info, + "return type previously deduced as {0} here", + TypeOfInstId); context.emitter() .Build(pending.expr_id, DeducedReturnTypeMismatch, pending.expr_id) - .Note(first_expr_id, DeducedReturnTypeMismatchPrevious, first_expr_id) + .Attach(first_expr_id, DeducedReturnTypeMismatchPrevious, + first_expr_id) .Emit(); return_type_id = SemIR::ErrorInst::TypeId; break; diff --git a/toolchain/check/testdata/alias/basics.carbon b/toolchain/check/testdata/alias/basics.carbon index f845545bc044..88ec3cb73e18 100644 --- a/toolchain/check/testdata/alias/basics.carbon +++ b/toolchain/check/testdata/alias/basics.carbon @@ -51,13 +51,9 @@ let v: a = {} as A({}); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_control_flow.carbon:[[@LINE+8]]:11: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] -// CHECK:STDERR: alias a = true or false; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_control_flow.carbon:[[@LINE+4]]:11-17: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] // CHECK:STDERR: -// CHECK:STDERR: fail_control_flow.carbon:[[@LINE+4]]:11: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] -// CHECK:STDERR: alias a = true or false; -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_control_flow.carbon:[[@LINE+2]]:11-23: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] // CHECK:STDERR: alias a = true or false; @@ -68,22 +64,14 @@ library "[[@TEST_NAME]]"; class C {} alias a = C; -// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE+7]]:5: error: duplicate name `a` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: var a: C = {}; -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE-4]]:7: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: alias a = C; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE+3]]:5: error: duplicate name `a` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE-2]]:7: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: var a: C = {}; var b: C = {}; -// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE+7]]:7: error: duplicate name `b` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: alias b = C; -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE-4]]:5: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: var b: C = {}; -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE+3]]:7: error: duplicate name `b` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE-2]]:5-8: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: alias b = C; @@ -94,9 +82,7 @@ library "[[@TEST_NAME]]"; var a: () = (); var b: ()* = &a; -// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+4]]:11: error: alias refers to a runtime value [AliasRequiresConstantValue] -// CHECK:STDERR: alias c = *b; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+2]]:11-12: error: alias refers to a runtime value [AliasRequiresConstantValue] // CHECK:STDERR: alias c = *b; @@ -104,9 +90,7 @@ alias c = *b; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_params.carbon:[[@LINE+4]]:8: error: `alias` declaration cannot have parameters [UnexpectedDeclNameParams] -// CHECK:STDERR: alias A(T: type) = T*; -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_params.carbon:[[@LINE+2]]:8-16: error: `alias` declaration cannot have parameters [UnexpectedDeclNameParams] // CHECK:STDERR: alias A(T: type) = T*; @@ -116,42 +100,24 @@ library "[[@TEST_NAME]]"; class Class {} -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+25]]:10: error: `base` not allowed on declaration with `abstract` [ModifierNotAllowedWith] -// CHECK:STDERR: abstract base default final alias A = Class; -// CHECK:STDERR: ^~~~ -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+22]]:1: note: `abstract` previously appeared here [ModifierPrevious] -// CHECK:STDERR: abstract base default final alias A = Class; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+11]]:10-13: error: `base` not allowed on declaration with `abstract` [ModifierNotAllowedWith] +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+10]]:1-8: note: `abstract` previously appeared here [ModifierPrevious] // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+18]]:15: error: `default` not allowed on declaration with `abstract` [ModifierNotAllowedWith] -// CHECK:STDERR: abstract base default final alias A = Class; -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+15]]:1: note: `abstract` previously appeared here [ModifierPrevious] -// CHECK:STDERR: abstract base default final alias A = Class; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+8]]:15-21: error: `default` not allowed on declaration with `abstract` [ModifierNotAllowedWith] +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:1-8: note: `abstract` previously appeared here [ModifierPrevious] // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+11]]:23: error: `final` not allowed on declaration with `abstract` [ModifierNotAllowedWith] -// CHECK:STDERR: abstract base default final alias A = Class; -// CHECK:STDERR: ^~~~~ -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+8]]:1: note: `abstract` previously appeared here [ModifierPrevious] -// CHECK:STDERR: abstract base default final alias A = Class; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+5]]:23-27: error: `final` not allowed on declaration with `abstract` [ModifierNotAllowedWith] +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1-8: note: `abstract` previously appeared here [ModifierPrevious] // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `abstract` not allowed on `alias` declaration [ModifierNotAllowedOnDeclaration] -// CHECK:STDERR: abstract base default final alias A = Class; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-8: error: `abstract` not allowed on `alias` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: abstract base default final alias A = Class; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `impl` not allowed on `alias` declaration [ModifierNotAllowedOnDeclaration] -// CHECK:STDERR: impl alias B = Class; -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-4: error: `impl` not allowed on `alias` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: impl alias B = Class; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `extern` not allowed on `alias` declaration [ModifierNotAllowedOnDeclaration] -// CHECK:STDERR: extern alias C = Class; -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-6: error: `extern` not allowed on `alias` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: extern alias C = Class; diff --git a/toolchain/check/testdata/alias/export_name.carbon b/toolchain/check/testdata/alias/export_name.carbon index 1171a6c7092b..5f3c10c59a91 100644 --- a/toolchain/check/testdata/alias/export_name.carbon +++ b/toolchain/check/testdata/alias/export_name.carbon @@ -56,9 +56,7 @@ library "[[@TEST_NAME]]"; import library "export"; -// CHECK:STDERR: fail_orig_name_not_in_export.carbon:[[@LINE+4]]:8: error: name `C` not found [NameNotFound] -// CHECK:STDERR: var c: C = {}; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_orig_name_not_in_export.carbon:[[@LINE+2]]:8: error: name `C` not found [NameNotFound] // CHECK:STDERR: var c: C = {}; @@ -277,7 +275,7 @@ var d: D* = &c; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc8: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: assign file.%c.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/alias/import_access.carbon b/toolchain/check/testdata/alias/import_access.carbon index d0e6ef6da56b..aad5a1cb1e59 100644 --- a/toolchain/check/testdata/alias/import_access.carbon +++ b/toolchain/check/testdata/alias/import_access.carbon @@ -38,9 +38,7 @@ package Test library "[[@TEST_NAME]]"; import library "def"; -// CHECK:STDERR: fail_local_def.carbon:[[@LINE+4]]:11: error: name `A` not found [NameNotFound] -// CHECK:STDERR: var inst: A = {}; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_local_def.carbon:[[@LINE+2]]:11: error: name `A` not found [NameNotFound] // CHECK:STDERR: var inst: A = {}; @@ -50,9 +48,7 @@ package Other library "[[@TEST_NAME]]"; import Test library "def"; -// CHECK:STDERR: fail_other_def.carbon:[[@LINE+4]]:11: error: member name `A` not found in `Test` [MemberNameNotFoundInInstScope] -// CHECK:STDERR: var inst: Test.A = {}; -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_other_def.carbon:[[@LINE+2]]:11-16: error: member name `A` not found in `Test` [MemberNameNotFoundInInstScope] // CHECK:STDERR: var inst: Test.A = {}; @@ -167,7 +163,7 @@ var inst: Test.A = {}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc8: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: assign file.%inst.var, // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -207,7 +203,7 @@ var inst: Test.A = {}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc8: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: assign file.%inst.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/alias/in_namespace.carbon b/toolchain/check/testdata/alias/in_namespace.carbon index c3ac47f870ce..c04a4324fc82 100644 --- a/toolchain/check/testdata/alias/in_namespace.carbon +++ b/toolchain/check/testdata/alias/in_namespace.carbon @@ -34,14 +34,10 @@ library "[[@TEST_NAME]]"; namespace NS; fn F() -> {} { - // CHECK:STDERR: fail_local_in_namespace.carbon:[[@LINE+4]]:9: error: name `NS` not found [NameNotFound] - // CHECK:STDERR: alias NS.a = {}; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_local_in_namespace.carbon:[[@LINE+2]]:9-10: error: name `NS` not found [NameNotFound] // CHECK:STDERR: alias NS.a = {}; - // CHECK:STDERR: fail_local_in_namespace.carbon:[[@LINE+4]]:10: error: member name `a` not found in `NS` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: return NS.a; - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_local_in_namespace.carbon:[[@LINE+2]]:10-13: error: member name `a` not found in `NS` [MemberNameNotFoundInInstScope] // CHECK:STDERR: return NS.a; } diff --git a/toolchain/check/testdata/alias/preserve_in_type_printing.carbon b/toolchain/check/testdata/alias/preserve_in_type_printing.carbon index 90283645df22..659f498485ed 100644 --- a/toolchain/check/testdata/alias/preserve_in_type_printing.carbon +++ b/toolchain/check/testdata/alias/preserve_in_type_printing.carbon @@ -19,37 +19,21 @@ alias A = C; // The diagnostics below should refer to `A`, not `C`. -// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+7]]:15: error: missing return value [ReturnStatementMissingExpr] -// CHECK:STDERR: fn F() -> A { return; } -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+4]]:11: note: return type of function is `A` [ReturnTypeHereNote] -// CHECK:STDERR: fn F() -> A { return; } -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+3]]:15-21: error: missing return value [ReturnStatementMissingExpr] +// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+2]]:11: note: return type of function is `A` [ReturnTypeHereNote] // CHECK:STDERR: fn F() -> A { return; } -// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+7]]:16: error: missing return value [ReturnStatementMissingExpr] -// CHECK:STDERR: fn G() -> A* { return; } -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+4]]:11: note: return type of function is `A*` [ReturnTypeHereNote] -// CHECK:STDERR: fn G() -> A* { return; } -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+3]]:16-22: error: missing return value [ReturnStatementMissingExpr] +// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+2]]:11-12: note: return type of function is `A*` [ReturnTypeHereNote] // CHECK:STDERR: fn G() -> A* { return; } -// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+7]]:22: error: missing return value [ReturnStatementMissingExpr] -// CHECK:STDERR: fn H() -> const A* { return; } -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+4]]:11: note: return type of function is `const A*` [ReturnTypeHereNote] -// CHECK:STDERR: fn H() -> const A* { return; } -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+3]]:22-28: error: missing return value [ReturnStatementMissingExpr] +// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+2]]:11-18: note: return type of function is `const A*` [ReturnTypeHereNote] // CHECK:STDERR: fn H() -> const A* { return; } // TODO: Preserve type sugar in generic arguments, such as for `Core.Array`. -// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+7]]:26: error: missing return value [ReturnStatementMissingExpr] -// CHECK:STDERR: fn I() -> array(A, 42) { return; } -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+4]]:11: note: return type of function is `array(C, 42)` [ReturnTypeHereNote] -// CHECK:STDERR: fn I() -> array(A, 42) { return; } -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+3]]:26-32: error: missing return value [ReturnStatementMissingExpr] +// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+2]]:11-22: note: return type of function is `array(C, 42)` [ReturnTypeHereNote] // CHECK:STDERR: fn I() -> array(A, 42) { return; } @@ -67,16 +51,12 @@ fn MakePtr() -> A*; fn F() { // The type of a call is the declared return type of the callee. - // CHECK:STDERR: fail_alias_in_type_of_expr.carbon:[[@LINE+4]]:3: error: type `A*` does not support qualified expressions [QualifiedExprUnsupported] - // CHECK:STDERR: MakePtr().missing; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_alias_in_type_of_expr.carbon:[[@LINE+2]]:3-19: error: type `A*` does not support qualified expressions [QualifiedExprUnsupported] // CHECK:STDERR: MakePtr().missing; // The type of a dereference is the pointee type of the pointer's type. - // CHECK:STDERR: fail_alias_in_type_of_expr.carbon:[[@LINE+4]]:3: error: value of type `A` is not callable [CallToNonCallable] - // CHECK:STDERR: (*MakePtr())(); - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_alias_in_type_of_expr.carbon:[[@LINE+2]]:3-16: error: value of type `A` is not callable [CallToNonCallable] // CHECK:STDERR: (*MakePtr())(); } diff --git a/toolchain/check/testdata/alias/var.carbon b/toolchain/check/testdata/alias/var.carbon index da03dd268ca3..3654acfafa2d 100644 --- a/toolchain/check/testdata/alias/var.carbon +++ b/toolchain/check/testdata/alias/var.carbon @@ -34,9 +34,7 @@ library "[[@TEST_NAME]]"; fn F() -> () { var a: () = (); //@dump-sem-ir-begin - // CHECK:STDERR: fail_local.carbon:[[@LINE+4]]:13: error: alias refers to a runtime value [AliasRequiresConstantValue] - // CHECK:STDERR: alias b = a; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_local.carbon:[[@LINE+2]]:13: error: alias refers to a runtime value [AliasRequiresConstantValue] // CHECK:STDERR: alias b = a; //@dump-sem-ir-end diff --git a/toolchain/check/testdata/array/basics.carbon b/toolchain/check/testdata/array/basics.carbon index 7bb84be743e6..5f37e42c4a87 100644 --- a/toolchain/check/testdata/array/basics.carbon +++ b/toolchain/check/testdata/array/basics.carbon @@ -81,22 +81,12 @@ library "[[@TEST_NAME]]"; class Incomplete; -// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE+17]]:8: error: binding pattern has incomplete type `array(Incomplete, 1)` in name binding declaration [IncompleteTypeInBindingDecl] -// CHECK:STDERR: var a: array(Incomplete, 1); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: min_prelude/parts/array.carbon:12:3: note: `` evaluates to incomplete type `` [IncompleteTypeInMonomorphization] -// CHECK:STDERR: adapt MakeArray(T, N); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE-8]]:1: note: class was forward declared here [ClassForwardDeclaredHere] -// CHECK:STDERR: class Incomplete; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE+7]]:8-27: error: binding pattern has incomplete type `array(Incomplete, 1)` in name binding declaration [IncompleteTypeInBindingDecl] +// CHECK:STDERR: min_prelude/parts/array.carbon:12:3-24: note: `` evaluates to incomplete type `` [IncompleteTypeInMonomorphization] +// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE-4]]:1-17: note: class was forward declared here [ClassForwardDeclaredHere] // CHECK:STDERR: -// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE+7]]:8: error: binding pattern has incomplete type `array(Incomplete, 1)` in name binding declaration [IncompleteTypeInBindingDecl] -// CHECK:STDERR: var a: array(Incomplete, 1); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE-15]]:1: note: class was forward declared here [ClassForwardDeclaredHere] -// CHECK:STDERR: class Incomplete; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE+3]]:8-27: error: binding pattern has incomplete type `array(Incomplete, 1)` in name binding declaration [IncompleteTypeInBindingDecl] +// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE-7]]:1-17: note: class was forward declared here [ClassForwardDeclaredHere] // CHECK:STDERR: var a: array(Incomplete, 1); @@ -106,12 +96,8 @@ var p: Incomplete* = &a[0]; 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)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var a: array(1, 1); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_invalid_element.carbon:[[@LINE+3]]:14: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] +// CHECK:STDERR: fail_invalid_element.carbon:[[@LINE+2]]:14: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var a: array(1, 1); diff --git a/toolchain/check/testdata/array/bound_values.carbon b/toolchain/check/testdata/array/bound_values.carbon index 2794c44ba570..1a0dc51b4f77 100644 --- a/toolchain/check/testdata/array/bound_values.carbon +++ b/toolchain/check/testdata/array/bound_values.carbon @@ -36,9 +36,7 @@ let b: array(i32, 3)* = &a; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_negative.carbon:[[@LINE+4]]:19: error: array bound of -1 is negative [ArrayBoundNegative] -// CHECK:STDERR: var a: array(i32, -1); -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_negative.carbon:[[@LINE+2]]:19-20: error: array bound of -1 is negative [ArrayBoundNegative] // CHECK:STDERR: var a: array(i32, -1); @@ -46,9 +44,7 @@ var a: array(i32, -1); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:19: error: array bound of 39999999999999999993 is too large [ArrayBoundTooLarge] -// CHECK:STDERR: var a: array(i32, 39999999999999999993); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:19-38: error: array bound of 39999999999999999993 is too large [ArrayBoundTooLarge] // CHECK:STDERR: var a: array(i32, 39999999999999999993); @@ -56,12 +52,8 @@ var a: array(i32, 39999999999999999993); 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)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var b: array(1, 39999999999999999993); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_invalid_type_with_overflow.carbon:[[@LINE+3]]:14: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] +// CHECK:STDERR: fail_invalid_type_with_overflow.carbon:[[@LINE+2]]:14: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var b: array(1, 39999999999999999993); diff --git a/toolchain/check/testdata/array/element_mismatches.carbon b/toolchain/check/testdata/array/element_mismatches.carbon index 77a71329a613..3a6d9e9cd423 100644 --- a/toolchain/check/testdata/array/element_mismatches.carbon +++ b/toolchain/check/testdata/array/element_mismatches.carbon @@ -16,12 +16,8 @@ library "[[@TEST_NAME]]"; 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)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var a: array(C, 3) = ({}, (), true); -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_arg_wrong_type.carbon:[[@LINE+3]]:22-35: error: cannot implicitly convert expression of type `()` to `C` [ConversionFailure] +// CHECK:STDERR: fail_arg_wrong_type.carbon:[[@LINE+2]]:22-35: note: type `()` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var a: array(C, 3) = ({}, (), true); @@ -33,22 +29,14 @@ class C {} class D {} 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)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var b: array(C, 3) = a; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_var_wrong_type.carbon:[[@LINE+3]]:22: error: cannot implicitly convert expression of type `D` to `C` [ConversionFailure] +// CHECK:STDERR: fail_var_wrong_type.carbon:[[@LINE+2]]:22: note: type `D` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var b: array(C, 3) = a; 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` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var d: array(C, 3) = c; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_var_wrong_type.carbon:[[@LINE+3]]:22: error: cannot copy value of type `C` [CopyOfUncopyableType] +// CHECK:STDERR: fail_var_wrong_type.carbon:[[@LINE+2]]:22: note: type `C` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var d: array(C, 3) = c; @@ -58,9 +46,7 @@ library "[[@TEST_NAME]]"; class C {} -// CHECK:STDERR: fail_arg_too_short.carbon:[[@LINE+4]]:22: error: cannot initialize array of 3 elements from 2 initializers [ArrayInitFromLiteralArgCountMismatch] -// CHECK:STDERR: var a: array(C, 3) = ({}, {}); -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_arg_too_short.carbon:[[@LINE+2]]:22-29: error: cannot initialize array of 3 elements from 2 initializers [ArrayInitFromLiteralArgCountMismatch] // CHECK:STDERR: var a: array(C, 3) = ({}, {}); @@ -71,16 +57,12 @@ library "[[@TEST_NAME]]"; class C {} var a: (C, C); -// CHECK:STDERR: fail_var_too_short.carbon:[[@LINE+4]]:22: error: cannot initialize array of 3 elements from tuple with 2 elements [ArrayInitFromExprArgCountMismatch] -// CHECK:STDERR: var b: array(C, 3) = a; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_var_too_short.carbon:[[@LINE+2]]:22: error: cannot initialize array of 3 elements from tuple with 2 elements [ArrayInitFromExprArgCountMismatch] // CHECK:STDERR: var b: array(C, 3) = a; // --- fail_arg_too_long.carbon -// CHECK:STDERR: fail_arg_too_long.carbon:[[@LINE+4]]:23: error: cannot initialize array of 1 element from 3 initializers [ArrayInitFromLiteralArgCountMismatch] -// CHECK:STDERR: var a: array((), 1) = ((), (), ()); -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_arg_too_long.carbon:[[@LINE+2]]:23-34: error: cannot initialize array of 1 element from 3 initializers [ArrayInitFromLiteralArgCountMismatch] // CHECK:STDERR: var a: array((), 1) = ((), (), ()); diff --git a/toolchain/check/testdata/array/index_not_literal.carbon b/toolchain/check/testdata/array/index_not_literal.carbon index 9a0e9b7f7770..5c98b51b13ef 100644 --- a/toolchain/check/testdata/array/index_not_literal.carbon +++ b/toolchain/check/testdata/array/index_not_literal.carbon @@ -39,9 +39,7 @@ fn F(a: array({}, 3)) -> {} { library "[[@TEST_NAME]]"; fn F(a: array({}, 3)) -> {} { - // CHECK:STDERR: fail_out_of_bound_non_literal.carbon:[[@LINE+4]]:12: error: array index `3` is past the end of type `array({}, 3)` [ArrayIndexOutOfBounds] - // CHECK:STDERR: return a[{.index = 3}.index]; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_out_of_bound_non_literal.carbon:[[@LINE+2]]:12-29: error: array index `3` is past the end of type `array({}, 3)` [ArrayIndexOutOfBounds] // CHECK:STDERR: return a[{.index = 3}.index]; } diff --git a/toolchain/check/testdata/array/init_dependent_bound.carbon b/toolchain/check/testdata/array/init_dependent_bound.carbon index a7b3b12568cf..879a969f0e27 100644 --- a/toolchain/check/testdata/array/init_dependent_bound.carbon +++ b/toolchain/check/testdata/array/init_dependent_bound.carbon @@ -32,9 +32,7 @@ fn H() { library "[[@TEST_NAME]]"; fn F(generic N: i32) { - // CHECK:STDERR: fail_init_dependent_bound.carbon:[[@LINE+4]]:35: error: cannot initialize array with dependent bound from a list of initializers [ArrayInitDependentBound] - // CHECK:STDERR: var unused arr: array(i32, N) = (1, 2, 3); - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_init_dependent_bound.carbon:[[@LINE+2]]:35-43: error: cannot initialize array with dependent bound from a list of initializers [ArrayInitDependentBound] // CHECK:STDERR: var unused arr: array(i32, N) = (1, 2, 3); } diff --git a/toolchain/check/testdata/as/adapter_conversion.carbon b/toolchain/check/testdata/as/adapter_conversion.carbon index d44b1bf22aee..9e8b6bd74609 100644 --- a/toolchain/check/testdata/as/adapter_conversion.carbon +++ b/toolchain/check/testdata/as/adapter_conversion.carbon @@ -133,15 +133,9 @@ fn F(a: A) { // a copy to perform initialization. It's not clear whether that is the right // behavior. - // 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` [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] - // CHECK:STDERR: var unused a_init: A = (a as ({}, Noncopyable)) as A; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_init_tuple_variable.carbon:[[@LINE+4]]:3-22: error: cannot copy value of type `Noncopyable` [CopyOfUncopyableType] + // CHECK:STDERR: fail_init_tuple_variable.carbon:[[@LINE+3]]:3-22: note: type `Noncopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: fail_init_tuple_variable.carbon:[[@LINE+2]]:26-54: note: in copy of `A` [InCopy] // CHECK:STDERR: var unused a_init: A = (a as ({}, Noncopyable)) as A; } @@ -161,12 +155,8 @@ class B { // We do not try to implicitly convert from the first operand of `as` to the // adapted type of the second operand. -// 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)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var b: B = {.x = ()} as B; -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_adapt_init_from_struct.carbon:[[@LINE+3]]:12-25: error: cannot convert expression of type `{.x: ()}` to `B` with `as` [ConversionFailure] +// CHECK:STDERR: fail_adapt_init_from_struct.carbon:[[@LINE+2]]:12-25: note: type `{.x: ()}` does not implement interface `Core.As(B)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var b: B = {.x = ()} as B; diff --git a/toolchain/check/testdata/as/basics.carbon b/toolchain/check/testdata/as/basics.carbon index a06a9ef84e15..a550a89628b3 100644 --- a/toolchain/check/testdata/as/basics.carbon +++ b/toolchain/check/testdata/as/basics.carbon @@ -106,12 +106,8 @@ let n: Y = ({.x = ()} as X) as Y; 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({})` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: let a: {} = 1 as {}; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+3]]:13-19: error: cannot convert expression of type `Core.IntLiteral` to `{}` with `as` [ConversionFailure] +// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+2]]:13-19: note: type `Core.IntLiteral` does not implement interface `Core.As({})` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let a: {} = 1 as {}; @@ -119,12 +115,8 @@ let a: {} = 1 as {}; 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)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: let n: {.x: ()} = {.x = ()} as {.x = ()}; -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_not_type.carbon:[[@LINE+3]]:32-40: error: cannot implicitly convert non-type value of type `{.x: ()}` to `type` [ConversionFailureNonTypeToFacet] +// CHECK:STDERR: fail_not_type.carbon:[[@LINE+2]]:32-40: note: type `{.x: ()}` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let n: {.x: ()} = {.x = ()} as {.x = ()}; diff --git a/toolchain/check/testdata/as/const.carbon b/toolchain/check/testdata/as/const.carbon index 04ab48b6ed25..fc7d3604aee0 100644 --- a/toolchain/check/testdata/as/const.carbon +++ b/toolchain/check/testdata/as/const.carbon @@ -58,20 +58,12 @@ var reference: const X; let ptr: const X* = &reference; 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let unused a: X* = &(reference as X); - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_cannot_remove_const.carbon:[[@LINE+3]]:24-37: error: cannot convert expression of type `const X` to `X` with `as` [ConversionFailure] + // CHECK:STDERR: fail_cannot_remove_const.carbon:[[@LINE+2]]:24-37: note: type `const X` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused a: X* = &(reference as X); - // 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*)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let unused b: X* = ptr as X*; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_cannot_remove_const.carbon:[[@LINE+3]]:22-30: error: cannot convert expression of type `const X*` to `X*` with `as` [ConversionFailure] + // CHECK:STDERR: fail_cannot_remove_const.carbon:[[@LINE+2]]:22-30: note: type `const X*` does not implement interface `Core.As(X*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused b: X* = ptr as X*; } diff --git a/toolchain/check/testdata/as/maybe_unformed.carbon b/toolchain/check/testdata/as/maybe_unformed.carbon index e6804e89d7db..112dca0807e0 100644 --- a/toolchain/check/testdata/as/maybe_unformed.carbon +++ b/toolchain/check/testdata/as/maybe_unformed.carbon @@ -39,20 +39,12 @@ let value: X = Init(); fn Use() { // TODO: These should probably be valid. //@dump-sem-ir-begin - // 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))` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var unused i: Core.MaybeUnformed(X) = Init() as Core.MaybeUnformed(X); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_add_unformed_nonref.carbon:[[@LINE+3]]:41-71: error: cannot convert expression of type `X` to `Core.MaybeUnformed(X)` with `as` [ConversionFailure] + // CHECK:STDERR: fail_todo_add_unformed_nonref.carbon:[[@LINE+2]]:41-71: 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: 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))` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let unused v: Core.MaybeUnformed(X) = value as Core.MaybeUnformed(X); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_add_unformed_nonref.carbon:[[@LINE+3]]:41-70: error: cannot convert expression of type `X` to `Core.MaybeUnformed(X)` with `as` [ConversionFailure] + // CHECK:STDERR: fail_todo_add_unformed_nonref.carbon:[[@LINE+2]]:41-70: 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); //@dump-sem-ir-end @@ -70,46 +62,26 @@ var reference: Core.MaybeUnformed(X); let ptr: Core.MaybeUnformed(X)* = &reference; 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var unused i: X = Init() as X; - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+3]]:21-31: error: cannot convert expression of type `Core.MaybeUnformed(X)` to `X` with `as` [ConversionFailure] + // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+2]]:21-31: note: type `Core.MaybeUnformed(X)` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused i: X = Init() as X; // TODO: The diagnostic should explain that the reason we can't perform this // conversion is due to the expression category. - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var unused j: X = Init() unsafe as X; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+3]]:21-38: error: cannot convert expression of type `Core.MaybeUnformed(X)` to `X` with `unsafe as` [ConversionFailure] + // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+2]]:21-38: 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: 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let unused v: X = value as X; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+3]]:21-30: error: cannot convert expression of type `Core.MaybeUnformed(X)` to `X` with `as` [ConversionFailure] + // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+2]]:21-30: note: type `Core.MaybeUnformed(X)` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused v: X = value as X; - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let unused a: X* = &(reference as X); - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+3]]:24-37: error: cannot convert expression of type `Core.MaybeUnformed(X)` to `X` with `as` [ConversionFailure] + // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+2]]:24-37: note: type `Core.MaybeUnformed(X)` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused a: X* = &(reference as X); - // 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*)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let unused b: X* = ptr as X*; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+3]]:22-30: error: cannot convert expression of type `Core.MaybeUnformed(X)*` to `X*` with `as` [ConversionFailure] + // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+2]]:22-30: note: type `Core.MaybeUnformed(X)*` does not implement interface `Core.As(X*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused b: X* = ptr as X*; } @@ -234,30 +206,30 @@ fn Use() { // CHECK:STDOUT: %pattern_type.a96: type = pattern_type %empty_struct_type [concrete] // CHECK:STDOUT: %self.param_patt.52f: %pattern_type.a96 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.4b1: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt.52f [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc19_3.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc15_3.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc19_3.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc15_3.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.1: %Destroy.WithSelf.Op.type.ef016f.1 = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.925: %pattern_type.6cb = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.617: %pattern_type.6cb = wrapper_binding_pattern self, %self.param_patt.925 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc19_3.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc15_3.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc19_3.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc15_3.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.2: %Destroy.WithSelf.Op.type.ef016f.2 = struct_value () [concrete] // CHECK:STDOUT: %pattern_type.b19: type = pattern_type %.f01 [concrete] // CHECK:STDOUT: %self.param_patt.64e: %pattern_type.b19 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.00a: %pattern_type.b19 = wrapper_binding_pattern self, %self.param_patt.64e [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc19_3.3 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc15_3.3 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc19_3.3 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc15_3.3 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.3: %Destroy.WithSelf.Op.type.ef016f.3 = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.0a9: %pattern_type.55d = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.280: %pattern_type.55d = wrapper_binding_pattern self, %self.param_patt.0a9 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc19_3.4 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc15_3.4 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.4: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.4: type = fn_type @Destroy.WithSelf.Op.loc19_3.4 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.4: type = fn_type @Destroy.WithSelf.Op.loc15_3.4 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.4: %Destroy.WithSelf.Op.type.ef016f.4 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.4: type = fn_type @Destroy.WithSelf.SelfDestruct.loc19_3.4 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.4: type = fn_type @Destroy.WithSelf.SelfDestruct.loc15_3.4 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.4: %Destroy.WithSelf.SelfDestruct.type.fbceb5.4 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -275,56 +247,56 @@ fn Use() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc19_3.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc15_3.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.a96 = ref_param_pattern [concrete = constants.%self.param_patt.52f] // CHECK:STDOUT: %self.patt: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.4b1] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %empty_struct_type = ref_param call_param0 // CHECK:STDOUT: %self: ref %empty_struct_type = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc19_3.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc15_3.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.a96 = ref_param_pattern [concrete = constants.%self.param_patt.52f] // CHECK:STDOUT: %self.patt: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.4b1] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %empty_struct_type = ref_param call_param0 // CHECK:STDOUT: %self: ref %empty_struct_type = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc19_3.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc15_3.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.6cb = ref_param_pattern [concrete = constants.%self.param_patt.925] // CHECK:STDOUT: %self.patt: %pattern_type.6cb = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.617] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %X = ref_param call_param0 // CHECK:STDOUT: %self: ref %X = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc19_3.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc15_3.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.6cb = ref_param_pattern [concrete = constants.%self.param_patt.925] // CHECK:STDOUT: %self.patt: %pattern_type.6cb = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.617] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %X = ref_param call_param0 // CHECK:STDOUT: %self: ref %X = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc19_3.3 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.3] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc15_3.3 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.3] { // CHECK:STDOUT: %self.param_patt: %pattern_type.b19 = ref_param_pattern [concrete = constants.%self.param_patt.64e] // CHECK:STDOUT: %self.patt: %pattern_type.b19 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.00a] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %.f01 = ref_param call_param0 // CHECK:STDOUT: %self: ref %.f01 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.3: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc19_3.3 [concrete = constants.%Destroy.WithSelf.Op.403171.3] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.3: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc15_3.3 [concrete = constants.%Destroy.WithSelf.Op.403171.3] { // CHECK:STDOUT: %self.param_patt: %pattern_type.b19 = ref_param_pattern [concrete = constants.%self.param_patt.64e] // CHECK:STDOUT: %self.patt: %pattern_type.b19 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.00a] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %.f01 = ref_param call_param0 // CHECK:STDOUT: %self: ref %.f01 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.4: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc19_3.4 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.4] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.4: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc15_3.4 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.4] { // CHECK:STDOUT: %self.param_patt: %pattern_type.55d = ref_param_pattern [concrete = constants.%self.param_patt.0a9] // CHECK:STDOUT: %self.patt: %pattern_type.55d = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.280] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %MaybeUnformed.67f = ref_param call_param0 // CHECK:STDOUT: %self: ref %MaybeUnformed.67f = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.4: %Destroy.WithSelf.Op.type.ef016f.4 = fn_decl @Destroy.WithSelf.Op.loc19_3.4 [concrete = constants.%Destroy.WithSelf.Op.403171.4] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.4: %Destroy.WithSelf.Op.type.ef016f.4 = fn_decl @Destroy.WithSelf.Op.loc15_3.4 [concrete = constants.%Destroy.WithSelf.Op.403171.4] { // CHECK:STDOUT: %self.param_patt: %pattern_type.55d = ref_param_pattern [concrete = constants.%self.param_patt.0a9] // CHECK:STDOUT: %self.patt: %pattern_type.55d = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.280] // CHECK:STDOUT: } { @@ -337,19 +309,19 @@ fn Use() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %i.var: ref %MaybeUnformed.67f = var_storage %i.var_patt // CHECK:STDOUT: %Init.ref: %Init.type = name_ref Init, file.%Init.decl [concrete = constants.%Init] -// CHECK:STDOUT: %.loc19_46: ref %X = temporary_storage -// CHECK:STDOUT: %Init.call: init %X to %.loc19_46 = call %Init.ref() -// CHECK:STDOUT: %Core.ref.loc19_51: = name_ref Core, imports.%Core [concrete = imports.%Core] -// CHECK:STDOUT: %MaybeUnformed.ref.loc19_55: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic] -// CHECK:STDOUT: %X.ref.loc19_70: type = name_ref X, file.%X.decl [concrete = constants.%X] -// CHECK:STDOUT: %MaybeUnformed.loc19_71: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f] -// CHECK:STDOUT: %.loc19_48: %MaybeUnformed.67f = converted %Init.call, [concrete = ] +// CHECK:STDOUT: %.loc15_46: ref %X = temporary_storage +// CHECK:STDOUT: %Init.call: init %X to %.loc15_46 = call %Init.ref() +// CHECK:STDOUT: %Core.ref.loc15_51: = name_ref Core, imports.%Core [concrete = imports.%Core] +// CHECK:STDOUT: %MaybeUnformed.ref.loc15_55: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic] +// CHECK:STDOUT: %X.ref.loc15_70: type = name_ref X, file.%X.decl [concrete = constants.%X] +// CHECK:STDOUT: %MaybeUnformed.loc15_71: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f] +// CHECK:STDOUT: %.loc15_48: %MaybeUnformed.67f = converted %Init.call, [concrete = ] // CHECK:STDOUT: assign %i.var, -// CHECK:STDOUT: %.loc19_37: type = splice_block %MaybeUnformed.loc19_37 [concrete = constants.%MaybeUnformed.67f] { -// CHECK:STDOUT: %Core.ref.loc19_17: = name_ref Core, imports.%Core [concrete = imports.%Core] -// CHECK:STDOUT: %MaybeUnformed.ref.loc19_21: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic] -// CHECK:STDOUT: %X.ref.loc19_36: type = name_ref X, file.%X.decl [concrete = constants.%X] -// CHECK:STDOUT: %MaybeUnformed.loc19_37: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f] +// CHECK:STDOUT: %.loc15_37: type = splice_block %MaybeUnformed.loc15_37 [concrete = constants.%MaybeUnformed.67f] { +// CHECK:STDOUT: %Core.ref.loc15_17: = name_ref Core, imports.%Core [concrete = imports.%Core] +// CHECK:STDOUT: %MaybeUnformed.ref.loc15_21: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic] +// CHECK:STDOUT: %X.ref.loc15_36: type = name_ref X, file.%X.decl [concrete = constants.%X] +// CHECK:STDOUT: %MaybeUnformed.loc15_37: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f] // CHECK:STDOUT: } // CHECK:STDOUT: %i: ref %MaybeUnformed.67f = wrapper_binding i, %i.var // CHECK:STDOUT: name_binding_decl { @@ -357,16 +329,16 @@ fn Use() { // CHECK:STDOUT: %i.var_patt: %pattern_type.55d = var_pattern %i.patt [concrete = constants.%i.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %value.ref: %X = name_ref value, file.%value -// CHECK:STDOUT: %Core.ref.loc27_50: = name_ref Core, imports.%Core [concrete = imports.%Core] -// CHECK:STDOUT: %MaybeUnformed.ref.loc27_54: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic] -// CHECK:STDOUT: %X.ref.loc27_69: type = name_ref X, file.%X.decl [concrete = constants.%X] -// CHECK:STDOUT: %MaybeUnformed.loc27_70: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f] -// CHECK:STDOUT: %.loc27_47: %MaybeUnformed.67f = converted %value.ref, [concrete = ] -// CHECK:STDOUT: %.loc27_37: type = splice_block %MaybeUnformed.loc27_37 [concrete = constants.%MaybeUnformed.67f] { -// CHECK:STDOUT: %Core.ref.loc27_17: = name_ref Core, imports.%Core [concrete = imports.%Core] -// CHECK:STDOUT: %MaybeUnformed.ref.loc27_21: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic] -// CHECK:STDOUT: %X.ref.loc27_36: type = name_ref X, file.%X.decl [concrete = constants.%X] -// CHECK:STDOUT: %MaybeUnformed.loc27_37: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f] +// CHECK:STDOUT: %Core.ref.loc19_50: = name_ref Core, imports.%Core [concrete = imports.%Core] +// CHECK:STDOUT: %MaybeUnformed.ref.loc19_54: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic] +// CHECK:STDOUT: %X.ref.loc19_69: type = name_ref X, file.%X.decl [concrete = constants.%X] +// CHECK:STDOUT: %MaybeUnformed.loc19_70: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f] +// CHECK:STDOUT: %.loc19_47: %MaybeUnformed.67f = converted %value.ref, [concrete = ] +// CHECK:STDOUT: %.loc19_37: type = splice_block %MaybeUnformed.loc19_37 [concrete = constants.%MaybeUnformed.67f] { +// CHECK:STDOUT: %Core.ref.loc19_17: = name_ref Core, imports.%Core [concrete = imports.%Core] +// CHECK:STDOUT: %MaybeUnformed.ref.loc19_21: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic] +// CHECK:STDOUT: %X.ref.loc19_36: type = name_ref X, file.%X.decl [concrete = constants.%X] +// CHECK:STDOUT: %MaybeUnformed.loc19_37: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f] // CHECK:STDOUT: } // CHECK:STDOUT: %v: %MaybeUnformed.67f = wrapper_binding v, [concrete = ] // CHECK:STDOUT: name_binding_decl { @@ -377,47 +349,47 @@ fn Use() { // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc19_3.1(%self.param: ref %empty_struct_type) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc15_3.1(%self.param: ref %empty_struct_type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc19_3.1(%self.param: ref %empty_struct_type) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc15_3.1(%self.param: ref %empty_struct_type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc19_3.1(%self.param: ref %empty_struct_type) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc15_3.1(%self.param: ref %empty_struct_type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.1(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.1(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc19_3.2(%self.param: ref %X) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc15_3.2(%self.param: ref %X) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc19_3.2(%self.param: ref %X) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc15_3.2(%self.param: ref %X) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc19_3.2(%self.param: ref %X) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc15_3.2(%self.param: ref %X) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.2(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.2(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc19_3.3(%self.param: ref %.f01) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc15_3.3(%self.param: ref %.f01) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc19_3.3(%self.param: ref %.f01) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc15_3.3(%self.param: ref %.f01) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc19_3.3(%self.param: ref %.f01) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc15_3.3(%self.param: ref %.f01) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.3(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.3(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc19_3.4(%self.param: ref %MaybeUnformed.67f) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc15_3.4(%self.param: ref %MaybeUnformed.67f) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc19_3.4(%self.param: ref %MaybeUnformed.67f) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc15_3.4(%self.param: ref %MaybeUnformed.67f) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc19_3.4(%self.param: ref %MaybeUnformed.67f) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc15_3.4(%self.param: ref %MaybeUnformed.67f) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.4(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.4(%self.param) diff --git a/toolchain/check/testdata/as/partial.carbon b/toolchain/check/testdata/as/partial.carbon index ff1bd6b1162b..dae775968ff8 100644 --- a/toolchain/check/testdata/as/partial.carbon +++ b/toolchain/check/testdata/as/partial.carbon @@ -60,28 +60,16 @@ var reference: partial X; let ptr: partial X* = &reference; 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let unused v: X = value as X; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+3]]:21-30: error: cannot convert expression of type `partial X` to `X` with `as` [ConversionFailure] + // CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+2]]:21-30: note: type `partial X` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused v: X = value as X; - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let unused a: X* = &(reference as X); - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+3]]:24-37: error: cannot convert expression of type `partial X` to `X` with `as` [ConversionFailure] + // CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+2]]:24-37: note: type `partial X` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused a: X* = &(reference as X); - // 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*)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let unused b: X* = ptr as X*; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+3]]:22-30: error: cannot convert expression of type `partial X*` to `X*` with `as` [ConversionFailure] + // CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+2]]:22-30: note: type `partial X*` does not implement interface `Core.As(X*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused b: X* = ptr as X*; } diff --git a/toolchain/check/testdata/as/unsafe_as.carbon b/toolchain/check/testdata/as/unsafe_as.carbon index 97d3ca0369cb..3e948599a4d9 100644 --- a/toolchain/check/testdata/as/unsafe_as.carbon +++ b/toolchain/check/testdata/as/unsafe_as.carbon @@ -18,12 +18,8 @@ class A {}; class B {}; 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return a unsafe as B; - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+3]]:10-22: error: cannot convert expression of type `A` to `B` with `unsafe as` [ConversionFailure] + // CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+2]]:10-22: note: type `A` does not implement interface `Core.UnsafeAs(B)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return a unsafe as B; } diff --git a/toolchain/check/testdata/basics/multi_error.carbon b/toolchain/check/testdata/basics/multi_error.carbon index 582d4e116e92..4162225db8e2 100644 --- a/toolchain/check/testdata/basics/multi_error.carbon +++ b/toolchain/check/testdata/basics/multi_error.carbon @@ -17,14 +17,10 @@ // This regression test ensures that reuse of `` in different scopes // works. -// CHECK:STDERR: fail_multi_error.carbon:[[@LINE+4]]:8: error: implicit parameters of functions must be constant [ImplictParamMustBeConstant] -// CHECK:STDERR: fn Foo[runtime a: ()](); -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_multi_error.carbon:[[@LINE+2]]:8-20: error: implicit parameters of functions must be constant [ImplictParamMustBeConstant] // CHECK:STDERR: fn Foo[runtime a: ()](); -// CHECK:STDERR: fail_multi_error.carbon:[[@LINE+4]]:8: error: implicit parameters of functions must be constant [ImplictParamMustBeConstant] -// CHECK:STDERR: fn Boo[runtime a: ()]() {} -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_multi_error.carbon:[[@LINE+2]]:8-20: error: implicit parameters of functions must be constant [ImplictParamMustBeConstant] // CHECK:STDERR: fn Boo[runtime a: ()]() {} diff --git a/toolchain/check/testdata/basics/name_lookup.carbon b/toolchain/check/testdata/basics/name_lookup.carbon index ebdd01a38d53..0b0f4d0f44e5 100644 --- a/toolchain/check/testdata/basics/name_lookup.carbon +++ b/toolchain/check/testdata/basics/name_lookup.carbon @@ -16,9 +16,7 @@ library "[[@TEST_NAME]]"; fn Main() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_not_found.carbon:[[@LINE+4]]:3: error: name `x` not found [NameNotFound] - // CHECK:STDERR: x; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_not_found.carbon:[[@LINE+2]]:3: error: name `x` not found [NameNotFound] // CHECK:STDERR: x; //@dump-sem-ir-end @@ -30,9 +28,7 @@ library "[[@TEST_NAME]]"; fn F() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_qualififier_unsupported.carbon:[[@LINE+4]]:3: error: type `bool` does not support qualified expressions [QualifiedExprUnsupported] - // CHECK:STDERR: true.b; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_qualififier_unsupported.carbon:[[@LINE+2]]:3-8: error: type `bool` does not support qualified expressions [QualifiedExprUnsupported] // CHECK:STDERR: true.b; //@dump-sem-ir-end diff --git a/toolchain/check/testdata/builtins/array/make_type.carbon b/toolchain/check/testdata/builtins/array/make_type.carbon index 94ed6b6e5993..27f9beaa023f 100644 --- a/toolchain/check/testdata/builtins/array/make_type.carbon +++ b/toolchain/check/testdata/builtins/array/make_type.carbon @@ -63,9 +63,7 @@ library "[[@TEST_NAME]]"; import library "types"; -// CHECK:STDERR: fail_negative_bound.carbon:[[@LINE+4]]:8: error: array bound of -1 is negative [ArrayBoundNegative] -// CHECK:STDERR: var n: MakeArray(i32, -1); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_negative_bound.carbon:[[@LINE+2]]:8-25: error: array bound of -1 is negative [ArrayBoundNegative] // CHECK:STDERR: var n: MakeArray(i32, -1); @@ -75,9 +73,7 @@ library "[[@TEST_NAME]]"; import library "types"; -// CHECK:STDERR: fail_bound_too_large.carbon:[[@LINE+4]]:8: error: array bound of 18446744073709551616 is too large [ArrayBoundTooLarge] -// CHECK:STDERR: var n: MakeArray(i32, 0x1_0000_0000_0000_0000); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bound_too_large.carbon:[[@LINE+2]]:8-46: error: array bound of 18446744073709551616 is too large [ArrayBoundTooLarge] // CHECK:STDERR: var n: MakeArray(i32, 0x1_0000_0000_0000_0000); @@ -88,9 +84,7 @@ library "[[@TEST_NAME]]"; import library "types"; fn F(n: Core.IntLiteral) { - // CHECK:STDERR: fail_dyn_bound.carbon:[[@LINE+4]]:17: error: cannot evaluate type expression [TypeExprEvaluationFailure] - // CHECK:STDERR: var unused a: MakeArray(i32, n); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_dyn_bound.carbon:[[@LINE+2]]:17-33: error: cannot evaluate type expression [TypeExprEvaluationFailure] // CHECK:STDERR: var unused a: MakeArray(i32, n); } diff --git a/toolchain/check/testdata/builtins/char_literal/add.carbon b/toolchain/check/testdata/builtins/char_literal/add.carbon index 4e9d50ca44dd..7cb00f9d7bb3 100644 --- a/toolchain/check/testdata/builtins/char_literal/add.carbon +++ b/toolchain/check/testdata/builtins/char_literal/add.carbon @@ -41,34 +41,22 @@ alias IntLiteral = MakeIntLiteral(); fn AddCharInt(c: CharLiteral, n: IntLiteral) -> CharLiteral = "char_literal.add"; fn Negate(n: IntLiteral) -> IntLiteral = "int.snegate"; -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:22: error: character arithmetic result 4503599627370593 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult] -// CHECK:STDERR: let a: CharLiteral = AddCharInt('a', 0x10000000000000); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:22-54: error: character arithmetic result 4503599627370593 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult] // CHECK:STDERR: let a: CharLiteral = AddCharInt('a', 0x10000000000000); -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+11]]:5: error: duplicate name `a` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: let a: CharLiteral = AddCharInt('\u{10FFFF}', 1); -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_overflow.carbon:[[@LINE-5]]:5: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: let a: CharLiteral = AddCharInt('a', 0x10000000000000); -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+5]]:5: error: duplicate name `a` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_overflow.carbon:[[@LINE-3]]:5-18: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:22: error: character arithmetic result 1114112 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult] -// CHECK:STDERR: let a: CharLiteral = AddCharInt('\u{10FFFF}', 1); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:22-48: error: character arithmetic result 1114112 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult] // CHECK:STDERR: let a: CharLiteral = AddCharInt('\u{10FFFF}', 1); -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:22: error: character arithmetic result 55296 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult] -// CHECK:STDERR: let b: CharLiteral = AddCharInt('\u{D7FF}', 1); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:22-46: error: character arithmetic result 55296 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult] // CHECK:STDERR: let b: CharLiteral = AddCharInt('\u{D7FF}', 1); -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:22: error: character arithmetic result -1 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult] -// CHECK:STDERR: let c: CharLiteral = AddCharInt('a', Negate(98)); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:22-48: error: character arithmetic result -1 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult] // CHECK:STDERR: let c: CharLiteral = AddCharInt('a', Negate(98)); diff --git a/toolchain/check/testdata/builtins/char_literal/convert_char.carbon b/toolchain/check/testdata/builtins/char_literal/convert_char.carbon index 02038881403b..09ef3df465e7 100644 --- a/toolchain/check/testdata/builtins/char_literal/convert_char.carbon +++ b/toolchain/check/testdata/builtins/char_literal/convert_char.carbon @@ -26,21 +26,15 @@ fn ToChar(c: CharLiteral) -> UInt(8) = "char_literal.convert_char"; library "[[@TEST_NAME]]"; import library "builtin"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "char_literal.convert_char" [InvalidBuiltinSignature] -// CHECK:STDERR: fn ToCharBarResultU16(c: CharLiteral) -> UInt(16) = "char_literal.convert_char"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-51: error: invalid signature for builtin function "char_literal.convert_char" [InvalidBuiltinSignature] // CHECK:STDERR: fn ToCharBarResultU16(c: CharLiteral) -> UInt(16) = "char_literal.convert_char"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "char_literal.convert_char" [InvalidBuiltinSignature] -// CHECK:STDERR: fn ToCharBadResultU9(c: CharLiteral) -> UInt(9) = "char_literal.convert_char"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-49: error: invalid signature for builtin function "char_literal.convert_char" [InvalidBuiltinSignature] // CHECK:STDERR: fn ToCharBadResultU9(c: CharLiteral) -> UInt(9) = "char_literal.convert_char"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "char_literal.convert_char" [InvalidBuiltinSignature] -// CHECK:STDERR: fn ToCharNoParam() -> UInt(8) = "char_literal.convert_char"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-31: error: invalid signature for builtin function "char_literal.convert_char" [InvalidBuiltinSignature] // CHECK:STDERR: fn ToCharNoParam() -> UInt(8) = "char_literal.convert_char"; @@ -50,13 +44,9 @@ library "[[@TEST_NAME]]"; import library "builtin"; let c: CharLiteral = 'a'; -// CHECK:STDERR: fail_runtime_call.carbon:[[@LINE+8]]:18: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] -// CHECK:STDERR: let d: UInt(8) = ToChar(c); -// CHECK:STDERR: ^~~~~~~~~ -// CHECK:STDERR: fail_runtime_call.carbon:[[@LINE-6]]:1: in import [InImport] -// CHECK:STDERR: builtin.carbon:10:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] -// CHECK:STDERR: fn ToChar(c: CharLiteral) -> UInt(8) = "char_literal.convert_char"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_runtime_call.carbon:[[@LINE+4]]:18-26: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: imported from: fail_runtime_call.carbon:[[@LINE-4]]:1 [InImport] +// CHECK:STDERR: builtin.carbon:10:1-38: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] // CHECK:STDERR: let d: UInt(8) = ToChar(c); @@ -76,9 +66,7 @@ let c: UInt(8) = ToChar('\u{7F}'); library "[[@TEST_NAME]]"; import library "builtin"; -// CHECK:STDERR: fail_size_small.carbon:[[@LINE+4]]:18: error: character value U+0080 too large for type `` [CharTooLargeForType] -// CHECK:STDERR: let c: UInt(8) = ToChar('\u{80}'); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_size_small.carbon:[[@LINE+2]]:18-33: error: character value U+0080 too large for type `` [CharTooLargeForType] // CHECK:STDERR: let c: UInt(8) = ToChar('\u{80}'); @@ -87,9 +75,7 @@ let c: UInt(8) = ToChar('\u{80}'); library "[[@TEST_NAME]]"; import library "builtin"; -// CHECK:STDERR: fail_size_multi_byte.carbon:[[@LINE+4]]:18: error: character value U+1E15 too large for type `` [CharTooLargeForType] -// CHECK:STDERR: let c: UInt(8) = ToChar('\u{1E15}'); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_size_multi_byte.carbon:[[@LINE+2]]:18-35: error: character value U+1E15 too large for type `` [CharTooLargeForType] // CHECK:STDERR: let c: UInt(8) = ToChar('\u{1E15}'); diff --git a/toolchain/check/testdata/builtins/char_literal/convert_int.carbon b/toolchain/check/testdata/builtins/char_literal/convert_int.carbon index 26d0b58da5bb..a4165f733274 100644 --- a/toolchain/check/testdata/builtins/char_literal/convert_int.carbon +++ b/toolchain/check/testdata/builtins/char_literal/convert_int.carbon @@ -45,16 +45,10 @@ fn UInt(n: IntLiteral) -> type = "int.make_type_unsigned"; fn ConvertToU8(c: CharLiteral) -> UInt(8) = "char_literal.convert_int"; -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+11]]:13: error: character value U+0100 too large for type `` [CharTooLargeForType] -// CHECK:STDERR: let g: u8 = ConvertToU8('\u{100}'); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+5]]:13-34: error: character value U+0100 too large for type `` [CharTooLargeForType] // CHECK:STDERR: -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+7]]:13: error: cannot implicitly convert expression of type `` to `u8` [ConversionFailure] -// CHECK:STDERR: let g: u8 = ConvertToU8('\u{100}'); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:13: note: type `` does not implement interface `Core.ImplicitAs(u8)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: let g: u8 = ConvertToU8('\u{100}'); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:13-34: error: cannot implicitly convert expression of type `` to `u8` [ConversionFailure] +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:13-34: note: type `` does not implement interface `Core.ImplicitAs(u8)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let g: u8 = ConvertToU8('\u{100}'); diff --git a/toolchain/check/testdata/builtins/char_literal/sub_int.carbon b/toolchain/check/testdata/builtins/char_literal/sub_int.carbon index 0869d84cc4ab..ccc3da192723 100644 --- a/toolchain/check/testdata/builtins/char_literal/sub_int.carbon +++ b/toolchain/check/testdata/builtins/char_literal/sub_int.carbon @@ -42,15 +42,11 @@ alias IntLiteral = MakeIntLiteral(); fn SubCharInt(c: CharLiteral, n: IntLiteral) -> CharLiteral = "char_literal.sub_int"; fn Negate(n: IntLiteral) -> IntLiteral = "int.snegate"; -// CHECK:STDERR: fail_invalid_result.carbon:[[@LINE+4]]:22: error: character arithmetic result -1 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult] -// CHECK:STDERR: let a: CharLiteral = SubCharInt('\u{0000}', 1); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_invalid_result.carbon:[[@LINE+2]]:22-46: error: character arithmetic result -1 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult] // CHECK:STDERR: let a: CharLiteral = SubCharInt('\u{0000}', 1); -// CHECK:STDERR: fail_invalid_result.carbon:[[@LINE+4]]:22: error: character arithmetic result 1114112 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult] -// CHECK:STDERR: let b: CharLiteral = SubCharInt('\u{10FFFF}', Negate(1)); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_invalid_result.carbon:[[@LINE+2]]:22-56: error: character arithmetic result 1114112 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult] // CHECK:STDERR: let b: CharLiteral = SubCharInt('\u{10FFFF}', Negate(1)); diff --git a/toolchain/check/testdata/builtins/cpp/std/initializer_list/make.carbon b/toolchain/check/testdata/builtins/cpp/std/initializer_list/make.carbon index 541a0cf84c8e..fbf742e49e96 100644 --- a/toolchain/check/testdata/builtins/cpp/std/initializer_list/make.carbon +++ b/toolchain/check/testdata/builtins/cpp/std/initializer_list/make.carbon @@ -58,16 +58,10 @@ library "[[@TEST_NAME]]"; class FailIncomplete; -// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+11]]:17: error: function returns incomplete type `FailIncomplete` [IncompleteTypeInFunctionReturnType] -// CHECK:STDERR: fn Make(n: i32) -> FailIncomplete = "cpp.std.initializer_list.make"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_incomplete.carbon:[[@LINE-5]]:1: note: class was forward declared here [ClassForwardDeclaredHere] -// CHECK:STDERR: class FailIncomplete; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+5]]:17-33: error: function returns incomplete type `FailIncomplete` [IncompleteTypeInFunctionReturnType] +// CHECK:STDERR: fail_incomplete.carbon:[[@LINE-3]]:1-21: note: class was forward declared here [ClassForwardDeclaredHere] // CHECK:STDERR: -// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature] -// CHECK:STDERR: fn Make(n: i32) -> FailIncomplete = "cpp.std.initializer_list.make"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature] // CHECK:STDERR: fn Make(n: i32) -> FailIncomplete = "cpp.std.initializer_list.make"; @@ -80,9 +74,7 @@ class FailWrongArg { var end: i32*; } -// CHECK:STDERR: fail_wrong_arg.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature] -// CHECK:STDERR: fn Make(n: i32) -> FailWrongArg = "cpp.std.initializer_list.make"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_wrong_arg.carbon:[[@LINE+2]]:1-33: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature] // CHECK:STDERR: fn Make(n: i32) -> FailWrongArg = "cpp.std.initializer_list.make"; @@ -95,9 +87,7 @@ class FailWrongArgCount { var end: i32*; } -// CHECK:STDERR: fail_wrong_arg_count.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature] -// CHECK:STDERR: fn Make(arr: array(i32, 3), n: i32) -> FailWrongArgCount = "cpp.std.initializer_list.make"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_wrong_arg_count.carbon:[[@LINE+2]]:1-58: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature] // CHECK:STDERR: fn Make(arr: array(i32, 3), n: i32) -> FailWrongArgCount = "cpp.std.initializer_list.make"; @@ -105,9 +95,7 @@ fn Make(arr: array(i32, 3), n: i32) -> FailWrongArgCount = "cpp.std.initializer_ library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_not_a_class.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature] -// CHECK:STDERR: fn Make(arr: array(i32, 3)) -> i32 = "cpp.std.initializer_list.make"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_not_a_class.carbon:[[@LINE+2]]:1-36: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature] // CHECK:STDERR: fn Make(arr: array(i32, 3)) -> i32 = "cpp.std.initializer_list.make"; @@ -119,9 +107,7 @@ class FailWrongFieldCount { var start: i32*; } -// CHECK:STDERR: fail_wrong_field_count.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature] -// CHECK:STDERR: fn Make(arr: array(i32, 3)) -> FailWrongFieldCount = "cpp.std.initializer_list.make"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_wrong_field_count.carbon:[[@LINE+2]]:1-52: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature] // CHECK:STDERR: fn Make(arr: array(i32, 3)) -> FailWrongFieldCount = "cpp.std.initializer_list.make"; @@ -134,9 +120,7 @@ class FailWrongFirstField { var end: i32; } -// CHECK:STDERR: fail_wrong_first_field.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature] -// CHECK:STDERR: fn Make(arr: array(i32, 3)) -> FailWrongFirstField = "cpp.std.initializer_list.make"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_wrong_first_field.carbon:[[@LINE+2]]:1-52: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature] // CHECK:STDERR: fn Make(arr: array(i32, 3)) -> FailWrongFirstField = "cpp.std.initializer_list.make"; @@ -149,8 +133,6 @@ class FailWrongSecondField { var end: {.a: i32}; } -// CHECK:STDERR: fail_wrong_second_field.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature] -// CHECK:STDERR: fn Make(arr: array(i32, 3)) -> FailWrongSecondField = "cpp.std.initializer_list.make"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_wrong_second_field.carbon:[[@LINE+2]]:1-53: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature] // CHECK:STDERR: fn Make(arr: array(i32, 3)) -> FailWrongSecondField = "cpp.std.initializer_list.make"; diff --git a/toolchain/check/testdata/builtins/float/add.carbon b/toolchain/check/testdata/builtins/float/add.carbon index c6dfd5691510..a5f46e6d84f1 100644 --- a/toolchain/check/testdata/builtins/float/add.carbon +++ b/toolchain/check/testdata/builtins/float/add.carbon @@ -28,19 +28,13 @@ var x: f64 = Add(2.2, 2.3); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.add" [InvalidBuiltinSignature] -// CHECK:STDERR: fn TooFew(a: f64) -> f64 = "float.add"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-26: error: invalid signature for builtin function "float.add" [InvalidBuiltinSignature] // CHECK:STDERR: fn TooFew(a: f64) -> f64 = "float.add"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.add" [InvalidBuiltinSignature] -// CHECK:STDERR: fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.add"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-43: error: invalid signature for builtin function "float.add" [InvalidBuiltinSignature] // CHECK:STDERR: fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.add"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.add" [InvalidBuiltinSignature] -// CHECK:STDERR: fn BadReturnType(a: f64, b: f64) -> bool = "float.add"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-42: error: invalid signature for builtin function "float.add" [InvalidBuiltinSignature] // CHECK:STDERR: fn BadReturnType(a: f64, b: f64) -> bool = "float.add"; fn JustRight(a: f64, b: f64) -> f64 = "float.add"; diff --git a/toolchain/check/testdata/builtins/float/add_assign.carbon b/toolchain/check/testdata/builtins/float/add_assign.carbon index 48c8a2a9d87a..7c211b362d2c 100644 --- a/toolchain/check/testdata/builtins/float/add_assign.carbon +++ b/toolchain/check/testdata/builtins/float/add_assign.carbon @@ -24,15 +24,11 @@ fn Call(ref a: f64, b: f64) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.add_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn NotRef(a: f64, b: f64) = "float.add_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "float.add_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn NotRef(a: f64, b: f64) = "float.add_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.add_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn MixedTypes(ref a: f64, b: f32) = "float.add_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "float.add_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn MixedTypes(ref a: f64, b: f32) = "float.add_assign"; @@ -41,8 +37,6 @@ fn MixedTypes(ref a: f64, b: f32) = "float.add_assign"; library "[[@TEST_NAME]]"; fn Literal() -> type = "float_literal.make_type"; -// CHECK:STDERR: fail_literal.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.add_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.add_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-51: error: invalid signature for builtin function "float.add_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.add_assign"; diff --git a/toolchain/check/testdata/builtins/float/convert_checked.carbon b/toolchain/check/testdata/builtins/float/convert_checked.carbon index 29cef8869b40..9543097117a8 100644 --- a/toolchain/check/testdata/builtins/float/convert_checked.carbon +++ b/toolchain/check/testdata/builtins/float/convert_checked.carbon @@ -110,19 +110,13 @@ import library "f32"; import library "f64"; //@dump-sem-ir-begin -// CHECK:STDERR: fail_truncate_overflow.carbon:[[@LINE+4]]:14: error: value 9.9999999999999994E+38 too large for floating-point type `f32` [FloatTooLargeForType] -// CHECK:STDERR: let a: f32 = Float64ToFloat32(1.0e39); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_truncate_overflow.carbon:[[@LINE+2]]:14-37: error: value 9.9999999999999994E+38 too large for floating-point type `f32` [FloatTooLargeForType] // CHECK:STDERR: let a: f32 = Float64ToFloat32(1.0e39); -// CHECK:STDERR: fail_truncate_overflow.carbon:[[@LINE+4]]:14: error: value 10*10^38 too large for floating-point type `f32` [FloatLiteralTooLargeForType] -// CHECK:STDERR: let b: f32 = FloatLiteralToFloat32(1.0e39); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_truncate_overflow.carbon:[[@LINE+2]]:14-42: error: value 10*10^38 too large for floating-point type `f32` [FloatLiteralTooLargeForType] // CHECK:STDERR: let b: f32 = FloatLiteralToFloat32(1.0e39); -// CHECK:STDERR: fail_truncate_overflow.carbon:[[@LINE+4]]:14: error: value 10*10^308 too large for floating-point type `f64` [FloatLiteralTooLargeForType] -// CHECK:STDERR: let c: f64 = FloatLiteralToFloat64(1.0e309); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_truncate_overflow.carbon:[[@LINE+2]]:14-43: error: value 10*10^308 too large for floating-point type `f64` [FloatLiteralTooLargeForType] // CHECK:STDERR: let c: f64 = FloatLiteralToFloat64(1.0e309); //@dump-sem-ir-end @@ -144,13 +138,9 @@ import library "f64"; //@dump-sem-ir-begin let not_constant_64: f64 = 0.0; -// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+8]]:33: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] -// CHECK:STDERR: let convert_not_constant: f64 = Float64ToFloat64(not_constant_64); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_not_constant.carbon:[[@LINE-7]]:1: in import [InImport] -// CHECK:STDERR: f64.carbon:5:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] -// CHECK:STDERR: fn Float64ToFloat64(a: f64) -> f64 = "float.convert_checked"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+4]]:33-65: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: imported from: fail_not_constant.carbon:[[@LINE-5]]:1 [InImport] +// CHECK:STDERR: f64.carbon:5:1-36: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] // CHECK:STDERR: let convert_not_constant: f64 = Float64ToFloat64(not_constant_64); //@dump-sem-ir-end @@ -625,24 +615,24 @@ let convert_not_constant: f64 = Float64ToFloat64(not_constant_64); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { -// CHECK:STDOUT: %.loc11_37.1: %f32.3bc = value_of_initializer @__global_init.%Float64ToFloat32.call [concrete = ] -// CHECK:STDOUT: %.loc11_37.2: %f32.3bc = converted @__global_init.%Float64ToFloat32.call, %.loc11_37.1 [concrete = ] -// CHECK:STDOUT: %f32.loc11: type = type_literal constants.%f32.3bc [concrete = constants.%f32.3bc] -// CHECK:STDOUT: %a: %f32.3bc = wrapper_binding a, %.loc11_37.2 [concrete = ] +// CHECK:STDOUT: %.loc9_37.1: %f32.3bc = value_of_initializer @__global_init.%Float64ToFloat32.call [concrete = ] +// CHECK:STDOUT: %.loc9_37.2: %f32.3bc = converted @__global_init.%Float64ToFloat32.call, %.loc9_37.1 [concrete = ] +// CHECK:STDOUT: %f32.loc9: type = type_literal constants.%f32.3bc [concrete = constants.%f32.3bc] +// CHECK:STDOUT: %a: %f32.3bc = wrapper_binding a, %.loc9_37.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %a.patt: %pattern_type.239 = value_binding_pattern a [concrete = constants.%a.patt.56d] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc16_42.1: %f32.3bc = value_of_initializer @__global_init.%FloatLiteralToFloat32.call [concrete = ] -// CHECK:STDOUT: %.loc16_42.2: %f32.3bc = converted @__global_init.%FloatLiteralToFloat32.call, %.loc16_42.1 [concrete = ] -// CHECK:STDOUT: %f32.loc16: type = type_literal constants.%f32.3bc [concrete = constants.%f32.3bc] -// CHECK:STDOUT: %b: %f32.3bc = wrapper_binding b, %.loc16_42.2 [concrete = ] +// CHECK:STDOUT: %.loc12_42.1: %f32.3bc = value_of_initializer @__global_init.%FloatLiteralToFloat32.call [concrete = ] +// CHECK:STDOUT: %.loc12_42.2: %f32.3bc = converted @__global_init.%FloatLiteralToFloat32.call, %.loc12_42.1 [concrete = ] +// CHECK:STDOUT: %f32.loc12: type = type_literal constants.%f32.3bc [concrete = constants.%f32.3bc] +// CHECK:STDOUT: %b: %f32.3bc = wrapper_binding b, %.loc12_42.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %b.patt: %pattern_type.239 = value_binding_pattern b [concrete = constants.%b.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc21_43.1: %f64.761 = value_of_initializer @__global_init.%FloatLiteralToFloat64.call [concrete = ] -// CHECK:STDOUT: %.loc21_43.2: %f64.761 = converted @__global_init.%FloatLiteralToFloat64.call, %.loc21_43.1 [concrete = ] +// CHECK:STDOUT: %.loc15_43.1: %f64.761 = value_of_initializer @__global_init.%FloatLiteralToFloat64.call [concrete = ] +// CHECK:STDOUT: %.loc15_43.2: %f64.761 = converted @__global_init.%FloatLiteralToFloat64.call, %.loc15_43.1 [concrete = ] // CHECK:STDOUT: %f64: type = type_literal constants.%f64.761 [concrete = constants.%f64.761] -// CHECK:STDOUT: %c: %f64.761 = wrapper_binding c, %.loc21_43.2 [concrete = ] +// CHECK:STDOUT: %c: %f64.761 = wrapper_binding c, %.loc15_43.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %c.patt: %pattern_type.667 = value_binding_pattern c [concrete = constants.%c.patt] // CHECK:STDOUT: } @@ -651,21 +641,21 @@ let convert_not_constant: f64 = Float64ToFloat64(not_constant_64); // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Float64ToFloat32.ref: %Float64ToFloat32.type = name_ref Float64ToFloat32, imports.%Main.Float64ToFloat32 [concrete = constants.%Float64ToFloat32] -// CHECK:STDOUT: %float.loc11: Core.FloatLiteral = float_literal_value 10e38 [concrete = constants.%float.cfcfd2.1] +// CHECK:STDOUT: %float.loc9: Core.FloatLiteral = float_literal_value 10e38 [concrete = constants.%float.cfcfd2.1] // CHECK:STDOUT: %impl.elem0: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] -// CHECK:STDOUT: %bound_method.loc11_31.1: = bound_method %float.loc11, %impl.elem0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %bound_method.loc9_31.1: = bound_method %float.loc9, %impl.elem0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound] // CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc11_31.2: = bound_method %float.loc11, %specific_fn [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call: init %f64.761 = call %bound_method.loc11_31.2(%float.loc11) [concrete = constants.%float.8d8] -// CHECK:STDOUT: %.loc11_31.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%float.8d8] -// CHECK:STDOUT: %.loc11_31.2: %f64.761 = converted %float.loc11, %.loc11_31.1 [concrete = constants.%float.8d8] -// CHECK:STDOUT: %Float64ToFloat32.call: init %f32.3bc = call %Float64ToFloat32.ref(%.loc11_31.2) [concrete = ] +// CHECK:STDOUT: %bound_method.loc9_31.2: = bound_method %float.loc9, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call: init %f64.761 = call %bound_method.loc9_31.2(%float.loc9) [concrete = constants.%float.8d8] +// CHECK:STDOUT: %.loc9_31.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%float.8d8] +// CHECK:STDOUT: %.loc9_31.2: %f64.761 = converted %float.loc9, %.loc9_31.1 [concrete = constants.%float.8d8] +// CHECK:STDOUT: %Float64ToFloat32.call: init %f32.3bc = call %Float64ToFloat32.ref(%.loc9_31.2) [concrete = ] // CHECK:STDOUT: %FloatLiteralToFloat32.ref: %FloatLiteralToFloat32.type = name_ref FloatLiteralToFloat32, imports.%Main.FloatLiteralToFloat32 [concrete = constants.%FloatLiteralToFloat32] -// CHECK:STDOUT: %float.loc16: Core.FloatLiteral = float_literal_value 10e38 [concrete = constants.%float.cfcfd2.2] -// CHECK:STDOUT: %FloatLiteralToFloat32.call: init %f32.3bc = call %FloatLiteralToFloat32.ref(%float.loc16) [concrete = ] +// CHECK:STDOUT: %float.loc12: Core.FloatLiteral = float_literal_value 10e38 [concrete = constants.%float.cfcfd2.2] +// CHECK:STDOUT: %FloatLiteralToFloat32.call: init %f32.3bc = call %FloatLiteralToFloat32.ref(%float.loc12) [concrete = ] // CHECK:STDOUT: %FloatLiteralToFloat64.ref: %FloatLiteralToFloat64.type = name_ref FloatLiteralToFloat64, imports.%Main.FloatLiteralToFloat64 [concrete = constants.%FloatLiteralToFloat64] -// CHECK:STDOUT: %float.loc21: Core.FloatLiteral = float_literal_value 10e308 [concrete = constants.%float.82f] -// CHECK:STDOUT: %FloatLiteralToFloat64.call: init %f64.761 = call %FloatLiteralToFloat64.ref(%float.loc21) [concrete = ] +// CHECK:STDOUT: %float.loc15: Core.FloatLiteral = float_literal_value 10e308 [concrete = constants.%float.82f] +// CHECK:STDOUT: %FloatLiteralToFloat64.call: init %f64.761 = call %FloatLiteralToFloat64.ref(%float.loc15) [concrete = ] // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -800,10 +790,10 @@ let convert_not_constant: f64 = Float64ToFloat64(not_constant_64); // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %not_constant_64.patt: %pattern_type.667 = value_binding_pattern not_constant_64 [concrete = constants.%not_constant_64.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc15_65.1: %f64.761 = value_of_initializer @__global_init.%Float64ToFloat64.call -// CHECK:STDOUT: %.loc15_65.2: %f64.761 = converted @__global_init.%Float64ToFloat64.call, %.loc15_65.1 -// CHECK:STDOUT: %f64.loc15: type = type_literal constants.%f64.761 [concrete = constants.%f64.761] -// CHECK:STDOUT: %convert_not_constant: %f64.761 = wrapper_binding convert_not_constant, %.loc15_65.2 +// CHECK:STDOUT: %.loc11_65.1: %f64.761 = value_of_initializer @__global_init.%Float64ToFloat64.call +// CHECK:STDOUT: %.loc11_65.2: %f64.761 = converted @__global_init.%Float64ToFloat64.call, %.loc11_65.1 +// CHECK:STDOUT: %f64.loc11: type = type_literal constants.%f64.761 [concrete = constants.%f64.761] +// CHECK:STDOUT: %convert_not_constant: %f64.761 = wrapper_binding convert_not_constant, %.loc11_65.2 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %convert_not_constant.patt: %pattern_type.667 = value_binding_pattern convert_not_constant [concrete = constants.%convert_not_constant.patt] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/builtins/float/convert_int.carbon b/toolchain/check/testdata/builtins/float/convert_int.carbon index c4a3e68471cd..67fa0c6a2e7e 100644 --- a/toolchain/check/testdata/builtins/float/convert_int.carbon +++ b/toolchain/check/testdata/builtins/float/convert_int.carbon @@ -96,104 +96,74 @@ library "[[@TEST_NAME]]"; import library "float_to_int"; //@dump-sem-ir-begin -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:21: error: floating-point value 2147483648 too large for integer type `i32` [FloatTooLargeForIntType] -// CHECK:STDERR: let overflow: i32 = ConvertF64ToI32(2147483648.0); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:21-49: error: floating-point value 2147483648 too large for integer type `i32` [FloatTooLargeForIntType] // CHECK:STDERR: let overflow: i32 = ConvertF64ToI32(2147483648.0); -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:22: error: floating-point value -2147483649 too large for integer type `i32` [FloatTooLargeForIntType] -// CHECK:STDERR: let underflow: i32 = ConvertF64ToI32(Negate(2147483649.0)); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:22-58: error: floating-point value -2147483649 too large for integer type `i32` [FloatTooLargeForIntType] // CHECK:STDERR: let underflow: i32 = ConvertF64ToI32(Negate(2147483649.0)); -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:25: error: floating-point value -1 too large for integer type `u32` [FloatTooLargeForIntType] -// CHECK:STDERR: let unsigned_neg: u32 = ConvertF64ToU32(Negate(1.0)); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:25-52: error: floating-point value -1 too large for integer type `u32` [FloatTooLargeForIntType] // CHECK:STDERR: let unsigned_neg: u32 = ConvertF64ToU32(Negate(1.0)); -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:29: error: floating-point value 21474836480*10^-1 too large for integer type `i32` [RealLiteralTooLargeForIntType] -// CHECK:STDERR: let literal_overflow: i32 = ConvertFloatLiteralToI32(2147483648.0); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:29-66: error: floating-point value 21474836480*10^-1 too large for integer type `i32` [RealLiteralTooLargeForIntType] // CHECK:STDERR: let literal_overflow: i32 = ConvertFloatLiteralToI32(2147483648.0); -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:35: error: floating-point value 10*10^999999 too large for integer type `i32` [RealLiteralTooLargeForIntType] -// CHECK:STDERR: let giant_literal_overflow: i32 = ConvertFloatLiteralToI32(1.0e1000000); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:35-71: error: floating-point value 10*10^999999 too large for integer type `i32` [RealLiteralTooLargeForIntType] // CHECK:STDERR: let giant_literal_overflow: i32 = ConvertFloatLiteralToI32(1.0e1000000); // -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:62: error: floating-point value 10*10^9999999 too large to convert: result would be an integer whose width is greater than the maximum supported width of 8388608 [RealLiteralTooLargeForUnsizedInt] -// CHECK:STDERR: let giant_literal_to_int_literal_overflow: Core.IntLiteral = ConvertFloatLiteralToIntLiteral(1.0e10000000); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:62-106: error: floating-point value 10*10^9999999 too large to convert: result would be an integer whose width is greater than the maximum supported width of 8388608 [RealLiteralTooLargeForUnsizedInt] // CHECK:STDERR: let giant_literal_to_int_literal_overflow: Core.IntLiteral = ConvertFloatLiteralToIntLiteral(1.0e10000000); // -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:44: error: floating-point value 10*10^999999999999999999999999999999999 too large for integer type `i32` [RealLiteralTooLargeForIntType] -// CHECK:STDERR: let giant_exponent_literal_overflow: i32 = ConvertFloatLiteralToI32(1.0e1000000000000000000000000000000000); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:44-107: error: floating-point value 10*10^999999999999999999999999999999999 too large for integer type `i32` [RealLiteralTooLargeForIntType] // CHECK:STDERR: let giant_exponent_literal_overflow: i32 = ConvertFloatLiteralToI32(1.0e1000000000000000000000000000000000); // // -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:71: error: floating-point value 10*10^999999999999999999999999999999999 too large to convert: result would be an integer whose width is greater than the maximum supported width of 8388608 [RealLiteralTooLargeForUnsizedInt] -// CHECK:STDERR: let giant_exponent_literal_to_int_literal_overflow: Core.IntLiteral = ConvertFloatLiteralToIntLiteral(1.0e1000000000000000000000000000000000); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:71-141: error: floating-point value 10*10^999999999999999999999999999999999 too large to convert: result would be an integer whose width is greater than the maximum supported width of 8388608 [RealLiteralTooLargeForUnsizedInt] // CHECK:STDERR: let giant_exponent_literal_to_int_literal_overflow: Core.IntLiteral = ConvertFloatLiteralToIntLiteral(1.0e1000000000000000000000000000000000); // -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:44: error: floating-point value 2147483648*10^0 too large for integer type `i32` [RealLiteralTooLargeForIntType] -// CHECK:STDERR: let literal_overflow_large_mantissa: i32 = ConvertFloatLiteralToI32(214748364.8e1); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:44-82: error: floating-point value 2147483648*10^0 too large for integer type `i32` [RealLiteralTooLargeForIntType] // CHECK:STDERR: let literal_overflow_large_mantissa: i32 = ConvertFloatLiteralToI32(214748364.8e1); // -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:42: error: floating-point value 2147483648*10^0 too large for integer type `i32` [RealLiteralTooLargeForIntType] -// CHECK:STDERR: let literal_overflow_med_mantissa: i32 = ConvertFloatLiteralToI32(21474.83648e5); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:42-80: error: floating-point value 2147483648*10^0 too large for integer type `i32` [RealLiteralTooLargeForIntType] // CHECK:STDERR: let literal_overflow_med_mantissa: i32 = ConvertFloatLiteralToI32(21474.83648e5); // -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:46: error: floating-point value 2147483648*2^0 too large for integer type `i32` [RealLiteralTooLargeForIntType] -// CHECK:STDERR: let literal_overflow_hex_med_mantissa: i32 = ConvertFloatLiteralToI32(0x8000.0000p16); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:46-85: error: floating-point value 2147483648*2^0 too large for integer type `i32` [RealLiteralTooLargeForIntType] // CHECK:STDERR: let literal_overflow_hex_med_mantissa: i32 = ConvertFloatLiteralToI32(0x8000.0000p16); // -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:44: error: floating-point value 10*10^9 too large for integer type `i32` [RealLiteralTooLargeForIntType] -// CHECK:STDERR: let literal_overflow_small_mantissa: i32 = ConvertFloatLiteralToI32(1.0e10); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:44-75: error: floating-point value 10*10^9 too large for integer type `i32` [RealLiteralTooLargeForIntType] // CHECK:STDERR: let literal_overflow_small_mantissa: i32 = ConvertFloatLiteralToI32(1.0e10); // -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:48: error: floating-point value 16*2^27 too large for integer type `i32` [RealLiteralTooLargeForIntType] -// CHECK:STDERR: let literal_overflow_bin_small_mantissa: i32 = ConvertFloatLiteralToI32(0x1.0p31); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:48-81: error: floating-point value 16*2^27 too large for integer type `i32` [RealLiteralTooLargeForIntType] // CHECK:STDERR: let literal_overflow_bin_small_mantissa: i32 = ConvertFloatLiteralToI32(0x1.0p31); // -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:42: error: floating-point value 50*10^8 too large for integer type `u32` [RealLiteralTooLargeForIntType] -// CHECK:STDERR: let literal_overflow_unsigned_neg: u32 = ConvertFloatLiteralToU32(5.0e9); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:42-72: error: floating-point value 50*10^8 too large for integer type `u32` [RealLiteralTooLargeForIntType] // CHECK:STDERR: let literal_overflow_unsigned_neg: u32 = ConvertFloatLiteralToU32(5.0e9); // -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:46: error: floating-point value 16*2^28 too large for integer type `u32` [RealLiteralTooLargeForIntType] -// CHECK:STDERR: let literal_overflow_bin_unsigned_neg: u32 = ConvertFloatLiteralToU32(0x1.0p32); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:46-79: error: floating-point value 16*2^28 too large for integer type `u32` [RealLiteralTooLargeForIntType] // CHECK:STDERR: let literal_overflow_bin_unsigned_neg: u32 = ConvertFloatLiteralToU32(0x1.0p32); //@dump-sem-ir-end @@ -203,15 +173,11 @@ library "[[@TEST_NAME]]"; import library "float_to_int"; //@dump-sem-ir-begin -// CHECK:STDERR: fail_nan_inf.carbon:[[@LINE+4]]:20: error: cannot convert NaN to integer type `i32` [FloatNaNConvertedToInt] -// CHECK:STDERR: let nan_val: i32 = ConvertF64ToI32(Div(0.0, 0.0)); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_nan_inf.carbon:[[@LINE+2]]:20-49: error: cannot convert NaN to integer type `i32` [FloatNaNConvertedToInt] // CHECK:STDERR: let nan_val: i32 = ConvertF64ToI32(Div(0.0, 0.0)); -// CHECK:STDERR: fail_nan_inf.carbon:[[@LINE+4]]:20: error: cannot convert infinity to integer type `i32` [FloatInfinityConvertedToInt] -// CHECK:STDERR: let inf_val: i32 = ConvertF64ToI32(Div(1.0, 0.0)); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_nan_inf.carbon:[[@LINE+2]]:20-49: error: cannot convert infinity to integer type `i32` [FloatInfinityConvertedToInt] // CHECK:STDERR: let inf_val: i32 = ConvertF64ToI32(Div(1.0, 0.0)); //@dump-sem-ir-end @@ -324,114 +290,114 @@ let inf_val: i32 = ConvertF64ToI32(Div(1.0, 0.0)); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { -// CHECK:STDOUT: %.loc9_49.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc9 [concrete = ] -// CHECK:STDOUT: %.loc9_49.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc9, %.loc9_49.1 [concrete = ] -// CHECK:STDOUT: %i32.loc9: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %overflow: %i32 = wrapper_binding overflow, %.loc9_49.2 [concrete = ] +// CHECK:STDOUT: %.loc7_49.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc7 [concrete = ] +// CHECK:STDOUT: %.loc7_49.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc7, %.loc7_49.1 [concrete = ] +// CHECK:STDOUT: %i32.loc7: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %overflow: %i32 = wrapper_binding overflow, %.loc7_49.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %overflow.patt: %pattern_type.d94 = value_binding_pattern overflow [concrete = constants.%overflow.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc15_58.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc15 [concrete = ] -// CHECK:STDOUT: %.loc15_58.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc15, %.loc15_58.1 [concrete = ] -// CHECK:STDOUT: %i32.loc15: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %underflow: %i32 = wrapper_binding underflow, %.loc15_58.2 [concrete = ] +// CHECK:STDOUT: %.loc11_58.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc11 [concrete = ] +// CHECK:STDOUT: %.loc11_58.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc11, %.loc11_58.1 [concrete = ] +// CHECK:STDOUT: %i32.loc11: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %underflow: %i32 = wrapper_binding underflow, %.loc11_58.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %underflow.patt: %pattern_type.d94 = value_binding_pattern underflow [concrete = constants.%underflow.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc21_52.1: %u32 = value_of_initializer @__global_init.%ConvertF64ToU32.call [concrete = ] -// CHECK:STDOUT: %.loc21_52.2: %u32 = converted @__global_init.%ConvertF64ToU32.call, %.loc21_52.1 [concrete = ] -// CHECK:STDOUT: %u32.loc21: type = type_literal constants.%u32 [concrete = constants.%u32] -// CHECK:STDOUT: %unsigned_neg: %u32 = wrapper_binding unsigned_neg, %.loc21_52.2 [concrete = ] +// CHECK:STDOUT: %.loc15_52.1: %u32 = value_of_initializer @__global_init.%ConvertF64ToU32.call [concrete = ] +// CHECK:STDOUT: %.loc15_52.2: %u32 = converted @__global_init.%ConvertF64ToU32.call, %.loc15_52.1 [concrete = ] +// CHECK:STDOUT: %u32.loc15: type = type_literal constants.%u32 [concrete = constants.%u32] +// CHECK:STDOUT: %unsigned_neg: %u32 = wrapper_binding unsigned_neg, %.loc15_52.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %unsigned_neg.patt: %pattern_type.129 = value_binding_pattern unsigned_neg [concrete = constants.%unsigned_neg.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc27_66.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc27 [concrete = ] -// CHECK:STDOUT: %.loc27_66.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc27, %.loc27_66.1 [concrete = ] -// CHECK:STDOUT: %i32.loc27: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %literal_overflow: %i32 = wrapper_binding literal_overflow, %.loc27_66.2 [concrete = ] +// CHECK:STDOUT: %.loc19_66.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc19 [concrete = ] +// CHECK:STDOUT: %.loc19_66.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc19, %.loc19_66.1 [concrete = ] +// CHECK:STDOUT: %i32.loc19: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %literal_overflow: %i32 = wrapper_binding literal_overflow, %.loc19_66.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %literal_overflow.patt: %pattern_type.d94 = value_binding_pattern literal_overflow [concrete = constants.%literal_overflow.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc33_71.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc33 [concrete = ] -// CHECK:STDOUT: %.loc33_71.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc33, %.loc33_71.1 [concrete = ] -// CHECK:STDOUT: %i32.loc33: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %giant_literal_overflow: %i32 = wrapper_binding giant_literal_overflow, %.loc33_71.2 [concrete = ] +// CHECK:STDOUT: %.loc23_71.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc23 [concrete = ] +// CHECK:STDOUT: %.loc23_71.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc23, %.loc23_71.1 [concrete = ] +// CHECK:STDOUT: %i32.loc23: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %giant_literal_overflow: %i32 = wrapper_binding giant_literal_overflow, %.loc23_71.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %giant_literal_overflow.patt: %pattern_type.d94 = value_binding_pattern giant_literal_overflow [concrete = constants.%giant_literal_overflow.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc40_106.1: Core.IntLiteral = value_of_initializer @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc40 [concrete = ] -// CHECK:STDOUT: %.loc40_106.2: Core.IntLiteral = converted @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc40, %.loc40_106.1 [concrete = ] -// CHECK:STDOUT: %.loc40_48: type = splice_block %IntLiteral.ref.loc40 [concrete = Core.IntLiteral] { -// CHECK:STDOUT: %Core.ref.loc40: = name_ref Core, imports.%Core.048aa3.1 [concrete = imports.%Core.048aa3.1] -// CHECK:STDOUT: %IntLiteral.ref.loc40: type = name_ref IntLiteral, imports.%Core.IntLiteral [concrete = Core.IntLiteral] +// CHECK:STDOUT: %.loc28_106.1: Core.IntLiteral = value_of_initializer @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc28 [concrete = ] +// CHECK:STDOUT: %.loc28_106.2: Core.IntLiteral = converted @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc28, %.loc28_106.1 [concrete = ] +// CHECK:STDOUT: %.loc28_48: type = splice_block %IntLiteral.ref.loc28 [concrete = Core.IntLiteral] { +// CHECK:STDOUT: %Core.ref.loc28: = name_ref Core, imports.%Core.048aa3.1 [concrete = imports.%Core.048aa3.1] +// CHECK:STDOUT: %IntLiteral.ref.loc28: type = name_ref IntLiteral, imports.%Core.IntLiteral [concrete = Core.IntLiteral] // CHECK:STDOUT: } -// CHECK:STDOUT: %giant_literal_to_int_literal_overflow: Core.IntLiteral = wrapper_binding giant_literal_to_int_literal_overflow, %.loc40_106.2 [concrete = ] +// CHECK:STDOUT: %giant_literal_to_int_literal_overflow: Core.IntLiteral = wrapper_binding giant_literal_to_int_literal_overflow, %.loc28_106.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %giant_literal_to_int_literal_overflow.patt: %pattern_type.dc0 = value_binding_pattern giant_literal_to_int_literal_overflow [concrete = constants.%giant_literal_to_int_literal_overflow.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc47_107.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc47 [concrete = ] -// CHECK:STDOUT: %.loc47_107.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc47, %.loc47_107.1 [concrete = ] -// CHECK:STDOUT: %i32.loc47: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %giant_exponent_literal_overflow: %i32 = wrapper_binding giant_exponent_literal_overflow, %.loc47_107.2 [concrete = ] +// CHECK:STDOUT: %.loc33_107.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc33 [concrete = ] +// CHECK:STDOUT: %.loc33_107.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc33, %.loc33_107.1 [concrete = ] +// CHECK:STDOUT: %i32.loc33: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %giant_exponent_literal_overflow: %i32 = wrapper_binding giant_exponent_literal_overflow, %.loc33_107.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %giant_exponent_literal_overflow.patt: %pattern_type.d94 = value_binding_pattern giant_exponent_literal_overflow [concrete = constants.%giant_exponent_literal_overflow.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc55_141.1: Core.IntLiteral = value_of_initializer @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc55 [concrete = ] -// CHECK:STDOUT: %.loc55_141.2: Core.IntLiteral = converted @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc55, %.loc55_141.1 [concrete = ] -// CHECK:STDOUT: %.loc55_57: type = splice_block %IntLiteral.ref.loc55 [concrete = Core.IntLiteral] { -// CHECK:STDOUT: %Core.ref.loc55: = name_ref Core, imports.%Core.048aa3.1 [concrete = imports.%Core.048aa3.1] -// CHECK:STDOUT: %IntLiteral.ref.loc55: type = name_ref IntLiteral, imports.%Core.IntLiteral [concrete = Core.IntLiteral] +// CHECK:STDOUT: %.loc39_141.1: Core.IntLiteral = value_of_initializer @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc39 [concrete = ] +// CHECK:STDOUT: %.loc39_141.2: Core.IntLiteral = converted @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc39, %.loc39_141.1 [concrete = ] +// CHECK:STDOUT: %.loc39_57: type = splice_block %IntLiteral.ref.loc39 [concrete = Core.IntLiteral] { +// CHECK:STDOUT: %Core.ref.loc39: = name_ref Core, imports.%Core.048aa3.1 [concrete = imports.%Core.048aa3.1] +// CHECK:STDOUT: %IntLiteral.ref.loc39: type = name_ref IntLiteral, imports.%Core.IntLiteral [concrete = Core.IntLiteral] // CHECK:STDOUT: } -// CHECK:STDOUT: %giant_exponent_literal_to_int_literal_overflow: Core.IntLiteral = wrapper_binding giant_exponent_literal_to_int_literal_overflow, %.loc55_141.2 [concrete = ] +// CHECK:STDOUT: %giant_exponent_literal_to_int_literal_overflow: Core.IntLiteral = wrapper_binding giant_exponent_literal_to_int_literal_overflow, %.loc39_141.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %giant_exponent_literal_to_int_literal_overflow.patt: %pattern_type.dc0 = value_binding_pattern giant_exponent_literal_to_int_literal_overflow [concrete = constants.%giant_exponent_literal_to_int_literal_overflow.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc62_82.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc62 [concrete = ] -// CHECK:STDOUT: %.loc62_82.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc62, %.loc62_82.1 [concrete = ] -// CHECK:STDOUT: %i32.loc62: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %literal_overflow_large_mantissa: %i32 = wrapper_binding literal_overflow_large_mantissa, %.loc62_82.2 [concrete = ] +// CHECK:STDOUT: %.loc44_82.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc44 [concrete = ] +// CHECK:STDOUT: %.loc44_82.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc44, %.loc44_82.1 [concrete = ] +// CHECK:STDOUT: %i32.loc44: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %literal_overflow_large_mantissa: %i32 = wrapper_binding literal_overflow_large_mantissa, %.loc44_82.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %literal_overflow_large_mantissa.patt: %pattern_type.d94 = value_binding_pattern literal_overflow_large_mantissa [concrete = constants.%literal_overflow_large_mantissa.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc69_80.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc69 [concrete = ] -// CHECK:STDOUT: %.loc69_80.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc69, %.loc69_80.1 [concrete = ] -// CHECK:STDOUT: %i32.loc69: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %literal_overflow_med_mantissa: %i32 = wrapper_binding literal_overflow_med_mantissa, %.loc69_80.2 [concrete = ] +// CHECK:STDOUT: %.loc49_80.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc49 [concrete = ] +// CHECK:STDOUT: %.loc49_80.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc49, %.loc49_80.1 [concrete = ] +// CHECK:STDOUT: %i32.loc49: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %literal_overflow_med_mantissa: %i32 = wrapper_binding literal_overflow_med_mantissa, %.loc49_80.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %literal_overflow_med_mantissa.patt: %pattern_type.d94 = value_binding_pattern literal_overflow_med_mantissa [concrete = constants.%literal_overflow_med_mantissa.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc76_85.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc76 [concrete = ] -// CHECK:STDOUT: %.loc76_85.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc76, %.loc76_85.1 [concrete = ] -// CHECK:STDOUT: %i32.loc76: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %literal_overflow_hex_med_mantissa: %i32 = wrapper_binding literal_overflow_hex_med_mantissa, %.loc76_85.2 [concrete = ] +// CHECK:STDOUT: %.loc54_85.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc54 [concrete = ] +// CHECK:STDOUT: %.loc54_85.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc54, %.loc54_85.1 [concrete = ] +// CHECK:STDOUT: %i32.loc54: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %literal_overflow_hex_med_mantissa: %i32 = wrapper_binding literal_overflow_hex_med_mantissa, %.loc54_85.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %literal_overflow_hex_med_mantissa.patt: %pattern_type.d94 = value_binding_pattern literal_overflow_hex_med_mantissa [concrete = constants.%literal_overflow_hex_med_mantissa.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc83_75.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc83 [concrete = ] -// CHECK:STDOUT: %.loc83_75.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc83, %.loc83_75.1 [concrete = ] -// CHECK:STDOUT: %i32.loc83: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %literal_overflow_small_mantissa: %i32 = wrapper_binding literal_overflow_small_mantissa, %.loc83_75.2 [concrete = ] +// CHECK:STDOUT: %.loc59_75.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc59 [concrete = ] +// CHECK:STDOUT: %.loc59_75.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc59, %.loc59_75.1 [concrete = ] +// CHECK:STDOUT: %i32.loc59: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %literal_overflow_small_mantissa: %i32 = wrapper_binding literal_overflow_small_mantissa, %.loc59_75.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %literal_overflow_small_mantissa.patt: %pattern_type.d94 = value_binding_pattern literal_overflow_small_mantissa [concrete = constants.%literal_overflow_small_mantissa.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc90_81.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc90 [concrete = ] -// CHECK:STDOUT: %.loc90_81.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc90, %.loc90_81.1 [concrete = ] -// CHECK:STDOUT: %i32.loc90: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %literal_overflow_bin_small_mantissa: %i32 = wrapper_binding literal_overflow_bin_small_mantissa, %.loc90_81.2 [concrete = ] +// CHECK:STDOUT: %.loc64_81.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc64 [concrete = ] +// CHECK:STDOUT: %.loc64_81.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc64, %.loc64_81.1 [concrete = ] +// CHECK:STDOUT: %i32.loc64: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %literal_overflow_bin_small_mantissa: %i32 = wrapper_binding literal_overflow_bin_small_mantissa, %.loc64_81.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %literal_overflow_bin_small_mantissa.patt: %pattern_type.d94 = value_binding_pattern literal_overflow_bin_small_mantissa [concrete = constants.%literal_overflow_bin_small_mantissa.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc97_72.1: %u32 = value_of_initializer @__global_init.%ConvertFloatLiteralToU32.call.loc97 [concrete = ] -// CHECK:STDOUT: %.loc97_72.2: %u32 = converted @__global_init.%ConvertFloatLiteralToU32.call.loc97, %.loc97_72.1 [concrete = ] -// CHECK:STDOUT: %u32.loc97: type = type_literal constants.%u32 [concrete = constants.%u32] -// CHECK:STDOUT: %literal_overflow_unsigned_neg: %u32 = wrapper_binding literal_overflow_unsigned_neg, %.loc97_72.2 [concrete = ] +// CHECK:STDOUT: %.loc69_72.1: %u32 = value_of_initializer @__global_init.%ConvertFloatLiteralToU32.call.loc69 [concrete = ] +// CHECK:STDOUT: %.loc69_72.2: %u32 = converted @__global_init.%ConvertFloatLiteralToU32.call.loc69, %.loc69_72.1 [concrete = ] +// CHECK:STDOUT: %u32.loc69: type = type_literal constants.%u32 [concrete = constants.%u32] +// CHECK:STDOUT: %literal_overflow_unsigned_neg: %u32 = wrapper_binding literal_overflow_unsigned_neg, %.loc69_72.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %literal_overflow_unsigned_neg.patt: %pattern_type.129 = value_binding_pattern literal_overflow_unsigned_neg [concrete = constants.%literal_overflow_unsigned_neg.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc104_79.1: %u32 = value_of_initializer @__global_init.%ConvertFloatLiteralToU32.call.loc104 [concrete = ] -// CHECK:STDOUT: %.loc104_79.2: %u32 = converted @__global_init.%ConvertFloatLiteralToU32.call.loc104, %.loc104_79.1 [concrete = ] -// CHECK:STDOUT: %u32.loc104: type = type_literal constants.%u32 [concrete = constants.%u32] -// CHECK:STDOUT: %literal_overflow_bin_unsigned_neg: %u32 = wrapper_binding literal_overflow_bin_unsigned_neg, %.loc104_79.2 [concrete = ] +// CHECK:STDOUT: %.loc74_79.1: %u32 = value_of_initializer @__global_init.%ConvertFloatLiteralToU32.call.loc74 [concrete = ] +// CHECK:STDOUT: %.loc74_79.2: %u32 = converted @__global_init.%ConvertFloatLiteralToU32.call.loc74, %.loc74_79.1 [concrete = ] +// CHECK:STDOUT: %u32.loc74: type = type_literal constants.%u32 [concrete = constants.%u32] +// CHECK:STDOUT: %literal_overflow_bin_unsigned_neg: %u32 = wrapper_binding literal_overflow_bin_unsigned_neg, %.loc74_79.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %literal_overflow_bin_unsigned_neg.patt: %pattern_type.129 = value_binding_pattern literal_overflow_bin_unsigned_neg [concrete = constants.%literal_overflow_bin_unsigned_neg.patt] // CHECK:STDOUT: } @@ -439,80 +405,80 @@ let inf_val: i32 = ConvertF64ToI32(Div(1.0, 0.0)); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %ConvertF64ToI32.ref.loc9: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32] -// CHECK:STDOUT: %float.loc9: Core.FloatLiteral = float_literal_value 21474836480e-1 [concrete = constants.%float.bab60c.1] -// CHECK:STDOUT: %impl.elem0.loc9: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] -// CHECK:STDOUT: %bound_method.loc9_37.1: = bound_method %float.loc9, %impl.elem0.loc9 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.9eb] -// CHECK:STDOUT: %specific_fn.loc9: = specific_function %impl.elem0.loc9, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc9_37.2: = bound_method %float.loc9, %specific_fn.loc9 [concrete = constants.%bound_method.847] -// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc9: init %f64.761 = call %bound_method.loc9_37.2(%float.loc9) [concrete = constants.%float.ab7] -// CHECK:STDOUT: %.loc9_37.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc9 [concrete = constants.%float.ab7] -// CHECK:STDOUT: %.loc9_37.2: %f64.761 = converted %float.loc9, %.loc9_37.1 [concrete = constants.%float.ab7] -// CHECK:STDOUT: %ConvertF64ToI32.call.loc9: init %i32 = call %ConvertF64ToI32.ref.loc9(%.loc9_37.2) [concrete = ] -// CHECK:STDOUT: %ConvertF64ToI32.ref.loc15: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32] -// CHECK:STDOUT: %Negate.ref.loc15: %Negate.type = name_ref Negate, imports.%Main.Negate [concrete = constants.%Negate] -// CHECK:STDOUT: %float.loc15: Core.FloatLiteral = float_literal_value 21474836490e-1 [concrete = constants.%float.449] -// CHECK:STDOUT: %impl.elem0.loc15: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] -// CHECK:STDOUT: %bound_method.loc15_45.1: = bound_method %float.loc15, %impl.elem0.loc15 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.00d] -// CHECK:STDOUT: %specific_fn.loc15: = specific_function %impl.elem0.loc15, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc15_45.2: = bound_method %float.loc15, %specific_fn.loc15 [concrete = constants.%bound_method.a16] -// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc15: init %f64.761 = call %bound_method.loc15_45.2(%float.loc15) [concrete = constants.%float.8e0] -// CHECK:STDOUT: %.loc15_45.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc15 [concrete = constants.%float.8e0] -// CHECK:STDOUT: %.loc15_45.2: %f64.761 = converted %float.loc15, %.loc15_45.1 [concrete = constants.%float.8e0] -// CHECK:STDOUT: %Negate.call.loc15: init %f64.761 = call %Negate.ref.loc15(%.loc15_45.2) [concrete = constants.%float.5e1] -// CHECK:STDOUT: %.loc15_57.1: %f64.761 = value_of_initializer %Negate.call.loc15 [concrete = constants.%float.5e1] -// CHECK:STDOUT: %.loc15_57.2: %f64.761 = converted %Negate.call.loc15, %.loc15_57.1 [concrete = constants.%float.5e1] -// CHECK:STDOUT: %ConvertF64ToI32.call.loc15: init %i32 = call %ConvertF64ToI32.ref.loc15(%.loc15_57.2) [concrete = ] +// CHECK:STDOUT: %ConvertF64ToI32.ref.loc7: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32] +// CHECK:STDOUT: %float.loc7: Core.FloatLiteral = float_literal_value 21474836480e-1 [concrete = constants.%float.bab60c.1] +// CHECK:STDOUT: %impl.elem0.loc7: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] +// CHECK:STDOUT: %bound_method.loc7_37.1: = bound_method %float.loc7, %impl.elem0.loc7 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.9eb] +// CHECK:STDOUT: %specific_fn.loc7: = specific_function %impl.elem0.loc7, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_37.2: = bound_method %float.loc7, %specific_fn.loc7 [concrete = constants.%bound_method.847] +// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc7: init %f64.761 = call %bound_method.loc7_37.2(%float.loc7) [concrete = constants.%float.ab7] +// CHECK:STDOUT: %.loc7_37.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc7 [concrete = constants.%float.ab7] +// CHECK:STDOUT: %.loc7_37.2: %f64.761 = converted %float.loc7, %.loc7_37.1 [concrete = constants.%float.ab7] +// CHECK:STDOUT: %ConvertF64ToI32.call.loc7: init %i32 = call %ConvertF64ToI32.ref.loc7(%.loc7_37.2) [concrete = ] +// CHECK:STDOUT: %ConvertF64ToI32.ref.loc11: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32] +// CHECK:STDOUT: %Negate.ref.loc11: %Negate.type = name_ref Negate, imports.%Main.Negate [concrete = constants.%Negate] +// CHECK:STDOUT: %float.loc11: Core.FloatLiteral = float_literal_value 21474836490e-1 [concrete = constants.%float.449] +// CHECK:STDOUT: %impl.elem0.loc11: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] +// CHECK:STDOUT: %bound_method.loc11_45.1: = bound_method %float.loc11, %impl.elem0.loc11 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.00d] +// CHECK:STDOUT: %specific_fn.loc11: = specific_function %impl.elem0.loc11, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc11_45.2: = bound_method %float.loc11, %specific_fn.loc11 [concrete = constants.%bound_method.a16] +// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc11: init %f64.761 = call %bound_method.loc11_45.2(%float.loc11) [concrete = constants.%float.8e0] +// CHECK:STDOUT: %.loc11_45.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc11 [concrete = constants.%float.8e0] +// CHECK:STDOUT: %.loc11_45.2: %f64.761 = converted %float.loc11, %.loc11_45.1 [concrete = constants.%float.8e0] +// CHECK:STDOUT: %Negate.call.loc11: init %f64.761 = call %Negate.ref.loc11(%.loc11_45.2) [concrete = constants.%float.5e1] +// CHECK:STDOUT: %.loc11_57.1: %f64.761 = value_of_initializer %Negate.call.loc11 [concrete = constants.%float.5e1] +// CHECK:STDOUT: %.loc11_57.2: %f64.761 = converted %Negate.call.loc11, %.loc11_57.1 [concrete = constants.%float.5e1] +// CHECK:STDOUT: %ConvertF64ToI32.call.loc11: init %i32 = call %ConvertF64ToI32.ref.loc11(%.loc11_57.2) [concrete = ] // CHECK:STDOUT: %ConvertF64ToU32.ref: %ConvertF64ToU32.type = name_ref ConvertF64ToU32, imports.%Main.ConvertF64ToU32 [concrete = constants.%ConvertF64ToU32] -// CHECK:STDOUT: %Negate.ref.loc21: %Negate.type = name_ref Negate, imports.%Main.Negate [concrete = constants.%Negate] -// CHECK:STDOUT: %float.loc21: Core.FloatLiteral = float_literal_value 10e-1 [concrete = constants.%float.6da] -// CHECK:STDOUT: %impl.elem0.loc21: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] -// CHECK:STDOUT: %bound_method.loc21_48.1: = bound_method %float.loc21, %impl.elem0.loc21 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.1a9] -// CHECK:STDOUT: %specific_fn.loc21: = specific_function %impl.elem0.loc21, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc21_48.2: = bound_method %float.loc21, %specific_fn.loc21 [concrete = constants.%bound_method.04a] -// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc21: init %f64.761 = call %bound_method.loc21_48.2(%float.loc21) [concrete = constants.%float.a71] -// CHECK:STDOUT: %.loc21_48.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc21 [concrete = constants.%float.a71] -// CHECK:STDOUT: %.loc21_48.2: %f64.761 = converted %float.loc21, %.loc21_48.1 [concrete = constants.%float.a71] -// CHECK:STDOUT: %Negate.call.loc21: init %f64.761 = call %Negate.ref.loc21(%.loc21_48.2) [concrete = constants.%float.c4b] -// CHECK:STDOUT: %.loc21_51.1: %f64.761 = value_of_initializer %Negate.call.loc21 [concrete = constants.%float.c4b] -// CHECK:STDOUT: %.loc21_51.2: %f64.761 = converted %Negate.call.loc21, %.loc21_51.1 [concrete = constants.%float.c4b] -// CHECK:STDOUT: %ConvertF64ToU32.call: init %u32 = call %ConvertF64ToU32.ref(%.loc21_51.2) [concrete = ] -// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc27: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32] -// CHECK:STDOUT: %float.loc27: Core.FloatLiteral = float_literal_value 21474836480e-1 [concrete = constants.%float.bab60c.2] -// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc27: init %i32 = call %ConvertFloatLiteralToI32.ref.loc27(%float.loc27) [concrete = ] +// CHECK:STDOUT: %Negate.ref.loc15: %Negate.type = name_ref Negate, imports.%Main.Negate [concrete = constants.%Negate] +// CHECK:STDOUT: %float.loc15: Core.FloatLiteral = float_literal_value 10e-1 [concrete = constants.%float.6da] +// CHECK:STDOUT: %impl.elem0.loc15: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] +// CHECK:STDOUT: %bound_method.loc15_48.1: = bound_method %float.loc15, %impl.elem0.loc15 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.1a9] +// CHECK:STDOUT: %specific_fn.loc15: = specific_function %impl.elem0.loc15, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc15_48.2: = bound_method %float.loc15, %specific_fn.loc15 [concrete = constants.%bound_method.04a] +// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc15: init %f64.761 = call %bound_method.loc15_48.2(%float.loc15) [concrete = constants.%float.a71] +// CHECK:STDOUT: %.loc15_48.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc15 [concrete = constants.%float.a71] +// CHECK:STDOUT: %.loc15_48.2: %f64.761 = converted %float.loc15, %.loc15_48.1 [concrete = constants.%float.a71] +// CHECK:STDOUT: %Negate.call.loc15: init %f64.761 = call %Negate.ref.loc15(%.loc15_48.2) [concrete = constants.%float.c4b] +// CHECK:STDOUT: %.loc15_51.1: %f64.761 = value_of_initializer %Negate.call.loc15 [concrete = constants.%float.c4b] +// CHECK:STDOUT: %.loc15_51.2: %f64.761 = converted %Negate.call.loc15, %.loc15_51.1 [concrete = constants.%float.c4b] +// CHECK:STDOUT: %ConvertF64ToU32.call: init %u32 = call %ConvertF64ToU32.ref(%.loc15_51.2) [concrete = ] +// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc19: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32] +// CHECK:STDOUT: %float.loc19: Core.FloatLiteral = float_literal_value 21474836480e-1 [concrete = constants.%float.bab60c.2] +// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc19: init %i32 = call %ConvertFloatLiteralToI32.ref.loc19(%float.loc19) [concrete = ] +// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc23: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32] +// CHECK:STDOUT: %float.loc23: Core.FloatLiteral = float_literal_value 10e999999 [concrete = constants.%float.53d] +// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc23: init %i32 = call %ConvertFloatLiteralToI32.ref.loc23(%float.loc23) [concrete = ] +// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.ref.loc28: %ConvertFloatLiteralToIntLiteral.type = name_ref ConvertFloatLiteralToIntLiteral, imports.%Main.ConvertFloatLiteralToIntLiteral [concrete = constants.%ConvertFloatLiteralToIntLiteral] +// CHECK:STDOUT: %float.loc28: Core.FloatLiteral = float_literal_value 10e9999999 [concrete = constants.%float.ef09] +// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.call.loc28: init Core.IntLiteral = call %ConvertFloatLiteralToIntLiteral.ref.loc28(%float.loc28) [concrete = ] // CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc33: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32] -// CHECK:STDOUT: %float.loc33: Core.FloatLiteral = float_literal_value 10e999999 [concrete = constants.%float.53d] +// CHECK:STDOUT: %float.loc33: Core.FloatLiteral = float_literal_value 10e999999999999999999999999999999999 [concrete = constants.%float.f461ee.1] // CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc33: init %i32 = call %ConvertFloatLiteralToI32.ref.loc33(%float.loc33) [concrete = ] -// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.ref.loc40: %ConvertFloatLiteralToIntLiteral.type = name_ref ConvertFloatLiteralToIntLiteral, imports.%Main.ConvertFloatLiteralToIntLiteral [concrete = constants.%ConvertFloatLiteralToIntLiteral] -// CHECK:STDOUT: %float.loc40: Core.FloatLiteral = float_literal_value 10e9999999 [concrete = constants.%float.ef09] -// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.call.loc40: init Core.IntLiteral = call %ConvertFloatLiteralToIntLiteral.ref.loc40(%float.loc40) [concrete = ] -// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc47: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32] -// CHECK:STDOUT: %float.loc47: Core.FloatLiteral = float_literal_value 10e999999999999999999999999999999999 [concrete = constants.%float.f461ee.1] -// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc47: init %i32 = call %ConvertFloatLiteralToI32.ref.loc47(%float.loc47) [concrete = ] -// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.ref.loc55: %ConvertFloatLiteralToIntLiteral.type = name_ref ConvertFloatLiteralToIntLiteral, imports.%Main.ConvertFloatLiteralToIntLiteral [concrete = constants.%ConvertFloatLiteralToIntLiteral] -// CHECK:STDOUT: %float.loc55: Core.FloatLiteral = float_literal_value 10e999999999999999999999999999999999 [concrete = constants.%float.f461ee.2] -// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.call.loc55: init Core.IntLiteral = call %ConvertFloatLiteralToIntLiteral.ref.loc55(%float.loc55) [concrete = ] -// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc62: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32] -// CHECK:STDOUT: %float.loc62: Core.FloatLiteral = float_literal_value 2147483648e0 [concrete = constants.%float.e12922.1] -// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc62: init %i32 = call %ConvertFloatLiteralToI32.ref.loc62(%float.loc62) [concrete = ] -// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc69: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32] -// CHECK:STDOUT: %float.loc69: Core.FloatLiteral = float_literal_value 2147483648e0 [concrete = constants.%float.e12922.2] -// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc69: init %i32 = call %ConvertFloatLiteralToI32.ref.loc69(%float.loc69) [concrete = ] -// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc76: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32] -// CHECK:STDOUT: %float.loc76: Core.FloatLiteral = float_literal_value 2147483648p0 [concrete = constants.%float.ef03] -// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc76: init %i32 = call %ConvertFloatLiteralToI32.ref.loc76(%float.loc76) [concrete = ] -// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc83: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32] -// CHECK:STDOUT: %float.loc83: Core.FloatLiteral = float_literal_value 10e9 [concrete = constants.%float.9d5] -// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc83: init %i32 = call %ConvertFloatLiteralToI32.ref.loc83(%float.loc83) [concrete = ] -// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc90: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32] -// CHECK:STDOUT: %float.loc90: Core.FloatLiteral = float_literal_value 16p27 [concrete = constants.%float.c0c] -// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc90: init %i32 = call %ConvertFloatLiteralToI32.ref.loc90(%float.loc90) [concrete = ] -// CHECK:STDOUT: %ConvertFloatLiteralToU32.ref.loc97: %ConvertFloatLiteralToU32.type = name_ref ConvertFloatLiteralToU32, imports.%Main.ConvertFloatLiteralToU32 [concrete = constants.%ConvertFloatLiteralToU32] -// CHECK:STDOUT: %float.loc97: Core.FloatLiteral = float_literal_value 50e8 [concrete = constants.%float.4f4] -// CHECK:STDOUT: %ConvertFloatLiteralToU32.call.loc97: init %u32 = call %ConvertFloatLiteralToU32.ref.loc97(%float.loc97) [concrete = ] -// CHECK:STDOUT: %ConvertFloatLiteralToU32.ref.loc104: %ConvertFloatLiteralToU32.type = name_ref ConvertFloatLiteralToU32, imports.%Main.ConvertFloatLiteralToU32 [concrete = constants.%ConvertFloatLiteralToU32] -// CHECK:STDOUT: %float.loc104: Core.FloatLiteral = float_literal_value 16p28 [concrete = constants.%float.97b] -// CHECK:STDOUT: %ConvertFloatLiteralToU32.call.loc104: init %u32 = call %ConvertFloatLiteralToU32.ref.loc104(%float.loc104) [concrete = ] +// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.ref.loc39: %ConvertFloatLiteralToIntLiteral.type = name_ref ConvertFloatLiteralToIntLiteral, imports.%Main.ConvertFloatLiteralToIntLiteral [concrete = constants.%ConvertFloatLiteralToIntLiteral] +// CHECK:STDOUT: %float.loc39: Core.FloatLiteral = float_literal_value 10e999999999999999999999999999999999 [concrete = constants.%float.f461ee.2] +// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.call.loc39: init Core.IntLiteral = call %ConvertFloatLiteralToIntLiteral.ref.loc39(%float.loc39) [concrete = ] +// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc44: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32] +// CHECK:STDOUT: %float.loc44: Core.FloatLiteral = float_literal_value 2147483648e0 [concrete = constants.%float.e12922.1] +// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc44: init %i32 = call %ConvertFloatLiteralToI32.ref.loc44(%float.loc44) [concrete = ] +// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc49: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32] +// CHECK:STDOUT: %float.loc49: Core.FloatLiteral = float_literal_value 2147483648e0 [concrete = constants.%float.e12922.2] +// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc49: init %i32 = call %ConvertFloatLiteralToI32.ref.loc49(%float.loc49) [concrete = ] +// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc54: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32] +// CHECK:STDOUT: %float.loc54: Core.FloatLiteral = float_literal_value 2147483648p0 [concrete = constants.%float.ef03] +// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc54: init %i32 = call %ConvertFloatLiteralToI32.ref.loc54(%float.loc54) [concrete = ] +// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc59: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32] +// CHECK:STDOUT: %float.loc59: Core.FloatLiteral = float_literal_value 10e9 [concrete = constants.%float.9d5] +// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc59: init %i32 = call %ConvertFloatLiteralToI32.ref.loc59(%float.loc59) [concrete = ] +// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc64: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32] +// CHECK:STDOUT: %float.loc64: Core.FloatLiteral = float_literal_value 16p27 [concrete = constants.%float.c0c] +// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc64: init %i32 = call %ConvertFloatLiteralToI32.ref.loc64(%float.loc64) [concrete = ] +// CHECK:STDOUT: %ConvertFloatLiteralToU32.ref.loc69: %ConvertFloatLiteralToU32.type = name_ref ConvertFloatLiteralToU32, imports.%Main.ConvertFloatLiteralToU32 [concrete = constants.%ConvertFloatLiteralToU32] +// CHECK:STDOUT: %float.loc69: Core.FloatLiteral = float_literal_value 50e8 [concrete = constants.%float.4f4] +// CHECK:STDOUT: %ConvertFloatLiteralToU32.call.loc69: init %u32 = call %ConvertFloatLiteralToU32.ref.loc69(%float.loc69) [concrete = ] +// CHECK:STDOUT: %ConvertFloatLiteralToU32.ref.loc74: %ConvertFloatLiteralToU32.type = name_ref ConvertFloatLiteralToU32, imports.%Main.ConvertFloatLiteralToU32 [concrete = constants.%ConvertFloatLiteralToU32] +// CHECK:STDOUT: %float.loc74: Core.FloatLiteral = float_literal_value 16p28 [concrete = constants.%float.97b] +// CHECK:STDOUT: %ConvertFloatLiteralToU32.call.loc74: init %u32 = call %ConvertFloatLiteralToU32.ref.loc74(%float.loc74) [concrete = ] // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -568,17 +534,17 @@ let inf_val: i32 = ConvertF64ToI32(Div(1.0, 0.0)); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { -// CHECK:STDOUT: %.loc9_49.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc9 [concrete = ] -// CHECK:STDOUT: %.loc9_49.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc9, %.loc9_49.1 [concrete = ] -// CHECK:STDOUT: %i32.loc9: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %nan_val: %i32 = wrapper_binding nan_val, %.loc9_49.2 [concrete = ] +// CHECK:STDOUT: %.loc7_49.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc7 [concrete = ] +// CHECK:STDOUT: %.loc7_49.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc7, %.loc7_49.1 [concrete = ] +// CHECK:STDOUT: %i32.loc7: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %nan_val: %i32 = wrapper_binding nan_val, %.loc7_49.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %nan_val.patt: %pattern_type.d94 = value_binding_pattern nan_val [concrete = constants.%nan_val.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc15_49.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc15 [concrete = ] -// CHECK:STDOUT: %.loc15_49.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc15, %.loc15_49.1 [concrete = ] -// CHECK:STDOUT: %i32.loc15: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %inf_val: %i32 = wrapper_binding inf_val, %.loc15_49.2 [concrete = ] +// CHECK:STDOUT: %.loc11_49.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc11 [concrete = ] +// CHECK:STDOUT: %.loc11_49.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc11, %.loc11_49.1 [concrete = ] +// CHECK:STDOUT: %i32.loc11: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %inf_val: %i32 = wrapper_binding inf_val, %.loc11_49.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %inf_val.patt: %pattern_type.d94 = value_binding_pattern inf_val [concrete = constants.%inf_val.patt] // CHECK:STDOUT: } @@ -586,50 +552,50 @@ let inf_val: i32 = ConvertF64ToI32(Div(1.0, 0.0)); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %ConvertF64ToI32.ref.loc9: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32] -// CHECK:STDOUT: %Div.ref.loc9: %Div.type = name_ref Div, imports.%Main.Div [concrete = constants.%Div] -// CHECK:STDOUT: %float.loc9_40: Core.FloatLiteral = float_literal_value 0e-1 [concrete = constants.%float.1f75e4.1] -// CHECK:STDOUT: %float.loc9_45: Core.FloatLiteral = float_literal_value 0e-1 [concrete = constants.%float.1f75e4.2] -// CHECK:STDOUT: %impl.elem0.loc9_40: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] -// CHECK:STDOUT: %bound_method.loc9_40.1: = bound_method %float.loc9_40, %impl.elem0.loc9_40 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.7c43ce.1] -// CHECK:STDOUT: %specific_fn.loc9_40: = specific_function %impl.elem0.loc9_40, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc9_40.2: = bound_method %float.loc9_40, %specific_fn.loc9_40 [concrete = constants.%bound_method.49396d.1] -// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc9_40: init %f64.761 = call %bound_method.loc9_40.2(%float.loc9_40) [concrete = constants.%float.73e] -// CHECK:STDOUT: %.loc9_40.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc9_40 [concrete = constants.%float.73e] -// CHECK:STDOUT: %.loc9_40.2: %f64.761 = converted %float.loc9_40, %.loc9_40.1 [concrete = constants.%float.73e] -// CHECK:STDOUT: %impl.elem0.loc9_45: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] -// CHECK:STDOUT: %bound_method.loc9_45.1: = bound_method %float.loc9_45, %impl.elem0.loc9_45 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.7c43ce.2] -// CHECK:STDOUT: %specific_fn.loc9_45: = specific_function %impl.elem0.loc9_45, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc9_45.2: = bound_method %float.loc9_45, %specific_fn.loc9_45 [concrete = constants.%bound_method.49396d.2] -// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc9_45: init %f64.761 = call %bound_method.loc9_45.2(%float.loc9_45) [concrete = constants.%float.73e] -// CHECK:STDOUT: %.loc9_45.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc9_45 [concrete = constants.%float.73e] -// CHECK:STDOUT: %.loc9_45.2: %f64.761 = converted %float.loc9_45, %.loc9_45.1 [concrete = constants.%float.73e] -// CHECK:STDOUT: %Div.call.loc9: init %f64.761 = call %Div.ref.loc9(%.loc9_40.2, %.loc9_45.2) [concrete = constants.%float.61c] -// CHECK:STDOUT: %.loc9_48.1: %f64.761 = value_of_initializer %Div.call.loc9 [concrete = constants.%float.61c] -// CHECK:STDOUT: %.loc9_48.2: %f64.761 = converted %Div.call.loc9, %.loc9_48.1 [concrete = constants.%float.61c] -// CHECK:STDOUT: %ConvertF64ToI32.call.loc9: init %i32 = call %ConvertF64ToI32.ref.loc9(%.loc9_48.2) [concrete = ] -// CHECK:STDOUT: %ConvertF64ToI32.ref.loc15: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32] -// CHECK:STDOUT: %Div.ref.loc15: %Div.type = name_ref Div, imports.%Main.Div [concrete = constants.%Div] -// CHECK:STDOUT: %float.loc15_40: Core.FloatLiteral = float_literal_value 10e-1 [concrete = constants.%float.6da] -// CHECK:STDOUT: %float.loc15_45: Core.FloatLiteral = float_literal_value 0e-1 [concrete = constants.%float.1f75e4.3] -// CHECK:STDOUT: %impl.elem0.loc15_40: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] -// CHECK:STDOUT: %bound_method.loc15_40.1: = bound_method %float.loc15_40, %impl.elem0.loc15_40 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.1a9] -// CHECK:STDOUT: %specific_fn.loc15_40: = specific_function %impl.elem0.loc15_40, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc15_40.2: = bound_method %float.loc15_40, %specific_fn.loc15_40 [concrete = constants.%bound_method.04a] -// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc15_40: init %f64.761 = call %bound_method.loc15_40.2(%float.loc15_40) [concrete = constants.%float.a71] -// CHECK:STDOUT: %.loc15_40.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc15_40 [concrete = constants.%float.a71] -// CHECK:STDOUT: %.loc15_40.2: %f64.761 = converted %float.loc15_40, %.loc15_40.1 [concrete = constants.%float.a71] -// CHECK:STDOUT: %impl.elem0.loc15_45: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] -// CHECK:STDOUT: %bound_method.loc15_45.1: = bound_method %float.loc15_45, %impl.elem0.loc15_45 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.7c43ce.3] -// CHECK:STDOUT: %specific_fn.loc15_45: = specific_function %impl.elem0.loc15_45, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc15_45.2: = bound_method %float.loc15_45, %specific_fn.loc15_45 [concrete = constants.%bound_method.49396d.3] -// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc15_45: init %f64.761 = call %bound_method.loc15_45.2(%float.loc15_45) [concrete = constants.%float.73e] -// CHECK:STDOUT: %.loc15_45.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc15_45 [concrete = constants.%float.73e] -// CHECK:STDOUT: %.loc15_45.2: %f64.761 = converted %float.loc15_45, %.loc15_45.1 [concrete = constants.%float.73e] -// CHECK:STDOUT: %Div.call.loc15: init %f64.761 = call %Div.ref.loc15(%.loc15_40.2, %.loc15_45.2) [concrete = constants.%float.62c] -// CHECK:STDOUT: %.loc15_48.1: %f64.761 = value_of_initializer %Div.call.loc15 [concrete = constants.%float.62c] -// CHECK:STDOUT: %.loc15_48.2: %f64.761 = converted %Div.call.loc15, %.loc15_48.1 [concrete = constants.%float.62c] -// CHECK:STDOUT: %ConvertF64ToI32.call.loc15: init %i32 = call %ConvertF64ToI32.ref.loc15(%.loc15_48.2) [concrete = ] +// CHECK:STDOUT: %ConvertF64ToI32.ref.loc7: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32] +// CHECK:STDOUT: %Div.ref.loc7: %Div.type = name_ref Div, imports.%Main.Div [concrete = constants.%Div] +// CHECK:STDOUT: %float.loc7_40: Core.FloatLiteral = float_literal_value 0e-1 [concrete = constants.%float.1f75e4.1] +// CHECK:STDOUT: %float.loc7_45: Core.FloatLiteral = float_literal_value 0e-1 [concrete = constants.%float.1f75e4.2] +// CHECK:STDOUT: %impl.elem0.loc7_40: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] +// CHECK:STDOUT: %bound_method.loc7_40.1: = bound_method %float.loc7_40, %impl.elem0.loc7_40 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.7c43ce.1] +// CHECK:STDOUT: %specific_fn.loc7_40: = specific_function %impl.elem0.loc7_40, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_40.2: = bound_method %float.loc7_40, %specific_fn.loc7_40 [concrete = constants.%bound_method.49396d.1] +// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc7_40: init %f64.761 = call %bound_method.loc7_40.2(%float.loc7_40) [concrete = constants.%float.73e] +// CHECK:STDOUT: %.loc7_40.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc7_40 [concrete = constants.%float.73e] +// CHECK:STDOUT: %.loc7_40.2: %f64.761 = converted %float.loc7_40, %.loc7_40.1 [concrete = constants.%float.73e] +// CHECK:STDOUT: %impl.elem0.loc7_45: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] +// CHECK:STDOUT: %bound_method.loc7_45.1: = bound_method %float.loc7_45, %impl.elem0.loc7_45 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.7c43ce.2] +// CHECK:STDOUT: %specific_fn.loc7_45: = specific_function %impl.elem0.loc7_45, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_45.2: = bound_method %float.loc7_45, %specific_fn.loc7_45 [concrete = constants.%bound_method.49396d.2] +// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc7_45: init %f64.761 = call %bound_method.loc7_45.2(%float.loc7_45) [concrete = constants.%float.73e] +// CHECK:STDOUT: %.loc7_45.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc7_45 [concrete = constants.%float.73e] +// CHECK:STDOUT: %.loc7_45.2: %f64.761 = converted %float.loc7_45, %.loc7_45.1 [concrete = constants.%float.73e] +// CHECK:STDOUT: %Div.call.loc7: init %f64.761 = call %Div.ref.loc7(%.loc7_40.2, %.loc7_45.2) [concrete = constants.%float.61c] +// CHECK:STDOUT: %.loc7_48.1: %f64.761 = value_of_initializer %Div.call.loc7 [concrete = constants.%float.61c] +// CHECK:STDOUT: %.loc7_48.2: %f64.761 = converted %Div.call.loc7, %.loc7_48.1 [concrete = constants.%float.61c] +// CHECK:STDOUT: %ConvertF64ToI32.call.loc7: init %i32 = call %ConvertF64ToI32.ref.loc7(%.loc7_48.2) [concrete = ] +// CHECK:STDOUT: %ConvertF64ToI32.ref.loc11: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32] +// CHECK:STDOUT: %Div.ref.loc11: %Div.type = name_ref Div, imports.%Main.Div [concrete = constants.%Div] +// CHECK:STDOUT: %float.loc11_40: Core.FloatLiteral = float_literal_value 10e-1 [concrete = constants.%float.6da] +// CHECK:STDOUT: %float.loc11_45: Core.FloatLiteral = float_literal_value 0e-1 [concrete = constants.%float.1f75e4.3] +// CHECK:STDOUT: %impl.elem0.loc11_40: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] +// CHECK:STDOUT: %bound_method.loc11_40.1: = bound_method %float.loc11_40, %impl.elem0.loc11_40 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.1a9] +// CHECK:STDOUT: %specific_fn.loc11_40: = specific_function %impl.elem0.loc11_40, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc11_40.2: = bound_method %float.loc11_40, %specific_fn.loc11_40 [concrete = constants.%bound_method.04a] +// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc11_40: init %f64.761 = call %bound_method.loc11_40.2(%float.loc11_40) [concrete = constants.%float.a71] +// CHECK:STDOUT: %.loc11_40.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc11_40 [concrete = constants.%float.a71] +// CHECK:STDOUT: %.loc11_40.2: %f64.761 = converted %float.loc11_40, %.loc11_40.1 [concrete = constants.%float.a71] +// CHECK:STDOUT: %impl.elem0.loc11_45: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] +// CHECK:STDOUT: %bound_method.loc11_45.1: = bound_method %float.loc11_45, %impl.elem0.loc11_45 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.7c43ce.3] +// CHECK:STDOUT: %specific_fn.loc11_45: = specific_function %impl.elem0.loc11_45, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc11_45.2: = bound_method %float.loc11_45, %specific_fn.loc11_45 [concrete = constants.%bound_method.49396d.3] +// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc11_45: init %f64.761 = call %bound_method.loc11_45.2(%float.loc11_45) [concrete = constants.%float.73e] +// CHECK:STDOUT: %.loc11_45.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc11_45 [concrete = constants.%float.73e] +// CHECK:STDOUT: %.loc11_45.2: %f64.761 = converted %float.loc11_45, %.loc11_45.1 [concrete = constants.%float.73e] +// CHECK:STDOUT: %Div.call.loc11: init %f64.761 = call %Div.ref.loc11(%.loc11_40.2, %.loc11_45.2) [concrete = constants.%float.62c] +// CHECK:STDOUT: %.loc11_48.1: %f64.761 = value_of_initializer %Div.call.loc11 [concrete = constants.%float.62c] +// CHECK:STDOUT: %.loc11_48.2: %f64.761 = converted %Div.call.loc11, %.loc11_48.1 [concrete = constants.%float.62c] +// CHECK:STDOUT: %ConvertF64ToI32.call.loc11: init %i32 = call %ConvertF64ToI32.ref.loc11(%.loc11_48.2) [concrete = ] // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/float/div.carbon b/toolchain/check/testdata/builtins/float/div.carbon index 4356f4e7f22c..ffe79ec3e327 100644 --- a/toolchain/check/testdata/builtins/float/div.carbon +++ b/toolchain/check/testdata/builtins/float/div.carbon @@ -30,9 +30,7 @@ let c: f64 = Div(0.0, 0.0); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_few.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.div" [InvalidBuiltinSignature] -// CHECK:STDERR: fn TooFew(a: f64) -> f64 = "float.div"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:1-26: error: invalid signature for builtin function "float.div" [InvalidBuiltinSignature] // CHECK:STDERR: fn TooFew(a: f64) -> f64 = "float.div"; @@ -44,9 +42,7 @@ fn RuntimeCallIsValidTooFew(a: f64) -> f64 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_many.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.div" [InvalidBuiltinSignature] -// CHECK:STDERR: fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.div"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:1-43: error: invalid signature for builtin function "float.div" [InvalidBuiltinSignature] // CHECK:STDERR: fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.div"; @@ -58,9 +54,7 @@ fn RuntimeCallIsValidTooMany(a: f64, b: f64, c: f64) -> f64 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.div" [InvalidBuiltinSignature] -// CHECK:STDERR: fn BadReturnType(a: f64, b: f64) -> bool = "float.div"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:1-42: error: invalid signature for builtin function "float.div" [InvalidBuiltinSignature] // CHECK:STDERR: fn BadReturnType(a: f64, b: f64) -> bool = "float.div"; @@ -73,9 +67,7 @@ fn RuntimeCallIsValidBadReturnType(a: f64, b: f64) -> bool { library "[[@TEST_NAME]]"; fn Literal() -> type = "float_literal.make_type"; -// CHECK:STDERR: fail_literal.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.div" [InvalidBuiltinSignature] -// CHECK:STDERR: fn DivLiteral(a: Literal(), b: Literal()) -> Literal() = "float.div"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "float.div" [InvalidBuiltinSignature] // CHECK:STDERR: fn DivLiteral(a: Literal(), b: Literal()) -> Literal() = "float.div"; diff --git a/toolchain/check/testdata/builtins/float/div_assign.carbon b/toolchain/check/testdata/builtins/float/div_assign.carbon index 72dc926b3fe2..1afae97933d4 100644 --- a/toolchain/check/testdata/builtins/float/div_assign.carbon +++ b/toolchain/check/testdata/builtins/float/div_assign.carbon @@ -24,15 +24,11 @@ fn Call(ref a: f64, b: f64) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.div_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn NotRef(a: f64, b: f64) = "float.div_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "float.div_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn NotRef(a: f64, b: f64) = "float.div_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.div_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn MixedTypes(ref a: f64, b: f32) = "float.div_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "float.div_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn MixedTypes(ref a: f64, b: f32) = "float.div_assign"; @@ -41,8 +37,6 @@ fn MixedTypes(ref a: f64, b: f32) = "float.div_assign"; library "[[@TEST_NAME]]"; fn Literal() -> type = "float_literal.make_type"; -// CHECK:STDERR: fail_literal.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.div_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.div_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-51: error: invalid signature for builtin function "float.div_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.div_assign"; diff --git a/toolchain/check/testdata/builtins/float/eq.carbon b/toolchain/check/testdata/builtins/float/eq.carbon index cca436ed5f6e..87cfc51a2ca2 100644 --- a/toolchain/check/testdata/builtins/float/eq.carbon +++ b/toolchain/check/testdata/builtins/float/eq.carbon @@ -32,9 +32,7 @@ fn RuntimeCallIsValid(a: f64, b: f64) -> bool { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.eq" [InvalidBuiltinSignature] -// CHECK:STDERR: fn WrongResult(a: f64, b: f64) -> f64 = "float.eq"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-39: error: invalid signature for builtin function "float.eq" [InvalidBuiltinSignature] // CHECK:STDERR: fn WrongResult(a: f64, b: f64) -> f64 = "float.eq"; @@ -42,9 +40,7 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.eq"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_literal.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.eq" [InvalidBuiltinSignature] -// CHECK:STDERR: fn Eq(a: Core.FloatLiteral, b: Core.FloatLiteral) -> bool = "float.eq"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-59: error: invalid signature for builtin function "float.eq" [InvalidBuiltinSignature] // CHECK:STDERR: fn Eq(a: Core.FloatLiteral, b: Core.FloatLiteral) -> bool = "float.eq"; diff --git a/toolchain/check/testdata/builtins/float/less_eq.carbon b/toolchain/check/testdata/builtins/float/less_eq.carbon index c5b8902a9e31..39854afd6573 100644 --- a/toolchain/check/testdata/builtins/float/less_eq.carbon +++ b/toolchain/check/testdata/builtins/float/less_eq.carbon @@ -36,9 +36,7 @@ fn RuntimeCallIsValid(a: f64, b: f64) -> bool { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_literal.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.less_eq" [InvalidBuiltinSignature] -// CHECK:STDERR: fn LessEq(a: Core.FloatLiteral, b: Core.FloatLiteral) -> bool = "float.less_eq"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-63: error: invalid signature for builtin function "float.less_eq" [InvalidBuiltinSignature] // CHECK:STDERR: fn LessEq(a: Core.FloatLiteral, b: Core.FloatLiteral) -> bool = "float.less_eq"; diff --git a/toolchain/check/testdata/builtins/float/make_type.carbon b/toolchain/check/testdata/builtins/float/make_type.carbon index e3fdbd87f712..529217e998fe 100644 --- a/toolchain/check/testdata/builtins/float/make_type.carbon +++ b/toolchain/check/testdata/builtins/float/make_type.carbon @@ -39,9 +39,7 @@ library "[[@TEST_NAME]]"; import library "types"; -// CHECK:STDERR: fail_invalid_size.carbon:[[@LINE+4]]:20: error: unsupported floating-point bit width 931 [CompileTimeFloatBitWidth] -// CHECK:STDERR: var invalid_float: Float(931); -// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: fail_invalid_size.carbon:[[@LINE+2]]:20-29: error: unsupported floating-point bit width 931 [CompileTimeFloatBitWidth] // CHECK:STDERR: var invalid_float: Float(931); @@ -52,9 +50,7 @@ library "[[@TEST_NAME]]"; import library "types"; var dyn_size: i32 = 64; -// CHECK:STDERR: fail_dyn_size.carbon:[[@LINE+4]]:10: error: cannot evaluate type expression [TypeExprEvaluationFailure] -// CHECK:STDERR: var dyn: Float(dyn_size); -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_dyn_size.carbon:[[@LINE+2]]:10-24: error: cannot evaluate type expression [TypeExprEvaluationFailure] // CHECK:STDERR: var dyn: Float(dyn_size); diff --git a/toolchain/check/testdata/builtins/float/mul.carbon b/toolchain/check/testdata/builtins/float/mul.carbon index 4771b49f75d1..b165f571b681 100644 --- a/toolchain/check/testdata/builtins/float/mul.carbon +++ b/toolchain/check/testdata/builtins/float/mul.carbon @@ -28,9 +28,7 @@ var x: f64 = Mul(2.0, 0.5); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_few.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.mul" [InvalidBuiltinSignature] -// CHECK:STDERR: fn TooFew(a: f64) -> f64 = "float.mul"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:1-26: error: invalid signature for builtin function "float.mul" [InvalidBuiltinSignature] // CHECK:STDERR: fn TooFew(a: f64) -> f64 = "float.mul"; @@ -42,9 +40,7 @@ fn RuntimeCallIsValidTooFew(a: f64) -> f64 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_many.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.mul" [InvalidBuiltinSignature] -// CHECK:STDERR: fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.mul"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:1-43: error: invalid signature for builtin function "float.mul" [InvalidBuiltinSignature] // CHECK:STDERR: fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.mul"; @@ -56,9 +52,7 @@ fn RuntimeCallIsValidTooMany(a: f64, b: f64, c: f64) -> f64 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.mul" [InvalidBuiltinSignature] -// CHECK:STDERR: fn BadReturnType(a: f64, b: f64) -> bool = "float.mul"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:1-42: error: invalid signature for builtin function "float.mul" [InvalidBuiltinSignature] // CHECK:STDERR: fn BadReturnType(a: f64, b: f64) -> bool = "float.mul"; @@ -71,9 +65,7 @@ fn RuntimeCallIsValidBadReturnType(a: f64, b: f64) -> bool { library "[[@TEST_NAME]]"; fn Literal() -> type = "float_literal.make_type"; -// CHECK:STDERR: fail_literal.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.mul" [InvalidBuiltinSignature] -// CHECK:STDERR: fn MulLiteral(a: Literal(), b: Literal()) -> Literal() = "float.mul"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "float.mul" [InvalidBuiltinSignature] // CHECK:STDERR: fn MulLiteral(a: Literal(), b: Literal()) -> Literal() = "float.mul"; diff --git a/toolchain/check/testdata/builtins/float/mul_assign.carbon b/toolchain/check/testdata/builtins/float/mul_assign.carbon index e24660ea2766..90bb200a79f4 100644 --- a/toolchain/check/testdata/builtins/float/mul_assign.carbon +++ b/toolchain/check/testdata/builtins/float/mul_assign.carbon @@ -24,15 +24,11 @@ fn Call(ref a: f64, b: f64) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.mul_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn NotRef(a: f64, b: f64) = "float.mul_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "float.mul_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn NotRef(a: f64, b: f64) = "float.mul_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.mul_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn MixedTypes(ref a: f64, b: f32) = "float.mul_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "float.mul_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn MixedTypes(ref a: f64, b: f32) = "float.mul_assign"; @@ -41,8 +37,6 @@ fn MixedTypes(ref a: f64, b: f32) = "float.mul_assign"; library "[[@TEST_NAME]]"; fn Literal() -> type = "float_literal.make_type"; -// CHECK:STDERR: fail_literal.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.mul_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.mul_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-51: error: invalid signature for builtin function "float.mul_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.mul_assign"; diff --git a/toolchain/check/testdata/builtins/float/negate.carbon b/toolchain/check/testdata/builtins/float/negate.carbon index 6cd427b391d3..58b6fb152a05 100644 --- a/toolchain/check/testdata/builtins/float/negate.carbon +++ b/toolchain/check/testdata/builtins/float/negate.carbon @@ -28,9 +28,7 @@ let a: f64 = Negate(1.5); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_few.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.negate" [InvalidBuiltinSignature] -// CHECK:STDERR: fn TooFew() -> f64 = "float.negate"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:1-20: error: invalid signature for builtin function "float.negate" [InvalidBuiltinSignature] // CHECK:STDERR: fn TooFew() -> f64 = "float.negate"; @@ -42,9 +40,7 @@ fn RuntimeCallIsValidTooFew() -> f64 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_many.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.negate" [InvalidBuiltinSignature] -// CHECK:STDERR: fn TooMany(a: f64, b: f64) -> f64 = "float.negate"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "float.negate" [InvalidBuiltinSignature] // CHECK:STDERR: fn TooMany(a: f64, b: f64) -> f64 = "float.negate"; @@ -56,9 +52,7 @@ fn RuntimeCallIsValidTooMany(a: f64, b: f64) -> f64 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.negate" [InvalidBuiltinSignature] -// CHECK:STDERR: fn BadReturnType(a: f64) -> bool = "float.negate"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:1-34: error: invalid signature for builtin function "float.negate" [InvalidBuiltinSignature] // CHECK:STDERR: fn BadReturnType(a: f64) -> bool = "float.negate"; diff --git a/toolchain/check/testdata/builtins/float/neq.carbon b/toolchain/check/testdata/builtins/float/neq.carbon index a6078309788b..65ef93002512 100644 --- a/toolchain/check/testdata/builtins/float/neq.carbon +++ b/toolchain/check/testdata/builtins/float/neq.carbon @@ -34,9 +34,7 @@ fn RuntimeCallIsValid(a: f64, b: f64) -> bool { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.neq" [InvalidBuiltinSignature] -// CHECK:STDERR: fn WrongResult(a: f64, b: f64) -> f64 = "float.neq"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-39: error: invalid signature for builtin function "float.neq" [InvalidBuiltinSignature] // CHECK:STDERR: fn WrongResult(a: f64, b: f64) -> f64 = "float.neq"; diff --git a/toolchain/check/testdata/builtins/float/sub.carbon b/toolchain/check/testdata/builtins/float/sub.carbon index a2dbdcb619c6..f88545deda2a 100644 --- a/toolchain/check/testdata/builtins/float/sub.carbon +++ b/toolchain/check/testdata/builtins/float/sub.carbon @@ -28,9 +28,7 @@ var x: f64 = Sub(2.0, 0.5); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_few.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.sub" [InvalidBuiltinSignature] -// CHECK:STDERR: fn TooFew(a: f64) -> f64 = "float.sub"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:1-26: error: invalid signature for builtin function "float.sub" [InvalidBuiltinSignature] // CHECK:STDERR: fn TooFew(a: f64) -> f64 = "float.sub"; @@ -42,9 +40,7 @@ fn RuntimeCallIsValidTooFew(a: f64) -> f64 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_many.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.sub" [InvalidBuiltinSignature] -// CHECK:STDERR: fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.sub"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:1-43: error: invalid signature for builtin function "float.sub" [InvalidBuiltinSignature] // CHECK:STDERR: fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.sub"; @@ -56,9 +52,7 @@ fn RuntimeCallIsValidTooMany(a: f64, b: f64, c: f64) -> f64 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.sub" [InvalidBuiltinSignature] -// CHECK:STDERR: fn BadReturnType(a: f64, b: f64) -> bool = "float.sub"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:1-42: error: invalid signature for builtin function "float.sub" [InvalidBuiltinSignature] // CHECK:STDERR: fn BadReturnType(a: f64, b: f64) -> bool = "float.sub"; diff --git a/toolchain/check/testdata/builtins/float/sub_assign.carbon b/toolchain/check/testdata/builtins/float/sub_assign.carbon index 1dfbb75eae80..1d10fa0fb02d 100644 --- a/toolchain/check/testdata/builtins/float/sub_assign.carbon +++ b/toolchain/check/testdata/builtins/float/sub_assign.carbon @@ -24,15 +24,11 @@ fn Call(ref a: f64, b: f64) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.sub_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn NotRef(a: f64, b: f64) = "float.sub_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "float.sub_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn NotRef(a: f64, b: f64) = "float.sub_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.sub_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn MixedTypes(ref a: f64, b: f32) = "float.sub_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "float.sub_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn MixedTypes(ref a: f64, b: f32) = "float.sub_assign"; @@ -41,8 +37,6 @@ fn MixedTypes(ref a: f64, b: f32) = "float.sub_assign"; library "[[@TEST_NAME]]"; fn Literal() -> type = "float_literal.make_type"; -// CHECK:STDERR: fail_literal.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.sub_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.sub_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-51: error: invalid signature for builtin function "float.sub_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.sub_assign"; diff --git a/toolchain/check/testdata/builtins/float_literal/add.carbon b/toolchain/check/testdata/builtins/float_literal/add.carbon index 637f7f389ac5..5215633ca945 100644 --- a/toolchain/check/testdata/builtins/float_literal/add.carbon +++ b/toolchain/check/testdata/builtins/float_literal/add.carbon @@ -42,9 +42,7 @@ library "[[@TEST_NAME]]"; fn Add(a: Core.FloatLiteral, b: Core.FloatLiteral) -> Core.FloatLiteral = "float.add"; fn F(){ - // CHECK:STDERR: fail_too_large.carbon:[[@LINE+4]]:6: error: binary calculation `16*2^1023999999996 + 1*10^-19` would exceed the maximum supported integer width of 8388608 [CompileTimeFloatLiteralBinaryOperationOutOfRange] - // CHECK:STDERR: Add(0x1.0p1024000000000, 0.0000000000000000001); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_too_large.carbon:[[@LINE+2]]:6-52: error: binary calculation `16*2^1023999999996 + 1*10^-19` would exceed the maximum supported integer width of 8388608 [CompileTimeFloatLiteralBinaryOperationOutOfRange] // CHECK:STDERR: Add(0x1.0p1024000000000, 0.0000000000000000001); } diff --git a/toolchain/check/testdata/builtins/float_literal/sub.carbon b/toolchain/check/testdata/builtins/float_literal/sub.carbon index 8926e7d64381..21d66de795ce 100644 --- a/toolchain/check/testdata/builtins/float_literal/sub.carbon +++ b/toolchain/check/testdata/builtins/float_literal/sub.carbon @@ -44,9 +44,7 @@ library "[[@TEST_NAME]]"; fn Sub(a: Core.FloatLiteral, b: Core.FloatLiteral) -> Core.FloatLiteral = "float.sub"; -// CHECK:STDERR: fail_too_large.carbon:[[@LINE+4]]:29: error: binary calculation `16*2^1023999999996 - 1*10^-19` would exceed the maximum supported integer width of 8388608 [CompileTimeFloatLiteralBinaryOperationOutOfRange] -// CHECK:STDERR: let v1: Core.FloatLiteral = Sub(0x1.0p1024000000000, 0.0000000000000000001); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_large.carbon:[[@LINE+2]]:29-75: error: binary calculation `16*2^1023999999996 - 1*10^-19` would exceed the maximum supported integer width of 8388608 [CompileTimeFloatLiteralBinaryOperationOutOfRange] // CHECK:STDERR: let v1: Core.FloatLiteral = Sub(0x1.0p1024000000000, 0.0000000000000000001); diff --git a/toolchain/check/testdata/builtins/int/add_char_literal.carbon b/toolchain/check/testdata/builtins/int/add_char_literal.carbon index b178416ff7ec..9d820d174d27 100644 --- a/toolchain/check/testdata/builtins/int/add_char_literal.carbon +++ b/toolchain/check/testdata/builtins/int/add_char_literal.carbon @@ -36,9 +36,7 @@ alias IntLiteral = MakeIntLiteral(); fn AddIntChar(n: IntLiteral, c: CharLiteral) -> CharLiteral = "int.add_char_literal"; -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:22: error: character arithmetic result 4503599627370593 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult] -// CHECK:STDERR: let a: CharLiteral = AddIntChar(0x10000000000000, 'a'); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:22-54: error: character arithmetic result 4503599627370593 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult] // CHECK:STDERR: let a: CharLiteral = AddIntChar(0x10000000000000, 'a'); @@ -54,21 +52,15 @@ alias IntLiteral = MakeIntLiteral(); fn AddIntChar(n: IntLiteral, c: CharLiteral) -> CharLiteral = "int.add_char_literal"; fn Negate(n: IntLiteral) -> IntLiteral = "int.snegate"; -// CHECK:STDERR: fail_invalid_result.carbon:[[@LINE+4]]:22: error: character arithmetic result 1114112 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult] -// CHECK:STDERR: let a: CharLiteral = AddIntChar(1, '\u{10FFFF}'); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_invalid_result.carbon:[[@LINE+2]]:22-48: error: character arithmetic result 1114112 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult] // CHECK:STDERR: let a: CharLiteral = AddIntChar(1, '\u{10FFFF}'); -// CHECK:STDERR: fail_invalid_result.carbon:[[@LINE+4]]:22: error: character arithmetic result 55296 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult] -// CHECK:STDERR: let b: CharLiteral = AddIntChar(1, '\u{D7FF}'); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_invalid_result.carbon:[[@LINE+2]]:22-46: error: character arithmetic result 55296 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult] // CHECK:STDERR: let b: CharLiteral = AddIntChar(1, '\u{D7FF}'); -// CHECK:STDERR: fail_invalid_result.carbon:[[@LINE+4]]:22: error: character arithmetic result -1 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult] -// CHECK:STDERR: let c: CharLiteral = AddIntChar(Negate(98), 'a'); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_invalid_result.carbon:[[@LINE+2]]:22-48: error: character arithmetic result -1 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult] // CHECK:STDERR: let c: CharLiteral = AddIntChar(Negate(98), 'a'); diff --git a/toolchain/check/testdata/builtins/int/and.carbon b/toolchain/check/testdata/builtins/int/and.carbon index 7398619a134c..b92e6c028e88 100644 --- a/toolchain/check/testdata/builtins/int/and.carbon +++ b/toolchain/check/testdata/builtins/int/and.carbon @@ -52,12 +52,8 @@ library "[[@TEST_NAME]]"; fn AndLit(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.and"; fn F(a: Core.IntLiteral) -> Core.IntLiteral { - // CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE+7]]:10: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: return AndLit(5, a); - // CHECK:STDERR: ^~~~~~~~~~~~ - // CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE-6]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] - // CHECK:STDERR: fn AndLit(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.and"; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE+3]]:10-21: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE-4]]:1-70: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] // CHECK:STDERR: return AndLit(5, a); } @@ -67,24 +63,16 @@ fn F(a: Core.IntLiteral) -> Core.IntLiteral { library "[[@TEST_NAME]]"; // Heterogeneous "and" is not supported. -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature] -// CHECK:STDERR: fn MixedAnd1(a: i32, b: Core.IntLiteral) -> i32 = "int.and"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-49: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature] // CHECK:STDERR: fn MixedAnd1(a: i32, b: Core.IntLiteral) -> i32 = "int.and"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature] -// CHECK:STDERR: fn MixedAnd2(a: Core.IntLiteral, b: i32) -> i32 = "int.and"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-49: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature] // CHECK:STDERR: fn MixedAnd2(a: Core.IntLiteral, b: i32) -> i32 = "int.and"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature] -// CHECK:STDERR: fn MixedAnd3(a: i32, b: Core.IntLiteral) -> Core.IntLiteral = "int.and"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-61: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature] // CHECK:STDERR: fn MixedAnd3(a: i32, b: Core.IntLiteral) -> Core.IntLiteral = "int.and"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature] -// CHECK:STDERR: fn MixedAnd4(a: Core.IntLiteral, b: i32) -> Core.IntLiteral = "int.and"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-61: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature] // CHECK:STDERR: fn MixedAnd4(a: Core.IntLiteral, b: i32) -> Core.IntLiteral = "int.and"; @@ -97,28 +85,16 @@ fn And(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.and"; fn Test(n: Core.IntLiteral) { // OK And(1, 1); - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+7]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: And(n, 1); - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-8]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] - // CHECK:STDERR: fn And(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.and"; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+3]]:3-11: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-6]]:1-67: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] // CHECK:STDERR: And(n, 1); - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+7]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: And(1, n); - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-16]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] - // CHECK:STDERR: fn And(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.and"; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+3]]:3-11: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-10]]:1-67: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] // CHECK:STDERR: And(1, n); - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+7]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: And(n, n); - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-24]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] - // CHECK:STDERR: fn And(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.and"; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+3]]:3-11: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-14]]:1-67: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] // CHECK:STDERR: And(n, n); } diff --git a/toolchain/check/testdata/builtins/int/and_assign.carbon b/toolchain/check/testdata/builtins/int/and_assign.carbon index 6a4e3822d700..2953ffc9eb3c 100644 --- a/toolchain/check/testdata/builtins/int/and_assign.carbon +++ b/toolchain/check/testdata/builtins/int/and_assign.carbon @@ -26,9 +26,7 @@ fn Call(ref a: i32, b: i32) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unsized.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.and_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.and_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.and_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.and_assign"; @@ -36,9 +34,7 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.and_assign"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_not_ptr.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.and_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.and_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_not_ptr.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.and_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.and_assign"; @@ -48,9 +44,7 @@ fn NotRef(a: i32, b: i32) = "int.and_assign"; // // library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_not_ptr.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.and_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.and_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_not_ptr.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.and_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.and_assign"; diff --git a/toolchain/check/testdata/builtins/int/complement.carbon b/toolchain/check/testdata/builtins/int/complement.carbon index 04dd2080af3f..c239f2ddfcaa 100644 --- a/toolchain/check/testdata/builtins/int/complement.carbon +++ b/toolchain/check/testdata/builtins/int/complement.carbon @@ -52,12 +52,8 @@ library "[[@TEST_NAME]]"; fn Complement(a: Core.IntLiteral) -> Core.IntLiteral = "int.complement"; fn F(a: Core.IntLiteral) -> Core.IntLiteral { - // CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE+7]]:10: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: return Complement(a); - // CHECK:STDERR: ^~~~~~~~~~~~~ - // CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE-6]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] - // CHECK:STDERR: fn Complement(a: Core.IntLiteral) -> Core.IntLiteral = "int.complement"; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE+3]]:10-22: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE-4]]:1-54: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] // CHECK:STDERR: return Complement(a); } diff --git a/toolchain/check/testdata/builtins/int/convert.carbon b/toolchain/check/testdata/builtins/int/convert.carbon index b490a5e3abf9..5dee1402ee2f 100644 --- a/toolchain/check/testdata/builtins/int/convert.carbon +++ b/toolchain/check/testdata/builtins/int/convert.carbon @@ -76,12 +76,8 @@ import library "int_ops"; fn F() { // Ensure our testing machinery works. - // 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))` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: Test(Int32ToInt32(0)) as Expect(1 as i32); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_self_test.carbon:[[@LINE+3]]:3-43: error: cannot convert expression of type `Expect(0)` to `Expect(1)` with `as` [ConversionFailure] + // CHECK:STDERR: fail_self_test.carbon:[[@LINE+2]]:3-43: note: type `Expect(0)` does not implement interface `Core.As(Expect(1))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: Test(Int32ToInt32(0)) as Expect(1 as i32); } @@ -245,13 +241,9 @@ import library "int_ops"; let not_constant: Core.IntLiteral = 0; -// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+8]]:33: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] -// CHECK:STDERR: let convert_not_constant: i16 = IntLiteralToInt16(not_constant); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_not_constant.carbon:[[@LINE-7]]:1: in import [InImport] -// CHECK:STDERR: int_ops.carbon:16:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] -// CHECK:STDERR: fn IntLiteralToInt16(a: Core.IntLiteral) -> i16 = "int.convert"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+4]]:33-63: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: imported from: fail_not_constant.carbon:[[@LINE-5]]:1 [InImport] +// CHECK:STDERR: int_ops.carbon:16:1-49: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] // CHECK:STDERR: let convert_not_constant: i16 = IntLiteralToInt16(not_constant); diff --git a/toolchain/check/testdata/builtins/int/convert_char_literal.carbon b/toolchain/check/testdata/builtins/int/convert_char_literal.carbon index 2c9c3f9729da..a2468bede7bc 100644 --- a/toolchain/check/testdata/builtins/int/convert_char_literal.carbon +++ b/toolchain/check/testdata/builtins/int/convert_char_literal.carbon @@ -40,21 +40,15 @@ alias IntLiteral = MakeIntLiteral(); fn ConvertFromIntLiteral(n: IntLiteral) -> CharLiteral = "int.convert_char_literal"; -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+4]]:22: error: integer value -1 is not a valid Unicode code point [InvalidCharLiteralValue] -// CHECK:STDERR: let a: CharLiteral = ConvertFromIntLiteral(-1); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:22-46: error: integer value -1 is not a valid Unicode code point [InvalidCharLiteralValue] // CHECK:STDERR: let a: CharLiteral = ConvertFromIntLiteral(-1); -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+4]]:22: error: integer value 55296 is not a valid Unicode code point [InvalidCharLiteralValue] -// CHECK:STDERR: let b: CharLiteral = ConvertFromIntLiteral(0xD800); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:22-50: error: integer value 55296 is not a valid Unicode code point [InvalidCharLiteralValue] // CHECK:STDERR: let b: CharLiteral = ConvertFromIntLiteral(0xD800); -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+4]]:22: error: integer value 1114112 is not a valid Unicode code point [InvalidCharLiteralValue] -// CHECK:STDERR: let c: CharLiteral = ConvertFromIntLiteral(0x110000); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:22-52: error: integer value 1114112 is not a valid Unicode code point [InvalidCharLiteralValue] // CHECK:STDERR: let c: CharLiteral = ConvertFromIntLiteral(0x110000); diff --git a/toolchain/check/testdata/builtins/int/convert_checked.carbon b/toolchain/check/testdata/builtins/int/convert_checked.carbon index be0f7741324f..60c26695fcd2 100644 --- a/toolchain/check/testdata/builtins/int/convert_checked.carbon +++ b/toolchain/check/testdata/builtins/int/convert_checked.carbon @@ -130,9 +130,7 @@ library "[[@TEST_NAME]]"; import library "int_ops"; let max_plus_one: i32 = - // CHECK:STDERR: fail_too_large_u32_for_i32.carbon:[[@LINE+4]]:3: error: integer value 2147483648 too large for type `i32` [IntTooLargeForType] - // CHECK:STDERR: Uint32ToInt32( - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_too_large_u32_for_i32.carbon:[[@LINE+2]]:3-16: error: integer value 2147483648 too large for type `i32` [IntTooLargeForType] // CHECK:STDERR: Uint32ToInt32( AddU32(Int32ToUint32(0x7FFF_FFFF), @@ -143,9 +141,7 @@ let max_plus_one: i32 = library "[[@TEST_NAME]]"; import library "int_ops"; -// CHECK:STDERR: fail_too_large_i32_for_i16.carbon:[[@LINE+4]]:25: error: integer value 32768 too large for type `i16` [IntTooLargeForType] -// CHECK:STDERR: let max_plus_one: i16 = Int32ToInt16(0x8000); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_large_i32_for_i16.carbon:[[@LINE+2]]:25-44: error: integer value 32768 too large for type `i16` [IntTooLargeForType] // CHECK:STDERR: let max_plus_one: i16 = Int32ToInt16(0x8000); @@ -154,9 +150,7 @@ let max_plus_one: i16 = Int32ToInt16(0x8000); library "[[@TEST_NAME]]"; import library "int_ops"; -// CHECK:STDERR: fail_too_large_i32_for_u16.carbon:[[@LINE+4]]:25: error: integer value 65536 too large for type `u16` [IntTooLargeForType] -// CHECK:STDERR: let max_plus_one: u16 = Int32ToUint16(0x1_0000); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_large_i32_for_u16.carbon:[[@LINE+2]]:25-47: error: integer value 65536 too large for type `u16` [IntTooLargeForType] // CHECK:STDERR: let max_plus_one: u16 = Int32ToUint16(0x1_0000); @@ -165,9 +159,7 @@ let max_plus_one: u16 = Int32ToUint16(0x1_0000); library "[[@TEST_NAME]]"; import library "int_ops"; -// CHECK:STDERR: fail_too_large_u32_for_i16.carbon:[[@LINE+4]]:25: error: integer value 32768 too large for type `i16` [IntTooLargeForType] -// CHECK:STDERR: let max_plus_one: i16 = Uint32ToInt16(Int32ToUint32(0x8000)); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_large_u32_for_i16.carbon:[[@LINE+2]]:25-60: error: integer value 32768 too large for type `i16` [IntTooLargeForType] // CHECK:STDERR: let max_plus_one: i16 = Uint32ToInt16(Int32ToUint32(0x8000)); @@ -176,9 +168,7 @@ let max_plus_one: i16 = Uint32ToInt16(Int32ToUint32(0x8000)); library "[[@TEST_NAME]]"; import library "int_ops"; -// CHECK:STDERR: fail_too_large_u32_for_u16.carbon:[[@LINE+4]]:25: error: integer value 65536 too large for type `u16` [IntTooLargeForType] -// CHECK:STDERR: let max_plus_one: u16 = Uint32ToUint16(Int32ToUint32(0x1_0000)); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_large_u32_for_u16.carbon:[[@LINE+2]]:25-63: error: integer value 65536 too large for type `u16` [IntTooLargeForType] // CHECK:STDERR: let max_plus_one: u16 = Uint32ToUint16(Int32ToUint32(0x1_0000)); @@ -187,9 +177,7 @@ let max_plus_one: u16 = Uint32ToUint16(Int32ToUint32(0x1_0000)); library "[[@TEST_NAME]]"; import library "int_ops"; -// CHECK:STDERR: fail_negative_i32_to_u16.carbon:[[@LINE+4]]:29: error: negative integer value -1 converted to unsigned type `u16` [NegativeIntInUnsignedType] -// CHECK:STDERR: let minus_one_to_u16: u16 = Int32ToUint16(SubI32(0, 1)); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_negative_i32_to_u16.carbon:[[@LINE+2]]:29-55: error: negative integer value -1 converted to unsigned type `u16` [NegativeIntInUnsignedType] // CHECK:STDERR: let minus_one_to_u16: u16 = Int32ToUint16(SubI32(0, 1)); @@ -198,9 +186,7 @@ let minus_one_to_u16: u16 = Int32ToUint16(SubI32(0, 1)); library "[[@TEST_NAME]]"; import library "int_ops"; -// CHECK:STDERR: fail_negative_i32_to_u32.carbon:[[@LINE+4]]:29: error: negative integer value -1 converted to unsigned type `u32` [NegativeIntInUnsignedType] -// CHECK:STDERR: let minus_one_to_u32: u32 = Int32ToUint32(SubI32(0, 1)); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_negative_i32_to_u32.carbon:[[@LINE+2]]:29-55: error: negative integer value -1 converted to unsigned type `u32` [NegativeIntInUnsignedType] // CHECK:STDERR: let minus_one_to_u32: u32 = Int32ToUint32(SubI32(0, 1)); @@ -209,9 +195,7 @@ let minus_one_to_u32: u32 = Int32ToUint32(SubI32(0, 1)); library "[[@TEST_NAME]]"; import library "int_ops"; -// CHECK:STDERR: fail_negative_i32_to_u64.carbon:[[@LINE+4]]:29: error: negative integer value -1 converted to unsigned type `u64` [NegativeIntInUnsignedType] -// CHECK:STDERR: let minus_one_to_u64: u64 = Int32ToUint64(SubI32(0, 1)); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_negative_i32_to_u64.carbon:[[@LINE+2]]:29-55: error: negative integer value -1 converted to unsigned type `u64` [NegativeIntInUnsignedType] // CHECK:STDERR: let minus_one_to_u64: u64 = Int32ToUint64(SubI32(0, 1)); @@ -220,9 +204,7 @@ let minus_one_to_u64: u64 = Int32ToUint64(SubI32(0, 1)); library "[[@TEST_NAME]]"; import library "int_ops"; -// CHECK:STDERR: fail_too_small_i32_for_i16.carbon:[[@LINE+4]]:26: error: integer value -32769 too large for type `i16` [IntTooLargeForType] -// CHECK:STDERR: let min_minus_one: i16 = Int32ToInt16(NegateI32(0x8001)); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_small_i32_for_i16.carbon:[[@LINE+2]]:26-56: error: integer value -32769 too large for type `i16` [IntTooLargeForType] // CHECK:STDERR: let min_minus_one: i16 = Int32ToInt16(NegateI32(0x8001)); @@ -233,33 +215,21 @@ import library "int_ops"; let not_constant: i32 = 0; -// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+8]]:40: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] -// CHECK:STDERR: let convert_not_constant_narrow: i16 = Int32ToInt16(not_constant); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_not_constant.carbon:[[@LINE-7]]:1: in import [InImport] -// CHECK:STDERR: int_ops.carbon:19:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] -// CHECK:STDERR: fn Int32ToInt16(a: i32) -> i16 = "int.convert_checked"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+4]]:40-65: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: imported from: fail_not_constant.carbon:[[@LINE-5]]:1 [InImport] +// CHECK:STDERR: int_ops.carbon:19:1-32: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] // CHECK:STDERR: let convert_not_constant_narrow: i16 = Int32ToInt16(not_constant); -// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+8]]:38: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] -// CHECK:STDERR: let convert_not_constant_same: i32 = Int32ToInt32(not_constant); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_not_constant.carbon:[[@LINE-17]]:1: in import [InImport] -// CHECK:STDERR: int_ops.carbon:11:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] -// CHECK:STDERR: fn Int32ToInt32(a: i32) -> i32 = "int.convert_checked"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+4]]:38-63: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: imported from: fail_not_constant.carbon:[[@LINE-11]]:1 [InImport] +// CHECK:STDERR: int_ops.carbon:11:1-32: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] // CHECK:STDERR: let convert_not_constant_same: i32 = Int32ToInt32(not_constant); -// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+8]]:39: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] -// CHECK:STDERR: let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_not_constant.carbon:[[@LINE-27]]:1: in import [InImport] -// CHECK:STDERR: int_ops.carbon:27:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] -// CHECK:STDERR: fn Int32ToInt64(a: i32) -> i64 = "int.convert_checked"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+4]]:39-64: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: imported from: fail_not_constant.carbon:[[@LINE-17]]:1 [InImport] +// CHECK:STDERR: int_ops.carbon:27:1-32: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] // CHECK:STDERR: let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); diff --git a/toolchain/check/testdata/builtins/int/convert_float.carbon b/toolchain/check/testdata/builtins/int/convert_float.carbon index 26549325dee1..36e95cffb1e9 100644 --- a/toolchain/check/testdata/builtins/int/convert_float.carbon +++ b/toolchain/check/testdata/builtins/int/convert_float.carbon @@ -48,9 +48,7 @@ library "[[@TEST_NAME]]"; import library "int_to_float"; //@dump-sem-ir-begin -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:21: error: integer value 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 too large for floating-point type `f64` [IntTooLargeForFloatType] -// CHECK:STDERR: let overflow: f64 = ConvertIntLiteralToF64(1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:21-354: error: integer value 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 too large for floating-point type `f64` [IntTooLargeForFloatType] // CHECK:STDERR: let overflow: f64 = ConvertIntLiteralToF64(1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000); //@dump-sem-ir-end @@ -73,10 +71,10 @@ let overflow: f64 = ConvertIntLiteralToF64(1000000000000000000000000000000000000 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { -// CHECK:STDOUT: %.loc9_354.1: %f64.761 = value_of_initializer @__global_init.%ConvertIntLiteralToF64.call [concrete = ] -// CHECK:STDOUT: %.loc9_354.2: %f64.761 = converted @__global_init.%ConvertIntLiteralToF64.call, %.loc9_354.1 [concrete = ] +// CHECK:STDOUT: %.loc7_354.1: %f64.761 = value_of_initializer @__global_init.%ConvertIntLiteralToF64.call [concrete = ] +// CHECK:STDOUT: %.loc7_354.2: %f64.761 = converted @__global_init.%ConvertIntLiteralToF64.call, %.loc7_354.1 [concrete = ] // CHECK:STDOUT: %f64: type = type_literal constants.%f64.761 [concrete = constants.%f64.761] -// CHECK:STDOUT: %overflow: %f64.761 = wrapper_binding overflow, %.loc9_354.2 [concrete = ] +// CHECK:STDOUT: %overflow: %f64.761 = wrapper_binding overflow, %.loc7_354.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %overflow.patt: %pattern_type.667 = value_binding_pattern overflow [concrete = constants.%overflow.patt] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/builtins/int/convert_float_checked.carbon b/toolchain/check/testdata/builtins/int/convert_float_checked.carbon index 13a233f8aa01..2a8c62bc532d 100644 --- a/toolchain/check/testdata/builtins/int/convert_float_checked.carbon +++ b/toolchain/check/testdata/builtins/int/convert_float_checked.carbon @@ -36,9 +36,7 @@ library "[[@TEST_NAME]]"; import library "int_to_float_checked"; //@dump-sem-ir-begin -// CHECK:STDERR: fail_lossy.carbon:[[@LINE+4]]:18: error: integer value 123456789 cannot be represented exactly in floating-point type `f32` [IntLossyConversionToFloat] -// CHECK:STDERR: let lossy: f32 = ConvertIntLiteralToF32(123456789); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_lossy.carbon:[[@LINE+2]]:18-50: error: integer value 123456789 cannot be represented exactly in floating-point type `f32` [IntLossyConversionToFloat] // CHECK:STDERR: let lossy: f32 = ConvertIntLiteralToF32(123456789); //@dump-sem-ir-end @@ -61,10 +59,10 @@ let lossy: f32 = ConvertIntLiteralToF32(123456789); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { -// CHECK:STDOUT: %.loc9_50.1: %f32.3bc = value_of_initializer @__global_init.%ConvertIntLiteralToF32.call [concrete = ] -// CHECK:STDOUT: %.loc9_50.2: %f32.3bc = converted @__global_init.%ConvertIntLiteralToF32.call, %.loc9_50.1 [concrete = ] +// CHECK:STDOUT: %.loc7_50.1: %f32.3bc = value_of_initializer @__global_init.%ConvertIntLiteralToF32.call [concrete = ] +// CHECK:STDOUT: %.loc7_50.2: %f32.3bc = converted @__global_init.%ConvertIntLiteralToF32.call, %.loc7_50.1 [concrete = ] // CHECK:STDOUT: %f32: type = type_literal constants.%f32.3bc [concrete = constants.%f32.3bc] -// CHECK:STDOUT: %lossy: %f32.3bc = wrapper_binding lossy, %.loc9_50.2 [concrete = ] +// CHECK:STDOUT: %lossy: %f32.3bc = wrapper_binding lossy, %.loc7_50.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %lossy.patt: %pattern_type.239 = value_binding_pattern lossy [concrete = constants.%lossy.patt] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/builtins/int/eq.carbon b/toolchain/check/testdata/builtins/int/eq.carbon index c22769742475..d8f104e4aa01 100644 --- a/toolchain/check/testdata/builtins/int/eq.carbon +++ b/toolchain/check/testdata/builtins/int/eq.carbon @@ -34,9 +34,7 @@ fn RuntimeCallIsValid(a: i32, b: i32) -> bool { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.eq" [InvalidBuiltinSignature] -// CHECK:STDERR: fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-39: error: invalid signature for builtin function "int.eq" [InvalidBuiltinSignature] // CHECK:STDERR: fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; @@ -81,28 +79,16 @@ fn Eq(a: Core.IntLiteral, b: Core.IntLiteral) -> bool = "int.eq"; fn Test(n: Core.IntLiteral) { // OK Eq(1, 1); - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+7]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: Eq(n, 1); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-8]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] - // CHECK:STDERR: fn Eq(a: Core.IntLiteral, b: Core.IntLiteral) -> bool = "int.eq"; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+3]]:3-10: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-6]]:1-55: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] // CHECK:STDERR: Eq(n, 1); - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+7]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: Eq(1, n); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-16]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] - // CHECK:STDERR: fn Eq(a: Core.IntLiteral, b: Core.IntLiteral) -> bool = "int.eq"; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+3]]:3-10: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-10]]:1-55: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] // CHECK:STDERR: Eq(1, n); - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+7]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: Eq(n, n); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-24]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] - // CHECK:STDERR: fn Eq(a: Core.IntLiteral, b: Core.IntLiteral) -> bool = "int.eq"; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+3]]:3-10: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-14]]:1-55: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] // CHECK:STDERR: Eq(n, n); } diff --git a/toolchain/check/testdata/builtins/int/fail_convert_oversized_type.carbon b/toolchain/check/testdata/builtins/int/fail_convert_oversized_type.carbon index 4023ab21c878..983204a050b9 100644 --- a/toolchain/check/testdata/builtins/int/fail_convert_oversized_type.carbon +++ b/toolchain/check/testdata/builtins/int/fail_convert_oversized_type.carbon @@ -17,16 +17,10 @@ library "[[@TEST_NAME]]"; // Initializing a binding whose type is an invalid integer type must not crash // constant evaluation (#7278). The type is diagnosed; the conversion of the // initializer should then produce an error value, not a CHECK failure. -// CHECK:STDERR: fail_width_not_multiple_of_8.carbon:[[@LINE+11]]:10: error: bit width of integer type literal must be a multiple of 8; use `Core.Int(8388609)` instead [IntWidthNotMultipleOf8] -// CHECK:STDERR: let bad: i8388609 = 0; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_width_not_multiple_of_8.carbon:[[@LINE+5]]:10-17: error: bit width of integer type literal must be a multiple of 8; use `Core.Int(8388609)` instead [IntWidthNotMultipleOf8] // CHECK:STDERR: -// CHECK:STDERR: fail_width_not_multiple_of_8.carbon:[[@LINE+7]]:10: error: binding pattern has incomplete type `i8388609` in name binding declaration [IncompleteTypeInBindingDecl] -// CHECK:STDERR: let bad: i8388609 = 0; -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: {{.*}}/prelude/types/int.carbon:18:9: note: integer type width of 8388609 is greater than the maximum supported width of 8388608 [IntWidthTooLarge] -// CHECK:STDERR: adapt MakeInt(N); -// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: fail_width_not_multiple_of_8.carbon:[[@LINE+3]]:10-17: error: binding pattern has incomplete type `i8388609` in name binding declaration [IncompleteTypeInBindingDecl] +// CHECK:STDERR: {{.*}}/prelude/types/int.carbon:18:9-18: note: integer type width of 8388609 is greater than the maximum supported width of 8388608 [IntWidthTooLarge] // CHECK:STDERR: let bad: i8388609 = 0; @@ -34,12 +28,8 @@ let bad: i8388609 = 0; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_width_too_large.carbon:[[@LINE+7]]:10: error: binding pattern has incomplete type `i16777216` in name binding declaration [IncompleteTypeInBindingDecl] -// CHECK:STDERR: let bad: i16777216 = 0; -// CHECK:STDERR: ^~~~~~~~~ -// CHECK:STDERR: {{.*}}/prelude/types/int.carbon:18:9: note: integer type width of 16777216 is greater than the maximum supported width of 8388608 [IntWidthTooLarge] -// CHECK:STDERR: adapt MakeInt(N); -// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: fail_width_too_large.carbon:[[@LINE+3]]:10-18: error: binding pattern has incomplete type `i16777216` in name binding declaration [IncompleteTypeInBindingDecl] +// CHECK:STDERR: {{.*}}/prelude/types/int.carbon:18:9-18: note: integer type width of 16777216 is greater than the maximum supported width of 8388608 [IntWidthTooLarge] // CHECK:STDERR: let bad: i16777216 = 0; @@ -47,11 +37,7 @@ let bad: i16777216 = 0; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_width_too_large_core_int.carbon:[[@LINE+7]]:10: error: binding pattern has incomplete type `i8388609` in name binding declaration [IncompleteTypeInBindingDecl] -// CHECK:STDERR: let bad: Core.Int(8388609) = 0; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ -// CHECK:STDERR: {{.*}}/prelude/types/int.carbon:18:9: note: integer type width of 8388609 is greater than the maximum supported width of 8388608 [IntWidthTooLarge] -// CHECK:STDERR: adapt MakeInt(N); -// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: fail_width_too_large_core_int.carbon:[[@LINE+3]]:10-26: error: binding pattern has incomplete type `i8388609` in name binding declaration [IncompleteTypeInBindingDecl] +// CHECK:STDERR: {{.*}}/prelude/types/int.carbon:18:9-18: note: integer type width of 8388609 is greater than the maximum supported width of 8388608 [IntWidthTooLarge] // CHECK:STDERR: let bad: Core.Int(8388609) = 0; diff --git a/toolchain/check/testdata/builtins/int/left_shift.carbon b/toolchain/check/testdata/builtins/int/left_shift.carbon index 628fb291d891..d97e04f412ad 100644 --- a/toolchain/check/testdata/builtins/int/left_shift.carbon +++ b/toolchain/check/testdata/builtins/int/left_shift.carbon @@ -111,52 +111,36 @@ fn LeftShiftLit(a: Core.IntLiteral, b: i32) -> Core.IntLiteral = "int.left_shift // Shift greater than size is disallowed for sized types. let size_1: i32 = LeftShift(1, 31); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error: shift distance >= type width of 32 in `1 << 32` [CompileTimeShiftOutOfRange] -// CHECK:STDERR: let size_2: i32 = LeftShift(1, 32); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:19-34: error: shift distance >= type width of 32 in `1 << 32` [CompileTimeShiftOutOfRange] // CHECK:STDERR: let size_2: i32 = LeftShift(1, 32); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error: shift distance >= type width of 32 in `1 << 33` [CompileTimeShiftOutOfRange] -// CHECK:STDERR: let size_3: i32 = LeftShift(1, 33); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:19-34: error: shift distance >= type width of 32 in `1 << 33` [CompileTimeShiftOutOfRange] // CHECK:STDERR: let size_3: i32 = LeftShift(1, 33); // Overflow is allowed if the shift distance is in bounds. let overflow_1: i32 = LeftShift(1000, 31); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:23: error: shift distance >= type width of 32 in `1000 << 32` [CompileTimeShiftOutOfRange] -// CHECK:STDERR: let overflow_2: i32 = LeftShift(1000, 32); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:23-41: error: shift distance >= type width of 32 in `1000 << 32` [CompileTimeShiftOutOfRange] // CHECK:STDERR: let overflow_2: i32 = LeftShift(1000, 32); // Oversize shifts aren't allowed even if there's no overflow. let no_overflow_1: i32 = LeftShift(0, 31); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:26: error: shift distance >= type width of 32 in `0 << 32` [CompileTimeShiftOutOfRange] -// CHECK:STDERR: let no_overflow_2: i32 = LeftShift(0, 32); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:26-41: error: shift distance >= type width of 32 in `0 << 32` [CompileTimeShiftOutOfRange] // CHECK:STDERR: let no_overflow_2: i32 = LeftShift(0, 32); // Negative shifts aren't allowed either, even for literals, even if the lhs is zero. -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:21: error: shift distance >= type width of 32 in `1 << -1` [CompileTimeShiftOutOfRange] -// CHECK:STDERR: let negative: i32 = LeftShift(1, -1); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:21-36: error: shift distance >= type width of 32 in `1 << -1` [CompileTimeShiftOutOfRange] // CHECK:STDERR: let negative: i32 = LeftShift(1, -1); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:26: error: shift distance >= type width of 32 in `0 << -1` [CompileTimeShiftOutOfRange] -// CHECK:STDERR: let negative_zero: i32 = LeftShift(0, -1); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:26-41: error: shift distance >= type width of 32 in `0 << -1` [CompileTimeShiftOutOfRange] // CHECK:STDERR: let negative_zero: i32 = LeftShift(0, -1); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:37: error: shift distance negative in `1 << -1` [CompileTimeShiftNegative] -// CHECK:STDERR: let negative_lit: Core.IntLiteral = LeftShiftLit(1, -1); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:37-55: error: shift distance negative in `1 << -1` [CompileTimeShiftNegative] // CHECK:STDERR: let negative_lit: Core.IntLiteral = LeftShiftLit(1, -1); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:42: error: shift distance negative in `0 << -1` [CompileTimeShiftNegative] -// CHECK:STDERR: let negative_lit_zero: Core.IntLiteral = LeftShiftLit(0, -1); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:42-60: error: shift distance negative in `0 << -1` [CompileTimeShiftNegative] // CHECK:STDERR: let negative_lit_zero: Core.IntLiteral = LeftShiftLit(0, -1); @@ -166,15 +150,11 @@ library "[[@TEST_NAME]]"; fn LeftShift(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.left_shift"; -// CHECK:STDERR: fail_literal_overflow.carbon:[[@LINE+4]]:16: error: shift distance of 1000000000 would result in an integer whose width is greater than the maximum supported width of 8388608 [CompileTimeUnsizedShiftOutOfRange] -// CHECK:STDERR: let bad: i32 = LeftShift(1, 1_000_000_000); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_literal_overflow.carbon:[[@LINE+2]]:16-42: error: shift distance of 1000000000 would result in an integer whose width is greater than the maximum supported width of 8388608 [CompileTimeUnsizedShiftOutOfRange] // CHECK:STDERR: let bad: i32 = LeftShift(1, 1_000_000_000); -// CHECK:STDERR: fail_literal_overflow.carbon:[[@LINE+4]]:25: error: shift distance of 1000000000 would result in an integer whose width is greater than the maximum supported width of 8388608 [CompileTimeUnsizedShiftOutOfRange] -// CHECK:STDERR: let bad_negative: i32 = LeftShift(-1, 1_000_000_000); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_literal_overflow.carbon:[[@LINE+2]]:25-52: error: shift distance of 1000000000 would result in an integer whose width is greater than the maximum supported width of 8388608 [CompileTimeUnsizedShiftOutOfRange] // CHECK:STDERR: let bad_negative: i32 = LeftShift(-1, 1_000_000_000); @@ -189,42 +169,26 @@ var a_lit: Core.IntLiteral = 12; var an_i32: i32 = 34; // This can't be valid: we don't have a compile-time or runtime integer value for `a_lit`. -// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE+7]]:17: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] -// CHECK:STDERR: let bad1: i32 = LeftShiftByLit(an_i32, a_lit); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE-10]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] -// CHECK:STDERR: fn LeftShiftByLit(a: i32, b: Core.IntLiteral) -> i32 = "int.left_shift"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE+3]]:17-45: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE-8]]:1-54: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] // CHECK:STDERR: let bad1: i32 = LeftShiftByLit(an_i32, a_lit); // TODO: This could be valid because we don't actually need the return value at runtime. -// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE+7]]:29: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] -// CHECK:STDERR: let bad2: Core.IntLiteral = LeftShiftOfLit(a_lit, an_i32); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE-19]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] -// CHECK:STDERR: fn LeftShiftOfLit(a: Core.IntLiteral, b: i32) -> Core.IntLiteral = "int.left_shift"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE+3]]:29-57: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE-13]]:1-66: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] // CHECK:STDERR: let bad2: Core.IntLiteral = LeftShiftOfLit(a_lit, an_i32); // TODO: This could be valid because the literal argument has a constant value. -// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE+7]]:17: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] -// CHECK:STDERR: let bad3: i32 = LeftShiftByLit(an_i32, 12); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE-30]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] -// CHECK:STDERR: fn LeftShiftByLit(a: i32, b: Core.IntLiteral) -> i32 = "int.left_shift"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE+3]]:17-42: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE-20]]:1-54: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] // CHECK:STDERR: let bad3: i32 = LeftShiftByLit(an_i32, 12); // TODO: This could be valid because we don't actually need the return value at runtime. -// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE+7]]:29: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] -// CHECK:STDERR: let bad4: Core.IntLiteral = LeftShiftOfLit(12, an_i32); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE-39]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] -// CHECK:STDERR: fn LeftShiftOfLit(a: Core.IntLiteral, b: i32) -> Core.IntLiteral = "int.left_shift"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE+3]]:29-54: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE-25]]:1-66: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] // CHECK:STDERR: let bad4: Core.IntLiteral = LeftShiftOfLit(12, an_i32); diff --git a/toolchain/check/testdata/builtins/int/left_shift_assign.carbon b/toolchain/check/testdata/builtins/int/left_shift_assign.carbon index 7ec18bb6a923..31d0c7d5b9cb 100644 --- a/toolchain/check/testdata/builtins/int/left_shift_assign.carbon +++ b/toolchain/check/testdata/builtins/int/left_shift_assign.carbon @@ -34,9 +34,7 @@ fn CallMixed(ref a: i32, b: i64) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unsized.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.left_shift_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.left_shift_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.left_shift_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.left_shift_assign"; @@ -44,9 +42,7 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.left_shift_assign" library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.left_shift_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.left_shift_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.left_shift_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.left_shift_assign"; diff --git a/toolchain/check/testdata/builtins/int/less_eq.carbon b/toolchain/check/testdata/builtins/int/less_eq.carbon index 90bf2f82af71..9bf391e712d2 100644 --- a/toolchain/check/testdata/builtins/int/less_eq.carbon +++ b/toolchain/check/testdata/builtins/int/less_eq.carbon @@ -79,28 +79,16 @@ fn LessEq(a: Core.IntLiteral, b: Core.IntLiteral) -> bool = "int.less_eq"; fn Test(n: Core.IntLiteral) { // OK LessEq(1, 1); - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+7]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: LessEq(n, 1); - // CHECK:STDERR: ^~~~~~~~~~~~ - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-8]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] - // CHECK:STDERR: fn LessEq(a: Core.IntLiteral, b: Core.IntLiteral) -> bool = "int.less_eq"; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+3]]:3-14: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-6]]:1-59: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] // CHECK:STDERR: LessEq(n, 1); - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+7]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: LessEq(1, n); - // CHECK:STDERR: ^~~~~~~~~~~~ - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-16]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] - // CHECK:STDERR: fn LessEq(a: Core.IntLiteral, b: Core.IntLiteral) -> bool = "int.less_eq"; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+3]]:3-14: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-10]]:1-59: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] // CHECK:STDERR: LessEq(1, n); - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+7]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: LessEq(n, n); - // CHECK:STDERR: ^~~~~~~~~~~~ - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-24]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] - // CHECK:STDERR: fn LessEq(a: Core.IntLiteral, b: Core.IntLiteral) -> bool = "int.less_eq"; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+3]]:3-14: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-14]]:1-59: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] // CHECK:STDERR: LessEq(n, n); } diff --git a/toolchain/check/testdata/builtins/int/make_type_signed.carbon b/toolchain/check/testdata/builtins/int/make_type_signed.carbon index 8278c4a9e424..006469338060 100644 --- a/toolchain/check/testdata/builtins/int/make_type_signed.carbon +++ b/toolchain/check/testdata/builtins/int/make_type_signed.carbon @@ -71,9 +71,7 @@ library "[[@TEST_NAME]]"; import library "types"; -// CHECK:STDERR: fail_zero_size.carbon:[[@LINE+4]]:8: error: integer type width of 0 is not positive [IntWidthNotPositive] -// CHECK:STDERR: var n: Int(0); -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_zero_size.carbon:[[@LINE+2]]:8-13: error: integer type width of 0 is not positive [IntWidthNotPositive] // CHECK:STDERR: var n: Int(0); @@ -85,9 +83,7 @@ import library "types"; fn Negate(a: IntLiteral) -> IntLiteral = "int.snegate"; -// CHECK:STDERR: fail_negative_size.carbon:[[@LINE+4]]:8: error: integer type width of -1 is not positive [IntWidthNotPositive] -// CHECK:STDERR: var n: Int(Negate(1)); -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_negative_size.carbon:[[@LINE+2]]:8-21: error: integer type width of -1 is not positive [IntWidthNotPositive] // CHECK:STDERR: var n: Int(Negate(1)); @@ -97,9 +93,7 @@ library "[[@TEST_NAME]]"; import library "types"; -// CHECK:STDERR: fail_oversized.carbon:[[@LINE+4]]:8: error: integer type width of 1000000000 is greater than the maximum supported width of 8388608 [IntWidthTooLarge] -// CHECK:STDERR: var m: Int(1000000000); -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_oversized.carbon:[[@LINE+2]]:8-22: error: integer type width of 1000000000 is greater than the maximum supported width of 8388608 [IntWidthTooLarge] // CHECK:STDERR: var m: Int(1000000000); diff --git a/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon b/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon index 99832486c0cb..9a49beeea121 100644 --- a/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon +++ b/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon @@ -53,9 +53,7 @@ library "[[@TEST_NAME]]"; import library "types"; -// CHECK:STDERR: fail_zero_size.carbon:[[@LINE+4]]:8: error: integer type width of 0 is not positive [IntWidthNotPositive] -// CHECK:STDERR: var n: UInt(0); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_zero_size.carbon:[[@LINE+2]]:8-14: error: integer type width of 0 is not positive [IntWidthNotPositive] // CHECK:STDERR: var n: UInt(0); @@ -67,9 +65,7 @@ import library "types"; fn Negate(n: i32) -> i32 = "int.snegate"; -// CHECK:STDERR: fail_negative_size.carbon:[[@LINE+4]]:8: error: integer type width of -1 is not positive [IntWidthNotPositive] -// CHECK:STDERR: var n: UInt(Negate(1)); -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_negative_size.carbon:[[@LINE+2]]:8-22: error: integer type width of -1 is not positive [IntWidthNotPositive] // CHECK:STDERR: var n: UInt(Negate(1)); @@ -79,9 +75,7 @@ library "[[@TEST_NAME]]"; import library "types"; -// CHECK:STDERR: fail_oversized.carbon:[[@LINE+4]]:8: error: integer type width of 1000000000 is greater than the maximum supported width of 8388608 [IntWidthTooLarge] -// CHECK:STDERR: var m: UInt(1000000000); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_oversized.carbon:[[@LINE+2]]:8-23: error: integer type width of 1000000000 is greater than the maximum supported width of 8388608 [IntWidthTooLarge] // CHECK:STDERR: var m: UInt(1000000000); diff --git a/toolchain/check/testdata/builtins/int/or_assign.carbon b/toolchain/check/testdata/builtins/int/or_assign.carbon index 690487400584..fa609108165f 100644 --- a/toolchain/check/testdata/builtins/int/or_assign.carbon +++ b/toolchain/check/testdata/builtins/int/or_assign.carbon @@ -26,9 +26,7 @@ fn Call(ref a: i32, b: i32) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unsized.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.or_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.or_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.or_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.or_assign"; @@ -36,15 +34,11 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.or_assign"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.or_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.or_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.or_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.or_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.or_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.or_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.or_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.or_assign"; diff --git a/toolchain/check/testdata/builtins/int/right_shift.carbon b/toolchain/check/testdata/builtins/int/right_shift.carbon index 9b3dc1483adc..587b03dbdc9b 100644 --- a/toolchain/check/testdata/builtins/int/right_shift.carbon +++ b/toolchain/check/testdata/builtins/int/right_shift.carbon @@ -99,36 +99,24 @@ fn RightShiftLit(a: Core.IntLiteral, b: i32) -> Core.IntLiteral = "int.right_shi // Shift greater than size is disallowed for sized types. let size_1: i32 = RightShift(1, 31); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error: shift distance >= type width of 32 in `1 >> 32` [CompileTimeShiftOutOfRange] -// CHECK:STDERR: let size_2: i32 = RightShift(1, 32); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:19-35: error: shift distance >= type width of 32 in `1 >> 32` [CompileTimeShiftOutOfRange] // CHECK:STDERR: let size_2: i32 = RightShift(1, 32); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error: shift distance >= type width of 32 in `1 >> 33` [CompileTimeShiftOutOfRange] -// CHECK:STDERR: let size_3: i32 = RightShift(1, 33); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:19-35: error: shift distance >= type width of 32 in `1 >> 33` [CompileTimeShiftOutOfRange] // CHECK:STDERR: let size_3: i32 = RightShift(1, 33); // Negative shifts aren't allowed either, even for literals, even if the lhs is zero. -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:21: error: shift distance >= type width of 32 in `1 >> -1` [CompileTimeShiftOutOfRange] -// CHECK:STDERR: let negative: i32 = RightShift(1, -1); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:21-37: error: shift distance >= type width of 32 in `1 >> -1` [CompileTimeShiftOutOfRange] // CHECK:STDERR: let negative: i32 = RightShift(1, -1); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:26: error: shift distance >= type width of 32 in `0 >> -1` [CompileTimeShiftOutOfRange] -// CHECK:STDERR: let negative_zero: i32 = RightShift(0, -1); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:26-42: error: shift distance >= type width of 32 in `0 >> -1` [CompileTimeShiftOutOfRange] // CHECK:STDERR: let negative_zero: i32 = RightShift(0, -1); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:37: error: shift distance negative in `1 >> -1` [CompileTimeShiftNegative] -// CHECK:STDERR: let negative_lit: Core.IntLiteral = RightShiftLit(1, -1); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:37-56: error: shift distance negative in `1 >> -1` [CompileTimeShiftNegative] // CHECK:STDERR: let negative_lit: Core.IntLiteral = RightShiftLit(1, -1); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:42: error: shift distance negative in `0 >> -1` [CompileTimeShiftNegative] -// CHECK:STDERR: let negative_lit_zero: Core.IntLiteral = RightShiftLit(0, -1); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:42-61: error: shift distance negative in `0 >> -1` [CompileTimeShiftNegative] // CHECK:STDERR: let negative_lit_zero: Core.IntLiteral = RightShiftLit(0, -1); diff --git a/toolchain/check/testdata/builtins/int/right_shift_assign.carbon b/toolchain/check/testdata/builtins/int/right_shift_assign.carbon index ae6d12a06d43..4314182ae943 100644 --- a/toolchain/check/testdata/builtins/int/right_shift_assign.carbon +++ b/toolchain/check/testdata/builtins/int/right_shift_assign.carbon @@ -34,9 +34,7 @@ fn CallMixed(ref a: i32, b: i64) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unsized.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.right_shift_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.right_shift_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.right_shift_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.right_shift_assign"; @@ -44,9 +42,7 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.right_shift_assign library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.right_shift_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.right_shift_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.right_shift_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.right_shift_assign"; diff --git a/toolchain/check/testdata/builtins/int/sadd.carbon b/toolchain/check/testdata/builtins/int/sadd.carbon index 59e52050209b..aebbe79b23ff 100644 --- a/toolchain/check/testdata/builtins/int/sadd.carbon +++ b/toolchain/check/testdata/builtins/int/sadd.carbon @@ -57,15 +57,11 @@ fn F() { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_few.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] -// CHECK:STDERR: fn TooFew(a: i32) -> i32 = "int.sadd"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:1-26: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] // CHECK:STDERR: fn TooFew(a: i32) -> i32 = "int.sadd"; -// CHECK:STDERR: fail_too_few.carbon:[[@LINE+4]]:26: error: name `TooMany` not found [NameNotFound] -// CHECK:STDERR: var too_many: array(i32, TooMany(1, 2, 3)); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:26-32: error: name `TooMany` not found [NameNotFound] // CHECK:STDERR: var too_many: array(i32, TooMany(1, 2, 3)); @@ -77,15 +73,11 @@ fn RuntimeCallIsValidTooFew(a: i32) -> i32 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_many.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] -// CHECK:STDERR: fn TooMany(a: i32, b: i32, c: i32) -> i32 = "int.sadd"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:1-43: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] // CHECK:STDERR: fn TooMany(a: i32, b: i32, c: i32) -> i32 = "int.sadd"; -// CHECK:STDERR: fail_too_many.carbon:[[@LINE+4]]:33: error: name `BadReturnType` not found [NameNotFound] -// CHECK:STDERR: var bad_return_type: array(i32, BadReturnType(1, 2)); -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:33-45: error: name `BadReturnType` not found [NameNotFound] // CHECK:STDERR: var bad_return_type: array(i32, BadReturnType(1, 2)); @@ -97,15 +89,11 @@ fn RuntimeCallIsValidTooMany(a: i32, b: i32, c: i32) -> i32 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] -// CHECK:STDERR: fn BadReturnType(a: i32, b: i32) -> bool = "int.sadd"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:1-42: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] // CHECK:STDERR: fn BadReturnType(a: i32, b: i32) -> bool = "int.sadd"; -// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+4]]:25: error: name `TooFew` not found [NameNotFound] -// CHECK:STDERR: var too_few: array(i32, TooFew(1)); -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:25-30: error: name `TooFew` not found [NameNotFound] // CHECK:STDERR: var too_few: array(i32, TooFew(1)); @@ -117,9 +105,7 @@ fn RuntimeCallIsValidBadReturnType(a: i32, b: i32) -> bool { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_call.carbon:[[@LINE+4]]:26: error: name `JustRight` not found [NameNotFound] -// CHECK:STDERR: var bad_call: array(i32, JustRight(1, 2, 3)); -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_bad_call.carbon:[[@LINE+2]]:26-34: error: name `JustRight` not found [NameNotFound] // CHECK:STDERR: var bad_call: array(i32, JustRight(1, 2, 3)); @@ -127,24 +113,16 @@ var bad_call: array(i32, JustRight(1, 2, 3)); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_mixed_add.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] -// CHECK:STDERR: fn MixedAdd1(a: i32, b: Core.IntLiteral) -> i32 = "int.sadd"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_mixed_add.carbon:[[@LINE+2]]:1-49: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] // CHECK:STDERR: fn MixedAdd1(a: i32, b: Core.IntLiteral) -> i32 = "int.sadd"; -// CHECK:STDERR: fail_mixed_add.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] -// CHECK:STDERR: fn MixedAdd2(a: Core.IntLiteral, b: i32) -> i32 = "int.sadd"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_mixed_add.carbon:[[@LINE+2]]:1-49: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] // CHECK:STDERR: fn MixedAdd2(a: Core.IntLiteral, b: i32) -> i32 = "int.sadd"; -// CHECK:STDERR: fail_mixed_add.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] -// CHECK:STDERR: fn MixedAdd3(a: i32, b: Core.IntLiteral) -> Core.IntLiteral = "int.sadd"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_mixed_add.carbon:[[@LINE+2]]:1-61: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] // CHECK:STDERR: fn MixedAdd3(a: i32, b: Core.IntLiteral) -> Core.IntLiteral = "int.sadd"; -// CHECK:STDERR: fail_mixed_add.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] -// CHECK:STDERR: fn MixedAdd4(a: Core.IntLiteral, b: i32) -> Core.IntLiteral = "int.sadd"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_mixed_add.carbon:[[@LINE+2]]:1-61: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] // CHECK:STDERR: fn MixedAdd4(a: Core.IntLiteral, b: i32) -> Core.IntLiteral = "int.sadd"; @@ -155,9 +133,7 @@ library "[[@TEST_NAME]]"; fn Add(a: i32, b: i32) -> i32 = "int.sadd"; let a: i32 = Add(0x7FFFFFFF, 0); -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:14: error: integer overflow in calculation `2147483647 + 1` [CompileTimeIntegerOverflow] -// CHECK:STDERR: let b: i32 = Add(0x7FFFFFFF, 1); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:14-31: error: integer overflow in calculation `2147483647 + 1` [CompileTimeIntegerOverflow] // CHECK:STDERR: let b: i32 = Add(0x7FFFFFFF, 1); diff --git a/toolchain/check/testdata/builtins/int/sadd_assign.carbon b/toolchain/check/testdata/builtins/int/sadd_assign.carbon index 6c38a5907f8e..067da74df060 100644 --- a/toolchain/check/testdata/builtins/int/sadd_assign.carbon +++ b/toolchain/check/testdata/builtins/int/sadd_assign.carbon @@ -24,9 +24,7 @@ fn Call(ref a: i32, b: i32) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unsized.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.sadd_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.sadd_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.sadd_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.sadd_assign"; @@ -34,14 +32,10 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.sadd_assign"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.sadd_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.sadd_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.sadd_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.sadd_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.sadd_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.sadd_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.sadd_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.sadd_assign"; diff --git a/toolchain/check/testdata/builtins/int/sdiv.carbon b/toolchain/check/testdata/builtins/int/sdiv.carbon index 9acf46f05881..b1da9d4b7ffd 100644 --- a/toolchain/check/testdata/builtins/int/sdiv.carbon +++ b/toolchain/check/testdata/builtins/int/sdiv.carbon @@ -40,9 +40,7 @@ let a: i32 = Div(-0x7FFF_FFFF, -1); let b: i32 = Div(-0x8000_0000, 1); // -0x8000_0000 / -1 overflows. -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:14: error: integer overflow in calculation `-2147483648 / -1` [CompileTimeIntegerOverflow] -// CHECK:STDERR: let c: i32 = Div(-0x8000_0000, -1); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:14-34: error: integer overflow in calculation `-2147483648 / -1` [CompileTimeIntegerOverflow] // CHECK:STDERR: let c: i32 = Div(-0x8000_0000, -1); @@ -67,28 +65,20 @@ library "[[@TEST_NAME]]"; fn Div(a: i32, b: i32) -> i32 = "int.sdiv"; fn DivLit(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.sdiv"; -// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:14: error: division by zero [CompileTimeDivisionByZero] -// CHECK:STDERR: let a: i32 = Div(1, 0); -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+2]]:14-22: error: division by zero [CompileTimeDivisionByZero] // CHECK:STDERR: let a: i32 = Div(1, 0); -// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:14: error: division by zero [CompileTimeDivisionByZero] -// CHECK:STDERR: let b: i32 = Div(0, 0); -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+2]]:14-22: error: division by zero [CompileTimeDivisionByZero] // CHECK:STDERR: let b: i32 = Div(0, 0); // IntLiteral allows "overflow" by widening its representation, but not overflow to infinity. -// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:26: error: division by zero [CompileTimeDivisionByZero] -// CHECK:STDERR: let c: Core.IntLiteral = DivLit(1, 0); -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+2]]:26-37: error: division by zero [CompileTimeDivisionByZero] // CHECK:STDERR: let c: Core.IntLiteral = DivLit(1, 0); -// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:26: error: division by zero [CompileTimeDivisionByZero] -// CHECK:STDERR: let d: Core.IntLiteral = DivLit(0, 0); -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+2]]:26-37: error: division by zero [CompileTimeDivisionByZero] // CHECK:STDERR: let d: Core.IntLiteral = DivLit(0, 0); diff --git a/toolchain/check/testdata/builtins/int/sdiv_assign.carbon b/toolchain/check/testdata/builtins/int/sdiv_assign.carbon index d964b0410681..5315afff8a40 100644 --- a/toolchain/check/testdata/builtins/int/sdiv_assign.carbon +++ b/toolchain/check/testdata/builtins/int/sdiv_assign.carbon @@ -26,9 +26,7 @@ fn Call(ref a: i32, b: i32) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unsized.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.sdiv_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.sdiv_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.sdiv_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.sdiv_assign"; @@ -36,15 +34,11 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.sdiv_assign"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.sdiv_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.sdiv_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.sdiv_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.sdiv_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.sdiv_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.sdiv_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.sdiv_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.sdiv_assign"; diff --git a/toolchain/check/testdata/builtins/int/smod.carbon b/toolchain/check/testdata/builtins/int/smod.carbon index 541968d6faf3..63b81e9cb0d0 100644 --- a/toolchain/check/testdata/builtins/int/smod.carbon +++ b/toolchain/check/testdata/builtins/int/smod.carbon @@ -41,9 +41,7 @@ let b: i32 = Mod(Sub(Negate(0x7FFF_FFFF), 1), 1); // -0x8000_0000 / -1 overflows, so -0x8000_0000 % -1 is disallowed, even though // its result is representable. -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:14: error: integer overflow in calculation `-2147483648 % -1` [CompileTimeIntegerOverflow] -// CHECK:STDERR: let c: i32 = Mod(Sub(Negate(0x7FFF_FFFF), 1), Negate(1)); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:14-56: error: integer overflow in calculation `-2147483648 % -1` [CompileTimeIntegerOverflow] // CHECK:STDERR: let c: i32 = Mod(Sub(Negate(0x7FFF_FFFF), 1), Negate(1)); @@ -55,15 +53,11 @@ fn Mod(a: i32, b: i32) -> i32 = "int.smod"; // Remainder of division by zero is not defined. -// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:14: error: division by zero [CompileTimeDivisionByZero] -// CHECK:STDERR: let a: i32 = Mod(1, 0); -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+2]]:14-22: error: division by zero [CompileTimeDivisionByZero] // CHECK:STDERR: let a: i32 = Mod(1, 0); -// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:14: error: division by zero [CompileTimeDivisionByZero] -// CHECK:STDERR: let b: i32 = Mod(0, 0); -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+2]]:14-22: error: division by zero [CompileTimeDivisionByZero] // CHECK:STDERR: let b: i32 = Mod(0, 0); diff --git a/toolchain/check/testdata/builtins/int/smod_assign.carbon b/toolchain/check/testdata/builtins/int/smod_assign.carbon index b51c256951e4..b2f211ba8ca7 100644 --- a/toolchain/check/testdata/builtins/int/smod_assign.carbon +++ b/toolchain/check/testdata/builtins/int/smod_assign.carbon @@ -26,9 +26,7 @@ fn Call(ref a: i32, b: i32) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unsized.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.smod_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.smod_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.smod_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.smod_assign"; @@ -36,15 +34,11 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.smod_assign"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.smod_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.smod_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.smod_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.smod_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.smod_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.smod_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.smod_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.smod_assign"; diff --git a/toolchain/check/testdata/builtins/int/smul.carbon b/toolchain/check/testdata/builtins/int/smul.carbon index 65dbbc77b068..171a52a80199 100644 --- a/toolchain/check/testdata/builtins/int/smul.carbon +++ b/toolchain/check/testdata/builtins/int/smul.carbon @@ -68,9 +68,7 @@ library "[[@TEST_NAME]]"; fn Mul(a: i32, b: i32) -> i32 = "int.smul"; let a: i32 = Mul(0x7FFF, 0x10000); -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:14: error: integer overflow in calculation `32768 * 65536` [CompileTimeIntegerOverflow] -// CHECK:STDERR: let b: i32 = Mul(0x8000, 0x10000); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:14-33: error: integer overflow in calculation `32768 * 65536` [CompileTimeIntegerOverflow] // CHECK:STDERR: let b: i32 = Mul(0x8000, 0x10000); diff --git a/toolchain/check/testdata/builtins/int/smul_assign.carbon b/toolchain/check/testdata/builtins/int/smul_assign.carbon index d652a7fba86f..e2915cfb0294 100644 --- a/toolchain/check/testdata/builtins/int/smul_assign.carbon +++ b/toolchain/check/testdata/builtins/int/smul_assign.carbon @@ -26,9 +26,7 @@ fn Call(ref a: i32, b: i32) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unsized.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.smul_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.smul_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.smul_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.smul_assign"; @@ -36,15 +34,11 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.smul_assign"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.smul_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.smul_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.smul_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.smul_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.smul_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.smul_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.smul_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.smul_assign"; diff --git a/toolchain/check/testdata/builtins/int/snegate.carbon b/toolchain/check/testdata/builtins/int/snegate.carbon index 1dc0dded525c..26f99452ec71 100644 --- a/toolchain/check/testdata/builtins/int/snegate.carbon +++ b/toolchain/check/testdata/builtins/int/snegate.carbon @@ -47,15 +47,11 @@ fn F() { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_few.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.snegate" [InvalidBuiltinSignature] -// CHECK:STDERR: fn TooFew() -> i32 = "int.snegate"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:1-20: error: invalid signature for builtin function "int.snegate" [InvalidBuiltinSignature] // CHECK:STDERR: fn TooFew() -> i32 = "int.snegate"; -// CHECK:STDERR: fail_too_few.carbon:[[@LINE+4]]:25: error: array bound is not a constant [InvalidArrayExpr] -// CHECK:STDERR: var too_few: array(i32, TooFew()); -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:25-32: error: array bound is not a constant [InvalidArrayExpr] // CHECK:STDERR: var too_few: array(i32, TooFew()); @@ -67,15 +63,11 @@ fn RuntimeCallIsValidTooFew() -> i32 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_many.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.snegate" [InvalidBuiltinSignature] -// CHECK:STDERR: fn TooMany(a: i32, b: i32) -> i32 = "int.snegate"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.snegate" [InvalidBuiltinSignature] // CHECK:STDERR: fn TooMany(a: i32, b: i32) -> i32 = "int.snegate"; -// CHECK:STDERR: fail_too_many.carbon:[[@LINE+4]]:26: error: array bound is not a constant [InvalidArrayExpr] -// CHECK:STDERR: var too_many: array(i32, TooMany(1, 2)); -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:26-38: error: array bound is not a constant [InvalidArrayExpr] // CHECK:STDERR: var too_many: array(i32, TooMany(1, 2)); @@ -87,15 +79,11 @@ fn RuntimeCallIsValidTooMany(a: i32, b: i32) -> i32 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.snegate" [InvalidBuiltinSignature] -// CHECK:STDERR: fn BadReturnType(a: i32) -> bool = "int.snegate"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:1-34: error: invalid signature for builtin function "int.snegate" [InvalidBuiltinSignature] // CHECK:STDERR: fn BadReturnType(a: i32) -> bool = "int.snegate"; -// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+4]]:33: error: array bound is not a constant [InvalidArrayExpr] -// CHECK:STDERR: var bad_return_type: array(i32, BadReturnType(1)); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:33-48: error: array bound is not a constant [InvalidArrayExpr] // CHECK:STDERR: var bad_return_type: array(i32, BadReturnType(1)); @@ -109,12 +97,8 @@ library "[[@TEST_NAME]]"; fn Negate(a: i32) -> i32 = "int.snegate"; -// CHECK:STDERR: fail_bad_call.carbon:[[@LINE+7]]:26: error: 2 arguments passed to function expecting 1 argument [CallArgCountMismatch] -// CHECK:STDERR: var bad_call: array(i32, Negate(1, 2)); -// CHECK:STDERR: ^~~~~~~~~~~~ -// CHECK:STDERR: fail_bad_call.carbon:[[@LINE-5]]:1: note: calling function declared here [InCallToEntity] -// CHECK:STDERR: fn Negate(a: i32) -> i32 = "int.snegate"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_call.carbon:[[@LINE+3]]:26-37: error: 2 arguments passed to function expecting 1 argument [CallArgCountMismatch] +// CHECK:STDERR: fail_bad_call.carbon:[[@LINE-3]]:1-26: note: calling function declared here [InCallToEntity] // CHECK:STDERR: var bad_call: array(i32, Negate(1, 2)); @@ -129,9 +113,7 @@ fn Sub(a: i32, b: i32) -> i32 = "int.ssub"; let a: i32 = Negate(Negate(0x7FFF_FFFF)); // -INT_MIN is too large for i32. -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:14: error: integer overflow in negation of -2147483648 [CompileTimeIntegerNegateOverflow] -// CHECK:STDERR: let b: i32 = Negate(-0x8000_0000); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:14-33: error: integer overflow in negation of -2147483648 [CompileTimeIntegerNegateOverflow] // CHECK:STDERR: let b: i32 = Negate(-0x8000_0000); diff --git a/toolchain/check/testdata/builtins/int/ssub.carbon b/toolchain/check/testdata/builtins/int/ssub.carbon index ab8707c3dd49..322046290866 100644 --- a/toolchain/check/testdata/builtins/int/ssub.carbon +++ b/toolchain/check/testdata/builtins/int/ssub.carbon @@ -33,9 +33,7 @@ fn Sub(a: i32, b: i32) -> i32 = "int.ssub"; let a: i32 = Sub(0, 0x7FFFFFFF); let b: i32 = Sub(Sub(0, 0x7FFFFFFF), 1); -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:14: error: integer overflow in calculation `-2147483647 - 2` [CompileTimeIntegerOverflow] -// CHECK:STDERR: let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:14-39: error: integer overflow in calculation `-2147483647 - 2` [CompileTimeIntegerOverflow] // CHECK:STDERR: let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); diff --git a/toolchain/check/testdata/builtins/int/ssub_assign.carbon b/toolchain/check/testdata/builtins/int/ssub_assign.carbon index 54609c670758..87d7c2089d80 100644 --- a/toolchain/check/testdata/builtins/int/ssub_assign.carbon +++ b/toolchain/check/testdata/builtins/int/ssub_assign.carbon @@ -26,9 +26,7 @@ fn Call(ref a: i32, b: i32) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unsized.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.ssub_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.ssub_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.ssub_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.ssub_assign"; @@ -36,15 +34,11 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.ssub_assign"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.ssub_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.ssub_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.ssub_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.ssub_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.ssub_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.ssub_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.ssub_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.ssub_assign"; diff --git a/toolchain/check/testdata/builtins/int/uadd.carbon b/toolchain/check/testdata/builtins/int/uadd.carbon index 29ee50fc1666..0da41e32948a 100644 --- a/toolchain/check/testdata/builtins/int/uadd.carbon +++ b/toolchain/check/testdata/builtins/int/uadd.carbon @@ -29,15 +29,11 @@ fn RuntimeCallIsValid(a: i32, b: i32) -> i32 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_few.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.uadd" [InvalidBuiltinSignature] -// CHECK:STDERR: fn TooFew(a: i32) -> i32 = "int.uadd"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:1-26: error: invalid signature for builtin function "int.uadd" [InvalidBuiltinSignature] // CHECK:STDERR: fn TooFew(a: i32) -> i32 = "int.uadd"; -// CHECK:STDERR: fail_too_few.carbon:[[@LINE+4]]:25: error: array bound is not a constant [InvalidArrayExpr] -// CHECK:STDERR: var too_few: array(i32, TooFew(1)); -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:25-33: error: array bound is not a constant [InvalidArrayExpr] // CHECK:STDERR: var too_few: array(i32, TooFew(1)); @@ -49,15 +45,11 @@ fn RuntimeCallIsValidTooFew(a: i32) -> i32 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_many.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.uadd" [InvalidBuiltinSignature] -// CHECK:STDERR: fn TooMany(a: i32, b: i32, c: i32) -> i32 = "int.uadd"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:1-43: error: invalid signature for builtin function "int.uadd" [InvalidBuiltinSignature] // CHECK:STDERR: fn TooMany(a: i32, b: i32, c: i32) -> i32 = "int.uadd"; -// CHECK:STDERR: fail_too_many.carbon:[[@LINE+4]]:26: error: array bound is not a constant [InvalidArrayExpr] -// CHECK:STDERR: var too_many: array(i32, TooMany(1, 2, 3)); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:26-41: error: array bound is not a constant [InvalidArrayExpr] // CHECK:STDERR: var too_many: array(i32, TooMany(1, 2, 3)); @@ -69,15 +61,11 @@ fn RuntimeCallIsValidTooMany(a: i32, b: i32, c: i32) -> i32 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.uadd" [InvalidBuiltinSignature] -// CHECK:STDERR: fn BadReturnType(a: i32, b: i32) -> bool = "int.uadd"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:1-42: error: invalid signature for builtin function "int.uadd" [InvalidBuiltinSignature] // CHECK:STDERR: fn BadReturnType(a: i32, b: i32) -> bool = "int.uadd"; -// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+4]]:33: error: array bound is not a constant [InvalidArrayExpr] -// CHECK:STDERR: var bad_return_type: array(i32, BadReturnType(1, 2)); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:33-51: error: array bound is not a constant [InvalidArrayExpr] // CHECK:STDERR: var bad_return_type: array(i32, BadReturnType(1, 2)); @@ -91,12 +79,8 @@ library "[[@TEST_NAME]]"; fn Add(a: i32, b: i32) -> i32 = "int.uadd"; -// CHECK:STDERR: fail_bad_call.carbon:[[@LINE+7]]:26: error: 3 arguments passed to function expecting 2 arguments [CallArgCountMismatch] -// CHECK:STDERR: var bad_call: array(i32, Add(1, 2, 3)); -// CHECK:STDERR: ^~~~~~~~~~~~ -// CHECK:STDERR: fail_bad_call.carbon:[[@LINE-5]]:1: note: calling function declared here [InCallToEntity] -// CHECK:STDERR: fn Add(a: i32, b: i32) -> i32 = "int.uadd"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_call.carbon:[[@LINE+3]]:26-37: error: 3 arguments passed to function expecting 2 arguments [CallArgCountMismatch] +// CHECK:STDERR: fail_bad_call.carbon:[[@LINE-3]]:1-31: note: calling function declared here [InCallToEntity] // CHECK:STDERR: var bad_call: array(i32, Add(1, 2, 3)); diff --git a/toolchain/check/testdata/builtins/int/uadd_assign.carbon b/toolchain/check/testdata/builtins/int/uadd_assign.carbon index b3935ad2a7b0..40a6dbe81ab9 100644 --- a/toolchain/check/testdata/builtins/int/uadd_assign.carbon +++ b/toolchain/check/testdata/builtins/int/uadd_assign.carbon @@ -26,9 +26,7 @@ fn Call(ref a: i32, b: i32) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unsized.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.uadd_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.uadd_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.uadd_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.uadd_assign"; @@ -36,15 +34,11 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.uadd_assign"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.uadd_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.uadd_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.uadd_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.uadd_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.uadd_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.uadd_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.uadd_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.uadd_assign"; diff --git a/toolchain/check/testdata/builtins/int/udiv.carbon b/toolchain/check/testdata/builtins/int/udiv.carbon index 6baeee69508e..ed6215b21442 100644 --- a/toolchain/check/testdata/builtins/int/udiv.carbon +++ b/toolchain/check/testdata/builtins/int/udiv.carbon @@ -48,15 +48,11 @@ library "[[@TEST_NAME]]"; fn Div(a: i32, b: i32) -> i32 = "int.udiv"; -// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:14: error: division by zero [CompileTimeDivisionByZero] -// CHECK:STDERR: let a: i32 = Div(1, 0); -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+2]]:14-22: error: division by zero [CompileTimeDivisionByZero] // CHECK:STDERR: let a: i32 = Div(1, 0); -// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:14: error: division by zero [CompileTimeDivisionByZero] -// CHECK:STDERR: let b: i32 = Div(0, 0); -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+2]]:14-22: error: division by zero [CompileTimeDivisionByZero] // CHECK:STDERR: let b: i32 = Div(0, 0); diff --git a/toolchain/check/testdata/builtins/int/udiv_assign.carbon b/toolchain/check/testdata/builtins/int/udiv_assign.carbon index 6ee68b31f866..90ee7153fb4f 100644 --- a/toolchain/check/testdata/builtins/int/udiv_assign.carbon +++ b/toolchain/check/testdata/builtins/int/udiv_assign.carbon @@ -26,9 +26,7 @@ fn Call(ref a: i32, b: i32) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unsized.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.udiv_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.udiv_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.udiv_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.udiv_assign"; @@ -36,15 +34,11 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.udiv_assign"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.udiv_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.udiv_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.udiv_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.udiv_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.udiv_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.udiv_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.udiv_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.udiv_assign"; diff --git a/toolchain/check/testdata/builtins/int/umod.carbon b/toolchain/check/testdata/builtins/int/umod.carbon index 7dc75bb61c56..6dce3b5c7493 100644 --- a/toolchain/check/testdata/builtins/int/umod.carbon +++ b/toolchain/check/testdata/builtins/int/umod.carbon @@ -50,15 +50,11 @@ fn Mod(a: i32, b: i32) -> i32 = "int.umod"; // Remainder of division by zero is not defined. -// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:14: error: division by zero [CompileTimeDivisionByZero] -// CHECK:STDERR: let a: i32 = Mod(1, 0); -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+2]]:14-22: error: division by zero [CompileTimeDivisionByZero] // CHECK:STDERR: let a: i32 = Mod(1, 0); -// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:14: error: division by zero [CompileTimeDivisionByZero] -// CHECK:STDERR: let b: i32 = Mod(0, 0); -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+2]]:14-22: error: division by zero [CompileTimeDivisionByZero] // CHECK:STDERR: let b: i32 = Mod(0, 0); diff --git a/toolchain/check/testdata/builtins/int/umod_assign.carbon b/toolchain/check/testdata/builtins/int/umod_assign.carbon index 6c8a12a6da1d..20460006e66d 100644 --- a/toolchain/check/testdata/builtins/int/umod_assign.carbon +++ b/toolchain/check/testdata/builtins/int/umod_assign.carbon @@ -26,9 +26,7 @@ fn Call(ref a: i32, b: i32) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unsized.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.umod_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.umod_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.umod_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.umod_assign"; @@ -36,15 +34,11 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.umod_assign"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.umod_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.umod_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.umod_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.umod_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.umod_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.umod_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.umod_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.umod_assign"; diff --git a/toolchain/check/testdata/builtins/int/umul_assign.carbon b/toolchain/check/testdata/builtins/int/umul_assign.carbon index 2db2cae4d3ac..6262011257e5 100644 --- a/toolchain/check/testdata/builtins/int/umul_assign.carbon +++ b/toolchain/check/testdata/builtins/int/umul_assign.carbon @@ -26,9 +26,7 @@ fn Call(ref a: i32, b: i32) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unsized.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.umul_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.umul_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.umul_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.umul_assign"; @@ -36,15 +34,11 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.umul_assign"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.umul_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.umul_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.umul_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.umul_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.umul_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.umul_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.umul_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.umul_assign"; diff --git a/toolchain/check/testdata/builtins/int/unegate.carbon b/toolchain/check/testdata/builtins/int/unegate.carbon index 663e4703e057..87b5a677770a 100644 --- a/toolchain/check/testdata/builtins/int/unegate.carbon +++ b/toolchain/check/testdata/builtins/int/unegate.carbon @@ -31,15 +31,11 @@ fn RuntimeCallIsValid(a: u32, unused b: u32) -> u32 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_few.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.unegate" [InvalidBuiltinSignature] -// CHECK:STDERR: fn TooFew() -> u32 = "int.unegate"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:1-20: error: invalid signature for builtin function "int.unegate" [InvalidBuiltinSignature] // CHECK:STDERR: fn TooFew() -> u32 = "int.unegate"; -// CHECK:STDERR: fail_too_few.carbon:[[@LINE+4]]:25: error: array bound is not a constant [InvalidArrayExpr] -// CHECK:STDERR: var too_few: array(u32, TooFew()); -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:25-32: error: array bound is not a constant [InvalidArrayExpr] // CHECK:STDERR: var too_few: array(u32, TooFew()); @@ -51,15 +47,11 @@ fn RuntimeCallIsValidTooFew() -> u32 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_many.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.unegate" [InvalidBuiltinSignature] -// CHECK:STDERR: fn TooMany(a: u32, b: u32) -> u32 = "int.unegate"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.unegate" [InvalidBuiltinSignature] // CHECK:STDERR: fn TooMany(a: u32, b: u32) -> u32 = "int.unegate"; -// CHECK:STDERR: fail_too_many.carbon:[[@LINE+4]]:26: error: array bound is not a constant [InvalidArrayExpr] -// CHECK:STDERR: var too_many: array(u32, TooMany(1, 2)); -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:26-38: error: array bound is not a constant [InvalidArrayExpr] // CHECK:STDERR: var too_many: array(u32, TooMany(1, 2)); @@ -71,15 +63,11 @@ fn RuntimeCallIsValidTooMany(a: u32, b: u32) -> u32 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.unegate" [InvalidBuiltinSignature] -// CHECK:STDERR: fn BadReturnType(a: u32) -> bool = "int.unegate"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:1-34: error: invalid signature for builtin function "int.unegate" [InvalidBuiltinSignature] // CHECK:STDERR: fn BadReturnType(a: u32) -> bool = "int.unegate"; -// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+4]]:33: error: array bound is not a constant [InvalidArrayExpr] -// CHECK:STDERR: var bad_return_type: array(u32, BadReturnType(1)); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:33-48: error: array bound is not a constant [InvalidArrayExpr] // CHECK:STDERR: var bad_return_type: array(u32, BadReturnType(1)); @@ -93,12 +81,8 @@ library "[[@TEST_NAME]]"; fn Negate(a: u32) -> u32 = "int.unegate"; -// CHECK:STDERR: fail_bad_call.carbon:[[@LINE+7]]:26: error: 2 arguments passed to function expecting 1 argument [CallArgCountMismatch] -// CHECK:STDERR: var bad_call: array(u32, Negate(1, 2)); -// CHECK:STDERR: ^~~~~~~~~~~~ -// CHECK:STDERR: fail_bad_call.carbon:[[@LINE-5]]:1: note: calling function declared here [InCallToEntity] -// CHECK:STDERR: fn Negate(a: u32) -> u32 = "int.unegate"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_call.carbon:[[@LINE+3]]:26-37: error: 2 arguments passed to function expecting 1 argument [CallArgCountMismatch] +// CHECK:STDERR: fail_bad_call.carbon:[[@LINE-3]]:1-26: note: calling function declared here [InCallToEntity] // CHECK:STDERR: var bad_call: array(u32, Negate(1, 2)); diff --git a/toolchain/check/testdata/builtins/int/usub_assign.carbon b/toolchain/check/testdata/builtins/int/usub_assign.carbon index daffe46cb6c4..a02611e15e02 100644 --- a/toolchain/check/testdata/builtins/int/usub_assign.carbon +++ b/toolchain/check/testdata/builtins/int/usub_assign.carbon @@ -26,9 +26,7 @@ fn Call(ref a: i32, b: i32) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unsized.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.usub_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.usub_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.usub_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.usub_assign"; @@ -36,15 +34,11 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.usub_assign"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.usub_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.usub_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.usub_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.usub_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.usub_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.usub_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.usub_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.usub_assign"; diff --git a/toolchain/check/testdata/builtins/int/xor_assign.carbon b/toolchain/check/testdata/builtins/int/xor_assign.carbon index 5d61adfe74a3..ce36d50d0227 100644 --- a/toolchain/check/testdata/builtins/int/xor_assign.carbon +++ b/toolchain/check/testdata/builtins/int/xor_assign.carbon @@ -26,9 +26,7 @@ fn Call(ref a: i32, b: i32) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unsized.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.xor_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.xor_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.xor_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.xor_assign"; @@ -36,15 +34,11 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.xor_assign"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.xor_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.xor_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.xor_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.xor_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.xor_assign" [InvalidBuiltinSignature] -// CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.xor_assign"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.xor_assign" [InvalidBuiltinSignature] // CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.xor_assign"; diff --git a/toolchain/check/testdata/builtins/maybe_unformed/make_type.carbon b/toolchain/check/testdata/builtins/maybe_unformed/make_type.carbon index c2b30a979839..7cdf89be5680 100644 --- a/toolchain/check/testdata/builtins/maybe_unformed/make_type.carbon +++ b/toolchain/check/testdata/builtins/maybe_unformed/make_type.carbon @@ -41,15 +41,11 @@ let u: type = Make(t); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "maybe_unformed.make_type" [InvalidBuiltinSignature] -// CHECK:STDERR: fn NoParam() -> type = "maybe_unformed.make_type"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-22: error: invalid signature for builtin function "maybe_unformed.make_type" [InvalidBuiltinSignature] // CHECK:STDERR: fn NoParam() -> type = "maybe_unformed.make_type"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "maybe_unformed.make_type" [InvalidBuiltinSignature] -// CHECK:STDERR: fn ColonBangParam(generic T: type) -> type = "maybe_unformed.make_type"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-44: error: invalid signature for builtin function "maybe_unformed.make_type" [InvalidBuiltinSignature] // CHECK:STDERR: fn ColonBangParam(generic T: type) -> type = "maybe_unformed.make_type"; diff --git a/toolchain/check/testdata/builtins/no_op.carbon b/toolchain/check/testdata/builtins/no_op.carbon index 0c81453d78ed..8c41b61e37f1 100644 --- a/toolchain/check/testdata/builtins/no_op.carbon +++ b/toolchain/check/testdata/builtins/no_op.carbon @@ -60,9 +60,7 @@ var x: () = NoOp(); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_signature.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "no_op" [InvalidBuiltinSignature] -// CHECK:STDERR: fn NoOp() -> {} = "no_op"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_signature.carbon:[[@LINE+2]]:1-17: error: invalid signature for builtin function "no_op" [InvalidBuiltinSignature] // CHECK:STDERR: fn NoOp() -> {} = "no_op"; diff --git a/toolchain/check/testdata/builtins/pointer/is_null.carbon b/toolchain/check/testdata/builtins/pointer/is_null.carbon index 852570d3a936..d0880d9f30bb 100644 --- a/toolchain/check/testdata/builtins/pointer/is_null.carbon +++ b/toolchain/check/testdata/builtins/pointer/is_null.carbon @@ -55,33 +55,23 @@ library "[[@TEST_NAME]]"; fn MakeUnformed(t: type) -> type = "maybe_unformed.make_type"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "pointer.is_null" [InvalidBuiltinSignature] -// CHECK:STDERR: fn NoParam() -> bool = "pointer.is_null"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-22: error: invalid signature for builtin function "pointer.is_null" [InvalidBuiltinSignature] // CHECK:STDERR: fn NoParam() -> bool = "pointer.is_null"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "pointer.is_null" [InvalidBuiltinSignature] -// CHECK:STDERR: fn NoRetType(p: MakeUnformed({}*)) = "pointer.is_null"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-36: error: invalid signature for builtin function "pointer.is_null" [InvalidBuiltinSignature] // CHECK:STDERR: fn NoRetType(p: MakeUnformed({}*)) = "pointer.is_null"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "pointer.is_null" [InvalidBuiltinSignature] -// CHECK:STDERR: fn WrongRetType(p: MakeUnformed({}*)) -> {} = "pointer.is_null"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-45: error: invalid signature for builtin function "pointer.is_null" [InvalidBuiltinSignature] // CHECK:STDERR: fn WrongRetType(p: MakeUnformed({}*)) -> {} = "pointer.is_null"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "pointer.is_null" [InvalidBuiltinSignature] -// CHECK:STDERR: fn NoUnformed(p: {}*) -> bool = "pointer.is_null"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-31: error: invalid signature for builtin function "pointer.is_null" [InvalidBuiltinSignature] // CHECK:STDERR: fn NoUnformed(p: {}*) -> bool = "pointer.is_null"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "pointer.is_null" [InvalidBuiltinSignature] -// CHECK:STDERR: fn NotPointer(p: MakeUnformed({})) -> bool = "pointer.is_null"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-44: error: invalid signature for builtin function "pointer.is_null" [InvalidBuiltinSignature] // CHECK:STDERR: fn NotPointer(p: MakeUnformed({})) -> bool = "pointer.is_null"; diff --git a/toolchain/check/testdata/builtins/pointer/make_null.carbon b/toolchain/check/testdata/builtins/pointer/make_null.carbon index 097f8e8a2e4a..af18664f71e9 100644 --- a/toolchain/check/testdata/builtins/pointer/make_null.carbon +++ b/toolchain/check/testdata/builtins/pointer/make_null.carbon @@ -45,21 +45,15 @@ library "[[@TEST_NAME]]"; fn MakeUnformed(t: type) -> type = "maybe_unformed.make_type"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "pointer.make_null" [InvalidBuiltinSignature] -// CHECK:STDERR: fn NoRetType() = "pointer.make_null"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-16: error: invalid signature for builtin function "pointer.make_null" [InvalidBuiltinSignature] // CHECK:STDERR: fn NoRetType() = "pointer.make_null"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "pointer.make_null" [InvalidBuiltinSignature] -// CHECK:STDERR: fn NoUnformed() -> {}* = "pointer.make_null"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-24: error: invalid signature for builtin function "pointer.make_null" [InvalidBuiltinSignature] // CHECK:STDERR: fn NoUnformed() -> {}* = "pointer.make_null"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "pointer.make_null" [InvalidBuiltinSignature] -// CHECK:STDERR: fn NotPointer() -> MakeUnformed({}) = "pointer.make_null"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-37: error: invalid signature for builtin function "pointer.make_null" [InvalidBuiltinSignature] // CHECK:STDERR: fn NotPointer() -> MakeUnformed({}) = "pointer.make_null"; diff --git a/toolchain/check/testdata/builtins/type/and.carbon b/toolchain/check/testdata/builtins/type/and.carbon index 2dafa9d4c5ab..d8e883d5ad28 100644 --- a/toolchain/check/testdata/builtins/type/and.carbon +++ b/toolchain/check/testdata/builtins/type/and.carbon @@ -50,20 +50,12 @@ class JustJ { } fn Call() { - // CHECK:STDERR: fail_combine_facets_bad_call.carbon:[[@LINE+7]]:3: error: cannot convert type `JustI` into type implementing `I & J` [ConversionFailureTypeToFacet] - // CHECK:STDERR: TakeIJ(JustI); - // CHECK:STDERR: ^~~~~~~~~~~~~ - // CHECK:STDERR: fail_combine_facets_bad_call.carbon:[[@LINE-14]]:26: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn TakeIJ(unused generic T: TypeAnd(I, J)) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_combine_facets_bad_call.carbon:[[@LINE+3]]:3-15: error: cannot convert type `JustI` into type implementing `I & J` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_combine_facets_bad_call.carbon:[[@LINE-12]]:26-41: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: TakeIJ(JustI); - // CHECK:STDERR: fail_combine_facets_bad_call.carbon:[[@LINE+7]]:3: error: cannot convert type `JustJ` into type implementing `I & J` [ConversionFailureTypeToFacet] - // CHECK:STDERR: TakeIJ(JustJ); - // CHECK:STDERR: ^~~~~~~~~~~~~ - // CHECK:STDERR: fail_combine_facets_bad_call.carbon:[[@LINE-22]]:26: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn TakeIJ(unused generic T: TypeAnd(I, J)) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_combine_facets_bad_call.carbon:[[@LINE+3]]:3-15: error: cannot convert type `JustJ` into type implementing `I & J` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_combine_facets_bad_call.carbon:[[@LINE-16]]:26-41: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: TakeIJ(JustJ); } @@ -72,32 +64,22 @@ fn Call() { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "type.and" [InvalidBuiltinSignature] -// CHECK:STDERR: fn TooFew(a: type) -> type = "type.and"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-28: error: invalid signature for builtin function "type.and" [InvalidBuiltinSignature] // CHECK:STDERR: fn TooFew(a: type) -> type = "type.and"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "type.and" [InvalidBuiltinSignature] -// CHECK:STDERR: fn TooMany(a: type, b: type, c: type) -> type = "type.and"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-47: error: invalid signature for builtin function "type.and" [InvalidBuiltinSignature] // CHECK:STDERR: fn TooMany(a: type, b: type, c: type) -> type = "type.and"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "type.and" [InvalidBuiltinSignature] -// CHECK:STDERR: fn ParamNotType(a: {}, b: {}) -> type = "type.and"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-39: error: invalid signature for builtin function "type.and" [InvalidBuiltinSignature] // CHECK:STDERR: fn ParamNotType(a: {}, b: {}) -> type = "type.and"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "type.and" [InvalidBuiltinSignature] -// CHECK:STDERR: fn ResultNotType(a: type, b: type) -> {} = "type.and"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-42: error: invalid signature for builtin function "type.and" [InvalidBuiltinSignature] // CHECK:STDERR: fn ResultNotType(a: type, b: type) -> {} = "type.and"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "type.and" [InvalidBuiltinSignature] -// CHECK:STDERR: fn ResultNotSpecified(a: type, b: type) = "type.and"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-41: error: invalid signature for builtin function "type.and" [InvalidBuiltinSignature] // CHECK:STDERR: fn ResultNotSpecified(a: type, b: type) = "type.and"; diff --git a/toolchain/check/testdata/choice/basic.carbon b/toolchain/check/testdata/choice/basic.carbon index 79b95fa5a7d7..8ab3931ddcdb 100644 --- a/toolchain/check/testdata/choice/basic.carbon +++ b/toolchain/check/testdata/choice/basic.carbon @@ -66,9 +66,7 @@ library "[[@TEST_NAME]]"; choice Never {} // TODO: Can we produce a better diagnostic? -// CHECK:STDERR: fail_no_alternative_construct.carbon:[[@LINE+4]]:20: error: missing value for field `discriminant` in struct initialization [StructInitMissingFieldInLiteral] -// CHECK:STDERR: let never: Never = {}; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_no_alternative_construct.carbon:[[@LINE+2]]:20-21: error: missing value for field `discriminant` in struct initialization [StructInitMissingFieldInLiteral] // CHECK:STDERR: let never: Never = {}; diff --git a/toolchain/check/testdata/choice/params.carbon b/toolchain/check/testdata/choice/params.carbon index 7c9f92770445..2f0bae6e055a 100644 --- a/toolchain/check/testdata/choice/params.carbon +++ b/toolchain/check/testdata/choice/params.carbon @@ -14,9 +14,7 @@ library "[[@TEST_NAME]]"; choice Always { - // CHECK:STDERR: fail_todo_empty_params.carbon:[[@LINE+4]]:8: error: semantics TODO: `empty parameter list should make a member function` [SemanticsTodo] - // CHECK:STDERR: Sunny() - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_todo_empty_params.carbon:[[@LINE+2]]:8-9: error: semantics TODO: `empty parameter list should make a member function` [SemanticsTodo] // CHECK:STDERR: Sunny() } @@ -28,9 +26,7 @@ library "[[@TEST_NAME]]"; choice C { Alt1, - // CHECK:STDERR: fail_todo_params.carbon:[[@LINE+4]]:7: error: semantics TODO: `choice alternatives with parameters are not yet supported` [SemanticsTodo] - // CHECK:STDERR: Alt2(a: i32, b: i64), - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_params.carbon:[[@LINE+2]]:7-22: error: semantics TODO: `choice alternatives with parameters are not yet supported` [SemanticsTodo] // CHECK:STDERR: Alt2(a: i32, b: i64), Alt3, @@ -40,9 +36,7 @@ choice C { library "[[@TEST_NAME]]"; choice C(T: type) { - // CHECK:STDERR: fail_todo_generic_params.carbon:[[@LINE+4]]:6: error: semantics TODO: `choice alternatives with parameters are not yet supported` [SemanticsTodo] - // CHECK:STDERR: Alt(a: T) - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_todo_generic_params.carbon:[[@LINE+2]]:6-11: error: semantics TODO: `choice alternatives with parameters are not yet supported` [SemanticsTodo] // CHECK:STDERR: Alt(a: T) } @@ -51,9 +45,7 @@ choice C(T: type) { library "[[@TEST_NAME]]"; choice C { - // CHECK:STDERR: fail_todo_self_param.carbon:[[@LINE+4]]:6: error: semantics TODO: `choice alternatives with parameters are not yet supported` [SemanticsTodo] - // CHECK:STDERR: Alt(a: Self*) - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_todo_self_param.carbon:[[@LINE+2]]:6-15: error: semantics TODO: `choice alternatives with parameters are not yet supported` [SemanticsTodo] // CHECK:STDERR: Alt(a: Self*) } diff --git a/toolchain/check/testdata/class/abstract/abstract.carbon b/toolchain/check/testdata/class/abstract/abstract.carbon index 060c9c1a35ce..6607f4f89a96 100644 --- a/toolchain/check/testdata/class/abstract/abstract.carbon +++ b/toolchain/check/testdata/class/abstract/abstract.carbon @@ -19,12 +19,8 @@ abstract class Abstract { } class Contains { - // CHECK:STDERR: fail_abstract_field.carbon:[[@LINE+7]]:10: error: binding pattern has abstract type `Abstract` in `var` pattern [AbstractTypeInVarPattern] - // CHECK:STDERR: var a: Abstract; - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_abstract_field.carbon:[[@LINE-7]]:1: note: class was declared abstract here [ClassAbstractHere] - // CHECK:STDERR: abstract class Abstract { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_abstract_field.carbon:[[@LINE+3]]:10-17: error: binding pattern has abstract type `Abstract` in `var` pattern [AbstractTypeInVarPattern] + // CHECK:STDERR: fail_abstract_field.carbon:[[@LINE-5]]:1-25: note: class was declared abstract here [ClassAbstractHere] // CHECK:STDERR: var a: Abstract; } @@ -36,12 +32,8 @@ abstract class Abstract { } fn Var() { - // CHECK:STDERR: fail_abstract_var.carbon:[[@LINE+7]]:17: error: binding pattern has abstract type `Abstract` in `var` pattern [AbstractTypeInVarPattern] - // CHECK:STDERR: var unused v: Abstract; - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_abstract_var.carbon:[[@LINE-7]]:1: note: class was declared abstract here [ClassAbstractHere] - // CHECK:STDERR: abstract class Abstract { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_abstract_var.carbon:[[@LINE+3]]:17-24: error: binding pattern has abstract type `Abstract` in `var` pattern [AbstractTypeInVarPattern] + // CHECK:STDERR: fail_abstract_var.carbon:[[@LINE-5]]:1-25: note: class was declared abstract here [ClassAbstractHere] // CHECK:STDERR: var unused v: Abstract; } @@ -52,12 +44,8 @@ library "[[@TEST_NAME]]"; abstract class Abstract { } -// CHECK:STDERR: fail_abstract_var_function_param.carbon:[[@LINE+7]]:13: error: binding pattern has abstract type `Abstract` in `var` pattern [AbstractTypeInVarPattern] -// CHECK:STDERR: fn F(var _: Abstract) { -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_abstract_var_function_param.carbon:[[@LINE-6]]:1: note: class was declared abstract here [ClassAbstractHere] -// CHECK:STDERR: abstract class Abstract { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_abstract_var_function_param.carbon:[[@LINE+3]]:13-20: error: binding pattern has abstract type `Abstract` in `var` pattern [AbstractTypeInVarPattern] +// CHECK:STDERR: fail_abstract_var_function_param.carbon:[[@LINE-4]]:1-25: note: class was declared abstract here [ClassAbstractHere] // CHECK:STDERR: fn F(var _: Abstract) { } @@ -80,12 +68,8 @@ abstract class Abstract { class Adapter { // TODO(#4387): This should probably be valid - // CHECK:STDERR: fail_abstract_adapter.carbon:[[@LINE+7]]:3: error: adapted type `Abstract` is an abstract type [AbstractTypeInAdaptDecl] - // CHECK:STDERR: adapt Abstract; - // CHECK:STDERR: ^~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_abstract_adapter.carbon:[[@LINE-8]]:1: note: class was declared abstract here [ClassAbstractHere] - // CHECK:STDERR: abstract class Abstract { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_abstract_adapter.carbon:[[@LINE+3]]:3-17: error: adapted type `Abstract` is an abstract type [AbstractTypeInAdaptDecl] + // CHECK:STDERR: fail_abstract_adapter.carbon:[[@LINE-6]]:1-25: note: class was declared abstract here [ClassAbstractHere] // CHECK:STDERR: adapt Abstract; } @@ -130,12 +114,8 @@ class Derived { var d: {}; } -// CHECK:STDERR: fail_return_abstract.carbon:[[@LINE+7]]:24: error: function returns abstract type `Abstract` [AbstractTypeInFunctionReturnType] -// CHECK:STDERR: fn Return(a: Abstract) -> Abstract { -// CHECK:STDERR: ^~~~~~~~~~~ -// CHECK:STDERR: fail_return_abstract.carbon:[[@LINE-12]]:1: note: class was declared abstract here [ClassAbstractHere] -// CHECK:STDERR: abstract class Abstract { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_return_abstract.carbon:[[@LINE+3]]:24-34: error: function returns abstract type `Abstract` [AbstractTypeInFunctionReturnType] +// CHECK:STDERR: fail_return_abstract.carbon:[[@LINE-10]]:1-25: note: class was declared abstract here [ClassAbstractHere] // CHECK:STDERR: fn Return(a: Abstract) -> Abstract { return a; @@ -169,13 +149,9 @@ abstract class Abstract { } fn F() { - // CHECK:STDERR: fail_abstract_let_temporary_struct_literal.carbon:[[@LINE+8]]:28: error: initialization of abstract class `Abstract` [AbstractTypeInInit] - // CHECK:STDERR: let unused l: Abstract = {}; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_abstract_let_temporary_struct_literal.carbon:[[@LINE+4]]:28-29: error: initialization of abstract class `Abstract` [AbstractTypeInInit] // CHECK:STDERR: - // CHECK:STDERR: fail_abstract_let_temporary_struct_literal.carbon:[[@LINE+4]]:28: error: cannot access member of interface `Core.Destroy` in type `Abstract` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let unused l: Abstract = {}; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_abstract_let_temporary_struct_literal.carbon:[[@LINE+2]]:28-29: error: cannot access member of interface `Core.Destroy` in type `Abstract` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let unused l: Abstract = {}; } @@ -193,9 +169,7 @@ class Derived { fn F() { // TODO: support destroying classes that derive from abstract types. // - // CHECK:STDERR: fail_todo_abstract_let_temporary.carbon:[[@LINE+4]]:28: error: cannot access member of interface `Core.Destroy` in type `Derived` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let unused l: Abstract = {.base = {}} as Derived; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_abstract_let_temporary.carbon:[[@LINE+2]]:28-50: error: cannot access member of interface `Core.Destroy` in type `Derived` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let unused l: Abstract = {.base = {}} as Derived; } @@ -209,15 +183,9 @@ abstract class Abstract { fn ReturnAbstract() -> Abstract; fn CallReturnAbstract() { - // CHECK:STDERR: fail_call_abstract_return.carbon:[[@LINE+10]]:3: error: function returns abstract type `Abstract` [AbstractTypeInFunctionReturnType] - // CHECK:STDERR: ReturnAbstract(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_call_abstract_return.carbon:[[@LINE-9]]:1: note: class was declared abstract here [ClassAbstractHere] - // CHECK:STDERR: abstract class Abstract { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_call_abstract_return.carbon:[[@LINE-9]]:21: note: return type declared here [IncompleteReturnTypeHere] - // CHECK:STDERR: fn ReturnAbstract() -> Abstract; - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_call_abstract_return.carbon:[[@LINE+4]]:3-18: error: function returns abstract type `Abstract` [AbstractTypeInFunctionReturnType] + // CHECK:STDERR: fail_call_abstract_return.carbon:[[@LINE-7]]:1-25: note: class was declared abstract here [ClassAbstractHere] + // CHECK:STDERR: fail_call_abstract_return.carbon:[[@LINE-5]]:21-31: note: return type declared here [IncompleteReturnTypeHere] // CHECK:STDERR: ReturnAbstract(); } @@ -229,12 +197,8 @@ abstract class Abstract { } fn Assign(ref a: Abstract) { - // CHECK:STDERR: fail_assign_to_abstract_ref.carbon:[[@LINE+7]]:7: error: cannot copy value of type `Abstract` [CopyOfUncopyableType] - // CHECK:STDERR: a = a; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_assign_to_abstract_ref.carbon:[[@LINE+4]]:7: note: type `Abstract` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: a = a; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_assign_to_abstract_ref.carbon:[[@LINE+3]]:7: error: cannot copy value of type `Abstract` [CopyOfUncopyableType] + // CHECK:STDERR: fail_assign_to_abstract_ref.carbon:[[@LINE+2]]:7: note: type `Abstract` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: a = a; } @@ -710,12 +674,12 @@ fn Assign(ref a: Abstract) { // CHECK:STDOUT: %a.param_patt: %pattern_type.169 = value_param_pattern [concrete = constants.%a.param_patt] // CHECK:STDOUT: %a.patt: %pattern_type.169 = wrapper_binding_pattern a, %a.param_patt [concrete = constants.%a.patt] // CHECK:STDOUT: %return.param_patt: %pattern_type.169 = out_param_pattern [concrete = constants.%return.param_patt] -// CHECK:STDOUT: %return.patt: %pattern_type.169 = return_slot_pattern %return.param_patt, %Abstract.ref.loc19_27 [concrete = constants.%return.patt] +// CHECK:STDOUT: %return.patt: %pattern_type.169 = return_slot_pattern %return.param_patt, %Abstract.ref.loc15_27 [concrete = constants.%return.patt] // CHECK:STDOUT: } { -// CHECK:STDOUT: %Abstract.ref.loc19_27: type = name_ref Abstract, file.%Abstract.decl [concrete = constants.%Abstract] -// CHECK:STDOUT: %.loc19: Core.Form = init_form %Abstract.ref.loc19_27 [concrete = constants.%.749] +// CHECK:STDOUT: %Abstract.ref.loc15_27: type = name_ref Abstract, file.%Abstract.decl [concrete = constants.%Abstract] +// CHECK:STDOUT: %.loc15: Core.Form = init_form %Abstract.ref.loc15_27 [concrete = constants.%.749] // CHECK:STDOUT: %a.param: %Abstract = value_param call_param0 -// CHECK:STDOUT: %Abstract.ref.loc19_14: type = name_ref Abstract, file.%Abstract.decl [concrete = constants.%Abstract] +// CHECK:STDOUT: %Abstract.ref.loc15_14: type = name_ref Abstract, file.%Abstract.decl [concrete = constants.%Abstract] // CHECK:STDOUT: %a: %Abstract = wrapper_binding a, %a.param // CHECK:STDOUT: %return.param: ref %Abstract = out_param call_param1 // CHECK:STDOUT: %return: ref %Abstract = return_slot %return.param @@ -938,14 +902,14 @@ fn Assign(ref a: Abstract) { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_29.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc15_29.2: ref %Abstract = temporary_storage -// CHECK:STDOUT: %.loc15_29.3: init %Abstract to %.loc15_29.2 = class_init () [concrete = constants.%Abstract.val] -// CHECK:STDOUT: %.loc15_29.4: init %Abstract = converted %.loc15_29.1, %.loc15_29.3 [concrete = constants.%Abstract.val] -// CHECK:STDOUT: %.loc15_29.5: ref %Abstract = temporary %.loc15_29.2, %.loc15_29.4 [concrete = constants.%.69a] -// CHECK:STDOUT: %.loc15_29.6: %Abstract = acquire_value %.loc15_29.5 [concrete = constants.%Abstract.val] +// CHECK:STDOUT: %.loc11_29.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc11_29.2: ref %Abstract = temporary_storage +// CHECK:STDOUT: %.loc11_29.3: init %Abstract to %.loc11_29.2 = class_init () [concrete = constants.%Abstract.val] +// CHECK:STDOUT: %.loc11_29.4: init %Abstract = converted %.loc11_29.1, %.loc11_29.3 [concrete = constants.%Abstract.val] +// CHECK:STDOUT: %.loc11_29.5: ref %Abstract = temporary %.loc11_29.2, %.loc11_29.4 [concrete = constants.%.69a] +// CHECK:STDOUT: %.loc11_29.6: %Abstract = acquire_value %.loc11_29.5 [concrete = constants.%Abstract.val] // CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, file.%Abstract.decl [concrete = constants.%Abstract] -// CHECK:STDOUT: %l: %Abstract = wrapper_binding l, %.loc15_29.6 +// CHECK:STDOUT: %l: %Abstract = wrapper_binding l, %.loc11_29.6 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %l.patt: %pattern_type.169 = value_binding_pattern l [concrete = constants.%l.patt] // CHECK:STDOUT: } @@ -1024,22 +988,22 @@ fn Assign(ref a: Abstract) { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc17_38.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct.a40] -// CHECK:STDOUT: %.loc17_39.1: %struct_type.base.f5e = struct_literal (%.loc17_38.1) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc15_38.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct.a40] +// CHECK:STDOUT: %.loc15_39.1: %struct_type.base.f5e = struct_literal (%.loc15_38.1) [concrete = constants.%struct] // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl [concrete = constants.%Derived] -// CHECK:STDOUT: %.loc17_39.2: ref %Derived = temporary_storage -// CHECK:STDOUT: %.loc17_39.3: ref %.79f = class_element_access %.loc17_39.2, element0 -// CHECK:STDOUT: %.loc17_38.2: init %.79f to %.loc17_39.3 = class_init () [concrete = constants.%empty_struct.5e0] -// CHECK:STDOUT: %.loc17_39.4: init %.79f = converted %.loc17_38.1, %.loc17_38.2 [concrete = constants.%empty_struct.5e0] -// CHECK:STDOUT: %.loc17_39.5: init %Abstract = as_compatible %.loc17_39.4 [concrete = constants.%Abstract.val] -// CHECK:STDOUT: %.loc17_39.6: init %Derived to %.loc17_39.2 = class_init (%.loc17_39.5) [concrete = constants.%Derived.val] -// CHECK:STDOUT: %.loc17_41.1: init %Derived = converted %.loc17_39.1, %.loc17_39.6 [concrete = constants.%Derived.val] -// CHECK:STDOUT: %.loc17_41.2: ref %Derived = temporary %.loc17_39.2, %.loc17_41.1 [concrete = constants.%.521] -// CHECK:STDOUT: %.loc17_41.3: ref %Abstract = class_element_access %.loc17_41.2, element0 [concrete = constants.%.5d3] -// CHECK:STDOUT: %.loc17_41.4: ref %Abstract = converted %.loc17_41.1, %.loc17_41.3 [concrete = constants.%.5d3] -// CHECK:STDOUT: %.loc17_41.5: %Abstract = acquire_value %.loc17_41.4 +// CHECK:STDOUT: %.loc15_39.2: ref %Derived = temporary_storage +// CHECK:STDOUT: %.loc15_39.3: ref %.79f = class_element_access %.loc15_39.2, element0 +// CHECK:STDOUT: %.loc15_38.2: init %.79f to %.loc15_39.3 = class_init () [concrete = constants.%empty_struct.5e0] +// CHECK:STDOUT: %.loc15_39.4: init %.79f = converted %.loc15_38.1, %.loc15_38.2 [concrete = constants.%empty_struct.5e0] +// CHECK:STDOUT: %.loc15_39.5: init %Abstract = as_compatible %.loc15_39.4 [concrete = constants.%Abstract.val] +// CHECK:STDOUT: %.loc15_39.6: init %Derived to %.loc15_39.2 = class_init (%.loc15_39.5) [concrete = constants.%Derived.val] +// CHECK:STDOUT: %.loc15_41.1: init %Derived = converted %.loc15_39.1, %.loc15_39.6 [concrete = constants.%Derived.val] +// CHECK:STDOUT: %.loc15_41.2: ref %Derived = temporary %.loc15_39.2, %.loc15_41.1 [concrete = constants.%.521] +// CHECK:STDOUT: %.loc15_41.3: ref %Abstract = class_element_access %.loc15_41.2, element0 [concrete = constants.%.5d3] +// CHECK:STDOUT: %.loc15_41.4: ref %Abstract = converted %.loc15_41.1, %.loc15_41.3 [concrete = constants.%.5d3] +// CHECK:STDOUT: %.loc15_41.5: %Abstract = acquire_value %.loc15_41.4 // CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, file.%Abstract.decl [concrete = constants.%Abstract] -// CHECK:STDOUT: %l: %Abstract = wrapper_binding l, %.loc17_41.5 +// CHECK:STDOUT: %l: %Abstract = wrapper_binding l, %.loc15_41.5 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %l.patt: %pattern_type.169 = value_binding_pattern l [concrete = constants.%l.patt] // CHECK:STDOUT: } @@ -1160,10 +1124,10 @@ fn Assign(ref a: Abstract) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Assign(%a.param: ref %Abstract) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %a.ref.loc14_3: ref %Abstract = name_ref a, %a -// CHECK:STDOUT: %a.ref.loc14_7: ref %Abstract = name_ref a, %a -// CHECK:STDOUT: %.loc14: %Abstract = acquire_value %a.ref.loc14_7 -// CHECK:STDOUT: assign %a.ref.loc14_3, +// CHECK:STDOUT: %a.ref.loc10_3: ref %Abstract = name_ref a, %a +// CHECK:STDOUT: %a.ref.loc10_7: ref %Abstract = name_ref a, %a +// CHECK:STDOUT: %.loc10: %Abstract = acquire_value %a.ref.loc10_7 +// CHECK:STDOUT: assign %a.ref.loc10_3, // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/abstract/fail_abstract_in_struct.carbon b/toolchain/check/testdata/class/abstract/fail_abstract_in_struct.carbon index 0677d1879b5f..3717a84ae6b5 100644 --- a/toolchain/check/testdata/class/abstract/fail_abstract_in_struct.carbon +++ b/toolchain/check/testdata/class/abstract/fail_abstract_in_struct.carbon @@ -18,12 +18,8 @@ library "[[@TEST_NAME]]"; abstract class Abstract1 {} class Contains { - // CHECK:STDERR: fail_abstract_field.carbon:[[@LINE+7]]:10: error: binding pattern has abstract type `{.m1: Abstract1}` in `var` pattern [AbstractTypeInVarPattern] - // CHECK:STDERR: var a: {.m1: Abstract1}; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_abstract_field.carbon:[[@LINE-6]]:1: note: uses class that was declared abstract here [ClassAbstractHere] - // CHECK:STDERR: abstract class Abstract1 {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_abstract_field.carbon:[[@LINE+3]]:10-25: error: binding pattern has abstract type `{.m1: Abstract1}` in `var` pattern [AbstractTypeInVarPattern] + // CHECK:STDERR: fail_abstract_field.carbon:[[@LINE-4]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere] // CHECK:STDERR: var a: {.m1: Abstract1}; } @@ -33,12 +29,8 @@ library "[[@TEST_NAME]]"; abstract class Abstract2 {} -// CHECK:STDERR: fail_abstract_var.carbon:[[@LINE+7]]:8: error: binding pattern has abstract type `{.m2: Abstract2}` in `var` pattern [AbstractTypeInVarPattern] -// CHECK:STDERR: var v: {.m2: Abstract2}; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_abstract_var.carbon:[[@LINE-5]]:1: note: uses class that was declared abstract here [ClassAbstractHere] -// CHECK:STDERR: abstract class Abstract2 {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_abstract_var.carbon:[[@LINE+3]]:8-23: error: binding pattern has abstract type `{.m2: Abstract2}` in `var` pattern [AbstractTypeInVarPattern] +// CHECK:STDERR: fail_abstract_var.carbon:[[@LINE-3]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere] // CHECK:STDERR: var v: {.m2: Abstract2}; @@ -58,12 +50,8 @@ library "[[@TEST_NAME]]"; abstract class Abstract4 {} abstract class Abstract5 {} -// CHECK:STDERR: fail_abstract_twice.carbon:[[@LINE+7]]:9: error: binding pattern has abstract type `{.m4: Abstract4, .m5: Abstract5}` in `var` pattern [AbstractTypeInVarPattern] -// CHECK:STDERR: var v2: {.m4: Abstract4, .m5: Abstract5}; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_abstract_twice.carbon:[[@LINE-6]]:1: note: uses class that was declared abstract here [ClassAbstractHere] -// CHECK:STDERR: abstract class Abstract4 {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_abstract_twice.carbon:[[@LINE+3]]:9-40: error: binding pattern has abstract type `{.m4: Abstract4, .m5: Abstract5}` in `var` pattern [AbstractTypeInVarPattern] +// CHECK:STDERR: fail_abstract_twice.carbon:[[@LINE-4]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere] // CHECK:STDERR: var v2: {.m4: Abstract4, .m5: Abstract5}; @@ -72,12 +60,8 @@ library "[[@TEST_NAME]]"; abstract class Abstract6 {} -// CHECK:STDERR: fail_abstract_first.carbon:[[@LINE+7]]:9: error: binding pattern has abstract type `{.m6: Abstract6, .c1: ()}` in `var` pattern [AbstractTypeInVarPattern] -// CHECK:STDERR: var v3: {.m6: Abstract6, .c1: ()}; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_abstract_first.carbon:[[@LINE-5]]:1: note: uses class that was declared abstract here [ClassAbstractHere] -// CHECK:STDERR: abstract class Abstract6 {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_abstract_first.carbon:[[@LINE+3]]:9-33: error: binding pattern has abstract type `{.m6: Abstract6, .c1: ()}` in `var` pattern [AbstractTypeInVarPattern] +// CHECK:STDERR: fail_abstract_first.carbon:[[@LINE-3]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere] // CHECK:STDERR: var v3: {.m6: Abstract6, .c1: ()}; @@ -86,12 +70,8 @@ library "[[@TEST_NAME]]"; abstract class Abstract7 {} -// CHECK:STDERR: fail_abstract_second.carbon:[[@LINE+7]]:9: error: binding pattern has abstract type `{.c2: (), .m7: Abstract7}` in `var` pattern [AbstractTypeInVarPattern] -// CHECK:STDERR: var v4: {.c2: (), .m7: Abstract7}; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_abstract_second.carbon:[[@LINE-5]]:1: note: uses class that was declared abstract here [ClassAbstractHere] -// CHECK:STDERR: abstract class Abstract7 {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_abstract_second.carbon:[[@LINE+3]]:9-33: error: binding pattern has abstract type `{.c2: (), .m7: Abstract7}` in `var` pattern [AbstractTypeInVarPattern] +// CHECK:STDERR: fail_abstract_second.carbon:[[@LINE-3]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere] // CHECK:STDERR: var v4: {.c2: (), .m7: Abstract7}; @@ -105,13 +85,9 @@ library "[[@TEST_NAME]]"; import library "lib"; -// CHECK:STDERR: fail_import.carbon:[[@LINE+8]]:9: error: binding pattern has abstract type `{.m: Abstract}` in `var` pattern [AbstractTypeInVarPattern] -// CHECK:STDERR: var v5: {.m: Abstract}; -// CHECK:STDERR: ^~~~~~~~~~~~~~ -// CHECK:STDERR: fail_import.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: lib.carbon:3:1: note: uses class that was declared abstract here [ClassAbstractHere] -// CHECK:STDERR: abstract class Abstract {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_import.carbon:[[@LINE+4]]:9-22: error: binding pattern has abstract type `{.m: Abstract}` in `var` pattern [AbstractTypeInVarPattern] +// CHECK:STDERR: imported from: fail_import.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: lib.carbon:3:1-25: note: uses class that was declared abstract here [ClassAbstractHere] // CHECK:STDERR: var v5: {.m: Abstract}; @@ -174,7 +150,7 @@ var v5: {.m: Abstract}; // CHECK:STDOUT: } // CHECK:STDOUT: %Abstract2.decl: type = class_decl @Abstract2 [concrete = constants.%Abstract2] {} {} // CHECK:STDOUT: %v.var: ref = var_storage %v.var_patt [concrete = ] -// CHECK:STDOUT: %.loc12: type = splice_block %struct_type.m2 [concrete = constants.%struct_type.m2.bb3] { +// CHECK:STDOUT: %.loc8: type = splice_block %struct_type.m2 [concrete = constants.%struct_type.m2.bb3] { // CHECK:STDOUT: %Abstract2.ref: type = name_ref Abstract2, %Abstract2.decl [concrete = constants.%Abstract2] // CHECK:STDOUT: %struct_type.m2: type = struct_type {.m2: %Abstract2} [concrete = constants.%struct_type.m2.bb3] // CHECK:STDOUT: } @@ -277,7 +253,7 @@ var v5: {.m: Abstract}; // CHECK:STDOUT: %Abstract4.decl: type = class_decl @Abstract4 [concrete = constants.%Abstract4] {} {} // CHECK:STDOUT: %Abstract5.decl: type = class_decl @Abstract5 [concrete = constants.%Abstract5] {} {} // CHECK:STDOUT: %v2.var: ref = var_storage %v2.var_patt [concrete = ] -// CHECK:STDOUT: %.loc13: type = splice_block %struct_type.m4.m5 [concrete = constants.%struct_type.m4.m5.5e1] { +// CHECK:STDOUT: %.loc9: type = splice_block %struct_type.m4.m5 [concrete = constants.%struct_type.m4.m5.5e1] { // CHECK:STDOUT: %Abstract4.ref: type = name_ref Abstract4, %Abstract4.decl [concrete = constants.%Abstract4] // CHECK:STDOUT: %Abstract5.ref: type = name_ref Abstract5, %Abstract5.decl [concrete = constants.%Abstract5] // CHECK:STDOUT: %struct_type.m4.m5: type = struct_type {.m4: %Abstract4, .m5: %Abstract5} [concrete = constants.%struct_type.m4.m5.5e1] @@ -330,10 +306,10 @@ var v5: {.m: Abstract}; // CHECK:STDOUT: } // CHECK:STDOUT: %Abstract6.decl: type = class_decl @Abstract6 [concrete = constants.%Abstract6] {} {} // CHECK:STDOUT: %v3.var: ref = var_storage %v3.var_patt [concrete = ] -// CHECK:STDOUT: %.loc12_33: type = splice_block %struct_type.m6.c1 [concrete = constants.%struct_type.m6.c1.a63] { +// CHECK:STDOUT: %.loc8_33: type = splice_block %struct_type.m6.c1 [concrete = constants.%struct_type.m6.c1.a63] { // CHECK:STDOUT: %Abstract6.ref: type = name_ref Abstract6, %Abstract6.decl [concrete = constants.%Abstract6] -// CHECK:STDOUT: %.loc12_32.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc12_32.2: type = converted %.loc12_32.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc8_32.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_32.2: type = converted %.loc8_32.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %struct_type.m6.c1: type = struct_type {.m6: %Abstract6, .c1: %empty_tuple.type} [concrete = constants.%struct_type.m6.c1.a63] // CHECK:STDOUT: } // CHECK:STDOUT: %v3: = wrapper_binding v3, [concrete = ] @@ -376,9 +352,9 @@ var v5: {.m: Abstract}; // CHECK:STDOUT: } // CHECK:STDOUT: %Abstract7.decl: type = class_decl @Abstract7 [concrete = constants.%Abstract7] {} {} // CHECK:STDOUT: %v4.var: ref = var_storage %v4.var_patt [concrete = ] -// CHECK:STDOUT: %.loc12_33: type = splice_block %struct_type.c2.m7 [concrete = constants.%struct_type.c2.m7.518] { -// CHECK:STDOUT: %.loc12_16.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc12_16.2: type = converted %.loc12_16.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc8_33: type = splice_block %struct_type.c2.m7 [concrete = constants.%struct_type.c2.m7.518] { +// CHECK:STDOUT: %.loc8_16.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_16.2: type = converted %.loc8_16.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %Abstract7.ref: type = name_ref Abstract7, %Abstract7.decl [concrete = constants.%Abstract7] // CHECK:STDOUT: %struct_type.c2.m7: type = struct_type {.c2: %empty_tuple.type, .m7: %Abstract7} [concrete = constants.%struct_type.c2.m7.518] // CHECK:STDOUT: } @@ -450,7 +426,7 @@ var v5: {.m: Abstract}; // CHECK:STDOUT: } // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %v5.var: ref = var_storage %v5.var_patt [concrete = ] -// CHECK:STDOUT: %.loc13: type = splice_block %struct_type.m [concrete = constants.%struct_type.m.b92] { +// CHECK:STDOUT: %.loc9: type = splice_block %struct_type.m [concrete = constants.%struct_type.m.b92] { // CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, imports.%Main.Abstract [concrete = constants.%Abstract] // CHECK:STDOUT: %struct_type.m: type = struct_type {.m: %Abstract} [concrete = constants.%struct_type.m.b92] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/abstract/fail_abstract_in_tuple.carbon b/toolchain/check/testdata/class/abstract/fail_abstract_in_tuple.carbon index a7f9429920ab..2e56736411c0 100644 --- a/toolchain/check/testdata/class/abstract/fail_abstract_in_tuple.carbon +++ b/toolchain/check/testdata/class/abstract/fail_abstract_in_tuple.carbon @@ -18,12 +18,8 @@ library "[[@TEST_NAME]]"; abstract class Abstract1 {} class Contains { - // CHECK:STDERR: fail_abstract_field.carbon:[[@LINE+7]]:10: error: binding pattern has abstract type `(Abstract1,)` in `var` pattern [AbstractTypeInVarPattern] - // CHECK:STDERR: var a: (Abstract1,); - // CHECK:STDERR: ^~~~~~~~~~~~ - // CHECK:STDERR: fail_abstract_field.carbon:[[@LINE-6]]:1: note: uses class that was declared abstract here [ClassAbstractHere] - // CHECK:STDERR: abstract class Abstract1 {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_abstract_field.carbon:[[@LINE+3]]:10-21: error: binding pattern has abstract type `(Abstract1,)` in `var` pattern [AbstractTypeInVarPattern] + // CHECK:STDERR: fail_abstract_field.carbon:[[@LINE-4]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere] // CHECK:STDERR: var a: (Abstract1,); } @@ -34,12 +30,8 @@ library "[[@TEST_NAME]]"; abstract class Abstract2 {} fn Var() { - // CHECK:STDERR: fail_abstract_var.carbon:[[@LINE+7]]:17: error: binding pattern has abstract type `(Abstract2,)` in `var` pattern [AbstractTypeInVarPattern] - // CHECK:STDERR: var unused v: (Abstract2,); - // CHECK:STDERR: ^~~~~~~~~~~~ - // CHECK:STDERR: fail_abstract_var.carbon:[[@LINE-6]]:1: note: uses class that was declared abstract here [ClassAbstractHere] - // CHECK:STDERR: abstract class Abstract2 {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_abstract_var.carbon:[[@LINE+3]]:17-28: error: binding pattern has abstract type `(Abstract2,)` in `var` pattern [AbstractTypeInVarPattern] + // CHECK:STDERR: fail_abstract_var.carbon:[[@LINE-4]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere] // CHECK:STDERR: var unused v: (Abstract2,); } @@ -61,12 +53,8 @@ abstract class Abstract4 {} abstract class Abstract5 {} fn Var2() { - // CHECK:STDERR: fail_abstract_twice.carbon:[[@LINE+7]]:18: error: binding pattern has abstract type `(Abstract4, Abstract5)` in `var` pattern [AbstractTypeInVarPattern] - // CHECK:STDERR: var unused v2: (Abstract4, Abstract5); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_abstract_twice.carbon:[[@LINE-7]]:1: note: uses class that was declared abstract here [ClassAbstractHere] - // CHECK:STDERR: abstract class Abstract4 {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_abstract_twice.carbon:[[@LINE+3]]:18-39: error: binding pattern has abstract type `(Abstract4, Abstract5)` in `var` pattern [AbstractTypeInVarPattern] + // CHECK:STDERR: fail_abstract_twice.carbon:[[@LINE-5]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere] // CHECK:STDERR: var unused v2: (Abstract4, Abstract5); } @@ -77,12 +65,8 @@ library "[[@TEST_NAME]]"; abstract class Abstract6 {} fn Var3() { - // CHECK:STDERR: fail_abstract_first.carbon:[[@LINE+7]]:18: error: binding pattern has abstract type `(Abstract6, {})` in `var` pattern [AbstractTypeInVarPattern] - // CHECK:STDERR: var unused v3: (Abstract6, {}); - // CHECK:STDERR: ^~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_abstract_first.carbon:[[@LINE-6]]:1: note: uses class that was declared abstract here [ClassAbstractHere] - // CHECK:STDERR: abstract class Abstract6 {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_abstract_first.carbon:[[@LINE+3]]:18-32: error: binding pattern has abstract type `(Abstract6, {})` in `var` pattern [AbstractTypeInVarPattern] + // CHECK:STDERR: fail_abstract_first.carbon:[[@LINE-4]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere] // CHECK:STDERR: var unused v3: (Abstract6, {}); } @@ -93,12 +77,8 @@ library "[[@TEST_NAME]]"; abstract class Abstract7 {} fn Var4() { - // CHECK:STDERR: fail_abstract_second.carbon:[[@LINE+7]]:18: error: binding pattern has abstract type `({}, Abstract7)` in `var` pattern [AbstractTypeInVarPattern] - // CHECK:STDERR: var unused v4: ({}, Abstract7); - // CHECK:STDERR: ^~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_abstract_second.carbon:[[@LINE-6]]:1: note: uses class that was declared abstract here [ClassAbstractHere] - // CHECK:STDERR: abstract class Abstract7 {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_abstract_second.carbon:[[@LINE+3]]:18-32: error: binding pattern has abstract type `({}, Abstract7)` in `var` pattern [AbstractTypeInVarPattern] + // CHECK:STDERR: fail_abstract_second.carbon:[[@LINE-4]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere] // CHECK:STDERR: var unused v4: ({}, Abstract7); } @@ -114,13 +94,9 @@ library "[[@TEST_NAME]]"; import library "lib"; fn Var5() { - // CHECK:STDERR: fail_import.carbon:[[@LINE+8]]:18: error: binding pattern has abstract type `(Abstract,)` in `var` pattern [AbstractTypeInVarPattern] - // CHECK:STDERR: var unused v5: (Abstract,); - // CHECK:STDERR: ^~~~~~~~~~~ - // CHECK:STDERR: fail_import.carbon:[[@LINE-6]]:1: in import [InImport] - // CHECK:STDERR: lib.carbon:3:1: note: uses class that was declared abstract here [ClassAbstractHere] - // CHECK:STDERR: abstract class Abstract {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import.carbon:[[@LINE+4]]:18-28: error: binding pattern has abstract type `(Abstract,)` in `var` pattern [AbstractTypeInVarPattern] + // CHECK:STDERR: imported from: fail_import.carbon:[[@LINE-4]]:1 [InImport] + // CHECK:STDERR: lib.carbon:3:1-25: note: uses class that was declared abstract here [ClassAbstractHere] // CHECK:STDERR: var unused v5: (Abstract,); } @@ -165,10 +141,10 @@ fn Var5() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Contains { -// CHECK:STDOUT: %field_decl: = field_decl a, element0, %.loc13_21.2 in [concrete] { +// CHECK:STDOUT: %field_decl: = field_decl a, element0, %.loc9_21.2 in [concrete] { // CHECK:STDOUT: %Abstract1.ref: type = name_ref Abstract1, file.%Abstract1.decl [concrete = constants.%Abstract1] -// CHECK:STDOUT: %.loc13_21.1: %tuple.type.135 = tuple_literal (%Abstract1.ref) [concrete = constants.%tuple] -// CHECK:STDOUT: %.loc13_21.2: type = converted %.loc13_21.1, constants.%tuple.type.b06 [concrete = constants.%tuple.type.b06] +// CHECK:STDOUT: %.loc9_21.1: %tuple.type.135 = tuple_literal (%Abstract1.ref) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc9_21.2: type = converted %.loc9_21.1, constants.%tuple.type.b06 [concrete = constants.%tuple.type.b06] // CHECK:STDOUT: } // CHECK:STDOUT: %complete_type: = complete_type_witness [concrete = ] // CHECK:STDOUT: complete_type_witness = %complete_type @@ -226,10 +202,10 @@ fn Var5() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %v.var: ref = var_storage %v.var_patt [concrete = ] // CHECK:STDOUT: assign %v.var, -// CHECK:STDOUT: %.loc13_28.1: type = splice_block %.loc13_28.3 [concrete = constants.%tuple.type.ea9] { +// CHECK:STDOUT: %.loc9_28.1: type = splice_block %.loc9_28.3 [concrete = constants.%tuple.type.ea9] { // CHECK:STDOUT: %Abstract2.ref: type = name_ref Abstract2, file.%Abstract2.decl [concrete = constants.%Abstract2] -// CHECK:STDOUT: %.loc13_28.2: %tuple.type.135 = tuple_literal (%Abstract2.ref) [concrete = constants.%tuple] -// CHECK:STDOUT: %.loc13_28.3: type = converted %.loc13_28.2, constants.%tuple.type.ea9 [concrete = constants.%tuple.type.ea9] +// CHECK:STDOUT: %.loc9_28.2: %tuple.type.135 = tuple_literal (%Abstract2.ref) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc9_28.3: type = converted %.loc9_28.2, constants.%tuple.type.ea9 [concrete = constants.%tuple.type.ea9] // CHECK:STDOUT: } // CHECK:STDOUT: %v: = wrapper_binding v, [concrete = ] // CHECK:STDOUT: name_binding_decl { @@ -367,11 +343,11 @@ fn Var5() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %v2.var: ref = var_storage %v2.var_patt [concrete = ] // CHECK:STDOUT: assign %v2.var, -// CHECK:STDOUT: %.loc14_39.1: type = splice_block %.loc14_39.3 [concrete = constants.%tuple.type.417] { +// CHECK:STDOUT: %.loc10_39.1: type = splice_block %.loc10_39.3 [concrete = constants.%tuple.type.417] { // CHECK:STDOUT: %Abstract4.ref: type = name_ref Abstract4, file.%Abstract4.decl [concrete = constants.%Abstract4] // CHECK:STDOUT: %Abstract5.ref: type = name_ref Abstract5, file.%Abstract5.decl [concrete = constants.%Abstract5] -// CHECK:STDOUT: %.loc14_39.2: %tuple.type.693 = tuple_literal (%Abstract4.ref, %Abstract5.ref) [concrete = constants.%tuple] -// CHECK:STDOUT: %.loc14_39.3: type = converted %.loc14_39.2, constants.%tuple.type.417 [concrete = constants.%tuple.type.417] +// CHECK:STDOUT: %.loc10_39.2: %tuple.type.693 = tuple_literal (%Abstract4.ref, %Abstract5.ref) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc10_39.3: type = converted %.loc10_39.2, constants.%tuple.type.417 [concrete = constants.%tuple.type.417] // CHECK:STDOUT: } // CHECK:STDOUT: %v2: = wrapper_binding v2, [concrete = ] // CHECK:STDOUT: name_binding_decl { @@ -429,12 +405,12 @@ fn Var5() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %v3.var: ref = var_storage %v3.var_patt [concrete = ] // CHECK:STDOUT: assign %v3.var, -// CHECK:STDOUT: %.loc13_32.1: type = splice_block %.loc13_32.4 [concrete = constants.%tuple.type.427] { +// CHECK:STDOUT: %.loc9_32.1: type = splice_block %.loc9_32.4 [concrete = constants.%tuple.type.427] { // CHECK:STDOUT: %Abstract6.ref: type = name_ref Abstract6, file.%Abstract6.decl [concrete = constants.%Abstract6] -// CHECK:STDOUT: %.loc13_31: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc13_32.2: %tuple.type.4d1 = tuple_literal (%Abstract6.ref, %.loc13_31) [concrete = constants.%tuple] -// CHECK:STDOUT: %.loc13_32.3: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %.loc13_32.4: type = converted %.loc13_32.2, constants.%tuple.type.427 [concrete = constants.%tuple.type.427] +// CHECK:STDOUT: %.loc9_31: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc9_32.2: %tuple.type.4d1 = tuple_literal (%Abstract6.ref, %.loc9_31) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc9_32.3: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc9_32.4: type = converted %.loc9_32.2, constants.%tuple.type.427 [concrete = constants.%tuple.type.427] // CHECK:STDOUT: } // CHECK:STDOUT: %v3: = wrapper_binding v3, [concrete = ] // CHECK:STDOUT: name_binding_decl { @@ -492,12 +468,12 @@ fn Var5() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %v4.var: ref = var_storage %v4.var_patt [concrete = ] // CHECK:STDOUT: assign %v4.var, -// CHECK:STDOUT: %.loc13_32.1: type = splice_block %.loc13_32.4 [concrete = constants.%tuple.type.9db] { -// CHECK:STDOUT: %.loc13_20: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc9_32.1: type = splice_block %.loc9_32.4 [concrete = constants.%tuple.type.9db] { +// CHECK:STDOUT: %.loc9_20: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: %Abstract7.ref: type = name_ref Abstract7, file.%Abstract7.decl [concrete = constants.%Abstract7] -// CHECK:STDOUT: %.loc13_32.2: %tuple.type.12a = tuple_literal (%.loc13_20, %Abstract7.ref) [concrete = constants.%tuple] -// CHECK:STDOUT: %.loc13_32.3: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %.loc13_32.4: type = converted %.loc13_32.2, constants.%tuple.type.9db [concrete = constants.%tuple.type.9db] +// CHECK:STDOUT: %.loc9_32.2: %tuple.type.12a = tuple_literal (%.loc9_20, %Abstract7.ref) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc9_32.3: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc9_32.4: type = converted %.loc9_32.2, constants.%tuple.type.9db [concrete = constants.%tuple.type.9db] // CHECK:STDOUT: } // CHECK:STDOUT: %v4: = wrapper_binding v4, [concrete = ] // CHECK:STDOUT: name_binding_decl { @@ -589,10 +565,10 @@ fn Var5() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %v5.var: ref = var_storage %v5.var_patt [concrete = ] // CHECK:STDOUT: assign %v5.var, -// CHECK:STDOUT: %.loc14_28.1: type = splice_block %.loc14_28.3 [concrete = constants.%tuple.type.763] { +// CHECK:STDOUT: %.loc10_28.1: type = splice_block %.loc10_28.3 [concrete = constants.%tuple.type.763] { // CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, imports.%Main.Abstract [concrete = constants.%Abstract] -// CHECK:STDOUT: %.loc14_28.2: %tuple.type.135 = tuple_literal (%Abstract.ref) [concrete = constants.%tuple] -// CHECK:STDOUT: %.loc14_28.3: type = converted %.loc14_28.2, constants.%tuple.type.763 [concrete = constants.%tuple.type.763] +// CHECK:STDOUT: %.loc10_28.2: %tuple.type.135 = tuple_literal (%Abstract.ref) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc10_28.3: type = converted %.loc10_28.2, constants.%tuple.type.763 [concrete = constants.%tuple.type.763] // CHECK:STDOUT: } // CHECK:STDOUT: %v5: = wrapper_binding v5, [concrete = ] // CHECK:STDOUT: name_binding_decl { diff --git a/toolchain/check/testdata/class/access/access_modifiers.carbon b/toolchain/check/testdata/class/access/access_modifiers.carbon index b0635f9a30d1..c83a8d5906a1 100644 --- a/toolchain/check/testdata/class/access/access_modifiers.carbon +++ b/toolchain/check/testdata/class/access/access_modifiers.carbon @@ -31,37 +31,21 @@ class Circle { fn Run() { //@dump-sem-ir-begin let circle: Circle = Circle.Make(); - // CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+7]]:28: error: cannot access private member `radius` of type `Circle` [ClassInvalidMemberAccess] - // CHECK:STDERR: let unused radius: i32 = circle.radius; - // CHECK:STDERR: ^~~~~~~~~~~~~ - // CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-20]]:15: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: private var radius: i32; - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+3]]:28-40: error: cannot access private member `radius` of type `Circle` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-18]]:15-25: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: let unused radius: i32 = circle.radius; - // CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+7]]:3: error: cannot access private member `radius` of type `Circle` [ClassInvalidMemberAccess] - // CHECK:STDERR: circle.radius = 5; - // CHECK:STDERR: ^~~~~~~~~~~~~ - // CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-28]]:15: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: private var radius: i32; - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+3]]:3-15: error: cannot access private member `radius` of type `Circle` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-22]]:15-25: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: circle.radius = 5; - // CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+7]]:3: error: cannot access private member `SOME_INTERNAL_CONSTANT` of type `Circle` [ClassInvalidMemberAccess] - // CHECK:STDERR: circle.SOME_INTERNAL_CONSTANT; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-35]]:15: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: private let SOME_INTERNAL_CONSTANT: i32 = 5; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+3]]:3-31: error: cannot access private member `SOME_INTERNAL_CONSTANT` of type `Circle` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-25]]:15-41: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: circle.SOME_INTERNAL_CONSTANT; - // CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+7]]:3: error: cannot access private member `SomeInternalFunction` of type `Circle` [ClassInvalidMemberAccess] - // CHECK:STDERR: circle.SomeInternalFunction(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-42]]:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: private fn SomeInternalFunction() -> i32 { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+3]]:3-29: error: cannot access private member `SomeInternalFunction` of type `Circle` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-28]]:3-44: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: circle.SomeInternalFunction(); //@dump-sem-ir-end @@ -76,12 +60,8 @@ class A { fn Run() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_protected_field_access.carbon:[[@LINE+7]]:23: error: cannot access protected member `x` of type `A` [ClassInvalidMemberAccess] - // CHECK:STDERR: let unused x: i32 = A.x; - // CHECK:STDERR: ^~~ - // CHECK:STDERR: fail_protected_field_access.carbon:[[@LINE-8]]:17: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: protected var x: i32; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_protected_field_access.carbon:[[@LINE+3]]:23-25: error: cannot access protected member `x` of type `A` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_protected_field_access.carbon:[[@LINE-6]]:17-22: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: let unused x: i32 = A.x; //@dump-sem-ir-end @@ -157,20 +137,12 @@ class A { } //@dump-sem-ir-begin -// CHECK:STDERR: fail_global_access.carbon:[[@LINE+7]]:14: error: cannot access protected member `x` of type `A` [ClassInvalidMemberAccess] -// CHECK:STDERR: let x: i32 = A.x; -// CHECK:STDERR: ^~~ -// CHECK:STDERR: fail_global_access.carbon:[[@LINE-8]]:17: note: declared here [ClassMemberDeclaration] -// CHECK:STDERR: protected let x: i32 = 5; -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_global_access.carbon:[[@LINE+3]]:14-16: error: cannot access protected member `x` of type `A` [ClassInvalidMemberAccess] +// CHECK:STDERR: fail_global_access.carbon:[[@LINE-6]]:17-22: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: let x: i32 = A.x; -// CHECK:STDERR: fail_global_access.carbon:[[@LINE+7]]:14: error: cannot access private member `y` of type `A` [ClassInvalidMemberAccess] -// CHECK:STDERR: let y: i32 = A.y; -// CHECK:STDERR: ^~~ -// CHECK:STDERR: fail_global_access.carbon:[[@LINE-15]]:15: note: declared here [ClassMemberDeclaration] -// CHECK:STDERR: private let y: i32 = 5; -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_global_access.carbon:[[@LINE+3]]:14-16: error: cannot access private member `y` of type `A` [ClassInvalidMemberAccess] +// CHECK:STDERR: fail_global_access.carbon:[[@LINE-9]]:15-20: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: let y: i32 = A.y; //@dump-sem-ir-end @@ -338,20 +310,20 @@ class A { // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %circle.patt: %pattern_type.f70 = value_binding_pattern circle [concrete = constants.%circle.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %circle.ref.loc28: %Circle = name_ref circle, %circle -// CHECK:STDOUT: %radius.ref.loc28: = name_ref radius, [concrete = ] +// CHECK:STDOUT: %circle.ref.loc24: %Circle = name_ref circle, %circle +// CHECK:STDOUT: %radius.ref.loc24: = name_ref radius, [concrete = ] // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %radius: %i32 = wrapper_binding radius, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %radius.patt: %pattern_type.d94 = value_binding_pattern radius [concrete = constants.%radius.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %circle.ref.loc36: %Circle = name_ref circle, %circle -// CHECK:STDOUT: %radius.ref.loc36: = name_ref radius, [concrete = ] +// CHECK:STDOUT: %circle.ref.loc28: %Circle = name_ref circle, %circle +// CHECK:STDOUT: %radius.ref.loc28: = name_ref radius, [concrete = ] // CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [concrete = constants.%int_5.64b] -// CHECK:STDOUT: assign %radius.ref.loc36, -// CHECK:STDOUT: %circle.ref.loc44: %Circle = name_ref circle, %circle +// CHECK:STDOUT: assign %radius.ref.loc28, +// CHECK:STDOUT: %circle.ref.loc32: %Circle = name_ref circle, %circle // CHECK:STDOUT: %SOME_INTERNAL_CONSTANT.ref: = name_ref SOME_INTERNAL_CONSTANT, [concrete = ] -// CHECK:STDOUT: %circle.ref.loc53: %Circle = name_ref circle, %circle +// CHECK:STDOUT: %circle.ref.loc37: %Circle = name_ref circle, %circle // CHECK:STDOUT: %SomeInternalFunction.ref: = name_ref SomeInternalFunction, [concrete = ] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc20_36.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.3 // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc20_36.2) @@ -578,12 +550,12 @@ class A { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { -// CHECK:STDOUT: %i32.loc16: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc12: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %x: %i32 = wrapper_binding x, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %x.patt: %pattern_type.d94 = value_binding_pattern x [concrete = constants.%x.patt.ea2] // CHECK:STDOUT: } -// CHECK:STDOUT: %i32.loc24: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc16: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %y: %i32 = wrapper_binding y, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %y.patt: %pattern_type.d94 = value_binding_pattern y [concrete = constants.%y.patt.cd5] @@ -592,9 +564,9 @@ class A { // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref.loc16: type = name_ref A, file.%A.decl [concrete = constants.%A] +// CHECK:STDOUT: %A.ref.loc12: type = name_ref A, file.%A.decl [concrete = constants.%A] // CHECK:STDOUT: %x.ref: = name_ref x, [concrete = ] -// CHECK:STDOUT: %A.ref.loc24: type = name_ref A, file.%A.decl [concrete = constants.%A] +// CHECK:STDOUT: %A.ref.loc16: type = name_ref A, file.%A.decl [concrete = constants.%A] // CHECK:STDOUT: %y.ref: = name_ref y, [concrete = ] // CHECK:STDOUT: // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/access/friend.carbon b/toolchain/check/testdata/class/access/friend.carbon index 44d767a5ef6b..b947254dc773 100644 --- a/toolchain/check/testdata/class/access/friend.carbon +++ b/toolchain/check/testdata/class/access/friend.carbon @@ -18,12 +18,8 @@ class C { } fn F(c: C) -> i32 { - // CHECK:STDERR: fail_non_friend.carbon:[[@LINE+7]]:10: error: cannot access private member `i` of type `C` [ClassInvalidMemberAccess] - // CHECK:STDERR: return c.i; - // CHECK:STDERR: ^~~ - // CHECK:STDERR: fail_non_friend.carbon:[[@LINE-7]]:15: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: private var i: i32; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_non_friend.carbon:[[@LINE+3]]:10-12: error: cannot access private member `i` of type `C` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_non_friend.carbon:[[@LINE-5]]:15-20: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: return c.i; } @@ -37,9 +33,7 @@ fn F(c: C) -> i32; class C { private var i: i32; - // CHECK:STDERR: fail_todo_friend_function.carbon:[[@LINE+4]]:3: error: semantics TODO: `befriending a function not yet implemented` [SemanticsTodo] - // CHECK:STDERR: friend F; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_todo_friend_function.carbon:[[@LINE+2]]:3-11: error: semantics TODO: `befriending a function not yet implemented` [SemanticsTodo] // CHECK:STDERR: friend F; } @@ -140,9 +134,7 @@ var v: i32; class C { private var i: i32; - // CHECK:STDERR: fail_friend_var.carbon:[[@LINE+4]]:10: error: friend declaration names entity that is not a name scope [FriendNotNameScope] - // CHECK:STDERR: friend v; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_friend_var.carbon:[[@LINE+2]]:10: error: friend declaration names entity that is not a name scope [FriendNotNameScope] // CHECK:STDERR: friend v; } @@ -169,9 +161,7 @@ library "[[@TEST_NAME]]"; class C; interface I { - // CHECK:STDERR: fail_friend_not_in_class.carbon:[[@LINE+4]]:3: error: `friend` declaration in non-class scope [FriendNotAllowedInScope] - // CHECK:STDERR: friend C; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_friend_not_in_class.carbon:[[@LINE+2]]:3-11: error: `friend` declaration in non-class scope [FriendNotAllowedInScope] // CHECK:STDERR: friend C; } @@ -181,9 +171,7 @@ library "[[@TEST_NAME]]"; class C { var v: i32; - // CHECK:STDERR: fail_friend_not_constant.carbon:[[@LINE+4]]:10: error: friend declaration names entity that is not a name scope [FriendNotNameScope] - // CHECK:STDERR: friend v; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_friend_not_constant.carbon:[[@LINE+2]]:10: error: friend declaration names entity that is not a name scope [FriendNotNameScope] // CHECK:STDERR: friend v; } diff --git a/toolchain/check/testdata/class/access/import_access.carbon b/toolchain/check/testdata/class/access/import_access.carbon index af86a8dc9f62..c39920a609e5 100644 --- a/toolchain/check/testdata/class/access/import_access.carbon +++ b/toolchain/check/testdata/class/access/import_access.carbon @@ -52,9 +52,7 @@ package Test library "[[@TEST_NAME]]"; import library "def"; -// CHECK:STDERR: fail_local_def.carbon:[[@LINE+4]]:8: error: name `Def` not found [NameNotFound] -// CHECK:STDERR: var c: Def = {}; -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_local_def.carbon:[[@LINE+2]]:8-10: error: name `Def` not found [NameNotFound] // CHECK:STDERR: var c: Def = {}; @@ -64,9 +62,7 @@ package Other library "[[@TEST_NAME]]"; import Test library "def"; -// CHECK:STDERR: fail_other_def.carbon:[[@LINE+4]]:8: error: member name `Def` not found in `Test` [MemberNameNotFoundInInstScope] -// CHECK:STDERR: var c: Test.Def = {}; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_other_def.carbon:[[@LINE+2]]:8-15: error: member name `Def` not found in `Test` [MemberNameNotFoundInInstScope] // CHECK:STDERR: var c: Test.Def = {}; @@ -82,9 +78,7 @@ package Test library "[[@TEST_NAME]]"; import library "forward_with_def"; -// CHECK:STDERR: fail_local_forward_with_def.carbon:[[@LINE+4]]:8: error: name `ForwardWithDef` not found [NameNotFound] -// CHECK:STDERR: var c: ForwardWithDef = {}; -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_local_forward_with_def.carbon:[[@LINE+2]]:8-21: error: name `ForwardWithDef` not found [NameNotFound] // CHECK:STDERR: var c: ForwardWithDef = {}; @@ -94,9 +88,7 @@ package Other library "[[@TEST_NAME]]"; import Test library "forward_with_def"; -// CHECK:STDERR: fail_other_forward_with_def.carbon:[[@LINE+4]]:8: error: member name `ForwardWithDef` not found in `Test` [MemberNameNotFoundInInstScope] -// CHECK:STDERR: var c: Test.ForwardWithDef = {}; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_other_forward_with_def.carbon:[[@LINE+2]]:8-26: error: member name `ForwardWithDef` not found in `Test` [MemberNameNotFoundInInstScope] // CHECK:STDERR: var c: Test.ForwardWithDef = {}; @@ -114,9 +106,7 @@ package Test library "[[@TEST_NAME]]"; import library "forward"; -// CHECK:STDERR: fail_local_forward.carbon:[[@LINE+4]]:16: error: name `Forward` not found [NameNotFound] -// CHECK:STDERR: fn F(unused c: Forward*) {} -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_local_forward.carbon:[[@LINE+2]]:16-22: error: name `Forward` not found [NameNotFound] // CHECK:STDERR: fn F(unused c: Forward*) {} @@ -126,9 +116,7 @@ package Other library "[[@TEST_NAME]]"; import Test library "forward"; -// CHECK:STDERR: fail_other_forward.carbon:[[@LINE+4]]:16: error: member name `Forward` not found in `Test` [MemberNameNotFoundInInstScope] -// CHECK:STDERR: fn F(unused c: Test.Forward*) {} -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_other_forward.carbon:[[@LINE+2]]:16-27: error: member name `Forward` not found in `Test` [MemberNameNotFoundInInstScope] // CHECK:STDERR: fn F(unused c: Test.Forward*) {} @@ -282,7 +270,7 @@ private class Redecl {} // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc8: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: assign file.%c.var, // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -322,7 +310,7 @@ private class Redecl {} // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc8: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: assign file.%c.var, // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -404,7 +392,7 @@ private class Redecl {} // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc8: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: assign file.%c.var, // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -444,7 +432,7 @@ private class Redecl {} // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc8: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: assign file.%c.var, // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -521,7 +509,7 @@ private class Redecl {} // CHECK:STDOUT: %c.patt: = wrapper_binding_pattern c, %c.param_patt [concrete = ] // CHECK:STDOUT: } { // CHECK:STDOUT: %c.param: = value_param call_param0 -// CHECK:STDOUT: %.loc10: type = splice_block %ptr [concrete = ] { +// CHECK:STDOUT: %.loc8: type = splice_block %ptr [concrete = ] { // CHECK:STDOUT: %Forward.ref: = name_ref Forward, [concrete = ] // CHECK:STDOUT: %ptr: type = ptr_type [concrete = ] // CHECK:STDOUT: } @@ -560,7 +548,7 @@ private class Redecl {} // CHECK:STDOUT: %c.patt: = wrapper_binding_pattern c, %c.param_patt [concrete = ] // CHECK:STDOUT: } { // CHECK:STDOUT: %c.param: = value_param call_param0 -// CHECK:STDOUT: %.loc10: type = splice_block %ptr [concrete = ] { +// CHECK:STDOUT: %.loc8: type = splice_block %ptr [concrete = ] { // CHECK:STDOUT: %Test.ref: = name_ref Test, imports.%Test [concrete = imports.%Test] // CHECK:STDOUT: %Forward.ref: = name_ref Forward, [concrete = ] // CHECK:STDOUT: %ptr: type = ptr_type [concrete = ] diff --git a/toolchain/check/testdata/class/access/inheritance_access.carbon b/toolchain/check/testdata/class/access/inheritance_access.carbon index fb85eb849a01..2129439e0839 100644 --- a/toolchain/check/testdata/class/access/inheritance_access.carbon +++ b/toolchain/check/testdata/class/access/inheritance_access.carbon @@ -83,12 +83,8 @@ class Square { extend base: Shape; fn GetPosition(self) -> i32 { - // CHECK:STDERR: fail_inherited_private_field_access.carbon:[[@LINE+7]]:12: error: cannot access private member `y` of type `Shape` [ClassInvalidMemberAccess] - // CHECK:STDERR: return self.y; - // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_inherited_private_field_access.carbon:[[@LINE-10]]:15: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: private var y: i32; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_inherited_private_field_access.carbon:[[@LINE+3]]:12-17: error: cannot access private member `y` of type `Shape` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_inherited_private_field_access.carbon:[[@LINE-8]]:15-20: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: return self.y; } @@ -128,12 +124,8 @@ base class B { class C { extend base: B; - // CHECK:STDERR: fail_noninstance_private_on_parent_qualified.carbon:[[@LINE+7]]:12: error: cannot access private member `F` of type `B` [ClassInvalidMemberAccess] - // CHECK:STDERR: fn G() { Self.F(); } - // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_noninstance_private_on_parent_qualified.carbon:[[@LINE-8]]:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: private fn F() {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_noninstance_private_on_parent_qualified.carbon:[[@LINE+3]]:12-17: error: cannot access private member `F` of type `B` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_noninstance_private_on_parent_qualified.carbon:[[@LINE-6]]:3-18: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: fn G() { Self.F(); } } @@ -156,30 +148,18 @@ base class B { class C { extend base: B; - // CHECK:STDERR: fail_noninstance_private_on_parent_unqualified.carbon:[[@LINE+7]]:27: error: cannot access private member `SOME_PRIVATE_CONSTANT` of type `B` [ClassInvalidMemberAccess] - // CHECK:STDERR: fn G1() -> i32 { return SOME_PRIVATE_CONSTANT; } - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_noninstance_private_on_parent_unqualified.carbon:[[@LINE-10]]:15: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: private let SOME_PRIVATE_CONSTANT: i32 = 86; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_noninstance_private_on_parent_unqualified.carbon:[[@LINE+3]]:27-47: error: cannot access private member `SOME_PRIVATE_CONSTANT` of type `B` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_noninstance_private_on_parent_unqualified.carbon:[[@LINE-8]]:15-40: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: fn G1() -> i32 { return SOME_PRIVATE_CONSTANT; } - // CHECK:STDERR: fail_noninstance_private_on_parent_unqualified.carbon:[[@LINE+7]]:13: error: cannot access private member `Fa` of type `A` [ClassInvalidMemberAccess] - // CHECK:STDERR: fn G2() { Fa(); } - // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_noninstance_private_on_parent_unqualified.carbon:[[@LINE-25]]:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: private fn Fa() {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_noninstance_private_on_parent_unqualified.carbon:[[@LINE+3]]:13-14: error: cannot access private member `Fa` of type `A` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_noninstance_private_on_parent_unqualified.carbon:[[@LINE-19]]:3-19: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: fn G2() { Fa(); } - // CHECK:STDERR: fail_noninstance_private_on_parent_unqualified.carbon:[[@LINE+7]]:13: error: cannot access private member `Fb` of type `B` [ClassInvalidMemberAccess] - // CHECK:STDERR: fn G3() { Fb(); } - // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_noninstance_private_on_parent_unqualified.carbon:[[@LINE-27]]:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: private fn Fb() {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_noninstance_private_on_parent_unqualified.carbon:[[@LINE+3]]:13-14: error: cannot access private member `Fb` of type `B` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_noninstance_private_on_parent_unqualified.carbon:[[@LINE-17]]:3-19: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: fn G3() { Fb(); } } @@ -214,32 +194,20 @@ class B { private var internal: Internal; fn G() -> i32 { - // CHECK:STDERR: fail_non_inherited_access.carbon:[[@LINE+7]]:5: error: cannot access private member `SOME_PRIVATE_CONSTANT` of type `A` [ClassInvalidMemberAccess] - // CHECK:STDERR: A.SOME_PRIVATE_CONSTANT; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_non_inherited_access.carbon:[[@LINE-14]]:15: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: private let SOME_PRIVATE_CONSTANT: i32 = 5; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_non_inherited_access.carbon:[[@LINE+3]]:5-27: error: cannot access private member `SOME_PRIVATE_CONSTANT` of type `A` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_non_inherited_access.carbon:[[@LINE-12]]:15-40: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: A.SOME_PRIVATE_CONSTANT; - // CHECK:STDERR: fail_non_inherited_access.carbon:[[@LINE+7]]:12: error: cannot access protected member `SOME_PROTECTED_CONSTANT` of type `A` [ClassInvalidMemberAccess] - // CHECK:STDERR: return A.SOME_PROTECTED_CONSTANT; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_non_inherited_access.carbon:[[@LINE-24]]:17: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: protected let SOME_PROTECTED_CONSTANT: i32 = 5; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_non_inherited_access.carbon:[[@LINE+3]]:12-36: error: cannot access protected member `SOME_PROTECTED_CONSTANT` of type `A` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_non_inherited_access.carbon:[[@LINE-18]]:17-44: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: return A.SOME_PROTECTED_CONSTANT; } fn SomeFunc(self) -> i32{ - // CHECK:STDERR: fail_non_inherited_access.carbon:[[@LINE+7]]:12: error: cannot access protected member `INTERNAL_CONSTANT` of type `Internal` [ClassInvalidMemberAccess] - // CHECK:STDERR: return self.internal.INTERNAL_CONSTANT; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_non_inherited_access.carbon:[[@LINE-30]]:17: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: protected let INTERNAL_CONSTANT: i32 = 5; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_non_inherited_access.carbon:[[@LINE+3]]:12-42: error: cannot access protected member `INTERNAL_CONSTANT` of type `Internal` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_non_inherited_access.carbon:[[@LINE-20]]:17-38: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: return self.internal.INTERNAL_CONSTANT; } @@ -256,12 +224,8 @@ base class A { class B { extend base: A; fn F(self) { - // CHECK:STDERR: fail_compound_member_access.carbon:[[@LINE+7]]:11: error: cannot access private member `x` of type `A` [ClassInvalidMemberAccess] - // CHECK:STDERR: self.(A.x); - // CHECK:STDERR: ^~~ - // CHECK:STDERR: fail_compound_member_access.carbon:[[@LINE-9]]:15: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: private var x: i32; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_compound_member_access.carbon:[[@LINE+3]]:11-13: error: cannot access private member `x` of type `A` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_compound_member_access.carbon:[[@LINE-7]]:15-20: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: self.(A.x); } @@ -1162,7 +1126,7 @@ class B { // CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32 [concrete = constants.%return.patt.6fa] // CHECK:STDOUT: } { // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc25: Core.Form = init_form %i32 [concrete = constants.%.0b3] +// CHECK:STDOUT: %.loc21: Core.Form = init_form %i32 [concrete = constants.%.0b3] // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param0 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } @@ -1440,7 +1404,7 @@ class B { // CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32 [concrete = constants.%return.patt.6fa] // CHECK:STDOUT: } { // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc36: Core.Form = init_form %i32 [concrete = constants.%.0b3] +// CHECK:STDOUT: %.loc28: Core.Form = init_form %i32 [concrete = constants.%.0b3] // CHECK:STDOUT: %self.param: %B = value_param call_param0 // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%B [concrete = constants.%B] // CHECK:STDOUT: %self: %B = wrapper_binding self, %self.param @@ -1461,9 +1425,9 @@ class B { // CHECK:STDOUT: // CHECK:STDOUT: fn @B.G() -> out %return.param: %i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref.loc24: type = name_ref A, file.%A.decl [concrete = constants.%A] +// CHECK:STDOUT: %A.ref.loc20: type = name_ref A, file.%A.decl [concrete = constants.%A] // CHECK:STDOUT: %SOME_PRIVATE_CONSTANT.ref: = name_ref SOME_PRIVATE_CONSTANT, [concrete = ] -// CHECK:STDOUT: %A.ref.loc33: type = name_ref A, file.%A.decl [concrete = constants.%A] +// CHECK:STDOUT: %A.ref.loc25: type = name_ref A, file.%A.decl [concrete = constants.%A] // CHECK:STDOUT: %SOME_PROTECTED_CONSTANT.ref: = name_ref SOME_PROTECTED_CONSTANT, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -1472,8 +1436,8 @@ class B { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %self.ref: %B = name_ref self, %self // CHECK:STDOUT: %internal.ref: %B.elem = name_ref internal, @B.%field_decl [concrete = @B.%field_decl] -// CHECK:STDOUT: %.loc44_16.1: ref %Internal = class_element_access %self.ref, element0 -// CHECK:STDOUT: %.loc44_16.2: %Internal = acquire_value %.loc44_16.1 +// CHECK:STDOUT: %.loc32_16.1: ref %Internal = class_element_access %self.ref, element0 +// CHECK:STDOUT: %.loc32_16.2: %Internal = acquire_value %.loc32_16.1 // CHECK:STDOUT: %INTERNAL_CONSTANT.ref: = name_ref INTERNAL_CONSTANT, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/access/method_access.carbon b/toolchain/check/testdata/class/access/method_access.carbon index bc5036afff53..7abfe4c1d554 100644 --- a/toolchain/check/testdata/class/access/method_access.carbon +++ b/toolchain/check/testdata/class/access/method_access.carbon @@ -20,9 +20,7 @@ class X { fn G(x: X) { // TODO: Produce a better diagnostic for this case. - // CHECK:STDERR: fail_multiple_bindings.carbon:[[@LINE+4]]:3: error: member name of type `` in compound member access is not an instance member or an interface member [CompoundMemberAccessDoesNotUseBase] - // CHECK:STDERR: x.(x.F)(); - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_multiple_bindings.carbon:[[@LINE+2]]:3-9: error: member name of type `` in compound member access is not an instance member or an interface member [CompoundMemberAccessDoesNotUseBase] // CHECK:STDERR: x.(x.F)(); } @@ -83,11 +81,11 @@ fn G(x: X) { // CHECK:STDOUT: // CHECK:STDOUT: fn @G(%x.param: %X) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %x.ref.loc12_3: %X = name_ref x, %x -// CHECK:STDOUT: %x.ref.loc12_6: %X = name_ref x, %x +// CHECK:STDOUT: %x.ref.loc10_3: %X = name_ref x, %x +// CHECK:STDOUT: %x.ref.loc10_6: %X = name_ref x, %x // CHECK:STDOUT: %F.ref: %X.F.type = name_ref F, @X.%X.F.decl [concrete = constants.%X.F] -// CHECK:STDOUT: %X.F.bound: = bound_method %x.ref.loc12_6, %F.ref -// CHECK:STDOUT: %X.F.call: init %empty_tuple.type = call %X.F.bound(%x.ref.loc12_6) +// CHECK:STDOUT: %X.F.bound: = bound_method %x.ref.loc10_6, %F.ref +// CHECK:STDOUT: %X.F.call: init %empty_tuple.type = call %X.F.bound(%x.ref.loc10_6) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/adapter/adapt.carbon b/toolchain/check/testdata/class/adapter/adapt.carbon index 63b513b741fc..a3f93ca18186 100644 --- a/toolchain/check/testdata/class/adapter/adapt.carbon +++ b/toolchain/check/testdata/class/adapter/adapt.carbon @@ -43,9 +43,7 @@ class AdaptNotExtend { fn F(a: AdaptNotExtend) { // `Adapted` is not extended, so lookup for `F` finds nothing. - // CHECK:STDERR: fail_not_extend.carbon:[[@LINE+4]]:3: error: member name `F` not found in `AdaptNotExtend` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: a.F(); - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_not_extend.carbon:[[@LINE+2]]:3-5: error: member name `F` not found in `AdaptNotExtend` [MemberNameNotFoundInInstScope] // CHECK:STDERR: a.F(); } @@ -55,17 +53,13 @@ fn F(a: AdaptNotExtend) { library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: fail_misplaced.carbon:[[@LINE+4]]:3: error: `adapt` declaration outside class [ClassSpecificDeclOutsideClass] - // CHECK:STDERR: adapt i32; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_misplaced.carbon:[[@LINE+2]]:3-12: error: `adapt` declaration outside class [ClassSpecificDeclOutsideClass] // CHECK:STDERR: adapt i32; } interface I { - // CHECK:STDERR: fail_misplaced.carbon:[[@LINE+4]]:3: error: `adapt` declaration outside class [ClassSpecificDeclOutsideClass] - // CHECK:STDERR: adapt i32; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_misplaced.carbon:[[@LINE+2]]:3-12: error: `adapt` declaration outside class [ClassSpecificDeclOutsideClass] // CHECK:STDERR: adapt i32; } diff --git a/toolchain/check/testdata/class/adapter/adapt_copy.carbon b/toolchain/check/testdata/class/adapter/adapt_copy.carbon index e9c90d233be8..7dcfbdd7fc22 100644 --- a/toolchain/check/testdata/class/adapter/adapt_copy.carbon +++ b/toolchain/check/testdata/class/adapter/adapt_copy.carbon @@ -24,39 +24,23 @@ class AdaptCopyable { } 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` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var d: AdaptCopyable = c; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+3]]:26: error: cannot copy value of type `AdaptCopyable` [CopyOfUncopyableType] + // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+2]]:26: note: type `AdaptCopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var d: AdaptCopyable = c; - // 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` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return d; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+3]]:10: error: cannot copy value of type `AdaptCopyable` [CopyOfUncopyableType] + // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+2]]:10: note: type `AdaptCopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return d; } 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` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var d: (AdaptCopyable, u32) = c; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+3]]:33: error: cannot copy value of type `AdaptCopyable` [CopyOfUncopyableType] + // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+2]]:33: note: type `AdaptCopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var d: (AdaptCopyable, u32) = c; - // 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` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return d; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+3]]:10: error: cannot copy value of type `AdaptCopyable` [CopyOfUncopyableType] + // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+2]]:10: note: type `AdaptCopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return d; } @@ -92,20 +76,12 @@ class AdaptNoncopyable { } 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` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var b: AdaptNoncopyable = a; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_adapt_not_copyable.carbon:[[@LINE+3]]:29: error: cannot copy value of type `AdaptNoncopyable` [CopyOfUncopyableType] + // CHECK:STDERR: fail_adapt_not_copyable.carbon:[[@LINE+2]]:29: note: type `AdaptNoncopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var b: AdaptNoncopyable = a; - // 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` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return b; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_adapt_not_copyable.carbon:[[@LINE+3]]:10: error: cannot copy value of type `AdaptNoncopyable` [CopyOfUncopyableType] + // CHECK:STDERR: fail_adapt_not_copyable.carbon:[[@LINE+2]]:10: note: type `AdaptNoncopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return b; } @@ -123,26 +99,14 @@ class AdaptNoncopyableIndirect { } 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` [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] - // CHECK:STDERR: var b: AdaptNoncopyableIndirect = a; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+4]]:3-33: error: cannot copy value of type `Noncopyable` [CopyOfUncopyableType] + // CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+3]]:3-33: note: type `Noncopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+2]]:37: note: in copy of `AdaptNoncopyableIndirect` [InCopy] // CHECK:STDERR: var b: AdaptNoncopyableIndirect = a; - // 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` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return b; - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+4]]:10: note: in copy of `AdaptNoncopyableIndirect` [InCopy] - // CHECK:STDERR: return b; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+4]]:3-11: error: cannot copy value of type `Noncopyable` [CopyOfUncopyableType] + // CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+3]]:3-11: note: type `Noncopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+2]]:10: note: in copy of `AdaptNoncopyableIndirect` [InCopy] // CHECK:STDERR: return b; } @@ -192,17 +156,17 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) { // CHECK:STDOUT: %pattern_type.d94: type = pattern_type %i32 [concrete] // CHECK:STDOUT: %self.param_patt.0c5: %pattern_type.d94 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.749: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt.0c5 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc16_3.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc12_3.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc16_3.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc12_3.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.1: %Destroy.WithSelf.Op.type.ef016f.1 = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.f36: %pattern_type.3b9 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.205: %pattern_type.3b9 = wrapper_binding_pattern self, %self.param_patt.f36 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc16_3.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc12_3.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc16_3.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc12_3.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.2: %Destroy.WithSelf.Op.type.ef016f.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc16_3.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc12_3.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.2: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2 = struct_value () [concrete] // CHECK:STDOUT: %UInt.type: type = parameterized_class_name_type @UInt [concrete] // CHECK:STDOUT: %UInt.generic: %UInt.type = struct_value () [concrete] @@ -223,21 +187,21 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) { // CHECK:STDOUT: %pattern_type.129: type = pattern_type %u32 [concrete] // CHECK:STDOUT: %self.param_patt.6f9: %pattern_type.129 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.ddd: %pattern_type.129 = wrapper_binding_pattern self, %self.param_patt.6f9 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc35_3.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc23_3.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc35_3.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc23_3.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.3: %Destroy.WithSelf.Op.type.ef016f.3 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.3: type = fn_type @Destroy.WithSelf.SelfDestruct.loc35_3.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.3: type = fn_type @Destroy.WithSelf.SelfDestruct.loc23_3.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.3: %Destroy.WithSelf.SelfDestruct.type.fbceb5.3 = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.604: %pattern_type.848 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.094: %pattern_type.848 = wrapper_binding_pattern self, %self.param_patt.604 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc35_3.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc23_3.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.4: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4 = struct_value () [concrete] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.4: type = fn_type @Destroy.WithSelf.Op.loc35_3.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.4: type = fn_type @Destroy.WithSelf.Op.loc23_3.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.4: %Destroy.WithSelf.Op.type.ef016f.4 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.4: type = fn_type @Destroy.WithSelf.SelfDestruct.loc35_3.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.4: type = fn_type @Destroy.WithSelf.SelfDestruct.loc23_3.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.4: %Destroy.WithSelf.SelfDestruct.type.fbceb5.4 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -257,56 +221,56 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc16_3.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc12_3.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d94 = ref_param_pattern [concrete = constants.%self.param_patt.0c5] // CHECK:STDOUT: %self.patt: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.749] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %i32 = ref_param call_param0 // CHECK:STDOUT: %self: ref %i32 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc16_3.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc12_3.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d94 = ref_param_pattern [concrete = constants.%self.param_patt.0c5] // CHECK:STDOUT: %self.patt: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.749] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %i32 = ref_param call_param0 // CHECK:STDOUT: %self: ref %i32 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc16_3.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc12_3.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.3b9 = ref_param_pattern [concrete = constants.%self.param_patt.f36] // CHECK:STDOUT: %self.patt: %pattern_type.3b9 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.205] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %AdaptCopyable = ref_param call_param0 // CHECK:STDOUT: %self: ref %AdaptCopyable = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc16_3.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc12_3.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.3b9 = ref_param_pattern [concrete = constants.%self.param_patt.f36] // CHECK:STDOUT: %self.patt: %pattern_type.3b9 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.205] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %AdaptCopyable = ref_param call_param0 // CHECK:STDOUT: %self: ref %AdaptCopyable = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc35_3.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.3] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc23_3.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.3] { // CHECK:STDOUT: %self.param_patt: %pattern_type.129 = ref_param_pattern [concrete = constants.%self.param_patt.6f9] // CHECK:STDOUT: %self.patt: %pattern_type.129 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.ddd] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %u32 = ref_param call_param0 // CHECK:STDOUT: %self: ref %u32 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.3: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc35_3.1 [concrete = constants.%Destroy.WithSelf.Op.403171.3] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.3: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc23_3.1 [concrete = constants.%Destroy.WithSelf.Op.403171.3] { // CHECK:STDOUT: %self.param_patt: %pattern_type.129 = ref_param_pattern [concrete = constants.%self.param_patt.6f9] // CHECK:STDOUT: %self.patt: %pattern_type.129 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.ddd] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %u32 = ref_param call_param0 // CHECK:STDOUT: %self: ref %u32 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.4: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc35_3.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.4] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.4: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc23_3.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.4] { // CHECK:STDOUT: %self.param_patt: %pattern_type.848 = ref_param_pattern [concrete = constants.%self.param_patt.604] // CHECK:STDOUT: %self.patt: %pattern_type.848 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.094] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %tuple.type.c35 = ref_param call_param0 // CHECK:STDOUT: %self: ref %tuple.type.c35 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.4: %Destroy.WithSelf.Op.type.ef016f.4 = fn_decl @Destroy.WithSelf.Op.loc35_3.2 [concrete = constants.%Destroy.WithSelf.Op.403171.4] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.4: %Destroy.WithSelf.Op.type.ef016f.4 = fn_decl @Destroy.WithSelf.Op.loc23_3.2 [concrete = constants.%Destroy.WithSelf.Op.403171.4] { // CHECK:STDOUT: %self.param_patt: %pattern_type.848 = ref_param_pattern [concrete = constants.%self.param_patt.604] // CHECK:STDOUT: %self.patt: %pattern_type.848 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.094] // CHECK:STDOUT: } { @@ -342,19 +306,19 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) { // CHECK:STDOUT: %c.param_patt: %pattern_type.848 = value_param_pattern [concrete = constants.%c.param_patt.47e] // CHECK:STDOUT: %c.patt: %pattern_type.848 = wrapper_binding_pattern c, %c.param_patt [concrete = constants.%c.patt.fe5] // CHECK:STDOUT: %return.param_patt: %pattern_type.848 = out_param_pattern [concrete = constants.%return.param_patt.117] -// CHECK:STDOUT: %return.patt: %pattern_type.848 = return_slot_pattern %return.param_patt, %.loc27_59.2 [concrete = constants.%return.patt.77a] +// CHECK:STDOUT: %return.patt: %pattern_type.848 = return_slot_pattern %return.param_patt, %.loc19_59.2 [concrete = constants.%return.patt.77a] // CHECK:STDOUT: } { -// CHECK:STDOUT: %AdaptCopyable.ref.loc27_41: type = name_ref AdaptCopyable, file.%AdaptCopyable.decl [concrete = constants.%AdaptCopyable] -// CHECK:STDOUT: %u32.loc27_56: type = type_literal constants.%u32 [concrete = constants.%u32] -// CHECK:STDOUT: %.loc27_59.1: %tuple.type.693 = tuple_literal (%AdaptCopyable.ref.loc27_41, %u32.loc27_56) [concrete = constants.%tuple.0f9] -// CHECK:STDOUT: %.loc27_59.2: type = converted %.loc27_59.1, constants.%tuple.type.c35 [concrete = constants.%tuple.type.c35] -// CHECK:STDOUT: %.loc27_59.3: Core.Form = init_form %.loc27_59.2 [concrete = constants.%.70b] +// CHECK:STDOUT: %AdaptCopyable.ref.loc19_41: type = name_ref AdaptCopyable, file.%AdaptCopyable.decl [concrete = constants.%AdaptCopyable] +// CHECK:STDOUT: %u32.loc19_56: type = type_literal constants.%u32 [concrete = constants.%u32] +// CHECK:STDOUT: %.loc19_59.1: %tuple.type.693 = tuple_literal (%AdaptCopyable.ref.loc19_41, %u32.loc19_56) [concrete = constants.%tuple.0f9] +// CHECK:STDOUT: %.loc19_59.2: type = converted %.loc19_59.1, constants.%tuple.type.c35 [concrete = constants.%tuple.type.c35] +// CHECK:STDOUT: %.loc19_59.3: Core.Form = init_form %.loc19_59.2 [concrete = constants.%.70b] // CHECK:STDOUT: %c.param: %tuple.type.c35 = value_param call_param0 -// CHECK:STDOUT: %.loc27_34.1: type = splice_block %.loc27_34.3 [concrete = constants.%tuple.type.c35] { -// CHECK:STDOUT: %AdaptCopyable.ref.loc27_16: type = name_ref AdaptCopyable, file.%AdaptCopyable.decl [concrete = constants.%AdaptCopyable] -// CHECK:STDOUT: %u32.loc27_31: type = type_literal constants.%u32 [concrete = constants.%u32] -// CHECK:STDOUT: %.loc27_34.2: %tuple.type.693 = tuple_literal (%AdaptCopyable.ref.loc27_16, %u32.loc27_31) [concrete = constants.%tuple.0f9] -// CHECK:STDOUT: %.loc27_34.3: type = converted %.loc27_34.2, constants.%tuple.type.c35 [concrete = constants.%tuple.type.c35] +// CHECK:STDOUT: %.loc19_34.1: type = splice_block %.loc19_34.3 [concrete = constants.%tuple.type.c35] { +// CHECK:STDOUT: %AdaptCopyable.ref.loc19_16: type = name_ref AdaptCopyable, file.%AdaptCopyable.decl [concrete = constants.%AdaptCopyable] +// CHECK:STDOUT: %u32.loc19_31: type = type_literal constants.%u32 [concrete = constants.%u32] +// CHECK:STDOUT: %.loc19_34.2: %tuple.type.693 = tuple_literal (%AdaptCopyable.ref.loc19_16, %u32.loc19_31) [concrete = constants.%tuple.0f9] +// CHECK:STDOUT: %.loc19_34.3: type = converted %.loc19_34.2, constants.%tuple.type.c35 [concrete = constants.%tuple.type.c35] // CHECK:STDOUT: } // CHECK:STDOUT: %c: %tuple.type.c35 = wrapper_binding c, %c.param // CHECK:STDOUT: %return.param: ref %tuple.type.c35 = out_param call_param1 @@ -377,35 +341,35 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) { // CHECK:STDOUT: %d.var: ref %AdaptCopyable = var_storage %d.var_patt // CHECK:STDOUT: %c.ref: %AdaptCopyable = name_ref c, %c // CHECK:STDOUT: assign %d.var, -// CHECK:STDOUT: %AdaptCopyable.ref.loc16: type = name_ref AdaptCopyable, file.%AdaptCopyable.decl [concrete = constants.%AdaptCopyable] +// CHECK:STDOUT: %AdaptCopyable.ref.loc12: type = name_ref AdaptCopyable, file.%AdaptCopyable.decl [concrete = constants.%AdaptCopyable] // CHECK:STDOUT: %d: ref %AdaptCopyable = wrapper_binding d, %d.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %d.patt: %pattern_type.3b9 = ref_binding_pattern d [concrete = constants.%d.patt.467] // CHECK:STDOUT: %d.var_patt: %pattern_type.3b9 = var_pattern %d.patt [concrete = constants.%d.var_patt.b13] // CHECK:STDOUT: } // CHECK:STDOUT: %d.ref: ref %AdaptCopyable = name_ref d, %d -// CHECK:STDOUT: %.loc24: %AdaptCopyable = acquire_value %d.ref +// CHECK:STDOUT: %.loc16: %AdaptCopyable = acquire_value %d.ref // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %d.var, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%d.var) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc16_3.1(%self.param: ref %i32) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc12_3.1(%self.param: ref %i32) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc16_3.1(%self.param: ref %i32) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc12_3.1(%self.param: ref %i32) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc16_3.1(%self.param: ref %i32) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc12_3.1(%self.param: ref %i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.1(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.1(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc16_3.2(%self.param: ref %AdaptCopyable) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc12_3.2(%self.param: ref %AdaptCopyable) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc16_3.2(%self.param: ref %AdaptCopyable) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc12_3.2(%self.param: ref %AdaptCopyable) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc16_3.2(%self.param: ref %AdaptCopyable) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc12_3.2(%self.param: ref %AdaptCopyable) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.2(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.2(%self.param) @@ -416,13 +380,13 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %d.var: ref %tuple.type.c35 = var_storage %d.var_patt // CHECK:STDOUT: %c.ref: %tuple.type.c35 = name_ref c, %c -// CHECK:STDOUT: %tuple.elem0.loc35: %AdaptCopyable = tuple_access %c.ref, element0 +// CHECK:STDOUT: %tuple.elem0.loc23: %AdaptCopyable = tuple_access %c.ref, element0 // CHECK:STDOUT: assign %d.var, -// CHECK:STDOUT: %.loc35_29.1: type = splice_block %.loc35_29.3 [concrete = constants.%tuple.type.c35] { -// CHECK:STDOUT: %AdaptCopyable.ref.loc35: type = name_ref AdaptCopyable, file.%AdaptCopyable.decl [concrete = constants.%AdaptCopyable] -// CHECK:STDOUT: %u32.loc35: type = type_literal constants.%u32 [concrete = constants.%u32] -// CHECK:STDOUT: %.loc35_29.2: %tuple.type.693 = tuple_literal (%AdaptCopyable.ref.loc35, %u32.loc35) [concrete = constants.%tuple.0f9] -// CHECK:STDOUT: %.loc35_29.3: type = converted %.loc35_29.2, constants.%tuple.type.c35 [concrete = constants.%tuple.type.c35] +// CHECK:STDOUT: %.loc23_29.1: type = splice_block %.loc23_29.3 [concrete = constants.%tuple.type.c35] { +// CHECK:STDOUT: %AdaptCopyable.ref.loc23: type = name_ref AdaptCopyable, file.%AdaptCopyable.decl [concrete = constants.%AdaptCopyable] +// CHECK:STDOUT: %u32.loc23: type = type_literal constants.%u32 [concrete = constants.%u32] +// CHECK:STDOUT: %.loc23_29.2: %tuple.type.693 = tuple_literal (%AdaptCopyable.ref.loc23, %u32.loc23) [concrete = constants.%tuple.0f9] +// CHECK:STDOUT: %.loc23_29.3: type = converted %.loc23_29.2, constants.%tuple.type.c35 [concrete = constants.%tuple.type.c35] // CHECK:STDOUT: } // CHECK:STDOUT: %d: ref %tuple.type.c35 = wrapper_binding d, %d.var // CHECK:STDOUT: name_binding_decl { @@ -430,40 +394,40 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) { // CHECK:STDOUT: %d.var_patt: %pattern_type.848 = var_pattern %d.patt [concrete = constants.%d.var_patt.66d] // CHECK:STDOUT: } // CHECK:STDOUT: %d.ref: ref %tuple.type.c35 = name_ref d, %d -// CHECK:STDOUT: %tuple.elem0.loc43: ref %AdaptCopyable = tuple_access %d.ref, element0 -// CHECK:STDOUT: %.loc43: %AdaptCopyable = acquire_value %tuple.elem0.loc43 +// CHECK:STDOUT: %tuple.elem0.loc27: ref %AdaptCopyable = tuple_access %d.ref, element0 +// CHECK:STDOUT: %.loc27: %AdaptCopyable = acquire_value %tuple.elem0.loc27 // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %d.var, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.4 // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%d.var) // CHECK:STDOUT: return to %return.param // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc35_3.1(%self.param: ref %u32) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc23_3.1(%self.param: ref %u32) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc35_3.1(%self.param: ref %u32) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc23_3.1(%self.param: ref %u32) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc35_3.1(%self.param: ref %u32) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc23_3.1(%self.param: ref %u32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.3(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.3(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc35_3.2(%self.param: ref %tuple.type.c35) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc23_3.2(%self.param: ref %tuple.type.c35) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] // CHECK:STDOUT: %tuple.elem1: ref %u32 = tuple_access %self.param, element1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc35_3.1: = bound_method %tuple.elem1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.3 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc35_3.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc35_3.1(%tuple.elem1) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc23_3.1: = bound_method %tuple.elem1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.3 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc23_3.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc23_3.1(%tuple.elem1) // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] // CHECK:STDOUT: %tuple.elem0: ref %AdaptCopyable = tuple_access %self.param, element0 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc35_3.2: = bound_method %tuple.elem0, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc35_3.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc35_3.2(%tuple.elem0) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc23_3.2: = bound_method %tuple.elem0, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc23_3.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc23_3.2(%tuple.elem0) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc35_3.2(%self.param: ref %tuple.type.c35) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc23_3.2(%self.param: ref %tuple.type.c35) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc35_3.2(%self.param: ref %tuple.type.c35) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc23_3.2(%self.param: ref %tuple.type.c35) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.4(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.4(%self.param) @@ -980,24 +944,24 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) { // CHECK:STDOUT: %pattern_type.a96: type = pattern_type %empty_struct_type [concrete] // CHECK:STDOUT: %self.param_patt.52f: %pattern_type.a96 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.4b1: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt.52f [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc20_3.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc16_3.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc20_3.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc16_3.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.1: %Destroy.WithSelf.Op.type.ef016f.1 = struct_value () [concrete] // CHECK:STDOUT: %pattern_type.944: type = pattern_type %Noncopyable [concrete] // CHECK:STDOUT: %self.param_patt.648: %pattern_type.944 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.e5a: %pattern_type.944 = wrapper_binding_pattern self, %self.param_patt.648 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc20_3.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc16_3.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc20_3.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc16_3.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.2: %Destroy.WithSelf.Op.type.ef016f.2 = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.f20: %pattern_type.d14 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.b09: %pattern_type.d14 = wrapper_binding_pattern self, %self.param_patt.f20 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc20_3.3 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc16_3.3 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc20_3.3 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc16_3.3 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.3: %Destroy.WithSelf.Op.type.ef016f.3 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.3: type = fn_type @Destroy.WithSelf.SelfDestruct.loc20_3.3 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.3: type = fn_type @Destroy.WithSelf.SelfDestruct.loc16_3.3 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.3: %Destroy.WithSelf.SelfDestruct.type.fbceb5.3 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1013,42 +977,42 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc20_3.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc16_3.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.a96 = ref_param_pattern [concrete = constants.%self.param_patt.52f] // CHECK:STDOUT: %self.patt: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.4b1] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %empty_struct_type = ref_param call_param0 // CHECK:STDOUT: %self: ref %empty_struct_type = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc20_3.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc16_3.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.a96 = ref_param_pattern [concrete = constants.%self.param_patt.52f] // CHECK:STDOUT: %self.patt: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.4b1] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %empty_struct_type = ref_param call_param0 // CHECK:STDOUT: %self: ref %empty_struct_type = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc20_3.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc16_3.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.944 = ref_param_pattern [concrete = constants.%self.param_patt.648] // CHECK:STDOUT: %self.patt: %pattern_type.944 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.e5a] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %Noncopyable = ref_param call_param0 // CHECK:STDOUT: %self: ref %Noncopyable = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc20_3.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc16_3.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.944 = ref_param_pattern [concrete = constants.%self.param_patt.648] // CHECK:STDOUT: %self.patt: %pattern_type.944 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.e5a] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %Noncopyable = ref_param call_param0 // CHECK:STDOUT: %self: ref %Noncopyable = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc20_3.3 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.3] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc16_3.3 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.3] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d14 = ref_param_pattern [concrete = constants.%self.param_patt.f20] // CHECK:STDOUT: %self.patt: %pattern_type.d14 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.b09] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %AdaptNoncopyable = ref_param call_param0 // CHECK:STDOUT: %self: ref %AdaptNoncopyable = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.3: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc20_3.3 [concrete = constants.%Destroy.WithSelf.Op.403171.3] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.3: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc16_3.3 [concrete = constants.%Destroy.WithSelf.Op.403171.3] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d14 = ref_param_pattern [concrete = constants.%self.param_patt.f20] // CHECK:STDOUT: %self.patt: %pattern_type.d14 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.b09] // CHECK:STDOUT: } { @@ -1107,46 +1071,46 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) { // CHECK:STDOUT: %b.var: ref %AdaptNoncopyable = var_storage %b.var_patt // CHECK:STDOUT: %a.ref: %AdaptNoncopyable = name_ref a, %a // CHECK:STDOUT: assign %b.var, -// CHECK:STDOUT: %AdaptNoncopyable.ref.loc20: type = name_ref AdaptNoncopyable, file.%AdaptNoncopyable.decl [concrete = constants.%AdaptNoncopyable] +// CHECK:STDOUT: %AdaptNoncopyable.ref.loc16: type = name_ref AdaptNoncopyable, file.%AdaptNoncopyable.decl [concrete = constants.%AdaptNoncopyable] // CHECK:STDOUT: %b: ref %AdaptNoncopyable = wrapper_binding b, %b.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %b.patt: %pattern_type.d14 = ref_binding_pattern b [concrete = constants.%b.patt] // CHECK:STDOUT: %b.var_patt: %pattern_type.d14 = var_pattern %b.patt [concrete = constants.%b.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %b.ref: ref %AdaptNoncopyable = name_ref b, %b -// CHECK:STDOUT: %.loc28: %AdaptNoncopyable = acquire_value %b.ref +// CHECK:STDOUT: %.loc20: %AdaptNoncopyable = acquire_value %b.ref // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %b.var, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.3 // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%b.var) // CHECK:STDOUT: return to %return.param // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc20_3.1(%self.param: ref %empty_struct_type) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc16_3.1(%self.param: ref %empty_struct_type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc20_3.1(%self.param: ref %empty_struct_type) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc16_3.1(%self.param: ref %empty_struct_type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc20_3.1(%self.param: ref %empty_struct_type) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc16_3.1(%self.param: ref %empty_struct_type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.1(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.1(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc20_3.2(%self.param: ref %Noncopyable) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc16_3.2(%self.param: ref %Noncopyable) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc20_3.2(%self.param: ref %Noncopyable) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc16_3.2(%self.param: ref %Noncopyable) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc20_3.2(%self.param: ref %Noncopyable) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc16_3.2(%self.param: ref %Noncopyable) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.2(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.2(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc20_3.3(%self.param: ref %AdaptNoncopyable) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc16_3.3(%self.param: ref %AdaptNoncopyable) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc20_3.3(%self.param: ref %AdaptNoncopyable) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc16_3.3(%self.param: ref %AdaptNoncopyable) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc20_3.3(%self.param: ref %AdaptNoncopyable) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc16_3.3(%self.param: ref %AdaptNoncopyable) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.3(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.3(%self.param) @@ -1195,45 +1159,45 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) { // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] // CHECK:STDOUT: %self.param_patt.0c5: %pattern_type.d94 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.749: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt.0c5 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc23_3.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc17_3.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc23_3.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc17_3.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.1: %Destroy.WithSelf.Op.type.ef016f.1 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1: type = fn_type @Destroy.WithSelf.SelfDestruct.loc23_3.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1: type = fn_type @Destroy.WithSelf.SelfDestruct.loc17_3.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.1: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1 = struct_value () [concrete] // CHECK:STDOUT: %pattern_type.a96: type = pattern_type %empty_struct_type [concrete] // CHECK:STDOUT: %self.param_patt.52f: %pattern_type.a96 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.4b1: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt.52f [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc23_3.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc17_3.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc23_3.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc17_3.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.2: %Destroy.WithSelf.Op.type.ef016f.2 = struct_value () [concrete] // CHECK:STDOUT: %pattern_type.944: type = pattern_type %Noncopyable [concrete] // CHECK:STDOUT: %self.param_patt.648: %pattern_type.944 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.e5a: %pattern_type.944 = wrapper_binding_pattern self, %self.param_patt.648 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc23_3.3 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc17_3.3 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc23_3.3 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc17_3.3 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.3: %Destroy.WithSelf.Op.type.ef016f.3 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.3: type = fn_type @Destroy.WithSelf.SelfDestruct.loc23_3.3 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.3: type = fn_type @Destroy.WithSelf.SelfDestruct.loc17_3.3 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.3: %Destroy.WithSelf.SelfDestruct.type.fbceb5.3 = struct_value () [concrete] // CHECK:STDOUT: %pattern_type.d28: type = pattern_type %tuple.type.71d [concrete] // CHECK:STDOUT: %self.param_patt.c3d: %pattern_type.d28 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.d63: %pattern_type.d28 = wrapper_binding_pattern self, %self.param_patt.c3d [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc23_3.4 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc17_3.4 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.4: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4 = struct_value () [concrete] // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.4: type = fn_type @Destroy.WithSelf.Op.loc23_3.4 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.4: type = fn_type @Destroy.WithSelf.Op.loc17_3.4 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.4: %Destroy.WithSelf.Op.type.ef016f.4 = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.f8a: %pattern_type.be3 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.021: %pattern_type.be3 = wrapper_binding_pattern self, %self.param_patt.f8a [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.5: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc23_3.5 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.5: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc17_3.5 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.5: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.5 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.5: type = fn_type @Destroy.WithSelf.Op.loc23_3.5 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.5: type = fn_type @Destroy.WithSelf.Op.loc17_3.5 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.5: %Destroy.WithSelf.Op.type.ef016f.5 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.5: type = fn_type @Destroy.WithSelf.SelfDestruct.loc23_3.5 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.5: type = fn_type @Destroy.WithSelf.SelfDestruct.loc17_3.5 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.5: %Destroy.WithSelf.SelfDestruct.type.fbceb5.5 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1253,70 +1217,70 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc23_3.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc17_3.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d94 = ref_param_pattern [concrete = constants.%self.param_patt.0c5] // CHECK:STDOUT: %self.patt: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.749] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %i32 = ref_param call_param0 // CHECK:STDOUT: %self: ref %i32 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc23_3.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc17_3.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d94 = ref_param_pattern [concrete = constants.%self.param_patt.0c5] // CHECK:STDOUT: %self.patt: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.749] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %i32 = ref_param call_param0 // CHECK:STDOUT: %self: ref %i32 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc23_3.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc17_3.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.a96 = ref_param_pattern [concrete = constants.%self.param_patt.52f] // CHECK:STDOUT: %self.patt: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.4b1] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %empty_struct_type = ref_param call_param0 // CHECK:STDOUT: %self: ref %empty_struct_type = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc23_3.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc17_3.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.a96 = ref_param_pattern [concrete = constants.%self.param_patt.52f] // CHECK:STDOUT: %self.patt: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.4b1] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %empty_struct_type = ref_param call_param0 // CHECK:STDOUT: %self: ref %empty_struct_type = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc23_3.3 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.3] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc17_3.3 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.3] { // CHECK:STDOUT: %self.param_patt: %pattern_type.944 = ref_param_pattern [concrete = constants.%self.param_patt.648] // CHECK:STDOUT: %self.patt: %pattern_type.944 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.e5a] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %Noncopyable = ref_param call_param0 // CHECK:STDOUT: %self: ref %Noncopyable = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.3: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc23_3.3 [concrete = constants.%Destroy.WithSelf.Op.403171.3] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.3: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc17_3.3 [concrete = constants.%Destroy.WithSelf.Op.403171.3] { // CHECK:STDOUT: %self.param_patt: %pattern_type.944 = ref_param_pattern [concrete = constants.%self.param_patt.648] // CHECK:STDOUT: %self.patt: %pattern_type.944 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.e5a] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %Noncopyable = ref_param call_param0 // CHECK:STDOUT: %self: ref %Noncopyable = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.4: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc23_3.4 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.4] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.4: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc17_3.4 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.4] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d28 = ref_param_pattern [concrete = constants.%self.param_patt.c3d] // CHECK:STDOUT: %self.patt: %pattern_type.d28 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.d63] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %tuple.type.71d = ref_param call_param0 // CHECK:STDOUT: %self: ref %tuple.type.71d = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.4: %Destroy.WithSelf.Op.type.ef016f.4 = fn_decl @Destroy.WithSelf.Op.loc23_3.4 [concrete = constants.%Destroy.WithSelf.Op.403171.4] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.4: %Destroy.WithSelf.Op.type.ef016f.4 = fn_decl @Destroy.WithSelf.Op.loc17_3.4 [concrete = constants.%Destroy.WithSelf.Op.403171.4] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d28 = ref_param_pattern [concrete = constants.%self.param_patt.c3d] // CHECK:STDOUT: %self.patt: %pattern_type.d28 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.d63] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %tuple.type.71d = ref_param call_param0 // CHECK:STDOUT: %self: ref %tuple.type.71d = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.5: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.5 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc23_3.5 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.5] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.5: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.5 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc17_3.5 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.5] { // CHECK:STDOUT: %self.param_patt: %pattern_type.be3 = ref_param_pattern [concrete = constants.%self.param_patt.f8a] // CHECK:STDOUT: %self.patt: %pattern_type.be3 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.021] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %AdaptNoncopyableIndirect = ref_param call_param0 // CHECK:STDOUT: %self: ref %AdaptNoncopyableIndirect = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.5: %Destroy.WithSelf.Op.type.ef016f.5 = fn_decl @Destroy.WithSelf.Op.loc23_3.5 [concrete = constants.%Destroy.WithSelf.Op.403171.5] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.5: %Destroy.WithSelf.Op.type.ef016f.5 = fn_decl @Destroy.WithSelf.Op.loc17_3.5 [concrete = constants.%Destroy.WithSelf.Op.403171.5] { // CHECK:STDOUT: %self.param_patt: %pattern_type.be3 = ref_param_pattern [concrete = constants.%self.param_patt.f8a] // CHECK:STDOUT: %self.patt: %pattern_type.be3 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.021] // CHECK:STDOUT: } { @@ -1378,107 +1342,107 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %b.var: ref %AdaptNoncopyableIndirect = var_storage %b.var_patt // CHECK:STDOUT: %a.ref: %AdaptNoncopyableIndirect = name_ref a, %a -// CHECK:STDOUT: %.loc23_3.1: %tuple.type.71d = as_compatible %a.ref -// CHECK:STDOUT: %tuple.elem0.loc23_3.1: %i32 = tuple_access %.loc23_3.1, element0 -// CHECK:STDOUT: %impl.elem0.loc23: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] -// CHECK:STDOUT: %bound_method.loc23_3.1: = bound_method %tuple.elem0.loc23_3.1, %impl.elem0.loc23 -// CHECK:STDOUT: %specific_fn.loc23: = specific_function %impl.elem0.loc23, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc23_3.2: = bound_method %tuple.elem0.loc23_3.1, %specific_fn.loc23 -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc23: init %i32 = call %bound_method.loc23_3.2(%tuple.elem0.loc23_3.1) -// CHECK:STDOUT: %.loc23_3.2: ref %tuple.type.71d = as_compatible %b.var -// CHECK:STDOUT: %tuple.elem0.loc23_3.2: ref %i32 = tuple_access %.loc23_3.2, element0 -// CHECK:STDOUT: %.loc23_3.3: init %i32 to %tuple.elem0.loc23_3.2 = in_place_init %Int.as.Copy.impl.Op.call.loc23 -// CHECK:STDOUT: %tuple.elem1.loc23: %Noncopyable = tuple_access %.loc23_3.1, element1 +// CHECK:STDOUT: %.loc17_3.1: %tuple.type.71d = as_compatible %a.ref +// CHECK:STDOUT: %tuple.elem0.loc17_3.1: %i32 = tuple_access %.loc17_3.1, element0 +// CHECK:STDOUT: %impl.elem0.loc17: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] +// CHECK:STDOUT: %bound_method.loc17_3.1: = bound_method %tuple.elem0.loc17_3.1, %impl.elem0.loc17 +// CHECK:STDOUT: %specific_fn.loc17: = specific_function %impl.elem0.loc17, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc17_3.2: = bound_method %tuple.elem0.loc17_3.1, %specific_fn.loc17 +// CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc17: init %i32 = call %bound_method.loc17_3.2(%tuple.elem0.loc17_3.1) +// CHECK:STDOUT: %.loc17_3.2: ref %tuple.type.71d = as_compatible %b.var +// CHECK:STDOUT: %tuple.elem0.loc17_3.2: ref %i32 = tuple_access %.loc17_3.2, element0 +// CHECK:STDOUT: %.loc17_3.3: init %i32 to %tuple.elem0.loc17_3.2 = in_place_init %Int.as.Copy.impl.Op.call.loc17 +// CHECK:STDOUT: %tuple.elem1.loc17: %Noncopyable = tuple_access %.loc17_3.1, element1 // CHECK:STDOUT: assign %b.var, -// CHECK:STDOUT: %AdaptNoncopyableIndirect.ref.loc23: type = name_ref AdaptNoncopyableIndirect, file.%AdaptNoncopyableIndirect.decl [concrete = constants.%AdaptNoncopyableIndirect] +// CHECK:STDOUT: %AdaptNoncopyableIndirect.ref.loc17: type = name_ref AdaptNoncopyableIndirect, file.%AdaptNoncopyableIndirect.decl [concrete = constants.%AdaptNoncopyableIndirect] // CHECK:STDOUT: %b: ref %AdaptNoncopyableIndirect = wrapper_binding b, %b.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %b.patt: %pattern_type.be3 = ref_binding_pattern b [concrete = constants.%b.patt] // CHECK:STDOUT: %b.var_patt: %pattern_type.be3 = var_pattern %b.patt [concrete = constants.%b.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %b.ref: ref %AdaptNoncopyableIndirect = name_ref b, %b -// CHECK:STDOUT: %.loc34_11.1: ref %tuple.type.71d = as_compatible %b.ref -// CHECK:STDOUT: %tuple.elem0.loc34_11.1: ref %i32 = tuple_access %.loc34_11.1, element0 -// CHECK:STDOUT: %.loc34_11.2: %i32 = acquire_value %tuple.elem0.loc34_11.1 -// CHECK:STDOUT: %impl.elem0.loc34: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] -// CHECK:STDOUT: %bound_method.loc34_11.1: = bound_method %.loc34_11.2, %impl.elem0.loc34 -// CHECK:STDOUT: %specific_fn.loc34: = specific_function %impl.elem0.loc34, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc34_11.2: = bound_method %.loc34_11.2, %specific_fn.loc34 -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc34: init %i32 = call %bound_method.loc34_11.2(%.loc34_11.2) -// CHECK:STDOUT: %.loc34_11.3: ref %tuple.type.71d = as_compatible %return.param -// CHECK:STDOUT: %tuple.elem0.loc34_11.2: ref %i32 = tuple_access %.loc34_11.3, element0 -// CHECK:STDOUT: %.loc34_11.4: init %i32 to %tuple.elem0.loc34_11.2 = in_place_init %Int.as.Copy.impl.Op.call.loc34 -// CHECK:STDOUT: %tuple.elem1.loc34: ref %Noncopyable = tuple_access %.loc34_11.1, element1 -// CHECK:STDOUT: %.loc34_11.5: %Noncopyable = acquire_value %tuple.elem1.loc34 +// CHECK:STDOUT: %.loc22_11.1: ref %tuple.type.71d = as_compatible %b.ref +// CHECK:STDOUT: %tuple.elem0.loc22_11.1: ref %i32 = tuple_access %.loc22_11.1, element0 +// CHECK:STDOUT: %.loc22_11.2: %i32 = acquire_value %tuple.elem0.loc22_11.1 +// CHECK:STDOUT: %impl.elem0.loc22: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] +// CHECK:STDOUT: %bound_method.loc22_11.1: = bound_method %.loc22_11.2, %impl.elem0.loc22 +// CHECK:STDOUT: %specific_fn.loc22: = specific_function %impl.elem0.loc22, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc22_11.2: = bound_method %.loc22_11.2, %specific_fn.loc22 +// CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc22: init %i32 = call %bound_method.loc22_11.2(%.loc22_11.2) +// CHECK:STDOUT: %.loc22_11.3: ref %tuple.type.71d = as_compatible %return.param +// CHECK:STDOUT: %tuple.elem0.loc22_11.2: ref %i32 = tuple_access %.loc22_11.3, element0 +// CHECK:STDOUT: %.loc22_11.4: init %i32 to %tuple.elem0.loc22_11.2 = in_place_init %Int.as.Copy.impl.Op.call.loc22 +// CHECK:STDOUT: %tuple.elem1.loc22: ref %Noncopyable = tuple_access %.loc22_11.1, element1 +// CHECK:STDOUT: %.loc22_11.5: %Noncopyable = acquire_value %tuple.elem1.loc22 // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %b.var, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.5 // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%b.var) // CHECK:STDOUT: return to %return.param // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc23_3.1(%self.param: ref %i32) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc17_3.1(%self.param: ref %i32) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc23_3.1(%self.param: ref %i32) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc17_3.1(%self.param: ref %i32) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc23_3.1(%self.param: ref %i32) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc17_3.1(%self.param: ref %i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.1(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.1(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc23_3.2(%self.param: ref %empty_struct_type) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc17_3.2(%self.param: ref %empty_struct_type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc23_3.2(%self.param: ref %empty_struct_type) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc17_3.2(%self.param: ref %empty_struct_type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc23_3.2(%self.param: ref %empty_struct_type) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc17_3.2(%self.param: ref %empty_struct_type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.2(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.2(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc23_3.3(%self.param: ref %Noncopyable) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc17_3.3(%self.param: ref %Noncopyable) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc23_3.3(%self.param: ref %Noncopyable) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc17_3.3(%self.param: ref %Noncopyable) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc23_3.3(%self.param: ref %Noncopyable) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc17_3.3(%self.param: ref %Noncopyable) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.3(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.3(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc23_3.4(%self.param: ref %tuple.type.71d) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc17_3.4(%self.param: ref %tuple.type.71d) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2] // CHECK:STDOUT: %tuple.elem2: ref %i32 = tuple_access %self.param, element2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc23_3.1: = bound_method %tuple.elem2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc23_3.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc23_3.1(%tuple.elem2) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc17_3.1: = bound_method %tuple.elem2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc17_3.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc17_3.1(%tuple.elem2) // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] // CHECK:STDOUT: %tuple.elem1: ref %Noncopyable = tuple_access %self.param, element1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc23_3.2: = bound_method %tuple.elem1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.3 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc23_3.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc23_3.2(%tuple.elem1) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc17_3.2: = bound_method %tuple.elem1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.3 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc17_3.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc17_3.2(%tuple.elem1) // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] // CHECK:STDOUT: %tuple.elem0: ref %i32 = tuple_access %self.param, element0 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc23_3.3: = bound_method %tuple.elem0, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc23_3.3: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc23_3.3(%tuple.elem0) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc17_3.3: = bound_method %tuple.elem0, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc17_3.3: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc17_3.3(%tuple.elem0) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc23_3.4(%self.param: ref %tuple.type.71d) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc17_3.4(%self.param: ref %tuple.type.71d) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc23_3.4(%self.param: ref %tuple.type.71d) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc17_3.4(%self.param: ref %tuple.type.71d) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.4(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.4(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc23_3.5(%self.param: ref %AdaptNoncopyableIndirect) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc17_3.5(%self.param: ref %AdaptNoncopyableIndirect) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc23_3.5(%self.param: ref %AdaptNoncopyableIndirect) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc17_3.5(%self.param: ref %AdaptNoncopyableIndirect) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc23_3.5(%self.param: ref %AdaptNoncopyableIndirect) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc17_3.5(%self.param: ref %AdaptNoncopyableIndirect) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.5(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.5(%self.param) diff --git a/toolchain/check/testdata/class/adapter/convert_incomplete.carbon b/toolchain/check/testdata/class/adapter/convert_incomplete.carbon index 22ff2a60b8fd..37172bc2bbb2 100644 --- a/toolchain/check/testdata/class/adapter/convert_incomplete.carbon +++ b/toolchain/check/testdata/class/adapter/convert_incomplete.carbon @@ -52,12 +52,8 @@ class Adapter(T: type); class X {} 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*)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let unused x: X* = *p as X*; - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+3]]:22-29: error: cannot convert expression of type `Adapter(X)` to `X*` with `as` [ConversionFailure] + // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+2]]:22-29: note: type `Adapter(X)` does not implement interface `Core.As(X*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused x: X* = *p as X*; } diff --git a/toolchain/check/testdata/class/adapter/extend_adapt.carbon b/toolchain/check/testdata/class/adapter/extend_adapt.carbon index 9d0e78297c54..d4096c2dcc85 100644 --- a/toolchain/check/testdata/class/adapter/extend_adapt.carbon +++ b/toolchain/check/testdata/class/adapter/extend_adapt.carbon @@ -52,15 +52,9 @@ class SomeClassAdapter { } 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: a.F(); - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_todo_method_access.carbon:[[@LINE-14]]:8: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn F(self); - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_todo_method_access.carbon:[[@LINE+4]]:3: error: cannot implicitly convert expression of type `SomeClassAdapter` to `SomeClass` [ConversionFailure] + // CHECK:STDERR: fail_todo_method_access.carbon:[[@LINE+3]]:3: note: type `SomeClassAdapter` does not implement interface `Core.ImplicitAs(SomeClass)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: fail_todo_method_access.carbon:[[@LINE-10]]:8-11: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: a.F(); } @@ -79,12 +73,8 @@ class SomeClassAdapter { } 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return a.b; - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_todo_field_access.carbon:[[@LINE+3]]:10-12: error: cannot implicitly convert expression of type `SomeClassAdapter` to `SomeClass` [ConversionFailure] + // CHECK:STDERR: fail_todo_field_access.carbon:[[@LINE+2]]:10-12: note: type `SomeClassAdapter` does not implement interface `Core.ImplicitAs(SomeClass)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return a.b; } @@ -99,9 +89,7 @@ class StructAdapter { fn F(a: StructAdapter) -> i32 { // TODO: This should be allowed. - // CHECK:STDERR: fail_todo_adapt_struct.carbon:[[@LINE+4]]:10: error: member name `b` not found in `StructAdapter` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: return a.b; - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_todo_adapt_struct.carbon:[[@LINE+2]]:10-12: error: member name `b` not found in `StructAdapter` [MemberNameNotFoundInInstScope] // CHECK:STDERR: return a.b; } @@ -116,9 +104,7 @@ class TupleAdapter { fn F(a: TupleAdapter) -> i32 { // TODO: This should be allowed. - // CHECK:STDERR: fail_todo_adapt_tuple.carbon:[[@LINE+4]]:10: error: type `TupleAdapter` does not support tuple indexing; only tuples can be indexed that way [TupleIndexOnANonTupleType] - // CHECK:STDERR: return a.1; - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_todo_adapt_tuple.carbon:[[@LINE+2]]:10-12: error: type `TupleAdapter` does not support tuple indexing; only tuples can be indexed that way [TupleIndexOnANonTupleType] // CHECK:STDERR: return a.1; } @@ -135,9 +121,7 @@ class IntAdapter { fn F(a: IntAdapter) -> i32 { // Builtin types have no member names. - // CHECK:STDERR: fail_adapt_builtin.carbon:[[@LINE+4]]:10: error: member name `foo` not found in `IntAdapter` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: return a.foo; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_adapt_builtin.carbon:[[@LINE+2]]:10-14: error: member name `foo` not found in `IntAdapter` [MemberNameNotFoundInInstScope] // CHECK:STDERR: return a.foo; } @@ -362,7 +346,7 @@ fn F(a: IntAdapter) -> i32 { // CHECK:STDOUT: %a.ref: %SomeClassAdapter = name_ref a, %a // CHECK:STDOUT: %F.ref: %SomeClass.F.type = name_ref F, @SomeClass.%SomeClass.F.decl [concrete = constants.%SomeClass.F] // CHECK:STDOUT: %SomeClass.F.bound: = bound_method %a.ref, %F.ref -// CHECK:STDOUT: %.loc23: %SomeClass = converted %a.ref, [concrete = ] +// CHECK:STDOUT: %.loc17: %SomeClass = converted %a.ref, [concrete = ] // CHECK:STDOUT: %SomeClass.F.call: init %empty_tuple.type = call %SomeClass.F.bound() // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -463,8 +447,8 @@ fn F(a: IntAdapter) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: %SomeClassAdapter = name_ref a, %a // CHECK:STDOUT: %b.ref: %SomeClass.elem = name_ref b, @SomeClass.%field_decl.loc6 [concrete = @SomeClass.%field_decl.loc6] -// CHECK:STDOUT: %.loc21_11.1: %SomeClass = converted %a.ref, [concrete = ] -// CHECK:STDOUT: %.loc21_11.2: %i32 = class_element_access , element1 [concrete = ] +// CHECK:STDOUT: %.loc17_11.1: %SomeClass = converted %a.ref, [concrete = ] +// CHECK:STDOUT: %.loc17_11.2: %i32 = class_element_access , element1 [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: 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 a20dd33e281b..9f19890d2a9a 100644 --- a/toolchain/check/testdata/class/adapter/fail_adapt_bad_decl.carbon +++ b/toolchain/check/testdata/class/adapter/fail_adapt_bad_decl.carbon @@ -15,19 +15,13 @@ library "[[@TEST_NAME]]"; 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: adapt 100; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_not_type.carbon:[[@LINE+3]]:3-12: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: fail_not_type.carbon:[[@LINE+2]]:3-12: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: adapt 100; } -// CHECK:STDERR: fail_not_type.carbon:[[@LINE+4]]:18: error: member name `F` not found in `Bad` [MemberNameNotFoundInInstScope] -// CHECK:STDERR: fn Use(b: Bad) { b.F(); } -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_not_type.carbon:[[@LINE+2]]:18-20: error: member name `F` not found in `Bad` [MemberNameNotFoundInInstScope] // CHECK:STDERR: fn Use(b: Bad) { b.F(); } @@ -36,12 +30,8 @@ fn Use(b: Bad) { b.F(); } library "[[@TEST_NAME]]"; 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: extend adapt 100; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_extend_not_type.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: fail_extend_not_type.carbon:[[@LINE+2]]:3-19: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: extend adapt 100; } @@ -55,24 +45,16 @@ library "[[@TEST_NAME]]"; class MultipleAdapts { adapt (); - // CHECK:STDERR: fail_repeated.carbon:[[@LINE+7]]:3: error: multiple `adapt` declarations in class [AdaptDeclRepeated] - // CHECK:STDERR: adapt {}; - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_repeated.carbon:[[@LINE-4]]:3: note: previous `adapt` declaration is here [ClassSpecificDeclPrevious] - // CHECK:STDERR: adapt (); - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_repeated.carbon:[[@LINE+3]]:3-11: error: multiple `adapt` declarations in class [AdaptDeclRepeated] + // CHECK:STDERR: fail_repeated.carbon:[[@LINE-2]]:3-11: note: previous `adapt` declaration is here [ClassSpecificDeclPrevious] // CHECK:STDERR: adapt {}; } class MultipleAdaptsSameType { adapt (); - // CHECK:STDERR: fail_repeated.carbon:[[@LINE+7]]:3: error: multiple `adapt` declarations in class [AdaptDeclRepeated] - // CHECK:STDERR: adapt (); - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_repeated.carbon:[[@LINE-4]]:3: note: previous `adapt` declaration is here [ClassSpecificDeclPrevious] - // CHECK:STDERR: adapt (); - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_repeated.carbon:[[@LINE+3]]:3-11: error: multiple `adapt` declarations in class [AdaptDeclRepeated] + // CHECK:STDERR: fail_repeated.carbon:[[@LINE-2]]:3-11: note: previous `adapt` declaration is here [ClassSpecificDeclPrevious] // CHECK:STDERR: adapt (); } @@ -81,25 +63,19 @@ class MultipleAdaptsSameType { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_scope.carbon:[[@LINE+4]]:1: error: `adapt` declaration outside class [ClassSpecificDeclOutsideClass] -// CHECK:STDERR: adapt {}; -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_bad_scope.carbon:[[@LINE+2]]:1-9: error: `adapt` declaration outside class [ClassSpecificDeclOutsideClass] // CHECK:STDERR: adapt {}; interface I { - // CHECK:STDERR: fail_bad_scope.carbon:[[@LINE+4]]:3: error: `adapt` declaration outside class [ClassSpecificDeclOutsideClass] - // CHECK:STDERR: adapt {}; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_bad_scope.carbon:[[@LINE+2]]:3-11: error: `adapt` declaration outside class [ClassSpecificDeclOutsideClass] // CHECK:STDERR: adapt {}; } class C { interface I { - // CHECK:STDERR: fail_bad_scope.carbon:[[@LINE+4]]:5: error: `adapt` declaration outside class [ClassSpecificDeclOutsideClass] - // CHECK:STDERR: adapt {}; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_bad_scope.carbon:[[@LINE+2]]:5-13: error: `adapt` declaration outside class [ClassSpecificDeclOutsideClass] // CHECK:STDERR: adapt {}; } diff --git a/toolchain/check/testdata/class/adapter/fail_adapt_bad_type.carbon b/toolchain/check/testdata/class/adapter/fail_adapt_bad_type.carbon index 7fb5a5bb63a6..bfa150b43d6e 100644 --- a/toolchain/check/testdata/class/adapter/fail_adapt_bad_type.carbon +++ b/toolchain/check/testdata/class/adapter/fail_adapt_bad_type.carbon @@ -17,12 +17,8 @@ library "[[@TEST_NAME]]"; class Incomplete; class AdaptIncomplete { - // CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE+7]]:3: error: adapted type `Incomplete` is an incomplete type [IncompleteTypeInAdaptDecl] - // CHECK:STDERR: adapt Incomplete; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE-6]]:1: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: class Incomplete; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE+3]]:3-19: error: adapted type `Incomplete` is an incomplete type [IncompleteTypeInAdaptDecl] + // CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE-4]]:1-17: note: class was forward declared here [ClassForwardDeclaredHere] // CHECK:STDERR: adapt Incomplete; } diff --git a/toolchain/check/testdata/class/adapter/fail_adapt_modifiers.carbon b/toolchain/check/testdata/class/adapter/fail_adapt_modifiers.carbon index fc14e068811d..4889ca89c1d2 100644 --- a/toolchain/check/testdata/class/adapter/fail_adapt_modifiers.carbon +++ b/toolchain/check/testdata/class/adapter/fail_adapt_modifiers.carbon @@ -13,52 +13,38 @@ class B {} class C1 { - // CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+4]]:3: error: `private` not allowed on `adapt` declaration [ModifierNotAllowedOnDeclaration] - // CHECK:STDERR: private adapt B; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+2]]:3-9: error: `private` not allowed on `adapt` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: private adapt B; } class C2 { - // CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+4]]:3: error: `abstract` not allowed on `adapt` declaration [ModifierNotAllowedOnDeclaration] - // CHECK:STDERR: abstract adapt B; - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+2]]:3-10: error: `abstract` not allowed on `adapt` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: abstract adapt B; } class C3 { - // CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+4]]:3: error: `default` not allowed on `adapt` declaration [ModifierNotAllowedOnDeclaration] - // CHECK:STDERR: default adapt B; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+2]]:3-9: error: `default` not allowed on `adapt` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: default adapt B; } class C4 { - // CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+7]]:10: error: `extend` repeated on declaration [ModifierRepeated] - // CHECK:STDERR: extend extend adapt B; - // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+4]]:3: note: `extend` previously appeared here [ModifierPrevious] - // CHECK:STDERR: extend extend adapt B; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+3]]:10-15: error: `extend` repeated on declaration [ModifierRepeated] + // CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+2]]:3-8: note: `extend` previously appeared here [ModifierPrevious] // CHECK:STDERR: extend extend adapt B; } class C5 { - // CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+4]]:3: error: `base` not allowed on `adapt` declaration [ModifierNotAllowedOnDeclaration] - // CHECK:STDERR: base adapt B; - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+2]]:3-6: error: `base` not allowed on `adapt` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: base adapt B; } class C6 { - // CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+4]]:10: error: `base` not allowed on `adapt` declaration [ModifierNotAllowedOnDeclaration] - // CHECK:STDERR: extend base adapt B; - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+2]]:10-13: error: `base` not allowed on `adapt` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: extend base adapt B; } diff --git a/toolchain/check/testdata/class/adapter/fail_adapt_with_base.carbon b/toolchain/check/testdata/class/adapter/fail_adapt_with_base.carbon index 45d244c28557..670339e8921b 100644 --- a/toolchain/check/testdata/class/adapter/fail_adapt_with_base.carbon +++ b/toolchain/check/testdata/class/adapter/fail_adapt_with_base.carbon @@ -12,12 +12,8 @@ class Simple {}; base class AdaptWithVirtual { virtual fn F(self); - // CHECK:STDERR: fail_adapt_with_base.carbon:[[@LINE+7]]:3: error: adapter with virtual function [AdaptWithVirtual] - // CHECK:STDERR: adapt Simple; - // CHECK:STDERR: ^~~~~~~~~~~~~ - // CHECK:STDERR: fail_adapt_with_base.carbon:[[@LINE-4]]:3: note: first virtual function declaration is here [AdaptWithVirtualHere] - // CHECK:STDERR: virtual fn F(self); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_adapt_with_base.carbon:[[@LINE+3]]:3-15: error: adapter with virtual function [AdaptWithVirtual] + // CHECK:STDERR: fail_adapt_with_base.carbon:[[@LINE-2]]:3-21: note: first virtual function declaration is here [AdaptWithVirtualHere] // CHECK:STDERR: adapt Simple; } diff --git a/toolchain/check/testdata/class/adapter/fail_adapt_with_subobjects.carbon b/toolchain/check/testdata/class/adapter/fail_adapt_with_subobjects.carbon index ccf2d1006d09..807d3b34c71e 100644 --- a/toolchain/check/testdata/class/adapter/fail_adapt_with_subobjects.carbon +++ b/toolchain/check/testdata/class/adapter/fail_adapt_with_subobjects.carbon @@ -19,13 +19,9 @@ library "[[@TEST_NAME]]"; base class Base {} class AdaptWithBase { - // CHECK:STDERR: fail_adapt_with_base.carbon:[[@LINE+3]]:3: error: adapter with base class [AdaptWithBase] - // CHECK:STDERR: adapt i32; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_adapt_with_base.carbon:[[@LINE+1]]:3-12: error: adapter with base class [AdaptWithBase] adapt i32; - // CHECK:STDERR: fail_adapt_with_base.carbon:[[@LINE+4]]:3: note: `base` declaration is here [AdaptWithBaseHere] - // CHECK:STDERR: extend base: Base; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_adapt_with_base.carbon:[[@LINE+2]]:3-20: note: `base` declaration is here [AdaptWithBaseHere] // CHECK:STDERR: extend base: Base; } @@ -35,25 +31,17 @@ class AdaptWithBase { library "[[@TEST_NAME]]"; class AdaptWithField { - // CHECK:STDERR: fail_adapt_with_fields.carbon:[[@LINE+3]]:3: error: adapter with fields [AdaptWithFields] - // CHECK:STDERR: adapt i32; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_adapt_with_fields.carbon:[[@LINE+1]]:3-12: error: adapter with fields [AdaptWithFields] adapt i32; - // CHECK:STDERR: fail_adapt_with_fields.carbon:[[@LINE+4]]:7: note: first field declaration is here [AdaptWithFieldHere] - // CHECK:STDERR: var n: i32; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_adapt_with_fields.carbon:[[@LINE+2]]:7-12: note: first field declaration is here [AdaptWithFieldHere] // CHECK:STDERR: var n: i32; } class AdaptWithFields { - // CHECK:STDERR: fail_adapt_with_fields.carbon:[[@LINE+3]]:3: error: adapter with fields [AdaptWithFields] - // CHECK:STDERR: adapt i32; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_adapt_with_fields.carbon:[[@LINE+1]]:3-12: error: adapter with fields [AdaptWithFields] adapt i32; - // CHECK:STDERR: fail_adapt_with_fields.carbon:[[@LINE+4]]:7: note: first field declaration is here [AdaptWithFieldHere] - // CHECK:STDERR: var a: i32; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_adapt_with_fields.carbon:[[@LINE+2]]:7-12: note: first field declaration is here [AdaptWithFieldHere] // CHECK:STDERR: var a: i32; var b: i32; @@ -69,12 +57,8 @@ base class Base {} class AdaptWithBaseAndFields { extend base: Base; var n: i32; - // CHECK:STDERR: fail_adapt_with_base_and_fields.carbon:[[@LINE+7]]:3: error: adapter with base class [AdaptWithBase] - // CHECK:STDERR: adapt {}; - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_adapt_with_base_and_fields.carbon:[[@LINE-5]]:3: note: `base` declaration is here [AdaptWithBaseHere] - // CHECK:STDERR: extend base: Base; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_adapt_with_base_and_fields.carbon:[[@LINE+3]]:3-11: error: adapter with base class [AdaptWithBase] + // CHECK:STDERR: fail_adapt_with_base_and_fields.carbon:[[@LINE-3]]:3-20: note: `base` declaration is here [AdaptWithBaseHere] // CHECK:STDERR: adapt {}; } @@ -126,13 +110,13 @@ class AdaptWithBaseAndFields { // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: adapt_decl %i32 [concrete] // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [concrete = constants.%Base] -// CHECK:STDOUT: %.loc15: %AdaptWithBase.elem = base_decl %Base.ref, element [concrete] +// CHECK:STDOUT: %.loc11: %AdaptWithBase.elem = base_decl %Base.ref, element [concrete] // CHECK:STDOUT: complete_type_witness = // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%AdaptWithBase // CHECK:STDOUT: .Base = -// CHECK:STDOUT: .base = %.loc15 +// CHECK:STDOUT: .base = %.loc11 // CHECK:STDOUT: extend %Base.ref // CHECK:STDOUT: } // CHECK:STDOUT: @@ -171,10 +155,10 @@ class AdaptWithBaseAndFields { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @AdaptWithField { -// CHECK:STDOUT: %i32.loc8: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: adapt_decl %i32.loc8 [concrete] -// CHECK:STDOUT: %field_decl: %AdaptWithField.elem = field_decl n, element, %i32.loc13 in [concrete] { -// CHECK:STDOUT: %i32.loc13: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc6: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: adapt_decl %i32.loc6 [concrete] +// CHECK:STDOUT: %field_decl: %AdaptWithField.elem = field_decl n, element, %i32.loc9 in [concrete] { +// CHECK:STDOUT: %i32.loc9: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: complete_type_witness = // CHECK:STDOUT: @@ -184,24 +168,24 @@ class AdaptWithBaseAndFields { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @AdaptWithFields { -// CHECK:STDOUT: %i32.loc20: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: adapt_decl %i32.loc20 [concrete] -// CHECK:STDOUT: %field_decl.loc25: %AdaptWithFields.elem = field_decl a, element, %i32.loc25 in [concrete] { -// CHECK:STDOUT: %i32.loc25: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc14: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: adapt_decl %i32.loc14 [concrete] +// CHECK:STDOUT: %field_decl.loc17: %AdaptWithFields.elem = field_decl a, element, %i32.loc17 in [concrete] { +// CHECK:STDOUT: %i32.loc17: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: } -// CHECK:STDOUT: %field_decl.loc26: %AdaptWithFields.elem = field_decl b, element, %i32.loc26 in [concrete] { -// CHECK:STDOUT: %i32.loc26: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %field_decl.loc18: %AdaptWithFields.elem = field_decl b, element, %i32.loc18 in [concrete] { +// CHECK:STDOUT: %i32.loc18: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: } -// CHECK:STDOUT: %field_decl.loc27: %AdaptWithFields.elem = field_decl c, element, %i32.loc27 in [concrete] { -// CHECK:STDOUT: %i32.loc27: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %field_decl.loc19: %AdaptWithFields.elem = field_decl c, element, %i32.loc19 in [concrete] { +// CHECK:STDOUT: %i32.loc19: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: complete_type_witness = // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%AdaptWithFields -// CHECK:STDOUT: .a = %field_decl.loc25 -// CHECK:STDOUT: .b = %field_decl.loc26 -// CHECK:STDOUT: .c = %field_decl.loc27 +// CHECK:STDOUT: .a = %field_decl.loc17 +// CHECK:STDOUT: .b = %field_decl.loc18 +// CHECK:STDOUT: .c = %field_decl.loc19 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_adapt_with_base_and_fields.carbon @@ -255,9 +239,9 @@ class AdaptWithBaseAndFields { // CHECK:STDOUT: %field_decl: %AdaptWithBaseAndFields.elem.a86 = field_decl n, element, %i32 in [concrete] { // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc16_10: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc16_11: type = converted %.loc16_10, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: adapt_decl %.loc16_11 [concrete] +// CHECK:STDOUT: %.loc12_10: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc12_11: type = converted %.loc12_10, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: adapt_decl %.loc12_11 [concrete] // CHECK:STDOUT: complete_type_witness = // CHECK:STDOUT: // CHECK:STDOUT: !members: diff --git a/toolchain/check/testdata/class/adapter/init_adapt.carbon b/toolchain/check/testdata/class/adapter/init_adapt.carbon index d6b800344e49..79f2734f1f6a 100644 --- a/toolchain/check/testdata/class/adapter/init_adapt.carbon +++ b/toolchain/check/testdata/class/adapter/init_adapt.carbon @@ -56,21 +56,13 @@ let a: C = {.a = 1, .b = 2}; // Cannot implicitly convert between a type and an adapter for the type. -// 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)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: let b: AdaptC = a; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+3]]:17: error: cannot implicitly convert expression of type `C` to `AdaptC` [ConversionFailure] +// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+2]]:17: note: type `C` does not implement interface `Core.ImplicitAs(AdaptC)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: 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)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: let c: C = b; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+3]]:12: error: cannot implicitly convert expression of type `AdaptC` to `C` [ConversionFailure] +// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+2]]:12: note: type `AdaptC` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let c: C = b; @@ -78,21 +70,13 @@ fn MakeC() -> C; 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)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var d: AdaptC = MakeC(); -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+3]]:1-13: error: cannot implicitly convert expression of type `C` to `AdaptC` [ConversionFailure] +// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+2]]:1-13: note: type `C` does not implement interface `Core.ImplicitAs(AdaptC)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: 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)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var e: C = MakeAdaptC(); -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+3]]:1-8: error: cannot implicitly convert expression of type `AdaptC` to `C` [ConversionFailure] +// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+2]]:1-8: note: type `AdaptC` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var e: C = MakeAdaptC(); @@ -429,14 +413,14 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %a.patt: %pattern_type.98b = value_binding_pattern a [concrete = constants.%a.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc24: %AdaptC = converted @__global_init.%a.ref, [concrete = ] -// CHECK:STDOUT: %AdaptC.ref.loc24: type = name_ref AdaptC, %AdaptC.decl [concrete = constants.%AdaptC] +// CHECK:STDOUT: %.loc20: %AdaptC = converted @__global_init.%a.ref, [concrete = ] +// CHECK:STDOUT: %AdaptC.ref.loc20: type = name_ref AdaptC, %AdaptC.decl [concrete = constants.%AdaptC] // CHECK:STDOUT: %b: %AdaptC = wrapper_binding b, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %b.patt: %pattern_type.720 = value_binding_pattern b [concrete = constants.%b.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc33: %C = converted @__global_init.%b.ref, [concrete = ] -// CHECK:STDOUT: %C.ref.loc33: type = name_ref C, %C.decl [concrete = constants.%C] +// CHECK:STDOUT: %.loc25: %C = converted @__global_init.%b.ref, [concrete = ] +// CHECK:STDOUT: %C.ref.loc25: type = name_ref C, %C.decl [concrete = constants.%C] // CHECK:STDOUT: %c: %C = wrapper_binding c, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %c.patt: %pattern_type.98b = value_binding_pattern c [concrete = constants.%c.patt] @@ -446,7 +430,7 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: %return.patt: %pattern_type.98b = return_slot_pattern %return.param_patt, %C.ref [concrete = constants.%return.patt.e4a] // CHECK:STDOUT: } { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc35: Core.Form = init_form %C.ref [concrete = constants.%.a44] +// CHECK:STDOUT: %.loc27: Core.Form = init_form %C.ref [concrete = constants.%.a44] // CHECK:STDOUT: %return.param: ref %C = out_param call_param0 // CHECK:STDOUT: %return: ref %C = return_slot %return.param // CHECK:STDOUT: } @@ -455,19 +439,19 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: %return.patt: %pattern_type.720 = return_slot_pattern %return.param_patt, %AdaptC.ref [concrete = constants.%return.patt.794] // CHECK:STDOUT: } { // CHECK:STDOUT: %AdaptC.ref: type = name_ref AdaptC, file.%AdaptC.decl [concrete = constants.%AdaptC] -// CHECK:STDOUT: %.loc37: Core.Form = init_form %AdaptC.ref [concrete = constants.%.624] +// CHECK:STDOUT: %.loc29: Core.Form = init_form %AdaptC.ref [concrete = constants.%.624] // CHECK:STDOUT: %return.param: ref %AdaptC = out_param call_param0 // CHECK:STDOUT: %return: ref %AdaptC = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %d.var: ref %AdaptC = var_storage %d.var_patt [concrete] -// CHECK:STDOUT: %AdaptC.ref.loc46: type = name_ref AdaptC, %AdaptC.decl [concrete = constants.%AdaptC] +// CHECK:STDOUT: %AdaptC.ref.loc34: type = name_ref AdaptC, %AdaptC.decl [concrete = constants.%AdaptC] // CHECK:STDOUT: %d: ref %AdaptC = wrapper_binding d, %d.var [concrete = %d.var] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %d.patt: %pattern_type.720 = ref_binding_pattern d [concrete = constants.%d.patt] // CHECK:STDOUT: %d.var_patt: %pattern_type.720 = var_pattern %d.patt [concrete = constants.%d.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %e.var: ref %C = var_storage %e.var_patt [concrete] -// CHECK:STDOUT: %C.ref.loc55: type = name_ref C, %C.decl [concrete = constants.%C] +// CHECK:STDOUT: %C.ref.loc39: type = name_ref C, %C.decl [concrete = constants.%C] // CHECK:STDOUT: %e: ref %C = wrapper_binding e, %e.var [concrete = %e.var] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %e.patt: %pattern_type.98b = ref_binding_pattern e [concrete = constants.%e.patt] @@ -514,14 +498,14 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: %a.ref: %C = name_ref a, file.%a // CHECK:STDOUT: %b.ref: %AdaptC = name_ref b, file.%b [concrete = ] // CHECK:STDOUT: %MakeC.ref: %MakeC.type = name_ref MakeC, file.%MakeC.decl [concrete = constants.%MakeC] -// CHECK:STDOUT: %.loc46_23: ref %C = temporary_storage -// CHECK:STDOUT: %MakeC.call: init %C to %.loc46_23 = call %MakeC.ref() -// CHECK:STDOUT: %.loc46_1: %AdaptC = converted %MakeC.call, [concrete = ] +// CHECK:STDOUT: %.loc34_23: ref %C = temporary_storage +// CHECK:STDOUT: %MakeC.call: init %C to %.loc34_23 = call %MakeC.ref() +// CHECK:STDOUT: %.loc34_1: %AdaptC = converted %MakeC.call, [concrete = ] // CHECK:STDOUT: assign file.%d.var, // CHECK:STDOUT: %MakeAdaptC.ref: %MakeAdaptC.type = name_ref MakeAdaptC, file.%MakeAdaptC.decl [concrete = constants.%MakeAdaptC] -// CHECK:STDOUT: %.loc55_23: ref %AdaptC = temporary_storage -// CHECK:STDOUT: %MakeAdaptC.call: init %AdaptC to %.loc55_23 = call %MakeAdaptC.ref() -// CHECK:STDOUT: %.loc55_1: %C = converted %MakeAdaptC.call, [concrete = ] +// CHECK:STDOUT: %.loc39_23: ref %AdaptC = temporary_storage +// CHECK:STDOUT: %MakeAdaptC.call: init %AdaptC to %.loc39_23 = call %MakeAdaptC.ref() +// CHECK:STDOUT: %.loc39_1: %C = converted %MakeAdaptC.call, [concrete = ] // CHECK:STDOUT: assign file.%e.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/cross_package_import.carbon b/toolchain/check/testdata/class/cross_package_import.carbon index 2a3c66e252a2..250181388c22 100644 --- a/toolchain/check/testdata/class/cross_package_import.carbon +++ b/toolchain/check/testdata/class/cross_package_import.carbon @@ -52,13 +52,9 @@ library "[[@TEST_NAME]]"; import Other library "other_extern"; -// CHECK:STDERR: fail_extern.carbon:[[@LINE+8]]:8: error: binding pattern has incomplete type `C` in name binding declaration [IncompleteTypeInBindingDecl] -// CHECK:STDERR: var c: Other.C = {}; -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_extern.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: other_extern.carbon:4:1: note: class was forward declared here [ClassForwardDeclaredHere] -// CHECK:STDERR: extern class C; -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_extern.carbon:[[@LINE+4]]:8-14: error: binding pattern has incomplete type `C` in name binding declaration [IncompleteTypeInBindingDecl] +// CHECK:STDERR: imported from: fail_extern.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: other_extern.carbon:4:1-15: note: class was forward declared here [ClassForwardDeclaredHere] // CHECK:STDERR: var c: Other.C = {}; @@ -66,20 +62,14 @@ var c: Other.C = {}; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_todo_merge_define_extern.carbon:[[@LINE+8]]:1: in import [InImport] -// CHECK:STDERR: other_extern.carbon:4:1: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: extern class C; -// CHECK:STDERR: ^~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_todo_merge_define_extern.carbon:[[@LINE+4]]:1: in import [InImport] -// CHECK:STDERR: other_define.carbon:4:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: class C {} -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: imported from: fail_todo_merge_define_extern.carbon:[[@LINE+4]]:1 [InImport] +// CHECK:STDERR: other_extern.carbon:4:1-15: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_todo_merge_define_extern.carbon:[[@LINE+2]]:1 [InImport] +// CHECK:STDERR: other_define.carbon:4:1-9: note: name is previously declared here [NameDeclPrevious] import Other library "other_define"; import Other library "other_extern"; -// CHECK:STDERR: fail_todo_merge_define_extern.carbon:[[@LINE+4]]:8: note: in name lookup for `C` [InNameLookup] -// CHECK:STDERR: var c: Other.C = {}; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_todo_merge_define_extern.carbon:[[@LINE+2]]:8-14: note: in name lookup for `C` [InNameLookup] // CHECK:STDERR: var c: Other.C = {}; @@ -87,20 +77,14 @@ var c: Other.C = {}; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+8]]:1: in import [InImport] -// CHECK:STDERR: other_conflict.carbon:4:1: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: fn C() {} -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+4]]:1: in import [InImport] -// CHECK:STDERR: other_define.carbon:4:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: class C {} -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: imported from: fail_conflict.carbon:[[@LINE+4]]:1 [InImport] +// CHECK:STDERR: other_conflict.carbon:4:1-8: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_conflict.carbon:[[@LINE+2]]:1 [InImport] +// CHECK:STDERR: other_define.carbon:4:1-9: note: name is previously declared here [NameDeclPrevious] import Other library "other_define"; import Other library "other_conflict"; -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+4]]:8: note: in name lookup for `C` [InNameLookup] -// CHECK:STDERR: var c: Other.C = {}; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_conflict.carbon:[[@LINE+2]]:8-14: note: in name lookup for `C` [InNameLookup] // CHECK:STDERR: var c: Other.C = {}; @@ -285,7 +269,7 @@ var c: Other.C = {}; // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %Other.import = import Other // CHECK:STDOUT: %c.var: ref = var_storage %c.var_patt [concrete = ] -// CHECK:STDOUT: %.loc14: type = splice_block %C.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc10: type = splice_block %C.ref [concrete = constants.%C] { // CHECK:STDOUT: %Other.ref: = name_ref Other, imports.%Other [concrete = imports.%Other] // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Other.C [concrete = constants.%C] // CHECK:STDOUT: } @@ -300,7 +284,7 @@ var c: Other.C = {}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc14: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc10: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: assign file.%c.var, // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -343,7 +327,7 @@ var c: Other.C = {}; // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %Other.import = import Other // CHECK:STDOUT: %c.var: ref %C = var_storage %c.var_patt [concrete] -// CHECK:STDOUT: %.loc19: type = splice_block %C.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc13: type = splice_block %C.ref [concrete = constants.%C] { // CHECK:STDOUT: %Other.ref: = name_ref Other, imports.%Other [concrete = imports.%Other] // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Other.C [concrete = constants.%C] // CHECK:STDOUT: } @@ -363,10 +347,10 @@ var c: Other.C = {}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc19_19.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc19_19.2: init %C to file.%c.var = class_init () [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc19_1: init %C = converted %.loc19_19.1, %.loc19_19.2 [concrete = constants.%C.val] -// CHECK:STDOUT: assign file.%c.var, %.loc19_1 +// CHECK:STDOUT: %.loc13_19.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc13_19.2: init %C to file.%c.var = class_init () [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc13_1: init %C = converted %.loc13_19.1, %.loc13_19.2 [concrete = constants.%C.val] +// CHECK:STDOUT: assign file.%c.var, %.loc13_1 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -408,7 +392,7 @@ var c: Other.C = {}; // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %Other.import = import Other // CHECK:STDOUT: %c.var: ref %C = var_storage %c.var_patt [concrete] -// CHECK:STDOUT: %.loc19: type = splice_block %C.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc13: type = splice_block %C.ref [concrete = constants.%C] { // CHECK:STDOUT: %Other.ref: = name_ref Other, imports.%Other [concrete = imports.%Other] // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Other.C [concrete = constants.%C] // CHECK:STDOUT: } @@ -428,10 +412,10 @@ var c: Other.C = {}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc19_19.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc19_19.2: init %C to file.%c.var = class_init () [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc19_1: init %C = converted %.loc19_19.1, %.loc19_19.2 [concrete = constants.%C.val] -// CHECK:STDOUT: assign file.%c.var, %.loc19_1 +// CHECK:STDOUT: %.loc13_19.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc13_19.2: init %C to file.%c.var = class_init () [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc13_1: init %C = converted %.loc13_19.1, %.loc13_19.2 [concrete = constants.%C.val] +// CHECK:STDOUT: assign file.%c.var, %.loc13_1 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/extern.carbon b/toolchain/check/testdata/class/extern.carbon index cd2ff10dccdd..a0847b23fd93 100644 --- a/toolchain/check/testdata/class/extern.carbon +++ b/toolchain/check/testdata/class/extern.carbon @@ -49,12 +49,8 @@ class C {} library "[[@TEST_NAME]]"; extern class C; -// CHECK:STDERR: fail_decl_fn_in_extern.carbon:[[@LINE+7]]:4: error: cannot declare a member of incomplete class `C` [QualifiedDeclInIncompleteClassScope] -// CHECK:STDERR: fn C.F(); -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_decl_fn_in_extern.carbon:[[@LINE-4]]:1: note: class was forward declared here [ClassForwardDeclaredHere] -// CHECK:STDERR: extern class C; -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_decl_fn_in_extern.carbon:[[@LINE+3]]:4: error: cannot declare a member of incomplete class `C` [QualifiedDeclInIncompleteClassScope] +// CHECK:STDERR: fail_decl_fn_in_extern.carbon:[[@LINE-2]]:1-15: note: class was forward declared here [ClassForwardDeclaredHere] // CHECK:STDERR: fn C.F(); @@ -69,12 +65,8 @@ extern class C {} library "[[@TEST_NAME]]"; extern class C; -// CHECK:STDERR: fail_extern_decl_after_extern_decl.carbon:[[@LINE+7]]:1: error: redeclaration of `class C` is redundant [RedeclRedundant] -// CHECK:STDERR: extern class C; -// CHECK:STDERR: ^~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_extern_decl_after_extern_decl.carbon:[[@LINE-4]]:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: extern class C; -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_extern_decl_after_extern_decl.carbon:[[@LINE+3]]:1-15: error: redeclaration of `class C` is redundant [RedeclRedundant] +// CHECK:STDERR: fail_extern_decl_after_extern_decl.carbon:[[@LINE-2]]:1-15: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: extern class C; @@ -83,12 +75,8 @@ extern class C; library "[[@TEST_NAME]]"; extern class C; -// CHECK:STDERR: fail_decl_after_extern_decl.carbon:[[@LINE+7]]:1: error: redeclaration of `class C` is redundant [RedeclRedundant] -// CHECK:STDERR: class C; -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_decl_after_extern_decl.carbon:[[@LINE-4]]:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: extern class C; -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_decl_after_extern_decl.carbon:[[@LINE+3]]:1-8: error: redeclaration of `class C` is redundant [RedeclRedundant] +// CHECK:STDERR: fail_decl_after_extern_decl.carbon:[[@LINE-2]]:1-15: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: class C; @@ -97,9 +85,7 @@ class C; library "[[@TEST_NAME]]"; class C { - // CHECK:STDERR: fail_extern_member_class.carbon:[[@LINE+4]]:3: error: `extern` not allowed; requires file or namespace scope [ModifierExternNotAllowed] - // CHECK:STDERR: extern class D; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_extern_member_class.carbon:[[@LINE+2]]:3-8: error: `extern` not allowed; requires file or namespace scope [ModifierExternNotAllowed] // CHECK:STDERR: extern class D; } @@ -109,12 +95,8 @@ class C { library "[[@TEST_NAME]]"; extern class C; -// CHECK:STDERR: fail_def_after_extern_decl.carbon:[[@LINE+7]]:1: error: redeclarations of `class C` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: class C {} -// CHECK:STDERR: ^~~~~~~~~ -// CHECK:STDERR: fail_def_after_extern_decl.carbon:[[@LINE-4]]:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: extern class C; -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_def_after_extern_decl.carbon:[[@LINE+3]]:1-9: error: redeclarations of `class C` must match use of `extern` [RedeclExternMismatch] +// CHECK:STDERR: fail_def_after_extern_decl.carbon:[[@LINE-2]]:1-15: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: class C {} @@ -123,12 +105,8 @@ class C {} library "[[@TEST_NAME]]"; class C; -// CHECK:STDERR: fail_extern_decl_after_decl.carbon:[[@LINE+7]]:1: error: redeclaration of `class C` is redundant [RedeclRedundant] -// CHECK:STDERR: extern class C; -// CHECK:STDERR: ^~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_extern_decl_after_decl.carbon:[[@LINE-4]]:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: class C; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_extern_decl_after_decl.carbon:[[@LINE+3]]:1-15: error: redeclaration of `class C` is redundant [RedeclRedundant] +// CHECK:STDERR: fail_extern_decl_after_decl.carbon:[[@LINE-2]]:1-8: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: extern class C; @@ -136,14 +114,10 @@ extern class C; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_extern_decl_then_decl.carbon:[[@LINE+9]]:1: in import [InImport] -// CHECK:STDERR: decl.carbon:4:1: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: class C; -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_import_extern_decl_then_decl.carbon:[[@LINE+5]]:1: in import [InImport] -// CHECK:STDERR: extern_decl.carbon:4:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: extern class C; -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: imported from: fail_import_extern_decl_then_decl.carbon:[[@LINE+5]]:1 [InImport] +// CHECK:STDERR: decl.carbon:4:1-8: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_import_extern_decl_then_decl.carbon:[[@LINE+3]]:1 [InImport] +// CHECK:STDERR: extern_decl.carbon:4:1-15: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: import library "extern_decl"; import library "decl"; @@ -152,14 +126,10 @@ import library "decl"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_decl_then_extern_decl.carbon:[[@LINE+9]]:1: in import [InImport] -// CHECK:STDERR: extern_decl.carbon:4:1: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: extern class C; -// CHECK:STDERR: ^~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_import_decl_then_extern_decl.carbon:[[@LINE+5]]:1: in import [InImport] -// CHECK:STDERR: decl.carbon:4:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: class C; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: imported from: fail_import_decl_then_extern_decl.carbon:[[@LINE+5]]:1 [InImport] +// CHECK:STDERR: extern_decl.carbon:4:1-15: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_import_decl_then_extern_decl.carbon:[[@LINE+3]]:1 [InImport] +// CHECK:STDERR: decl.carbon:4:1-8: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: import library "decl"; import library "extern_decl"; @@ -168,14 +138,10 @@ import library "extern_decl"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_extern_decl_then_def.carbon:[[@LINE+9]]:1: in import [InImport] -// CHECK:STDERR: def.carbon:4:1: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: class C {} -// CHECK:STDERR: ^~~~~~~~~ -// CHECK:STDERR: fail_import_extern_decl_then_def.carbon:[[@LINE+5]]:1: in import [InImport] -// CHECK:STDERR: extern_decl.carbon:4:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: extern class C; -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: imported from: fail_import_extern_decl_then_def.carbon:[[@LINE+5]]:1 [InImport] +// CHECK:STDERR: def.carbon:4:1-9: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_import_extern_decl_then_def.carbon:[[@LINE+3]]:1 [InImport] +// CHECK:STDERR: extern_decl.carbon:4:1-15: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: import library "extern_decl"; import library "def"; @@ -184,23 +150,15 @@ import library "def"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_ownership_conflict.carbon:[[@LINE+18]]:1: in import [InImport] -// CHECK:STDERR: decl.carbon:4:1: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: class C; -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_import_ownership_conflict.carbon:[[@LINE+14]]:1: in import [InImport] -// CHECK:STDERR: extern_decl.carbon:4:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: extern class C; -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: imported from: fail_import_ownership_conflict.carbon:[[@LINE+10]]:1 [InImport] +// CHECK:STDERR: decl.carbon:4:1-8: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_import_ownership_conflict.carbon:[[@LINE+8]]:1 [InImport] +// CHECK:STDERR: extern_decl.carbon:4:1-15: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: -// CHECK:STDERR: fail_import_ownership_conflict.carbon:[[@LINE+9]]:1: in import [InImport] -// CHECK:STDERR: def.carbon:4:1: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: class C {} -// CHECK:STDERR: ^~~~~~~~~ -// CHECK:STDERR: fail_import_ownership_conflict.carbon:[[@LINE+5]]:1: in import [InImport] -// CHECK:STDERR: extern_decl.carbon:4:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: extern class C; -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: imported from: fail_import_ownership_conflict.carbon:[[@LINE+5]]:1 [InImport] +// CHECK:STDERR: def.carbon:4:1-9: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_import_ownership_conflict.carbon:[[@LINE+3]]:1 [InImport] +// CHECK:STDERR: extern_decl.carbon:4:1-15: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: import library "extern_decl"; import library "decl"; @@ -210,14 +168,10 @@ import library "def"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_todo_import_extern_decl_copy.carbon:[[@LINE+9]]:1: in import [InImport] -// CHECK:STDERR: extern_decl_copy.carbon:4:1: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: extern class C; -// CHECK:STDERR: ^~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_todo_import_extern_decl_copy.carbon:[[@LINE+5]]:1: in import [InImport] -// CHECK:STDERR: extern_decl.carbon:4:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: extern class C; -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: imported from: fail_todo_import_extern_decl_copy.carbon:[[@LINE+5]]:1 [InImport] +// CHECK:STDERR: extern_decl_copy.carbon:4:1-15: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_todo_import_extern_decl_copy.carbon:[[@LINE+3]]:1 [InImport] +// CHECK:STDERR: extern_decl.carbon:4:1-15: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: import library "extern_decl"; import library "extern_decl_copy"; @@ -228,13 +182,9 @@ library "[[@TEST_NAME]]"; import library "extern_decl"; -// CHECK:STDERR: fail_extern_decl_after_import_extern_decl.carbon:[[@LINE+8]]:1: error: redeclaration of `class C` is redundant [RedeclRedundant] -// CHECK:STDERR: extern class C; -// CHECK:STDERR: ^~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_extern_decl_after_import_extern_decl.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: extern_decl.carbon:4:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: extern class C; -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_extern_decl_after_import_extern_decl.carbon:[[@LINE+4]]:1-15: error: redeclaration of `class C` is redundant [RedeclRedundant] +// CHECK:STDERR: imported from: fail_extern_decl_after_import_extern_decl.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: extern_decl.carbon:4:1-15: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: extern class C; @@ -244,13 +194,9 @@ library "[[@TEST_NAME]]"; import library "decl"; -// CHECK:STDERR: fail_decl_after_import_extern_decl.carbon:[[@LINE+8]]:1: error: redeclarations of `class C` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: extern class C; -// CHECK:STDERR: ^~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_decl_after_import_extern_decl.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: decl.carbon:4:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: class C; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_decl_after_import_extern_decl.carbon:[[@LINE+4]]:1-15: error: redeclarations of `class C` must match use of `extern` [RedeclExternMismatch] +// CHECK:STDERR: imported from: fail_decl_after_import_extern_decl.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: decl.carbon:4:1-8: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: extern class C; @@ -260,13 +206,9 @@ library "[[@TEST_NAME]]"; import library "def"; -// CHECK:STDERR: fail_def_after_import_extern_decl.carbon:[[@LINE+8]]:1: error: redeclarations of `class C` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: extern class C; -// CHECK:STDERR: ^~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_def_after_import_extern_decl.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: def.carbon:4:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: class C {} -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_def_after_import_extern_decl.carbon:[[@LINE+4]]:1-15: error: redeclarations of `class C` must match use of `extern` [RedeclExternMismatch] +// CHECK:STDERR: imported from: fail_def_after_import_extern_decl.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: def.carbon:4:1-9: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: extern class C; @@ -276,13 +218,9 @@ library "[[@TEST_NAME]]"; import library "def"; -// CHECK:STDERR: fail_extern_decl_after_import_def.carbon:[[@LINE+8]]:1: error: redeclarations of `class C` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: extern class C; -// CHECK:STDERR: ^~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_extern_decl_after_import_def.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: def.carbon:4:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: class C {} -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_extern_decl_after_import_def.carbon:[[@LINE+4]]:1-15: error: redeclarations of `class C` must match use of `extern` [RedeclExternMismatch] +// CHECK:STDERR: imported from: fail_extern_decl_after_import_def.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: def.carbon:4:1-9: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: extern class C; @@ -415,7 +353,7 @@ extern class C; // CHECK:STDOUT: .C = %C.decl.loc4 // CHECK:STDOUT: } // CHECK:STDOUT: %C.decl.loc4: type = class_decl @C [concrete = constants.%C] {} {} -// CHECK:STDOUT: %C.decl.loc12: type = class_decl @C [concrete = constants.%C] {} {} +// CHECK:STDOUT: %C.decl.loc8: type = class_decl @C [concrete = constants.%C] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C; @@ -429,10 +367,10 @@ extern class C; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .C = %C.decl.loc12 +// CHECK:STDOUT: .C = %C.decl.loc8 // CHECK:STDOUT: } // CHECK:STDOUT: %C.decl.loc4: type = class_decl @C [concrete = constants.%C] {} {} -// CHECK:STDOUT: %C.decl.loc12: type = class_decl @C [concrete = constants.%C] {} {} +// CHECK:STDOUT: %C.decl.loc8: type = class_decl @C [concrete = constants.%C] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C; @@ -477,10 +415,10 @@ extern class C; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .C = %C.decl.loc12 +// CHECK:STDOUT: .C = %C.decl.loc8 // CHECK:STDOUT: } // CHECK:STDOUT: %C.decl.loc4: type = class_decl @C [concrete = constants.%C] {} {} -// CHECK:STDOUT: %C.decl.loc12: type = class_decl @C [concrete = constants.%C] {} {} +// CHECK:STDOUT: %C.decl.loc8: type = class_decl @C [concrete = constants.%C] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { @@ -503,7 +441,7 @@ extern class C; // CHECK:STDOUT: .C = %C.decl.loc4 // CHECK:STDOUT: } // CHECK:STDOUT: %C.decl.loc4: type = class_decl @C [concrete = constants.%C] {} {} -// CHECK:STDOUT: %C.decl.loc12: type = class_decl @C [concrete = constants.%C] {} {} +// CHECK:STDOUT: %C.decl.loc8: type = class_decl @C [concrete = constants.%C] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C; diff --git a/toolchain/check/testdata/class/extern_library.carbon b/toolchain/check/testdata/class/extern_library.carbon index f7cad79f6371..a7debde60e2a 100644 --- a/toolchain/check/testdata/class/extern_library.carbon +++ b/toolchain/check/testdata/class/extern_library.carbon @@ -14,9 +14,7 @@ // --- fail_todo.carbon -// CHECK:STDERR: fail_todo.carbon:[[@LINE+4]]:1: error: semantics TODO: `extern library` [SemanticsTodo] -// CHECK:STDERR: extern library "foo" class C; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo.carbon:[[@LINE+2]]:1-29: error: semantics TODO: `extern library` [SemanticsTodo] // CHECK:STDERR: extern library "foo" class C; diff --git a/toolchain/check/testdata/class/fail_compound_type_mismatch.carbon b/toolchain/check/testdata/class/fail_compound_type_mismatch.carbon index e7c2cdd9ee84..730960650b4b 100644 --- a/toolchain/check/testdata/class/fail_compound_type_mismatch.carbon +++ b/toolchain/check/testdata/class/fail_compound_type_mismatch.carbon @@ -19,12 +19,8 @@ class B { } 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return a.(B.b); - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_compound_type_mismatch.carbon:[[@LINE+3]]:10-16: error: cannot implicitly convert expression of type `A` to `B` [ConversionFailure] + // CHECK:STDERR: fail_compound_type_mismatch.carbon:[[@LINE+2]]:10-16: note: type `A` does not implement interface `Core.ImplicitAs(B)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return a.(B.b); } diff --git a/toolchain/check/testdata/class/fail_convert_to_invalid.carbon b/toolchain/check/testdata/class/fail_convert_to_invalid.carbon index 82bdfe587d58..d08517a2e153 100644 --- a/toolchain/check/testdata/class/fail_convert_to_invalid.carbon +++ b/toolchain/check/testdata/class/fail_convert_to_invalid.carbon @@ -11,9 +11,7 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_convert_to_invalid.carbon class C { - // CHECK:STDERR: fail_convert_to_invalid.carbon:[[@LINE+4]]:10: error: name `NoSuchType` not found [NameNotFound] - // CHECK:STDERR: var a: NoSuchType; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_convert_to_invalid.carbon:[[@LINE+2]]:10-19: error: name `NoSuchType` not found [NameNotFound] // CHECK:STDERR: var a: NoSuchType; } diff --git a/toolchain/check/testdata/class/fail_error_recovery.carbon b/toolchain/check/testdata/class/fail_error_recovery.carbon index 221e75113fbf..8bd2032e76e0 100644 --- a/toolchain/check/testdata/class/fail_error_recovery.carbon +++ b/toolchain/check/testdata/class/fail_error_recovery.carbon @@ -12,9 +12,7 @@ // --- fail_virtual_fn_in_invalid_context.carbon -// CHECK:STDERR: fail_virtual_fn_in_invalid_context.carbon:[[@LINE+4]]:24: error: name `error_not_found` not found [NameNotFound] -// CHECK:STDERR: fn F(unused generic N: error_not_found) { -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_virtual_fn_in_invalid_context.carbon:[[@LINE+2]]:24-38: error: name `error_not_found` not found [NameNotFound] // CHECK:STDERR: fn F(unused generic N: error_not_found) { base class C { diff --git a/toolchain/check/testdata/class/fail_import_misuses.carbon b/toolchain/check/testdata/class/fail_import_misuses.carbon index a20fd79ab789..16366a4147de 100644 --- a/toolchain/check/testdata/class/fail_import_misuses.carbon +++ b/toolchain/check/testdata/class/fail_import_misuses.carbon @@ -25,23 +25,15 @@ library "[[@TEST_NAME]]"; import library "a"; -// CHECK:STDERR: fail_b.carbon:[[@LINE+8]]:1: error: redeclaration of `class Empty` is redundant [RedeclRedundant] -// CHECK:STDERR: class Empty { -// CHECK:STDERR: ^~~~~~~~~~~~~ -// CHECK:STDERR: fail_b.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: a.carbon:4:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: class Empty { -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_b.carbon:[[@LINE+4]]:1-13: error: redeclaration of `class Empty` is redundant [RedeclRedundant] +// CHECK:STDERR: imported from: fail_b.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: a.carbon:4:1-13: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: class Empty { } -// CHECK:STDERR: fail_b.carbon:[[@LINE+8]]:8: error: binding pattern has incomplete type `Incomplete` in name binding declaration [IncompleteTypeInBindingDecl] -// CHECK:STDERR: var a: Incomplete; -// CHECK:STDERR: ^~~~~~~~~~ -// CHECK:STDERR: fail_b.carbon:[[@LINE-16]]:1: in import [InImport] -// CHECK:STDERR: a.carbon:7:1: note: class was forward declared here [ClassForwardDeclaredHere] -// CHECK:STDERR: class Incomplete; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_b.carbon:[[@LINE+4]]:8-17: error: binding pattern has incomplete type `Incomplete` in name binding declaration [IncompleteTypeInBindingDecl] +// CHECK:STDERR: imported from: fail_b.carbon:[[@LINE-10]]:1 [InImport] +// CHECK:STDERR: a.carbon:7:1-17: note: class was forward declared here [ClassForwardDeclaredHere] // CHECK:STDERR: var a: Incomplete; diff --git a/toolchain/check/testdata/class/fail_incomplete.carbon b/toolchain/check/testdata/class/fail_incomplete.carbon index cdf34d51be06..751f87745c40 100644 --- a/toolchain/check/testdata/class/fail_incomplete.carbon +++ b/toolchain/check/testdata/class/fail_incomplete.carbon @@ -16,84 +16,52 @@ library "[[@TEST_NAME]]"; class Class; -// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+7]]:4: error: cannot declare a member of incomplete class `Class` [QualifiedDeclInIncompleteClassScope] -// CHECK:STDERR: fn Class.Function() {} -// CHECK:STDERR: ^~~~~ -// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-5]]:1: note: class was forward declared here [ClassForwardDeclaredHere] -// CHECK:STDERR: class Class; -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+3]]:4-8: error: cannot declare a member of incomplete class `Class` [QualifiedDeclInIncompleteClassScope] +// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-3]]:1-12: note: class was forward declared here [ClassForwardDeclaredHere] // CHECK:STDERR: fn Class.Function() {} fn CallClassFunction() { - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+7]]:3: error: member access into incomplete class `Class` [QualifiedExprInIncompleteClassScope] - // CHECK:STDERR: Class.Function(); - // CHECK:STDERR: ^~~~~~~~~~~~~~ - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-15]]:1: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: class Class; - // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+3]]:3-16: error: member access into incomplete class `Class` [QualifiedExprInIncompleteClassScope] + // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-9]]:1-12: note: class was forward declared here [ClassForwardDeclaredHere] // CHECK:STDERR: Class.Function(); } -// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+7]]:17: error: binding pattern has incomplete type `Class` in name binding declaration [IncompleteTypeInBindingDecl] -// CHECK:STDERR: var global_var: Class; -// CHECK:STDERR: ^~~~~ -// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-25]]:1: note: class was forward declared here [ClassForwardDeclaredHere] -// CHECK:STDERR: class Class; -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+3]]:17-21: error: binding pattern has incomplete type `Class` in name binding declaration [IncompleteTypeInBindingDecl] +// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-15]]:1-12: note: class was forward declared here [ClassForwardDeclaredHere] // CHECK:STDERR: var global_var: Class; -// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+7]]:24: error: function returns incomplete type `Class` [IncompleteTypeInFunctionReturnType] -// CHECK:STDERR: fn ConvertFromStruct() -> Class { return {}; } -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-34]]:1: note: class was forward declared here [ClassForwardDeclaredHere] -// CHECK:STDERR: class Class; -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+3]]:24-31: error: function returns incomplete type `Class` [IncompleteTypeInFunctionReturnType] +// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-20]]:1-12: note: class was forward declared here [ClassForwardDeclaredHere] // CHECK:STDERR: fn ConvertFromStruct() -> Class { return {}; } fn G(p: Class*) -> () { - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+7]]:10: error: member access into object of incomplete type `Class` [IncompleteTypeInMemberAccess] - // CHECK:STDERR: return p->n; - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-44]]:1: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: class Class; - // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+3]]:10-13: error: member access into object of incomplete type `Class` [IncompleteTypeInMemberAccess] + // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-26]]:1-12: note: class was forward declared here [ClassForwardDeclaredHere] // CHECK:STDERR: return p->n; } fn MemberAccess(p: Class*) -> () { - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+7]]:11: error: member access into object of incomplete type `Class` [IncompleteTypeInMemberAccess] - // CHECK:STDERR: return (*p).n; - // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-55]]:1: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: class Class; - // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+3]]:11-12: error: member access into object of incomplete type `Class` [IncompleteTypeInMemberAccess] + // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-33]]:1-12: note: class was forward declared here [ClassForwardDeclaredHere] // CHECK:STDERR: return (*p).n; } -// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+7]]:20: error: function returns incomplete type `Class` [IncompleteTypeInFunctionReturnType] -// CHECK:STDERR: fn Copy(p: Class*) -> Class { -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-65]]:1: note: class was forward declared here [ClassForwardDeclaredHere] -// CHECK:STDERR: class Class; -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+3]]:20-27: error: function returns incomplete type `Class` [IncompleteTypeInFunctionReturnType] +// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-39]]:1-12: note: class was forward declared here [ClassForwardDeclaredHere] // CHECK:STDERR: fn Copy(p: Class*) -> Class { return *p; } fn Let(p: Class*) { - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+7]]:17: error: binding pattern has incomplete type `Class` in name binding declaration [IncompleteTypeInBindingDecl] - // CHECK:STDERR: let unused c: Class = *p; - // CHECK:STDERR: ^~~~~ - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-77]]:1: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: class Class; - // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+3]]:17-21: error: binding pattern has incomplete type `Class` in name binding declaration [IncompleteTypeInBindingDecl] + // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-47]]:1-12: note: class was forward declared here [ClassForwardDeclaredHere] // CHECK:STDERR: let unused c: Class = *p; } @@ -103,41 +71,23 @@ fn TakeIncomplete(c: Class); fn ReturnIncomplete() -> Class; fn CallTakeIncomplete(p: Class*) { - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+10]]:18: error: forming value of incomplete type `Class` [IncompleteTypeInValueConversion] - // CHECK:STDERR: TakeIncomplete(*p); - // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-92]]:1: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: class Class; - // CHECK:STDERR: ^~~~~~~~~~~~ - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-11]]:19: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn TakeIncomplete(c: Class); - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+4]]:18-19: error: forming value of incomplete type `Class` [IncompleteTypeInValueConversion] + // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-58]]:1-12: note: class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-7]]:19-26: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: TakeIncomplete(*p); - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+10]]:18: error: forming value of incomplete type `Class` [IncompleteTypeInValueConversion] - // CHECK:STDERR: TakeIncomplete({}); - // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-104]]:1: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: class Class; - // CHECK:STDERR: ^~~~~~~~~~~~ - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-23]]:19: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn TakeIncomplete(c: Class); - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+4]]:18-19: error: forming value of incomplete type `Class` [IncompleteTypeInValueConversion] + // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-64]]:1-12: note: class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-13]]:19-26: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: TakeIncomplete({}); } fn CallReturnIncomplete() { - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+10]]:3: error: function returns incomplete type `Class` [IncompleteTypeInFunctionReturnType] - // CHECK:STDERR: ReturnIncomplete(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-118]]:1: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: class Class; - // CHECK:STDERR: ^~~~~~~~~~~~ - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-35]]:23: note: return type declared here [IncompleteReturnTypeHere] - // CHECK:STDERR: fn ReturnIncomplete() -> Class; - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+4]]:3-20: error: function returns incomplete type `Class` [IncompleteTypeInFunctionReturnType] + // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-72]]:1-12: note: class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-19]]:23-30: note: return type declared here [IncompleteReturnTypeHere] // CHECK:STDERR: ReturnIncomplete(); } @@ -147,12 +97,8 @@ fn CallReturnIncomplete() { library "[[@TEST_NAME]]"; class C { - // CHECK:STDERR: fail_in_definition.carbon:[[@LINE+7]]:10: error: binding pattern has incomplete type `C` in name binding declaration [IncompleteTypeInBindingDecl] - // CHECK:STDERR: var c: C; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_in_definition.carbon:[[@LINE-4]]:1: note: class is incomplete within its definition [ClassIncompleteWithinDefinition] - // CHECK:STDERR: class C { - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_in_definition.carbon:[[@LINE+3]]:10: error: binding pattern has incomplete type `C` in name binding declaration [IncompleteTypeInBindingDecl] + // CHECK:STDERR: fail_in_definition.carbon:[[@LINE-2]]:1-9: note: class is incomplete within its definition [ClassIncompleteWithinDefinition] // CHECK:STDERR: var c: C; } diff --git a/toolchain/check/testdata/class/fail_init.carbon b/toolchain/check/testdata/class/fail_init.carbon index 7c47a0a30846..f006e22273e8 100644 --- a/toolchain/check/testdata/class/fail_init.carbon +++ b/toolchain/check/testdata/class/fail_init.carbon @@ -16,19 +16,13 @@ class Class { } fn F() { - // CHECK:STDERR: fail_init.carbon:[[@LINE+4]]:3: error: missing value for field `b` in struct initialization [StructInitMissingFieldInLiteral] - // CHECK:STDERR: {.a = 1} as Class; - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_init.carbon:[[@LINE+2]]:3-10: error: missing value for field `b` in struct initialization [StructInitMissingFieldInLiteral] // CHECK:STDERR: {.a = 1} as Class; - // CHECK:STDERR: fail_init.carbon:[[@LINE+4]]:3: error: struct `Class` has no field named `c` [StructInitUnexpectedFieldInLiteral] - // CHECK:STDERR: {.a = 1, .c = 2} as Class; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_init.carbon:[[@LINE+2]]:3-18: error: struct `Class` has no field named `c` [StructInitUnexpectedFieldInLiteral] // CHECK:STDERR: {.a = 1, .c = 2} as Class; - // CHECK:STDERR: fail_init.carbon:[[@LINE+4]]:3: error: struct `Class` has no field named `c` [StructInitUnexpectedFieldInLiteral] - // CHECK:STDERR: {.a = 1, .b = 2, .c = 3} as Class; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_init.carbon:[[@LINE+2]]:3-26: error: struct `Class` has no field named `c` [StructInitUnexpectedFieldInLiteral] // CHECK:STDERR: {.a = 1, .b = 2, .c = 3} as Class; } diff --git a/toolchain/check/testdata/class/fail_memaccess_category.carbon b/toolchain/check/testdata/class/fail_memaccess_category.carbon index 0e1fd68ef993..df1cbeafc2eb 100644 --- a/toolchain/check/testdata/class/fail_memaccess_category.carbon +++ b/toolchain/check/testdata/class/fail_memaccess_category.carbon @@ -20,23 +20,15 @@ class B { fn F(s: {.a: A}, b: B) { // `s` has only a value representation, so this must be invalid. - // CHECK:STDERR: fail_memaccess_category.carbon:[[@LINE+7]]:3: error: value expression passed to reference parameter [ValueForRefParam] - // CHECK:STDERR: s.a.F(); - // CHECK:STDERR: ^~~ - // CHECK:STDERR: fail_memaccess_category.carbon:[[@LINE-12]]:8: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn F(ref self: A); - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_memaccess_category.carbon:[[@LINE+3]]:3-5: error: value expression passed to reference parameter [ValueForRefParam] + // CHECK:STDERR: fail_memaccess_category.carbon:[[@LINE-10]]:8-18: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: s.a.F(); // `b` has an object representation for `A`, but this is still invalid for // consistency. - // CHECK:STDERR: fail_memaccess_category.carbon:[[@LINE+7]]:3: error: value expression passed to reference parameter [ValueForRefParam] - // CHECK:STDERR: b.a.F(); - // CHECK:STDERR: ^~~ - // CHECK:STDERR: fail_memaccess_category.carbon:[[@LINE-23]]:8: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn F(ref self: A); - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_memaccess_category.carbon:[[@LINE+3]]:3-5: error: value expression passed to reference parameter [ValueForRefParam] + // CHECK:STDERR: fail_memaccess_category.carbon:[[@LINE-17]]:8-18: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: b.a.F(); } diff --git a/toolchain/check/testdata/class/fail_member_of_let.carbon b/toolchain/check/testdata/class/fail_member_of_let.carbon index 0941383411e8..5be6e9f191a8 100644 --- a/toolchain/check/testdata/class/fail_member_of_let.carbon +++ b/toolchain/check/testdata/class/fail_member_of_let.carbon @@ -19,11 +19,7 @@ let T: type = Class; // The class name is required to be written in the same way as in the class // declaration. An expression that evaluates to the class name is not accepted. -// CHECK:STDERR: fail_member_of_let.carbon:[[@LINE+7]]:4: error: name qualifiers are only allowed for entities that provide a scope [QualifiedNameInNonScope] -// CHECK:STDERR: fn T.F() {} -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_member_of_let.carbon:[[@LINE-7]]:5: note: referenced non-scope entity declared here [QualifiedNameNonScopeEntity] -// CHECK:STDERR: let T: type = Class; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_member_of_let.carbon:[[@LINE+3]]:4: error: name qualifiers are only allowed for entities that provide a scope [QualifiedNameInNonScope] +// CHECK:STDERR: fail_member_of_let.carbon:[[@LINE-5]]:5-11: note: referenced non-scope entity declared here [QualifiedNameNonScopeEntity] // CHECK:STDERR: fn T.F() {} diff --git a/toolchain/check/testdata/class/fail_modifiers.carbon b/toolchain/check/testdata/class/fail_modifiers.carbon index 12f1528ed02b..818ba82364a4 100644 --- a/toolchain/check/testdata/class/fail_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_modifiers.carbon @@ -10,91 +10,55 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_modifiers.carbon -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:9: error: `private` repeated on declaration [ModifierRepeated] -// CHECK:STDERR: private private class DuplicatePrivate; -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: note: `private` previously appeared here [ModifierPrevious] -// CHECK:STDERR: private private class DuplicatePrivate; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+3]]:9-15: error: `private` repeated on declaration [ModifierRepeated] +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-7: note: `private` previously appeared here [ModifierPrevious] // CHECK:STDERR: private private class DuplicatePrivate; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `abstract` not allowed on `class` forward declaration, only definition [ModifierOnlyAllowedOnDefinition] -// CHECK:STDERR: abstract class AbstractDecl; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-8: error: `abstract` not allowed on `class` forward declaration, only definition [ModifierOnlyAllowedOnDefinition] // CHECK:STDERR: abstract class AbstractDecl; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:9: error: `protected` not allowed on declaration with `private` [ModifierNotAllowedWith] -// CHECK:STDERR: private protected class TwoAccess; -// CHECK:STDERR: ^~~~~~~~~ -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: note: `private` previously appeared here [ModifierPrevious] -// CHECK:STDERR: private protected class TwoAccess; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+3]]:9-17: error: `protected` not allowed on declaration with `private` [ModifierNotAllowedWith] +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-7: note: `private` previously appeared here [ModifierPrevious] // CHECK:STDERR: private protected class TwoAccess; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `base` not allowed on `class` forward declaration, only definition [ModifierOnlyAllowedOnDefinition] -// CHECK:STDERR: base class BaseDecl; -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-4: error: `base` not allowed on `class` forward declaration, only definition [ModifierOnlyAllowedOnDefinition] // CHECK:STDERR: base class BaseDecl; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:10: error: `abstract` repeated on declaration [ModifierRepeated] -// CHECK:STDERR: abstract abstract class TwoAbstract { } -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: note: `abstract` previously appeared here [ModifierPrevious] -// CHECK:STDERR: abstract abstract class TwoAbstract { } -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+3]]:10-17: error: `abstract` repeated on declaration [ModifierRepeated] +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-8: note: `abstract` previously appeared here [ModifierPrevious] // CHECK:STDERR: abstract abstract class TwoAbstract { } -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+15]]:19: error: `base` not allowed on declaration with `virtual` [ModifierNotAllowedWith] -// CHECK:STDERR: protected virtual base class Virtual {} -// CHECK:STDERR: ^~~~ -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+12]]:11: note: `virtual` previously appeared here [ModifierPrevious] -// CHECK:STDERR: protected virtual base class Virtual {} -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:19-22: error: `base` not allowed on declaration with `virtual` [ModifierNotAllowedWith] +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+6]]:11-17: note: `virtual` previously appeared here [ModifierPrevious] // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+8]]:1: error: `protected` not allowed; requires class scope [ModifierProtectedNotAllowed] -// CHECK:STDERR: protected virtual base class Virtual {} -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1-9: error: `protected` not allowed; requires class scope [ModifierProtectedNotAllowed] // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:11: error: `virtual` not allowed on `class` declaration [ModifierNotAllowedOnDeclaration] -// CHECK:STDERR: protected virtual base class Virtual {} -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:11-17: error: `virtual` not allowed on `class` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: protected virtual base class Virtual {} -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:10: error: `protected` must appear before `abstract` [ModifierMustAppearBefore] -// CHECK:STDERR: abstract protected class WrongOrder { } -// CHECK:STDERR: ^~~~~~~~~ -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: note: `abstract` previously appeared here [ModifierPrevious] -// CHECK:STDERR: abstract protected class WrongOrder { } -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+3]]:10-18: error: `protected` must appear before `abstract` [ModifierMustAppearBefore] +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-8: note: `abstract` previously appeared here [ModifierPrevious] // CHECK:STDERR: abstract protected class WrongOrder { } -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:10: error: `base` not allowed on declaration with `abstract` [ModifierNotAllowedWith] -// CHECK:STDERR: abstract base class AbstractAndBase {} -// CHECK:STDERR: ^~~~ -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: note: `abstract` previously appeared here [ModifierPrevious] -// CHECK:STDERR: abstract base class AbstractAndBase {} -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+3]]:10-13: error: `base` not allowed on declaration with `abstract` [ModifierNotAllowedWith] +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-8: note: `abstract` previously appeared here [ModifierPrevious] // CHECK:STDERR: abstract base class AbstractAndBase {} abstract class AbstractWithDefinition { - // CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:30: error: definition of `abstract` function [DefinedAbstractFunction] - // CHECK:STDERR: abstract fn F(unused self) {} - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:30: error: definition of `abstract` function [DefinedAbstractFunction] // CHECK:STDERR: abstract fn F(unused self) {} abstract fn G(self); } -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:42: error: definition of `abstract` function [DefinedAbstractFunction] -// CHECK:STDERR: fn AbstractWithDefinition.G(unused self) { -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:42: error: definition of `abstract` function [DefinedAbstractFunction] // CHECK:STDERR: fn AbstractWithDefinition.G(unused self) { } diff --git a/toolchain/check/testdata/class/fail_redeclaration_scope.carbon b/toolchain/check/testdata/class/fail_redeclaration_scope.carbon index ce8e5800f819..d04815171f17 100644 --- a/toolchain/check/testdata/class/fail_redeclaration_scope.carbon +++ b/toolchain/check/testdata/class/fail_redeclaration_scope.carbon @@ -21,9 +21,7 @@ class X { class A { class B; } class Y { - // CHECK:STDERR: fail_redeclaration_scope.carbon:[[@LINE+4]]:9: error: name `A` not found [NameNotFound] - // CHECK:STDERR: class A.B {} - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_redeclaration_scope.carbon:[[@LINE+2]]:9: error: name `A` not found [NameNotFound] // CHECK:STDERR: class A.B {} } diff --git a/toolchain/check/testdata/class/fail_redefinition.carbon b/toolchain/check/testdata/class/fail_redefinition.carbon index 78ba3d48acca..b5a256c62c57 100644 --- a/toolchain/check/testdata/class/fail_redefinition.carbon +++ b/toolchain/check/testdata/class/fail_redefinition.carbon @@ -16,12 +16,8 @@ class Class { fn I() {} } -// CHECK:STDERR: fail_redefinition.carbon:[[@LINE+7]]:1: error: redefinition of `class Class` [RedeclRedef] -// CHECK:STDERR: class Class { -// CHECK:STDERR: ^~~~~~~~~~~~~ -// CHECK:STDERR: fail_redefinition.carbon:[[@LINE-9]]:1: note: previously defined here [RedeclPrevDef] -// CHECK:STDERR: class Class { -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_redefinition.carbon:[[@LINE+3]]:1-13: error: redefinition of `class Class` [RedeclRedef] +// CHECK:STDERR: fail_redefinition.carbon:[[@LINE-7]]:1-13: note: previously defined here [RedeclPrevDef] // CHECK:STDERR: class Class { fn G(); @@ -30,17 +26,11 @@ class Class { } fn Class.F() {} -// CHECK:STDERR: fail_redefinition.carbon:[[@LINE+4]]:10: error: out-of-line declaration requires a declaration in scoped entity [QualifiedDeclOutsideScopeEntity] -// CHECK:STDERR: fn Class.G() {} -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_redefinition.carbon:[[@LINE+2]]:10: error: out-of-line declaration requires a declaration in scoped entity [QualifiedDeclOutsideScopeEntity] // CHECK:STDERR: fn Class.G() {} fn Class.H() {} -// CHECK:STDERR: fail_redefinition.carbon:[[@LINE+7]]:1: error: redefinition of `fn I` [RedeclRedef] -// CHECK:STDERR: fn Class.I() {} -// CHECK:STDERR: ^~~~~~~~~~~~~~ -// CHECK:STDERR: fail_redefinition.carbon:[[@LINE-26]]:3: note: previously defined here [RedeclPrevDef] -// CHECK:STDERR: fn I() {} -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_redefinition.carbon:[[@LINE+3]]:1-14: error: redefinition of `fn I` [RedeclRedef] +// CHECK:STDERR: fail_redefinition.carbon:[[@LINE-18]]:3-10: note: previously defined here [RedeclPrevDef] // CHECK:STDERR: fn Class.I() {} diff --git a/toolchain/check/testdata/class/fail_scope.carbon b/toolchain/check/testdata/class/fail_scope.carbon index c0bda8e9e024..b729c999518a 100644 --- a/toolchain/check/testdata/class/fail_scope.carbon +++ b/toolchain/check/testdata/class/fail_scope.carbon @@ -17,9 +17,7 @@ class Class { } fn G() -> () { - // CHECK:STDERR: fail_scope.carbon:[[@LINE+4]]:10: error: name `F` not found [NameNotFound] - // CHECK:STDERR: return F(); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_scope.carbon:[[@LINE+2]]:10: error: name `F` not found [NameNotFound] // CHECK:STDERR: return F(); } diff --git a/toolchain/check/testdata/class/fail_unknown_member.carbon b/toolchain/check/testdata/class/fail_unknown_member.carbon index 7047123f4d97..3bbbce4e3d82 100644 --- a/toolchain/check/testdata/class/fail_unknown_member.carbon +++ b/toolchain/check/testdata/class/fail_unknown_member.carbon @@ -16,9 +16,7 @@ class Class { fn G(c: Class) -> i32 { // TODO: Mention the scope in which we looked for the name. - // CHECK:STDERR: fail_unknown_member.carbon:[[@LINE+4]]:10: error: member name `something` not found in `Class` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: return c.something; - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_unknown_member.carbon:[[@LINE+2]]:10-20: error: member name `something` not found in `Class` [MemberNameNotFoundInInstScope] // CHECK:STDERR: return c.something; } diff --git a/toolchain/check/testdata/class/fail_var_param.carbon b/toolchain/check/testdata/class/fail_var_param.carbon index 54a526b2a1c9..1380a0905dbc 100644 --- a/toolchain/check/testdata/class/fail_var_param.carbon +++ b/toolchain/check/testdata/class/fail_var_param.carbon @@ -12,11 +12,7 @@ // A `var` parameter is not constant, so it is not allowed as a parameter of a // generic type. -// CHECK:STDERR: fail_var_param.carbon:[[@LINE+7]]:13: error: parameters of generic types must be constant [GenericParamMustBeConstant] -// CHECK:STDERR: class C(var x: i32); -// CHECK:STDERR: ^~~~~~ -// CHECK:STDERR: fail_var_param.carbon:[[@LINE+4]]:13: note: `var` parameters are runtime [VarParamIsRuntime] -// CHECK:STDERR: class C(var x: i32); -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_var_param.carbon:[[@LINE+3]]:13-18: error: parameters of generic types must be constant [GenericParamMustBeConstant] +// CHECK:STDERR: fail_var_param.carbon:[[@LINE+2]]:13-18: note: `var` parameters are runtime [VarParamIsRuntime] // CHECK:STDERR: class C(var x: i32); diff --git a/toolchain/check/testdata/class/field/comp_time_field.carbon b/toolchain/check/testdata/class/field/comp_time_field.carbon index 9fc6ea40dc25..04817a0135ef 100644 --- a/toolchain/check/testdata/class/field/comp_time_field.carbon +++ b/toolchain/check/testdata/class/field/comp_time_field.carbon @@ -17,15 +17,11 @@ library "[[@TEST_NAME]]"; class Class { - // CHECK:STDERR: fail_let.carbon:[[@LINE+4]]:15: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] - // CHECK:STDERR: let generic A: type = Class; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_let.carbon:[[@LINE+2]]:15-21: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] // CHECK:STDERR: let generic A: type = Class; - // CHECK:STDERR: fail_let.carbon:[[@LINE+4]]:7: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] - // CHECK:STDERR: let template B: type = Class; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_let.carbon:[[@LINE+2]]:7-22: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] // CHECK:STDERR: let template B: type = Class; } @@ -35,19 +31,13 @@ class Class { library "[[@TEST_NAME]]"; class Class { - // CHECK:STDERR: fail_var.carbon:[[@LINE+8]]:15: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] - // CHECK:STDERR: var generic C: type = Class; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_var.carbon:[[@LINE+4]]:15-21: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: - // CHECK:STDERR: fail_var.carbon:[[@LINE+4]]:23: error: found generic binding inside `var` pattern [NonRegularBindingInVarDecl] - // CHECK:STDERR: var generic C: type = Class; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_var.carbon:[[@LINE+2]]:23: error: found generic binding inside `var` pattern [NonRegularBindingInVarDecl] // CHECK:STDERR: var generic C: type = Class; - // CHECK:STDERR: fail_var.carbon:[[@LINE+4]]:24: error: found generic binding inside `var` pattern [NonRegularBindingInVarDecl] - // CHECK:STDERR: var template D: type = Class; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_var.carbon:[[@LINE+2]]:24: error: found generic binding inside `var` pattern [NonRegularBindingInVarDecl] // CHECK:STDERR: var template D: type = Class; } @@ -75,21 +65,21 @@ var x: Class = {}; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %Class.ref.loc9: type = name_ref Class, file.%Class.decl [concrete = constants.%Class] -// CHECK:STDOUT: %.loc9_18.1: type = splice_block %.loc9_18.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc9: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc9_18.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %Class.ref.loc7: type = name_ref Class, file.%Class.decl [concrete = constants.%Class] +// CHECK:STDOUT: %.loc7_18.1: type = splice_block %.loc7_18.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc7: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc7_18.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %A: type = wrapper_binding A, %Class.ref.loc9 +// CHECK:STDOUT: %A: type = wrapper_binding A, %Class.ref.loc7 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %A.patt: %pattern_type = value_binding_pattern A [concrete = constants.%A.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Class.ref.loc15: type = name_ref Class, file.%Class.decl [concrete = constants.%Class] -// CHECK:STDOUT: %.loc15_19.1: type = splice_block %.loc15_19.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc15: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc15_19.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %Class.ref.loc11: type = name_ref Class, file.%Class.decl [concrete = constants.%Class] +// CHECK:STDOUT: %.loc11_19.1: type = splice_block %.loc11_19.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc11: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc11_19.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %B: type = wrapper_binding B, %Class.ref.loc15 +// CHECK:STDOUT: %B: type = wrapper_binding B, %Class.ref.loc11 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %B.patt: %pattern_type = value_binding_pattern B [concrete = constants.%B.patt] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/field/fail_field_modifiers.carbon b/toolchain/check/testdata/class/field/fail_field_modifiers.carbon index 99731aa85c8b..7af5095132cb 100644 --- a/toolchain/check/testdata/class/field/fail_field_modifiers.carbon +++ b/toolchain/check/testdata/class/field/fail_field_modifiers.carbon @@ -12,27 +12,19 @@ class Class { - // CHECK:STDERR: fail_field_modifiers.carbon:[[@LINE+4]]:3: error: `default` not allowed on `var` declaration [ModifierNotAllowedOnDeclaration] - // CHECK:STDERR: default var j: i32; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_field_modifiers.carbon:[[@LINE+2]]:3-9: error: `default` not allowed on `var` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: default var j: i32; - // CHECK:STDERR: fail_field_modifiers.carbon:[[@LINE+4]]:3: error: `final` not allowed on `var` declaration [ModifierNotAllowedOnDeclaration] - // CHECK:STDERR: final var k: i32; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_field_modifiers.carbon:[[@LINE+2]]:3-7: error: `final` not allowed on `var` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: final var k: i32; - // CHECK:STDERR: fail_field_modifiers.carbon:[[@LINE+4]]:3: error: `default` not allowed; requires interface scope [ModifierRequiresInterface] - // CHECK:STDERR: default let l: i32 = 0; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_field_modifiers.carbon:[[@LINE+2]]:3-9: error: `default` not allowed; requires interface scope [ModifierRequiresInterface] // CHECK:STDERR: default let l: i32 = 0; - // CHECK:STDERR: fail_field_modifiers.carbon:[[@LINE+4]]:3: error: `final` not allowed; requires interface scope [ModifierRequiresInterface] - // CHECK:STDERR: final let m: i32 = 1; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_field_modifiers.carbon:[[@LINE+2]]:3-7: error: `final` not allowed; requires interface scope [ModifierRequiresInterface] // CHECK:STDERR: final let m: i32 = 1; } diff --git a/toolchain/check/testdata/class/field/fail_unbound_field.carbon b/toolchain/check/testdata/class/field/fail_unbound_field.carbon index 4fae4894be6a..2180381ff761 100644 --- a/toolchain/check/testdata/class/field/fail_unbound_field.carbon +++ b/toolchain/check/testdata/class/field/fail_unbound_field.carbon @@ -13,26 +13,20 @@ class Class { var field: i32; fn F() -> i32 { - // CHECK:STDERR: fail_unbound_field.carbon:[[@LINE+4]]:12: error: expression cannot be used as a value [UseOfNonExprAsValue] - // CHECK:STDERR: return field; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_unbound_field.carbon:[[@LINE+2]]:12-16: error: expression cannot be used as a value [UseOfNonExprAsValue] // CHECK:STDERR: return field; } fn IsZero() -> bool { - // CHECK:STDERR: fail_unbound_field.carbon:[[@LINE+4]]:12: error: cannot access member of interface `Core.EqWith(Core.IntLiteral)` in type `` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: return field == 0; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_unbound_field.carbon:[[@LINE+2]]:12-21: error: cannot access member of interface `Core.EqWith(Core.IntLiteral)` in type `` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: return field == 0; } } fn G() -> i32 { - // CHECK:STDERR: fail_unbound_field.carbon:[[@LINE+4]]:10: error: expression cannot be used as a value [UseOfNonExprAsValue] - // CHECK:STDERR: return Class.field; - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_unbound_field.carbon:[[@LINE+2]]:10-20: error: expression cannot be used as a value [UseOfNonExprAsValue] // CHECK:STDERR: return Class.field; } diff --git a/toolchain/check/testdata/class/field/field_initializer.carbon b/toolchain/check/testdata/class/field/field_initializer.carbon index dbca3dcdc488..f3adef5cb91a 100644 --- a/toolchain/check/testdata/class/field/field_initializer.carbon +++ b/toolchain/check/testdata/class/field/field_initializer.carbon @@ -50,9 +50,7 @@ class Class { var field: i32 = 123; } -// CHECK:STDERR: fail_field_initializer_invalid_name.carbon:[[@LINE+4]]:16: error: struct `Class` has no field named `not_a_field` [StructInitUnexpectedFieldInLiteral] -// CHECK:STDERR: var C: Class = {.not_a_field = 456}; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_field_initializer_invalid_name.carbon:[[@LINE+2]]:16-35: error: struct `Class` has no field named `not_a_field` [StructInitUnexpectedFieldInLiteral] // CHECK:STDERR: var C: Class = {.not_a_field = 456}; @@ -60,12 +58,8 @@ var C: Class = {.not_a_field = 456}; library "[[@TEST_NAME]]"; class Class { - // CHECK:STDERR: fail_field_initializer_wrong_type.carbon:[[@LINE+7]]:20: error: cannot implicitly convert expression of type `()` to `i32` [ConversionFailure] - // CHECK:STDERR: var field: i32 = (); - // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_field_initializer_wrong_type.carbon:[[@LINE+4]]:20: note: type `()` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var field: i32 = (); - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_field_initializer_wrong_type.carbon:[[@LINE+3]]:20-21: error: cannot implicitly convert expression of type `()` to `i32` [ConversionFailure] + // CHECK:STDERR: fail_field_initializer_wrong_type.carbon:[[@LINE+2]]:20-21: note: type `()` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var field: i32 = (); } @@ -75,9 +69,7 @@ library "[[@TEST_NAME]]"; var x: i32; class Class { - // CHECK:STDERR: fail_field_initializer_not_constant.carbon:[[@LINE+4]]:20: error: semantics TODO: `field initializer is not constant` [SemanticsTodo] - // CHECK:STDERR: var field: i32 = x; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_field_initializer_not_constant.carbon:[[@LINE+2]]:20: error: semantics TODO: `field initializer is not constant` [SemanticsTodo] // CHECK:STDERR: var field: i32 = x; } diff --git a/toolchain/check/testdata/class/field/static.carbon b/toolchain/check/testdata/class/field/static.carbon index 48d3acaa139a..3acf850f74b0 100644 --- a/toolchain/check/testdata/class/field/static.carbon +++ b/toolchain/check/testdata/class/field/static.carbon @@ -43,12 +43,8 @@ class C { } fn F() { - // CHECK:STDERR: fail_private_static_field_invalid_access.carbon:[[@LINE+7]]:3: error: cannot access private member `static_field` of type `C` [ClassInvalidMemberAccess] - // CHECK:STDERR: C.static_field = 123; - // CHECK:STDERR: ^~~~~~~~~~~~~~ - // CHECK:STDERR: fail_private_static_field_invalid_access.carbon:[[@LINE-7]]:22: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: private static var static_field: i32; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_private_static_field_invalid_access.carbon:[[@LINE+3]]:3-16: error: cannot access private member `static_field` of type `C` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_private_static_field_invalid_access.carbon:[[@LINE-5]]:22-38: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: C.static_field = 123; } diff --git a/toolchain/check/testdata/class/generic/adapt.carbon b/toolchain/check/testdata/class/generic/adapt.carbon index 642190ff22b3..4a75cd2e7141 100644 --- a/toolchain/check/testdata/class/generic/adapt.carbon +++ b/toolchain/check/testdata/class/generic/adapt.carbon @@ -52,12 +52,8 @@ class Adapter { fn Access(a: Adapter) -> i32 { // TODO: This should presumably work, but the design doesn't say how yet. - // 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))` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return a.x; - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_todo_extend_adapt_specific_type.carbon:[[@LINE+3]]:10-12: error: cannot implicitly convert expression of type `Adapter` to `C(i32)` [ConversionFailure] + // CHECK:STDERR: fail_todo_extend_adapt_specific_type.carbon:[[@LINE+2]]:10-12: note: type `Adapter` does not implement interface `Core.ImplicitAs(C(i32))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return a.x; } @@ -85,12 +81,8 @@ import library "extend_adapt_specific_type_library"; fn ImportedAccess(a: Adapter) -> i32 { // TODO: This should presumably work, but the design doesn't say how yet. - // 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))` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return a.x; - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_todo_import_extend_adapt_specific_type.carbon:[[@LINE+3]]:10-12: error: cannot implicitly convert expression of type `Adapter` to `C(i32)` [ConversionFailure] + // CHECK:STDERR: fail_todo_import_extend_adapt_specific_type.carbon:[[@LINE+2]]:10-12: note: type `Adapter` does not implement interface `Core.ImplicitAs(C(i32))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return a.x; } @@ -582,8 +574,8 @@ fn ImportedConvertLocal(a: Adapter(C)) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: %Adapter = name_ref a, %a // CHECK:STDOUT: %x.ref: %C.elem.0b0 = name_ref x, @C.%field_decl [concrete = @C.%field_decl] -// CHECK:STDOUT: %.loc21_11.1: %C.4da = converted %a.ref, [concrete = ] -// CHECK:STDOUT: %.loc21_11.2: %i32 = class_element_access , element0 [concrete = ] +// CHECK:STDOUT: %.loc17_11.1: %C.4da = converted %a.ref, [concrete = ] +// CHECK:STDOUT: %.loc17_11.2: %i32 = class_element_access , element0 [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -832,8 +824,8 @@ fn ImportedConvertLocal(a: Adapter(C)) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: %Adapter = name_ref a, %a // CHECK:STDOUT: %x.ref: %C.elem.0b0 = name_ref x, imports.%Main.import_ref.130 [concrete = imports.%field_decl] -// CHECK:STDOUT: %.loc15_11.1: %C.4da = converted %a.ref, [concrete = ] -// CHECK:STDOUT: %.loc15_11.2: %i32 = class_element_access , element0 [concrete = ] +// CHECK:STDOUT: %.loc11_11.1: %C.4da = converted %a.ref, [concrete = ] +// CHECK:STDOUT: %.loc11_11.2: %i32 = class_element_access , element0 [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/generic/base_is_generic.carbon b/toolchain/check/testdata/class/generic/base_is_generic.carbon index 50c563d14613..aaac98e1932d 100644 --- a/toolchain/check/testdata/class/generic/base_is_generic.carbon +++ b/toolchain/check/testdata/class/generic/base_is_generic.carbon @@ -47,9 +47,7 @@ fn ImportedDoubleFieldAccess(d: Derived) -> i32 { library "[[@TEST_NAME]]"; class C(T: type) { - // CHECK:STDERR: fail_todo_extend_symbolic_base.carbon:[[@LINE+4]]:16: error: deriving from final type `T`; base type must be an `abstract` or `base` class [BaseIsFinal] - // CHECK:STDERR: extend base: T; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_todo_extend_symbolic_base.carbon:[[@LINE+2]]:16: error: deriving from final type `T`; base type must be an `abstract` or `base` class [BaseIsFinal] // CHECK:STDERR: extend base: T; } @@ -520,14 +518,14 @@ fn H() { // CHECK:STDOUT: // CHECK:STDOUT: class { // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc4_10.2 [symbolic = %T.loc4_10.1 (constants.%T)] -// CHECK:STDOUT: %.loc9: = base_decl , element0 [concrete] +// CHECK:STDOUT: %.loc7: = base_decl , element0 [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness [concrete = ] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C.04a // CHECK:STDOUT: .T = -// CHECK:STDOUT: .base = %.loc9 +// CHECK:STDOUT: .base = %.loc7 // CHECK:STDOUT: .G = // CHECK:STDOUT: has_error // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/generic/call.carbon b/toolchain/check/testdata/class/generic/call.carbon index d8399e7d4bc3..bab549f897ba 100644 --- a/toolchain/check/testdata/class/generic/call.carbon +++ b/toolchain/check/testdata/class/generic/call.carbon @@ -29,12 +29,8 @@ library "[[@TEST_NAME]]"; class Class(T: type, N: i32) {} -// CHECK:STDERR: fail_too_few.carbon:[[@LINE+7]]:8: error: 1 argument passed to generic class expecting 2 arguments [CallArgCountMismatch] -// CHECK:STDERR: var a: Class(i32*); -// CHECK:STDERR: ^~~~~~~~~~~ -// CHECK:STDERR: fail_too_few.carbon:[[@LINE-5]]:1: note: calling generic class declared here [InCallToEntity] -// CHECK:STDERR: class Class(T: type, N: i32) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_few.carbon:[[@LINE+3]]:8-18: error: 1 argument passed to generic class expecting 2 arguments [CallArgCountMismatch] +// CHECK:STDERR: fail_too_few.carbon:[[@LINE-3]]:1-30: note: calling generic class declared here [InCallToEntity] // CHECK:STDERR: var a: Class(i32*); @@ -44,12 +40,8 @@ library "[[@TEST_NAME]]"; class Class(T: type, N: i32) {} -// CHECK:STDERR: fail_too_many.carbon:[[@LINE+7]]:8: error: 3 arguments passed to generic class expecting 2 arguments [CallArgCountMismatch] -// CHECK:STDERR: var a: Class(i32*, 1, 2); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_too_many.carbon:[[@LINE-5]]:1: note: calling generic class declared here [InCallToEntity] -// CHECK:STDERR: class Class(T: type, N: i32) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_many.carbon:[[@LINE+3]]:8-24: error: 3 arguments passed to generic class expecting 2 arguments [CallArgCountMismatch] +// CHECK:STDERR: fail_too_many.carbon:[[@LINE-3]]:1-30: note: calling generic class declared here [InCallToEntity] // CHECK:STDERR: var a: Class(i32*, 1, 2); @@ -59,15 +51,9 @@ library "[[@TEST_NAME]]"; 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)` [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] -// CHECK:STDERR: class Class(T: type, N: i32) {} -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+4]]:8-21: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] +// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+3]]:8-21: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE-4]]:13-19: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: var a: Class(5, i32*); @@ -565,7 +551,7 @@ class Outer(T: type) { // CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [concrete = constants.%int_5] // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %ptr: type = ptr_type %i32 [concrete = constants.%ptr] -// CHECK:STDOUT: %.loc16: type = converted %int_5, [concrete = ] +// CHECK:STDOUT: %.loc10: type = converted %int_5, [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %a: = wrapper_binding a, [concrete = ] // CHECK:STDOUT: name_binding_decl { diff --git a/toolchain/check/testdata/class/generic/complete_in_conversion.carbon b/toolchain/check/testdata/class/generic/complete_in_conversion.carbon index 0a9a2eccc74d..132cf1474467 100644 --- a/toolchain/check/testdata/class/generic/complete_in_conversion.carbon +++ b/toolchain/check/testdata/class/generic/complete_in_conversion.carbon @@ -25,12 +25,8 @@ class A(N: i32) { } fn F(a: A(0)*) { - // 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: fail_derived_to_base.carbon:[[@LINE+3]]:22: error: unable to monomorphize specific `A(0)` [ResolvingSpecificHere] + // CHECK:STDERR: fail_derived_to_base.carbon:[[@LINE-5]]:10-15: note: integer type width of 0 is not positive [IntWidthNotPositive] // CHECK:STDERR: let unused b: B* = a; } @@ -251,15 +247,15 @@ fn F(a: A(0)*) { // CHECK:STDOUT: fn @F(%a.param: %ptr.0b6) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: %ptr.0b6 = name_ref a, %a -// CHECK:STDOUT: %.loc20_22.1: ref %A.10a = deref %a.ref -// CHECK:STDOUT: %.loc20_22.2: ref %B = class_element_access %.loc20_22.1, element0 -// CHECK:STDOUT: %addr: %ptr.432 = addr_of %.loc20_22.2 -// CHECK:STDOUT: %.loc20_22.3: %ptr.432 = converted %a.ref, %addr -// CHECK:STDOUT: %.loc20_18: type = splice_block %ptr.loc20 [concrete = constants.%ptr.432] { +// CHECK:STDOUT: %.loc16_22.1: ref %A.10a = deref %a.ref +// CHECK:STDOUT: %.loc16_22.2: ref %B = class_element_access %.loc16_22.1, element0 +// CHECK:STDOUT: %addr: %ptr.432 = addr_of %.loc16_22.2 +// CHECK:STDOUT: %.loc16_22.3: %ptr.432 = converted %a.ref, %addr +// CHECK:STDOUT: %.loc16_18: type = splice_block %ptr.loc16 [concrete = constants.%ptr.432] { // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B] -// CHECK:STDOUT: %ptr.loc20: type = ptr_type %B.ref [concrete = constants.%ptr.432] +// CHECK:STDOUT: %ptr.loc16: type = ptr_type %B.ref [concrete = constants.%ptr.432] // CHECK:STDOUT: } -// CHECK:STDOUT: %b: %ptr.432 = wrapper_binding b, %.loc20_22.3 +// CHECK:STDOUT: %b: %ptr.432 = wrapper_binding b, %.loc16_22.3 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %b.patt: %pattern_type.3c8 = value_binding_pattern b [concrete = constants.%b.patt] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/generic/generic_vs_params.carbon b/toolchain/check/testdata/class/generic/generic_vs_params.carbon index a7332064953e..6295230c6d03 100644 --- a/toolchain/check/testdata/class/generic/generic_vs_params.carbon +++ b/toolchain/check/testdata/class/generic/generic_vs_params.carbon @@ -37,9 +37,7 @@ var e: C(X).GenericAndParams(X) = {}; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_non_generic_implicit_params.carbon:[[@LINE+4]]:9: error: parameters of generic types must be constant [GenericParamMustBeConstant] -// CHECK:STDERR: class A[runtime T: type]() {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_non_generic_implicit_params.carbon:[[@LINE+2]]:9-23: error: parameters of generic types must be constant [GenericParamMustBeConstant] // CHECK:STDERR: class A[runtime T: type]() {} @@ -47,9 +45,7 @@ class A[runtime T: type]() {} library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_non_generic_params.carbon:[[@LINE+4]]:9: error: parameters of generic types must be constant [GenericParamMustBeConstant] -// CHECK:STDERR: class A(runtime T: type) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_non_generic_params.carbon:[[@LINE+2]]:9-23: error: parameters of generic types must be constant [GenericParamMustBeConstant] // CHECK:STDERR: class A(runtime T: type) {} @@ -62,9 +58,7 @@ fn F(generic T: type) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_implicit_params_only_empty.carbon:[[@LINE+4]]:10: error: expected explicit parameters after implicit parameters [GenericMissingExplicitParameters] -// CHECK:STDERR: class Foo[]; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_implicit_params_only_empty.carbon:[[@LINE+2]]:10-11: error: expected explicit parameters after implicit parameters [GenericMissingExplicitParameters] // CHECK:STDERR: class Foo[]; @@ -72,9 +66,7 @@ class Foo[]; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_implicit_params_only.carbon:[[@LINE+4]]:10: error: expected explicit parameters after implicit parameters [GenericMissingExplicitParameters] -// CHECK:STDERR: class Foo[T: type]; -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_implicit_params_only.carbon:[[@LINE+2]]:10-18: error: expected explicit parameters after implicit parameters [GenericMissingExplicitParameters] // CHECK:STDERR: class Foo[T: type]; @@ -442,13 +434,13 @@ class Foo[T: type]; // CHECK:STDOUT: } // CHECK:STDOUT: %A.decl: %A.type = class_decl @A [concrete = constants.%A.generic] {} {} // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { -// CHECK:STDOUT: %T.patt.loc11_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc9_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_15.2 (constants.%T.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc11_17.1: type = splice_block %.loc11_17.2 [concrete = type] { +// CHECK:STDOUT: %.loc9_17.1: type = splice_block %.loc9_17.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc11_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc9_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc11_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc11_15.1 (constants.%T)] +// CHECK:STDOUT: %T.loc9_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc9_15.1 (constants.%T)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -460,24 +452,24 @@ class Foo[T: type]; // CHECK:STDOUT: .Self = constants.%A // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F(%T.loc11_15.2: type) { -// CHECK:STDOUT: %T.patt.loc11_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc11_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc11_15.1 (constants.%T)] +// CHECK:STDOUT: generic fn @F(%T.loc9_15.2: type) { +// CHECK:STDOUT: %T.patt.loc9_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc9_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc9_15.1 (constants.%T)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref: %A.type = name_ref A, file.%A.decl [concrete = constants.%A.generic] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc11_15.2 [symbolic = %T.loc11_15.1 (constants.%T)] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc9_15.2 [symbolic = %T.loc9_15.1 (constants.%T)] // CHECK:STDOUT: %A: type = class_type @A [concrete = constants.%A] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @F(constants.%T) { -// CHECK:STDOUT: %T.patt.loc11_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc11_15.1 => constants.%T +// CHECK:STDOUT: %T.patt.loc9_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc9_15.1 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_implicit_params_only_empty.carbon @@ -514,25 +506,25 @@ class Foo[T: type]; // CHECK:STDOUT: .Foo = %Foo.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Foo.decl: %Foo.type = class_decl @Foo [concrete = constants.%Foo.generic] { -// CHECK:STDOUT: %T.patt.loc8_12.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_12.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc6_12.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_12.2 (constants.%T.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc8_14.1: type = splice_block %.loc8_14.2 [concrete = type] { +// CHECK:STDOUT: %.loc6_14.1: type = splice_block %.loc6_14.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc8_14.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc6_14.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc8_12.2: type = symbolic_binding T, 0 [symbolic = %T.loc8_12.1 (constants.%T)] +// CHECK:STDOUT: %T.loc6_12.2: type = symbolic_binding T, 0 [symbolic = %T.loc6_12.1 (constants.%T)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @Foo(%T.loc8_12.2: type) { -// CHECK:STDOUT: %T.patt.loc8_12.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_12.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc8_12.1: type = symbolic_binding T, 0 [symbolic = %T.loc8_12.1 (constants.%T)] +// CHECK:STDOUT: generic class @Foo(%T.loc6_12.2: type) { +// CHECK:STDOUT: %T.patt.loc6_12.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_12.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc6_12.1: type = symbolic_binding T, 0 [symbolic = %T.loc6_12.1 (constants.%T)] // CHECK:STDOUT: // CHECK:STDOUT: class; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Foo(constants.%T) { -// CHECK:STDOUT: %T.patt.loc8_12.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc8_12.1 => constants.%T +// CHECK:STDOUT: %T.patt.loc6_12.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc6_12.1 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/generic/import.carbon b/toolchain/check/testdata/class/generic/import.carbon index 1921d5965c88..2b557a88b81c 100644 --- a/toolchain/check/testdata/class/generic/import.carbon +++ b/toolchain/check/testdata/class/generic/import.carbon @@ -58,12 +58,8 @@ library "[[@TEST_NAME]]"; import library "foo"; 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*))` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var unused v: CompleteClass(i32*) = F(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_generic_arg_mismatch.carbon:[[@LINE+3]]:3-35: error: cannot implicitly convert expression of type `CompleteClass(i32)` to `CompleteClass(i32*)` [ConversionFailure] + // CHECK:STDERR: fail_generic_arg_mismatch.carbon:[[@LINE+2]]:3-35: note: type `CompleteClass(i32)` does not implement interface `Core.ImplicitAs(CompleteClass(i32*))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused v: CompleteClass(i32*) = F(); } @@ -72,18 +68,12 @@ fn Use() { impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_foo.impl.carbon:[[@LINE+8]]:13: error: redeclaration differs at parameter 1 [RedeclParamDiffers] -// CHECK:STDERR: class Class(U: type) { -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_foo.impl.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: foo.carbon:4:13: note: previous declaration's corresponding parameter here [RedeclParamPrevious] -// CHECK:STDERR: class Class(T: type); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_foo.impl.carbon:[[@LINE+4]]:13-19: error: redeclaration differs at parameter 1 [RedeclParamDiffers] +// CHECK:STDERR: imported from: fail_foo.impl.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: foo.carbon:4:13-19: note: previous declaration's corresponding parameter here [RedeclParamPrevious] // CHECK:STDERR: class Class(U: type) { - // CHECK:STDERR: fail_foo.impl.carbon:[[@LINE+4]]:10: error: name `T` not found [NameNotFound] - // CHECK:STDERR: var x: T; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_foo.impl.carbon:[[@LINE+2]]:10: error: name `T` not found [NameNotFound] // CHECK:STDERR: var x: T; } @@ -861,26 +851,26 @@ class Class(U: type) { // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] // CHECK:STDOUT: %self.param_patt.0c5: %pattern_type.d94 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.749: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt.0c5 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc13_3.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc9_3.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc13_3.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc9_3.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.1: %Destroy.WithSelf.Op.type.ef016f.1 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1: type = fn_type @Destroy.WithSelf.SelfDestruct.loc13_3.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1: type = fn_type @Destroy.WithSelf.SelfDestruct.loc9_3.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.1: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1 = struct_value () [concrete] // CHECK:STDOUT: %pattern_type.5c4: type = pattern_type %struct_type.n [concrete] // CHECK:STDOUT: %self.param_patt.d03: %pattern_type.5c4 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.3cd: %pattern_type.5c4 = wrapper_binding_pattern self, %self.param_patt.d03 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc13_3.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc9_3.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc13_3.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc9_3.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.2: %Destroy.WithSelf.Op.type.ef016f.2 = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.f3f: %pattern_type.c65 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.d9d: %pattern_type.c65 = wrapper_binding_pattern self, %self.param_patt.f3f [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc13_3.3 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc9_3.3 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc13_3.3 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc9_3.3 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.3: %Destroy.WithSelf.Op.type.ef016f.3 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.3: type = fn_type @Destroy.WithSelf.SelfDestruct.loc13_3.3 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.3: type = fn_type @Destroy.WithSelf.SelfDestruct.loc9_3.3 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.3: %Destroy.WithSelf.SelfDestruct.type.fbceb5.3 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -909,42 +899,42 @@ class Class(U: type) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc13_3.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc9_3.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d94 = ref_param_pattern [concrete = constants.%self.param_patt.0c5] // CHECK:STDOUT: %self.patt: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.749] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %i32 = ref_param call_param0 // CHECK:STDOUT: %self: ref %i32 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc13_3.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc9_3.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d94 = ref_param_pattern [concrete = constants.%self.param_patt.0c5] // CHECK:STDOUT: %self.patt: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.749] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %i32 = ref_param call_param0 // CHECK:STDOUT: %self: ref %i32 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc13_3.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc9_3.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.5c4 = ref_param_pattern [concrete = constants.%self.param_patt.d03] // CHECK:STDOUT: %self.patt: %pattern_type.5c4 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.3cd] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %struct_type.n = ref_param call_param0 // CHECK:STDOUT: %self: ref %struct_type.n = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc13_3.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc9_3.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.5c4 = ref_param_pattern [concrete = constants.%self.param_patt.d03] // CHECK:STDOUT: %self.patt: %pattern_type.5c4 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.3cd] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %struct_type.n = ref_param call_param0 // CHECK:STDOUT: %self: ref %struct_type.n = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc13_3.3 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.3] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc9_3.3 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.3] { // CHECK:STDOUT: %self.param_patt: %pattern_type.c65 = ref_param_pattern [concrete = constants.%self.param_patt.f3f] // CHECK:STDOUT: %self.patt: %pattern_type.c65 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.d9d] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %CompleteClass.860 = ref_param call_param0 // CHECK:STDOUT: %self: ref %CompleteClass.860 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.3: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc13_3.3 [concrete = constants.%Destroy.WithSelf.Op.403171.3] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.3: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc9_3.3 [concrete = constants.%Destroy.WithSelf.Op.403171.3] { // CHECK:STDOUT: %self.param_patt: %pattern_type.c65 = ref_param_pattern [concrete = constants.%self.param_patt.f3f] // CHECK:STDOUT: %self.patt: %pattern_type.c65 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.d9d] // CHECK:STDOUT: } { @@ -990,11 +980,11 @@ class Class(U: type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %v.var: ref %CompleteClass.860 = var_storage %v.var_patt // CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%Main.F [concrete = constants.%F] -// CHECK:STDOUT: %.loc13_41: ref %CompleteClass.09c = temporary_storage -// CHECK:STDOUT: %F.call: init %CompleteClass.09c to %.loc13_41 = call %F.ref() -// CHECK:STDOUT: %.loc13_3: %CompleteClass.860 = converted %F.call, [concrete = ] +// CHECK:STDOUT: %.loc9_41: ref %CompleteClass.09c = temporary_storage +// CHECK:STDOUT: %F.call: init %CompleteClass.09c to %.loc9_41 = call %F.ref() +// CHECK:STDOUT: %.loc9_3: %CompleteClass.860 = converted %F.call, [concrete = ] // CHECK:STDOUT: assign %v.var, -// CHECK:STDOUT: %.loc13_35: type = splice_block %CompleteClass [concrete = constants.%CompleteClass.860] { +// CHECK:STDOUT: %.loc9_35: type = splice_block %CompleteClass [concrete = constants.%CompleteClass.860] { // CHECK:STDOUT: %CompleteClass.ref: %CompleteClass.type = name_ref CompleteClass, imports.%Main.CompleteClass [concrete = constants.%CompleteClass.generic] // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %ptr: type = ptr_type %i32 [concrete = constants.%ptr.a17] @@ -1018,46 +1008,46 @@ class Class(U: type) { // CHECK:STDOUT: // CHECK:STDOUT: fn @F [from "foo.carbon"]; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc13_3.1(%self.param: ref %i32) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc9_3.1(%self.param: ref %i32) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc13_3.1(%self.param: ref %i32) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc9_3.1(%self.param: ref %i32) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc13_3.1(%self.param: ref %i32) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc9_3.1(%self.param: ref %i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.1(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.1(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc13_3.2(%self.param: ref %struct_type.n) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc9_3.2(%self.param: ref %struct_type.n) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc13: ref %i32 = struct_access %self.param, element0 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc13, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc13) +// CHECK:STDOUT: %.loc9: ref %i32 = struct_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc9, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc9) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc13_3.2(%self.param: ref %struct_type.n) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc9_3.2(%self.param: ref %struct_type.n) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc13_3.2(%self.param: ref %struct_type.n) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc9_3.2(%self.param: ref %struct_type.n) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.2(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.2(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc13_3.3(%self.param: ref %CompleteClass.860) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc9_3.3(%self.param: ref %CompleteClass.860) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %n.ref: %CompleteClass.elem.609 = name_ref n, imports.%Main.import_ref.14b [concrete = imports.%field_decl] -// CHECK:STDOUT: %.loc13: ref %i32 = class_element_access %self.param, element0 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc13, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc13) +// CHECK:STDOUT: %.loc9: ref %i32 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc9, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc9) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc13_3.3(%self.param: ref %CompleteClass.860) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc9_3.3(%self.param: ref %CompleteClass.860) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc13_3.3(%self.param: ref %CompleteClass.860) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc9_3.3(%self.param: ref %CompleteClass.860) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.3(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.3(%self.param) @@ -1111,9 +1101,9 @@ class Class(U: type) { // CHECK:STDOUT: %Class.generic.d9d1e3.1: %Class.type.e90e5c.1 = struct_value () [concrete] // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %T.patt: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic] -// CHECK:STDOUT: %Class.type.e90e5c.2: type = parameterized_class_name_type @Class.loc12 [concrete] +// CHECK:STDOUT: %Class.type.e90e5c.2: type = parameterized_class_name_type @Class.loc8 [concrete] // CHECK:STDOUT: %Class.generic.d9d1e3.2: %Class.type.e90e5c.2 = struct_value () [concrete] -// CHECK:STDOUT: %Class.d9697b.2: type = class_type @Class.loc12, @Class.loc12(%U) [symbolic] +// CHECK:STDOUT: %Class.d9697b.2: type = class_type @Class.loc8, @Class.loc8(%U) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -1138,14 +1128,14 @@ class Class(U: type) { // CHECK:STDOUT: %default.import.loc2_19.1 = import // CHECK:STDOUT: %default.import.loc2_19.2 = import // CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Class.decl: %Class.type.e90e5c.2 = class_decl @Class.loc12 [concrete = constants.%Class.generic.d9d1e3.2] { -// CHECK:STDOUT: %U.patt.loc12_14.1: %pattern_type.9a5 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc12_14.2 (constants.%U.patt)] +// CHECK:STDOUT: %Class.decl: %Class.type.e90e5c.2 = class_decl @Class.loc8 [concrete = constants.%Class.generic.d9d1e3.2] { +// CHECK:STDOUT: %U.patt.loc8_14.1: %pattern_type.9a5 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc8_14.2 (constants.%U.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc12_16.1: type = splice_block %.loc12_16.2 [concrete = type] { +// CHECK:STDOUT: %.loc8_16.1: type = splice_block %.loc8_16.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc12_16.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc8_16.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %U.loc12_14.2: type = symbolic_binding U, 0 [symbolic = %U.loc12_14.1 (constants.%U)] +// CHECK:STDOUT: %U.loc8_14.2: type = symbolic_binding U, 0 [symbolic = %U.loc8_14.1 (constants.%U)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1156,9 +1146,9 @@ class Class(U: type) { // CHECK:STDOUT: class; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @Class.loc12(%U.loc12_14.2: type) { -// CHECK:STDOUT: %U.patt.loc12_14.2: %pattern_type.9a5 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc12_14.2 (constants.%U.patt)] -// CHECK:STDOUT: %U.loc12_14.1: type = symbolic_binding U, 0 [symbolic = %U.loc12_14.1 (constants.%U)] +// CHECK:STDOUT: generic class @Class.loc8(%U.loc8_14.2: type) { +// CHECK:STDOUT: %U.patt.loc8_14.2: %pattern_type.9a5 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc8_14.2 (constants.%U.patt)] +// CHECK:STDOUT: %U.loc8_14.1: type = symbolic_binding U, 0 [symbolic = %U.loc8_14.1 (constants.%U)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -1181,8 +1171,8 @@ class Class(U: type) { // CHECK:STDOUT: %T => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Class.loc12(constants.%U) { -// CHECK:STDOUT: %U.patt.loc12_14.2 => constants.%U.patt -// CHECK:STDOUT: %U.loc12_14.1 => constants.%U +// CHECK:STDOUT: specific @Class.loc8(constants.%U) { +// CHECK:STDOUT: %U.patt.loc8_14.2 => constants.%U.patt +// CHECK:STDOUT: %U.loc8_14.1 => constants.%U // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/generic/member_inline.carbon b/toolchain/check/testdata/class/generic/member_inline.carbon index 8989ce47c508..8b3220b24d0e 100644 --- a/toolchain/check/testdata/class/generic/member_inline.carbon +++ b/toolchain/check/testdata/class/generic/member_inline.carbon @@ -35,9 +35,7 @@ library "[[@TEST_NAME]]"; //@dump-sem-ir-begin class C(T: Core.Copy) { fn F() { - // CHECK:STDERR: fail_member_inline_missing_self_dot.carbon:[[@LINE+4]]:5: error: expression cannot be used as a value [UseOfNonExprAsValue] - // CHECK:STDERR: data; - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_member_inline_missing_self_dot.carbon:[[@LINE+2]]:5-8: error: expression cannot be used as a value [UseOfNonExprAsValue] // CHECK:STDERR: data; } @@ -351,9 +349,9 @@ class C(T: Core.Copy) { // CHECK:STDOUT: // CHECK:STDOUT: class { // CHECK:STDOUT: %C.F.decl: @C.%C.F.type (%C.F.type) = fn_decl @C.F [symbolic = @C.%C.F (constants.%C.F)] {} {} -// CHECK:STDOUT: %field_decl: @C.%C.elem (%C.elem) = field_decl data, element0, %.loc13_14.2 in [concrete] { -// CHECK:STDOUT: %.loc13_14.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc13_14.2: type = converted %.loc13_14.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %field_decl: @C.%C.elem (%C.elem) = field_decl data, element0, %.loc11_14.2 in [concrete] { +// CHECK:STDOUT: %.loc11_14.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc11_14.2: type = converted %.loc11_14.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: } // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%struct_type.data [concrete = constants.%complete_type] // CHECK:STDOUT: complete_type_witness = %complete_type @@ -373,8 +371,8 @@ class C(T: Core.Copy) { // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11: @C.F.%C.elem (%C.elem) = specific_constant @C.%field_decl, @C(constants.%T) [concrete = @C.%field_decl] -// CHECK:STDOUT: %data.ref: @C.F.%C.elem (%C.elem) = name_ref data, %.loc11 [concrete = @C.%field_decl] +// CHECK:STDOUT: %.loc9: @C.F.%C.elem (%C.elem) = specific_constant @C.%field_decl, @C(constants.%T) [concrete = @C.%field_decl] +// CHECK:STDOUT: %data.ref: @C.F.%C.elem (%C.elem) = name_ref data, %.loc9 [concrete = @C.%field_decl] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/generic/member_lookup.carbon b/toolchain/check/testdata/class/generic/member_lookup.carbon index 2380ec46ece2..cb7232d88cd1 100644 --- a/toolchain/check/testdata/class/generic/member_lookup.carbon +++ b/toolchain/check/testdata/class/generic/member_lookup.carbon @@ -53,25 +53,19 @@ class Derived(T: type) { } fn AccessMissingBase[T: type](x: Base(T)) -> T { - // CHECK:STDERR: fail_no_member.carbon:[[@LINE+4]]:10: error: member name `nonesuch` not found in `Base(T)` [MemberNameNotFoundInSpecificScope] - // CHECK:STDERR: return x.nonesuch; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_no_member.carbon:[[@LINE+2]]:10-19: error: member name `nonesuch` not found in `Base(T)` [MemberNameNotFoundInSpecificScope] // CHECK:STDERR: return x.nonesuch; } fn AccessMissingDerived[T: type](x: Derived(T)) -> T { - // CHECK:STDERR: fail_no_member.carbon:[[@LINE+4]]:10: error: member name `nonesuch` not found in `Derived(T)` [MemberNameNotFoundInSpecificScope] - // CHECK:STDERR: return x.nonesuch; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_no_member.carbon:[[@LINE+2]]:10-19: error: member name `nonesuch` not found in `Derived(T)` [MemberNameNotFoundInSpecificScope] // CHECK:STDERR: return x.nonesuch; } fn AccessMissingConcrete(x: Derived(i32)) -> i32 { - // CHECK:STDERR: fail_no_member.carbon:[[@LINE+4]]:10: error: member name `nonesuch` not found in `Derived(i32)` [MemberNameNotFoundInSpecificScope] - // CHECK:STDERR: return x.nonesuch; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_no_member.carbon:[[@LINE+2]]:10-19: error: member name `nonesuch` not found in `Derived(i32)` [MemberNameNotFoundInSpecificScope] // CHECK:STDERR: return x.nonesuch; } diff --git a/toolchain/check/testdata/class/generic/member_out_of_line.carbon b/toolchain/check/testdata/class/generic/member_out_of_line.carbon index bbb690e94902..34cf1ec0865e 100644 --- a/toolchain/check/testdata/class/generic/member_out_of_line.carbon +++ b/toolchain/check/testdata/class/generic/member_out_of_line.carbon @@ -52,12 +52,8 @@ class NotGeneric { fn F(); } -// CHECK:STDERR: fail_mismatched_not_generic_vs_generic.carbon:[[@LINE+7]]:4: error: redeclaration differs because of parameter list [RedeclParamListDiffers] -// CHECK:STDERR: fn NotGeneric(unused T: type).F() {} -// CHECK:STDERR: ^~~~~~~~~~ -// CHECK:STDERR: fail_mismatched_not_generic_vs_generic.carbon:[[@LINE-7]]:1: note: previously declared without parameter list [RedeclParamListPrevious] -// CHECK:STDERR: class NotGeneric { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_mismatched_not_generic_vs_generic.carbon:[[@LINE+3]]:4-13: error: redeclaration differs because of parameter list [RedeclParamListDiffers] +// CHECK:STDERR: fail_mismatched_not_generic_vs_generic.carbon:[[@LINE-5]]:1-18: note: previously declared without parameter list [RedeclParamListPrevious] // CHECK:STDERR: fn NotGeneric(unused T: type).F() {} @@ -69,12 +65,8 @@ class Generic(unused T: type) { fn TooFew(); } -// CHECK:STDERR: fail_mismatched_too_few_args.carbon:[[@LINE+7]]:4: error: redeclaration differs because of parameter count of 0 [RedeclParamCountDiffers] -// CHECK:STDERR: fn Generic().TooFew() {} -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_mismatched_too_few_args.carbon:[[@LINE-7]]:1: note: previously declared with parameter count of 1 [RedeclParamCountPrevious] -// CHECK:STDERR: class Generic(unused T: type) { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_mismatched_too_few_args.carbon:[[@LINE+3]]:4-10: error: redeclaration differs because of parameter count of 0 [RedeclParamCountDiffers] +// CHECK:STDERR: fail_mismatched_too_few_args.carbon:[[@LINE-5]]:1-31: note: previously declared with parameter count of 1 [RedeclParamCountPrevious] // CHECK:STDERR: fn Generic().TooFew() {} @@ -86,12 +78,8 @@ class Generic(T: type) { fn TooMany(); } -// CHECK:STDERR: fail_mismatched_too_many_args.carbon:[[@LINE+7]]:4: error: redeclaration differs because of parameter count of 2 [RedeclParamCountDiffers] -// CHECK:STDERR: fn Generic(unused T: type, unused U: type).TooMany() {} -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_mismatched_too_many_args.carbon:[[@LINE-7]]:1: note: previously declared with parameter count of 1 [RedeclParamCountPrevious] -// CHECK:STDERR: class Generic(T: type) { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_mismatched_too_many_args.carbon:[[@LINE+3]]:4-10: error: redeclaration differs because of parameter count of 2 [RedeclParamCountDiffers] +// CHECK:STDERR: fail_mismatched_too_many_args.carbon:[[@LINE-5]]:1-24: note: previously declared with parameter count of 1 [RedeclParamCountPrevious] // CHECK:STDERR: fn Generic(unused T: type, unused U: type).TooMany() {} @@ -103,12 +91,8 @@ class Generic(unused T: type) { fn WrongType(); } -// CHECK:STDERR: fail_mismatched_wrong_arg_type.carbon:[[@LINE+7]]:19: error: type `` of parameter 1 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] -// CHECK:STDERR: fn Generic(unused T: ()).WrongType() {} -// CHECK:STDERR: ^~~~~ -// CHECK:STDERR: fail_mismatched_wrong_arg_type.carbon:[[@LINE-7]]:22: note: previous declaration's corresponding parameter here [RedeclParamPrevious] -// CHECK:STDERR: class Generic(unused T: type) { -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_mismatched_wrong_arg_type.carbon:[[@LINE+3]]:19-23: error: type `` of parameter 1 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] +// CHECK:STDERR: fail_mismatched_wrong_arg_type.carbon:[[@LINE-5]]:22-28: note: previous declaration's corresponding parameter here [RedeclParamPrevious] // CHECK:STDERR: fn Generic(unused T: ()).WrongType() {} diff --git a/toolchain/check/testdata/class/generic/redeclare.carbon b/toolchain/check/testdata/class/generic/redeclare.carbon index c194104567d6..77f51ede79de 100644 --- a/toolchain/check/testdata/class/generic/redeclare.carbon +++ b/toolchain/check/testdata/class/generic/redeclare.carbon @@ -26,12 +26,8 @@ class Generic(T: type) { library "[[@TEST_NAME]]"; class A; -// CHECK:STDERR: fail_mismatch_param_list.carbon:[[@LINE+7]]:1: error: redeclaration differs because of parameter list [RedeclParamListDiffers] -// CHECK:STDERR: class A(T: type) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_mismatch_param_list.carbon:[[@LINE-4]]:1: note: previously declared without parameter list [RedeclParamListPrevious] -// CHECK:STDERR: class A; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_mismatch_param_list.carbon:[[@LINE+3]]:1-18: error: redeclaration differs because of parameter list [RedeclParamListDiffers] +// CHECK:STDERR: fail_mismatch_param_list.carbon:[[@LINE-2]]:1-8: note: previously declared without parameter list [RedeclParamListPrevious] // CHECK:STDERR: class A(T: type) {} @@ -42,12 +38,8 @@ library "[[@TEST_NAME]]"; class A {} class B(N: A); -// CHECK:STDERR: fail_mismatch_implicit_param_list.carbon:[[@LINE+7]]:1: error: redeclaration differs because of implicit parameter list [RedeclParamListDiffers] -// CHECK:STDERR: class B[T: type](N: T) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_mismatch_implicit_param_list.carbon:[[@LINE-4]]:1: note: previously declared without implicit parameter list [RedeclParamListPrevious] -// CHECK:STDERR: class B(N: A); -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_mismatch_implicit_param_list.carbon:[[@LINE+3]]:1-24: error: redeclaration differs because of implicit parameter list [RedeclParamListDiffers] +// CHECK:STDERR: fail_mismatch_implicit_param_list.carbon:[[@LINE-2]]:1-14: note: previously declared without implicit parameter list [RedeclParamListPrevious] // CHECK:STDERR: class B[T: type](N: T) {} @@ -58,12 +50,8 @@ library "[[@TEST_NAME]]"; class A {} class C(T: type); -// CHECK:STDERR: fail_mismatch_param_count.carbon:[[@LINE+7]]:1: error: redeclaration differs because of parameter count of 2 [RedeclParamCountDiffers] -// CHECK:STDERR: class C(T: type, U: A) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_mismatch_param_count.carbon:[[@LINE-4]]:1: note: previously declared with parameter count of 1 [RedeclParamCountPrevious] -// CHECK:STDERR: class C(T: type); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_mismatch_param_count.carbon:[[@LINE+3]]:1-24: error: redeclaration differs because of parameter count of 2 [RedeclParamCountDiffers] +// CHECK:STDERR: fail_mismatch_param_count.carbon:[[@LINE-2]]:1-17: note: previously declared with parameter count of 1 [RedeclParamCountPrevious] // CHECK:STDERR: class C(T: type, U: A) {} @@ -74,12 +62,8 @@ library "[[@TEST_NAME]]"; class A {} class D(T: type); -// CHECK:STDERR: fail_mismatch_param_type.carbon:[[@LINE+7]]:9: error: type `` of parameter 1 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] -// CHECK:STDERR: class D(T: A) {} -// CHECK:STDERR: ^~~~ -// CHECK:STDERR: fail_mismatch_param_type.carbon:[[@LINE-4]]:9: note: previous declaration's corresponding parameter here [RedeclParamPrevious] -// CHECK:STDERR: class D(T: type); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_mismatch_param_type.carbon:[[@LINE+3]]:9-12: error: type `` of parameter 1 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] +// CHECK:STDERR: fail_mismatch_param_type.carbon:[[@LINE-2]]:9-15: note: previous declaration's corresponding parameter here [RedeclParamPrevious] // CHECK:STDERR: class D(T: A) {} @@ -88,12 +72,8 @@ class D(T: A) {} library "[[@TEST_NAME]]"; class E(T: type); -// CHECK:STDERR: fail_mismatch_param_name.carbon:[[@LINE+7]]:9: error: redeclaration differs at parameter 1 [RedeclParamDiffers] -// CHECK:STDERR: class E(U: type) {} -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_mismatch_param_name.carbon:[[@LINE-4]]:9: note: previous declaration's corresponding parameter here [RedeclParamPrevious] -// CHECK:STDERR: class E(T: type); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_mismatch_param_name.carbon:[[@LINE+3]]:9-15: error: redeclaration differs at parameter 1 [RedeclParamDiffers] +// CHECK:STDERR: fail_mismatch_param_name.carbon:[[@LINE-2]]:9-15: note: previous declaration's corresponding parameter here [RedeclParamPrevious] // CHECK:STDERR: class E(U: type) {} @@ -174,9 +154,9 @@ class E(U: type) {} // CHECK:STDOUT: %pattern_type: type = pattern_type type [concrete] // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [symbolic] // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic] -// CHECK:STDOUT: %A.type: type = parameterized_class_name_type @A.loc12 [concrete] +// CHECK:STDOUT: %A.type: type = parameterized_class_name_type @A.loc8 [concrete] // CHECK:STDOUT: %A.generic: %A.type = struct_value () [concrete] -// CHECK:STDOUT: %A.59f: type = class_type @A.loc12, @A.loc12(%T) [symbolic] +// CHECK:STDOUT: %A.59f: type = class_type @A.loc8, @A.loc8(%T) [symbolic] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: } @@ -195,22 +175,22 @@ class E(U: type) {} // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %A.decl.loc4: type = class_decl @A.loc4 [concrete = constants.%A.5a2] {} {} -// CHECK:STDOUT: %A.decl.loc12: %A.type = class_decl @A.loc12 [concrete = constants.%A.generic] { -// CHECK:STDOUT: %T.patt.loc12_10.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc12_10.2 (constants.%T.patt)] +// CHECK:STDOUT: %A.decl.loc8: %A.type = class_decl @A.loc8 [concrete = constants.%A.generic] { +// CHECK:STDOUT: %T.patt.loc8_10.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_10.2 (constants.%T.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc12_12.1: type = splice_block %.loc12_12.2 [concrete = type] { +// CHECK:STDOUT: %.loc8_12.1: type = splice_block %.loc8_12.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc12_12.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc8_12.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc12_10.2: type = symbolic_binding T, 0 [symbolic = %T.loc12_10.1 (constants.%T)] +// CHECK:STDOUT: %T.loc8_10.2: type = symbolic_binding T, 0 [symbolic = %T.loc8_10.1 (constants.%T)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A.loc4; // CHECK:STDOUT: -// CHECK:STDOUT: generic class @A.loc12(%T.loc12_10.2: type) { -// CHECK:STDOUT: %T.patt.loc12_10.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc12_10.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc12_10.1: type = symbolic_binding T, 0 [symbolic = %T.loc12_10.1 (constants.%T)] +// CHECK:STDOUT: generic class @A.loc8(%T.loc8_10.2: type) { +// CHECK:STDOUT: %T.patt.loc8_10.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_10.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc8_10.1: type = symbolic_binding T, 0 [symbolic = %T.loc8_10.1 (constants.%T)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -223,9 +203,9 @@ class E(U: type) {} // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @A.loc12(constants.%T) { -// CHECK:STDOUT: %T.patt.loc12_10.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc12_10.1 => constants.%T +// CHECK:STDOUT: specific @A.loc8(constants.%T) { +// CHECK:STDOUT: %T.patt.loc8_10.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc8_10.1 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_mismatch_implicit_param_list.carbon @@ -247,9 +227,9 @@ class E(U: type) {} // CHECK:STDOUT: %pattern_type.51d: type = pattern_type %T [symbolic] // CHECK:STDOUT: %N.patt.9f0: %pattern_type.51d = symbolic_binding_pattern N, 1 [symbolic] // CHECK:STDOUT: %N.bd9: %T = symbolic_binding N, 1 [symbolic] -// CHECK:STDOUT: %B.type.7c49ec.2: type = parameterized_class_name_type @B.loc14 [concrete] +// CHECK:STDOUT: %B.type.7c49ec.2: type = parameterized_class_name_type @B.loc10 [concrete] // CHECK:STDOUT: %B.generic.4b73a1.2: %B.type.7c49ec.2 = struct_value () [concrete] -// CHECK:STDOUT: %B.cb8: type = class_type @B.loc14, @B.loc14(%T, %N.bd9) [symbolic] +// CHECK:STDOUT: %B.cb8: type = class_type @B.loc10, @B.loc10(%T, %N.bd9) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -276,20 +256,20 @@ class E(U: type) {} // CHECK:STDOUT: } // CHECK:STDOUT: %N.loc6_10.2: %A = symbolic_binding N, 0 [symbolic = %N.loc6_10.1 (constants.%N.37f)] // CHECK:STDOUT: } -// CHECK:STDOUT: %B.decl.loc14: %B.type.7c49ec.2 = class_decl @B.loc14 [concrete = constants.%B.generic.4b73a1.2] { -// CHECK:STDOUT: %T.patt.loc14_10.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc14_10.2 (constants.%T.patt)] -// CHECK:STDOUT: %N.patt.loc14_19.1: @B.loc14.%pattern_type (%pattern_type.51d) = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc14_19.2 (constants.%N.patt.9f0)] +// CHECK:STDOUT: %B.decl.loc10: %B.type.7c49ec.2 = class_decl @B.loc10 [concrete = constants.%B.generic.4b73a1.2] { +// CHECK:STDOUT: %T.patt.loc10_10.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_10.2 (constants.%T.patt)] +// CHECK:STDOUT: %N.patt.loc10_19.1: @B.loc10.%pattern_type (%pattern_type.51d) = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc10_19.2 (constants.%N.patt.9f0)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc14_12.1: type = splice_block %.loc14_12.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc14_10: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc14_12.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc10_12.1: type = splice_block %.loc10_12.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc10_10: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc10_12.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc14_10.2: type = symbolic_binding T, 0 [symbolic = %T.loc14_10.1 (constants.%T)] -// CHECK:STDOUT: %.loc14_21: type = splice_block %T.ref [symbolic = %T.loc14_10.1 (constants.%T)] { -// CHECK:STDOUT: %.Self.frozen.loc14_19: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc14_10.2 [symbolic = %T.loc14_10.1 (constants.%T)] +// CHECK:STDOUT: %T.loc10_10.2: type = symbolic_binding T, 0 [symbolic = %T.loc10_10.1 (constants.%T)] +// CHECK:STDOUT: %.loc10_21: type = splice_block %T.ref [symbolic = %T.loc10_10.1 (constants.%T)] { +// CHECK:STDOUT: %.Self.frozen.loc10_19: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc10_10.2 [symbolic = %T.loc10_10.1 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %N.loc14_19.2: @B.loc14.%T.loc14_10.1 (%T) = symbolic_binding N, 1 [symbolic = %N.loc14_19.1 (constants.%N.bd9)] +// CHECK:STDOUT: %N.loc10_19.2: @B.loc10.%T.loc10_10.1 (%T) = symbolic_binding N, 1 [symbolic = %N.loc10_19.1 (constants.%N.bd9)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -308,12 +288,12 @@ class E(U: type) {} // CHECK:STDOUT: class; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @B.loc14(%T.loc14_10.2: type, %N.loc14_19.2: @B.loc14.%T.loc14_10.1 (%T)) { -// CHECK:STDOUT: %T.patt.loc14_10.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc14_10.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc14_10.1: type = symbolic_binding T, 0 [symbolic = %T.loc14_10.1 (constants.%T)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %T.loc14_10.1 [symbolic = %pattern_type (constants.%pattern_type.51d)] -// CHECK:STDOUT: %N.patt.loc14_19.2: @B.loc14.%pattern_type (%pattern_type.51d) = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc14_19.2 (constants.%N.patt.9f0)] -// CHECK:STDOUT: %N.loc14_19.1: @B.loc14.%T.loc14_10.1 (%T) = symbolic_binding N, 1 [symbolic = %N.loc14_19.1 (constants.%N.bd9)] +// CHECK:STDOUT: generic class @B.loc10(%T.loc10_10.2: type, %N.loc10_19.2: @B.loc10.%T.loc10_10.1 (%T)) { +// CHECK:STDOUT: %T.patt.loc10_10.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_10.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc10_10.1: type = symbolic_binding T, 0 [symbolic = %T.loc10_10.1 (constants.%T)] +// CHECK:STDOUT: %pattern_type: type = pattern_type %T.loc10_10.1 [symbolic = %pattern_type (constants.%pattern_type.51d)] +// CHECK:STDOUT: %N.patt.loc10_19.2: @B.loc10.%pattern_type (%pattern_type.51d) = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc10_19.2 (constants.%N.patt.9f0)] +// CHECK:STDOUT: %N.loc10_19.1: @B.loc10.%T.loc10_10.1 (%T) = symbolic_binding N, 1 [symbolic = %N.loc10_19.1 (constants.%N.bd9)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -331,12 +311,12 @@ class E(U: type) {} // CHECK:STDOUT: %N.loc6_10.1 => constants.%N.37f // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @B.loc14(constants.%T, constants.%N.bd9) { -// CHECK:STDOUT: %T.patt.loc14_10.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc14_10.1 => constants.%T +// CHECK:STDOUT: specific @B.loc10(constants.%T, constants.%N.bd9) { +// CHECK:STDOUT: %T.patt.loc10_10.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc10_10.1 => constants.%T // CHECK:STDOUT: %pattern_type => constants.%pattern_type.51d -// CHECK:STDOUT: %N.patt.loc14_19.2 => constants.%N.patt.9f0 -// CHECK:STDOUT: %N.loc14_19.1 => constants.%N.bd9 +// CHECK:STDOUT: %N.patt.loc10_19.2 => constants.%N.patt.9f0 +// CHECK:STDOUT: %N.loc10_19.1 => constants.%N.bd9 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_mismatch_param_count.carbon @@ -355,9 +335,9 @@ class E(U: type) {} // CHECK:STDOUT: %pattern_type.9ef: type = pattern_type %A [concrete] // CHECK:STDOUT: %U.patt: %pattern_type.9ef = symbolic_binding_pattern U, 1 [symbolic] // CHECK:STDOUT: %U: %A = symbolic_binding U, 1 [symbolic] -// CHECK:STDOUT: %C.type.7a6f96.2: type = parameterized_class_name_type @C.loc14 [concrete] +// CHECK:STDOUT: %C.type.7a6f96.2: type = parameterized_class_name_type @C.loc10 [concrete] // CHECK:STDOUT: %C.generic.e6debf.2: %C.type.7a6f96.2 = struct_value () [concrete] -// CHECK:STDOUT: %C.4c2: type = class_type @C.loc14, @C.loc14(%T, %U) [symbolic] +// CHECK:STDOUT: %C.4c2: type = class_type @C.loc10, @C.loc10(%T, %U) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -384,20 +364,20 @@ class E(U: type) {} // CHECK:STDOUT: } // CHECK:STDOUT: %T.loc6_10.2: type = symbolic_binding T, 0 [symbolic = %T.loc6_10.1 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %C.decl.loc14: %C.type.7a6f96.2 = class_decl @C.loc14 [concrete = constants.%C.generic.e6debf.2] { -// CHECK:STDOUT: %T.patt.loc14_10.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc14_10.2 (constants.%T.patt)] -// CHECK:STDOUT: %U.patt.loc14_19.1: %pattern_type.9ef = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc14_19.2 (constants.%U.patt)] +// CHECK:STDOUT: %C.decl.loc10: %C.type.7a6f96.2 = class_decl @C.loc10 [concrete = constants.%C.generic.e6debf.2] { +// CHECK:STDOUT: %T.patt.loc10_10.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_10.2 (constants.%T.patt)] +// CHECK:STDOUT: %U.patt.loc10_19.1: %pattern_type.9ef = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc10_19.2 (constants.%U.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc14_12.1: type = splice_block %.loc14_12.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc14_10: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc14_12.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc10_12.1: type = splice_block %.loc10_12.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc10_10: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc10_12.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc14_10.2: type = symbolic_binding T, 0 [symbolic = %T.loc14_10.1 (constants.%T)] -// CHECK:STDOUT: %.loc14_21: type = splice_block %A.ref [concrete = constants.%A] { -// CHECK:STDOUT: %.Self.frozen.loc14_19: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %T.loc10_10.2: type = symbolic_binding T, 0 [symbolic = %T.loc10_10.1 (constants.%T)] +// CHECK:STDOUT: %.loc10_21: type = splice_block %A.ref [concrete = constants.%A] { +// CHECK:STDOUT: %.Self.frozen.loc10_19: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A] // CHECK:STDOUT: } -// CHECK:STDOUT: %U.loc14_19.2: %A = symbolic_binding U, 1 [symbolic = %U.loc14_19.1 (constants.%U)] +// CHECK:STDOUT: %U.loc10_19.2: %A = symbolic_binding U, 1 [symbolic = %U.loc10_19.1 (constants.%U)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -416,11 +396,11 @@ class E(U: type) {} // CHECK:STDOUT: class; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @C.loc14(%T.loc14_10.2: type, %U.loc14_19.2: %A) { -// CHECK:STDOUT: %T.patt.loc14_10.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc14_10.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc14_10.1: type = symbolic_binding T, 0 [symbolic = %T.loc14_10.1 (constants.%T)] -// CHECK:STDOUT: %U.patt.loc14_19.2: %pattern_type.9ef = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc14_19.2 (constants.%U.patt)] -// CHECK:STDOUT: %U.loc14_19.1: %A = symbolic_binding U, 1 [symbolic = %U.loc14_19.1 (constants.%U)] +// CHECK:STDOUT: generic class @C.loc10(%T.loc10_10.2: type, %U.loc10_19.2: %A) { +// CHECK:STDOUT: %T.patt.loc10_10.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_10.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc10_10.1: type = symbolic_binding T, 0 [symbolic = %T.loc10_10.1 (constants.%T)] +// CHECK:STDOUT: %U.patt.loc10_19.2: %pattern_type.9ef = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc10_19.2 (constants.%U.patt)] +// CHECK:STDOUT: %U.loc10_19.1: %A = symbolic_binding U, 1 [symbolic = %U.loc10_19.1 (constants.%U)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -438,11 +418,11 @@ class E(U: type) {} // CHECK:STDOUT: %T.loc6_10.1 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @C.loc14(constants.%T, constants.%U) { -// CHECK:STDOUT: %T.patt.loc14_10.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc14_10.1 => constants.%T -// CHECK:STDOUT: %U.patt.loc14_19.2 => constants.%U.patt -// CHECK:STDOUT: %U.loc14_19.1 => constants.%U +// CHECK:STDOUT: specific @C.loc10(constants.%T, constants.%U) { +// CHECK:STDOUT: %T.patt.loc10_10.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc10_10.1 => constants.%T +// CHECK:STDOUT: %U.patt.loc10_19.2 => constants.%U.patt +// CHECK:STDOUT: %U.loc10_19.1 => constants.%U // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_mismatch_param_type.carbon @@ -461,9 +441,9 @@ class E(U: type) {} // CHECK:STDOUT: %pattern_type.9ef: type = pattern_type %A [concrete] // CHECK:STDOUT: %T.patt.3a1: %pattern_type.9ef = symbolic_binding_pattern T, 0 [symbolic] // CHECK:STDOUT: %T.37f: %A = symbolic_binding T, 0 [symbolic] -// CHECK:STDOUT: %D.type.0f59a4.2: type = parameterized_class_name_type @D.loc14 [concrete] +// CHECK:STDOUT: %D.type.0f59a4.2: type = parameterized_class_name_type @D.loc10 [concrete] // CHECK:STDOUT: %D.generic.f4a710.2: %D.type.0f59a4.2 = struct_value () [concrete] -// CHECK:STDOUT: %D.703: type = class_type @D.loc14, @D.loc14(%T.37f) [symbolic] +// CHECK:STDOUT: %D.703: type = class_type @D.loc10, @D.loc10(%T.37f) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -490,14 +470,14 @@ class E(U: type) {} // CHECK:STDOUT: } // CHECK:STDOUT: %T.loc6_10.2: type = symbolic_binding T, 0 [symbolic = %T.loc6_10.1 (constants.%T.67d)] // CHECK:STDOUT: } -// CHECK:STDOUT: %D.decl.loc14: %D.type.0f59a4.2 = class_decl @D.loc14 [concrete = constants.%D.generic.f4a710.2] { -// CHECK:STDOUT: %T.patt.loc14_10.1: %pattern_type.9ef = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc14_10.2 (constants.%T.patt.3a1)] +// CHECK:STDOUT: %D.decl.loc10: %D.type.0f59a4.2 = class_decl @D.loc10 [concrete = constants.%D.generic.f4a710.2] { +// CHECK:STDOUT: %T.patt.loc10_10.1: %pattern_type.9ef = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_10.2 (constants.%T.patt.3a1)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc14: type = splice_block %A.ref [concrete = constants.%A] { +// CHECK:STDOUT: %.loc10: type = splice_block %A.ref [concrete = constants.%A] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc14_10.2: %A = symbolic_binding T, 0 [symbolic = %T.loc14_10.1 (constants.%T.37f)] +// CHECK:STDOUT: %T.loc10_10.2: %A = symbolic_binding T, 0 [symbolic = %T.loc10_10.1 (constants.%T.37f)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -516,9 +496,9 @@ class E(U: type) {} // CHECK:STDOUT: class; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @D.loc14(%T.loc14_10.2: %A) { -// CHECK:STDOUT: %T.patt.loc14_10.2: %pattern_type.9ef = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc14_10.2 (constants.%T.patt.3a1)] -// CHECK:STDOUT: %T.loc14_10.1: %A = symbolic_binding T, 0 [symbolic = %T.loc14_10.1 (constants.%T.37f)] +// CHECK:STDOUT: generic class @D.loc10(%T.loc10_10.2: %A) { +// CHECK:STDOUT: %T.patt.loc10_10.2: %pattern_type.9ef = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_10.2 (constants.%T.patt.3a1)] +// CHECK:STDOUT: %T.loc10_10.1: %A = symbolic_binding T, 0 [symbolic = %T.loc10_10.1 (constants.%T.37f)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -536,9 +516,9 @@ class E(U: type) {} // CHECK:STDOUT: %T.loc6_10.1 => constants.%T.67d // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @D.loc14(constants.%T.37f) { -// CHECK:STDOUT: %T.patt.loc14_10.2 => constants.%T.patt.3a1 -// CHECK:STDOUT: %T.loc14_10.1 => constants.%T.37f +// CHECK:STDOUT: specific @D.loc10(constants.%T.37f) { +// CHECK:STDOUT: %T.patt.loc10_10.2 => constants.%T.patt.3a1 +// CHECK:STDOUT: %T.loc10_10.1 => constants.%T.37f // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_mismatch_param_name.carbon @@ -553,9 +533,9 @@ class E(U: type) {} // CHECK:STDOUT: %E.generic.a02b8a.1: %E.type.d96618.1 = struct_value () [concrete] // CHECK:STDOUT: %U.patt: %pattern_type = symbolic_binding_pattern U, 0 [symbolic] // CHECK:STDOUT: %U: type = symbolic_binding U, 0 [symbolic] -// CHECK:STDOUT: %E.type.d96618.2: type = parameterized_class_name_type @E.loc12 [concrete] +// CHECK:STDOUT: %E.type.d96618.2: type = parameterized_class_name_type @E.loc8 [concrete] // CHECK:STDOUT: %E.generic.a02b8a.2: %E.type.d96618.2 = struct_value () [concrete] -// CHECK:STDOUT: %E.2b2fa7.2: type = class_type @E.loc12, @E.loc12(%U) [symbolic] +// CHECK:STDOUT: %E.2b2fa7.2: type = class_type @E.loc8, @E.loc8(%U) [symbolic] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: } @@ -582,14 +562,14 @@ class E(U: type) {} // CHECK:STDOUT: } // CHECK:STDOUT: %T.loc4_10.2: type = symbolic_binding T, 0 [symbolic = %T.loc4_10.1 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %E.decl.loc12: %E.type.d96618.2 = class_decl @E.loc12 [concrete = constants.%E.generic.a02b8a.2] { -// CHECK:STDOUT: %U.patt.loc12_10.1: %pattern_type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc12_10.2 (constants.%U.patt)] +// CHECK:STDOUT: %E.decl.loc8: %E.type.d96618.2 = class_decl @E.loc8 [concrete = constants.%E.generic.a02b8a.2] { +// CHECK:STDOUT: %U.patt.loc8_10.1: %pattern_type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc8_10.2 (constants.%U.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc12_12.1: type = splice_block %.loc12_12.2 [concrete = type] { +// CHECK:STDOUT: %.loc8_12.1: type = splice_block %.loc8_12.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc12_12.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc8_12.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %U.loc12_10.2: type = symbolic_binding U, 0 [symbolic = %U.loc12_10.1 (constants.%U)] +// CHECK:STDOUT: %U.loc8_10.2: type = symbolic_binding U, 0 [symbolic = %U.loc8_10.1 (constants.%U)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -600,9 +580,9 @@ class E(U: type) {} // CHECK:STDOUT: class; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @E.loc12(%U.loc12_10.2: type) { -// CHECK:STDOUT: %U.patt.loc12_10.2: %pattern_type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc12_10.2 (constants.%U.patt)] -// CHECK:STDOUT: %U.loc12_10.1: type = symbolic_binding U, 0 [symbolic = %U.loc12_10.1 (constants.%U)] +// CHECK:STDOUT: generic class @E.loc8(%U.loc8_10.2: type) { +// CHECK:STDOUT: %U.patt.loc8_10.2: %pattern_type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc8_10.2 (constants.%U.patt)] +// CHECK:STDOUT: %U.loc8_10.1: type = symbolic_binding U, 0 [symbolic = %U.loc8_10.1 (constants.%U)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -620,8 +600,8 @@ class E(U: type) {} // CHECK:STDOUT: %T.loc4_10.1 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @E.loc12(constants.%U) { -// CHECK:STDOUT: %U.patt.loc12_10.2 => constants.%U.patt -// CHECK:STDOUT: %U.loc12_10.1 => constants.%U +// CHECK:STDOUT: specific @E.loc8(constants.%U) { +// CHECK:STDOUT: %U.patt.loc8_10.2 => constants.%U.patt +// CHECK:STDOUT: %U.loc8_10.1 => constants.%U // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/generic/stringify.carbon b/toolchain/check/testdata/class/generic/stringify.carbon index f164bdd42501..2b5455f34704 100644 --- a/toolchain/check/testdata/class/generic/stringify.carbon +++ b/toolchain/check/testdata/class/generic/stringify.carbon @@ -20,12 +20,8 @@ class NoParams {} class EmptyParams() {} 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())` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var w: EmptyParams() = v; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_empty_params.carbon:[[@LINE+3]]:1-20: error: cannot implicitly convert expression of type `NoParams` to `EmptyParams()` [ConversionFailure] +// CHECK:STDERR: fail_empty_params.carbon:[[@LINE+2]]:1-20: note: type `NoParams` does not implement interface `Core.ImplicitAs(EmptyParams())` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var w: EmptyParams() = v; @@ -41,12 +37,8 @@ class Outer(T: type) { var v: Outer({}*); // TODO: It would be nice to include the `Outer({}*).` prefix in the name of `Inner`. -// 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}*))` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var w: Outer({}*).Inner({.a: i32}*) = v; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_nested.carbon:[[@LINE+3]]:1-35: error: cannot implicitly convert expression of type `Outer({}*)` to `Inner({.a: i32}*)` [ConversionFailure] +// CHECK:STDERR: fail_nested.carbon:[[@LINE+2]]:1-35: note: type `Outer({}*)` does not implement interface `Core.ImplicitAs(Inner({.a: i32}*))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var w: Outer({}*).Inner({.a: i32}*) = v; @@ -56,12 +48,8 @@ library "[[@TEST_NAME]]"; 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))` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var v: C(123) = (); -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_int_value.carbon:[[@LINE+3]]:1-13: error: cannot implicitly convert expression of type `()` to `C(123)` [ConversionFailure] +// CHECK:STDERR: fail_int_value.carbon:[[@LINE+2]]:1-13: note: type `()` does not implement interface `Core.ImplicitAs(C(123))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var v: C(123) = (); @@ -76,12 +64,8 @@ class D { class E(F: D) {} -// CHECK:STDERR: fail_class_param.carbon:[[@LINE+7]]:1: error: cannot implicitly convert expression of type `E({.a = 3, .b = 4})` to `E({.a = 1, .b = 2})` [ConversionFailure] -// CHECK:STDERR: var g: E({.a = 1, .b = 2}) = {} as E({.a = 3, .b = 4} as D); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_class_param.carbon:[[@LINE+4]]:1: note: type `E({.a = 3, .b = 4})` does not implement interface `Core.ImplicitAs(E({.a = 1, .b = 2}))` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var g: E({.a = 1, .b = 2}) = {} as E({.a = 3, .b = 4} as D); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_class_param.carbon:[[@LINE+3]]:1-26: error: cannot implicitly convert expression of type `E({.a = 3, .b = 4})` to `E({.a = 1, .b = 2})` [ConversionFailure] +// CHECK:STDERR: fail_class_param.carbon:[[@LINE+2]]:1-26: note: type `E({.a = 3, .b = 4})` does not implement interface `Core.ImplicitAs(E({.a = 1, .b = 2}))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var g: E({.a = 1, .b = 2}) = {} as E({.a = 3, .b = 4} as D); @@ -146,7 +130,7 @@ var g: E({.a = 1, .b = 2}) = {} as E({.a = 3, .b = 4} as D); // CHECK:STDOUT: %v.var_patt: %pattern_type.c07 = var_pattern %v.patt [concrete = constants.%v.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %w.var: ref %EmptyParams = var_storage %w.var_patt [concrete] -// CHECK:STDOUT: %.loc15: type = splice_block %EmptyParams [concrete = constants.%EmptyParams] { +// CHECK:STDOUT: %.loc11: type = splice_block %EmptyParams [concrete = constants.%EmptyParams] { // CHECK:STDOUT: %EmptyParams.ref: %EmptyParams.type = name_ref EmptyParams, %EmptyParams.decl [concrete = constants.%EmptyParams.generic] // CHECK:STDOUT: %EmptyParams: type = class_type @EmptyParams [concrete = constants.%EmptyParams] // CHECK:STDOUT: } @@ -184,7 +168,7 @@ var g: E({.a = 1, .b = 2}) = {} as E({.a = 3, .b = 4} as D); // CHECK:STDOUT: %T.as.DefaultOrUnformed.impl.Op.call: init %NoParams to %.loc7_1 = call %T.as.DefaultOrUnformed.impl.Op.specific_fn() // CHECK:STDOUT: assign file.%v.var, %T.as.DefaultOrUnformed.impl.Op.call // CHECK:STDOUT: %v.ref: ref %NoParams = name_ref v, file.%v [concrete = file.%v.var] -// CHECK:STDOUT: %.loc15: %EmptyParams = converted %v.ref, [concrete = ] +// CHECK:STDOUT: %.loc11: %EmptyParams = converted %v.ref, [concrete = ] // CHECK:STDOUT: assign file.%w.var, // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -283,17 +267,17 @@ var g: E({.a = 1, .b = 2}) = {} as E({.a = 3, .b = 4} as D); // CHECK:STDOUT: %v.var_patt: %pattern_type.dbc = var_pattern %v.patt [concrete = constants.%v.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %w.var: ref %Inner.8dc = var_storage %w.var_patt [concrete] -// CHECK:STDOUT: %.loc19_35: type = splice_block %Inner [concrete = constants.%Inner.8dc] { -// CHECK:STDOUT: %Outer.ref.loc19: %Outer.type = name_ref Outer, %Outer.decl [concrete = constants.%Outer.generic] -// CHECK:STDOUT: %.loc19_15: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc19_16: type = converted %.loc19_15, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %ptr.loc19_16: type = ptr_type %.loc19_16 [concrete = constants.%ptr.c28] -// CHECK:STDOUT: %Outer.loc19: type = class_type @Outer, @Outer(constants.%ptr.c28) [concrete = constants.%Outer.856] -// CHECK:STDOUT: %.loc19_18: %Inner.type.894 = specific_constant @Outer.%Inner.decl, @Outer(constants.%ptr.c28) [concrete = constants.%Inner.generic.787] -// CHECK:STDOUT: %Inner.ref: %Inner.type.894 = name_ref Inner, %.loc19_18 [concrete = constants.%Inner.generic.787] +// CHECK:STDOUT: %.loc15_35: type = splice_block %Inner [concrete = constants.%Inner.8dc] { +// CHECK:STDOUT: %Outer.ref.loc15: %Outer.type = name_ref Outer, %Outer.decl [concrete = constants.%Outer.generic] +// CHECK:STDOUT: %.loc15_15: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc15_16: type = converted %.loc15_15, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %ptr.loc15_16: type = ptr_type %.loc15_16 [concrete = constants.%ptr.c28] +// CHECK:STDOUT: %Outer.loc15: type = class_type @Outer, @Outer(constants.%ptr.c28) [concrete = constants.%Outer.856] +// CHECK:STDOUT: %.loc15_18: %Inner.type.894 = specific_constant @Outer.%Inner.decl, @Outer(constants.%ptr.c28) [concrete = constants.%Inner.generic.787] +// CHECK:STDOUT: %Inner.ref: %Inner.type.894 = name_ref Inner, %.loc15_18 [concrete = constants.%Inner.generic.787] // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %i32} [concrete = constants.%struct_type.a] -// CHECK:STDOUT: %ptr.loc19_34: type = ptr_type %struct_type.a [concrete = constants.%ptr.54f] +// CHECK:STDOUT: %ptr.loc15_34: type = ptr_type %struct_type.a [concrete = constants.%ptr.54f] // CHECK:STDOUT: %Inner: type = class_type @Inner, @Inner(constants.%ptr.c28, constants.%ptr.54f) [concrete = constants.%Inner.8dc] // CHECK:STDOUT: } // CHECK:STDOUT: %w: ref %Inner.8dc = wrapper_binding w, %w.var [concrete = %w.var] @@ -356,7 +340,7 @@ var g: E({.a = 1, .b = 2}) = {} as E({.a = 3, .b = 4} as D); // CHECK:STDOUT: %T.as.DefaultOrUnformed.impl.Op.call: init %Outer.856 to %.loc9_1 = call %T.as.DefaultOrUnformed.impl.Op.specific_fn() // CHECK:STDOUT: assign file.%v.var, %T.as.DefaultOrUnformed.impl.Op.call // CHECK:STDOUT: %v.ref: ref %Outer.856 = name_ref v, file.%v [concrete = file.%v.var] -// CHECK:STDOUT: %.loc19: %Inner.8dc = converted %v.ref, [concrete = ] +// CHECK:STDOUT: %.loc15: %Inner.8dc = converted %v.ref, [concrete = ] // CHECK:STDOUT: assign file.%w.var, // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -459,16 +443,16 @@ var g: E({.a = 1, .b = 2}) = {} as E({.a = 3, .b = 4} as D); // CHECK:STDOUT: %N.loc4_10.2: %i32 = symbolic_binding N, 0 [symbolic = %N.loc4_10.1 (constants.%N.c34)] // CHECK:STDOUT: } // CHECK:STDOUT: %v.var: ref %C.a98 = var_storage %v.var_patt [concrete] -// CHECK:STDOUT: %.loc13_13.1: type = splice_block %C [concrete = constants.%C.a98] { +// CHECK:STDOUT: %.loc9_13.1: type = splice_block %C [concrete = constants.%C.a98] { // CHECK:STDOUT: %C.ref: %C.type = name_ref C, %C.decl [concrete = constants.%C.generic] // CHECK:STDOUT: %int_123: Core.IntLiteral = int_value 123 [concrete = constants.%int_123.fff] // CHECK:STDOUT: %impl.elem0: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc13_13.1: = bound_method %int_123, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %bound_method.loc9_13.1: = bound_method %int_123, %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.loc13_13.2: = bound_method %int_123, %specific_fn [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc13_13.2(%int_123) [concrete = constants.%int_123.c07] -// CHECK:STDOUT: %.loc13_13.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_123.c07] -// CHECK:STDOUT: %.loc13_13.3: %i32 = converted %int_123, %.loc13_13.2 [concrete = constants.%int_123.c07] +// CHECK:STDOUT: %bound_method.loc9_13.2: = bound_method %int_123, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc9_13.2(%int_123) [concrete = constants.%int_123.c07] +// CHECK:STDOUT: %.loc9_13.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_123.c07] +// CHECK:STDOUT: %.loc9_13.3: %i32 = converted %int_123, %.loc9_13.2 [concrete = constants.%int_123.c07] // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%int_123.c07) [concrete = constants.%C.a98] // CHECK:STDOUT: } // CHECK:STDOUT: %v: ref %C.a98 = wrapper_binding v, %v.var [concrete = %v.var] @@ -495,8 +479,8 @@ var g: E({.a = 1, .b = 2}) = {} as E({.a = 3, .b = 4} as D); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc13_18: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc13_1: %C.a98 = converted %.loc13_18, [concrete = ] +// CHECK:STDOUT: %.loc9_18: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc9_1: %C.a98 = converted %.loc9_18, [concrete = ] // CHECK:STDOUT: assign file.%v.var, // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -611,32 +595,32 @@ var g: E({.a = 1, .b = 2}) = {} as E({.a = 3, .b = 4} as D); // CHECK:STDOUT: %F.loc9_10.2: %D = symbolic_binding F, 0 [symbolic = %F.loc9_10.1 (constants.%F)] // CHECK:STDOUT: } // CHECK:STDOUT: %g.var: ref %E.468 = var_storage %g.var_patt [concrete] -// CHECK:STDOUT: %.loc18_26.1: type = splice_block %E [concrete = constants.%E.468] { +// CHECK:STDOUT: %.loc14_26.1: type = splice_block %E [concrete = constants.%E.468] { // CHECK:STDOUT: %E.ref: %E.type = name_ref E, %E.decl [concrete = constants.%E.generic] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %.loc18_25.1: %struct_type.a.b.cfd = struct_literal (%int_1, %int_2) [concrete = constants.%struct.4aa] -// CHECK:STDOUT: %impl.elem0.loc18_25.1: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc18_25.1: = bound_method %int_1, %impl.elem0.loc18_25.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] -// CHECK:STDOUT: %specific_fn.loc18_25.1: = specific_function %impl.elem0.loc18_25.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc18_25.2: = bound_method %int_1, %specific_fn.loc18_25.1 [concrete = constants.%bound_method.3bd] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc18_25.1: init %i32 = call %bound_method.loc18_25.2(%int_1) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc18_25.2: init %i32 = converted %int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc18_25.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc18_25.3: ref %D = temporary_storage -// CHECK:STDOUT: %.loc18_25.4: ref %i32 = class_element_access %.loc18_25.3, element0 -// CHECK:STDOUT: %.loc18_25.5: init %i32 to %.loc18_25.4 = in_place_init %.loc18_25.2 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %impl.elem0.loc18_25.2: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc18_25.3: = bound_method %int_2, %impl.elem0.loc18_25.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6] -// CHECK:STDOUT: %specific_fn.loc18_25.2: = specific_function %impl.elem0.loc18_25.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc18_25.4: = bound_method %int_2, %specific_fn.loc18_25.2 [concrete = constants.%bound_method.a55] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc18_25.2: init %i32 = call %bound_method.loc18_25.4(%int_2) [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc18_25.6: init %i32 = converted %int_2, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc18_25.2 [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc18_25.7: ref %i32 = class_element_access %.loc18_25.3, element1 -// CHECK:STDOUT: %.loc18_25.8: init %i32 to %.loc18_25.7 = in_place_init %.loc18_25.6 [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc18_25.9: init %D to %.loc18_25.3 = class_init (%.loc18_25.5, %.loc18_25.8) [concrete = constants.%D.val.b5e] -// CHECK:STDOUT: %.loc18_26.2: init %D = converted %.loc18_25.1, %.loc18_25.9 [concrete = constants.%D.val.b5e] -// CHECK:STDOUT: %.loc18_26.3: ref %D = temporary %.loc18_25.3, %.loc18_26.2 [concrete = constants.%.738] -// CHECK:STDOUT: %.loc18_26.4: %D = acquire_value %.loc18_26.3 [concrete = constants.%D.val.b5e] +// CHECK:STDOUT: %.loc14_25.1: %struct_type.a.b.cfd = struct_literal (%int_1, %int_2) [concrete = constants.%struct.4aa] +// CHECK:STDOUT: %impl.elem0.loc14_25.1: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc14_25.1: = bound_method %int_1, %impl.elem0.loc14_25.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] +// CHECK:STDOUT: %specific_fn.loc14_25.1: = specific_function %impl.elem0.loc14_25.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc14_25.2: = bound_method %int_1, %specific_fn.loc14_25.1 [concrete = constants.%bound_method.3bd] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc14_25.1: init %i32 = call %bound_method.loc14_25.2(%int_1) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc14_25.2: init %i32 = converted %int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc14_25.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc14_25.3: ref %D = temporary_storage +// CHECK:STDOUT: %.loc14_25.4: ref %i32 = class_element_access %.loc14_25.3, element0 +// CHECK:STDOUT: %.loc14_25.5: init %i32 to %.loc14_25.4 = in_place_init %.loc14_25.2 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %impl.elem0.loc14_25.2: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc14_25.3: = bound_method %int_2, %impl.elem0.loc14_25.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6] +// CHECK:STDOUT: %specific_fn.loc14_25.2: = specific_function %impl.elem0.loc14_25.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc14_25.4: = bound_method %int_2, %specific_fn.loc14_25.2 [concrete = constants.%bound_method.a55] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc14_25.2: init %i32 = call %bound_method.loc14_25.4(%int_2) [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc14_25.6: init %i32 = converted %int_2, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc14_25.2 [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc14_25.7: ref %i32 = class_element_access %.loc14_25.3, element1 +// CHECK:STDOUT: %.loc14_25.8: init %i32 to %.loc14_25.7 = in_place_init %.loc14_25.6 [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc14_25.9: init %D to %.loc14_25.3 = class_init (%.loc14_25.5, %.loc14_25.8) [concrete = constants.%D.val.b5e] +// CHECK:STDOUT: %.loc14_26.2: init %D = converted %.loc14_25.1, %.loc14_25.9 [concrete = constants.%D.val.b5e] +// CHECK:STDOUT: %.loc14_26.3: ref %D = temporary %.loc14_25.3, %.loc14_26.2 [concrete = constants.%.738] +// CHECK:STDOUT: %.loc14_26.4: %D = acquire_value %.loc14_26.3 [concrete = constants.%D.val.b5e] // CHECK:STDOUT: %E: type = class_type @E, @E(constants.%D.val.b5e) [concrete = constants.%E.468] // CHECK:STDOUT: } // CHECK:STDOUT: %g: ref %E.468 = wrapper_binding g, %g.var [concrete = %g.var] @@ -679,38 +663,38 @@ var g: E({.a = 1, .b = 2}) = {} as E({.a = 3, .b = 4} as D); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc18_31.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc14_31.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: %E.ref: %E.type = name_ref E, file.%E.decl [concrete = constants.%E.generic] // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba] // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4.0c1] -// CHECK:STDOUT: %.loc18_53.1: %struct_type.a.b.cfd = struct_literal (%int_3, %int_4) [concrete = constants.%struct.cb7] +// CHECK:STDOUT: %.loc14_53.1: %struct_type.a.b.cfd = struct_literal (%int_3, %int_4) [concrete = constants.%struct.cb7] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [concrete = constants.%D] -// CHECK:STDOUT: %impl.elem0.loc18_53.1: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc18_53.1: = bound_method %int_3, %impl.elem0.loc18_53.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.b3c] -// CHECK:STDOUT: %specific_fn.loc18_53.1: = specific_function %impl.elem0.loc18_53.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc18_53.2: = bound_method %int_3, %specific_fn.loc18_53.1 [concrete = constants.%bound_method.fb0] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc18_53.1: init %i32 = call %bound_method.loc18_53.2(%int_3) [concrete = constants.%int_3.9f3] -// CHECK:STDOUT: %.loc18_53.2: init %i32 = converted %int_3, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc18_53.1 [concrete = constants.%int_3.9f3] -// CHECK:STDOUT: %.loc18_53.3: ref %D = temporary_storage -// CHECK:STDOUT: %.loc18_53.4: ref %i32 = class_element_access %.loc18_53.3, element0 -// CHECK:STDOUT: %.loc18_53.5: init %i32 to %.loc18_53.4 = in_place_init %.loc18_53.2 [concrete = constants.%int_3.9f3] -// CHECK:STDOUT: %impl.elem0.loc18_53.2: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc18_53.3: = bound_method %int_4, %impl.elem0.loc18_53.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.776] -// CHECK:STDOUT: %specific_fn.loc18_53.2: = specific_function %impl.elem0.loc18_53.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc18_53.4: = bound_method %int_4, %specific_fn.loc18_53.2 [concrete = constants.%bound_method.7fa] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc18_53.2: init %i32 = call %bound_method.loc18_53.4(%int_4) [concrete = constants.%int_4.6bf] -// CHECK:STDOUT: %.loc18_53.6: init %i32 = converted %int_4, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc18_53.2 [concrete = constants.%int_4.6bf] -// CHECK:STDOUT: %.loc18_53.7: ref %i32 = class_element_access %.loc18_53.3, element1 -// CHECK:STDOUT: %.loc18_53.8: init %i32 to %.loc18_53.7 = in_place_init %.loc18_53.6 [concrete = constants.%int_4.6bf] -// CHECK:STDOUT: %.loc18_53.9: init %D to %.loc18_53.3 = class_init (%.loc18_53.5, %.loc18_53.8) [concrete = constants.%D.val.db4] -// CHECK:STDOUT: %.loc18_55.1: init %D = converted %.loc18_53.1, %.loc18_53.9 [concrete = constants.%D.val.db4] -// CHECK:STDOUT: %.loc18_55.2: ref %D = temporary %.loc18_53.3, %.loc18_55.1 [concrete = constants.%.c27] -// CHECK:STDOUT: %.loc18_55.3: %D = acquire_value %.loc18_55.2 [concrete = constants.%D.val.db4] +// CHECK:STDOUT: %impl.elem0.loc14_53.1: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc14_53.1: = bound_method %int_3, %impl.elem0.loc14_53.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.b3c] +// CHECK:STDOUT: %specific_fn.loc14_53.1: = specific_function %impl.elem0.loc14_53.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc14_53.2: = bound_method %int_3, %specific_fn.loc14_53.1 [concrete = constants.%bound_method.fb0] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc14_53.1: init %i32 = call %bound_method.loc14_53.2(%int_3) [concrete = constants.%int_3.9f3] +// CHECK:STDOUT: %.loc14_53.2: init %i32 = converted %int_3, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc14_53.1 [concrete = constants.%int_3.9f3] +// CHECK:STDOUT: %.loc14_53.3: ref %D = temporary_storage +// CHECK:STDOUT: %.loc14_53.4: ref %i32 = class_element_access %.loc14_53.3, element0 +// CHECK:STDOUT: %.loc14_53.5: init %i32 to %.loc14_53.4 = in_place_init %.loc14_53.2 [concrete = constants.%int_3.9f3] +// CHECK:STDOUT: %impl.elem0.loc14_53.2: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc14_53.3: = bound_method %int_4, %impl.elem0.loc14_53.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.776] +// CHECK:STDOUT: %specific_fn.loc14_53.2: = specific_function %impl.elem0.loc14_53.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc14_53.4: = bound_method %int_4, %specific_fn.loc14_53.2 [concrete = constants.%bound_method.7fa] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc14_53.2: init %i32 = call %bound_method.loc14_53.4(%int_4) [concrete = constants.%int_4.6bf] +// CHECK:STDOUT: %.loc14_53.6: init %i32 = converted %int_4, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc14_53.2 [concrete = constants.%int_4.6bf] +// CHECK:STDOUT: %.loc14_53.7: ref %i32 = class_element_access %.loc14_53.3, element1 +// CHECK:STDOUT: %.loc14_53.8: init %i32 to %.loc14_53.7 = in_place_init %.loc14_53.6 [concrete = constants.%int_4.6bf] +// CHECK:STDOUT: %.loc14_53.9: init %D to %.loc14_53.3 = class_init (%.loc14_53.5, %.loc14_53.8) [concrete = constants.%D.val.db4] +// CHECK:STDOUT: %.loc14_55.1: init %D = converted %.loc14_53.1, %.loc14_53.9 [concrete = constants.%D.val.db4] +// CHECK:STDOUT: %.loc14_55.2: ref %D = temporary %.loc14_53.3, %.loc14_55.1 [concrete = constants.%.c27] +// CHECK:STDOUT: %.loc14_55.3: %D = acquire_value %.loc14_55.2 [concrete = constants.%D.val.db4] // CHECK:STDOUT: %E: type = class_type @E, @E(constants.%D.val.db4) [concrete = constants.%E.dc1] -// CHECK:STDOUT: %.loc18_31.2: ref %E.dc1 = temporary_storage -// CHECK:STDOUT: %.loc18_31.3: init %E.dc1 to %.loc18_31.2 = class_init () [concrete = constants.%E.val] -// CHECK:STDOUT: %.loc18_33: init %E.dc1 = converted %.loc18_31.1, %.loc18_31.3 [concrete = constants.%E.val] -// CHECK:STDOUT: %.loc18_1: %E.468 = converted %.loc18_33, [concrete = ] +// CHECK:STDOUT: %.loc14_31.2: ref %E.dc1 = temporary_storage +// CHECK:STDOUT: %.loc14_31.3: init %E.dc1 to %.loc14_31.2 = class_init () [concrete = constants.%E.val] +// CHECK:STDOUT: %.loc14_33: init %E.dc1 = converted %.loc14_31.1, %.loc14_31.3 [concrete = constants.%E.val] +// CHECK:STDOUT: %.loc14_1: %E.468 = converted %.loc14_33, [concrete = ] // CHECK:STDOUT: assign file.%g.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/implicit_import.carbon b/toolchain/check/testdata/class/implicit_import.carbon index 6fb79942efac..980f84c62011 100644 --- a/toolchain/check/testdata/class/implicit_import.carbon +++ b/toolchain/check/testdata/class/implicit_import.carbon @@ -34,13 +34,9 @@ class C {} impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_redecl_after_def.impl.carbon:[[@LINE+8]]:1: error: redeclaration of `class C` is redundant [RedeclRedundant] -// CHECK:STDERR: class C; -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_redecl_after_def.impl.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: redecl_after_def.carbon:4:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: class C {} -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_redecl_after_def.impl.carbon:[[@LINE+4]]:1-8: error: redeclaration of `class C` is redundant [RedeclRedundant] +// CHECK:STDERR: imported from: fail_redecl_after_def.impl.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: redecl_after_def.carbon:4:1-9: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: class C; @@ -54,13 +50,9 @@ class C {} impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_redef_after_def.impl.carbon:[[@LINE+8]]:1: error: redefinition of `class C` [RedeclRedef] -// CHECK:STDERR: class C {} -// CHECK:STDERR: ^~~~~~~~~ -// CHECK:STDERR: fail_redef_after_def.impl.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: redef_after_def.carbon:4:1: note: previously defined here [RedeclPrevDef] -// CHECK:STDERR: class C {} -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_redef_after_def.impl.carbon:[[@LINE+4]]:1-9: error: redefinition of `class C` [RedeclRedef] +// CHECK:STDERR: imported from: fail_redef_after_def.impl.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: redef_after_def.carbon:4:1-9: note: previously defined here [RedeclPrevDef] // CHECK:STDERR: class C {} @@ -75,13 +67,9 @@ alias B = C; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_def_alias.impl.carbon:[[@LINE+8]]:7: error: duplicate name `B` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: class B {} -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_def_alias.impl.carbon:[[@LINE-5]]:1: in import [InImport] +// CHECK:STDERR: fail_def_alias.impl.carbon:[[@LINE+4]]:7: error: duplicate name `B` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_def_alias.impl.carbon:[[@LINE-3]]:1 [InImport] // CHECK:STDERR: def_alias.carbon:5:7: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: alias B = C; -// CHECK:STDERR: ^ // CHECK:STDERR: class B {} @@ -212,7 +200,7 @@ class B {} // CHECK:STDOUT: %C.08d9e3.1: type = class_type @C.1 [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: %C.08d9e3.2: type = class_type @C.loc12 [concrete] +// CHECK:STDOUT: %C.08d9e3.2: type = class_type @C.loc8 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -227,7 +215,7 @@ class B {} // CHECK:STDOUT: } // CHECK:STDOUT: %default.import.loc2_31.1 = import // CHECK:STDOUT: %default.import.loc2_31.2 = import -// CHECK:STDOUT: %C.decl: type = class_decl @C.loc12 [concrete = constants.%C.08d9e3.2] {} {} +// CHECK:STDOUT: %C.decl: type = class_decl @C.loc8 [concrete = constants.%C.08d9e3.2] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C.1 [from "redef_after_def.carbon"] { @@ -237,7 +225,7 @@ class B {} // CHECK:STDOUT: .Self = imports.%Main.import_ref.e47 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: class @C.loc12 { +// CHECK:STDOUT: class @C.loc8 { // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/inheritance/base.carbon b/toolchain/check/testdata/class/inheritance/base.carbon index 24983c0d9041..b526c7d668cb 100644 --- a/toolchain/check/testdata/class/inheritance/base.carbon +++ b/toolchain/check/testdata/class/inheritance/base.carbon @@ -42,9 +42,7 @@ base class Base { class Derived { var d: i32; - // CHECK:STDERR: fail_base_after_field.carbon:[[@LINE+4]]:3: error: `base` declaration must appear before field declarations [BaseDeclAfterFieldDecl] - // CHECK:STDERR: extend base: Base; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_after_field.carbon:[[@LINE+2]]:3-20: error: `base` declaration must appear before field declarations [BaseDeclAfterFieldDecl] // CHECK:STDERR: extend base: Base; } diff --git a/toolchain/check/testdata/class/inheritance/fail_base_as_declared_name.carbon b/toolchain/check/testdata/class/inheritance/fail_base_as_declared_name.carbon index dda6399ffcf0..748712346334 100644 --- a/toolchain/check/testdata/class/inheritance/fail_base_as_declared_name.carbon +++ b/toolchain/check/testdata/class/inheritance/fail_base_as_declared_name.carbon @@ -12,12 +12,8 @@ namespace N; -// CHECK:STDERR: fail_base_as_declared_name.carbon:[[@LINE+8]]:6: error: `.` should be followed by a name [ExpectedDeclNameAfterPeriod] -// CHECK:STDERR: fn N.base() {} -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_base_as_declared_name.carbon:[[@LINE+4]]:6-9: error: `.` should be followed by a name [ExpectedDeclNameAfterPeriod] // CHECK:STDERR: -// CHECK:STDERR: fail_base_as_declared_name.carbon:[[@LINE+4]]:6: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] -// CHECK:STDERR: fn N.base() {} -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_base_as_declared_name.carbon:[[@LINE+2]]:6-9: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: fn N.base() {} diff --git a/toolchain/check/testdata/class/inheritance/fail_base_bad_type.carbon b/toolchain/check/testdata/class/inheritance/fail_base_bad_type.carbon index c56fd8271c7e..569ffe9d8a37 100644 --- a/toolchain/check/testdata/class/inheritance/fail_base_bad_type.carbon +++ b/toolchain/check/testdata/class/inheritance/fail_base_bad_type.carbon @@ -15,9 +15,7 @@ library "[[@TEST_NAME]]"; class DeriveFromError { - // CHECK:STDERR: fail_derive_from_error.carbon:[[@LINE+4]]:16: error: name `error` not found [NameNotFound] - // CHECK:STDERR: extend base: error; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_derive_from_error.carbon:[[@LINE+2]]:16-20: error: name `error` not found [NameNotFound] // CHECK:STDERR: extend base: error; } @@ -30,12 +28,8 @@ fn AccessMemberWithInvalidBaseError(p: DeriveFromError*) -> i32 { return (*p).n; library "[[@TEST_NAME]]"; 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: extend base: 32; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_derive_from_non_type.carbon:[[@LINE+3]]:16-17: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: fail_derive_from_non_type.carbon:[[@LINE+2]]:16-17: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: extend base: 32; } @@ -47,27 +41,19 @@ fn AccessMemberWithInvalidBasNonType(p: DeriveFromNonType*) -> i32 { return (*p) library "[[@TEST_NAME]]"; class DeriveFromi32 { - // CHECK:STDERR: fail_derive_from_i32.carbon:[[@LINE+4]]:16: error: deriving from final type `i32`; base type must be an `abstract` or `base` class [BaseIsFinal] - // CHECK:STDERR: extend base: i32; - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_derive_from_i32.carbon:[[@LINE+2]]:16-18: error: deriving from final type `i32`; base type must be an `abstract` or `base` class [BaseIsFinal] // CHECK:STDERR: extend base: i32; } // It's not really important whether this conversion produces an error or not, // but it shouldn't crash. -// 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*)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: fn ConvertToBadBasei32(p: DeriveFromi32*) -> i32* { return p; } -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_derive_from_i32.carbon:[[@LINE+3]]:53-61: error: cannot implicitly convert expression of type `DeriveFromi32*` to `i32*` [ConversionFailure] +// CHECK:STDERR: fail_derive_from_i32.carbon:[[@LINE+2]]:53-61: note: type `DeriveFromi32*` does not implement interface `Core.ImplicitAs(i32*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn ConvertToBadBasei32(p: DeriveFromi32*) -> i32* { return p; } -// CHECK:STDERR: fail_derive_from_i32.carbon:[[@LINE+4]]:70: error: member name `n` not found in `DeriveFromi32` [MemberNameNotFoundInInstScope] -// CHECK:STDERR: fn AccessMemberWithInvalidBasei32(p: DeriveFromi32*) -> i32 { return (*p).n; } -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_derive_from_i32.carbon:[[@LINE+2]]:70-75: error: member name `n` not found in `DeriveFromi32` [MemberNameNotFoundInInstScope] // CHECK:STDERR: fn AccessMemberWithInvalidBasei32(p: DeriveFromi32*) -> i32 { return (*p).n; } @@ -78,19 +64,13 @@ library "[[@TEST_NAME]]"; base class Base {} class DeriveFromTuple { - // CHECK:STDERR: fail_derive_from_tuple.carbon:[[@LINE+4]]:16: error: deriving from final type `(Base,)`; base type must be an `abstract` or `base` class [BaseIsFinal] - // CHECK:STDERR: extend base: (Base,); - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_derive_from_tuple.carbon:[[@LINE+2]]:16-22: error: deriving from final type `(Base,)`; base type must be an `abstract` or `base` class [BaseIsFinal] // CHECK:STDERR: extend base: (Base,); } -// 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,)*)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: fn ConvertToBadBaseTuple(p: DeriveFromTuple*) -> (Base,)* { return p; } -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_derive_from_tuple.carbon:[[@LINE+3]]:61-69: error: cannot implicitly convert expression of type `DeriveFromTuple*` to `(Base,)*` [ConversionFailure] +// CHECK:STDERR: fail_derive_from_tuple.carbon:[[@LINE+2]]:61-69: note: type `DeriveFromTuple*` does not implement interface `Core.ImplicitAs((Base,)*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn ConvertToBadBaseTuple(p: DeriveFromTuple*) -> (Base,)* { return p; } @@ -103,19 +83,13 @@ library "[[@TEST_NAME]]"; // TODO: Should we allow this? // We do allow `{.base = {.a: i32, .b: i32}}`. class DeriveFromStruct { - // CHECK:STDERR: fail_derive_from_struct.carbon:[[@LINE+4]]:16: error: deriving from final type `{.a: i32, .b: i32}`; base type must be an `abstract` or `base` class [BaseIsFinal] - // CHECK:STDERR: extend base: {.a: i32, .b: i32}; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_derive_from_struct.carbon:[[@LINE+2]]:16-33: error: deriving from final type `{.a: i32, .b: i32}`; base type must be an `abstract` or `base` class [BaseIsFinal] // CHECK:STDERR: extend base: {.a: i32, .b: i32}; } -// 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}*)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: fn ConvertToBadBaseStruct(p: DeriveFromStruct*) -> {.a: i32, .b: i32}* { return p; } -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_derive_from_struct.carbon:[[@LINE+3]]:74-82: error: cannot implicitly convert expression of type `DeriveFromStruct*` to `{.a: i32, .b: i32}*` [ConversionFailure] +// CHECK:STDERR: fail_derive_from_struct.carbon:[[@LINE+2]]:74-82: 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; } @@ -126,29 +100,19 @@ fn AccessMemberWithInvalidBaseStruct(p: DeriveFromStruct*) -> i32 { return (*p). library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_derive_from_incomplete.carbon:[[@LINE+4]]:1: error: `base` not allowed on `class` forward declaration, only definition [ModifierOnlyAllowedOnDefinition] -// CHECK:STDERR: base class Incomplete; -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_derive_from_incomplete.carbon:[[@LINE+2]]:1-4: error: `base` not allowed on `class` forward declaration, only definition [ModifierOnlyAllowedOnDefinition] // CHECK:STDERR: base class Incomplete; class DeriveFromIncomplete { - // CHECK:STDERR: fail_derive_from_incomplete.carbon:[[@LINE+7]]:16: error: base `Incomplete` is an incomplete type [IncompleteTypeInBaseDecl] - // CHECK:STDERR: extend base: Incomplete; - // CHECK:STDERR: ^~~~~~~~~~ - // CHECK:STDERR: fail_derive_from_incomplete.carbon:[[@LINE-6]]:1: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: base class Incomplete; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_derive_from_incomplete.carbon:[[@LINE+3]]:16-25: error: base `Incomplete` is an incomplete type [IncompleteTypeInBaseDecl] + // CHECK:STDERR: fail_derive_from_incomplete.carbon:[[@LINE-4]]:1-22: note: class was forward declared here [ClassForwardDeclaredHere] // CHECK:STDERR: extend base: Incomplete; } -// 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*)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: fn ConvertToBadBaseIncomplete(p: DeriveFromIncomplete*) -> Incomplete* { return p; } -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_derive_from_incomplete.carbon:[[@LINE+3]]:74-82: error: cannot implicitly convert expression of type `DeriveFromIncomplete*` to `Incomplete*` [ConversionFailure] +// CHECK:STDERR: fail_derive_from_incomplete.carbon:[[@LINE+2]]:74-82: note: type `DeriveFromIncomplete*` does not implement interface `Core.ImplicitAs(Incomplete*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn ConvertToBadBaseIncomplete(p: DeriveFromIncomplete*) -> Incomplete* { return p; } @@ -163,9 +127,7 @@ class Final { } class DeriveFromFinal { - // CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE+4]]:16: error: deriving from final type `Final`; base type must be an `abstract` or `base` class [BaseIsFinal] - // CHECK:STDERR: extend base: Final; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE+2]]:16-20: error: deriving from final type `Final`; base type must be an `abstract` or `base` class [BaseIsFinal] // CHECK:STDERR: extend base: Final; } @@ -180,9 +142,7 @@ fn AccessMemberWithInvalidBaseFinal_WithMember(p: DeriveFromFinal*) -> i32 { } fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { - // CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE+4]]:10: error: member name `b` not found in `DeriveFromFinal` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: return (*p).b; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE+2]]:10-15: error: member name `b` not found in `DeriveFromFinal` [MemberNameNotFoundInInstScope] // CHECK:STDERR: return (*p).b; } diff --git a/toolchain/check/testdata/class/inheritance/fail_base_method_define.carbon b/toolchain/check/testdata/class/inheritance/fail_base_method_define.carbon index aaf8d7be5d04..de0792d7d072 100644 --- a/toolchain/check/testdata/class/inheritance/fail_base_method_define.carbon +++ b/toolchain/check/testdata/class/inheritance/fail_base_method_define.carbon @@ -22,14 +22,10 @@ class D { extend base: B; } -// CHECK:STDERR: fail_base_method_define.carbon:[[@LINE+4]]:6: error: out-of-line declaration requires a declaration in scoped entity [QualifiedDeclOutsideScopeEntity] -// CHECK:STDERR: fn D.F() {} -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_base_method_define.carbon:[[@LINE+2]]:6: error: out-of-line declaration requires a declaration in scoped entity [QualifiedDeclOutsideScopeEntity] // CHECK:STDERR: fn D.F() {} -// CHECK:STDERR: fail_base_method_define.carbon:[[@LINE+4]]:6: error: name `C` not found [NameNotFound] -// CHECK:STDERR: fn D.C.F() {} -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_base_method_define.carbon:[[@LINE+2]]:6: error: name `C` not found [NameNotFound] // CHECK:STDERR: fn D.C.F() {} diff --git a/toolchain/check/testdata/class/inheritance/fail_base_misplaced.carbon b/toolchain/check/testdata/class/inheritance/fail_base_misplaced.carbon index ee3c8909d5fa..57db0c28ed71 100644 --- a/toolchain/check/testdata/class/inheritance/fail_base_misplaced.carbon +++ b/toolchain/check/testdata/class/inheritance/fail_base_misplaced.carbon @@ -12,25 +12,19 @@ base class B {} -// CHECK:STDERR: fail_base_misplaced.carbon:[[@LINE+4]]:1: error: `base` declaration outside class [ClassSpecificDeclOutsideClass] -// CHECK:STDERR: extend base: B; -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_base_misplaced.carbon:[[@LINE+2]]:1-15: error: `base` declaration outside class [ClassSpecificDeclOutsideClass] // CHECK:STDERR: extend base: B; fn F() { - // CHECK:STDERR: fail_base_misplaced.carbon:[[@LINE+4]]:3: error: `base` declaration outside class [ClassSpecificDeclOutsideClass] - // CHECK:STDERR: extend base: B; - // CHECK:STDERR: ^~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_misplaced.carbon:[[@LINE+2]]:3-17: error: `base` declaration outside class [ClassSpecificDeclOutsideClass] // CHECK:STDERR: extend base: B; } class C { fn F() { - // CHECK:STDERR: fail_base_misplaced.carbon:[[@LINE+4]]:5: error: `base` declaration outside class [ClassSpecificDeclOutsideClass] - // CHECK:STDERR: extend base: B; - // CHECK:STDERR: ^~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_misplaced.carbon:[[@LINE+2]]:5-19: error: `base` declaration outside class [ClassSpecificDeclOutsideClass] // CHECK:STDERR: extend base: B; } diff --git a/toolchain/check/testdata/class/inheritance/fail_base_modifiers.carbon b/toolchain/check/testdata/class/inheritance/fail_base_modifiers.carbon index 97b67aaff979..ae33ddab8d5a 100644 --- a/toolchain/check/testdata/class/inheritance/fail_base_modifiers.carbon +++ b/toolchain/check/testdata/class/inheritance/fail_base_modifiers.carbon @@ -13,40 +13,28 @@ base class B {} class C1 { - // CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+4]]:3: error: `private` not allowed on `base` declaration [ModifierNotAllowedOnDeclaration] - // CHECK:STDERR: private extend base: B; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+2]]:3-9: error: `private` not allowed on `base` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: private extend base: B; } class C2 { - // CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+8]]:3: error: `abstract` not allowed on `base` declaration [ModifierNotAllowedOnDeclaration] - // CHECK:STDERR: abstract base: B; - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+4]]:3-10: error: `abstract` not allowed on `base` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: - // CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+4]]:3: error: missing `extend` before `base` declaration [BaseMissingExtend] - // CHECK:STDERR: abstract base: B; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+2]]:3-19: error: missing `extend` before `base` declaration [BaseMissingExtend] // CHECK:STDERR: abstract base: B; } class C3 { - // CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+4]]:10: error: `default` not allowed on `base` declaration [ModifierNotAllowedOnDeclaration] - // CHECK:STDERR: extend default base: B; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+2]]:10-16: error: `default` not allowed on `base` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: extend default base: B; } class C4 { - // CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+7]]:10: error: `extend` repeated on declaration [ModifierRepeated] - // CHECK:STDERR: extend extend base: B; - // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+4]]:3: note: `extend` previously appeared here [ModifierPrevious] - // CHECK:STDERR: extend extend base: B; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+3]]:10-15: error: `extend` repeated on declaration [ModifierRepeated] + // CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+2]]:3-8: note: `extend` previously appeared here [ModifierPrevious] // CHECK:STDERR: extend extend base: B; } diff --git a/toolchain/check/testdata/class/inheritance/fail_base_no_extend.carbon b/toolchain/check/testdata/class/inheritance/fail_base_no_extend.carbon index 86e6a60e6758..24760fb61a0d 100644 --- a/toolchain/check/testdata/class/inheritance/fail_base_no_extend.carbon +++ b/toolchain/check/testdata/class/inheritance/fail_base_no_extend.carbon @@ -13,9 +13,7 @@ base class B {} class C { - // CHECK:STDERR: fail_base_no_extend.carbon:[[@LINE+4]]:3: error: missing `extend` before `base` declaration [BaseMissingExtend] - // CHECK:STDERR: base: B; - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_base_no_extend.carbon:[[@LINE+2]]:3-10: error: missing `extend` before `base` declaration [BaseMissingExtend] // CHECK:STDERR: base: B; } diff --git a/toolchain/check/testdata/class/inheritance/fail_base_repeated.carbon b/toolchain/check/testdata/class/inheritance/fail_base_repeated.carbon index 20180d629452..dc13641990f3 100644 --- a/toolchain/check/testdata/class/inheritance/fail_base_repeated.carbon +++ b/toolchain/check/testdata/class/inheritance/fail_base_repeated.carbon @@ -15,12 +15,8 @@ base class B2 {} class C { extend base: B1; - // CHECK:STDERR: fail_base_repeated.carbon:[[@LINE+7]]:3: error: multiple `base` declarations in class; multiple inheritance is not permitted [BaseDeclRepeated] - // CHECK:STDERR: extend base: B2; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_repeated.carbon:[[@LINE-4]]:3: note: previous `base` declaration is here [ClassSpecificDeclPrevious] - // CHECK:STDERR: extend base: B1; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_repeated.carbon:[[@LINE+3]]:3-18: error: multiple `base` declarations in class; multiple inheritance is not permitted [BaseDeclRepeated] + // CHECK:STDERR: fail_base_repeated.carbon:[[@LINE-2]]:3-18: note: previous `base` declaration is here [ClassSpecificDeclPrevious] // CHECK:STDERR: extend base: B2; } @@ -28,12 +24,8 @@ class C { class D { // TODO: Consider adding a custom diagnostic for this case. extend base: B1; - // CHECK:STDERR: fail_base_repeated.carbon:[[@LINE+7]]:3: error: multiple `base` declarations in class; multiple inheritance is not permitted [BaseDeclRepeated] - // CHECK:STDERR: extend base: B1; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_repeated.carbon:[[@LINE-4]]:3: note: previous `base` declaration is here [ClassSpecificDeclPrevious] - // CHECK:STDERR: extend base: B1; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_repeated.carbon:[[@LINE+3]]:3-18: error: multiple `base` declarations in class; multiple inheritance is not permitted [BaseDeclRepeated] + // CHECK:STDERR: fail_base_repeated.carbon:[[@LINE-2]]:3-18: note: previous `base` declaration is here [ClassSpecificDeclPrevious] // CHECK:STDERR: extend base: B1; } diff --git a/toolchain/check/testdata/class/inheritance/fail_base_unbound.carbon b/toolchain/check/testdata/class/inheritance/fail_base_unbound.carbon index a4fff62258a1..fcd7f14b32ec 100644 --- a/toolchain/check/testdata/class/inheritance/fail_base_unbound.carbon +++ b/toolchain/check/testdata/class/inheritance/fail_base_unbound.carbon @@ -16,8 +16,6 @@ class C { extend base: B; } -// CHECK:STDERR: fail_base_unbound.carbon:[[@LINE+4]]:12: error: expression cannot be used as a value [UseOfNonExprAsValue] -// CHECK:STDERR: let b: B = C.base; -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_base_unbound.carbon:[[@LINE+2]]:12-17: error: expression cannot be used as a value [UseOfNonExprAsValue] // CHECK:STDERR: let b: B = C.base; diff --git a/toolchain/check/testdata/class/inheritance/fail_derived_to_base.carbon b/toolchain/check/testdata/class/inheritance/fail_derived_to_base.carbon index b3845ffe9913..90d64e72b125 100644 --- a/toolchain/check/testdata/class/inheritance/fail_derived_to_base.carbon +++ b/toolchain/check/testdata/class/inheritance/fail_derived_to_base.carbon @@ -23,22 +23,14 @@ class B2 { var b: i32; } -// 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*)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: fn ConvertUnrelated(p: B2*) -> A1* { return p; } -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_derived_to_base.carbon:[[@LINE+3]]:38-46: error: cannot implicitly convert expression of type `B2*` to `A1*` [ConversionFailure] +// CHECK:STDERR: fail_derived_to_base.carbon:[[@LINE+2]]:38-46: note: type `B2*` does not implement interface `Core.ImplicitAs(A1*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn ConvertUnrelated(p: B2*) -> A1* { return p; } 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*)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: fn ConvertIncomplete(p: Incomplete*) -> A2* { return p; } -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_derived_to_base.carbon:[[@LINE+3]]:47-55: error: cannot implicitly convert expression of type `Incomplete*` to `A2*` [ConversionFailure] +// CHECK:STDERR: fail_derived_to_base.carbon:[[@LINE+2]]:47-55: note: type `Incomplete*` does not implement interface `Core.ImplicitAs(A2*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn ConvertIncomplete(p: Incomplete*) -> A2* { return p; } diff --git a/toolchain/check/testdata/class/inheritance/fail_extend_cycle.carbon b/toolchain/check/testdata/class/inheritance/fail_extend_cycle.carbon index 166996d06f3c..b64e7dff28e3 100644 --- a/toolchain/check/testdata/class/inheritance/fail_extend_cycle.carbon +++ b/toolchain/check/testdata/class/inheritance/fail_extend_cycle.carbon @@ -18,18 +18,12 @@ base class B { extend base: A; } -// CHECK:STDERR: fail_extend_cycle.carbon:[[@LINE+7]]:1: error: redefinition of `class A` [RedeclRedef] -// CHECK:STDERR: base class A { -// CHECK:STDERR: ^~~~~~~~~~~~~~ -// CHECK:STDERR: fail_extend_cycle.carbon:[[@LINE-11]]:1: note: previously defined here [RedeclPrevDef] -// CHECK:STDERR: base class A { -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_extend_cycle.carbon:[[@LINE+3]]:1-14: error: redefinition of `class A` [RedeclRedef] +// CHECK:STDERR: fail_extend_cycle.carbon:[[@LINE-9]]:1-14: note: previously defined here [RedeclPrevDef] // CHECK:STDERR: base class A { extend base: A; - // CHECK:STDERR: fail_extend_cycle.carbon:[[@LINE+4]]:10: error: name `C` not found [NameNotFound] - // CHECK:STDERR: var c: C; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_extend_cycle.carbon:[[@LINE+2]]:10: error: name `C` not found [NameNotFound] // CHECK:STDERR: var c: C; } diff --git a/toolchain/check/testdata/class/inheritance/fail_init_missing_base.carbon b/toolchain/check/testdata/class/inheritance/fail_init_missing_base.carbon index 43146bdbf285..d53d5f33e444 100644 --- a/toolchain/check/testdata/class/inheritance/fail_init_missing_base.carbon +++ b/toolchain/check/testdata/class/inheritance/fail_init_missing_base.carbon @@ -17,9 +17,7 @@ class Z { } fn Run() { - // CHECK:STDERR: fail_init_missing_base.carbon:[[@LINE+4]]:14: error: missing value for field `base` in struct initialization [StructInitMissingFieldInLiteral] - // CHECK:STDERR: var _: Z = {}; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_init_missing_base.carbon:[[@LINE+2]]:14-15: error: missing value for field `base` in struct initialization [StructInitMissingFieldInLiteral] // CHECK:STDERR: var _: Z = {}; } diff --git a/toolchain/check/testdata/class/method/bound_method_value.carbon b/toolchain/check/testdata/class/method/bound_method_value.carbon index 95fa4c9220df..0576dac0c1ad 100644 --- a/toolchain/check/testdata/class/method/bound_method_value.carbon +++ b/toolchain/check/testdata/class/method/bound_method_value.carbon @@ -18,12 +18,8 @@ class C { } fn F(c: C) { - // CHECK:STDERR: fail_implicit_conversion.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `` to `i32` [ConversionFailure] - // CHECK:STDERR: var _: i32 = c.Get; - // CHECK:STDERR: ^~~~~~~~~~ - // CHECK:STDERR: fail_implicit_conversion.carbon:[[@LINE+4]]:3: note: type `` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var _: i32 = c.Get; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_implicit_conversion.carbon:[[@LINE+3]]:3-12: error: cannot implicitly convert expression of type `` to `i32` [ConversionFailure] + // CHECK:STDERR: fail_implicit_conversion.carbon:[[@LINE+2]]:3-12: note: type `` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var _: i32 = c.Get; } @@ -36,12 +32,8 @@ class C { } fn F(c: C) -> i32 { - // CHECK:STDERR: fail_as.carbon:[[@LINE+7]]:10: error: cannot convert expression of type `` to `i32` with `as` [ConversionFailure] - // CHECK:STDERR: return c.Get as i32; - // CHECK:STDERR: ^~~~~~~~~~~~ - // CHECK:STDERR: fail_as.carbon:[[@LINE+4]]:10: note: type `` does not implement interface `Core.As(i32)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return c.Get as i32; - // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_as.carbon:[[@LINE+3]]:10-21: error: cannot convert expression of type `` to `i32` with `as` [ConversionFailure] + // CHECK:STDERR: fail_as.carbon:[[@LINE+2]]:10-21: note: type `` does not implement interface `Core.As(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return c.Get as i32; } @@ -58,9 +50,7 @@ class C { } fn F(c: C) { - // CHECK:STDERR: fail_interface_member.carbon:[[@LINE+4]]:3: error: cannot access member of interface `I` in type `` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: c.Get.(I.Op)(); - // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_interface_member.carbon:[[@LINE+2]]:3-14: error: cannot access member of interface `I` in type `` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: c.Get.(I.Op)(); } @@ -73,12 +63,8 @@ class C { } fn F(c: C) { - // CHECK:STDERR: fail_copy.carbon:[[@LINE+7]]:26: error: cannot copy value of type `` [CopyOfUncopyableType] - // CHECK:STDERR: var _: typeof(c.Get) = c.Get; - // CHECK:STDERR: ^~~~~ - // CHECK:STDERR: fail_copy.carbon:[[@LINE+4]]:26: note: type `` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var _: typeof(c.Get) = c.Get; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_copy.carbon:[[@LINE+3]]:26-30: error: cannot copy value of type `` [CopyOfUncopyableType] + // CHECK:STDERR: fail_copy.carbon:[[@LINE+2]]:26-30: note: type `` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var _: typeof(c.Get) = c.Get; } diff --git a/toolchain/check/testdata/class/method/fail_call_without_method_syntax.carbon b/toolchain/check/testdata/class/method/fail_call_without_method_syntax.carbon index d27297dadf88..2ad1b2dde9bc 100644 --- a/toolchain/check/testdata/class/method/fail_call_without_method_syntax.carbon +++ b/toolchain/check/testdata/class/method/fail_call_without_method_syntax.carbon @@ -24,37 +24,23 @@ class Other {} // When a method is called as an ordinary function, `self` is an ordinary // argument, so the usual arity and conversion rules apply. fn TooFew() -> i32 { - // CHECK:STDERR: fail_call_without_method_syntax.carbon:[[@LINE+7]]:10: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] - // CHECK:STDERR: return Point.Get(); - // CHECK:STDERR: ^~~~~~~~~~~ - // CHECK:STDERR: fail_call_without_method_syntax.carbon:[[@LINE-13]]:3: note: calling function declared here [InCallToEntity] - // CHECK:STDERR: fn Get(self) -> i32 { return self.x; } - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_call_without_method_syntax.carbon:[[@LINE+3]]:10-20: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] + // CHECK:STDERR: fail_call_without_method_syntax.carbon:[[@LINE-11]]:3-23: note: calling function declared here [InCallToEntity] // CHECK:STDERR: return Point.Get(); } fn TooMany(p: Point) -> i32 { - // CHECK:STDERR: fail_call_without_method_syntax.carbon:[[@LINE+7]]:10: error: 2 arguments passed to function expecting 1 argument [CallArgCountMismatch] - // CHECK:STDERR: return Point.Get(p, p); - // CHECK:STDERR: ^~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_call_without_method_syntax.carbon:[[@LINE-24]]:3: note: calling function declared here [InCallToEntity] - // CHECK:STDERR: fn Get(self) -> i32 { return self.x; } - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_call_without_method_syntax.carbon:[[@LINE+3]]:10-24: error: 2 arguments passed to function expecting 1 argument [CallArgCountMismatch] + // CHECK:STDERR: fail_call_without_method_syntax.carbon:[[@LINE-18]]:3-23: note: calling function declared here [InCallToEntity] // CHECK:STDERR: return Point.Get(p, p); } fn WrongSelfType(o: Other) -> i32 { - // CHECK:STDERR: fail_call_without_method_syntax.carbon:[[@LINE+10]]:20: error: cannot implicitly convert expression of type `Other` to `Point` [ConversionFailure] - // CHECK:STDERR: return Point.Get(o); - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_call_without_method_syntax.carbon:[[@LINE+7]]:20: note: type `Other` does not implement interface `Core.ImplicitAs(Point)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return Point.Get(o); - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_call_without_method_syntax.carbon:[[@LINE-38]]:10: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn Get(self) -> i32 { return self.x; } - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_call_without_method_syntax.carbon:[[@LINE+4]]:20: error: cannot implicitly convert expression of type `Other` to `Point` [ConversionFailure] + // CHECK:STDERR: fail_call_without_method_syntax.carbon:[[@LINE+3]]:20: note: type `Other` does not implement interface `Core.ImplicitAs(Point)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: fail_call_without_method_syntax.carbon:[[@LINE-26]]:10-13: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: return Point.Get(o); } diff --git a/toolchain/check/testdata/class/method/fail_generic_method.carbon b/toolchain/check/testdata/class/method/fail_generic_method.carbon index d9f056da2468..05f964c5835d 100644 --- a/toolchain/check/testdata/class/method/fail_generic_method.carbon +++ b/toolchain/check/testdata/class/method/fail_generic_method.carbon @@ -19,19 +19,11 @@ class Class(T: type) { // TODO: The follow-on errors here aren't great. Investigate whether we can // enter the scope anyway if the parameters don't match. -// CHECK:STDERR: fail_generic_method.carbon:[[@LINE+15]]:17: error: type `` of parameter 1 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] -// CHECK:STDERR: fn Class(unused N: I).F(unused self, unused n: T) {} -// CHECK:STDERR: ^~~~ -// CHECK:STDERR: fail_generic_method.carbon:[[@LINE-10]]:13: note: previous declaration's corresponding parameter here [RedeclParamPrevious] -// CHECK:STDERR: class Class(T: type) { -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_generic_method.carbon:[[@LINE+7]]:17-20: error: type `` of parameter 1 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] +// CHECK:STDERR: fail_generic_method.carbon:[[@LINE-8]]:13-19: note: previous declaration's corresponding parameter here [RedeclParamPrevious] // CHECK:STDERR: -// CHECK:STDERR: fail_generic_method.carbon:[[@LINE+8]]:32: error: name `Self` not found [NameNotFound] -// CHECK:STDERR: fn Class(unused N: I).F(unused self, unused n: T) {} -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_generic_method.carbon:[[@LINE+4]]:32-35: error: name `Self` not found [NameNotFound] // CHECK:STDERR: -// CHECK:STDERR: fail_generic_method.carbon:[[@LINE+4]]:48: error: name `T` not found [NameNotFound] -// CHECK:STDERR: fn Class(unused N: I).F(unused self, unused n: T) {} -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_generic_method.carbon:[[@LINE+2]]:48: error: name `T` not found [NameNotFound] // CHECK:STDERR: fn Class(unused N: I).F(unused self, unused n: T) {} diff --git a/toolchain/check/testdata/class/method/fail_method.carbon b/toolchain/check/testdata/class/method/fail_method.carbon index dbc69325c3ea..4f49c62e919e 100644 --- a/toolchain/check/testdata/class/method/fail_method.carbon +++ b/toolchain/check/testdata/class/method/fail_method.carbon @@ -22,22 +22,14 @@ fn F(c: Class) { c.WithSelf(); Class.NoSelf(); - // CHECK:STDERR: fail_method.carbon:[[@LINE+7]]:3: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] - // CHECK:STDERR: Class.WithSelf(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_method.carbon:[[@LINE-13]]:3: note: calling function declared here [InCallToEntity] - // CHECK:STDERR: fn WithSelf(self: Class); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_method.carbon:[[@LINE+3]]:3-18: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] + // CHECK:STDERR: fail_method.carbon:[[@LINE-11]]:3-27: note: calling function declared here [InCallToEntity] // CHECK:STDERR: Class.WithSelf(); Class.WithSelf(c); - // CHECK:STDERR: fail_method.carbon:[[@LINE+7]]:3: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] - // CHECK:STDERR: A(); - // CHECK:STDERR: ^~~ - // CHECK:STDERR: fail_method.carbon:[[@LINE-23]]:3: note: calling function declared here [InCallToEntity] - // CHECK:STDERR: fn WithSelf(self: Class); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_method.carbon:[[@LINE+3]]:3-5: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] + // CHECK:STDERR: fail_method.carbon:[[@LINE-17]]:3-27: note: calling function declared here [InCallToEntity] // CHECK:STDERR: A(); } diff --git a/toolchain/check/testdata/class/method/fail_method_modifiers.carbon b/toolchain/check/testdata/class/method/fail_method_modifiers.carbon index 4744b4e271ad..06b8368e85f9 100644 --- a/toolchain/check/testdata/class/method/fail_method_modifiers.carbon +++ b/toolchain/check/testdata/class/method/fail_method_modifiers.carbon @@ -12,48 +12,32 @@ class FinalClass { - // CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE+7]]:3: error: `abstract` not allowed; requires `abstract` class scope [ModifierAbstractNotAllowed] - // CHECK:STDERR: abstract fn Abstract(self); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE-5]]:1: note: containing definition here [ModifierNotInContext] - // CHECK:STDERR: class FinalClass { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE+3]]:3-10: error: `abstract` not allowed; requires `abstract` class scope [ModifierAbstractNotAllowed] + // CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE-3]]:1-18: note: containing definition here [ModifierNotInContext] // CHECK:STDERR: abstract fn Abstract(self); - // CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE+7]]:3: error: `virtual` not allowed; requires `abstract` or `base` class scope [ModifierVirtualNotAllowed] - // CHECK:STDERR: virtual fn Virtual(self); - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE-14]]:1: note: containing definition here [ModifierNotInContext] - // CHECK:STDERR: class FinalClass { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE+3]]:3-9: error: `virtual` not allowed; requires `abstract` or `base` class scope [ModifierVirtualNotAllowed] + // CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE-8]]:1-18: note: containing definition here [ModifierNotInContext] // CHECK:STDERR: virtual fn Virtual(self); } abstract class AbstractClass { - // CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE+4]]:3: error: `default` not allowed; requires interface scope [ModifierRequiresInterface] - // CHECK:STDERR: default fn Default(self); - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE+2]]:3-9: error: `default` not allowed; requires interface scope [ModifierRequiresInterface] // CHECK:STDERR: default fn Default(self); - // CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE+4]]:3: error: `final` not allowed; requires interface scope [ModifierRequiresInterface] - // CHECK:STDERR: final fn Final(self); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE+2]]:3-7: error: `final` not allowed; requires interface scope [ModifierRequiresInterface] // CHECK:STDERR: final fn Final(self); } base class BaseClass { - // CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE+7]]:3: error: `abstract` not allowed; requires `abstract` class scope [ModifierAbstractNotAllowed] - // CHECK:STDERR: abstract fn Abstract(self); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE-5]]:1: note: containing definition here [ModifierNotInContext] - // CHECK:STDERR: base class BaseClass { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE+3]]:3-10: error: `abstract` not allowed; requires `abstract` class scope [ModifierAbstractNotAllowed] + // CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE-3]]:1-22: note: containing definition here [ModifierNotInContext] // CHECK:STDERR: abstract fn Abstract(self); } diff --git a/toolchain/check/testdata/class/method/fail_method_redefinition.carbon b/toolchain/check/testdata/class/method/fail_method_redefinition.carbon index 7f6faa7aa2e8..6c4a7a60c24d 100644 --- a/toolchain/check/testdata/class/method/fail_method_redefinition.carbon +++ b/toolchain/check/testdata/class/method/fail_method_redefinition.carbon @@ -12,12 +12,8 @@ class Class { fn F() {} - // CHECK:STDERR: fail_method_redefinition.carbon:[[@LINE+7]]:3: error: redefinition of `fn F` [RedeclRedef] - // CHECK:STDERR: fn F() {} - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_method_redefinition.carbon:[[@LINE-4]]:3: note: previously defined here [RedeclPrevDef] - // CHECK:STDERR: fn F() {} - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_method_redefinition.carbon:[[@LINE+3]]:3-10: error: redefinition of `fn F` [RedeclRedef] + // CHECK:STDERR: fail_method_redefinition.carbon:[[@LINE-2]]:3-10: note: previously defined here [RedeclPrevDef] // CHECK:STDERR: fn F() {} } diff --git a/toolchain/check/testdata/class/method/fail_out_of_line_decl.carbon b/toolchain/check/testdata/class/method/fail_out_of_line_decl.carbon index c86b77413bf0..9ec715968afa 100644 --- a/toolchain/check/testdata/class/method/fail_out_of_line_decl.carbon +++ b/toolchain/check/testdata/class/method/fail_out_of_line_decl.carbon @@ -12,8 +12,6 @@ class C {} -// CHECK:STDERR: fail_out_of_line_decl.carbon:[[@LINE+4]]:6: error: out-of-line declaration requires a declaration in scoped entity [QualifiedDeclOutsideScopeEntity] -// CHECK:STDERR: fn C.F() {} -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_out_of_line_decl.carbon:[[@LINE+2]]:6: error: out-of-line declaration requires a declaration in scoped entity [QualifiedDeclOutsideScopeEntity] // CHECK:STDERR: fn C.F() {} diff --git a/toolchain/check/testdata/class/method/virtual.carbon b/toolchain/check/testdata/class/method/virtual.carbon index d7aeaee0a202..2d645215ce5b 100644 --- a/toolchain/check/testdata/class/method/virtual.carbon +++ b/toolchain/check/testdata/class/method/virtual.carbon @@ -110,9 +110,7 @@ fn Use() { library "[[@TEST_NAME]]"; class C { - // CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:3: error: override without base class [OverrideWithoutBase] - // CHECK:STDERR: override fn F(self); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:3-22: error: override without base class [OverrideWithoutBase] // CHECK:STDERR: override fn F(self); } @@ -147,9 +145,7 @@ base class Base { class Derived { extend base: Base; - // CHECK:STDERR: fail_impl_without_base_declaration.carbon:[[@LINE+4]]:3: error: override without compatible virtual in base class [OverrideWithoutVirtualInBase] - // CHECK:STDERR: override fn F(self); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_impl_without_base_declaration.carbon:[[@LINE+2]]:3-22: error: override without compatible virtual in base class [OverrideWithoutVirtualInBase] // CHECK:STDERR: override fn F(self); } @@ -202,12 +198,8 @@ base class Base { class Derived { extend base: Base; - // CHECK:STDERR: fail_impl_mismatch.carbon:[[@LINE+7]]:3: error: override without compatible virtual in base class [OverrideWithoutVirtualInBase] - // CHECK:STDERR: override fn F(self, v: i32); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_mismatch.carbon:[[@LINE-8]]:3: note: base class function has fewer parameters (0 vs 1 excluding `self`) [OverrideCandidateArityMismatch] - // CHECK:STDERR: virtual fn F(self); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_impl_mismatch.carbon:[[@LINE+3]]:3-30: error: override without compatible virtual in base class [OverrideWithoutVirtualInBase] + // CHECK:STDERR: fail_impl_mismatch.carbon:[[@LINE-6]]:3-21: note: base class function has fewer parameters (0 vs 1 excluding `self`) [OverrideCandidateArityMismatch] // CHECK:STDERR: override fn F(self, v: i32); } @@ -247,13 +239,9 @@ fn Derived.F(unused self) -> T2 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_generic_virtual_decl.carbon:[[@LINE+3]]:1: error: use of undefined generic function [MissingGenericFunctionDefinition] -// CHECK:STDERR: base class Base(T: type) { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_generic_virtual_decl.carbon:[[@LINE+1]]:1-26: error: use of undefined generic function [MissingGenericFunctionDefinition] base class Base(T: type) { - // CHECK:STDERR: fail_generic_virtual_decl.carbon:[[@LINE+4]]:3: note: generic function declared here [MissingGenericFunctionDefinitionHere] - // CHECK:STDERR: virtual fn F(self); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_generic_virtual_decl.carbon:[[@LINE+2]]:3-21: note: generic function declared here [MissingGenericFunctionDefinitionHere] // CHECK:STDERR: virtual fn F(self); } @@ -280,23 +268,17 @@ class Derived { library "[[@TEST_NAME]]"; abstract class T1 { - // CHECK:STDERR: fail_virtual_without_self.carbon:[[@LINE+4]]:3: error: virtual class function [VirtualWithoutSelf] - // CHECK:STDERR: virtual fn F(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_virtual_without_self.carbon:[[@LINE+2]]:3-17: error: virtual class function [VirtualWithoutSelf] // CHECK:STDERR: virtual fn F(); - // CHECK:STDERR: fail_virtual_without_self.carbon:[[@LINE+4]]:3: error: virtual class function [VirtualWithoutSelf] - // CHECK:STDERR: abstract fn G(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_virtual_without_self.carbon:[[@LINE+2]]:3-18: error: virtual class function [VirtualWithoutSelf] // CHECK:STDERR: abstract fn G(); } class T2 { extend base: T1; - // CHECK:STDERR: fail_virtual_without_self.carbon:[[@LINE+4]]:3: error: virtual class function [VirtualWithoutSelf] - // CHECK:STDERR: override fn F(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_virtual_without_self.carbon:[[@LINE+2]]:3-18: error: virtual class function [VirtualWithoutSelf] // CHECK:STDERR: override fn F(); } @@ -311,15 +293,9 @@ base class T1 { class T2 { extend base: T1; - // CHECK:STDERR: fail_ref_self_mismatch.carbon:[[@LINE+10]]:3: error: value expression passed to reference parameter [ValueForRefParam] - // CHECK:STDERR: override fn F1(ref self); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_ref_self_mismatch.carbon:[[@LINE+7]]:18: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: override fn F1(ref self); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_ref_self_mismatch.carbon:[[@LINE-11]]:3: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: virtual fn F1(self); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_ref_self_mismatch.carbon:[[@LINE+4]]:3-27: error: value expression passed to reference parameter [ValueForRefParam] + // CHECK:STDERR: fail_ref_self_mismatch.carbon:[[@LINE+3]]:18-25: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: fail_ref_self_mismatch.carbon:[[@LINE-7]]:3-22: note: while building thunk to match the signature of this function [ThunkSignature] // CHECK:STDERR: override fn F1(ref self); } @@ -329,9 +305,7 @@ class T2 { library "[[@TEST_NAME]]"; base class T1 { - // CHECK:STDERR: fail_generic_virtual.carbon:[[@LINE+4]]:3: error: generic virtual function [GenericVirtual] - // CHECK:STDERR: virtual fn F[T: type](self); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_generic_virtual.carbon:[[@LINE+2]]:3-30: error: generic virtual function [GenericVirtual] // CHECK:STDERR: virtual fn F[T: type](self); } @@ -341,9 +315,7 @@ base class T1 { library "[[@TEST_NAME]]"; base class T1(T: type) { - // CHECK:STDERR: fail_generic_virtual_in_generic_class.carbon:[[@LINE+4]]:3: error: generic virtual function [GenericVirtual] - // CHECK:STDERR: virtual fn F[T: type](self); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_generic_virtual_in_generic_class.carbon:[[@LINE+2]]:3-30: error: generic virtual function [GenericVirtual] // CHECK:STDERR: virtual fn F[T: type](self); } @@ -438,12 +410,8 @@ base class Base(T: type) { class D1 { extend base: Base(T1); - // CHECK:STDERR: fail_impl_generic_specifically_mismatch.carbon:[[@LINE+7]]:37: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: override fn F(unused self, unused t: T2*) { } - // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_impl_generic_specifically_mismatch.carbon:[[@LINE-8]]:3: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: virtual fn F(unused self, unused t: T1*) { } - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_impl_generic_specifically_mismatch.carbon:[[@LINE+3]]:37-42: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: fail_impl_generic_specifically_mismatch.carbon:[[@LINE-6]]:3-44: note: while building thunk to match the signature of this function [ThunkSignature] // CHECK:STDERR: override fn F(unused self, unused t: T2*) { } } @@ -459,12 +427,8 @@ abstract class Base(T: type) { } class Derived(T: type) { extend base: Base(T); - // CHECK:STDERR: fail_impl_generic_generic_mismatch.carbon:[[@LINE+7]]:37: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: override fn F(unused self, unused t: T) { } - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_impl_generic_generic_mismatch.carbon:[[@LINE-7]]:3: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: virtual fn F(unused self, unused t: T*) { } - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_impl_generic_generic_mismatch.carbon:[[@LINE+3]]:37-40: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: fail_impl_generic_generic_mismatch.carbon:[[@LINE-5]]:3-43: note: while building thunk to match the signature of this function [ThunkSignature] // CHECK:STDERR: override fn F(unused self, unused t: T) { } } diff --git a/toolchain/check/testdata/class/name_poisoning.carbon b/toolchain/check/testdata/class/name_poisoning.carbon index 9c91becfe7b5..8d77d082e6ba 100644 --- a/toolchain/check/testdata/class/name_poisoning.carbon +++ b/toolchain/check/testdata/class/name_poisoning.carbon @@ -44,15 +44,11 @@ class C; namespace N; // Use `package.C` and poison `N.C`. -// CHECK:STDERR: fail_declare_after_poison.carbon:[[@LINE+3]]:11: error: name `C` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: fn N.F(x: C); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_declare_after_poison.carbon:[[@LINE+1]]:11: error: name `C` used before it was declared [NameUseBeforeDecl] fn N.F(x: C); // Failure: `N.C` declared after it was poisoned. -// CHECK:STDERR: fail_declare_after_poison.carbon:[[@LINE+4]]:9: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: class N.C; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_declare_after_poison.carbon:[[@LINE+2]]:9: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: class N.C; @@ -67,9 +63,7 @@ namespace N; fn N.F1() -> C; // Use `N.C` which was poisoned and not declared. -// CHECK:STDERR: fail_use_poison.carbon:[[@LINE+4]]:14: error: member name `C` not found in `N` [MemberNameNotFoundInInstScope] -// CHECK:STDERR: fn N.F2() -> N.C; -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_use_poison.carbon:[[@LINE+2]]:14-16: error: member name `C` not found in `N` [MemberNameNotFoundInInstScope] // CHECK:STDERR: fn N.F2() -> N.C; @@ -81,22 +75,16 @@ class C; namespace N; // Use `package.C` and poison `N.C`. -// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+3]]:12: error: name `C` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: fn N.F1(x: C); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+1]]:12: error: name `C` used before it was declared [NameUseBeforeDecl] fn N.F1(x: C); // Failure: N.C declared after it was poisoned. -// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+4]]:9: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: class N.C; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+2]]:9: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: class N.C; // Failure: `N.C` used after declaration failed. -// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+4]]:12: error: member name `C` not found in `N` [MemberNameNotFoundInInstScope] -// CHECK:STDERR: fn N.F2(x: N.C); -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+2]]:12-14: error: member name `C` not found in `N` [MemberNameNotFoundInInstScope] // CHECK:STDERR: fn N.F2(x: N.C); @@ -107,12 +95,8 @@ library "[[@TEST_NAME]]"; class C; namespace N; -// CHECK:STDERR: fail_alias.carbon:[[@LINE+7]]:13: error: name `C` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: alias N.C = C; -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_alias.carbon:[[@LINE+4]]:9: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: alias N.C = C; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_alias.carbon:[[@LINE+3]]:13: error: name `C` used before it was declared [NameUseBeforeDecl] +// CHECK:STDERR: fail_alias.carbon:[[@LINE+2]]:9: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: alias N.C = C; @@ -129,32 +113,20 @@ class C2 { // * `C2.C1` // * `C2.C3.C1` // * `C2.C3.C4.C1` - // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+3]]:15: error: name `C1` used before it was declared [NameUseBeforeDecl] - // CHECK:STDERR: fn F(x: C1); - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+1]]:15-16: error: name `C1` used before it was declared [NameUseBeforeDecl] fn F(x: C1); - // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+7]]:13: note: declared here [NameUseBeforeDeclNote] - // CHECK:STDERR: class C1; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+3]]:13-14: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: - // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE-6]]:15: error: name `C1` used before it was declared [NameUseBeforeDecl] - // CHECK:STDERR: fn F(x: C1); - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE-4]]:15-16: error: name `C1` used before it was declared [NameUseBeforeDecl] class C1; } - // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+7]]:11: note: declared here [NameUseBeforeDeclNote] - // CHECK:STDERR: class C1; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+3]]:11-12: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: - // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE-15]]:15: error: name `C1` used before it was declared [NameUseBeforeDecl] - // CHECK:STDERR: fn F(x: C1); - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE-9]]:15-16: error: name `C1` used before it was declared [NameUseBeforeDecl] class C1; } - // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+4]]:9: note: declared here [NameUseBeforeDeclNote] - // CHECK:STDERR: class C1; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+2]]:9-10: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: class C1; } @@ -180,27 +152,17 @@ library "[[@TEST_NAME]]"; namespace N; // `package.C` and `N.C` poisoned when not found. -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+7]]:11: error: name `C` not found [NameNotFound] -// CHECK:STDERR: fn N.F(x: C); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+3]]:11: error: name `C` not found [NameNotFound] // CHECK:STDERR: -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+3]]:11: error: name `C` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: fn N.F(x: C); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+1]]:11: error: name `C` used before it was declared [NameUseBeforeDecl] fn N.F(x: C); // TODO: We should ideally only produce one diagnostic here. -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+7]]:7: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: class C; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+3]]:7: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE-7]]:11: error: name `C` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: fn N.F(x: C); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE-5]]:11: error: name `C` used before it was declared [NameUseBeforeDecl] class C; -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+4]]:9: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: class N.C; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+2]]:9: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: class N.C; @@ -212,14 +174,10 @@ fn F() { class C1 {} class C2 { - // CHECK:STDERR: fail_poison_with_lexical_result.carbon:[[@LINE+3]]:12: error: name `C1` used before it was declared [NameUseBeforeDecl] - // CHECK:STDERR: var v: C1; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_poison_with_lexical_result.carbon:[[@LINE+1]]:12-13: error: name `C1` used before it was declared [NameUseBeforeDecl] var v: C1; - // CHECK:STDERR: fail_poison_with_lexical_result.carbon:[[@LINE+4]]:11: note: declared here [NameUseBeforeDeclNote] - // CHECK:STDERR: class C1; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_poison_with_lexical_result.carbon:[[@LINE+2]]:11-12: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: class C1; } @@ -233,16 +191,12 @@ class C1; class C2 { // Use `package.C1` and poison `C2.C1`. - // CHECK:STDERR: fail_declare_data_member_after_poison.carbon:[[@LINE+3]]:11: error: name `C1` used before it was declared [NameUseBeforeDecl] - // CHECK:STDERR: fn F(x: C1); - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_declare_data_member_after_poison.carbon:[[@LINE+1]]:11-12: error: name `C1` used before it was declared [NameUseBeforeDecl] fn F(x: C1); class C2 {} // Failure: `C2.C1` declared after it was poisoned. - // CHECK:STDERR: fail_declare_data_member_after_poison.carbon:[[@LINE+4]]:7: note: declared here [NameUseBeforeDeclNote] - // CHECK:STDERR: var C1: C2; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_declare_data_member_after_poison.carbon:[[@LINE+2]]:7-8: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: var C1: C2; } @@ -254,14 +208,10 @@ library "[[@TEST_NAME]]"; base class B {} class C { - // CHECK:STDERR: fail_extend_poison_class_members.carbon:[[@LINE+3]]:16: error: name `B` used before it was declared [NameUseBeforeDecl] - // CHECK:STDERR: extend base: B; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_extend_poison_class_members.carbon:[[@LINE+1]]:16: error: name `B` used before it was declared [NameUseBeforeDecl] extend base: B; - // CHECK:STDERR: fail_extend_poison_class_members.carbon:[[@LINE+4]]:6: note: declared here [NameUseBeforeDeclNote] - // CHECK:STDERR: fn B(); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_extend_poison_class_members.carbon:[[@LINE+2]]:6: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: fn B(); } diff --git a/toolchain/check/testdata/class/no_definition_in_impl_file.carbon b/toolchain/check/testdata/class/no_definition_in_impl_file.carbon index a071fc63b8b6..641a2375572a 100644 --- a/toolchain/check/testdata/class/no_definition_in_impl_file.carbon +++ b/toolchain/check/testdata/class/no_definition_in_impl_file.carbon @@ -52,17 +52,11 @@ class C; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+12]]:1: error: redeclaration of `class C` is redundant [RedeclRedundant] -// CHECK:STDERR: class C; -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: decl_in_api_decl_in_impl.carbon:4:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: class C; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+6]]:1-8: error: redeclaration of `class C` is redundant [RedeclRedundant] +// CHECK:STDERR: imported from: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: decl_in_api_decl_in_impl.carbon:4:1-8: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: -// CHECK:STDERR: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+4]]:1: error: no definition found for declaration in impl file [MissingDefinitionInImpl] -// CHECK:STDERR: class C; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+2]]:1-8: error: no definition found for declaration in impl file [MissingDefinitionInImpl] // CHECK:STDERR: class C; @@ -76,13 +70,9 @@ class D; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_decl_in_api_decl_and_definition_in_impl.impl.carbon:[[@LINE+8]]:1: error: redeclaration of `class D` is redundant [RedeclRedundant] -// CHECK:STDERR: class D; -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_decl_in_api_decl_and_definition_in_impl.impl.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: decl_in_api_decl_and_definition_in_impl.carbon:4:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: class D; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_decl_in_api_decl_and_definition_in_impl.impl.carbon:[[@LINE+4]]:1-8: error: redeclaration of `class D` is redundant [RedeclRedundant] +// CHECK:STDERR: imported from: fail_decl_in_api_decl_and_definition_in_impl.impl.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: decl_in_api_decl_and_definition_in_impl.carbon:4:1-8: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: class D; @@ -96,8 +86,6 @@ library "[[@TEST_NAME]]"; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_decl_only_in_impl.impl.carbon:[[@LINE+4]]:1: error: no definition found for declaration in impl file [MissingDefinitionInImpl] -// CHECK:STDERR: class E; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_decl_only_in_impl.impl.carbon:[[@LINE+2]]:1-8: error: no definition found for declaration in impl file [MissingDefinitionInImpl] // CHECK:STDERR: class E; diff --git a/toolchain/check/testdata/class/partial/access.carbon b/toolchain/check/testdata/class/partial/access.carbon index 7373c272eedd..cfbf559ffc63 100644 --- a/toolchain/check/testdata/class/partial/access.carbon +++ b/toolchain/check/testdata/class/partial/access.carbon @@ -36,12 +36,8 @@ library "[[@TEST_NAME]]"; import Common; fn F(ref pb: partial Common.B) { - // CHECK:STDERR: fail_invalid_partial_member_access.carbon:[[@LINE+7]]:27: error: cannot implicitly convert expression of type `partial Common.A` to `Common.A` [ConversionFailure] - // CHECK:STDERR: let ref _: Common.A = pb.base; - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_invalid_partial_member_access.carbon:[[@LINE+4]]:27: note: type `partial Common.A` does not implement interface `Core.ImplicitAs(Common.A)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let ref _: Common.A = pb.base; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_invalid_partial_member_access.carbon:[[@LINE+3]]:27-33: error: cannot implicitly convert expression of type `partial Common.A` to `Common.A` [ConversionFailure] + // CHECK:STDERR: fail_invalid_partial_member_access.carbon:[[@LINE+2]]:27-33: note: type `partial Common.A` does not implement interface `Core.ImplicitAs(Common.A)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let ref _: Common.A = pb.base; } diff --git a/toolchain/check/testdata/class/partial/qualifier.carbon b/toolchain/check/testdata/class/partial/qualifier.carbon index 13864c5944a2..effc4220a566 100644 --- a/toolchain/check/testdata/class/partial/qualifier.carbon +++ b/toolchain/check/testdata/class/partial/qualifier.carbon @@ -43,9 +43,7 @@ library "[[@TEST_NAME]]"; class C { } //@dump-sem-ir-begin -// CHECK:STDERR: fail_partial_nondynamic.carbon:[[@LINE+4]]:9: error: `partial` applied to final type `C` [PartialOnFinal] -// CHECK:STDERR: fn G(p: partial C); -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_partial_nondynamic.carbon:[[@LINE+2]]:9-17: error: `partial` applied to final type `C` [PartialOnFinal] // CHECK:STDERR: fn G(p: partial C); //@dump-sem-ir-end @@ -59,9 +57,7 @@ class Derived { } //@dump-sem-ir-begin -// CHECK:STDERR: fail_partial_final.carbon:[[@LINE+4]]:9: error: `partial` applied to final type `Derived` [PartialOnFinal] -// CHECK:STDERR: fn G(p: partial Derived); -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_partial_final.carbon:[[@LINE+2]]:9-23: error: `partial` applied to final type `Derived` [PartialOnFinal] // CHECK:STDERR: fn G(p: partial Derived); //@dump-sem-ir-end @@ -75,9 +71,7 @@ class C; // but since we only have a declaration, we don't know. //@dump-sem-ir-begin // applied to final type `C` [PartialOnFinal] CHECK:STDERR: fn G(p: partial C); -// CHECK:STDERR: fail_partial_decl.carbon:[[@LINE+4]]:9: error: `partial` applied to final type `C` [PartialOnFinal] -// CHECK:STDERR: fn G(p: partial C); -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_partial_decl.carbon:[[@LINE+2]]:9-17: error: `partial` applied to final type `C` [PartialOnFinal] // CHECK:STDERR: fn G(p: partial C); //@dump-sem-ir-end @@ -88,9 +82,7 @@ library "[[@TEST_NAME]]"; class C; //@dump-sem-ir-begin -// CHECK:STDERR: fail_partial_tuple.carbon:[[@LINE+4]]:9: error: `partial` applied to final type `(C, C)` [PartialOnFinal] -// CHECK:STDERR: fn G(p: partial (C, C)); -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_partial_tuple.carbon:[[@LINE+2]]:9-22: error: `partial` applied to final type `(C, C)` [PartialOnFinal] // CHECK:STDERR: fn G(p: partial (C, C)); //@dump-sem-ir-end @@ -101,9 +93,7 @@ library "[[@TEST_NAME]]"; class C; //@dump-sem-ir-begin -// CHECK:STDERR: fail_partial_struct.carbon:[[@LINE+4]]:9: error: `partial` applied to final type `{.x: C}` [PartialOnFinal] -// CHECK:STDERR: fn G(p: partial {.x: C}); -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_partial_struct.carbon:[[@LINE+2]]:9-23: error: `partial` applied to final type `{.x: C}` [PartialOnFinal] // CHECK:STDERR: fn G(p: partial {.x: C}); //@dump-sem-ir-end @@ -114,9 +104,7 @@ library "[[@TEST_NAME]]"; base class C { } //@dump-sem-ir-begin -// CHECK:STDERR: fail_duplicate.carbon:[[@LINE+4]]:9: error: `partial` applied to final type `partial C` [PartialOnFinal] -// CHECK:STDERR: fn F(p: partial (partial C)); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_duplicate.carbon:[[@LINE+2]]:9-27: error: `partial` applied to final type `partial C` [PartialOnFinal] // CHECK:STDERR: fn F(p: partial (partial C)); //@dump-sem-ir-end @@ -127,12 +115,8 @@ library "[[@TEST_NAME]]"; base class C { } 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*)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return p; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_convert_to_nonpartial.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `partial C*` to `C*` [ConversionFailure] + // CHECK:STDERR: fail_convert_to_nonpartial.carbon:[[@LINE+2]]:3-11: note: type `partial C*` does not implement interface `Core.ImplicitAs(C*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; } @@ -143,9 +127,7 @@ library "[[@TEST_NAME]]"; base class C { } class Derived { - // CHECK:STDERR: fail_derive_from_partial.carbon:[[@LINE+4]]:16: error: deriving from final type `partial C`; base type must be an `abstract` or `base` class [BaseIsFinal] - // CHECK:STDERR: extend base: partial C; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_derive_from_partial.carbon:[[@LINE+2]]:16-24: error: deriving from final type `partial C`; base type must be an `abstract` or `base` class [BaseIsFinal] // CHECK:STDERR: extend base: partial C; } @@ -156,9 +138,7 @@ library "[[@TEST_NAME]]"; // TODO: This should be accepted because `T` might be final once we know what it // is. -// CHECK:STDERR: fail_todo_partial_template_dependent.carbon:[[@LINE+4]]:27: error: `partial` applied to final type `T` [PartialOnFinal] -// CHECK:STDERR: fn G[template T: type](p: partial T*); -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_todo_partial_template_dependent.carbon:[[@LINE+2]]:27-35: error: `partial` applied to final type `T` [PartialOnFinal] // CHECK:STDERR: fn G[template T: type](p: partial T*); @@ -169,9 +149,7 @@ library "[[@TEST_NAME]]"; // generic type and its requirements, as distinct from the concrete type that // might be used here in any specific. -// CHECK:STDERR: fail_partial_generic.carbon:[[@LINE+4]]:18: error: `partial` applied to final type `T` [PartialOnFinal] -// CHECK:STDERR: fn F[T: type](p: partial T*); -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_partial_generic.carbon:[[@LINE+2]]:18-26: error: `partial` applied to final type `T` [PartialOnFinal] // CHECK:STDERR: fn F[T: type](p: partial T*); @@ -281,9 +259,9 @@ fn F[T: type](p: partial T*); // CHECK:STDOUT: %p.patt: %pattern_type = wrapper_binding_pattern p, %p.param_patt [concrete = constants.%p.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %p.param: %.331 = value_param call_param0 -// CHECK:STDOUT: %.loc10_9.1: type = splice_block %.loc10_9.2 [concrete = constants.%.331] { +// CHECK:STDOUT: %.loc8_9.1: type = splice_block %.loc8_9.2 [concrete = constants.%.331] { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc10_9.2: type = partial_type %C.ref [concrete = constants.%.331] +// CHECK:STDOUT: %.loc8_9.2: type = partial_type %C.ref [concrete = constants.%.331] // CHECK:STDOUT: } // CHECK:STDOUT: %p: %.331 = wrapper_binding p, %p.param // CHECK:STDOUT: } @@ -310,9 +288,9 @@ fn F[T: type](p: partial T*); // CHECK:STDOUT: %p.patt: %pattern_type = wrapper_binding_pattern p, %p.param_patt [concrete = constants.%p.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %p.param: %.546 = value_param call_param0 -// CHECK:STDOUT: %.loc13_9.1: type = splice_block %.loc13_9.2 [concrete = constants.%.546] { +// CHECK:STDOUT: %.loc11_9.1: type = splice_block %.loc11_9.2 [concrete = constants.%.546] { // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl [concrete = constants.%Derived] -// CHECK:STDOUT: %.loc13_9.2: type = partial_type %Derived.ref [concrete = constants.%.546] +// CHECK:STDOUT: %.loc11_9.2: type = partial_type %Derived.ref [concrete = constants.%.546] // CHECK:STDOUT: } // CHECK:STDOUT: %p: %.546 = wrapper_binding p, %p.param // CHECK:STDOUT: } @@ -339,9 +317,9 @@ fn F[T: type](p: partial T*); // CHECK:STDOUT: %p.patt: %pattern_type = wrapper_binding_pattern p, %p.param_patt [concrete = constants.%p.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %p.param: %.331 = value_param call_param0 -// CHECK:STDOUT: %.loc13_9.1: type = splice_block %.loc13_9.2 [concrete = constants.%.331] { +// CHECK:STDOUT: %.loc11_9.1: type = splice_block %.loc11_9.2 [concrete = constants.%.331] { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc13_9.2: type = partial_type %C.ref [concrete = constants.%.331] +// CHECK:STDOUT: %.loc11_9.2: type = partial_type %C.ref [concrete = constants.%.331] // CHECK:STDOUT: } // CHECK:STDOUT: %p: %.331 = wrapper_binding p, %p.param // CHECK:STDOUT: } @@ -371,12 +349,12 @@ fn F[T: type](p: partial T*); // CHECK:STDOUT: %p.patt: %pattern_type = wrapper_binding_pattern p, %p.param_patt [concrete = constants.%p.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %p.param: %.8dc = value_param call_param0 -// CHECK:STDOUT: %.loc10_9.1: type = splice_block %.loc10_9.3 [concrete = constants.%.8dc] { -// CHECK:STDOUT: %C.ref.loc10_18: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %C.ref.loc10_21: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc10_22: %tuple.type.693 = tuple_literal (%C.ref.loc10_18, %C.ref.loc10_21) [concrete = constants.%tuple] -// CHECK:STDOUT: %.loc10_9.2: type = converted %.loc10_22, constants.%tuple.type.748 [concrete = constants.%tuple.type.748] -// CHECK:STDOUT: %.loc10_9.3: type = partial_type %.loc10_9.2 [concrete = constants.%.8dc] +// CHECK:STDOUT: %.loc8_9.1: type = splice_block %.loc8_9.3 [concrete = constants.%.8dc] { +// CHECK:STDOUT: %C.ref.loc8_18: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %C.ref.loc8_21: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %.loc8_22: %tuple.type.693 = tuple_literal (%C.ref.loc8_18, %C.ref.loc8_21) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc8_9.2: type = converted %.loc8_22, constants.%tuple.type.748 [concrete = constants.%tuple.type.748] +// CHECK:STDOUT: %.loc8_9.3: type = partial_type %.loc8_9.2 [concrete = constants.%.8dc] // CHECK:STDOUT: } // CHECK:STDOUT: %p: %.8dc = wrapper_binding p, %p.param // CHECK:STDOUT: } @@ -404,10 +382,10 @@ fn F[T: type](p: partial T*); // CHECK:STDOUT: %p.patt: %pattern_type = wrapper_binding_pattern p, %p.param_patt [concrete = constants.%p.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %p.param: %.91f = value_param call_param0 -// CHECK:STDOUT: %.loc10_9.1: type = splice_block %.loc10_9.2 [concrete = constants.%.91f] { +// CHECK:STDOUT: %.loc8_9.1: type = splice_block %.loc8_9.2 [concrete = constants.%.91f] { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %struct_type.x: type = struct_type {.x: %C} [concrete = constants.%struct_type.x] -// CHECK:STDOUT: %.loc10_9.2: type = partial_type %struct_type.x [concrete = constants.%.91f] +// CHECK:STDOUT: %.loc8_9.2: type = partial_type %struct_type.x [concrete = constants.%.91f] // CHECK:STDOUT: } // CHECK:STDOUT: %p: %.91f = wrapper_binding p, %p.param // CHECK:STDOUT: } @@ -435,10 +413,10 @@ fn F[T: type](p: partial T*); // CHECK:STDOUT: %p.patt: %pattern_type = wrapper_binding_pattern p, %p.param_patt [concrete = constants.%p.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %p.param: %.d52 = value_param call_param0 -// CHECK:STDOUT: %.loc10_9.1: type = splice_block %.loc10_9.2 [concrete = constants.%.d52] { +// CHECK:STDOUT: %.loc8_9.1: type = splice_block %.loc8_9.2 [concrete = constants.%.d52] { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc10_18: type = partial_type %C.ref [concrete = constants.%.331] -// CHECK:STDOUT: %.loc10_9.2: type = partial_type %.loc10_18 [concrete = constants.%.d52] +// CHECK:STDOUT: %.loc8_18: type = partial_type %C.ref [concrete = constants.%.331] +// CHECK:STDOUT: %.loc8_9.2: type = partial_type %.loc8_18 [concrete = constants.%.d52] // CHECK:STDOUT: } // CHECK:STDOUT: %p: %.d52 = wrapper_binding p, %p.param // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/self/fail_ref_self.carbon b/toolchain/check/testdata/class/self/fail_ref_self.carbon index fd8d3915f392..d387c668f832 100644 --- a/toolchain/check/testdata/class/self/fail_ref_self.carbon +++ b/toolchain/check/testdata/class/self/fail_ref_self.carbon @@ -19,12 +19,8 @@ class Class { fn Make() -> Class; fn F(c: Class, p: Class*) { - // CHECK:STDERR: fail_ref_self.carbon:[[@LINE+7]]:3: error: value expression passed to reference parameter [ValueForRefParam] - // CHECK:STDERR: c.F(); - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_ref_self.carbon:[[@LINE-9]]:8: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn F(ref self); - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_ref_self.carbon:[[@LINE+3]]:3: error: value expression passed to reference parameter [ValueForRefParam] + // CHECK:STDERR: fail_ref_self.carbon:[[@LINE-7]]:8-15: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: c.F(); @@ -65,15 +61,15 @@ fn F(c: Class, p: Class*) { // CHECK:STDOUT: %pattern_type.a96: type = pattern_type %empty_struct_type [concrete] // CHECK:STDOUT: %self.param_patt.52f: %pattern_type.a96 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.4b1: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt.52f [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc35_8.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc31_8.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc35_8.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc31_8.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.1: %Destroy.WithSelf.Op.type.ef016f.1 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc35_8.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc31_8.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc35_8.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc31_8.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.2: %Destroy.WithSelf.Op.type.ef016f.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc35_8.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc31_8.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.2: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -87,28 +83,28 @@ fn F(c: Class, p: Class*) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc35_8.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc31_8.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.a96 = ref_param_pattern [concrete = constants.%self.param_patt.52f] // CHECK:STDOUT: %self.patt: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.4b1] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %empty_struct_type = ref_param call_param0 // CHECK:STDOUT: %self: ref %empty_struct_type = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc35_8.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc31_8.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.a96 = ref_param_pattern [concrete = constants.%self.param_patt.52f] // CHECK:STDOUT: %self.patt: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.4b1] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %empty_struct_type = ref_param call_param0 // CHECK:STDOUT: %self: ref %empty_struct_type = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc35_8.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc31_8.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.f15 = ref_param_pattern [concrete = constants.%self.param_patt.b2b] // CHECK:STDOUT: %self.patt: %pattern_type.f15 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.f19] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %Class = ref_param call_param0 // CHECK:STDOUT: %self: ref %Class = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc35_8.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc31_8.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.f15 = ref_param_pattern [concrete = constants.%self.param_patt.b2b] // CHECK:STDOUT: %self.patt: %pattern_type.f15 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.f19] // CHECK:STDOUT: } { @@ -177,42 +173,42 @@ fn F(c: Class, p: Class*) { // CHECK:STDOUT: fn @F(%c.param: %Class, %p.param: %ptr.7ee) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %c.ref: %Class = name_ref c, %c -// CHECK:STDOUT: %F.ref.loc29: %Class.F.type = name_ref F, @Class.%Class.F.decl [concrete = constants.%Class.F] -// CHECK:STDOUT: %Class.F.bound.loc29: = bound_method %c.ref, %F.ref.loc29 -// CHECK:STDOUT: %Class.F.call.loc29: init %empty_tuple.type = call %Class.F.bound.loc29() +// CHECK:STDOUT: %F.ref.loc25: %Class.F.type = name_ref F, @Class.%Class.F.decl [concrete = constants.%Class.F] +// CHECK:STDOUT: %Class.F.bound.loc25: = bound_method %c.ref, %F.ref.loc25 +// CHECK:STDOUT: %Class.F.call.loc25: init %empty_tuple.type = call %Class.F.bound.loc25() // CHECK:STDOUT: %p.ref: %ptr.7ee = name_ref p, %p -// CHECK:STDOUT: %.loc32: ref %Class = deref %p.ref -// CHECK:STDOUT: %F.ref.loc32: %Class.F.type = name_ref F, @Class.%Class.F.decl [concrete = constants.%Class.F] -// CHECK:STDOUT: %Class.F.bound.loc32: = bound_method %.loc32, %F.ref.loc32 -// CHECK:STDOUT: %Class.F.call.loc32: init %empty_tuple.type = call %Class.F.bound.loc32(%.loc32) +// CHECK:STDOUT: %.loc28: ref %Class = deref %p.ref +// CHECK:STDOUT: %F.ref.loc28: %Class.F.type = name_ref F, @Class.%Class.F.decl [concrete = constants.%Class.F] +// CHECK:STDOUT: %Class.F.bound.loc28: = bound_method %.loc28, %F.ref.loc28 +// CHECK:STDOUT: %Class.F.call.loc28: init %empty_tuple.type = call %Class.F.bound.loc28(%.loc28) // CHECK:STDOUT: %Make.ref: %Make.type = name_ref Make, file.%Make.decl [concrete = constants.%Make] -// CHECK:STDOUT: %.loc35_8.1: ref %Class = temporary_storage -// CHECK:STDOUT: %Make.call: init %Class to %.loc35_8.1 = call %Make.ref() -// CHECK:STDOUT: %.loc35_8.2: ref %Class = temporary %.loc35_8.1, %Make.call -// CHECK:STDOUT: %F.ref.loc35: %Class.F.type = name_ref F, @Class.%Class.F.decl [concrete = constants.%Class.F] -// CHECK:STDOUT: %Class.F.bound.loc35: = bound_method %.loc35_8.2, %F.ref.loc35 -// CHECK:STDOUT: %Class.F.call.loc35: init %empty_tuple.type = call %Class.F.bound.loc35(%.loc35_8.2) -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc35_8.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc35_8.2) +// CHECK:STDOUT: %.loc31_8.1: ref %Class = temporary_storage +// CHECK:STDOUT: %Make.call: init %Class to %.loc31_8.1 = call %Make.ref() +// CHECK:STDOUT: %.loc31_8.2: ref %Class = temporary %.loc31_8.1, %Make.call +// CHECK:STDOUT: %F.ref.loc31: %Class.F.type = name_ref F, @Class.%Class.F.decl [concrete = constants.%Class.F] +// CHECK:STDOUT: %Class.F.bound.loc31: = bound_method %.loc31_8.2, %F.ref.loc31 +// CHECK:STDOUT: %Class.F.call.loc31: init %empty_tuple.type = call %Class.F.bound.loc31(%.loc31_8.2) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc31_8.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc31_8.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc35_8.1(%self.param: ref %empty_struct_type) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc31_8.1(%self.param: ref %empty_struct_type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc35_8.1(%self.param: ref %empty_struct_type) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc31_8.1(%self.param: ref %empty_struct_type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc35_8.1(%self.param: ref %empty_struct_type) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc31_8.1(%self.param: ref %empty_struct_type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.1(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.1(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc35_8.2(%self.param: ref %Class) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc31_8.2(%self.param: ref %Class) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc35_8.2(%self.param: ref %Class) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc31_8.2(%self.param: ref %Class) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc35_8.2(%self.param: ref %Class) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc31_8.2(%self.param: ref %Class) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.2(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.2(%self.param) diff --git a/toolchain/check/testdata/class/self/fail_self.carbon b/toolchain/check/testdata/class/self/fail_self.carbon index 69f77c7b472f..2b9565cebe95 100644 --- a/toolchain/check/testdata/class/self/fail_self.carbon +++ b/toolchain/check/testdata/class/self/fail_self.carbon @@ -16,29 +16,19 @@ library "[[@TEST_NAME]]"; // `self` is not permitted in the implicit parameter list, regardless of how // its type is spelled (explicit `Self`, an arbitrary type, or omitted). class Class { - // CHECK:STDERR: fail_self_implicit_list.carbon:[[@LINE+4]]:8: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] - // CHECK:STDERR: fn F[self: Self](); - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_self_implicit_list.carbon:[[@LINE+2]]:8-17: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] // CHECK:STDERR: fn F[self: Self](); - // CHECK:STDERR: fail_self_implicit_list.carbon:[[@LINE+4]]:8: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] - // CHECK:STDERR: fn G[self: Class](); - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_self_implicit_list.carbon:[[@LINE+2]]:8-18: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] // CHECK:STDERR: fn G[self: Class](); - // CHECK:STDERR: fail_self_implicit_list.carbon:[[@LINE+4]]:8: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] - // CHECK:STDERR: fn H[self](); - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_self_implicit_list.carbon:[[@LINE+2]]:8-11: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] // CHECK:STDERR: fn H[self](); - // CHECK:STDERR: fail_self_implicit_list.carbon:[[@LINE+4]]:8: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] - // CHECK:STDERR: fn I[ref self: Self](); - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_self_implicit_list.carbon:[[@LINE+2]]:8-21: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] // CHECK:STDERR: fn I[ref self: Self](); - // CHECK:STDERR: fail_self_implicit_list.carbon:[[@LINE+4]]:8: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] - // CHECK:STDERR: fn J[ref self](); - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_self_implicit_list.carbon:[[@LINE+2]]:8-15: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] // CHECK:STDERR: fn J[ref self](); } @@ -47,16 +37,12 @@ class Class { library "[[@TEST_NAME]]"; // `self` outside any class scope has no `Self` to default to. -// CHECK:STDERR: fail_self_outside_class.carbon:[[@LINE+4]]:6: error: name `Self` not found [NameNotFound] -// CHECK:STDERR: fn F(self); -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_self_outside_class.carbon:[[@LINE+2]]:6-9: error: name `Self` not found [NameNotFound] // CHECK:STDERR: fn F(self); // `ref self` is similarly invalid at file scope. -// CHECK:STDERR: fail_self_outside_class.carbon:[[@LINE+4]]:6: error: name `Self` not found [NameNotFound] -// CHECK:STDERR: fn G(ref self); -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_self_outside_class.carbon:[[@LINE+2]]:6-13: error: name `Self` not found [NameNotFound] // CHECK:STDERR: fn G(ref self); @@ -65,119 +51,63 @@ library "[[@TEST_NAME]]"; class Class { // Repeating `self` within a single parameter list is rejected. - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+7]]:14: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] - // CHECK:STDERR: fn F(self, self); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+4]]:8: note: name is previously declared here [NameDeclPrevious] - // CHECK:STDERR: fn F(self, self); - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+3]]:14-17: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] + // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+2]]:8-11: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: fn F(self, self); - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+7]]:20: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] - // CHECK:STDERR: fn G(self: Self, self); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+4]]:8: note: name is previously declared here [NameDeclPrevious] - // CHECK:STDERR: fn G(self: Self, self); - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+3]]:20-23: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] + // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+2]]:8-17: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: fn G(self: Self, self); - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+7]]:14: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] - // CHECK:STDERR: fn H(self, self: Self); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+4]]:8: note: name is previously declared here [NameDeclPrevious] - // CHECK:STDERR: fn H(self, self: Self); - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+3]]:14-17: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] + // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+2]]:8-11: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: fn H(self, self: Self); - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+7]]:18: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] - // CHECK:STDERR: fn I(ref self, self); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+4]]:8: note: name is previously declared here [NameDeclPrevious] - // CHECK:STDERR: fn I(ref self, self); - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+3]]:18-21: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] + // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+2]]:8-15: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: fn I(ref self, self); - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+7]]:24: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] - // CHECK:STDERR: fn J(ref self: Self, self: Self); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+4]]:8: note: name is previously declared here [NameDeclPrevious] - // CHECK:STDERR: fn J(ref self: Self, self: Self); - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+3]]:24-27: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] + // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+2]]:8-21: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: fn J(ref self: Self, self: Self); // `self` in both lists, even just once each, is rejected: the implicit // occurrence is wrong, and the explicit one becomes a duplicate. - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+11]]:8: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] - // CHECK:STDERR: fn K[self](self); - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+5]]:8-11: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] // CHECK:STDERR: - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+7]]:14: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] - // CHECK:STDERR: fn K[self](self); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+4]]:8: note: name is previously declared here [NameDeclPrevious] - // CHECK:STDERR: fn K[self](self); - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+3]]:14-17: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] + // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+2]]:8-11: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: fn K[self](self); - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+11]]:8: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] - // CHECK:STDERR: fn L[self: Self](self); - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+5]]:8-17: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] // CHECK:STDERR: - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+7]]:20: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] - // CHECK:STDERR: fn L[self: Self](self); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+4]]:8: note: name is previously declared here [NameDeclPrevious] - // CHECK:STDERR: fn L[self: Self](self); - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+3]]:20-23: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] + // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+2]]:8-17: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: fn L[self: Self](self); // Duplicates within the implicit list and across both lists. - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+15]]:8: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] - // CHECK:STDERR: fn M[self, self](); - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+7]]:8-11: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] // CHECK:STDERR: - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+11]]:14: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] - // CHECK:STDERR: fn M[self, self](); - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+5]]:14-17: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] // CHECK:STDERR: - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+7]]:14: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] - // CHECK:STDERR: fn M[self, self](); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+4]]:8: note: name is previously declared here [NameDeclPrevious] - // CHECK:STDERR: fn M[self, self](); - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+3]]:14-17: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] + // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+2]]:8-11: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: fn M[self, self](); - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+29]]:8: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] - // CHECK:STDERR: fn N[self, self](self, self); - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+13]]:8-11: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] // CHECK:STDERR: - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+25]]:14: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] - // CHECK:STDERR: fn N[self, self](self, self); - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+11]]:14-17: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] // CHECK:STDERR: - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+21]]:14: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] - // CHECK:STDERR: fn N[self, self](self, self); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+18]]:8: note: name is previously declared here [NameDeclPrevious] - // CHECK:STDERR: fn N[self, self](self, self); - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+9]]:14-17: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] + // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+8]]:8-11: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+14]]:20: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] - // CHECK:STDERR: fn N[self, self](self, self); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+11]]:8: note: name is previously declared here [NameDeclPrevious] - // CHECK:STDERR: fn N[self, self](self, self); - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+6]]:20-23: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] + // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+5]]:8-11: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+7]]:26: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] - // CHECK:STDERR: fn N[self, self](self, self); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+4]]:8: note: name is previously declared here [NameDeclPrevious] - // CHECK:STDERR: fn N[self, self](self, self); - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+3]]:26-29: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] + // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+2]]:8-11: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: fn N[self, self](self, self); } @@ -192,9 +122,7 @@ class Class { fn Class.F() { // `var self` is only valid as the receiver of a method, not as a local // variable. - // CHECK:STDERR: fail_var_self.carbon:[[@LINE+4]]:14: error: `self` can only be declared in a parameter list [SelfOutsideParamList] - // CHECK:STDERR: var unused self: Self; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_var_self.carbon:[[@LINE+2]]:14-23: error: `self` can only be declared in a parameter list [SelfOutsideParamList] // CHECK:STDERR: var unused self: Self; } @@ -212,15 +140,9 @@ class WrongSelf { } fn CallWrongSelf(ws: WrongSelf) { - // CHECK:STDERR: fail_self_wrong_type.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_wrong_type.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_wrong_type.carbon:[[@LINE-10]]:8: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn F(self: Class); - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_self_wrong_type.carbon:[[@LINE+4]]:3-4: error: cannot implicitly convert expression of type `WrongSelf` to `Class` [ConversionFailure] + // CHECK:STDERR: fail_self_wrong_type.carbon:[[@LINE+3]]:3-4: note: type `WrongSelf` does not implement interface `Core.ImplicitAs(Class)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: fail_self_wrong_type.carbon:[[@LINE-6]]:8-18: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: ws.F(); } @@ -230,9 +152,7 @@ library "[[@TEST_NAME]]"; class Class { // `self` must be the first explicit parameter. - // CHECK:STDERR: fail_self_not_first.carbon:[[@LINE+4]]:22: error: `self` must be the first explicit parameter [SelfNotFirstParam] - // CHECK:STDERR: fn F(other: Class, self: Self); - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_self_not_first.carbon:[[@LINE+2]]:22-31: error: `self` must be the first explicit parameter [SelfNotFirstParam] // CHECK:STDERR: fn F(other: Class, self: Self); } diff --git a/toolchain/check/testdata/class/self/fail_self_param.carbon b/toolchain/check/testdata/class/self/fail_self_param.carbon index d276e2b62174..da55d7b7dcae 100644 --- a/toolchain/check/testdata/class/self/fail_self_param.carbon +++ b/toolchain/check/testdata/class/self/fail_self_param.carbon @@ -15,17 +15,11 @@ library "[[@TEST_NAME]]"; // `self` is not a valid parameter of a class declaration even when placed in // the explicit parameter list. -// CHECK:STDERR: fail_self_param.carbon:[[@LINE+4]]:9: error: `self` parameter only allowed on functions [SelfParameterNotAllowed] -// CHECK:STDERR: class C(self: type, x: self) {} -// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: fail_self_param.carbon:[[@LINE+2]]:9-18: error: `self` parameter only allowed on functions [SelfParameterNotAllowed] // CHECK:STDERR: class C(self: type, x: self) {} -// CHECK:STDERR: fail_self_param.carbon:[[@LINE+7]]:8: error: 1 argument passed to generic class expecting 2 arguments [CallArgCountMismatch] -// CHECK:STDERR: var v: C(()); -// CHECK:STDERR: ^~~~~ -// CHECK:STDERR: fail_self_param.carbon:[[@LINE-4]]:1: note: calling generic class declared here [InCallToEntity] -// CHECK:STDERR: class C(self: type, x: self) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_self_param.carbon:[[@LINE+3]]:8-12: error: 1 argument passed to generic class expecting 2 arguments [CallArgCountMismatch] +// CHECK:STDERR: fail_self_param.carbon:[[@LINE-2]]:1-30: note: calling generic class declared here [InCallToEntity] // CHECK:STDERR: var v: C(()); @@ -34,13 +28,9 @@ library "[[@TEST_NAME]]"; // `self` in the implicit parameter list of a class declaration is reported as // both being in the wrong list and not allowed on a class at all. -// CHECK:STDERR: fail_self_param_implicit.carbon:[[@LINE+8]]:9: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] -// CHECK:STDERR: class C[self: type](x: self) {} -// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: fail_self_param_implicit.carbon:[[@LINE+4]]:9-18: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] // CHECK:STDERR: -// CHECK:STDERR: fail_self_param_implicit.carbon:[[@LINE+4]]:9: error: `self` parameter only allowed on functions [SelfParameterNotAllowed] -// CHECK:STDERR: class C[self: type](x: self) {} -// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: fail_self_param_implicit.carbon:[[@LINE+2]]:9-18: error: `self` parameter only allowed on functions [SelfParameterNotAllowed] // CHECK:STDERR: class C[self: type](x: self) {} var v: C(()); diff --git a/toolchain/check/testdata/class/self/fail_self_type_member.carbon b/toolchain/check/testdata/class/self/fail_self_type_member.carbon index da7f2686bc24..2c1d20d4a494 100644 --- a/toolchain/check/testdata/class/self/fail_self_type_member.carbon +++ b/toolchain/check/testdata/class/self/fail_self_type_member.carbon @@ -16,13 +16,9 @@ class Class { fn F() -> bool { var c1: Class = {.b = true}; - // CHECK:STDERR: fail_self_type_member.carbon:[[@LINE+8]]:17: error: expected identifier after `.`; prefix reserved word with `r#` to form a valid identifier [ExpectedIdentifierAfterPeriodOrArrow] - // CHECK:STDERR: var c2: Class.Self = c1; - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_self_type_member.carbon:[[@LINE+4]]:17-20: error: expected identifier after `.`; prefix reserved word with `r#` to form a valid identifier [ExpectedIdentifierAfterPeriodOrArrow] // CHECK:STDERR: - // CHECK:STDERR: fail_self_type_member.carbon:[[@LINE+4]]:11: error: member name `r#Self` not found in `Class` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: var c2: Class.Self = c1; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_self_type_member.carbon:[[@LINE+2]]:11-20: error: member name `r#Self` not found in `Class` [MemberNameNotFoundInInstScope] // CHECK:STDERR: var c2: Class.Self = c1; return c2.b; diff --git a/toolchain/check/testdata/class/self/generic_self.carbon b/toolchain/check/testdata/class/self/generic_self.carbon index 895da5ac1c2e..96501fe7be78 100644 --- a/toolchain/check/testdata/class/self/generic_self.carbon +++ b/toolchain/check/testdata/class/self/generic_self.carbon @@ -29,12 +29,8 @@ class Class { } fn G(c: Class) { - // CHECK:STDERR: fail_runtime_arg.carbon:[[@LINE+7]]:3: error: argument for generic parameter is not a compile-time constant [CompTimeArgumentNotConstant] - // CHECK:STDERR: c.F(); - // CHECK:STDERR: ^~~~~ - // CHECK:STDERR: fail_runtime_arg.carbon:[[@LINE-7]]:23: note: initializing generic parameter `self` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(unused generic self: Self) {} - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_runtime_arg.carbon:[[@LINE+3]]:3-7: error: argument for generic parameter is not a compile-time constant [CompTimeArgumentNotConstant] + // CHECK:STDERR: fail_runtime_arg.carbon:[[@LINE-5]]:23-32: note: initializing generic parameter `self` declared here [InitializingGenericParam] // CHECK:STDERR: c.F(); } diff --git a/toolchain/check/testdata/class/self/self.carbon b/toolchain/check/testdata/class/self/self.carbon index 94c129f92ddf..845c29f6a268 100644 --- a/toolchain/check/testdata/class/self/self.carbon +++ b/toolchain/check/testdata/class/self/self.carbon @@ -42,21 +42,13 @@ class Class { } // A redeclaration must spell `self` the same way as the original. -// CHECK:STDERR: fail_self_syntax_mismatch.carbon:[[@LINE+7]]:19: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: fn Class.F(unused self) {} -// CHECK:STDERR: ^~~~ -// CHECK:STDERR: fail_self_syntax_mismatch.carbon:[[@LINE-8]]:12: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] -// CHECK:STDERR: fn F(self: Self); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_self_syntax_mismatch.carbon:[[@LINE+3]]:19-22: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] +// CHECK:STDERR: fail_self_syntax_mismatch.carbon:[[@LINE-6]]:12: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] // CHECK:STDERR: fn Class.F(unused self) {} -// CHECK:STDERR: fail_self_syntax_mismatch.carbon:[[@LINE+7]]:23: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: fn Class.G(unused self: Self) {} -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_self_syntax_mismatch.carbon:[[@LINE-16]]:8: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] -// CHECK:STDERR: fn G(self); -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_self_syntax_mismatch.carbon:[[@LINE+3]]:23: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] +// CHECK:STDERR: fail_self_syntax_mismatch.carbon:[[@LINE-10]]:8-11: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] // CHECK:STDERR: fn Class.G(unused self: Self) {} @@ -69,12 +61,8 @@ class Class { // Two explicit `self` types that differ syntactically (here `Class` instead of // `Self`, even though they refer to the same type). -// CHECK:STDERR: fail_self_type_mismatch.carbon:[[@LINE+7]]:25: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: fn Class.F(unused self: Class) {} -// CHECK:STDERR: ^~~~~ -// CHECK:STDERR: fail_self_type_mismatch.carbon:[[@LINE-8]]:14: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] -// CHECK:STDERR: fn F(self: Self); -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_self_type_mismatch.carbon:[[@LINE+3]]:25-29: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] +// CHECK:STDERR: fail_self_type_mismatch.carbon:[[@LINE-6]]:14-17: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] // CHECK:STDERR: fn Class.F(unused self: Class) {} @@ -82,12 +70,8 @@ fn Class.F(unused self: Class) {} library "[[@TEST_NAME]]"; class Class { - // CHECK:STDERR: fail_return_self_value.carbon:[[@LINE+7]]:17: error: cannot implicitly convert non-type value of type `Self` to `type` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fn F(self) -> self; - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_return_self_value.carbon:[[@LINE+4]]:17: note: type `Class` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fn F(self) -> self; - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_return_self_value.carbon:[[@LINE+3]]:17-20: error: cannot implicitly convert non-type value of type `Self` to `type` [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: fail_return_self_value.carbon:[[@LINE+2]]:17-20: note: type `Class` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn F(self) -> self; } @@ -265,9 +249,9 @@ class Class { // CHECK:STDOUT: %Class.G.d407b2.1: %Class.G.type.321a2c.1 = struct_value () [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: %Class.F.type.48cdab.2: type = fn_type @Class.F.loc16 [concrete] +// CHECK:STDOUT: %Class.F.type.48cdab.2: type = fn_type @Class.F.loc12 [concrete] // CHECK:STDOUT: %Class.F.bd5be1.2: %Class.F.type.48cdab.2 = struct_value () [concrete] -// CHECK:STDOUT: %Class.G.type.321a2c.2: type = fn_type @Class.G.loc25 [concrete] +// CHECK:STDOUT: %Class.G.type.321a2c.2: type = fn_type @Class.G.loc17 [concrete] // CHECK:STDOUT: %Class.G.d407b2.2: %Class.G.type.321a2c.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -285,7 +269,7 @@ class Class { // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %Class.decl: type = class_decl @Class [concrete = constants.%Class] {} {} -// CHECK:STDOUT: %Class.F.decl: %Class.F.type.48cdab.2 = fn_decl @Class.F.loc16 [concrete = constants.%Class.F.bd5be1.2] { +// CHECK:STDOUT: %Class.F.decl: %Class.F.type.48cdab.2 = fn_decl @Class.F.loc12 [concrete = constants.%Class.F.bd5be1.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type = value_param_pattern [concrete = constants.%self.param_patt] // CHECK:STDOUT: %self.patt: %pattern_type = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt] // CHECK:STDOUT: } { @@ -293,7 +277,7 @@ class Class { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [concrete = constants.%Class] // CHECK:STDOUT: %self: %Class = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Class.G.decl: %Class.G.type.321a2c.2 = fn_decl @Class.G.loc25 [concrete = constants.%Class.G.d407b2.2] { +// CHECK:STDOUT: %Class.G.decl: %Class.G.type.321a2c.2 = fn_decl @Class.G.loc17 [concrete = constants.%Class.G.d407b2.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type = value_param_pattern [concrete = constants.%self.param_patt] // CHECK:STDOUT: %self.patt: %pattern_type = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt] // CHECK:STDOUT: } { @@ -333,12 +317,12 @@ class Class { // CHECK:STDOUT: // CHECK:STDOUT: fn @Class.G.loc5(%self.param: %Class); // CHECK:STDOUT: -// CHECK:STDOUT: fn @Class.F.loc16(%self.param: %Class) { +// CHECK:STDOUT: fn @Class.F.loc12(%self.param: %Class) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Class.G.loc25(%self.param: %Class) { +// CHECK:STDOUT: fn @Class.G.loc17(%self.param: %Class) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -355,7 +339,7 @@ class Class { // CHECK:STDOUT: %Class.F.bd5be1.1: %Class.F.type.48cdab.1 = struct_value () [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: %Class.F.type.48cdab.2: type = fn_type @Class.F.loc16 [concrete] +// CHECK:STDOUT: %Class.F.type.48cdab.2: type = fn_type @Class.F.loc12 [concrete] // CHECK:STDOUT: %Class.F.bd5be1.2: %Class.F.type.48cdab.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -373,7 +357,7 @@ class Class { // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %Class.decl: type = class_decl @Class [concrete = constants.%Class] {} {} -// CHECK:STDOUT: %Class.F.decl: %Class.F.type.48cdab.2 = fn_decl @Class.F.loc16 [concrete = constants.%Class.F.bd5be1.2] { +// CHECK:STDOUT: %Class.F.decl: %Class.F.type.48cdab.2 = fn_decl @Class.F.loc12 [concrete = constants.%Class.F.bd5be1.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type = value_param_pattern [concrete = constants.%self.param_patt] // CHECK:STDOUT: %self.patt: %pattern_type = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt] // CHECK:STDOUT: } { @@ -403,7 +387,7 @@ class Class { // CHECK:STDOUT: // CHECK:STDOUT: fn @Class.F.loc4(%self.param: %Class); // CHECK:STDOUT: -// CHECK:STDOUT: fn @Class.F.loc16(%self.param: %Class) { +// CHECK:STDOUT: fn @Class.F.loc12(%self.param: %Class) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -449,7 +433,7 @@ class Class { // CHECK:STDOUT: %return.patt: = return_slot_pattern , [concrete = ] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.ref: %Class = name_ref self, %self -// CHECK:STDOUT: %.loc11: type = converted %self.ref, [concrete = ] +// CHECK:STDOUT: %.loc7: type = converted %self.ref, [concrete = ] // CHECK:STDOUT: %self.param: %Class = value_param call_param0 // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [concrete = constants.%Class] // CHECK:STDOUT: %self: %Class = wrapper_binding self, %self.param diff --git a/toolchain/check/testdata/class/syntactic_merge.carbon b/toolchain/check/testdata/class/syntactic_merge.carbon index 68609ccb7567..fb1890878ee6 100644 --- a/toolchain/check/testdata/class/syntactic_merge.carbon +++ b/toolchain/check/testdata/class/syntactic_merge.carbon @@ -41,12 +41,8 @@ library "[[@TEST_NAME]]"; class C {} class Foo(a: C); -// CHECK:STDERR: fail_parens.carbon:[[@LINE+7]]:14: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: class Foo(a: (C)) {} -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_parens.carbon:[[@LINE-4]]:14: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] -// CHECK:STDERR: class Foo(a: C); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_parens.carbon:[[@LINE+3]]:14: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] +// CHECK:STDERR: fail_parens.carbon:[[@LINE-2]]:14: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] // CHECK:STDERR: class Foo(a: (C)) {} @@ -57,12 +53,8 @@ library "[[@TEST_NAME]]"; class C {} class Foo(a: C); -// CHECK:STDERR: fail_raw_identifier.carbon:[[@LINE+7]]:14: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: class Foo(a: r#C) {} -// CHECK:STDERR: ^~~ -// CHECK:STDERR: fail_raw_identifier.carbon:[[@LINE-4]]:14: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] -// CHECK:STDERR: class Foo(a: C); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_raw_identifier.carbon:[[@LINE+3]]:14-16: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] +// CHECK:STDERR: fail_raw_identifier.carbon:[[@LINE-2]]:14: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] // CHECK:STDERR: class Foo(a: r#C) {} @@ -91,12 +83,8 @@ class C {} alias D = C; class Foo(a: C); -// CHECK:STDERR: fail_name_mismatch.carbon:[[@LINE+7]]:11: error: redeclaration differs at parameter 1 [RedeclParamDiffers] -// CHECK:STDERR: class Foo(b: D) {} -// CHECK:STDERR: ^~~~ -// CHECK:STDERR: fail_name_mismatch.carbon:[[@LINE-4]]:11: note: previous declaration's corresponding parameter here [RedeclParamPrevious] -// CHECK:STDERR: class Foo(a: C); -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_name_mismatch.carbon:[[@LINE+3]]:11-14: error: redeclaration differs at parameter 1 [RedeclParamDiffers] +// CHECK:STDERR: fail_name_mismatch.carbon:[[@LINE-2]]:11-14: note: previous declaration's corresponding parameter here [RedeclParamPrevious] // CHECK:STDERR: class Foo(b: D) {} @@ -108,12 +96,8 @@ class C {} alias D = C; class Foo(a: C); -// CHECK:STDERR: fail_alias.carbon:[[@LINE+7]]:14: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: class Foo(a: D) {} -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_alias.carbon:[[@LINE-4]]:14: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] -// CHECK:STDERR: class Foo(a: C); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_alias.carbon:[[@LINE+3]]:14: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] +// CHECK:STDERR: fail_alias.carbon:[[@LINE-2]]:14: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] // CHECK:STDERR: class Foo(a: D) {} @@ -125,12 +109,8 @@ class C {} alias D = C; class Foo[a: C](); -// CHECK:STDERR: fail_deduced_alias.carbon:[[@LINE+7]]:14: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: class Foo[a: D]() {} -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_deduced_alias.carbon:[[@LINE-4]]:14: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] -// CHECK:STDERR: class Foo[a: C](); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_deduced_alias.carbon:[[@LINE+3]]:14: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] +// CHECK:STDERR: fail_deduced_alias.carbon:[[@LINE-2]]:14: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] // CHECK:STDERR: class Foo[a: D]() {} @@ -157,16 +137,10 @@ library "[[@TEST_NAME]]"; class C {} class Foo(a: const C); -// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE+11]]:14: warning: `const` applied repeatedly to the same type has no additional effect [RepeatedConst] -// CHECK:STDERR: class Foo(a: const (const C)) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE+5]]:14-28: warning: `const` applied repeatedly to the same type has no additional effect [RepeatedConst] // CHECK:STDERR: -// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE+7]]:20: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: class Foo(a: const (const C)) {} -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE-8]]:20: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] -// CHECK:STDERR: class Foo(a: const C); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE+3]]:20: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] +// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE-4]]:20: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] // CHECK:STDERR: class Foo(a: const (const C)) {} @@ -180,12 +154,8 @@ base class Base { fn F(ref self); } -// CHECK:STDERR: fail_self_type.carbon:[[@LINE+7]]:19: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: fn Base.F(ref self: Base) { -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_self_type.carbon:[[@LINE-6]]:8: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] -// CHECK:STDERR: fn F(ref self); -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_self_type.carbon:[[@LINE+3]]:19: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] +// CHECK:STDERR: fail_self_type.carbon:[[@LINE-4]]:8-15: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] // CHECK:STDERR: fn Base.F(ref self: Base) { self.a = (); @@ -389,9 +359,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: %a: %C = symbolic_binding a, 0 [symbolic] // CHECK:STDOUT: %Foo.type.6e5839.1: type = parameterized_class_name_type @Foo.loc6 [concrete] // CHECK:STDOUT: %Foo.generic.08f655.1: %Foo.type.6e5839.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.6e5839.2: type = parameterized_class_name_type @Foo.loc14 [concrete] +// CHECK:STDOUT: %Foo.type.6e5839.2: type = parameterized_class_name_type @Foo.loc10 [concrete] // CHECK:STDOUT: %Foo.generic.08f655.2: %Foo.type.6e5839.2 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.755f1e.2: type = class_type @Foo.loc14, @Foo.loc14(%a) [symbolic] +// CHECK:STDOUT: %Foo.755f1e.2: type = class_type @Foo.loc10, @Foo.loc10(%a) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -409,14 +379,14 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: } // CHECK:STDOUT: %a.loc6_12.2: %C = symbolic_binding a, 0 [symbolic = %a.loc6_12.1 (constants.%a)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc14: %Foo.type.6e5839.2 = class_decl @Foo.loc14 [concrete = constants.%Foo.generic.08f655.2] { -// CHECK:STDOUT: %a.patt.loc14_12.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc14_12.2 (constants.%a.patt)] +// CHECK:STDOUT: %Foo.decl.loc10: %Foo.type.6e5839.2 = class_decl @Foo.loc10 [concrete = constants.%Foo.generic.08f655.2] { +// CHECK:STDOUT: %a.patt.loc10_12.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc10_12.2 (constants.%a.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc14: type = splice_block %C.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc10: type = splice_block %C.ref [concrete = constants.%C] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.loc14_12.2: %C = symbolic_binding a, 0 [symbolic = %a.loc14_12.1 (constants.%a)] +// CHECK:STDOUT: %a.loc10_12.2: %C = symbolic_binding a, 0 [symbolic = %a.loc10_12.1 (constants.%a)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -435,9 +405,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: class; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @Foo.loc14(%a.loc14_12.2: %C) { -// CHECK:STDOUT: %a.patt.loc14_12.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc14_12.2 (constants.%a.patt)] -// CHECK:STDOUT: %a.loc14_12.1: %C = symbolic_binding a, 0 [symbolic = %a.loc14_12.1 (constants.%a)] +// CHECK:STDOUT: generic class @Foo.loc10(%a.loc10_12.2: %C) { +// CHECK:STDOUT: %a.patt.loc10_12.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc10_12.2 (constants.%a.patt)] +// CHECK:STDOUT: %a.loc10_12.1: %C = symbolic_binding a, 0 [symbolic = %a.loc10_12.1 (constants.%a)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -455,9 +425,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: %a.loc6_12.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Foo.loc14(constants.%a) { -// CHECK:STDOUT: %a.patt.loc14_12.2 => constants.%a.patt -// CHECK:STDOUT: %a.loc14_12.1 => constants.%a +// CHECK:STDOUT: specific @Foo.loc10(constants.%a) { +// CHECK:STDOUT: %a.patt.loc10_12.2 => constants.%a.patt +// CHECK:STDOUT: %a.loc10_12.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_raw_identifier.carbon @@ -473,9 +443,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: %a: %C = symbolic_binding a, 0 [symbolic] // CHECK:STDOUT: %Foo.type.6e5839.1: type = parameterized_class_name_type @Foo.loc6 [concrete] // CHECK:STDOUT: %Foo.generic.08f655.1: %Foo.type.6e5839.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.6e5839.2: type = parameterized_class_name_type @Foo.loc14 [concrete] +// CHECK:STDOUT: %Foo.type.6e5839.2: type = parameterized_class_name_type @Foo.loc10 [concrete] // CHECK:STDOUT: %Foo.generic.08f655.2: %Foo.type.6e5839.2 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.755f1e.2: type = class_type @Foo.loc14, @Foo.loc14(%a) [symbolic] +// CHECK:STDOUT: %Foo.755f1e.2: type = class_type @Foo.loc10, @Foo.loc10(%a) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -493,14 +463,14 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: } // CHECK:STDOUT: %a.loc6_12.2: %C = symbolic_binding a, 0 [symbolic = %a.loc6_12.1 (constants.%a)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc14: %Foo.type.6e5839.2 = class_decl @Foo.loc14 [concrete = constants.%Foo.generic.08f655.2] { -// CHECK:STDOUT: %a.patt.loc14_12.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc14_12.2 (constants.%a.patt)] +// CHECK:STDOUT: %Foo.decl.loc10: %Foo.type.6e5839.2 = class_decl @Foo.loc10 [concrete = constants.%Foo.generic.08f655.2] { +// CHECK:STDOUT: %a.patt.loc10_12.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc10_12.2 (constants.%a.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc14: type = splice_block %C.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc10: type = splice_block %C.ref [concrete = constants.%C] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.loc14_12.2: %C = symbolic_binding a, 0 [symbolic = %a.loc14_12.1 (constants.%a)] +// CHECK:STDOUT: %a.loc10_12.2: %C = symbolic_binding a, 0 [symbolic = %a.loc10_12.1 (constants.%a)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -519,9 +489,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: class; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @Foo.loc14(%a.loc14_12.2: %C) { -// CHECK:STDOUT: %a.patt.loc14_12.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc14_12.2 (constants.%a.patt)] -// CHECK:STDOUT: %a.loc14_12.1: %C = symbolic_binding a, 0 [symbolic = %a.loc14_12.1 (constants.%a)] +// CHECK:STDOUT: generic class @Foo.loc10(%a.loc10_12.2: %C) { +// CHECK:STDOUT: %a.patt.loc10_12.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc10_12.2 (constants.%a.patt)] +// CHECK:STDOUT: %a.loc10_12.1: %C = symbolic_binding a, 0 [symbolic = %a.loc10_12.1 (constants.%a)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -539,9 +509,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: %a.loc6_12.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Foo.loc14(constants.%a) { -// CHECK:STDOUT: %a.patt.loc14_12.2 => constants.%a.patt -// CHECK:STDOUT: %a.loc14_12.1 => constants.%a +// CHECK:STDOUT: specific @Foo.loc10(constants.%a) { +// CHECK:STDOUT: %a.patt.loc10_12.2 => constants.%a.patt +// CHECK:STDOUT: %a.loc10_12.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- two_file.carbon @@ -742,9 +712,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: %Foo.generic.08f655.1: %Foo.type.6e5839.1 = struct_value () [concrete] // CHECK:STDOUT: %b.patt: %pattern_type = symbolic_binding_pattern b, 0 [symbolic] // CHECK:STDOUT: %b: %C = symbolic_binding b, 0 [symbolic] -// CHECK:STDOUT: %Foo.type.6e5839.2: type = parameterized_class_name_type @Foo.loc15 [concrete] +// CHECK:STDOUT: %Foo.type.6e5839.2: type = parameterized_class_name_type @Foo.loc11 [concrete] // CHECK:STDOUT: %Foo.generic.08f655.2: %Foo.type.6e5839.2 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.755f1e.2: type = class_type @Foo.loc15, @Foo.loc15(%b) [symbolic] +// CHECK:STDOUT: %Foo.755f1e.2: type = class_type @Foo.loc11, @Foo.loc11(%b) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -765,14 +735,14 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: } // CHECK:STDOUT: %a.loc7_12.2: %C = symbolic_binding a, 0 [symbolic = %a.loc7_12.1 (constants.%a)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc15: %Foo.type.6e5839.2 = class_decl @Foo.loc15 [concrete = constants.%Foo.generic.08f655.2] { -// CHECK:STDOUT: %b.patt.loc15_12.1: %pattern_type = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc15_12.2 (constants.%b.patt)] +// CHECK:STDOUT: %Foo.decl.loc11: %Foo.type.6e5839.2 = class_decl @Foo.loc11 [concrete = constants.%Foo.generic.08f655.2] { +// CHECK:STDOUT: %b.patt.loc11_12.1: %pattern_type = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc11_12.2 (constants.%b.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc15: type = splice_block %D.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc11: type = splice_block %D.ref [concrete = constants.%C] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D [concrete = constants.%C] // CHECK:STDOUT: } -// CHECK:STDOUT: %b.loc15_12.2: %C = symbolic_binding b, 0 [symbolic = %b.loc15_12.1 (constants.%b)] +// CHECK:STDOUT: %b.loc11_12.2: %C = symbolic_binding b, 0 [symbolic = %b.loc11_12.1 (constants.%b)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -791,9 +761,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: class; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @Foo.loc15(%b.loc15_12.2: %C) { -// CHECK:STDOUT: %b.patt.loc15_12.2: %pattern_type = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc15_12.2 (constants.%b.patt)] -// CHECK:STDOUT: %b.loc15_12.1: %C = symbolic_binding b, 0 [symbolic = %b.loc15_12.1 (constants.%b)] +// CHECK:STDOUT: generic class @Foo.loc11(%b.loc11_12.2: %C) { +// CHECK:STDOUT: %b.patt.loc11_12.2: %pattern_type = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc11_12.2 (constants.%b.patt)] +// CHECK:STDOUT: %b.loc11_12.1: %C = symbolic_binding b, 0 [symbolic = %b.loc11_12.1 (constants.%b)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -811,9 +781,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: %a.loc7_12.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Foo.loc15(constants.%b) { -// CHECK:STDOUT: %b.patt.loc15_12.2 => constants.%b.patt -// CHECK:STDOUT: %b.loc15_12.1 => constants.%b +// CHECK:STDOUT: specific @Foo.loc11(constants.%b) { +// CHECK:STDOUT: %b.patt.loc11_12.2 => constants.%b.patt +// CHECK:STDOUT: %b.loc11_12.1 => constants.%b // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_alias.carbon @@ -829,9 +799,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: %a: %C = symbolic_binding a, 0 [symbolic] // CHECK:STDOUT: %Foo.type.6e5839.1: type = parameterized_class_name_type @Foo.loc7 [concrete] // CHECK:STDOUT: %Foo.generic.08f655.1: %Foo.type.6e5839.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.6e5839.2: type = parameterized_class_name_type @Foo.loc15 [concrete] +// CHECK:STDOUT: %Foo.type.6e5839.2: type = parameterized_class_name_type @Foo.loc11 [concrete] // CHECK:STDOUT: %Foo.generic.08f655.2: %Foo.type.6e5839.2 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.755f1e.2: type = class_type @Foo.loc15, @Foo.loc15(%a) [symbolic] +// CHECK:STDOUT: %Foo.755f1e.2: type = class_type @Foo.loc11, @Foo.loc11(%a) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -852,14 +822,14 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: } // CHECK:STDOUT: %a.loc7_12.2: %C = symbolic_binding a, 0 [symbolic = %a.loc7_12.1 (constants.%a)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc15: %Foo.type.6e5839.2 = class_decl @Foo.loc15 [concrete = constants.%Foo.generic.08f655.2] { -// CHECK:STDOUT: %a.patt.loc15_12.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc15_12.2 (constants.%a.patt)] +// CHECK:STDOUT: %Foo.decl.loc11: %Foo.type.6e5839.2 = class_decl @Foo.loc11 [concrete = constants.%Foo.generic.08f655.2] { +// CHECK:STDOUT: %a.patt.loc11_12.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc11_12.2 (constants.%a.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc15: type = splice_block %D.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc11: type = splice_block %D.ref [concrete = constants.%C] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D [concrete = constants.%C] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.loc15_12.2: %C = symbolic_binding a, 0 [symbolic = %a.loc15_12.1 (constants.%a)] +// CHECK:STDOUT: %a.loc11_12.2: %C = symbolic_binding a, 0 [symbolic = %a.loc11_12.1 (constants.%a)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -878,9 +848,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: class; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @Foo.loc15(%a.loc15_12.2: %C) { -// CHECK:STDOUT: %a.patt.loc15_12.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc15_12.2 (constants.%a.patt)] -// CHECK:STDOUT: %a.loc15_12.1: %C = symbolic_binding a, 0 [symbolic = %a.loc15_12.1 (constants.%a)] +// CHECK:STDOUT: generic class @Foo.loc11(%a.loc11_12.2: %C) { +// CHECK:STDOUT: %a.patt.loc11_12.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc11_12.2 (constants.%a.patt)] +// CHECK:STDOUT: %a.loc11_12.1: %C = symbolic_binding a, 0 [symbolic = %a.loc11_12.1 (constants.%a)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -898,9 +868,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: %a.loc7_12.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Foo.loc15(constants.%a) { -// CHECK:STDOUT: %a.patt.loc15_12.2 => constants.%a.patt -// CHECK:STDOUT: %a.loc15_12.1 => constants.%a +// CHECK:STDOUT: specific @Foo.loc11(constants.%a) { +// CHECK:STDOUT: %a.patt.loc11_12.2 => constants.%a.patt +// CHECK:STDOUT: %a.loc11_12.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_deduced_alias.carbon @@ -916,9 +886,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: %a: %C = symbolic_binding a, 0 [symbolic] // CHECK:STDOUT: %Foo.type.6e5839.1: type = parameterized_class_name_type @Foo.loc7 [concrete] // CHECK:STDOUT: %Foo.generic.08f655.1: %Foo.type.6e5839.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.6e5839.2: type = parameterized_class_name_type @Foo.loc15 [concrete] +// CHECK:STDOUT: %Foo.type.6e5839.2: type = parameterized_class_name_type @Foo.loc11 [concrete] // CHECK:STDOUT: %Foo.generic.08f655.2: %Foo.type.6e5839.2 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.755f1e.2: type = class_type @Foo.loc15, @Foo.loc15(%a) [symbolic] +// CHECK:STDOUT: %Foo.755f1e.2: type = class_type @Foo.loc11, @Foo.loc11(%a) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -939,14 +909,14 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: } // CHECK:STDOUT: %a.loc7_12.2: %C = symbolic_binding a, 0 [symbolic = %a.loc7_12.1 (constants.%a)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc15: %Foo.type.6e5839.2 = class_decl @Foo.loc15 [concrete = constants.%Foo.generic.08f655.2] { -// CHECK:STDOUT: %a.patt.loc15_12.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc15_12.2 (constants.%a.patt)] +// CHECK:STDOUT: %Foo.decl.loc11: %Foo.type.6e5839.2 = class_decl @Foo.loc11 [concrete = constants.%Foo.generic.08f655.2] { +// CHECK:STDOUT: %a.patt.loc11_12.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc11_12.2 (constants.%a.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc15: type = splice_block %D.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc11: type = splice_block %D.ref [concrete = constants.%C] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D [concrete = constants.%C] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.loc15_12.2: %C = symbolic_binding a, 0 [symbolic = %a.loc15_12.1 (constants.%a)] +// CHECK:STDOUT: %a.loc11_12.2: %C = symbolic_binding a, 0 [symbolic = %a.loc11_12.1 (constants.%a)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -965,9 +935,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: class; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @Foo.loc15(%a.loc15_12.2: %C) { -// CHECK:STDOUT: %a.patt.loc15_12.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc15_12.2 (constants.%a.patt)] -// CHECK:STDOUT: %a.loc15_12.1: %C = symbolic_binding a, 0 [symbolic = %a.loc15_12.1 (constants.%a)] +// CHECK:STDOUT: generic class @Foo.loc11(%a.loc11_12.2: %C) { +// CHECK:STDOUT: %a.patt.loc11_12.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc11_12.2 (constants.%a.patt)] +// CHECK:STDOUT: %a.loc11_12.1: %C = symbolic_binding a, 0 [symbolic = %a.loc11_12.1 (constants.%a)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -985,9 +955,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: %a.loc7_12.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Foo.loc15(constants.%a) { -// CHECK:STDOUT: %a.patt.loc15_12.2 => constants.%a.patt -// CHECK:STDOUT: %a.loc15_12.1 => constants.%a +// CHECK:STDOUT: specific @Foo.loc11(constants.%a) { +// CHECK:STDOUT: %a.patt.loc11_12.2 => constants.%a.patt +// CHECK:STDOUT: %a.loc11_12.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- alias_two_file.carbon @@ -1127,9 +1097,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: %a: %const = symbolic_binding a, 0 [symbolic] // CHECK:STDOUT: %Foo.type.6e5839.1: type = parameterized_class_name_type @Foo.loc6 [concrete] // CHECK:STDOUT: %Foo.generic.08f655.1: %Foo.type.6e5839.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.6e5839.2: type = parameterized_class_name_type @Foo.loc18 [concrete] +// CHECK:STDOUT: %Foo.type.6e5839.2: type = parameterized_class_name_type @Foo.loc12 [concrete] // CHECK:STDOUT: %Foo.generic.08f655.2: %Foo.type.6e5839.2 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.16c1fe.2: type = class_type @Foo.loc18, @Foo.loc18(%a) [symbolic] +// CHECK:STDOUT: %Foo.16c1fe.2: type = class_type @Foo.loc12, @Foo.loc12(%a) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -1148,16 +1118,16 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: } // CHECK:STDOUT: %a.loc6_12.2: %const = symbolic_binding a, 0 [symbolic = %a.loc6_12.1 (constants.%a)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc18: %Foo.type.6e5839.2 = class_decl @Foo.loc18 [concrete = constants.%Foo.generic.08f655.2] { -// CHECK:STDOUT: %a.patt.loc18_12.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc18_12.2 (constants.%a.patt)] +// CHECK:STDOUT: %Foo.decl.loc12: %Foo.type.6e5839.2 = class_decl @Foo.loc12 [concrete = constants.%Foo.generic.08f655.2] { +// CHECK:STDOUT: %a.patt.loc12_12.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc12_12.2 (constants.%a.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc18: type = splice_block %const.loc18_14 [concrete = constants.%const] { +// CHECK:STDOUT: %.loc12: type = splice_block %const.loc12_14 [concrete = constants.%const] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %const.loc18_21: type = const_type %C.ref [concrete = constants.%const] -// CHECK:STDOUT: %const.loc18_14: type = const_type %const.loc18_21 [concrete = constants.%const] +// CHECK:STDOUT: %const.loc12_21: type = const_type %C.ref [concrete = constants.%const] +// CHECK:STDOUT: %const.loc12_14: type = const_type %const.loc12_21 [concrete = constants.%const] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.loc18_12.2: %const = symbolic_binding a, 0 [symbolic = %a.loc18_12.1 (constants.%a)] +// CHECK:STDOUT: %a.loc12_12.2: %const = symbolic_binding a, 0 [symbolic = %a.loc12_12.1 (constants.%a)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1176,9 +1146,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: class; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @Foo.loc18(%a.loc18_12.2: %const) { -// CHECK:STDOUT: %a.patt.loc18_12.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc18_12.2 (constants.%a.patt)] -// CHECK:STDOUT: %a.loc18_12.1: %const = symbolic_binding a, 0 [symbolic = %a.loc18_12.1 (constants.%a)] +// CHECK:STDOUT: generic class @Foo.loc12(%a.loc12_12.2: %const) { +// CHECK:STDOUT: %a.patt.loc12_12.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc12_12.2 (constants.%a.patt)] +// CHECK:STDOUT: %a.loc12_12.1: %const = symbolic_binding a, 0 [symbolic = %a.loc12_12.1 (constants.%a)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -1196,9 +1166,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: %a.loc6_12.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Foo.loc18(constants.%a) { -// CHECK:STDOUT: %a.patt.loc18_12.2 => constants.%a.patt -// CHECK:STDOUT: %a.loc18_12.1 => constants.%a +// CHECK:STDOUT: specific @Foo.loc12(constants.%a) { +// CHECK:STDOUT: %a.patt.loc12_12.2 => constants.%a.patt +// CHECK:STDOUT: %a.loc12_12.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_self_type.carbon @@ -1216,7 +1186,7 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: %Base.F.bd5be1.1: %Base.F.type.48cdab.1 = struct_value () [concrete] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %empty_tuple.type} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %struct_type.a [concrete] -// CHECK:STDOUT: %Base.F.type.48cdab.2: type = fn_type @Base.F.loc17 [concrete] +// CHECK:STDOUT: %Base.F.type.48cdab.2: type = fn_type @Base.F.loc13 [concrete] // CHECK:STDOUT: %Base.F.bd5be1.2: %Base.F.type.48cdab.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1225,7 +1195,7 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: .Base = %Base.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Base.decl: type = class_decl @Base [concrete = constants.%Base] {} {} -// CHECK:STDOUT: %Base.F.decl: %Base.F.type.48cdab.2 = fn_decl @Base.F.loc17 [concrete = constants.%Base.F.bd5be1.2] { +// CHECK:STDOUT: %Base.F.decl: %Base.F.type.48cdab.2 = fn_decl @Base.F.loc13 [concrete = constants.%Base.F.bd5be1.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.912 = ref_param_pattern [concrete = constants.%self.param_patt] // CHECK:STDOUT: %self.patt: %pattern_type.912 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt] // CHECK:STDOUT: } { @@ -1260,15 +1230,15 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Base.F.loc7(%self.param: ref %Base); // CHECK:STDOUT: -// CHECK:STDOUT: fn @Base.F.loc17(%self.param: ref %Base) { +// CHECK:STDOUT: fn @Base.F.loc13(%self.param: ref %Base) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %self.ref: ref %Base = name_ref self, %self // CHECK:STDOUT: %a.ref: %Base.elem = name_ref a, @Base.%field_decl [concrete = @Base.%field_decl] -// CHECK:STDOUT: %.loc18_7: ref %empty_tuple.type = class_element_access %self.ref, element0 -// CHECK:STDOUT: %.loc18_13.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc18_13.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc18_10: init %empty_tuple.type = converted %.loc18_13.1, %.loc18_13.2 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: assign %.loc18_7, %.loc18_10 +// CHECK:STDOUT: %.loc14_7: ref %empty_tuple.type = class_element_access %self.ref, element0 +// CHECK:STDOUT: %.loc14_13.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc14_13.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc14_10: init %empty_tuple.type = converted %.loc14_13.1, %.loc14_13.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: assign %.loc14_7, %.loc14_10 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/syntactic_merge_literal.carbon b/toolchain/check/testdata/class/syntactic_merge_literal.carbon index 50deab41b589..582ceaee1a6b 100644 --- a/toolchain/check/testdata/class/syntactic_merge_literal.carbon +++ b/toolchain/check/testdata/class/syntactic_merge_literal.carbon @@ -26,12 +26,8 @@ library "[[@TEST_NAME]]"; class C(a: i32) {} class D(b: C(1000)); -// CHECK:STDERR: fail_int_mismatch.carbon:[[@LINE+7]]:14: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: class D(b: C(1_000)) {} -// CHECK:STDERR: ^~~~~ -// CHECK:STDERR: fail_int_mismatch.carbon:[[@LINE-4]]:14: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] -// CHECK:STDERR: class D(b: C(1000)); -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_int_mismatch.carbon:[[@LINE+3]]:14-18: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] +// CHECK:STDERR: fail_int_mismatch.carbon:[[@LINE-2]]:14-17: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] // CHECK:STDERR: class D(b: C(1_000)) {} @@ -230,9 +226,9 @@ class D(b: C(1_000)) {} // CHECK:STDOUT: %b: %C.f79 = symbolic_binding b, 0 [symbolic] // CHECK:STDOUT: %D.type.0f59a4.1: type = parameterized_class_name_type @D.loc5 [concrete] // CHECK:STDOUT: %D.generic.f4a710.1: %D.type.0f59a4.1 = struct_value () [concrete] -// CHECK:STDOUT: %D.type.0f59a4.2: type = parameterized_class_name_type @D.loc13 [concrete] +// CHECK:STDOUT: %D.type.0f59a4.2: type = parameterized_class_name_type @D.loc9 [concrete] // CHECK:STDOUT: %D.generic.f4a710.2: %D.type.0f59a4.2 = struct_value () [concrete] -// CHECK:STDOUT: %D.690fbd.2: type = class_type @D.loc13, @D.loc13(%b) [symbolic] +// CHECK:STDOUT: %D.690fbd.2: type = class_type @D.loc9, @D.loc9(%b) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -282,23 +278,23 @@ class D(b: C(1_000)) {} // CHECK:STDOUT: } // CHECK:STDOUT: %b.loc5_10.2: %C.f79 = symbolic_binding b, 0 [symbolic = %b.loc5_10.1 (constants.%b)] // CHECK:STDOUT: } -// CHECK:STDOUT: %D.decl.loc13: %D.type.0f59a4.2 = class_decl @D.loc13 [concrete = constants.%D.generic.f4a710.2] { -// CHECK:STDOUT: %b.patt.loc13_10.1: %pattern_type.864 = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc13_10.2 (constants.%b.patt)] +// CHECK:STDOUT: %D.decl.loc9: %D.type.0f59a4.2 = class_decl @D.loc9 [concrete = constants.%D.generic.f4a710.2] { +// CHECK:STDOUT: %b.patt.loc9_10.1: %pattern_type.864 = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc9_10.2 (constants.%b.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc13_19.1: type = splice_block %C [concrete = constants.%C.f79] { +// CHECK:STDOUT: %.loc9_19.1: type = splice_block %C [concrete = constants.%C.f79] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [concrete = constants.%C.generic] // CHECK:STDOUT: %int_1000: Core.IntLiteral = int_value 1000 [concrete = constants.%int_1000.ff9] // CHECK:STDOUT: %impl.elem0: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc13_19.1: = bound_method %int_1000, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %bound_method.loc9_19.1: = bound_method %int_1000, %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.loc13_19.2: = bound_method %int_1000, %specific_fn [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc13_19.2(%int_1000) [concrete = constants.%int_1000.b23] -// CHECK:STDOUT: %.loc13_19.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_1000.b23] -// CHECK:STDOUT: %.loc13_19.3: %i32 = converted %int_1000, %.loc13_19.2 [concrete = constants.%int_1000.b23] +// CHECK:STDOUT: %bound_method.loc9_19.2: = bound_method %int_1000, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc9_19.2(%int_1000) [concrete = constants.%int_1000.b23] +// CHECK:STDOUT: %.loc9_19.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_1000.b23] +// CHECK:STDOUT: %.loc9_19.3: %i32 = converted %int_1000, %.loc9_19.2 [concrete = constants.%int_1000.b23] // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%int_1000.b23) [concrete = constants.%C.f79] // CHECK:STDOUT: } -// CHECK:STDOUT: %b.loc13_10.2: %C.f79 = symbolic_binding b, 0 [symbolic = %b.loc13_10.1 (constants.%b)] +// CHECK:STDOUT: %b.loc9_10.2: %C.f79 = symbolic_binding b, 0 [symbolic = %b.loc9_10.1 (constants.%b)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -324,9 +320,9 @@ class D(b: C(1_000)) {} // CHECK:STDOUT: class; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @D.loc13(%b.loc13_10.2: %C.f79) { -// CHECK:STDOUT: %b.patt.loc13_10.2: %pattern_type.864 = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc13_10.2 (constants.%b.patt)] -// CHECK:STDOUT: %b.loc13_10.1: %C.f79 = symbolic_binding b, 0 [symbolic = %b.loc13_10.1 (constants.%b)] +// CHECK:STDOUT: generic class @D.loc9(%b.loc9_10.2: %C.f79) { +// CHECK:STDOUT: %b.patt.loc9_10.2: %pattern_type.864 = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc9_10.2 (constants.%b.patt)] +// CHECK:STDOUT: %b.loc9_10.1: %C.f79 = symbolic_binding b, 0 [symbolic = %b.loc9_10.1 (constants.%b)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -354,8 +350,8 @@ class D(b: C(1_000)) {} // CHECK:STDOUT: %b.loc5_10.1 => constants.%b // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @D.loc13(constants.%b) { -// CHECK:STDOUT: %b.patt.loc13_10.2 => constants.%b.patt -// CHECK:STDOUT: %b.loc13_10.1 => constants.%b +// CHECK:STDOUT: specific @D.loc9(constants.%b) { +// CHECK:STDOUT: %b.patt.loc9_10.2 => constants.%b.patt +// CHECK:STDOUT: %b.loc9_10.1 => constants.%b // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/const/access.carbon b/toolchain/check/testdata/const/access.carbon index 88479fd34b90..7e70813f5417 100644 --- a/toolchain/check/testdata/const/access.carbon +++ b/toolchain/check/testdata/const/access.carbon @@ -29,9 +29,7 @@ class C { } fn F(c: const C) { - // CHECK:STDERR: fail_const_member_assign.carbon:[[@LINE+4]]:3: error: expression is not assignable [AssignmentToNonAssignable] - // CHECK:STDERR: c.x = (); - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_const_member_assign.carbon:[[@LINE+2]]:3-5: error: expression is not assignable [AssignmentToNonAssignable] // CHECK:STDERR: c.x = (); } @@ -44,9 +42,7 @@ class C { } fn F(ref c: const C) { - // CHECK:STDERR: fail_const_ref_member_assign.carbon:[[@LINE+4]]:3: error: expression is not assignable [AssignmentToNonAssignable] - // CHECK:STDERR: c.x = (); - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_const_ref_member_assign.carbon:[[@LINE+2]]:3-5: error: expression is not assignable [AssignmentToNonAssignable] // CHECK:STDERR: c.x = (); } diff --git a/toolchain/check/testdata/const/basics.carbon b/toolchain/check/testdata/const/basics.carbon index 3c0cb45da3c2..e27954acd92e 100644 --- a/toolchain/check/testdata/const/basics.carbon +++ b/toolchain/check/testdata/const/basics.carbon @@ -32,9 +32,7 @@ class C; // OK, `const (const C)` is the same type as `const C`. //@dump-sem-ir-begin -// CHECK:STDERR: collapse.carbon:[[@LINE+4]]:23: warning: `const` applied repeatedly to the same type has no additional effect [RepeatedConst] -// CHECK:STDERR: fn F(p: const C**) -> const (const C)** { -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: collapse.carbon:[[@LINE+2]]:23-37: warning: `const` applied repeatedly to the same type has no additional effect [RepeatedConst] // CHECK:STDERR: fn F(p: const C**) -> const (const C)** { return p; @@ -46,17 +44,11 @@ library "[[@TEST_NAME]]"; class C; -// CHECK:STDERR: fail_collapse_in_error.carbon:[[@LINE+4]]:9: warning: `const` applied repeatedly to the same type has no additional effect [RepeatedConst] -// CHECK:STDERR: fn G(p: const (const C)**) -> C** { -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_collapse_in_error.carbon:[[@LINE+2]]:9-23: warning: `const` applied repeatedly to the same type has no additional effect [RepeatedConst] // CHECK:STDERR: 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**)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return p; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_collapse_in_error.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `const C**` to `C**` [ConversionFailure] + // CHECK:STDERR: fail_collapse_in_error.carbon:[[@LINE+2]]:3-11: note: type `const C**` does not implement interface `Core.ImplicitAs(C**)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; } @@ -114,15 +106,9 @@ class X { } 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: p->(X.TakeSelf)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_remove_while_forming_reference.carbon:[[@LINE-10]]:15: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn TakeSelf(ref self); - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_remove_while_forming_reference.carbon:[[@LINE+4]]:3-17: error: cannot implicitly convert expression of type `const X` to `X` [ConversionFailure] + // CHECK:STDERR: fail_remove_while_forming_reference.carbon:[[@LINE+3]]:3-17: note: type `const X` does not implement interface `Core.ImplicitAs(X)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: fail_remove_while_forming_reference.carbon:[[@LINE-6]]:15-22: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: p->(X.TakeSelf)(); } @@ -137,33 +123,21 @@ interface J {} // type. The operand of `const` is parenthesized if it's a facet type formed // with `&` or `where`. fn F() -> const (I & J); -// CHECK:STDERR: fail_print_const_facet_type.carbon:[[@LINE+7]]:1: error: function redeclaration differs because return type is `{}` [FunctionRedeclReturnTypeDiffers] -// CHECK:STDERR: fn F() -> {}; -// CHECK:STDERR: ^~~~~~~~~~~~~ -// CHECK:STDERR: fail_print_const_facet_type.carbon:[[@LINE-4]]:1: note: previously declared with return type `const (I & J)` [FunctionRedeclReturnTypePrevious] -// CHECK:STDERR: fn F() -> const (I & J); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_print_const_facet_type.carbon:[[@LINE+3]]:1-13: error: function redeclaration differs because return type is `{}` [FunctionRedeclReturnTypeDiffers] +// CHECK:STDERR: fail_print_const_facet_type.carbon:[[@LINE-2]]:1-24: note: previously declared with return type `const (I & J)` [FunctionRedeclReturnTypePrevious] // CHECK:STDERR: fn F() -> {}; fn G() -> const (I where .T = ()); -// CHECK:STDERR: fail_print_const_facet_type.carbon:[[@LINE+7]]:1: error: function redeclaration differs because return type is `{}` [FunctionRedeclReturnTypeDiffers] -// CHECK:STDERR: fn G() -> {}; -// CHECK:STDERR: ^~~~~~~~~~~~~ -// CHECK:STDERR: fail_print_const_facet_type.carbon:[[@LINE-4]]:1: note: previously declared with return type `const (I where .(I.T) = ())` [FunctionRedeclReturnTypePrevious] -// CHECK:STDERR: fn G() -> const (I where .T = ()); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_print_const_facet_type.carbon:[[@LINE+3]]:1-13: error: function redeclaration differs because return type is `{}` [FunctionRedeclReturnTypeDiffers] +// CHECK:STDERR: fail_print_const_facet_type.carbon:[[@LINE-2]]:1-34: note: previously declared with return type `const (I where .(I.T) = ())` [FunctionRedeclReturnTypePrevious] // CHECK:STDERR: fn G() -> {}; // No parentheses are needed for a single interface. fn H() -> const I; -// CHECK:STDERR: fail_print_const_facet_type.carbon:[[@LINE+7]]:1: error: function redeclaration differs because return type is `{}` [FunctionRedeclReturnTypeDiffers] -// CHECK:STDERR: fn H() -> {}; -// CHECK:STDERR: ^~~~~~~~~~~~~ -// CHECK:STDERR: fail_print_const_facet_type.carbon:[[@LINE-4]]:1: note: previously declared with return type `const I` [FunctionRedeclReturnTypePrevious] -// CHECK:STDERR: fn H() -> const I; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_print_const_facet_type.carbon:[[@LINE+3]]:1-13: error: function redeclaration differs because return type is `{}` [FunctionRedeclReturnTypeDiffers] +// CHECK:STDERR: fail_print_const_facet_type.carbon:[[@LINE-2]]:1-18: note: previously declared with return type `const I` [FunctionRedeclReturnTypePrevious] // CHECK:STDERR: fn H() -> {}; @@ -335,20 +309,20 @@ fn H() -> {}; // CHECK:STDOUT: %p.param_patt: %pattern_type.803 = value_param_pattern [concrete = constants.%p.param_patt] // CHECK:STDOUT: %p.patt: %pattern_type.803 = wrapper_binding_pattern p, %p.param_patt [concrete = constants.%p.patt] // CHECK:STDOUT: %return.param_patt: %pattern_type.803 = out_param_pattern [concrete = constants.%return.param_patt.934] -// CHECK:STDOUT: %return.patt: %pattern_type.803 = return_slot_pattern %return.param_patt, %ptr.loc11_39 [concrete = constants.%return.patt.895] +// CHECK:STDOUT: %return.patt: %pattern_type.803 = return_slot_pattern %return.param_patt, %ptr.loc9_39 [concrete = constants.%return.patt.895] // CHECK:STDOUT: } { -// CHECK:STDOUT: %C.ref.loc11_36: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %const.loc11_30: type = const_type %C.ref.loc11_36 [concrete = constants.%const.13f] -// CHECK:STDOUT: %const.loc11_23: type = const_type %const.loc11_30 [concrete = constants.%const.13f] -// CHECK:STDOUT: %ptr.loc11_38: type = ptr_type %const.loc11_23 [concrete = constants.%ptr.77f] -// CHECK:STDOUT: %ptr.loc11_39: type = ptr_type %ptr.loc11_38 [concrete = constants.%ptr.0c8] -// CHECK:STDOUT: %.loc11_39: Core.Form = init_form %ptr.loc11_39 [concrete = constants.%.5f5] +// CHECK:STDOUT: %C.ref.loc9_36: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %const.loc9_30: type = const_type %C.ref.loc9_36 [concrete = constants.%const.13f] +// CHECK:STDOUT: %const.loc9_23: type = const_type %const.loc9_30 [concrete = constants.%const.13f] +// CHECK:STDOUT: %ptr.loc9_38: type = ptr_type %const.loc9_23 [concrete = constants.%ptr.77f] +// CHECK:STDOUT: %ptr.loc9_39: type = ptr_type %ptr.loc9_38 [concrete = constants.%ptr.0c8] +// CHECK:STDOUT: %.loc9_39: Core.Form = init_form %ptr.loc9_39 [concrete = constants.%.5f5] // CHECK:STDOUT: %p.param: %ptr.0c8 = value_param call_param0 -// CHECK:STDOUT: %.loc11_17: type = splice_block %ptr.loc11_17 [concrete = constants.%ptr.0c8] { -// CHECK:STDOUT: %C.ref.loc11_15: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %const.loc11_9: type = const_type %C.ref.loc11_15 [concrete = constants.%const.13f] -// CHECK:STDOUT: %ptr.loc11_16: type = ptr_type %const.loc11_9 [concrete = constants.%ptr.77f] -// CHECK:STDOUT: %ptr.loc11_17: type = ptr_type %ptr.loc11_16 [concrete = constants.%ptr.0c8] +// CHECK:STDOUT: %.loc9_17: type = splice_block %ptr.loc9_17 [concrete = constants.%ptr.0c8] { +// CHECK:STDOUT: %C.ref.loc9_15: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %const.loc9_9: type = const_type %C.ref.loc9_15 [concrete = constants.%const.13f] +// CHECK:STDOUT: %ptr.loc9_16: type = ptr_type %const.loc9_9 [concrete = constants.%ptr.77f] +// CHECK:STDOUT: %ptr.loc9_17: type = ptr_type %ptr.loc9_16 [concrete = constants.%ptr.0c8] // CHECK:STDOUT: } // CHECK:STDOUT: %p: %ptr.0c8 = wrapper_binding p, %p.param // CHECK:STDOUT: %return.param: ref %ptr.0c8 = out_param call_param1 @@ -360,10 +334,10 @@ fn H() -> {}; // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: %ptr.0c8 = name_ref p, %p // CHECK:STDOUT: %impl.elem0: %.a9c = impl_witness_access constants.%Copy.impl_witness.9f0, element0 [concrete = constants.%ptr.as.Copy.impl.Op.e7f] -// CHECK:STDOUT: %bound_method.loc12_10.1: = bound_method %p.ref, %impl.elem0 +// CHECK:STDOUT: %bound_method.loc10_10.1: = bound_method %p.ref, %impl.elem0 // CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @ptr.as.Copy.impl.Op(constants.%ptr.77f) [concrete = constants.%ptr.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc12_10.2: = bound_method %p.ref, %specific_fn -// CHECK:STDOUT: %ptr.as.Copy.impl.Op.call: init %ptr.0c8 = call %bound_method.loc12_10.2(%p.ref) +// CHECK:STDOUT: %bound_method.loc10_10.2: = bound_method %p.ref, %specific_fn +// CHECK:STDOUT: %ptr.as.Copy.impl.Op.call: init %ptr.0c8 = call %bound_method.loc10_10.2(%p.ref) // CHECK:STDOUT: return %ptr.as.Copy.impl.Op.call // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/deduce/array.carbon b/toolchain/check/testdata/deduce/array.carbon index 1dc7a23dbe6e..414597affeb7 100644 --- a/toolchain/check/testdata/deduce/array.carbon +++ b/toolchain/check/testdata/deduce/array.carbon @@ -62,15 +62,9 @@ fn F[T: type](a: array(T, 2)) -> T { return F(a); } fn G() -> C { // TODO: We succeed at deducing T here but fail to convert. Is this the right behavior? var a: array(C, 3) = ({}, {}, {}); - // 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))` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return F(a); - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_bound_mismatch.carbon:[[@LINE-11]]:15: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn F[T: type](a: array(T, 2)) -> T { return F(a); } - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_bound_mismatch.carbon:[[@LINE+4]]:12: error: cannot implicitly convert expression of type `array(C, 3)` to `array(C, 2)` [ConversionFailure] + // CHECK:STDERR: fail_bound_mismatch.carbon:[[@LINE+3]]:12: note: type `array(C, 3)` does not implement interface `Core.ImplicitAs(array(C, 2))` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: fail_bound_mismatch.carbon:[[@LINE-7]]:15-28: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: return F(a); } @@ -87,15 +81,9 @@ fn F[N: Core.IntLiteral](unused a: array(C, N)) -> i32 { return N; } fn G() -> i32 { // TODO: We succeed at deducing N here but fail to convert. Is this the right behavior? var a: array(D, 3) = ({}, {}, {}); - // 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))` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return F(a); - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE-11]]:33: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn F[N: Core.IntLiteral](unused a: array(C, N)) -> i32 { return N; } - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+4]]:12: error: cannot implicitly convert expression of type `array(D, 3)` to `array(C, 3)` [ConversionFailure] + // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+3]]:12: note: type `array(D, 3)` does not implement interface `Core.ImplicitAs(array(C, 3))` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE-7]]:33-46: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: return F(a); } @@ -115,12 +103,8 @@ fn G() -> i32 { // which we can't deduce through. We should decide if we want to support // deductions of that form. If not, it'd be nice to diagnose this situation // better. - // CHECK:STDERR: fail_bound_type_mismatch.carbon:[[@LINE+7]]:10: error: cannot deduce value for generic parameter `N` [DeductionIncomplete] - // CHECK:STDERR: return F(a); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_bound_type_mismatch.carbon:[[@LINE-12]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn F[N: i32](unused a: array(C, N)) -> i32 { return N; } - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_bound_type_mismatch.carbon:[[@LINE+3]]:10-13: error: cannot deduce value for generic parameter `N` [DeductionIncomplete] + // CHECK:STDERR: fail_bound_type_mismatch.carbon:[[@LINE-10]]:1-44: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: return F(a); } @@ -135,12 +119,8 @@ fn F[N: i32](unused a: array(C, N)) {} fn G() { // TODO: Deduce N as 3 from the tuple's size. // - // CHECK:STDERR: fail_todo_array_length_from_tuple.carbon:[[@LINE+7]]:3: error: cannot deduce value for generic parameter `N` [DeductionIncomplete] - // CHECK:STDERR: F(({}, {}, {})); - // CHECK:STDERR: ^~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_array_length_from_tuple.carbon:[[@LINE-8]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn F[N: i32](unused a: array(C, N)) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_array_length_from_tuple.carbon:[[@LINE+3]]:3-17: error: cannot deduce value for generic parameter `N` [DeductionIncomplete] + // CHECK:STDERR: fail_todo_array_length_from_tuple.carbon:[[@LINE-6]]:1-37: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: F(({}, {}, {})); } @@ -1395,7 +1375,7 @@ fn G() { // CHECK:STDOUT: %a.ref: ref %Array.96f = name_ref a, %a // CHECK:STDOUT: %F.specific_fn: = specific_function %F.ref, @F(constants.%C) [concrete = constants.%F.specific_fn.c73] // CHECK:STDOUT: %.loc8_11.1: ref %C = splice_block %return.param {} -// CHECK:STDOUT: %.loc21: %Array.ee7 = converted %a.ref, [concrete = ] +// CHECK:STDOUT: %.loc15: %Array.ee7 = converted %a.ref, [concrete = ] // CHECK:STDOUT: %F.call: init %C to %.loc8_11.1 = call %F.specific_fn() // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %a.var, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.3 // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%a.var) @@ -1771,7 +1751,7 @@ fn G() { // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] // CHECK:STDOUT: %a.ref: ref %Array.f94 = name_ref a, %a // CHECK:STDOUT: %F.specific_fn: = specific_function %F.ref, @F(constants.%int_3.1ba) [concrete = constants.%F.specific_fn] -// CHECK:STDOUT: %.loc22: %Array.96f = converted %a.ref, [concrete = ] +// CHECK:STDOUT: %.loc16: %Array.96f = converted %a.ref, [concrete = ] // CHECK:STDOUT: %F.call: init %i32 = call %F.specific_fn() // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %a.var, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.3 // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%a.var) @@ -2331,10 +2311,10 @@ fn G() { // CHECK:STDOUT: fn @G() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] -// CHECK:STDOUT: %.loc17_7: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc17_11: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc17_15: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc17_16: %tuple.type = tuple_literal (%.loc17_7, %.loc17_11, %.loc17_15) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc13_7: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc13_11: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc13_15: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc13_16: %tuple.type = tuple_literal (%.loc13_7, %.loc13_11, %.loc13_15) [concrete = constants.%tuple] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/deduce/binding_pattern.carbon b/toolchain/check/testdata/deduce/binding_pattern.carbon index b0cf9a17a3bf..9bf712bb7e18 100644 --- a/toolchain/check/testdata/deduce/binding_pattern.carbon +++ b/toolchain/check/testdata/deduce/binding_pattern.carbon @@ -19,15 +19,9 @@ class C(T: type) { } fn F(unused generic U: type, generic 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: C(V).Create({}); - // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_incompatible_deduce.carbon:[[@LINE-10]]:20: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn Create(unused value: T) {} - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_incompatible_deduce.carbon:[[@LINE+4]]:15-16: error: cannot implicitly convert expression of type `{}` to `V` [ConversionFailure] + // CHECK:STDERR: fail_incompatible_deduce.carbon:[[@LINE+3]]:15-16: note: type `{}` does not implement interface `Core.ImplicitAs(V)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: fail_incompatible_deduce.carbon:[[@LINE-6]]:20-27: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: C(V).Create({}); } @@ -51,9 +45,7 @@ library "[[@TEST_NAME]]"; class A {}; -// CHECK:STDERR: fail_invalid_type.carbon:[[@LINE+4]]:9: error: name `DoesNotExist` not found [NameNotFound] -// CHECK:STDERR: fn F[T: DoesNotExist](unused x: T) {} -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_invalid_type.carbon:[[@LINE+2]]:9-20: error: name `DoesNotExist` not found [NameNotFound] // CHECK:STDERR: fn F[T: DoesNotExist](unused x: T) {} diff --git a/toolchain/check/testdata/deduce/symbolic_facets.carbon b/toolchain/check/testdata/deduce/symbolic_facets.carbon index 278bc12cd55e..7cc1be5ec779 100644 --- a/toolchain/check/testdata/deduce/symbolic_facets.carbon +++ b/toolchain/check/testdata/deduce/symbolic_facets.carbon @@ -29,12 +29,8 @@ class D(DD: type) { // T only implements D(DD).B, so should not convert to a facet value // implementing C(()).A. // - // CHECK:STDERR: fail_missing_interface.carbon:[[@LINE+7]]:5: error: cannot convert type `T` that implements `B` into type implementing `A` [ConversionFailureFacetToFacet] - // CHECK:STDERR: C(()).F(T); - // CHECK:STDERR: ^~~~~~~~~~ - // CHECK:STDERR: fail_missing_interface.carbon:[[@LINE-12]]:3: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn F(unused generic T: A) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_missing_interface.carbon:[[@LINE+3]]:5-14: error: cannot convert type `T` that implements `B` into type implementing `A` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_missing_interface.carbon:[[@LINE-10]]:3-29: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: C(()).F(T); } @@ -54,12 +50,8 @@ class D(DD: type) { // T implements C({}).A and D(DD).B, so should not convert to a facet value // implementing C(()).A. // - // CHECK:STDERR: fail_interface_wrong_generic_param.carbon:[[@LINE+7]]:5: error: cannot convert type `T` that implements `A & B` into type implementing `A` [ConversionFailureFacetToFacet] - // CHECK:STDERR: C(()).F(T); - // CHECK:STDERR: ^~~~~~~~~~ - // CHECK:STDERR: fail_interface_wrong_generic_param.carbon:[[@LINE-12]]:3: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn F(unused generic T: A) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_interface_wrong_generic_param.carbon:[[@LINE+3]]:5-14: error: cannot convert type `T` that implements `A & B` into type implementing `A` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_interface_wrong_generic_param.carbon:[[@LINE-10]]:3-29: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: C(()).F(T); } diff --git a/toolchain/check/testdata/deduce/tuple.carbon b/toolchain/check/testdata/deduce/tuple.carbon index 60a228fb0a9a..9e6dfa3849a4 100644 --- a/toolchain/check/testdata/deduce/tuple.carbon +++ b/toolchain/check/testdata/deduce/tuple.carbon @@ -47,12 +47,8 @@ class D {} fn F[T: type](pair: (T, T)) -> T; fn G(pair: (C, D)) -> D { - // CHECK:STDERR: fail_inconsistent.carbon:[[@LINE+7]]:10: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent] - // CHECK:STDERR: return F(pair); - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_inconsistent.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn F[T: type](pair: (T, T)) -> T; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_inconsistent.carbon:[[@LINE+3]]:10-16: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent] + // CHECK:STDERR: fail_inconsistent.carbon:[[@LINE-4]]:1-33: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: return F(pair); } diff --git a/toolchain/check/testdata/deduce/type_operator.carbon b/toolchain/check/testdata/deduce/type_operator.carbon index a79c0f6337a8..ce32657073d2 100644 --- a/toolchain/check/testdata/deduce/type_operator.carbon +++ b/toolchain/check/testdata/deduce/type_operator.carbon @@ -57,12 +57,8 @@ class C {} fn F[T: type](p: const T*) -> T { return F(p); } fn G(p: C*) -> const C { - // CHECK:STDERR: fail_const_from_nonconst.carbon:[[@LINE+7]]:10: error: cannot deduce value for generic parameter `T` [DeductionIncomplete] - // CHECK:STDERR: return F(p); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_const_from_nonconst.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn F[T: type](p: const T*) -> T { return F(p); } - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_const_from_nonconst.carbon:[[@LINE+3]]:10-13: error: cannot deduce value for generic parameter `T` [DeductionIncomplete] + // CHECK:STDERR: fail_const_from_nonconst.carbon:[[@LINE-4]]:1-33: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: return F(p); } diff --git a/toolchain/check/testdata/deduce/value_with_type_through_access.carbon b/toolchain/check/testdata/deduce/value_with_type_through_access.carbon index 93a591ddfe8e..1caac9fd9fa3 100644 --- a/toolchain/check/testdata/deduce/value_with_type_through_access.carbon +++ b/toolchain/check/testdata/deduce/value_with_type_through_access.carbon @@ -61,9 +61,7 @@ class HoldsType(T: Class) {} // should be able to eval to a type. We would expect the `.` in `T.t` to be a // ClassElementAccess but it is an AcquireValue, which has a runtime value. // -// CHECK:STDERR: fail_todo_class_access.carbon:[[@LINE+4]]:50: error: cannot evaluate type expression [TypeExprEvaluationFailure] -// CHECK:STDERR: fn F[T: Class](unused x: HoldsType(T), unused a: T.t) {} -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_todo_class_access.carbon:[[@LINE+2]]:50-52: error: cannot evaluate type expression [TypeExprEvaluationFailure] // CHECK:STDERR: fn F[T: Class](unused x: HoldsType(T), unused a: T.t) {} @@ -85,9 +83,7 @@ class HoldsType(T: array(type, 1)) {} // `a` is received as a value, and has a type that requires going through // ArrayIndex. Building the value representation must handle this indirection. -// CHECK:STDERR: fail_todo_array_index.carbon:[[@LINE+4]]:59: error: cannot evaluate type expression [TypeExprEvaluationFailure] -// CHECK:STDERR: fn F[T: array(type, 1)](unused x: HoldsType(T), unused a: T[0]) {} -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_todo_array_index.carbon:[[@LINE+2]]:59-62: error: cannot evaluate type expression [TypeExprEvaluationFailure] // CHECK:STDERR: fn F[T: array(type, 1)](unused x: HoldsType(T), unused a: T[0]) {} @@ -806,26 +802,26 @@ fn G() { // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] // CHECK:STDOUT: %self.param_patt.11c: %pattern_type.9a5 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.11d: %pattern_type.9a5 = wrapper_binding_pattern self, %self.param_patt.11c [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc30_13.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc28_13.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc30_13.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc28_13.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.1: %Destroy.WithSelf.Op.type.ef016f.1 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1: type = fn_type @Destroy.WithSelf.SelfDestruct.loc30_13.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1: type = fn_type @Destroy.WithSelf.SelfDestruct.loc28_13.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.1: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1 = struct_value () [concrete] // CHECK:STDOUT: %pattern_type.136: type = pattern_type %struct_type.t [concrete] // CHECK:STDOUT: %self.param_patt.0c8: %pattern_type.136 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.a0c: %pattern_type.136 = wrapper_binding_pattern self, %self.param_patt.0c8 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc30_13.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc28_13.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc30_13.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc28_13.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.2: %Destroy.WithSelf.Op.type.ef016f.2 = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.b2b: %pattern_type.f15 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.f19: %pattern_type.f15 = wrapper_binding_pattern self, %self.param_patt.b2b [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc30_13.3 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc28_13.3 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc30_13.3 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc28_13.3 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.3: %Destroy.WithSelf.Op.type.ef016f.3 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.3: type = fn_type @Destroy.WithSelf.SelfDestruct.loc30_13.3 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.3: type = fn_type @Destroy.WithSelf.SelfDestruct.loc28_13.3 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.3: %Destroy.WithSelf.SelfDestruct.type.fbceb5.3 = struct_value () [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.0de, %Destroy.WithSelf.SelfDestruct.db3fdb.3 [concrete] // CHECK:STDOUT: %HoldsType.ddc: type = class_type @HoldsType, @HoldsType(%Class.val) [concrete] @@ -846,42 +842,42 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc30_13.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc28_13.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.9a5 = ref_param_pattern [concrete = constants.%self.param_patt.11c] // CHECK:STDOUT: %self.patt: %pattern_type.9a5 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.11d] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref type = ref_param call_param0 // CHECK:STDOUT: %self: ref type = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc30_13.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc28_13.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.9a5 = ref_param_pattern [concrete = constants.%self.param_patt.11c] // CHECK:STDOUT: %self.patt: %pattern_type.9a5 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.11d] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref type = ref_param call_param0 // CHECK:STDOUT: %self: ref type = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc30_13.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc28_13.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.136 = ref_param_pattern [concrete = constants.%self.param_patt.0c8] // CHECK:STDOUT: %self.patt: %pattern_type.136 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.a0c] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %struct_type.t = ref_param call_param0 // CHECK:STDOUT: %self: ref %struct_type.t = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc30_13.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc28_13.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.136 = ref_param_pattern [concrete = constants.%self.param_patt.0c8] // CHECK:STDOUT: %self.patt: %pattern_type.136 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.a0c] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %struct_type.t = ref_param call_param0 // CHECK:STDOUT: %self: ref %struct_type.t = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc30_13.3 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.3] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc28_13.3 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.3] { // CHECK:STDOUT: %self.param_patt: %pattern_type.f15 = ref_param_pattern [concrete = constants.%self.param_patt.b2b] // CHECK:STDOUT: %self.patt: %pattern_type.f15 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.f19] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %Class = ref_param call_param0 // CHECK:STDOUT: %self: ref %Class = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.3: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc30_13.3 [concrete = constants.%Destroy.WithSelf.Op.403171.3] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.3: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc28_13.3 [concrete = constants.%Destroy.WithSelf.Op.403171.3] { // CHECK:STDOUT: %self.param_patt: %pattern_type.f15 = ref_param_pattern [concrete = constants.%self.param_patt.b2b] // CHECK:STDOUT: %self.patt: %pattern_type.f15 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.f19] // CHECK:STDOUT: } { @@ -912,42 +908,42 @@ fn G() { // CHECK:STDOUT: %T.loc8_18.2: %Class = symbolic_binding T, 0 [symbolic = %T.loc8_18.1 (constants.%T.f25)] // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { -// CHECK:STDOUT: %T.patt.loc21_7.1: %pattern_type.f15 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc21_7.2 (constants.%T.patt.125)] -// CHECK:STDOUT: %x.param_patt.loc21_24.1: @F.%pattern_type (%pattern_type.d63) = value_param_pattern [symbolic = %x.param_patt.loc21_24.2 (constants.%x.param_patt)] -// CHECK:STDOUT: %x.patt.loc21_24.1: @F.%pattern_type (%pattern_type.d63) = wrapper_binding_pattern x, %x.param_patt.loc21_24.1 [symbolic = %x.patt.loc21_24.2 (constants.%x.patt)] +// CHECK:STDOUT: %T.patt.loc19_7.1: %pattern_type.f15 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc19_7.2 (constants.%T.patt.125)] +// CHECK:STDOUT: %x.param_patt.loc19_24.1: @F.%pattern_type (%pattern_type.d63) = value_param_pattern [symbolic = %x.param_patt.loc19_24.2 (constants.%x.param_patt)] +// CHECK:STDOUT: %x.patt.loc19_24.1: @F.%pattern_type (%pattern_type.d63) = wrapper_binding_pattern x, %x.param_patt.loc19_24.1 [symbolic = %x.patt.loc19_24.2 (constants.%x.patt)] // CHECK:STDOUT: %a.param_patt: = value_param_pattern [concrete = ] // CHECK:STDOUT: %a.patt: = wrapper_binding_pattern a, %a.param_patt [concrete = ] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc21_9: type = splice_block %Class.ref [concrete = constants.%Class] { +// CHECK:STDOUT: %.loc19_9: type = splice_block %Class.ref [concrete = constants.%Class] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [concrete = constants.%Class] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc21_7.2: %Class = symbolic_binding T, 0 [symbolic = %T.loc21_7.1 (constants.%T.f25)] -// CHECK:STDOUT: %x.param: @F.%HoldsType.loc21_37.1 (%HoldsType.ef239b.1) = value_param call_param0 -// CHECK:STDOUT: %.loc21_37: type = splice_block %HoldsType.loc21_37.2 [symbolic = %HoldsType.loc21_37.1 (constants.%HoldsType.ef239b.1)] { +// CHECK:STDOUT: %T.loc19_7.2: %Class = symbolic_binding T, 0 [symbolic = %T.loc19_7.1 (constants.%T.f25)] +// CHECK:STDOUT: %x.param: @F.%HoldsType.loc19_37.1 (%HoldsType.ef239b.1) = value_param call_param0 +// CHECK:STDOUT: %.loc19_37: type = splice_block %HoldsType.loc19_37.2 [symbolic = %HoldsType.loc19_37.1 (constants.%HoldsType.ef239b.1)] { // CHECK:STDOUT: %HoldsType.ref: %HoldsType.type = name_ref HoldsType, file.%HoldsType.decl [concrete = constants.%HoldsType.generic] -// CHECK:STDOUT: %T.ref.loc21_36: %Class = name_ref T, %T.loc21_7.2 [symbolic = %T.loc21_7.1 (constants.%T.f25)] -// CHECK:STDOUT: %HoldsType.loc21_37.2: type = class_type @HoldsType, @HoldsType(constants.%T.f25) [symbolic = %HoldsType.loc21_37.1 (constants.%HoldsType.ef239b.1)] +// CHECK:STDOUT: %T.ref.loc19_36: %Class = name_ref T, %T.loc19_7.2 [symbolic = %T.loc19_7.1 (constants.%T.f25)] +// CHECK:STDOUT: %HoldsType.loc19_37.2: type = class_type @HoldsType, @HoldsType(constants.%T.f25) [symbolic = %HoldsType.loc19_37.1 (constants.%HoldsType.ef239b.1)] // CHECK:STDOUT: } -// CHECK:STDOUT: %x: @F.%HoldsType.loc21_37.1 (%HoldsType.ef239b.1) = wrapper_binding x, %x.param +// CHECK:STDOUT: %x: @F.%HoldsType.loc19_37.1 (%HoldsType.ef239b.1) = wrapper_binding x, %x.param // CHECK:STDOUT: %a.param: = value_param call_param1 // CHECK:STDOUT: %.1: = splice_block [concrete = ] { -// CHECK:STDOUT: %T.ref.loc21_50: %Class = name_ref T, %T.loc21_7.2 [symbolic = %T.loc21_7.1 (constants.%T.f25)] +// CHECK:STDOUT: %T.ref.loc19_50: %Class = name_ref T, %T.loc19_7.2 [symbolic = %T.loc19_7.1 (constants.%T.f25)] // CHECK:STDOUT: %t.ref: %Class.elem = name_ref t, @Class.%field_decl [concrete = @Class.%field_decl] -// CHECK:STDOUT: %.loc21_51.2: ref type = class_element_access %T.ref.loc21_50, element0 [symbolic = %.loc21_51.1 (constants.%.9dd)] -// CHECK:STDOUT: %.loc21_51.3: type = acquire_value %.loc21_51.2 +// CHECK:STDOUT: %.loc19_51.2: ref type = class_element_access %T.ref.loc19_50, element0 [symbolic = %.loc19_51.1 (constants.%.9dd)] +// CHECK:STDOUT: %.loc19_51.3: type = acquire_value %.loc19_51.2 // CHECK:STDOUT: } // CHECK:STDOUT: %a: = wrapper_binding a, [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {} // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] { -// CHECK:STDOUT: %c.patt.loc25_15.1: %pattern_type.f15 = symbolic_binding_pattern c, 0 [symbolic = %c.patt.loc25_15.2 (constants.%c.patt)] +// CHECK:STDOUT: %c.patt.loc23_15.1: %pattern_type.f15 = symbolic_binding_pattern c, 0 [symbolic = %c.patt.loc23_15.2 (constants.%c.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc25: type = splice_block %Class.ref [concrete = constants.%Class] { +// CHECK:STDOUT: %.loc23: type = splice_block %Class.ref [concrete = constants.%Class] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [concrete = constants.%Class] // CHECK:STDOUT: } -// CHECK:STDOUT: %c.loc25_15.2: %Class = symbolic_binding c, 0 [symbolic = %c.loc25_15.1 (constants.%c)] +// CHECK:STDOUT: %c.loc23_15.2: %Class = symbolic_binding c, 0 [symbolic = %c.loc23_15.1 (constants.%c)] // CHECK:STDOUT: } // CHECK:STDOUT: %H.decl: %H.type = fn_decl @H [concrete = constants.%H] {} {} // CHECK:STDOUT: } @@ -987,44 +983,44 @@ fn G() { // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F(%T.loc21_7.2: %Class) { -// CHECK:STDOUT: %T.patt.loc21_7.2: %pattern_type.f15 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc21_7.2 (constants.%T.patt.125)] -// CHECK:STDOUT: %T.loc21_7.1: %Class = symbolic_binding T, 0 [symbolic = %T.loc21_7.1 (constants.%T.f25)] -// CHECK:STDOUT: %HoldsType.loc21_37.1: type = class_type @HoldsType, @HoldsType(%T.loc21_7.1) [symbolic = %HoldsType.loc21_37.1 (constants.%HoldsType.ef239b.1)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %HoldsType.loc21_37.1 [symbolic = %pattern_type (constants.%pattern_type.d63)] -// CHECK:STDOUT: %x.param_patt.loc21_24.2: @F.%pattern_type (%pattern_type.d63) = value_param_pattern [symbolic = %x.param_patt.loc21_24.2 (constants.%x.param_patt)] -// CHECK:STDOUT: %x.patt.loc21_24.2: @F.%pattern_type (%pattern_type.d63) = wrapper_binding_pattern x, %x.param_patt.loc21_24.2 [symbolic = %x.patt.loc21_24.2 (constants.%x.patt)] -// CHECK:STDOUT: %.loc21_51.1: ref type = class_element_access %T.loc21_7.1, element0 [symbolic = %.loc21_51.1 (constants.%.9dd)] +// CHECK:STDOUT: generic fn @F(%T.loc19_7.2: %Class) { +// CHECK:STDOUT: %T.patt.loc19_7.2: %pattern_type.f15 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc19_7.2 (constants.%T.patt.125)] +// CHECK:STDOUT: %T.loc19_7.1: %Class = symbolic_binding T, 0 [symbolic = %T.loc19_7.1 (constants.%T.f25)] +// CHECK:STDOUT: %HoldsType.loc19_37.1: type = class_type @HoldsType, @HoldsType(%T.loc19_7.1) [symbolic = %HoldsType.loc19_37.1 (constants.%HoldsType.ef239b.1)] +// CHECK:STDOUT: %pattern_type: type = pattern_type %HoldsType.loc19_37.1 [symbolic = %pattern_type (constants.%pattern_type.d63)] +// CHECK:STDOUT: %x.param_patt.loc19_24.2: @F.%pattern_type (%pattern_type.d63) = value_param_pattern [symbolic = %x.param_patt.loc19_24.2 (constants.%x.param_patt)] +// CHECK:STDOUT: %x.patt.loc19_24.2: @F.%pattern_type (%pattern_type.d63) = wrapper_binding_pattern x, %x.param_patt.loc19_24.2 [symbolic = %x.patt.loc19_24.2 (constants.%x.patt)] +// CHECK:STDOUT: %.loc19_51.1: ref type = class_element_access %T.loc19_7.1, element0 [symbolic = %.loc19_51.1 (constants.%.9dd)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %HoldsType.loc21_37.1 [symbolic = %require_complete (constants.%require_complete.8b59ba.1)] +// CHECK:STDOUT: %require_complete: = require_complete_type %HoldsType.loc19_37.1 [symbolic = %require_complete (constants.%require_complete.8b59ba.1)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%x.param: @F.%HoldsType.loc21_37.1 (%HoldsType.ef239b.1), %a.param: ) { +// CHECK:STDOUT: fn(%x.param: @F.%HoldsType.loc19_37.1 (%HoldsType.ef239b.1), %a.param: ) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @G(%c.loc25_15.2: %Class) { -// CHECK:STDOUT: %c.patt.loc25_15.2: %pattern_type.f15 = symbolic_binding_pattern c, 0 [symbolic = %c.patt.loc25_15.2 (constants.%c.patt)] -// CHECK:STDOUT: %c.loc25_15.1: %Class = symbolic_binding c, 0 [symbolic = %c.loc25_15.1 (constants.%c)] +// CHECK:STDOUT: generic fn @G(%c.loc23_15.2: %Class) { +// CHECK:STDOUT: %c.patt.loc23_15.2: %pattern_type.f15 = symbolic_binding_pattern c, 0 [symbolic = %c.patt.loc23_15.2 (constants.%c.patt)] +// CHECK:STDOUT: %c.loc23_15.1: %Class = symbolic_binding c, 0 [symbolic = %c.loc23_15.1 (constants.%c)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %HoldsType.loc26_22.2: type = class_type @HoldsType, @HoldsType(%c.loc25_15.1) [symbolic = %HoldsType.loc26_22.2 (constants.%HoldsType.ef239b.2)] -// CHECK:STDOUT: %require_complete: = require_complete_type %HoldsType.loc26_22.2 [symbolic = %require_complete (constants.%require_complete.8b59ba.2)] -// CHECK:STDOUT: %HoldsType.val: @G.%HoldsType.loc26_22.2 (%HoldsType.ef239b.2) = struct_value () [symbolic = %HoldsType.val (constants.%HoldsType.val.16e)] +// CHECK:STDOUT: %HoldsType.loc24_22.2: type = class_type @HoldsType, @HoldsType(%c.loc23_15.1) [symbolic = %HoldsType.loc24_22.2 (constants.%HoldsType.ef239b.2)] +// CHECK:STDOUT: %require_complete: = require_complete_type %HoldsType.loc24_22.2 [symbolic = %require_complete (constants.%require_complete.8b59ba.2)] +// CHECK:STDOUT: %HoldsType.val: @G.%HoldsType.loc24_22.2 (%HoldsType.ef239b.2) = struct_value () [symbolic = %HoldsType.val (constants.%HoldsType.val.16e)] // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] -// CHECK:STDOUT: %.loc26_6.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc24_6.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: %HoldsType.ref: %HoldsType.type = name_ref HoldsType, file.%HoldsType.decl [concrete = constants.%HoldsType.generic] -// CHECK:STDOUT: %c.ref: %Class = name_ref c, %c.loc25_15.2 [symbolic = %c.loc25_15.1 (constants.%c)] -// CHECK:STDOUT: %HoldsType.loc26_22.1: type = class_type @HoldsType, @HoldsType(constants.%c) [symbolic = %HoldsType.loc26_22.2 (constants.%HoldsType.ef239b.2)] -// CHECK:STDOUT: %.loc26_6.2: ref @G.%HoldsType.loc26_22.2 (%HoldsType.ef239b.2) = temporary_storage -// CHECK:STDOUT: %.loc26_6.3: init @G.%HoldsType.loc26_22.2 (%HoldsType.ef239b.2) to %.loc26_6.2 = class_init () [symbolic = %HoldsType.val (constants.%HoldsType.val.16e)] -// CHECK:STDOUT: %.loc26_8: init @G.%HoldsType.loc26_22.2 (%HoldsType.ef239b.2) = converted %.loc26_6.1, %.loc26_6.3 [symbolic = %HoldsType.val (constants.%HoldsType.val.16e)] -// CHECK:STDOUT: %.loc26_26: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %c.ref: %Class = name_ref c, %c.loc23_15.2 [symbolic = %c.loc23_15.1 (constants.%c)] +// CHECK:STDOUT: %HoldsType.loc24_22.1: type = class_type @HoldsType, @HoldsType(constants.%c) [symbolic = %HoldsType.loc24_22.2 (constants.%HoldsType.ef239b.2)] +// CHECK:STDOUT: %.loc24_6.2: ref @G.%HoldsType.loc24_22.2 (%HoldsType.ef239b.2) = temporary_storage +// CHECK:STDOUT: %.loc24_6.3: init @G.%HoldsType.loc24_22.2 (%HoldsType.ef239b.2) to %.loc24_6.2 = class_init () [symbolic = %HoldsType.val (constants.%HoldsType.val.16e)] +// CHECK:STDOUT: %.loc24_8: init @G.%HoldsType.loc24_22.2 (%HoldsType.ef239b.2) = converted %.loc24_6.1, %.loc24_6.3 [symbolic = %HoldsType.val (constants.%HoldsType.val.16e)] +// CHECK:STDOUT: %.loc24_26: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -1033,63 +1029,63 @@ fn G() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %G.ref: %G.type = name_ref G, file.%G.decl [concrete = constants.%G] // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc30_12.1: %struct_type.t = struct_literal (%C.ref) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc28_12.1: %struct_type.t = struct_literal (%C.ref) [concrete = constants.%struct] // CHECK:STDOUT: %impl.elem0: %.cd2 = impl_witness_access constants.%Copy.impl_witness.f3e, element0 [concrete = constants.%type.as.Copy.impl.Op] // CHECK:STDOUT: %bound_method: = bound_method %C.ref, %impl.elem0 [concrete = constants.%type.as.Copy.impl.Op.bound] // CHECK:STDOUT: %type.as.Copy.impl.Op.call: init type = call %bound_method(%C.ref) [concrete = constants.%C] -// CHECK:STDOUT: %.loc30_12.2: ref %Class = temporary_storage -// CHECK:STDOUT: %.loc30_12.3: ref type = class_element_access %.loc30_12.2, element0 -// CHECK:STDOUT: %.loc30_12.4: init type to %.loc30_12.3 = in_place_init %type.as.Copy.impl.Op.call [concrete = constants.%C] -// CHECK:STDOUT: %.loc30_12.5: init %Class to %.loc30_12.2 = class_init (%.loc30_12.4) [concrete = constants.%Class.val] -// CHECK:STDOUT: %.loc30_13.1: init %Class = converted %.loc30_12.1, %.loc30_12.5 [concrete = constants.%Class.val] -// CHECK:STDOUT: %.loc30_13.2: ref %Class = temporary %.loc30_12.2, %.loc30_13.1 [concrete = constants.%.0de] -// CHECK:STDOUT: %.loc30_13.3: %Class = acquire_value %.loc30_13.2 [concrete = constants.%Class.val] +// CHECK:STDOUT: %.loc28_12.2: ref %Class = temporary_storage +// CHECK:STDOUT: %.loc28_12.3: ref type = class_element_access %.loc28_12.2, element0 +// CHECK:STDOUT: %.loc28_12.4: init type to %.loc28_12.3 = in_place_init %type.as.Copy.impl.Op.call [concrete = constants.%C] +// CHECK:STDOUT: %.loc28_12.5: init %Class to %.loc28_12.2 = class_init (%.loc28_12.4) [concrete = constants.%Class.val] +// CHECK:STDOUT: %.loc28_13.1: init %Class = converted %.loc28_12.1, %.loc28_12.5 [concrete = constants.%Class.val] +// CHECK:STDOUT: %.loc28_13.2: ref %Class = temporary %.loc28_12.2, %.loc28_13.1 [concrete = constants.%.0de] +// CHECK:STDOUT: %.loc28_13.3: %Class = acquire_value %.loc28_13.2 [concrete = constants.%Class.val] // CHECK:STDOUT: %G.specific_fn: = specific_function %G.ref, @G(constants.%Class.val) [concrete = constants.%G.specific_fn] // CHECK:STDOUT: %G.call: init %empty_tuple.type = call %G.specific_fn() // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call constants.%Destroy.WithSelf.SelfDestruct.bound(constants.%.0de) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc30_13.1(%self.param: ref type) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc28_13.1(%self.param: ref type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc30_13.1(%self.param: ref type) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc28_13.1(%self.param: ref type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc30_13.1(%self.param: ref type) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc28_13.1(%self.param: ref type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.1(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.1(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc30_13.2(%self.param: ref %struct_type.t) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc28_13.2(%self.param: ref %struct_type.t) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc30: ref type = struct_access %self.param, element0 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc30, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc30) +// CHECK:STDOUT: %.loc28: ref type = struct_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc28, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc28) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc30_13.2(%self.param: ref %struct_type.t) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc28_13.2(%self.param: ref %struct_type.t) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc30_13.2(%self.param: ref %struct_type.t) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc28_13.2(%self.param: ref %struct_type.t) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.2(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.2(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc30_13.3(%self.param: ref %Class) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc28_13.3(%self.param: ref %Class) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %t.ref: %Class.elem = name_ref t, @Class.%field_decl [concrete = @Class.%field_decl] -// CHECK:STDOUT: %.loc30: ref type = class_element_access %self.param, element0 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc30, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc30) +// CHECK:STDOUT: %.loc28: ref type = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc28, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc28) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc30_13.3(%self.param: ref %Class) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc28_13.3(%self.param: ref %Class) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc30_13.3(%self.param: ref %Class) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc28_13.3(%self.param: ref %Class) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.3(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.3(%self.param) @@ -1104,18 +1100,18 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @F(constants.%T.f25) { -// CHECK:STDOUT: %T.patt.loc21_7.2 => constants.%T.patt.125 -// CHECK:STDOUT: %T.loc21_7.1 => constants.%T.f25 -// CHECK:STDOUT: %HoldsType.loc21_37.1 => constants.%HoldsType.ef239b.1 +// CHECK:STDOUT: %T.patt.loc19_7.2 => constants.%T.patt.125 +// CHECK:STDOUT: %T.loc19_7.1 => constants.%T.f25 +// CHECK:STDOUT: %HoldsType.loc19_37.1 => constants.%HoldsType.ef239b.1 // CHECK:STDOUT: %pattern_type => constants.%pattern_type.d63 -// CHECK:STDOUT: %x.param_patt.loc21_24.2 => constants.%x.param_patt -// CHECK:STDOUT: %x.patt.loc21_24.2 => constants.%x.patt -// CHECK:STDOUT: %.loc21_51.1 => constants.%.9dd +// CHECK:STDOUT: %x.param_patt.loc19_24.2 => constants.%x.param_patt +// CHECK:STDOUT: %x.patt.loc19_24.2 => constants.%x.patt +// CHECK:STDOUT: %.loc19_51.1 => constants.%.9dd // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @G(constants.%c) { -// CHECK:STDOUT: %c.patt.loc25_15.2 => constants.%c.patt -// CHECK:STDOUT: %c.loc25_15.1 => constants.%c +// CHECK:STDOUT: %c.patt.loc23_15.2 => constants.%c.patt +// CHECK:STDOUT: %c.loc23_15.1 => constants.%c // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @HoldsType(constants.%c) { @@ -1126,11 +1122,11 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @G(constants.%Class.val) { -// CHECK:STDOUT: %c.patt.loc25_15.2 => constants.%c.patt -// CHECK:STDOUT: %c.loc25_15.1 => constants.%Class.val +// CHECK:STDOUT: %c.patt.loc23_15.2 => constants.%c.patt +// CHECK:STDOUT: %c.loc23_15.1 => constants.%Class.val // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %HoldsType.loc26_22.2 => constants.%HoldsType.ddc +// CHECK:STDOUT: %HoldsType.loc24_22.2 => constants.%HoldsType.ddc // CHECK:STDOUT: %require_complete => constants.%complete_type.357 // CHECK:STDOUT: %HoldsType.val => constants.%HoldsType.val.046 // CHECK:STDOUT: } @@ -1208,11 +1204,11 @@ fn G() { // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] // CHECK:STDOUT: %self.param_patt.46c: %pattern_type.809 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.463: %pattern_type.809 = wrapper_binding_pattern self, %self.param_patt.46c [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfc: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc17 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfc: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc15 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01: %Destroy.WithSelf.SubobjectDestroy.type.dfc = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef0: type = fn_type @Destroy.WithSelf.Op.loc17 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef0: type = fn_type @Destroy.WithSelf.Op.loc15 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403: %Destroy.WithSelf.Op.type.ef0 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbc: type = fn_type @Destroy.WithSelf.SelfDestruct.loc17 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbc: type = fn_type @Destroy.WithSelf.SelfDestruct.loc15 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3: %Destroy.WithSelf.SelfDestruct.type.fbc = struct_value () [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.345, %Destroy.WithSelf.SelfDestruct.db3 [concrete] // CHECK:STDOUT: } @@ -1239,14 +1235,14 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl: %Destroy.WithSelf.SubobjectDestroy.type.dfc = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc17 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl: %Destroy.WithSelf.SubobjectDestroy.type.dfc = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc15 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01] { // CHECK:STDOUT: %self.param_patt: %pattern_type.809 = ref_param_pattern [concrete = constants.%self.param_patt.46c] // CHECK:STDOUT: %self.patt: %pattern_type.809 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.463] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %Array.612 = ref_param call_param0 // CHECK:STDOUT: %self: ref %Array.612 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl: %Destroy.WithSelf.Op.type.ef0 = fn_decl @Destroy.WithSelf.Op.loc17 [concrete = constants.%Destroy.WithSelf.Op.403] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl: %Destroy.WithSelf.Op.type.ef0 = fn_decl @Destroy.WithSelf.Op.loc15 [concrete = constants.%Destroy.WithSelf.Op.403] { // CHECK:STDOUT: %self.param_patt: %pattern_type.809 = ref_param_pattern [concrete = constants.%self.param_patt.46c] // CHECK:STDOUT: %self.patt: %pattern_type.809 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.463] // CHECK:STDOUT: } { @@ -1276,40 +1272,40 @@ fn G() { // CHECK:STDOUT: %T.loc4_18.2: %Array.612 = symbolic_binding T, 0 [symbolic = %T.loc4_18.1 (constants.%T.6be)] // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { -// CHECK:STDOUT: %T.patt.loc12_7.1: %pattern_type.809 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc12_7.2 (constants.%T.patt.bb1)] -// CHECK:STDOUT: %x.param_patt.loc12_33.1: @F.%pattern_type (%pattern_type.dc7) = value_param_pattern [symbolic = %x.param_patt.loc12_33.2 (constants.%x.param_patt)] -// CHECK:STDOUT: %x.patt.loc12_33.1: @F.%pattern_type (%pattern_type.dc7) = wrapper_binding_pattern x, %x.param_patt.loc12_33.1 [symbolic = %x.patt.loc12_33.2 (constants.%x.patt)] +// CHECK:STDOUT: %T.patt.loc10_7.1: %pattern_type.809 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_7.2 (constants.%T.patt.bb1)] +// CHECK:STDOUT: %x.param_patt.loc10_33.1: @F.%pattern_type (%pattern_type.dc7) = value_param_pattern [symbolic = %x.param_patt.loc10_33.2 (constants.%x.param_patt)] +// CHECK:STDOUT: %x.patt.loc10_33.1: @F.%pattern_type (%pattern_type.dc7) = wrapper_binding_pattern x, %x.param_patt.loc10_33.1 [symbolic = %x.patt.loc10_33.2 (constants.%x.patt)] // CHECK:STDOUT: %a.param_patt: = value_param_pattern [concrete = ] // CHECK:STDOUT: %a.patt: = wrapper_binding_pattern a, %a.param_patt [concrete = ] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc12_22: type = splice_block %Array [concrete = constants.%Array.612] { +// CHECK:STDOUT: %.loc10_22: type = splice_block %Array [concrete = constants.%Array.612] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc12_15: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc10_15: type = type_literal type [concrete = type] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] // CHECK:STDOUT: %Array: type = class_type @Array, @Array(type, constants.%int_1) [concrete = constants.%Array.612] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc12_7.2: %Array.612 = symbolic_binding T, 0 [symbolic = %T.loc12_7.1 (constants.%T.6be)] -// CHECK:STDOUT: %x.param: @F.%HoldsType.loc12_46.1 (%HoldsType.9dd) = value_param call_param0 -// CHECK:STDOUT: %.loc12_46: type = splice_block %HoldsType.loc12_46.2 [symbolic = %HoldsType.loc12_46.1 (constants.%HoldsType.9dd)] { +// CHECK:STDOUT: %T.loc10_7.2: %Array.612 = symbolic_binding T, 0 [symbolic = %T.loc10_7.1 (constants.%T.6be)] +// CHECK:STDOUT: %x.param: @F.%HoldsType.loc10_46.1 (%HoldsType.9dd) = value_param call_param0 +// CHECK:STDOUT: %.loc10_46: type = splice_block %HoldsType.loc10_46.2 [symbolic = %HoldsType.loc10_46.1 (constants.%HoldsType.9dd)] { // CHECK:STDOUT: %HoldsType.ref: %HoldsType.type = name_ref HoldsType, file.%HoldsType.decl [concrete = constants.%HoldsType.generic] -// CHECK:STDOUT: %T.ref.loc12_45: %Array.612 = name_ref T, %T.loc12_7.2 [symbolic = %T.loc12_7.1 (constants.%T.6be)] -// CHECK:STDOUT: %HoldsType.loc12_46.2: type = class_type @HoldsType, @HoldsType(constants.%T.6be) [symbolic = %HoldsType.loc12_46.1 (constants.%HoldsType.9dd)] +// CHECK:STDOUT: %T.ref.loc10_45: %Array.612 = name_ref T, %T.loc10_7.2 [symbolic = %T.loc10_7.1 (constants.%T.6be)] +// CHECK:STDOUT: %HoldsType.loc10_46.2: type = class_type @HoldsType, @HoldsType(constants.%T.6be) [symbolic = %HoldsType.loc10_46.1 (constants.%HoldsType.9dd)] // CHECK:STDOUT: } -// CHECK:STDOUT: %x: @F.%HoldsType.loc12_46.1 (%HoldsType.9dd) = wrapper_binding x, %x.param +// CHECK:STDOUT: %x: @F.%HoldsType.loc10_46.1 (%HoldsType.9dd) = wrapper_binding x, %x.param // CHECK:STDOUT: %a.param: = value_param call_param1 // CHECK:STDOUT: %.1: = splice_block [concrete = ] { -// CHECK:STDOUT: %T.ref.loc12_59: %Array.612 = name_ref T, %T.loc12_7.2 [symbolic = %T.loc12_7.1 (constants.%T.6be)] +// CHECK:STDOUT: %T.ref.loc10_59: %Array.612 = name_ref T, %T.loc10_7.2 [symbolic = %T.loc10_7.1 (constants.%T.6be)] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] // CHECK:STDOUT: %impl.elem0: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc12_61.1: = bound_method %int_0, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %bound_method.loc10_61.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.loc12_61.2: = bound_method %int_0, %specific_fn [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc12_61.2(%int_0) [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc12_61.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc12_61.2: %i32 = converted %int_0, %.loc12_61.1 [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc12_62.1: ref %Array.612 = value_as_ref %T.ref.loc12_59 -// CHECK:STDOUT: %.loc12_62.2: ref type = array_index %.loc12_62.1, %.loc12_61.2 -// CHECK:STDOUT: %.loc12_62.3: type = acquire_value %.loc12_62.2 +// CHECK:STDOUT: %bound_method.loc10_61.2: = bound_method %int_0, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc10_61.2(%int_0) [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc10_61.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc10_61.2: %i32 = converted %int_0, %.loc10_61.1 [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc10_62.1: ref %Array.612 = value_as_ref %T.ref.loc10_59 +// CHECK:STDOUT: %.loc10_62.2: ref type = array_index %.loc10_62.1, %.loc10_61.2 +// CHECK:STDOUT: %.loc10_62.3: type = acquire_value %.loc10_62.2 // CHECK:STDOUT: } // CHECK:STDOUT: %a: = wrapper_binding a, [concrete = ] // CHECK:STDOUT: } @@ -1340,18 +1336,18 @@ fn G() { // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F(%T.loc12_7.2: %Array.612) { -// CHECK:STDOUT: %T.patt.loc12_7.2: %pattern_type.809 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc12_7.2 (constants.%T.patt.bb1)] -// CHECK:STDOUT: %T.loc12_7.1: %Array.612 = symbolic_binding T, 0 [symbolic = %T.loc12_7.1 (constants.%T.6be)] -// CHECK:STDOUT: %HoldsType.loc12_46.1: type = class_type @HoldsType, @HoldsType(%T.loc12_7.1) [symbolic = %HoldsType.loc12_46.1 (constants.%HoldsType.9dd)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %HoldsType.loc12_46.1 [symbolic = %pattern_type (constants.%pattern_type.dc7)] -// CHECK:STDOUT: %x.param_patt.loc12_33.2: @F.%pattern_type (%pattern_type.dc7) = value_param_pattern [symbolic = %x.param_patt.loc12_33.2 (constants.%x.param_patt)] -// CHECK:STDOUT: %x.patt.loc12_33.2: @F.%pattern_type (%pattern_type.dc7) = wrapper_binding_pattern x, %x.param_patt.loc12_33.2 [symbolic = %x.patt.loc12_33.2 (constants.%x.patt)] +// CHECK:STDOUT: generic fn @F(%T.loc10_7.2: %Array.612) { +// CHECK:STDOUT: %T.patt.loc10_7.2: %pattern_type.809 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_7.2 (constants.%T.patt.bb1)] +// CHECK:STDOUT: %T.loc10_7.1: %Array.612 = symbolic_binding T, 0 [symbolic = %T.loc10_7.1 (constants.%T.6be)] +// CHECK:STDOUT: %HoldsType.loc10_46.1: type = class_type @HoldsType, @HoldsType(%T.loc10_7.1) [symbolic = %HoldsType.loc10_46.1 (constants.%HoldsType.9dd)] +// CHECK:STDOUT: %pattern_type: type = pattern_type %HoldsType.loc10_46.1 [symbolic = %pattern_type (constants.%pattern_type.dc7)] +// CHECK:STDOUT: %x.param_patt.loc10_33.2: @F.%pattern_type (%pattern_type.dc7) = value_param_pattern [symbolic = %x.param_patt.loc10_33.2 (constants.%x.param_patt)] +// CHECK:STDOUT: %x.patt.loc10_33.2: @F.%pattern_type (%pattern_type.dc7) = wrapper_binding_pattern x, %x.param_patt.loc10_33.2 [symbolic = %x.patt.loc10_33.2 (constants.%x.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %HoldsType.loc12_46.1 [symbolic = %require_complete (constants.%require_complete.501)] +// CHECK:STDOUT: %require_complete: = require_complete_type %HoldsType.loc10_46.1 [symbolic = %require_complete (constants.%require_complete.501)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%x.param: @F.%HoldsType.loc12_46.1 (%HoldsType.9dd), %a.param: ) { +// CHECK:STDOUT: fn(%x.param: @F.%HoldsType.loc10_46.1 (%HoldsType.9dd), %a.param: ) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -1360,38 +1356,38 @@ fn G() { // CHECK:STDOUT: fn @G() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] -// CHECK:STDOUT: %.loc17_6.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc15_6.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: %HoldsType.ref: %HoldsType.type = name_ref HoldsType, file.%HoldsType.decl [concrete = constants.%HoldsType.generic] // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc17_25.1: %tuple.type.135 = tuple_literal (%C.ref) [concrete = constants.%tuple.9e1] -// CHECK:STDOUT: %.loc17_36: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc15_25.1: %tuple.type.135 = tuple_literal (%C.ref) [concrete = constants.%tuple.9e1] +// CHECK:STDOUT: %.loc15_36: type = type_literal type [concrete = type] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] // CHECK:STDOUT: %Array: type = class_type @Array, @Array(type, constants.%int_1) [concrete = constants.%Array.612] // CHECK:STDOUT: %impl.elem0: %.cd2 = impl_witness_access constants.%Copy.impl_witness.f3e, element0 [concrete = constants.%type.as.Copy.impl.Op] // CHECK:STDOUT: %bound_method: = bound_method %C.ref, %impl.elem0 [concrete = constants.%type.as.Copy.impl.Op.bound] // CHECK:STDOUT: %type.as.Copy.impl.Op.call: init type = call %bound_method(%C.ref) [concrete = constants.%C] -// CHECK:STDOUT: %.loc17_25.2: ref %Array.612 = temporary_storage +// CHECK:STDOUT: %.loc15_25.2: ref %Array.612 = temporary_storage // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] -// CHECK:STDOUT: %.loc17_25.3: ref type = array_index %.loc17_25.2, %int_0 -// CHECK:STDOUT: %.loc17_25.4: init type to %.loc17_25.3 = in_place_init %type.as.Copy.impl.Op.call [concrete = constants.%C] -// CHECK:STDOUT: %.loc17_25.5: init %Array.612 to %.loc17_25.2 = array_init (%.loc17_25.4) [concrete = constants.%array] -// CHECK:STDOUT: %.loc17_27.1: init %Array.612 = converted %.loc17_25.1, %.loc17_25.5 [concrete = constants.%array] -// CHECK:STDOUT: %.loc17_27.2: ref %Array.612 = temporary %.loc17_25.2, %.loc17_27.1 [concrete = constants.%.345] -// CHECK:STDOUT: %.loc17_27.3: %Array.612 = acquire_value %.loc17_27.2 [concrete = constants.%array] +// CHECK:STDOUT: %.loc15_25.3: ref type = array_index %.loc15_25.2, %int_0 +// CHECK:STDOUT: %.loc15_25.4: init type to %.loc15_25.3 = in_place_init %type.as.Copy.impl.Op.call [concrete = constants.%C] +// CHECK:STDOUT: %.loc15_25.5: init %Array.612 to %.loc15_25.2 = array_init (%.loc15_25.4) [concrete = constants.%array] +// CHECK:STDOUT: %.loc15_27.1: init %Array.612 = converted %.loc15_25.1, %.loc15_25.5 [concrete = constants.%array] +// CHECK:STDOUT: %.loc15_27.2: ref %Array.612 = temporary %.loc15_25.2, %.loc15_27.1 [concrete = constants.%.345] +// CHECK:STDOUT: %.loc15_27.3: %Array.612 = acquire_value %.loc15_27.2 [concrete = constants.%array] // CHECK:STDOUT: %HoldsType: type = class_type @HoldsType, @HoldsType(constants.%array) [concrete = constants.%HoldsType.00d] -// CHECK:STDOUT: %.loc17_6.2: ref %HoldsType.00d = temporary_storage -// CHECK:STDOUT: %.loc17_6.3: init %HoldsType.00d to %.loc17_6.2 = class_init () [concrete = constants.%HoldsType.val] -// CHECK:STDOUT: %.loc17_8: init %HoldsType.00d = converted %.loc17_6.1, %.loc17_6.3 [concrete = constants.%HoldsType.val] -// CHECK:STDOUT: %.loc17_48: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc15_6.2: ref %HoldsType.00d = temporary_storage +// CHECK:STDOUT: %.loc15_6.3: init %HoldsType.00d to %.loc15_6.2 = class_init () [concrete = constants.%HoldsType.val] +// CHECK:STDOUT: %.loc15_8: init %HoldsType.00d = converted %.loc15_6.1, %.loc15_6.3 [concrete = constants.%HoldsType.val] +// CHECK:STDOUT: %.loc15_48: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call constants.%Destroy.WithSelf.SelfDestruct.bound(constants.%.345) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc17(%self.param: ref %Array.612) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc15(%self.param: ref %Array.612) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc17(%self.param: ref %Array.612) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc15(%self.param: ref %Array.612) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc17(%self.param: ref %Array.612) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc15(%self.param: ref %Array.612) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl(%self.param) @@ -1406,12 +1402,12 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @F(constants.%T.6be) { -// CHECK:STDOUT: %T.patt.loc12_7.2 => constants.%T.patt.bb1 -// CHECK:STDOUT: %T.loc12_7.1 => constants.%T.6be -// CHECK:STDOUT: %HoldsType.loc12_46.1 => constants.%HoldsType.9dd +// CHECK:STDOUT: %T.patt.loc10_7.2 => constants.%T.patt.bb1 +// CHECK:STDOUT: %T.loc10_7.1 => constants.%T.6be +// CHECK:STDOUT: %HoldsType.loc10_46.1 => constants.%HoldsType.9dd // CHECK:STDOUT: %pattern_type => constants.%pattern_type.dc7 -// CHECK:STDOUT: %x.param_patt.loc12_33.2 => constants.%x.param_patt -// CHECK:STDOUT: %x.patt.loc12_33.2 => constants.%x.patt +// CHECK:STDOUT: %x.param_patt.loc10_33.2 => constants.%x.param_patt +// CHECK:STDOUT: %x.patt.loc10_33.2 => constants.%x.patt // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @HoldsType(constants.%array) { diff --git a/toolchain/check/testdata/deduce/where.carbon b/toolchain/check/testdata/deduce/where.carbon index fe5b0ff5bc7f..5a87a684eb3f 100644 --- a/toolchain/check/testdata/deduce/where.carbon +++ b/toolchain/check/testdata/deduce/where.carbon @@ -28,12 +28,8 @@ fn G() { // TODO: Should be able to see that ().(Z.Z1) is C(D), so deduce that C(U) // is C(D) and U is D. // - // CHECK:STDERR: fail_todo_where.carbon:[[@LINE+7]]:3: error: cannot deduce value for generic parameter `U` [DeductionIncomplete] - // CHECK:STDERR: F(() as type); - // CHECK:STDERR: ^~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_where.carbon:[[@LINE-12]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn F[U: type](unused generic T: Z where .Z1 = C(U)) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_where.carbon:[[@LINE+3]]:3-15: error: cannot deduce value for generic parameter `U` [DeductionIncomplete] + // CHECK:STDERR: fail_todo_where.carbon:[[@LINE-10]]:1-53: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: F(() as type); } diff --git a/toolchain/check/testdata/eval/aggregates.carbon b/toolchain/check/testdata/eval/aggregates.carbon index d246dcad8370..df545edfceee 100644 --- a/toolchain/check/testdata/eval/aggregates.carbon +++ b/toolchain/check/testdata/eval/aggregates.carbon @@ -28,9 +28,7 @@ library "[[@TEST_NAME]]"; // TODO: This creates an array temporary, which we don't yet support evaluating. //@dump-sem-ir-begin -// CHECK:STDERR: fail_todo_array_temporary.carbon:[[@LINE+4]]:53: error: array bound is not a constant [InvalidArrayExpr] -// CHECK:STDERR: var array_index: array(i32, 1) = (0,) as array(i32, ((5, 7, 1, 9) as array(i32, 4))[2]); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_array_temporary.carbon:[[@LINE+2]]:53-86: error: array bound is not a constant [InvalidArrayExpr] // CHECK:STDERR: var array_index: array(i32, 1) = (0,) as array(i32, ((5, 7, 1, 9) as array(i32, 4))[2]); //@dump-sem-ir-end @@ -415,7 +413,7 @@ fn G(generic N: i32) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: %array_index.var: ref %Array.00c = var_storage %array_index.var_patt [concrete] -// CHECK:STDOUT: %.loc9: type = splice_block %Array [concrete = constants.%Array.00c] { +// CHECK:STDOUT: %.loc7: type = splice_block %Array [concrete = constants.%Array.00c] { // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] // CHECK:STDOUT: %Array: type = class_type @Array, @Array(constants.%i32, constants.%int_1.5b8) [concrete = constants.%Array.00c] @@ -429,67 +427,67 @@ fn G(generic N: i32) { // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int_0.loc9_35: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] -// CHECK:STDOUT: %.loc9_37: %tuple.type.985 = tuple_literal (%int_0.loc9_35) [concrete = constants.%tuple.4f2] -// CHECK:STDOUT: %i32.loc9_48: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %int_0.loc7_35: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] +// CHECK:STDOUT: %.loc7_37: %tuple.type.985 = tuple_literal (%int_0.loc7_35) [concrete = constants.%tuple.4f2] +// CHECK:STDOUT: %i32.loc7_48: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [concrete = constants.%int_5.64b] // CHECK:STDOUT: %int_7: Core.IntLiteral = int_value 7 [concrete = constants.%int_7.29f] -// CHECK:STDOUT: %int_1.loc9_61: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_1.loc7_61: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] // CHECK:STDOUT: %int_9: Core.IntLiteral = int_value 9 [concrete = constants.%int_9.988] -// CHECK:STDOUT: %.loc9_65.1: %tuple.type.d46 = tuple_literal (%int_5, %int_7, %int_1.loc9_61, %int_9) [concrete = constants.%tuple.869] -// CHECK:STDOUT: %i32.loc9_76: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc7_65.1: %tuple.type.d46 = tuple_literal (%int_5, %int_7, %int_1.loc7_61, %int_9) [concrete = constants.%tuple.869] +// CHECK:STDOUT: %i32.loc7_76: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4] // CHECK:STDOUT: %Array: type = class_type @Array, @Array(constants.%i32, constants.%int_4) [concrete = constants.%Array.f09] -// CHECK:STDOUT: %impl.elem0.loc9_65.1: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc9_65.1: = bound_method %int_5, %impl.elem0.loc9_65.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.f65] -// CHECK:STDOUT: %specific_fn.loc9_65.1: = specific_function %impl.elem0.loc9_65.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc9_65.2: = bound_method %int_5, %specific_fn.loc9_65.1 [concrete = constants.%bound_method.ab2] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc9_65.1: init %i32 = call %bound_method.loc9_65.2(%int_5) [concrete = constants.%int_5.708] -// CHECK:STDOUT: %.loc9_65.2: init %i32 = converted %int_5, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc9_65.1 [concrete = constants.%int_5.708] -// CHECK:STDOUT: %.loc9_65.3: ref %Array.f09 = temporary_storage -// CHECK:STDOUT: %int_0.loc9_65: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] -// CHECK:STDOUT: %.loc9_65.4: ref %i32 = array_index %.loc9_65.3, %int_0.loc9_65 -// CHECK:STDOUT: %.loc9_65.5: init %i32 to %.loc9_65.4 = in_place_init %.loc9_65.2 [concrete = constants.%int_5.708] -// CHECK:STDOUT: %impl.elem0.loc9_65.2: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc9_65.3: = bound_method %int_7, %impl.elem0.loc9_65.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.5f1] -// CHECK:STDOUT: %specific_fn.loc9_65.2: = specific_function %impl.elem0.loc9_65.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc9_65.4: = bound_method %int_7, %specific_fn.loc9_65.2 [concrete = constants.%bound_method.a5e] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc9_65.2: init %i32 = call %bound_method.loc9_65.4(%int_7) [concrete = constants.%int_7.a13] -// CHECK:STDOUT: %.loc9_65.6: init %i32 = converted %int_7, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc9_65.2 [concrete = constants.%int_7.a13] -// CHECK:STDOUT: %int_1.loc9_65: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %.loc9_65.7: ref %i32 = array_index %.loc9_65.3, %int_1.loc9_65 -// CHECK:STDOUT: %.loc9_65.8: init %i32 to %.loc9_65.7 = in_place_init %.loc9_65.6 [concrete = constants.%int_7.a13] -// CHECK:STDOUT: %impl.elem0.loc9_65.3: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc9_65.5: = bound_method %int_1.loc9_61, %impl.elem0.loc9_65.3 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] -// CHECK:STDOUT: %specific_fn.loc9_65.3: = specific_function %impl.elem0.loc9_65.3, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc9_65.6: = bound_method %int_1.loc9_61, %specific_fn.loc9_65.3 [concrete = constants.%bound_method.3bd] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc9_65.3: init %i32 = call %bound_method.loc9_65.6(%int_1.loc9_61) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc9_65.9: init %i32 = converted %int_1.loc9_61, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc9_65.3 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %int_2.loc9_65: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %.loc9_65.10: ref %i32 = array_index %.loc9_65.3, %int_2.loc9_65 -// CHECK:STDOUT: %.loc9_65.11: init %i32 to %.loc9_65.10 = in_place_init %.loc9_65.9 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %impl.elem0.loc9_65.4: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc9_65.7: = bound_method %int_9, %impl.elem0.loc9_65.4 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.cf2] -// CHECK:STDOUT: %specific_fn.loc9_65.4: = specific_function %impl.elem0.loc9_65.4, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc9_65.8: = bound_method %int_9, %specific_fn.loc9_65.4 [concrete = constants.%bound_method.015] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc9_65.4: init %i32 = call %bound_method.loc9_65.8(%int_9) [concrete = constants.%int_9.607] -// CHECK:STDOUT: %.loc9_65.12: init %i32 = converted %int_9, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc9_65.4 [concrete = constants.%int_9.607] +// CHECK:STDOUT: %impl.elem0.loc7_65.1: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc7_65.1: = bound_method %int_5, %impl.elem0.loc7_65.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.f65] +// CHECK:STDOUT: %specific_fn.loc7_65.1: = specific_function %impl.elem0.loc7_65.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_65.2: = bound_method %int_5, %specific_fn.loc7_65.1 [concrete = constants.%bound_method.ab2] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7_65.1: init %i32 = call %bound_method.loc7_65.2(%int_5) [concrete = constants.%int_5.708] +// CHECK:STDOUT: %.loc7_65.2: init %i32 = converted %int_5, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7_65.1 [concrete = constants.%int_5.708] +// CHECK:STDOUT: %.loc7_65.3: ref %Array.f09 = temporary_storage +// CHECK:STDOUT: %int_0.loc7_65: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] +// CHECK:STDOUT: %.loc7_65.4: ref %i32 = array_index %.loc7_65.3, %int_0.loc7_65 +// CHECK:STDOUT: %.loc7_65.5: init %i32 to %.loc7_65.4 = in_place_init %.loc7_65.2 [concrete = constants.%int_5.708] +// CHECK:STDOUT: %impl.elem0.loc7_65.2: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc7_65.3: = bound_method %int_7, %impl.elem0.loc7_65.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.5f1] +// CHECK:STDOUT: %specific_fn.loc7_65.2: = specific_function %impl.elem0.loc7_65.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_65.4: = bound_method %int_7, %specific_fn.loc7_65.2 [concrete = constants.%bound_method.a5e] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7_65.2: init %i32 = call %bound_method.loc7_65.4(%int_7) [concrete = constants.%int_7.a13] +// CHECK:STDOUT: %.loc7_65.6: init %i32 = converted %int_7, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7_65.2 [concrete = constants.%int_7.a13] +// CHECK:STDOUT: %int_1.loc7_65: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %.loc7_65.7: ref %i32 = array_index %.loc7_65.3, %int_1.loc7_65 +// CHECK:STDOUT: %.loc7_65.8: init %i32 to %.loc7_65.7 = in_place_init %.loc7_65.6 [concrete = constants.%int_7.a13] +// CHECK:STDOUT: %impl.elem0.loc7_65.3: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc7_65.5: = bound_method %int_1.loc7_61, %impl.elem0.loc7_65.3 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] +// CHECK:STDOUT: %specific_fn.loc7_65.3: = specific_function %impl.elem0.loc7_65.3, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_65.6: = bound_method %int_1.loc7_61, %specific_fn.loc7_65.3 [concrete = constants.%bound_method.3bd] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7_65.3: init %i32 = call %bound_method.loc7_65.6(%int_1.loc7_61) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc7_65.9: init %i32 = converted %int_1.loc7_61, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7_65.3 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %int_2.loc7_65: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] +// CHECK:STDOUT: %.loc7_65.10: ref %i32 = array_index %.loc7_65.3, %int_2.loc7_65 +// CHECK:STDOUT: %.loc7_65.11: init %i32 to %.loc7_65.10 = in_place_init %.loc7_65.9 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %impl.elem0.loc7_65.4: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc7_65.7: = bound_method %int_9, %impl.elem0.loc7_65.4 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.cf2] +// CHECK:STDOUT: %specific_fn.loc7_65.4: = specific_function %impl.elem0.loc7_65.4, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_65.8: = bound_method %int_9, %specific_fn.loc7_65.4 [concrete = constants.%bound_method.015] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7_65.4: init %i32 = call %bound_method.loc7_65.8(%int_9) [concrete = constants.%int_9.607] +// CHECK:STDOUT: %.loc7_65.12: init %i32 = converted %int_9, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7_65.4 [concrete = constants.%int_9.607] // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3] -// CHECK:STDOUT: %.loc9_65.13: ref %i32 = array_index %.loc9_65.3, %int_3 -// CHECK:STDOUT: %.loc9_65.14: init %i32 to %.loc9_65.13 = in_place_init %.loc9_65.12 [concrete = constants.%int_9.607] -// CHECK:STDOUT: %.loc9_65.15: init %Array.f09 to %.loc9_65.3 = array_init (%.loc9_65.5, %.loc9_65.8, %.loc9_65.11, %.loc9_65.14) [concrete = constants.%array] -// CHECK:STDOUT: %.loc9_67.1: init %Array.f09 = converted %.loc9_65.1, %.loc9_65.15 [concrete = constants.%array] -// CHECK:STDOUT: %int_2.loc9_85: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %.loc9_67.2: ref %Array.f09 = temporary %.loc9_65.3, %.loc9_67.1 [concrete = constants.%.4ae] -// CHECK:STDOUT: %impl.elem0.loc9_85: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc9_85.1: = bound_method %int_2.loc9_85, %impl.elem0.loc9_85 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6] -// CHECK:STDOUT: %specific_fn.loc9_85: = specific_function %impl.elem0.loc9_85, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc9_85.2: = bound_method %int_2.loc9_85, %specific_fn.loc9_85 [concrete = constants.%bound_method.a55] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc9_85: init %i32 = call %bound_method.loc9_85.2(%int_2.loc9_85) [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc9_85.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc9_85 [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc9_85.2: %i32 = converted %int_2.loc9_85, %.loc9_85.1 [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc9_86.1: ref %i32 = array_index %.loc9_67.2, %.loc9_85.2 -// CHECK:STDOUT: %.loc9_86.2: %i32 = acquire_value %.loc9_86.1 +// CHECK:STDOUT: %.loc7_65.13: ref %i32 = array_index %.loc7_65.3, %int_3 +// CHECK:STDOUT: %.loc7_65.14: init %i32 to %.loc7_65.13 = in_place_init %.loc7_65.12 [concrete = constants.%int_9.607] +// CHECK:STDOUT: %.loc7_65.15: init %Array.f09 to %.loc7_65.3 = array_init (%.loc7_65.5, %.loc7_65.8, %.loc7_65.11, %.loc7_65.14) [concrete = constants.%array] +// CHECK:STDOUT: %.loc7_67.1: init %Array.f09 = converted %.loc7_65.1, %.loc7_65.15 [concrete = constants.%array] +// CHECK:STDOUT: %int_2.loc7_85: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] +// CHECK:STDOUT: %.loc7_67.2: ref %Array.f09 = temporary %.loc7_65.3, %.loc7_67.1 [concrete = constants.%.4ae] +// CHECK:STDOUT: %impl.elem0.loc7_85: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc7_85.1: = bound_method %int_2.loc7_85, %impl.elem0.loc7_85 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6] +// CHECK:STDOUT: %specific_fn.loc7_85: = specific_function %impl.elem0.loc7_85, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_85.2: = bound_method %int_2.loc7_85, %specific_fn.loc7_85 [concrete = constants.%bound_method.a55] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7_85: init %i32 = call %bound_method.loc7_85.2(%int_2.loc7_85) [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc7_85.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7_85 [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc7_85.2: %i32 = converted %int_2.loc7_85, %.loc7_85.1 [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc7_86.1: ref %i32 = array_index %.loc7_67.2, %.loc7_85.2 +// CHECK:STDOUT: %.loc7_86.2: %i32 = acquire_value %.loc7_86.1 // CHECK:STDOUT: assign file.%array_index.var, // CHECK:STDOUT: // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/eval/binding.carbon b/toolchain/check/testdata/eval/binding.carbon index fbe03db5104f..7800be4ffedd 100644 --- a/toolchain/check/testdata/eval/binding.carbon +++ b/toolchain/check/testdata/eval/binding.carbon @@ -33,15 +33,11 @@ library "[[@TEST_NAME]]"; let a: i32 = 3; eval fn G() -> i32 { - // CHECK:STDERR: fail_global.carbon:[[@LINE+3]]:10: error: expression is runtime; expected constant [EvalRequiresConstantValue] - // CHECK:STDERR: return a; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_global.carbon:[[@LINE+1]]:10: error: expression is runtime; expected constant [EvalRequiresConstantValue] return a; } -// CHECK:STDERR: fail_global.carbon:[[@LINE+4]]:19: note: in call to G here [InCallToEvalFn] -// CHECK:STDERR: let n: array(i32, G()) = (1, 2, 3); -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_global.carbon:[[@LINE+2]]:19-21: note: in call to G here [InCallToEvalFn] // CHECK:STDERR: let n: array(i32, G()) = (1, 2, 3); @@ -54,15 +50,11 @@ fn F() -> i32; let a: i32 = F(); eval fn G() -> i32 { - // CHECK:STDERR: fail_runtime_value.carbon:[[@LINE+3]]:10: error: expression is runtime; expected constant [EvalRequiresConstantValue] - // CHECK:STDERR: return a; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_runtime_value.carbon:[[@LINE+1]]:10: error: expression is runtime; expected constant [EvalRequiresConstantValue] return a; } -// CHECK:STDERR: fail_runtime_value.carbon:[[@LINE+4]]:19: note: in call to G here [InCallToEvalFn] -// CHECK:STDERR: let n: array(i32, G()) = (1, 2, 3); -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_runtime_value.carbon:[[@LINE+2]]:19-21: note: in call to G here [InCallToEvalFn] // CHECK:STDERR: let n: array(i32, G()) = (1, 2, 3); diff --git a/toolchain/check/testdata/eval/branch.carbon b/toolchain/check/testdata/eval/branch.carbon index 027e07bb46d8..56111bb9d150 100644 --- a/toolchain/check/testdata/eval/branch.carbon +++ b/toolchain/check/testdata/eval/branch.carbon @@ -57,9 +57,7 @@ var b: F(false) = MakeB(); library "[[@TEST_NAME]]"; import library "types"; -// CHECK:STDERR: fail_todo_if_expression_direct.carbon:[[@LINE+4]]:8: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] -// CHECK:STDERR: var a: if true then A else B = MakeA(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_if_expression_direct.carbon:[[@LINE+2]]:8-28: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] // CHECK:STDERR: var a: if true then A else B = MakeA(); var b: if false then A else B = MakeB(); diff --git a/toolchain/check/testdata/eval/call.carbon b/toolchain/check/testdata/eval/call.carbon index 5145cae94f2e..f41d0fdf9e4b 100644 --- a/toolchain/check/testdata/eval/call.carbon +++ b/toolchain/check/testdata/eval/call.carbon @@ -26,9 +26,7 @@ eval fn F() -> i32 { return 3; } // Ensure we get an error about the over-sized initializer and aren't just // treating all `eval fn` calls as silent errors. -// CHECK:STDERR: fail_call_wrong_value.carbon:[[@LINE+4]]:26: error: cannot initialize array of 3 elements from 4 initializers [ArrayInitFromLiteralArgCountMismatch] -// CHECK:STDERR: var a: array(i32, F()) = (0, 1, 2, 3); -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_call_wrong_value.carbon:[[@LINE+2]]:26-37: error: cannot initialize array of 3 elements from 4 initializers [ArrayInitFromLiteralArgCountMismatch] // CHECK:STDERR: var a: array(i32, F()) = (0, 1, 2, 3); @@ -38,9 +36,7 @@ library "[[@TEST_NAME]]"; fn F() -> i32 { return 3; } -// CHECK:STDERR: fail_call_fn_not_eval.carbon:[[@LINE+4]]:19: error: array bound is not a constant [InvalidArrayExpr] -// CHECK:STDERR: var a: array(i32, F()) = (0, 1, 2); -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_call_fn_not_eval.carbon:[[@LINE+2]]:19-21: error: array bound is not a constant [InvalidArrayExpr] // CHECK:STDERR: var a: array(i32, F()) = (0, 1, 2); @@ -51,9 +47,7 @@ library "[[@TEST_NAME]]"; eval fn F() -> i32; // TODO: We should be able to diagnose this better. -// CHECK:STDERR: fail_call_eval_fn_not_defined.carbon:[[@LINE+4]]:19: error: array bound is not a constant [InvalidArrayExpr] -// CHECK:STDERR: var a: array(i32, F()) = (0, 1, 2); -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_call_eval_fn_not_defined.carbon:[[@LINE+2]]:19-21: error: array bound is not a constant [InvalidArrayExpr] // CHECK:STDERR: var a: array(i32, F()) = (0, 1, 2); @@ -133,9 +127,7 @@ eval fn G(v: (i32, i32, i32)) -> i32 { return v.1; } fn H() { // TODO: The call to the function is a constant, but the `temporary` instruction wrapping it is not. //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_return_in_place_tuple.carbon:[[@LINE+4]]:28: error: array bound is not a constant [InvalidArrayExpr] - // CHECK:STDERR: var unused a: array(i32, G(F())) = (1, 2); - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_todo_return_in_place_tuple.carbon:[[@LINE+2]]:28-33: error: array bound is not a constant [InvalidArrayExpr] // CHECK:STDERR: var unused a: array(i32, G(F())) = (1, 2); //@dump-sem-ir-end @@ -676,20 +668,20 @@ fn H() { // CHECK:STDOUT: %tuple.ad8: %tuple.type.f94 = tuple_value (%int_1.5b8, %int_2.ecc) [concrete] // CHECK:STDOUT: %self.param_patt.0c5: %pattern_type.d94 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.749: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt.0c5 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc17_32.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc15_32.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc17_32.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc15_32.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.1: %Destroy.WithSelf.Op.type.ef016f.1 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1: type = fn_type @Destroy.WithSelf.SelfDestruct.loc17_32.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1: type = fn_type @Destroy.WithSelf.SelfDestruct.loc15_32.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.1: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1 = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.a2d: %pattern_type.c97 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.eb0: %pattern_type.c97 = wrapper_binding_pattern self, %self.param_patt.a2d [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc17_32.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc15_32.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = struct_value () [concrete] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc17_32.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc15_32.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.2: %Destroy.WithSelf.Op.type.ef016f.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc17_32.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc15_32.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.2: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2 = struct_value () [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.a35, %Destroy.WithSelf.SelfDestruct.db3fdb.2 [concrete] // CHECK:STDOUT: } @@ -700,28 +692,28 @@ fn H() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc17_32.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc15_32.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d94 = ref_param_pattern [concrete = constants.%self.param_patt.0c5] // CHECK:STDOUT: %self.patt: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.749] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %i32 = ref_param call_param0 // CHECK:STDOUT: %self: ref %i32 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc17_32.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc15_32.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d94 = ref_param_pattern [concrete = constants.%self.param_patt.0c5] // CHECK:STDOUT: %self.patt: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.749] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %i32 = ref_param call_param0 // CHECK:STDOUT: %self: ref %i32 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc17_32.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc15_32.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.c97 = ref_param_pattern [concrete = constants.%self.param_patt.a2d] // CHECK:STDOUT: %self.patt: %pattern_type.c97 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.eb0] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %tuple.type.abc = ref_param call_param0 // CHECK:STDOUT: %self: ref %tuple.type.abc = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc17_32.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc15_32.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.c97 = ref_param_pattern [concrete = constants.%self.param_patt.a2d] // CHECK:STDOUT: %self.patt: %pattern_type.c97 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.eb0] // CHECK:STDOUT: } { @@ -786,7 +778,7 @@ fn H() { // CHECK:STDOUT: %a.var: ref = var_storage %a.var_patt [concrete = ] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %.loc17_43: %tuple.type.f94 = tuple_literal (%int_1, %int_2) [concrete = constants.%tuple.ad8] +// CHECK:STDOUT: %.loc15_43: %tuple.type.f94 = tuple_literal (%int_1, %int_2) [concrete = constants.%tuple.ad8] // CHECK:STDOUT: assign %a.var, // CHECK:STDOUT: // CHECK:STDOUT: %a: = wrapper_binding a, [concrete = ] @@ -798,37 +790,37 @@ fn H() { // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc17_32.1(%self.param: ref %i32) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc15_32.1(%self.param: ref %i32) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc17_32.1(%self.param: ref %i32) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc15_32.1(%self.param: ref %i32) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc17_32.1(%self.param: ref %i32) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc15_32.1(%self.param: ref %i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.1(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.1(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc17_32.2(%self.param: ref %tuple.type.abc) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc15_32.2(%self.param: ref %tuple.type.abc) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] // CHECK:STDOUT: %tuple.elem2: ref %i32 = tuple_access %self.param, element2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc17_32.1: = bound_method %tuple.elem2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc17_32.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc17_32.1(%tuple.elem2) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc15_32.1: = bound_method %tuple.elem2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc15_32.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc15_32.1(%tuple.elem2) // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] // CHECK:STDOUT: %tuple.elem1: ref %i32 = tuple_access %self.param, element1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc17_32.2: = bound_method %tuple.elem1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc17_32.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc17_32.2(%tuple.elem1) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc15_32.2: = bound_method %tuple.elem1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc15_32.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc15_32.2(%tuple.elem1) // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] // CHECK:STDOUT: %tuple.elem0: ref %i32 = tuple_access %self.param, element0 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc17_32.3: = bound_method %tuple.elem0, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc17_32.3: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc17_32.3(%tuple.elem0) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc15_32.3: = bound_method %tuple.elem0, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc15_32.3: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc15_32.3(%tuple.elem0) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc17_32.2(%self.param: ref %tuple.type.abc) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc15_32.2(%self.param: ref %tuple.type.abc) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc17_32.2(%self.param: ref %tuple.type.abc) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc15_32.2(%self.param: ref %tuple.type.abc) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.2(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.2(%self.param) diff --git a/toolchain/check/testdata/eval/symbolic.carbon b/toolchain/check/testdata/eval/symbolic.carbon index 0a6f8bf2398f..3068ac75eeda 100644 --- a/toolchain/check/testdata/eval/symbolic.carbon +++ b/toolchain/check/testdata/eval/symbolic.carbon @@ -41,9 +41,7 @@ fn G(generic B: bool) { // TODO: Provide a location for the "cannot initialize" error message. fn H() { - // 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:[[@LINE+3]]:3: error: unable to monomorphize specific `G(true)` [ResolvingSpecificHere] // 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); @@ -85,24 +83,16 @@ eval fn G(generic B: bool, (a: bool, b: bool)) -> type { // the type of the parameter. The argument for the generic parameter is found // in the specific for the callee, not in the arguments of the SemIR `call`. fn UseF(generic B: bool, x: F(B)); -// CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE+7]]:26: error: type `` of parameter 2 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] -// CHECK:STDERR: fn UseF(generic B: bool, x: bool); -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE-4]]:26: note: previous declaration's corresponding parameter here [RedeclParamPrevious] -// CHECK:STDERR: fn UseF(generic B: bool, x: F(B)); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE+3]]:26-32: error: type `` of parameter 2 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] +// CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE-2]]:26-32: note: previous declaration's corresponding parameter here [RedeclParamPrevious] // CHECK:STDERR: fn UseF(generic B: bool, x: bool); // The arguments of the SemIR `call` are flattened by the nested tuple pattern // in the signature of `G`, and are regrouped here to match the source. fn UseG(generic B: bool, x: G(B, (true, false))); -// CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE+7]]:26: error: type `` of parameter 2 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] -// CHECK:STDERR: fn UseG(generic B: bool, x: bool); -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE-4]]:26: note: previous declaration's corresponding parameter here [RedeclParamPrevious] -// CHECK:STDERR: fn UseG(generic B: bool, x: G(B, (true, false))); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE+3]]:26-32: error: type `` of parameter 2 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] +// CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE-2]]:26-47: note: previous declaration's corresponding parameter here [RedeclParamPrevious] // CHECK:STDERR: fn UseG(generic B: bool, x: bool); @@ -113,21 +103,15 @@ eval fn H(generic B: bool, (a: bool,)) -> type { } fn UseH(generic B: bool, x: H(B, (true,))); -// CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE+7]]:26: error: type `` of parameter 2 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] -// CHECK:STDERR: fn UseH(generic B: bool, x: bool); -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE-4]]:26: note: previous declaration's corresponding parameter here [RedeclParamPrevious] -// CHECK:STDERR: fn UseH(generic B: bool, x: H(B, (true,))); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE+3]]:26-32: error: type `` of parameter 2 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] +// CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE-2]]:26-41: note: previous declaration's corresponding parameter here [RedeclParamPrevious] // CHECK:STDERR: fn UseH(generic B: bool, x: bool); // The `self` argument is the first argument of the SemIR `call`, but is printed // before the name of the method, as it was written. class C { - // CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE+4]]:13: warning: binding `self` unused [UnusedBinding] - // CHECK:STDERR: eval fn M(self: Self, b: bool) -> type { - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE+2]]:13-22: warning: binding `self` unused [UnusedBinding] // CHECK:STDERR: eval fn M(self: Self, b: bool) -> type { if (b) { return (); } @@ -136,12 +120,8 @@ class C { } fn UseM(generic c: C, x: c.M(true)); -// CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE+7]]:23: error: type `` of parameter 2 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] -// CHECK:STDERR: fn UseM(generic c: C, x: bool); -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE-4]]:23: note: previous declaration's corresponding parameter here [RedeclParamPrevious] -// CHECK:STDERR: fn UseM(generic c: C, x: c.M(true)); -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE+3]]:23-29: error: type `` of parameter 2 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] +// CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE-2]]:23-34: note: previous declaration's corresponding parameter here [RedeclParamPrevious] // CHECK:STDERR: fn UseM(generic c: C, x: bool); @@ -154,12 +134,8 @@ impl type as J { } fn UseN(generic T: type, x: (const T).(J.N)()); -// CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE+7]]:26: error: type `` of parameter 2 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] -// CHECK:STDERR: fn UseN(generic T: type, x: bool); -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE-4]]:26: note: previous declaration's corresponding parameter here [RedeclParamPrevious] -// CHECK:STDERR: fn UseN(generic T: type, x: (const T).(J.N)()); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE+3]]:26-32: error: type `` of parameter 2 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] +// CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE-2]]:26-45: note: previous declaration's corresponding parameter here [RedeclParamPrevious] // CHECK:STDERR: fn UseN(generic T: type, x: bool); diff --git a/toolchain/check/testdata/eval/unexpected_runtime.carbon b/toolchain/check/testdata/eval/unexpected_runtime.carbon index f7e633f08cad..a74ec9546ade 100644 --- a/toolchain/check/testdata/eval/unexpected_runtime.carbon +++ b/toolchain/check/testdata/eval/unexpected_runtime.carbon @@ -20,9 +20,7 @@ interface Z { } class D { - // CHECK:STDERR: fail_unexpected_runtime_base.carbon:[[@LINE+4]]:18: error: cannot evaluate type expression [TypeExprEvaluationFailure] - // CHECK:STDERR: extend impl as x where .T = () {} - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_unexpected_runtime_base.carbon:[[@LINE+2]]:18: error: cannot evaluate type expression [TypeExprEvaluationFailure] // CHECK:STDERR: extend impl as x where .T = () {} } @@ -37,13 +35,9 @@ interface Z { } class D { - // CHECK:STDERR: fail_unexpected_runtime_rewrite_lhs.carbon:[[@LINE+8]]:18: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] - // CHECK:STDERR: extend impl as Z where x = () {} - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_unexpected_runtime_rewrite_lhs.carbon:[[@LINE+4]]:18-26: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: - // CHECK:STDERR: fail_unexpected_runtime_rewrite_lhs.carbon:[[@LINE+4]]:28: error: requirement can only use `=` after `.member` designator [RequirementEqualAfterNonDesignator] - // CHECK:STDERR: extend impl as Z where x = () {} - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_unexpected_runtime_rewrite_lhs.carbon:[[@LINE+2]]:28: error: requirement can only use `=` after `.member` designator [RequirementEqualAfterNonDesignator] // CHECK:STDERR: extend impl as Z where x = () {} } @@ -58,9 +52,7 @@ interface Z { } class D { - // CHECK:STDERR: fail_unexpected_runtime_rewrite_rhs.carbon:[[@LINE+4]]:31: error: expression is runtime; expected constant [EvalRequiresConstantValue] - // CHECK:STDERR: extend impl as Z where .T = x {} - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_unexpected_runtime_rewrite_rhs.carbon:[[@LINE+2]]:31: error: expression is runtime; expected constant [EvalRequiresConstantValue] // CHECK:STDERR: extend impl as Z where .T = x {} } @@ -73,9 +65,7 @@ var x: type; interface Z(T: type) {} class D { - // CHECK:STDERR: fail_unexpected_runtime_impls_lhs.carbon:[[@LINE+4]]:29: error: cannot evaluate type expression [TypeExprEvaluationFailure] - // CHECK:STDERR: extend impl as type where x impls Z(.Self) {} - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_unexpected_runtime_impls_lhs.carbon:[[@LINE+2]]:29: error: cannot evaluate type expression [TypeExprEvaluationFailure] // CHECK:STDERR: extend impl as type where x impls Z(.Self) {} } @@ -88,9 +78,7 @@ var x: type; interface Z {} class D { - // CHECK:STDERR: fail_unexpected_runtime_impls_rhs.carbon:[[@LINE+4]]:41: error: cannot evaluate type expression [TypeExprEvaluationFailure] - // CHECK:STDERR: extend impl as type where .Self impls x {} - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_unexpected_runtime_impls_rhs.carbon:[[@LINE+2]]:41: error: cannot evaluate type expression [TypeExprEvaluationFailure] // CHECK:STDERR: extend impl as type where .Self impls x {} } diff --git a/toolchain/check/testdata/facet/access.carbon b/toolchain/check/testdata/facet/access.carbon index f53edcedc3c5..d25094d3664f 100644 --- a/toolchain/check/testdata/facet/access.carbon +++ b/toolchain/check/testdata/facet/access.carbon @@ -148,24 +148,16 @@ fn F(generic U: Core.Destroy & I where .X = .Self) { // member lookup, but can't call methods without `self`. See the // `compound_access_through_call_with_self_param.carbon` test for the former. // - // CHECK:STDERR: fail_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_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: fail_compound_access_through_call.carbon:[[@LINE+3]]:3-9: error: cannot implicitly convert non-type value of type `U` into type implementing `I` [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: fail_compound_access_through_call.carbon:[[@LINE+2]]:3-9: note: type `U` does not implement interface `Core.ImplicitAs(I)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: u.(I.G)(); // This is the same as the above, since G() returns a non-type value of type // `U`. // - // CHECK:STDERR: fail_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)().(I.G)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_compound_access_through_call.carbon:[[@LINE+4]]:3: note: type `U` does not implement interface `Core.ImplicitAs(I)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: U.(I.G)().(I.G)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_compound_access_through_call.carbon:[[@LINE+3]]:3-17: error: cannot implicitly convert non-type value of type `U` into type implementing `I` [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: fail_compound_access_through_call.carbon:[[@LINE+2]]:3-17: note: type `U` does not implement interface `Core.ImplicitAs(I)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: U.(I.G)().(I.G)(); } @@ -201,9 +193,7 @@ fn Id[U: type](x: U) -> U { return Id(x); } impl () as I where .T = () {} // Type of member expr is associated entity type, // but value is not constant. -// CHECK:STDERR: fail_non_const_associated.carbon:[[@LINE+4]]:8: error: semantics TODO: `Non-constant associated entity value` [SemanticsTodo] -// CHECK:STDERR: var v: ().(Id(I.T)); -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_non_const_associated.carbon:[[@LINE+2]]:8-19: error: semantics TODO: `Non-constant associated entity value` [SemanticsTodo] // CHECK:STDERR: var v: ().(Id(I.T)); @@ -214,9 +204,7 @@ fn Id[U: type](x: U) -> U { return Id(x); } interface J { let T: type; - // CHECK:STDERR: fail_non_const_associated_in_interface.carbon:[[@LINE+4]]:13: error: cannot evaluate type expression [TypeExprEvaluationFailure] - // CHECK:STDERR: fn F() -> Id(T); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_non_const_associated_in_interface.carbon:[[@LINE+2]]:13-17: error: cannot evaluate type expression [TypeExprEvaluationFailure] // CHECK:STDERR: fn F() -> Id(T); } @@ -228,9 +216,7 @@ interface I { let T: type; } -// CHECK:STDERR: fail_alias_to_non_const_assoc_entity.carbon:[[@LINE+4]]:8: error: semantics TODO: `HandleAutoTypeLiteral` [SemanticsTodo] -// CHECK:STDERR: let x: auto = I.T; -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_alias_to_non_const_assoc_entity.carbon:[[@LINE+2]]:8-11: error: semantics TODO: `HandleAutoTypeLiteral` [SemanticsTodo] // CHECK:STDERR: let x: auto = I.T; @@ -258,9 +244,7 @@ import library "to_import"; interface J { // extend I; alias V = U; - // CHECK:STDERR: fail_access_alias_in_imported_library.carbon:[[@LINE+4]]:13: error: cannot convert type `Self` that implements `J` into type implementing `I` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fn F() -> V; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_access_alias_in_imported_library.carbon:[[@LINE+2]]:13: error: cannot convert type `Self` that implements `J` into type implementing `I` [ConversionFailureFacetToFacet] // CHECK:STDERR: fn F() -> V; } @@ -307,12 +291,8 @@ constraint N { fn F(generic AA: N) { // TODO: The identified facet type `N` includes `A` and should provide a // same-type constraint `A.X == ()` which would allow this conversion. - // CHECK:STDERR: fail_todo_access_constant_through_named_constraint.carbon:[[@LINE+7]]:3: error: cannot convert expression of type `()` to `AA.(A.X)` with `as` [ConversionFailure] - // CHECK:STDERR: () as AA.X; - // CHECK:STDERR: ^~~~~~~~~~ - // CHECK:STDERR: fail_todo_access_constant_through_named_constraint.carbon:[[@LINE+4]]:3: note: type `()` does not implement interface `Core.As(AA.(A.X))` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: () as AA.X; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_todo_access_constant_through_named_constraint.carbon:[[@LINE+3]]:3-12: error: cannot convert expression of type `()` to `AA.(A.X)` with `as` [ConversionFailure] + // CHECK:STDERR: fail_todo_access_constant_through_named_constraint.carbon:[[@LINE+2]]:3-12: note: type `()` does not implement interface `Core.As(AA.(A.X))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: () as AA.X; } @@ -397,12 +377,8 @@ fn F(generic V: Z(.Self)) { // // TODO: The identified facet type `NX` includes `X` and should provide a // same-type constraint `X.X1 == {}` which would allow this conversion. - // CHECK:STDERR: fail_todo_find_access_value_in_second_nested_access.carbon:[[@LINE+7]]:3: error: cannot convert expression of type `{}` to `V.(Z(V).Z1).(Y(V).Y1).(X.X1)` with `as` [ConversionFailure] - // CHECK:STDERR: {} as V.(Z(V).Z1).(Y(V).Y1).(X.X1); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_find_access_value_in_second_nested_access.carbon:[[@LINE+4]]:3: note: type `{}` does not implement interface `Core.As(V.(Z(V).Z1).(Y(V).Y1).(X.X1))` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: {} as V.(Z(V).Z1).(Y(V).Y1).(X.X1); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_find_access_value_in_second_nested_access.carbon:[[@LINE+3]]:3-36: error: cannot convert expression of type `{}` to `V.(Z(V).Z1).(Y(V).Y1).(X.X1)` with `as` [ConversionFailure] + // CHECK:STDERR: fail_todo_find_access_value_in_second_nested_access.carbon:[[@LINE+2]]:3-36: note: type `{}` does not implement interface `Core.As(V.(Z(V).Z1).(Y(V).Y1).(X.X1))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: {} as V.(Z(V).Z1).(Y(V).Y1).(X.X1); } @@ -440,9 +416,7 @@ fn F(generic V: Z(.Self) where .Z0 impls NY(()) // // TODO: The identified facet type `NX` includes `X` and should provide a // same-type constraint `X.X1 == V` which would allow this conversion. - // CHECK:STDERR: fail_todo_find_access_value_in_third_nested_access.carbon:[[@LINE+4]]:9: error: cannot convert type `V.(Z(V).Z1).(Y.Y1)` into type implementing `X` [ConversionFailureTypeToFacet] - // CHECK:STDERR: {} as V.(Z(V).Z1).(Y.Y1).(X.X1); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_find_access_value_in_third_nested_access.carbon:[[@LINE+2]]:9-33: error: cannot convert type `V.(Z(V).Z1).(Y.Y1)` into type implementing `X` [ConversionFailureTypeToFacet] // CHECK:STDERR: {} as V.(Z(V).Z1).(Y.Y1).(X.X1); } @@ -464,12 +438,8 @@ constraint NY(PeriodSelf: type) { // `(C as Y(T)).Y1` but we currently only look in `C`. See the TODO in // `TryFindValueInRewriteConstraints()`. fn F(generic T: Z where C impls NY(.Self)) -> C.(Y(T).Y1) { - // CHECK:STDERR: fail_todo_find_access_value_in_facet_from_specific_interface.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `{}` to `C.(Y(T).Y1)` [ConversionFailure] - // CHECK:STDERR: return {}; - // CHECK:STDERR: ^~~~~~~~~~ - // CHECK:STDERR: fail_todo_find_access_value_in_facet_from_specific_interface.carbon:[[@LINE+4]]:3: note: type `{}` does not implement interface `Core.ImplicitAs(C.(Y(T).Y1))` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return {}; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_todo_find_access_value_in_facet_from_specific_interface.carbon:[[@LINE+3]]:3-12: error: cannot implicitly convert expression of type `{}` to `C.(Y(T).Y1)` [ConversionFailure] + // CHECK:STDERR: fail_todo_find_access_value_in_facet_from_specific_interface.carbon:[[@LINE+2]]:3-12: note: type `{}` does not implement interface `Core.ImplicitAs(C.(Y(T).Y1))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return {}; } diff --git a/toolchain/check/testdata/facet/aggregate_through_access.carbon b/toolchain/check/testdata/facet/aggregate_through_access.carbon index 280e30e9c06b..909af4ada0a4 100644 --- a/toolchain/check/testdata/facet/aggregate_through_access.carbon +++ b/toolchain/check/testdata/facet/aggregate_through_access.carbon @@ -17,9 +17,7 @@ interface Z { let X: type; } -// CHECK:STDERR: fail_todo_tuple_access_through_witness.carbon:[[@LINE+4]]:41: error: type `type` does not support tuple indexing; only tuples can be indexed that way [TupleIndexOnANonTupleType] -// CHECK:STDERR: fn F(generic T: Z where .X = ({}, )) -> T.X.0 { -// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: fail_todo_tuple_access_through_witness.carbon:[[@LINE+2]]:41-45: error: type `type` does not support tuple indexing; only tuples can be indexed that way [TupleIndexOnANonTupleType] // CHECK:STDERR: fn F(generic T: Z where .X = ({}, )) -> T.X.0 { return {}; @@ -32,9 +30,7 @@ interface Z { let X: type; } -// CHECK:STDERR: fail_todo_struct_access_through_witness.carbon:[[@LINE+4]]:43: error: type `type` does not support qualified expressions [QualifiedExprUnsupported] -// CHECK:STDERR: fn F(generic T: Z where .X = {.t: ()}) -> T.X.t { -// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: fail_todo_struct_access_through_witness.carbon:[[@LINE+2]]:43-47: error: type `type` does not support qualified expressions [QualifiedExprUnsupported] // CHECK:STDERR: fn F(generic T: Z where .X = {.t: ()}) -> T.X.t { return (); @@ -47,9 +43,7 @@ interface Z { let X: type; } -// CHECK:STDERR: fail_todo_array_access_through_witness.carbon:[[@LINE+4]]:47: error: cannot access member of interface `Core.IndexWith(Core.IntLiteral)` in type `type` that does not implement that interface [MissingImplInMemberAccess] -// CHECK:STDERR: fn F(generic T: Z where .X = array({}, 1)) -> T.X[0] { -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_todo_array_access_through_witness.carbon:[[@LINE+2]]:47-52: error: cannot access member of interface `Core.IndexWith(Core.IntLiteral)` in type `type` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: fn F(generic T: Z where .X = array({}, 1)) -> T.X[0] { return {}; diff --git a/toolchain/check/testdata/facet/combine.carbon b/toolchain/check/testdata/facet/combine.carbon index 9144ebe0ebfd..7219d5482db4 100644 --- a/toolchain/check/testdata/facet/combine.carbon +++ b/toolchain/check/testdata/facet/combine.carbon @@ -31,9 +31,7 @@ impl C as B { fn F() { // TODO: This error message is wrong here, we are not using `extend`. - // CHECK:STDERR: fail_name_collision.carbon:[[@LINE+4]]:14: error: ambiguous use of name `G` found in multiple extended scopes [NameAmbiguousDueToExtend] - // CHECK:STDERR: ({} as C).((A & B).G)(); - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_name_collision.carbon:[[@LINE+2]]:14-22: error: ambiguous use of name `G` found in multiple extended scopes [NameAmbiguousDueToExtend] // CHECK:STDERR: ({} as C).((A & B).G)(); } @@ -98,12 +96,8 @@ impl C as B {} fn G[T: A(P2) & B](unused t: T) {} fn F() { - // CHECK:STDERR: fail_wrong_generic_interface.carbon:[[@LINE+7]]:3: error: cannot convert type `C` into type implementing `A(P2) & B` [ConversionFailureTypeToFacet] - // CHECK:STDERR: G({} as C); - // CHECK:STDERR: ^~~~~~~~~~ - // CHECK:STDERR: fail_wrong_generic_interface.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn G[T: A(P2) & B](unused t: T) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_wrong_generic_interface.carbon:[[@LINE+3]]:3-12: error: cannot convert type `C` into type implementing `A(P2) & B` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_wrong_generic_interface.carbon:[[@LINE-4]]:1-33: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: G({} as C); } @@ -179,12 +173,8 @@ interface J {} interface K {} fn Test() { - // CHECK:STDERR: fail_compare_not_equal.carbon:[[@LINE+7]]:3: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent] - // CHECK:STDERR: Same(Type(I & J), Type(K & I & J)); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_compare_not_equal.carbon:[[@LINE-11]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Same[T: type](unused a: WrapType(T), unused b: WrapType(T)) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_compare_not_equal.carbon:[[@LINE+3]]:3-36: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent] + // CHECK:STDERR: fail_compare_not_equal.carbon:[[@LINE-9]]:1-64: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: Same(Type(I & J), Type(K & I & J)); } @@ -200,12 +190,8 @@ interface I {} interface J(T: type) {} fn Test() { - // CHECK:STDERR: fail_compare_not_equal_parameterized.carbon:[[@LINE+7]]:3: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent] - // CHECK:STDERR: Same(Type(I & J(())), Type(J({}) & I)); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_compare_not_equal_parameterized.carbon:[[@LINE-10]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Same[T: type](unused a: WrapType(T), unused b: WrapType(T)) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_compare_not_equal_parameterized.carbon:[[@LINE+3]]:3-40: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent] + // CHECK:STDERR: fail_compare_not_equal_parameterized.carbon:[[@LINE-8]]:1-64: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: Same(Type(I & J(())), Type(J({}) & I)); } @@ -221,12 +207,8 @@ interface I {} interface J(T: type) {} fn Test() { - // CHECK:STDERR: fail_compare_not_equal_parameterized_extra.carbon:[[@LINE+7]]:3: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent] - // CHECK:STDERR: Same(Type(I & J(())), Type(J(()) & J({}) & I)); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_compare_not_equal_parameterized_extra.carbon:[[@LINE-10]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Same[T: type](unused a: WrapType(T), unused b: WrapType(T)) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_compare_not_equal_parameterized_extra.carbon:[[@LINE+3]]:3-48: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent] + // CHECK:STDERR: fail_compare_not_equal_parameterized_extra.carbon:[[@LINE-8]]:1-64: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: Same(Type(I & J(())), Type(J(()) & J({}) & I)); } diff --git a/toolchain/check/testdata/facet/convert_class_value_to_generic_facet_value_value.carbon b/toolchain/check/testdata/facet/convert_class_value_to_generic_facet_value_value.carbon index a0296a2111fb..d652bee09e57 100644 --- a/toolchain/check/testdata/facet/convert_class_value_to_generic_facet_value_value.carbon +++ b/toolchain/check/testdata/facet/convert_class_value_to_generic_facet_value_value.carbon @@ -62,12 +62,8 @@ impl forall [T: type] C as I(T, ()) {} fn A[T: I({}, {})](unused t: T) {} fn B() { - // CHECK:STDERR: fail_mismatch_impl_constraint_with_fixed_specific.carbon:[[@LINE+7]]:3: error: cannot convert type `C` into type implementing `I({}, {})` [ConversionFailureTypeToFacet] - // CHECK:STDERR: A({} as C); - // CHECK:STDERR: ^~~~~~~~~~ - // CHECK:STDERR: fail_mismatch_impl_constraint_with_fixed_specific.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn A[T: I({}, {})](unused t: T) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_mismatch_impl_constraint_with_fixed_specific.carbon:[[@LINE+3]]:3-12: error: cannot convert type `C` into type implementing `I({}, {})` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_mismatch_impl_constraint_with_fixed_specific.carbon:[[@LINE-4]]:1-33: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: A({} as C); } @@ -84,12 +80,8 @@ impl forall [T: type] C(T, ()) as I {} fn A[T: I](unused t: T) {} fn B() { - // CHECK:STDERR: fail_mismatch_impl_self_with_fixed_specific.carbon:[[@LINE+7]]:3: error: cannot convert type `C({}, {})` into type implementing `I` [ConversionFailureTypeToFacet] - // CHECK:STDERR: A({} as C({}, {})); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_mismatch_impl_self_with_fixed_specific.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn A[T: I](unused t: T) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_mismatch_impl_self_with_fixed_specific.carbon:[[@LINE+3]]:3-20: error: cannot convert type `C({}, {})` into type implementing `I` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_mismatch_impl_self_with_fixed_specific.carbon:[[@LINE-4]]:1-25: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: A({} as C({}, {})); } @@ -1157,11 +1149,11 @@ fn B() { // CHECK:STDOUT: fn @B() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref: %A.type = name_ref A, file.%A.decl [concrete = constants.%A] -// CHECK:STDOUT: %.loc19_6.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc15_6.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc19_6.2: ref %C = temporary_storage -// CHECK:STDOUT: %.loc19_6.3: init %C to %.loc19_6.2 = class_init () [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc19_8: init %C = converted %.loc19_6.1, %.loc19_6.3 [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc15_6.2: ref %C = temporary_storage +// CHECK:STDOUT: %.loc15_6.3: init %C to %.loc15_6.2 = class_init () [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc15_8: init %C = converted %.loc15_6.1, %.loc15_6.3 [concrete = constants.%C.val] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1395,16 +1387,16 @@ fn B() { // CHECK:STDOUT: fn @B() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref: %A.type = name_ref A, file.%A.decl [concrete = constants.%A] -// CHECK:STDOUT: %.loc19_6.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc15_6.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [concrete = constants.%C.generic] -// CHECK:STDOUT: %.loc19_14: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc19_18: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc19_19.1: type = converted %.loc19_14, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %.loc19_19.2: type = converted %.loc19_18, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc15_14: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc15_18: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc15_19.1: type = converted %.loc15_14, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc15_19.2: type = converted %.loc15_18, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%empty_struct_type, constants.%empty_struct_type) [concrete = constants.%C.35b] -// CHECK:STDOUT: %.loc19_6.2: ref %C.35b = temporary_storage -// CHECK:STDOUT: %.loc19_6.3: init %C.35b to %.loc19_6.2 = class_init () [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc19_8: init %C.35b = converted %.loc19_6.1, %.loc19_6.3 [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc15_6.2: ref %C.35b = temporary_storage +// CHECK:STDOUT: %.loc15_6.3: init %C.35b to %.loc15_6.2 = class_init () [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc15_8: init %C.35b = converted %.loc15_6.1, %.loc15_6.3 [concrete = constants.%C.val] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/facet/convert_facet_type_to_facet_value.carbon b/toolchain/check/testdata/facet/convert_facet_type_to_facet_value.carbon index 2509f201e18b..f17f3fc58317 100644 --- a/toolchain/check/testdata/facet/convert_facet_type_to_facet_value.carbon +++ b/toolchain/check/testdata/facet/convert_facet_type_to_facet_value.carbon @@ -40,12 +40,8 @@ class Goat {} impl Goat as Animal {} fn F() { - // CHECK:STDERR: fail_facet_value_to_facet_type.carbon:[[@LINE+7]]:3: error: cannot convert type `Goat as Animal` that implements `Animal` into type implementing `Eats` [ConversionFailureFacetToFacet] - // CHECK:STDERR: Feed(Goat as Animal); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_facet_value_to_facet_type.carbon:[[@LINE-8]]:24: note: initializing generic parameter `e` declared here [InitializingGenericParam] - // CHECK:STDERR: fn Feed(unused generic e: Eats) {} - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_facet_value_to_facet_type.carbon:[[@LINE+3]]:3-22: error: cannot convert type `Goat as Animal` that implements `Animal` into type implementing `Eats` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_facet_value_to_facet_type.carbon:[[@LINE-6]]:24-30: note: initializing generic parameter `e` declared here [InitializingGenericParam] // CHECK:STDERR: Feed(Goat as Animal); } @@ -69,21 +65,13 @@ impl Goat as Climbs {} // These are expected to fail: // https://github.com/carbon-language/carbon-lang/issues/4853#issuecomment-2707673344 fn F() { - // CHECK:STDERR: fail_convert_multi_interface_facet_value_to_facet_value.carbon:[[@LINE+7]]:3: error: cannot convert type `Goat as Animal & Climbs` that implements `Animal & Climbs` into type implementing `Eats` [ConversionFailureFacetToFacet] - // CHECK:STDERR: Feed(Goat as (Animal & Climbs)); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_convert_multi_interface_facet_value_to_facet_value.carbon:[[@LINE-11]]:24: note: initializing generic parameter `e` declared here [InitializingGenericParam] - // CHECK:STDERR: fn Feed(unused generic e: Eats) {} - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_convert_multi_interface_facet_value_to_facet_value.carbon:[[@LINE+3]]:3-33: error: cannot convert type `Goat as Animal & Climbs` that implements `Animal & Climbs` into type implementing `Eats` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_convert_multi_interface_facet_value_to_facet_value.carbon:[[@LINE-9]]:24-30: note: initializing generic parameter `e` declared here [InitializingGenericParam] // CHECK:STDERR: Feed(Goat as (Animal & Climbs)); - // CHECK:STDERR: fail_convert_multi_interface_facet_value_to_facet_value.carbon:[[@LINE+7]]:3: error: cannot convert type `Animal & Climbs` into type implementing `Eats` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Feed(Animal & Climbs); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_convert_multi_interface_facet_value_to_facet_value.carbon:[[@LINE-20]]:24: note: initializing generic parameter `e` declared here [InitializingGenericParam] - // CHECK:STDERR: fn Feed(unused generic e: Eats) {} - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_convert_multi_interface_facet_value_to_facet_value.carbon:[[@LINE+3]]:3-23: error: cannot convert type `Animal & Climbs` into type implementing `Eats` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_convert_multi_interface_facet_value_to_facet_value.carbon:[[@LINE-14]]:24-30: note: initializing generic parameter `e` declared here [InitializingGenericParam] // CHECK:STDERR: Feed(Animal & Climbs); } diff --git a/toolchain/check/testdata/facet/early_impls.carbon b/toolchain/check/testdata/facet/early_impls.carbon index 0930265156a0..d361c69d861c 100644 --- a/toolchain/check/testdata/facet/early_impls.carbon +++ b/toolchain/check/testdata/facet/early_impls.carbon @@ -195,9 +195,7 @@ constraint N(V: type) { // `C impls N(.Z1)` gives `.Z1 impls Y(C)`. // -// CHECK:STDERR: fail_early_impl_named_constraint_gives_wrong_witness_for_different_self.carbon:[[@LINE+4]]:58: error: cannot convert type `.(Z(.Self).Z1)` into type implementing `Y(.Self)` [ConversionFailureTypeToFacet] -// CHECK:STDERR: fn F(generic _: Z(.Self) where C impls N(.Z1) and .Z2 = (.Z1 as Y(.Self))) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_early_impl_named_constraint_gives_wrong_witness_for_different_self.carbon:[[@LINE+2]]:58-72: error: cannot convert type `.(Z(.Self).Z1)` into type implementing `Y(.Self)` [ConversionFailureTypeToFacet] // CHECK:STDERR: fn F(generic _: Z(.Self) where C impls N(.Z1) and .Z2 = (.Z1 as Y(.Self))) {} @@ -267,12 +265,8 @@ interface S(T: type); // there should be replaced during the conversion. We show that it was replaced // because the `C impls Z(.Self)` constraint does not satisfy `C as Z(C)` so the // conversion fails. -// CHECK:STDERR: fail_early_impls_with_period_self_replaced.carbon:[[@LINE+7]]:56: error: cannot convert type `C` into type implementing `Z(.Self)` [ConversionFailureTypeToFacet] -// CHECK:STDERR: fn F(unused generic T: type where C impls Z(.Self) and NeedZ(C) impls S(.Self)) {} -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_early_impls_with_period_self_replaced.carbon:[[@LINE-12]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: class NeedZ(V: Z(.Self)); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_early_impls_with_period_self_replaced.carbon:[[@LINE+3]]:56-63: error: cannot convert type `C` into type implementing `Z(.Self)` [ConversionFailureTypeToFacet] +// CHECK:STDERR: fail_early_impls_with_period_self_replaced.carbon:[[@LINE-10]]:1-25: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: fn F(unused generic T: type where C impls Z(.Self) and NeedZ(C) impls S(.Self)) {} diff --git a/toolchain/check/testdata/facet/early_rewrites.carbon b/toolchain/check/testdata/facet/early_rewrites.carbon index 2a287a72ec2d..f7863a154da5 100644 --- a/toolchain/check/testdata/facet/early_rewrites.carbon +++ b/toolchain/check/testdata/facet/early_rewrites.carbon @@ -29,12 +29,8 @@ class C(T: Z where .Z1 = ()) {} interface J { // Implied: .Z1 == () - // CHECK:STDERR: fail_todo_implied_constraint_on_self.carbon:[[@LINE+7]]:25: error: cannot convert type `.Self` that implements `Z` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] - // CHECK:STDERR: let J1: Z where .Z2 = C(.Self); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_todo_implied_constraint_on_self.carbon:[[@LINE-7]]:9: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: class C(T: Z where .Z1 = ()) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_implied_constraint_on_self.carbon:[[@LINE+3]]:25-32: error: cannot convert type `.Self` that implements `Z` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_todo_implied_constraint_on_self.carbon:[[@LINE-5]]:9-27: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: let J1: Z where .Z2 = C(.Self); } @@ -43,12 +39,8 @@ fn F(unused generic T: J) {} class D; // Satisfies the implied constraint in J.J1. -// CHECK:STDERR: fail_todo_implied_constraint_on_self.carbon:[[@LINE+7]]:38: error: cannot convert type `.Self` that implements `Z` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] -// CHECK:STDERR: impl D as Z where .Z1 = () and .Z2 = C(.Self) {} -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_todo_implied_constraint_on_self.carbon:[[@LINE-21]]:9: note: initializing generic parameter `T` declared here [InitializingGenericParam] -// CHECK:STDERR: class C(T: Z where .Z1 = ()) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_implied_constraint_on_self.carbon:[[@LINE+3]]:38-45: error: cannot convert type `.Self` that implements `Z` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] +// CHECK:STDERR: fail_todo_implied_constraint_on_self.carbon:[[@LINE-15]]:9-27: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: impl D as Z where .Z1 = () and .Z2 = C(.Self) {} fn G(generic T: J where .J1 = D) { @@ -70,12 +62,8 @@ class C(T: Tuple) {} interface J { // Implied: .Z1 impls Tuple - // CHECK:STDERR: fail_todo_implied_constraint_on_associated_constant.carbon:[[@LINE+7]]:25: error: cannot convert type `.(Z.Z1)` into type implementing `Tuple` [ConversionFailureTypeToFacet] - // CHECK:STDERR: let J1: Z where .Z2 = C(.Z1); - // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_todo_implied_constraint_on_associated_constant.carbon:[[@LINE-7]]:9: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: class C(T: Tuple) {} - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_todo_implied_constraint_on_associated_constant.carbon:[[@LINE+3]]:25-30: error: cannot convert type `.(Z.Z1)` into type implementing `Tuple` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_todo_implied_constraint_on_associated_constant.carbon:[[@LINE-5]]:9-16: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: let J1: Z where .Z2 = C(.Z1); } @@ -113,15 +101,9 @@ class D; // // TODO: Right now the type of `U` ends up with an ImplSelfWitness // which does not resolve the access. So () can't convert to it. -// CHECK:STDERR: fail_todo_period_self_used_in_access_in_nested_specific.carbon:[[@LINE+10]]:38: error: cannot implicitly convert expression of type `type` to `.(Z.Z1)` [ConversionFailure] -// CHECK:STDERR: impl D as Z where .Z1 = () and .Z2 = C(.Self, .Z1) {} -// CHECK:STDERR: ^~~~~~~~~~~~~ -// CHECK:STDERR: fail_todo_period_self_used_in_access_in_nested_specific.carbon:[[@LINE+7]]:38: note: type `type` does not implement interface `Core.ImplicitAs(.(Z.Z1))` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: impl D as Z where .Z1 = () and .Z2 = C(.Self, .Z1) {} -// CHECK:STDERR: ^~~~~~~~~~~~~ -// CHECK:STDERR: fail_todo_period_self_used_in_access_in_nested_specific.carbon:[[@LINE-19]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: class C(T: Z & Y, U: T.(Z.Z1)) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_period_self_used_in_access_in_nested_specific.carbon:[[@LINE+4]]:38-50: error: cannot implicitly convert expression of type `type` to `.(Z.Z1)` [ConversionFailure] +// CHECK:STDERR: fail_todo_period_self_used_in_access_in_nested_specific.carbon:[[@LINE+3]]:38-50: note: type `type` does not implement interface `Core.ImplicitAs(.(Z.Z1))` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: fail_todo_period_self_used_in_access_in_nested_specific.carbon:[[@LINE-15]]:1-32: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: impl D as Z where .Z1 = () and .Z2 = C(.Self, .Z1) {} @@ -149,15 +131,9 @@ class D; // // TODO: Right now the type of `U` ends up with an ImplSelfWitness // which does not resolve the access. So `.Z1` can't convert to it. -// CHECK:STDERR: fail_todo_period_self_used_in_access_in_nested_specific_before_rewrite_of_access.carbon:[[@LINE+10]]:25: error: cannot implicitly convert expression of type `type` to `.(Z.Z1)` [ConversionFailure] -// CHECK:STDERR: impl D as Z where .Z2 = C(.Self, .Z1) and .Z1 = () {} -// CHECK:STDERR: ^~~~~~~~~~~~~ -// CHECK:STDERR: fail_todo_period_self_used_in_access_in_nested_specific_before_rewrite_of_access.carbon:[[@LINE+7]]:25: note: type `type` does not implement interface `Core.ImplicitAs(.(Z.Z1))` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: impl D as Z where .Z2 = C(.Self, .Z1) and .Z1 = () {} -// CHECK:STDERR: ^~~~~~~~~~~~~ -// CHECK:STDERR: fail_todo_period_self_used_in_access_in_nested_specific_before_rewrite_of_access.carbon:[[@LINE-19]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: class C(T: Z & Y, U: T.(Z.Z1)) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_period_self_used_in_access_in_nested_specific_before_rewrite_of_access.carbon:[[@LINE+4]]:25-37: error: cannot implicitly convert expression of type `type` to `.(Z.Z1)` [ConversionFailure] +// CHECK:STDERR: fail_todo_period_self_used_in_access_in_nested_specific_before_rewrite_of_access.carbon:[[@LINE+3]]:25-37: note: type `type` does not implement interface `Core.ImplicitAs(.(Z.Z1))` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: fail_todo_period_self_used_in_access_in_nested_specific_before_rewrite_of_access.carbon:[[@LINE-15]]:1-32: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: impl D as Z where .Z2 = C(.Self, .Z1) and .Z1 = () {} @@ -173,12 +149,8 @@ class C(T: Z where .Z1 = ()) {} interface J { // Implied: .Z1 == (), but this is also explicitly required for J1. - // CHECK:STDERR: fail_todo_nested_constraint_visible_in_type_parameter.carbon:[[@LINE+7]]:42: error: cannot convert type `.Self` that implements `Z` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] - // CHECK:STDERR: let J1: (Z where .Z1 = ()) where .Z2 = C(.Self); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_todo_nested_constraint_visible_in_type_parameter.carbon:[[@LINE-7]]:9: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: class C(T: Z where .Z1 = ()) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_nested_constraint_visible_in_type_parameter.carbon:[[@LINE+3]]:42-49: error: cannot convert type `.Self` that implements `Z` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_todo_nested_constraint_visible_in_type_parameter.carbon:[[@LINE-5]]:9-27: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: let J1: (Z where .Z1 = ()) where .Z2 = C(.Self); } @@ -187,12 +159,8 @@ fn F(unused generic T: J) {} class D; // Satisfies the implied constraint in J.J1. -// CHECK:STDERR: fail_todo_nested_constraint_visible_in_type_parameter.carbon:[[@LINE+7]]:38: error: cannot convert type `.Self` that implements `Z` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] -// CHECK:STDERR: impl D as Z where .Z1 = () and .Z2 = C(.Self) {} -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_todo_nested_constraint_visible_in_type_parameter.carbon:[[@LINE-21]]:9: note: initializing generic parameter `T` declared here [InitializingGenericParam] -// CHECK:STDERR: class C(T: Z where .Z1 = ()) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_nested_constraint_visible_in_type_parameter.carbon:[[@LINE+3]]:38-45: error: cannot convert type `.Self` that implements `Z` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] +// CHECK:STDERR: fail_todo_nested_constraint_visible_in_type_parameter.carbon:[[@LINE-15]]:9-27: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: impl D as Z where .Z1 = () and .Z2 = C(.Self) {} fn G(generic T: J where .J1 = D) { @@ -211,12 +179,8 @@ class C(T: Z where .Z1 = ()) {} interface J { // Implied: .Z1 == (), but this is also explicitly required for J1. - // CHECK:STDERR: fail_todo_outer_nested_constraint_visible_in_type_parameter.carbon:[[@LINE+7]]:26: error: cannot convert type `.Self` that implements `Z` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] - // CHECK:STDERR: let J1: (Z where .Z2 = C(.Self)) where .Z1 = (); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_todo_outer_nested_constraint_visible_in_type_parameter.carbon:[[@LINE-7]]:9: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: class C(T: Z where .Z1 = ()) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_outer_nested_constraint_visible_in_type_parameter.carbon:[[@LINE+3]]:26-33: error: cannot convert type `.Self` that implements `Z` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_todo_outer_nested_constraint_visible_in_type_parameter.carbon:[[@LINE-5]]:9-27: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: let J1: (Z where .Z2 = C(.Self)) where .Z1 = (); } @@ -225,12 +189,8 @@ fn F(unused generic T: J) {} class D; // Satisfies the implied constraint in J.J1. -// CHECK:STDERR: fail_todo_outer_nested_constraint_visible_in_type_parameter.carbon:[[@LINE+7]]:38: error: cannot convert type `.Self` that implements `Z` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] -// CHECK:STDERR: impl D as Z where .Z1 = () and .Z2 = C(.Self) {} -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_todo_outer_nested_constraint_visible_in_type_parameter.carbon:[[@LINE-21]]:9: note: initializing generic parameter `T` declared here [InitializingGenericParam] -// CHECK:STDERR: class C(T: Z where .Z1 = ()) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_outer_nested_constraint_visible_in_type_parameter.carbon:[[@LINE+3]]:38-45: error: cannot convert type `.Self` that implements `Z` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] +// CHECK:STDERR: fail_todo_outer_nested_constraint_visible_in_type_parameter.carbon:[[@LINE-15]]:9-27: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: impl D as Z where .Z1 = () and .Z2 = C(.Self) {} fn G(generic T: J where .J1 = D) { @@ -249,12 +209,8 @@ class C(T: Z where .Z1 = ()) {} interface J { // Implied: .Z1 == (), but this is also explicitly required for J1. - // CHECK:STDERR: fail_todo_earlier_constraint_visible_in_type_parameter.carbon:[[@LINE+7]]:38: error: cannot convert type `.Self` that implements `Z` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] - // CHECK:STDERR: let J1: Z where .Z1 = () and .Z2 = C(.Self); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_todo_earlier_constraint_visible_in_type_parameter.carbon:[[@LINE-7]]:9: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: class C(T: Z where .Z1 = ()) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_earlier_constraint_visible_in_type_parameter.carbon:[[@LINE+3]]:38-45: error: cannot convert type `.Self` that implements `Z` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_todo_earlier_constraint_visible_in_type_parameter.carbon:[[@LINE-5]]:9-27: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: let J1: Z where .Z1 = () and .Z2 = C(.Self); } @@ -263,12 +219,8 @@ fn F(unused generic T: J) {} class D; // Satisfies the implied constraint in J.J1. -// CHECK:STDERR: fail_todo_earlier_constraint_visible_in_type_parameter.carbon:[[@LINE+7]]:38: error: cannot convert type `.Self` that implements `Z` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] -// CHECK:STDERR: impl D as Z where .Z1 = () and .Z2 = C(.Self) {} -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_todo_earlier_constraint_visible_in_type_parameter.carbon:[[@LINE-21]]:9: note: initializing generic parameter `T` declared here [InitializingGenericParam] -// CHECK:STDERR: class C(T: Z where .Z1 = ()) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_earlier_constraint_visible_in_type_parameter.carbon:[[@LINE+3]]:38-45: error: cannot convert type `.Self` that implements `Z` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] +// CHECK:STDERR: fail_todo_earlier_constraint_visible_in_type_parameter.carbon:[[@LINE-15]]:9-27: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: impl D as Z where .Z1 = () and .Z2 = C(.Self) {} fn G(generic T: J where .J1 = D) { @@ -287,12 +239,8 @@ class C(T: Z where .Z1 = ()) {} interface J { // Implied: .Z1 == (), but this is also explicitly required for J1. - // CHECK:STDERR: fail_todo_later_constraint_visible_in_type_parameter.carbon:[[@LINE+7]]:25: error: cannot convert type `.Self` that implements `Z` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] - // CHECK:STDERR: let J1: Z where .Z2 = C(.Self) and .Z1 = (); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_todo_later_constraint_visible_in_type_parameter.carbon:[[@LINE-7]]:9: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: class C(T: Z where .Z1 = ()) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_later_constraint_visible_in_type_parameter.carbon:[[@LINE+3]]:25-32: error: cannot convert type `.Self` that implements `Z` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_todo_later_constraint_visible_in_type_parameter.carbon:[[@LINE-5]]:9-27: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: let J1: Z where .Z2 = C(.Self) and .Z1 = (); } @@ -301,12 +249,8 @@ fn F(unused generic T: J) {} class D; // Satisfies the implied constraint in J.J1. -// CHECK:STDERR: fail_todo_later_constraint_visible_in_type_parameter.carbon:[[@LINE+7]]:38: error: cannot convert type `.Self` that implements `Z` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] -// CHECK:STDERR: impl D as Z where .Z1 = () and .Z2 = C(.Self) {} -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_todo_later_constraint_visible_in_type_parameter.carbon:[[@LINE-21]]:9: note: initializing generic parameter `T` declared here [InitializingGenericParam] -// CHECK:STDERR: class C(T: Z where .Z1 = ()) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_later_constraint_visible_in_type_parameter.carbon:[[@LINE+3]]:38-45: error: cannot convert type `.Self` that implements `Z` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] +// CHECK:STDERR: fail_todo_later_constraint_visible_in_type_parameter.carbon:[[@LINE-15]]:9-27: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: impl D as Z where .Z1 = () and .Z2 = C(.Self) {} fn G(generic T: J where .J1 = D) { @@ -443,14 +387,10 @@ fn F(unused generic T: J) {} class D; // Satisfies the implied constraint in J.J1. impl D as Y where .Y1 = () {} -// CHECK:STDERR: fail_todo_resolved_constraint_visible_in_type_parameter.carbon:[[@LINE+4]]:25: error: cannot convert type `.Self` that implements `Z` into type implementing `Y` [ConversionFailureFacetToFacet] -// CHECK:STDERR: impl D as Z where .Z1 = .Self and .Z2 = () and .Z3 = C(()) {} -// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: fail_todo_resolved_constraint_visible_in_type_parameter.carbon:[[@LINE+2]]:25-29: error: cannot convert type `.Self` that implements `Z` into type implementing `Y` [ConversionFailureFacetToFacet] // CHECK:STDERR: impl D as Z where .Z1 = .Self and .Z2 = () and .Z3 = C(()) {} -// CHECK:STDERR: fail_todo_resolved_constraint_visible_in_type_parameter.carbon:[[@LINE+4]]:31: error: cannot convert type `D` into type implementing `Y & Z where .(Y.Y1) = () and .(Z.Z1) = .Self as Y and .(Z.Z2) = () and .(Z.Z3) = C(() as Tuple)` [ConversionFailureTypeToFacet] -// CHECK:STDERR: fn G(generic T: J where .J1 = D) { -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_todo_resolved_constraint_visible_in_type_parameter.carbon:[[@LINE+2]]:31: error: cannot convert type `D` into type implementing `Y & Z where .(Y.Y1) = () and .(Z.Z1) = .Self as Y and .(Z.Z2) = () and .(Z.Z3) = C(() as Tuple)` [ConversionFailureTypeToFacet] // CHECK:STDERR: fn G(generic T: J where .J1 = D) { F(T); @@ -475,12 +415,8 @@ constraint NY(V: type) { extend require impls Y where .Y1 = V; } -// CHECK:STDERR: fail_todo_early_rewrite_from_previous_impls_constraint.carbon:[[@LINE+7]]:59: error: cannot convert type `.(Z.Z1).(Y.Y1)` into type implementing `Tuple` [ConversionFailureTypeToFacet] -// CHECK:STDERR: fn F(unused generic T: Z where .Z1 impls NY(()) and .Z2 = C(.Z1.(Y.Y1))) {} -// CHECK:STDERR: ^~~~~~~~~~~~~ -// CHECK:STDERR: fail_todo_early_rewrite_from_previous_impls_constraint.carbon:[[@LINE-9]]:9: note: initializing generic parameter `U` declared here [InitializingGenericParam] -// CHECK:STDERR: class C(U: Tuple); -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_todo_early_rewrite_from_previous_impls_constraint.carbon:[[@LINE+3]]:59-71: error: cannot convert type `.(Z.Z1).(Y.Y1)` into type implementing `Tuple` [ConversionFailureTypeToFacet] +// CHECK:STDERR: fail_todo_early_rewrite_from_previous_impls_constraint.carbon:[[@LINE-7]]:9-16: note: initializing generic parameter `U` declared here [InitializingGenericParam] // CHECK:STDERR: fn F(unused generic T: Z where .Z1 impls NY(()) and .Z2 = C(.Z1.(Y.Y1))) {} @@ -506,12 +442,8 @@ constraint NY(V: type) { // This should fail: `T.(Y.Y1)` is rewritten to be `()` but `T.(Z.Z1).(Y.Y1)` // is used in the argument to `C`. // -// CHECK:STDERR: fail_early_rewrite_correct_interface_wrong_self_access_rewrite_in_period_self.carbon:[[@LINE+7]]:77: error: cannot convert type `.(Z.Z1).(Y.Y1)` into type implementing `Tuple` [ConversionFailureTypeToFacet] -// CHECK:STDERR: fn F(unused generic T: Z where .Self impls NY(()) and .Z1 impls Y and .Z2 = C(.Z1.(Y.Y1))) {} -// CHECK:STDERR: ^~~~~~~~~~~~~ -// CHECK:STDERR: fail_early_rewrite_correct_interface_wrong_self_access_rewrite_in_period_self.carbon:[[@LINE-12]]:9: note: initializing generic parameter `U` declared here [InitializingGenericParam] -// CHECK:STDERR: class C(U: Tuple); -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_early_rewrite_correct_interface_wrong_self_access_rewrite_in_period_self.carbon:[[@LINE+3]]:77-89: error: cannot convert type `.(Z.Z1).(Y.Y1)` into type implementing `Tuple` [ConversionFailureTypeToFacet] +// CHECK:STDERR: fail_early_rewrite_correct_interface_wrong_self_access_rewrite_in_period_self.carbon:[[@LINE-10]]:9-16: note: initializing generic parameter `U` declared here [InitializingGenericParam] // CHECK:STDERR: fn F(unused generic T: Z where .Self impls NY(()) and .Z1 impls Y and .Z2 = C(.Z1.(Y.Y1))) {} @@ -537,9 +469,7 @@ constraint NY(V: type) { // This should fail: `T.(Z.Z1).(Y.Y1)` is rewritten to be `()` but `T.(Y.Y1)` is used // in the argument to `C`. // -// CHECK:STDERR: fail_early_rewrite_correct_interface_wrong_self_access_rewrite_in_associated_constant.carbon:[[@LINE+4]]:79: error: name `Self` not found [NameNotFound] -// CHECK:STDERR: fn G(unused generic T: Z where .Z1 impls NY(()) and .Self impls Y and .Z2 = C(Self.(Y.Y1))) {} -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_early_rewrite_correct_interface_wrong_self_access_rewrite_in_associated_constant.carbon:[[@LINE+2]]:79-82: error: name `Self` not found [NameNotFound] // CHECK:STDERR: fn G(unused generic T: Z where .Z1 impls NY(()) and .Self impls Y and .Z2 = C(Self.(Y.Y1))) {} @@ -559,12 +489,8 @@ fn F(generic T: Z where .Y = {} and .X = NZ(.Y), generic U: T.X) -> U.(Z.X) { // This should fail: `U: T.X` contains a rewrite `.X = .Y` in its type, but // the value of `U.(Z.Y)` is not known. Only `T.(Z.Y)` is rewritten to `{}`. // - // CHECK:STDERR: fail_nested_facet_type_in_rewrite_does_not_use_rewrite_from_outside.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `{}` to `U.(Z.X)` [ConversionFailure] - // CHECK:STDERR: return {}; - // CHECK:STDERR: ^~~~~~~~~~ - // CHECK:STDERR: fail_nested_facet_type_in_rewrite_does_not_use_rewrite_from_outside.carbon:[[@LINE+4]]:3: note: type `{}` does not implement interface `Core.ImplicitAs(U.(Z.X))` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return {}; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_nested_facet_type_in_rewrite_does_not_use_rewrite_from_outside.carbon:[[@LINE+3]]:3-12: error: cannot implicitly convert expression of type `{}` to `U.(Z.X)` [ConversionFailure] + // CHECK:STDERR: fail_nested_facet_type_in_rewrite_does_not_use_rewrite_from_outside.carbon:[[@LINE+2]]:3-12: note: type `{}` does not implement interface `Core.ImplicitAs(U.(Z.X))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return {}; } diff --git a/toolchain/check/testdata/facet/facet_assoc_const.carbon b/toolchain/check/testdata/facet/facet_assoc_const.carbon index 5724668b6a85..f082da21438c 100644 --- a/toolchain/check/testdata/facet/facet_assoc_const.carbon +++ b/toolchain/check/testdata/facet/facet_assoc_const.carbon @@ -29,9 +29,7 @@ library "[[@TEST_NAME]]"; interface L { let W: type; } -// CHECK:STDERR: fail_two_different.carbon:[[@LINE+4]]:24: error: associated constant `.(L.W)` given two different values `{}` and `()` [AssociatedConstantWithDifferentValues] -// CHECK:STDERR: fn F(unused generic T: L where .W = {} and .W = ()) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_two_different.carbon:[[@LINE+2]]:24-50: error: associated constant `.(L.W)` given two different values `{}` and `()` [AssociatedConstantWithDifferentValues] // CHECK:STDERR: fn F(unused generic T: L where .W = {} and .W = ()) {} @@ -40,9 +38,7 @@ library "[[@TEST_NAME]]"; interface L { let W: type; let X: type; } -// CHECK:STDERR: fail_two_different_first_associated.carbon:[[@LINE+4]]:24: error: associated constant `.(L.W)` given two different values `()` and `.(L.X)` [AssociatedConstantWithDifferentValues] -// CHECK:STDERR: fn F(unused generic T: L where .W = .X and .W = ()) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_two_different_first_associated.carbon:[[@LINE+2]]:24-50: error: associated constant `.(L.W)` given two different values `()` and `.(L.X)` [AssociatedConstantWithDifferentValues] // CHECK:STDERR: fn F(unused generic T: L where .W = .X and .W = ()) {} @@ -51,9 +47,7 @@ library "[[@TEST_NAME]]"; interface L { let W: type; let X: type; } -// CHECK:STDERR: fail_two_different_second_associated.carbon:[[@LINE+4]]:24: error: associated constant `.(L.W)` given two different values `()` and `.(L.X)` [AssociatedConstantWithDifferentValues] -// CHECK:STDERR: fn F(unused generic T: L where .W = () and .W = .X) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_two_different_second_associated.carbon:[[@LINE+2]]:24-50: error: associated constant `.(L.W)` given two different values `()` and `.(L.X)` [AssociatedConstantWithDifferentValues] // CHECK:STDERR: fn F(unused generic T: L where .W = () and .W = .X) {} @@ -62,9 +56,7 @@ library "[[@TEST_NAME]]"; interface L { let W: type; } -// CHECK:STDERR: fail_two_different_first_bad.carbon:[[@LINE+4]]:37: error: name `BAD5` not found [NameNotFound] -// CHECK:STDERR: fn F(unused generic T: L where .W = BAD5 and .W = ()) {} -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_two_different_first_bad.carbon:[[@LINE+2]]:37-40: error: name `BAD5` not found [NameNotFound] // CHECK:STDERR: fn F(unused generic T: L where .W = BAD5 and .W = ()) {} @@ -73,9 +65,7 @@ library "[[@TEST_NAME]]"; interface L { let W: type; } -// CHECK:STDERR: fail_two_different_second_bad.carbon:[[@LINE+4]]:49: error: name `BAD6` not found [NameNotFound] -// CHECK:STDERR: fn F(unused generic T: L where .W = {} and .W = BAD6) {} -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_two_different_second_bad.carbon:[[@LINE+2]]:49-52: error: name `BAD6` not found [NameNotFound] // CHECK:STDERR: fn F(unused generic T: L where .W = {} and .W = BAD6) {} @@ -84,13 +74,9 @@ library "[[@TEST_NAME]]"; interface L { let W: type; } -// CHECK:STDERR: fail_two_different_both_bad.carbon:[[@LINE+8]]:37: error: name `BAD7` not found [NameNotFound] -// CHECK:STDERR: fn F(unused generic T: L where .W = BAD7 and .W = BAD8) {} -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_two_different_both_bad.carbon:[[@LINE+4]]:37-40: error: name `BAD7` not found [NameNotFound] // CHECK:STDERR: -// CHECK:STDERR: fail_two_different_both_bad.carbon:[[@LINE+4]]:51: error: name `BAD8` not found [NameNotFound] -// CHECK:STDERR: fn F(unused generic T: L where .W = BAD7 and .W = BAD8) {} -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_two_different_both_bad.carbon:[[@LINE+2]]:51-54: error: name `BAD8` not found [NameNotFound] // CHECK:STDERR: fn F(unused generic T: L where .W = BAD7 and .W = BAD8) {} @@ -99,9 +85,7 @@ library "[[@TEST_NAME]]"; interface L { let W: type; } -// CHECK:STDERR: fail_two_different_combined_from_bitand.carbon:[[@LINE+4]]:24: error: associated constant `.(L.W)` given two different values `{}` and `()` [AssociatedConstantWithDifferentValues] -// CHECK:STDERR: fn F(unused generic T: (L where .W = {}) & (L where .W = ())) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_two_different_combined_from_bitand.carbon:[[@LINE+2]]:24-60: error: associated constant `.(L.W)` given two different values `{}` and `()` [AssociatedConstantWithDifferentValues] // CHECK:STDERR: fn F(unused generic T: (L where .W = {}) & (L where .W = ())) {} @@ -145,12 +129,8 @@ fn F(generic T: M & (L where .W = {}), a: T.W) { // likely to show up in diagnostics? Or should we diagnose `T` as being // invalid directly, where we can see both `.W` values and print them? // - // CHECK:STDERR: fail_two_different_combined_from_final_impl_and_facet.carbon:[[@LINE+7]]:22: error: cannot convert type `T` that implements `L & M where .(L.W) = {}` into type implementing `L where .(L.W) = {}` [ConversionFailureFacetToFacet] - // CHECK:STDERR: let unused c: {} = H(T, a); - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_two_different_combined_from_final_impl_and_facet.carbon:[[@LINE-15]]:14: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn H(generic T: L where .W = {}, a: T.W) -> {} { return a; } - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_two_different_combined_from_final_impl_and_facet.carbon:[[@LINE+3]]:22-28: error: cannot convert type `T` that implements `L & M where .(L.W) = {}` into type implementing `L where .(L.W) = {}` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_two_different_combined_from_final_impl_and_facet.carbon:[[@LINE-13]]:14-31: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: let unused c: {} = H(T, a); } @@ -160,9 +140,7 @@ library "[[@TEST_NAME]]"; interface L { let W: type; } -// CHECK:STDERR: fail_many_different.carbon:[[@LINE+4]]:24: error: associated constant `.(L.W)` given two different values `((), (), ())` and `({}, (), ())` [AssociatedConstantWithDifferentValues] -// CHECK:STDERR: fn G(unused generic T: L where .W = ((), (), ()) and .W = ({}, (), ()) and .W = ({}, {}, ()) and .W = ({}, (), {})) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_many_different.carbon:[[@LINE+2]]:24-114: error: associated constant `.(L.W)` given two different values `((), (), ())` and `({}, (), ())` [AssociatedConstantWithDifferentValues] // CHECK:STDERR: fn G(unused generic T: L where .W = ((), (), ()) and .W = ({}, (), ()) and .W = ({}, {}, ()) and .W = ({}, (), {})) {} @@ -180,9 +158,7 @@ library "[[@TEST_NAME]]"; interface M { let X: type; let Y: type; } -// CHECK:STDERR: fail_rewrite_conflicts_with_second_facet.carbon:[[@LINE+4]]:52: error: associated constant `.(M.Y)` given two different values `T.(M.X)` and `.(M.X)` [AssociatedConstantWithDifferentValues] -// CHECK:STDERR: fn F(generic T: M where .X = (), unused generic U: M where .Y = T.X and .Y = .X) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_rewrite_conflicts_with_second_facet.carbon:[[@LINE+2]]:52-79: error: associated constant `.(M.Y)` given two different values `T.(M.X)` and `.(M.X)` [AssociatedConstantWithDifferentValues] // CHECK:STDERR: fn F(generic T: M where .X = (), unused generic U: M where .Y = T.X and .Y = .X) {} @@ -240,9 +216,7 @@ library "[[@TEST_NAME]]"; interface M { let X: type; } -// CHECK:STDERR: fail_repeated_and_different.carbon:[[@LINE+4]]:24: error: associated constant `.(M.X)` given two different values `{}` and `()` [AssociatedConstantWithDifferentValues] -// CHECK:STDERR: fn F(unused generic T: M where .X = {} and .X = () and .X = {}) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_repeated_and_different.carbon:[[@LINE+2]]:24-62: error: associated constant `.(M.X)` given two different values `{}` and `()` [AssociatedConstantWithDifferentValues] // CHECK:STDERR: fn F(unused generic T: M where .X = {} and .X = () and .X = {}) {} @@ -253,18 +227,14 @@ interface M { let X: type; } // This fails because it resolves to `.X = .X` which is cyclical. // -// CHECK:STDERR: fail_cycle_single.carbon:[[@LINE+4]]:24: error: found cycle in facet type constraint for `.(M.X)` [FacetTypeConstraintCycle] -// CHECK:STDERR: fn F(unused generic T: M where .X = .X) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_cycle_single.carbon:[[@LINE+2]]:24-38: error: found cycle in facet type constraint for `.(M.X)` [FacetTypeConstraintCycle] // CHECK:STDERR: fn F(unused generic T: M where .X = .X) {} // Even though `.X = ()` is specified, the rewrites are resolved left to right // and a cycle `.X = .X` is found first. // -// CHECK:STDERR: fail_cycle_single.carbon:[[@LINE+4]]:24: error: found cycle in facet type constraint for `.(M.X)` [FacetTypeConstraintCycle] -// CHECK:STDERR: fn G(unused generic T: M where .X = .X and .X = ()) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_cycle_single.carbon:[[@LINE+2]]:24-50: error: found cycle in facet type constraint for `.(M.X)` [FacetTypeConstraintCycle] // CHECK:STDERR: fn G(unused generic T: M where .X = .X and .X = ()) {} @@ -277,9 +247,7 @@ interface M { let X: type; let Y: type; let Z: type; } // The value of .X and .Y becomes but .Z is still valid. // //@dump-sem-ir-begin -// CHECK:STDERR: fail_cycle.carbon:[[@LINE+4]]:24: error: found cycle in facet type constraint for `.(M.Y)` [FacetTypeConstraintCycle] -// CHECK:STDERR: fn F(unused generic T: M where .X = .Y and .Y = .X and .Z = ()) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_cycle.carbon:[[@LINE+2]]:24-62: error: found cycle in facet type constraint for `.(M.Y)` [FacetTypeConstraintCycle] // CHECK:STDERR: fn F(unused generic T: M where .X = .Y and .Y = .X and .Z = ()) {} //@dump-sem-ir-end @@ -297,9 +265,7 @@ interface J { // This fails because it resolves to `.X1 = .X1` which is cyclical. // -// CHECK:STDERR: fail_cycle_between_interfaces.carbon:[[@LINE+4]]:24: error: found cycle in facet type constraint for `.(J.X3)` [FacetTypeConstraintCycle] -// CHECK:STDERR: fn G(unused generic T: I & J where .X1 = .X3 and .X2 = .X1 and .X3 = .X2) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_cycle_between_interfaces.carbon:[[@LINE+2]]:24-72: error: found cycle in facet type constraint for `.(J.X3)` [FacetTypeConstraintCycle] // CHECK:STDERR: fn G(unused generic T: I & J where .X1 = .X3 and .X2 = .X1 and .X3 = .X2) {} @@ -313,18 +279,14 @@ interface I { // This fails because it resolves to `.X1 = .X1**` which is cyclical. // -// CHECK:STDERR: fail_indirect_cycle.carbon:[[@LINE+4]]:17: error: found cycle in facet type constraint for `.(I.X2)` [FacetTypeConstraintCycle] -// CHECK:STDERR: fn F(generic T: I where .X1 = .X2* and .X2 = .X1*); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_indirect_cycle.carbon:[[@LINE+2]]:17-49: error: found cycle in facet type constraint for `.(I.X2)` [FacetTypeConstraintCycle] // CHECK:STDERR: fn F(generic T: I where .X1 = .X2* and .X2 = .X1*); class C(T: type); // This fails because it resolves to `.X1 = C(C(.X1))` which is cyclical. // -// CHECK:STDERR: fail_indirect_cycle.carbon:[[@LINE+4]]:17: error: found cycle in facet type constraint for `.(I.X2)` [FacetTypeConstraintCycle] -// CHECK:STDERR: fn G(generic T: I where .X1 = C(.X2) and .X2 = C(.X1)); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_indirect_cycle.carbon:[[@LINE+2]]:17-53: error: found cycle in facet type constraint for `.(I.X2)` [FacetTypeConstraintCycle] // CHECK:STDERR: fn G(generic T: I where .X1 = C(.X2) and .X2 = C(.X1)); @@ -342,9 +304,7 @@ class C(T: type, U: type); // This fails because it resolves to `.X1 = C(C(.X3, .X1), .X3)` which is // cyclical. // -// CHECK:STDERR: fail_complex_indirect_cycle.carbon:[[@LINE+4]]:17: error: found cycle in facet type constraint for `.(I.X2)` [FacetTypeConstraintCycle] -// CHECK:STDERR: fn F(generic T: I where .X1 = C(.X2, .X3) and .X2 = C(.X3, .X1)); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_complex_indirect_cycle.carbon:[[@LINE+2]]:17-63: error: found cycle in facet type constraint for `.(I.X2)` [FacetTypeConstraintCycle] // CHECK:STDERR: fn F(generic T: I where .X1 = C(.X2, .X3) and .X2 = C(.X3, .X1)); @@ -403,9 +363,7 @@ interface Z { // approach can recursively rebuild the RHS values from the ground up // repeatedly. fn F( - // CHECK:STDERR: fail_exponential_large_cycle.carbon:[[@LINE+4]]:16: error: found cycle in facet type constraint for `.(Z.T0)` [FacetTypeConstraintCycle] - // CHECK:STDERR: generic T: Z where - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_exponential_large_cycle.carbon:[[@LINE+2]]:16-22: error: found cycle in facet type constraint for `.(Z.T0)` [FacetTypeConstraintCycle] // CHECK:STDERR: generic T: Z where .T9 = .T0 and @@ -445,9 +403,7 @@ interface N { let Y: {.a: type}; } -// CHECK:STDERR: fail_non-type_different.carbon:[[@LINE+4]]:24: error: associated constant `.(N.Y)` given two different values `{.a = {}}` and `{.a = ()}` [AssociatedConstantWithDifferentValues] -// CHECK:STDERR: fn F(unused generic T: N where .Y = {.a = {}} and .Y = {.a = ()}) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_non-type_different.carbon:[[@LINE+2]]:24-64: error: associated constant `.(N.Y)` given two different values `{.a = {}}` and `{.a = ()}` [AssociatedConstantWithDifferentValues] // CHECK:STDERR: fn F(unused generic T: N where .Y = {.a = {}} and .Y = {.a = ()}) {} @@ -479,9 +435,7 @@ interface Z { let U: Z; } -// CHECK:STDERR: fail_cycle_through_self_reference.carbon:[[@LINE+4]]:24: error: found cycle in facet type constraint for `.(Z.T)` [FacetTypeConstraintCycle] -// CHECK:STDERR: fn F(unused generic A: Z where .T = .U.T and .U = .Self) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_cycle_through_self_reference.carbon:[[@LINE+2]]:24-55: error: found cycle in facet type constraint for `.(Z.T)` [FacetTypeConstraintCycle] // CHECK:STDERR: fn F(unused generic A: Z where .T = .U.T and .U = .Self) {} @@ -518,9 +472,7 @@ interface Z { let T3: type; } -// CHECK:STDERR: fail_cycle_with_unrelated_associated_constant.carbon:[[@LINE+4]]:24: error: found cycle in facet type constraint for `.(Z.T1)` [FacetTypeConstraintCycle] -// CHECK:STDERR: fn F(unused generic T: Z where .T0 = .T1 and .T1 = .T0 and .T2 = .T3) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_cycle_with_unrelated_associated_constant.carbon:[[@LINE+2]]:24-68: error: found cycle in facet type constraint for `.(Z.T1)` [FacetTypeConstraintCycle] // CHECK:STDERR: fn F(unused generic T: Z where .T0 = .T1 and .T1 = .T0 and .T2 = .T3) {} @@ -537,15 +489,11 @@ interface Z { // TODO: There should only be one diagnostic here. // -// CHECK:STDERR: fail_cycle_with_branching_in_rhs.carbon:[[@LINE+4]]:24: error: found cycle in facet type constraint for `.(Z.T3)` [FacetTypeConstraintCycle] -// CHECK:STDERR: fn F(unused generic T: Z where .T0 = .T1 and .T1 = (.T2, .T3) and .T2 = .T4 and .T3 = .T1) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_cycle_with_branching_in_rhs.carbon:[[@LINE+2]]:24-89: error: found cycle in facet type constraint for `.(Z.T3)` [FacetTypeConstraintCycle] // CHECK:STDERR: fn F(unused generic T: Z where .T0 = .T1 and .T1 = (.T2, .T3) and .T2 = .T4 and .T3 = .T1) {} -// CHECK:STDERR: fail_cycle_with_branching_in_rhs.carbon:[[@LINE+4]]:24: error: found cycle in facet type constraint for `.(Z.T1)` [FacetTypeConstraintCycle] -// CHECK:STDERR: fn G(unused generic T: Z where .T0 = .T1 and .T1 = (.T2, .T3) and .T2 = .T4 and .T3 = .T0) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_cycle_with_branching_in_rhs.carbon:[[@LINE+2]]:24-89: error: found cycle in facet type constraint for `.(Z.T1)` [FacetTypeConstraintCycle] // CHECK:STDERR: fn G(unused generic T: Z where .T0 = .T1 and .T1 = (.T2, .T3) and .T2 = .T4 and .T3 = .T0) {} @@ -670,57 +618,57 @@ fn F(unused generic T: I & J where .I1 = .J1.I2) {} // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { // CHECK:STDOUT: %T.patt: = symbolic_binding_pattern T, 0 [concrete = ] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc13_26.1: type = splice_block %.loc13_26.2 [concrete = ] { -// CHECK:STDOUT: %.Self.frozen.loc13_22: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen.e58] +// CHECK:STDOUT: %.loc11_26.1: type = splice_block %.loc11_26.2 [concrete = ] { +// CHECK:STDOUT: %.Self.frozen.loc11_22: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen.e58] // CHECK:STDOUT: %M.ref: type = name_ref M, file.%M.decl [concrete = constants.%M.type] -// CHECK:STDOUT: %.Self.frozen.loc13_26: %M.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen.1cb] +// CHECK:STDOUT: %.Self.frozen.loc11_26: %M.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen.1cb] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %M.ref [concrete] -// CHECK:STDOUT: %.Self.ref.loc13_32: %M.type = name_ref .Self, %.Self.frozen.loc13_26 [symbolic_self = constants.%.Self.frozen.1cb] -// CHECK:STDOUT: %.Self.as_type.loc13_32: type = facet_access_type %.Self.ref.loc13_32 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc13_32: type = converted %.Self.ref.loc13_32, %.Self.as_type.loc13_32 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %X.ref.loc13_32: %M.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc13_32.1: type = impl_witness_access constants.%M.lookup_impl_witness.beb, element0 [symbolic_self = constants.%impl.elem0.352] -// CHECK:STDOUT: %.Self.ref.loc13_37: %M.type = name_ref .Self, %.Self.frozen.loc13_26 [symbolic_self = constants.%.Self.frozen.1cb] -// CHECK:STDOUT: %.Self.as_type.loc13_37: type = facet_access_type %.Self.ref.loc13_37 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc13_37: type = converted %.Self.ref.loc13_37, %.Self.as_type.loc13_37 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %Y.ref.loc13_37: %M.assoc_type = name_ref Y, @Y.%assoc1 [concrete = constants.%assoc1] -// CHECK:STDOUT: %impl.elem1.loc13_37.1: type = impl_witness_access constants.%M.lookup_impl_witness.beb, element1 [symbolic_self = constants.%impl.elem1.66c] -// CHECK:STDOUT: %rewrite.loc13_35.1 = requirement_rewrite %impl.elem0.loc13_32.1, %impl.elem1.loc13_37.1 [concrete] -// CHECK:STDOUT: %.Self.ref.loc13_44: %M.type = name_ref .Self, %.Self.frozen.loc13_26 [symbolic_self = constants.%.Self.frozen.1cb] -// CHECK:STDOUT: %.Self.as_type.loc13_44: type = facet_access_type %.Self.ref.loc13_44 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc13_44: type = converted %.Self.ref.loc13_44, %.Self.as_type.loc13_44 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %Y.ref.loc13_44: %M.assoc_type = name_ref Y, @Y.%assoc1 [concrete = constants.%assoc1] -// CHECK:STDOUT: %impl.elem1.loc13_44.1: type = impl_witness_access constants.%M.lookup_impl_witness.beb, element1 [symbolic_self = constants.%impl.elem1.66c] -// CHECK:STDOUT: %.Self.ref.loc13_49: %M.type = name_ref .Self, %.Self.frozen.loc13_26 [symbolic_self = constants.%.Self.frozen.1cb] -// CHECK:STDOUT: %.Self.as_type.loc13_49: type = facet_access_type %.Self.ref.loc13_49 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc13_49: type = converted %.Self.ref.loc13_49, %.Self.as_type.loc13_49 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %X.ref.loc13_49: %M.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc13_49.1: type = impl_witness_access constants.%M.lookup_impl_witness.beb, element0 [symbolic_self = constants.%impl.elem0.352] -// CHECK:STDOUT: %impl.elem0.subst.loc13_49.1: type = impl_witness_access_substituted %impl.elem0.loc13_49.1, %impl.elem1.loc13_37.1 [symbolic_self = constants.%impl.elem1.66c] -// CHECK:STDOUT: %rewrite.loc13_47.1 = requirement_rewrite %impl.elem1.loc13_44.1, %impl.elem0.subst.loc13_49.1 [concrete] -// CHECK:STDOUT: %.Self.ref.loc13_56: %M.type = name_ref .Self, %.Self.frozen.loc13_26 [symbolic_self = constants.%.Self.frozen.1cb] -// CHECK:STDOUT: %.Self.as_type.loc13_56: type = facet_access_type %.Self.ref.loc13_56 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc13_56: type = converted %.Self.ref.loc13_56, %.Self.as_type.loc13_56 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.Self.ref.loc11_32: %M.type = name_ref .Self, %.Self.frozen.loc11_26 [symbolic_self = constants.%.Self.frozen.1cb] +// CHECK:STDOUT: %.Self.as_type.loc11_32: type = facet_access_type %.Self.ref.loc11_32 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc11_32: type = converted %.Self.ref.loc11_32, %.Self.as_type.loc11_32 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %X.ref.loc11_32: %M.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc11_32.1: type = impl_witness_access constants.%M.lookup_impl_witness.beb, element0 [symbolic_self = constants.%impl.elem0.352] +// CHECK:STDOUT: %.Self.ref.loc11_37: %M.type = name_ref .Self, %.Self.frozen.loc11_26 [symbolic_self = constants.%.Self.frozen.1cb] +// CHECK:STDOUT: %.Self.as_type.loc11_37: type = facet_access_type %.Self.ref.loc11_37 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc11_37: type = converted %.Self.ref.loc11_37, %.Self.as_type.loc11_37 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %Y.ref.loc11_37: %M.assoc_type = name_ref Y, @Y.%assoc1 [concrete = constants.%assoc1] +// CHECK:STDOUT: %impl.elem1.loc11_37.1: type = impl_witness_access constants.%M.lookup_impl_witness.beb, element1 [symbolic_self = constants.%impl.elem1.66c] +// CHECK:STDOUT: %rewrite.loc11_35.1 = requirement_rewrite %impl.elem0.loc11_32.1, %impl.elem1.loc11_37.1 [concrete] +// CHECK:STDOUT: %.Self.ref.loc11_44: %M.type = name_ref .Self, %.Self.frozen.loc11_26 [symbolic_self = constants.%.Self.frozen.1cb] +// CHECK:STDOUT: %.Self.as_type.loc11_44: type = facet_access_type %.Self.ref.loc11_44 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc11_44: type = converted %.Self.ref.loc11_44, %.Self.as_type.loc11_44 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %Y.ref.loc11_44: %M.assoc_type = name_ref Y, @Y.%assoc1 [concrete = constants.%assoc1] +// CHECK:STDOUT: %impl.elem1.loc11_44.1: type = impl_witness_access constants.%M.lookup_impl_witness.beb, element1 [symbolic_self = constants.%impl.elem1.66c] +// CHECK:STDOUT: %.Self.ref.loc11_49: %M.type = name_ref .Self, %.Self.frozen.loc11_26 [symbolic_self = constants.%.Self.frozen.1cb] +// CHECK:STDOUT: %.Self.as_type.loc11_49: type = facet_access_type %.Self.ref.loc11_49 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc11_49: type = converted %.Self.ref.loc11_49, %.Self.as_type.loc11_49 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %X.ref.loc11_49: %M.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc11_49.1: type = impl_witness_access constants.%M.lookup_impl_witness.beb, element0 [symbolic_self = constants.%impl.elem0.352] +// CHECK:STDOUT: %impl.elem0.subst.loc11_49.1: type = impl_witness_access_substituted %impl.elem0.loc11_49.1, %impl.elem1.loc11_37.1 [symbolic_self = constants.%impl.elem1.66c] +// CHECK:STDOUT: %rewrite.loc11_47.1 = requirement_rewrite %impl.elem1.loc11_44.1, %impl.elem0.subst.loc11_49.1 [concrete] +// CHECK:STDOUT: %.Self.ref.loc11_56: %M.type = name_ref .Self, %.Self.frozen.loc11_26 [symbolic_self = constants.%.Self.frozen.1cb] +// CHECK:STDOUT: %.Self.as_type.loc11_56: type = facet_access_type %.Self.ref.loc11_56 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc11_56: type = converted %.Self.ref.loc11_56, %.Self.as_type.loc11_56 [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %Z.ref: %M.assoc_type = name_ref Z, @Z.%assoc2 [concrete = constants.%assoc2] -// CHECK:STDOUT: %impl.elem2.loc13_56.1: type = impl_witness_access constants.%M.lookup_impl_witness.beb, element2 [symbolic_self = constants.%impl.elem2.c22] -// CHECK:STDOUT: %.loc13_62.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc13_62.2: type = converted %.loc13_62.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %rewrite.loc13_59.1 = requirement_rewrite %impl.elem2.loc13_56.1, %.loc13_62.2 [concrete] -// CHECK:STDOUT: %impl.elem0.loc13_32.2: type = impl_witness_access constants.%M.lookup_impl_witness.e09, element0 [symbolic_self = constants.%impl.elem0.c24] -// CHECK:STDOUT: %impl.elem1.loc13_37.2: type = impl_witness_access constants.%M.lookup_impl_witness.e09, element1 [symbolic_self = constants.%impl.elem1.e3e] -// CHECK:STDOUT: %rewrite.loc13_35.2 = requirement_rewrite %impl.elem0.loc13_32.2, %impl.elem1.loc13_37.2 [concrete] -// CHECK:STDOUT: %impl.elem1.loc13_44.2: type = impl_witness_access constants.%M.lookup_impl_witness.e09, element1 [symbolic_self = constants.%impl.elem1.e3e] -// CHECK:STDOUT: %impl.elem0.loc13_49.2: type = impl_witness_access constants.%M.lookup_impl_witness.e09, element0 [symbolic_self = constants.%impl.elem0.c24] -// CHECK:STDOUT: %impl.elem1.loc13_37.3: type = impl_witness_access constants.%M.lookup_impl_witness.e09, element1 [symbolic_self = constants.%impl.elem1.e3e] -// CHECK:STDOUT: %impl.elem0.subst.loc13_49.2: type = impl_witness_access_substituted %impl.elem0.loc13_49.2, %impl.elem1.loc13_37.3 [symbolic_self = constants.%impl.elem1.e3e] -// CHECK:STDOUT: %rewrite.loc13_47.2 = requirement_rewrite %impl.elem1.loc13_44.2, %impl.elem0.subst.loc13_49.2 [concrete] -// CHECK:STDOUT: %impl.elem2.loc13_56.2: type = impl_witness_access constants.%M.lookup_impl_witness.e09, element2 [symbolic_self = constants.%impl.elem2.017] -// CHECK:STDOUT: %rewrite.loc13_59.2 = requirement_rewrite %impl.elem2.loc13_56.2, %.loc13_62.2 [concrete] -// CHECK:STDOUT: %.loc13_26.2: type = where_expr [concrete = ] { +// CHECK:STDOUT: %impl.elem2.loc11_56.1: type = impl_witness_access constants.%M.lookup_impl_witness.beb, element2 [symbolic_self = constants.%impl.elem2.c22] +// CHECK:STDOUT: %.loc11_62.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc11_62.2: type = converted %.loc11_62.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %rewrite.loc11_59.1 = requirement_rewrite %impl.elem2.loc11_56.1, %.loc11_62.2 [concrete] +// CHECK:STDOUT: %impl.elem0.loc11_32.2: type = impl_witness_access constants.%M.lookup_impl_witness.e09, element0 [symbolic_self = constants.%impl.elem0.c24] +// CHECK:STDOUT: %impl.elem1.loc11_37.2: type = impl_witness_access constants.%M.lookup_impl_witness.e09, element1 [symbolic_self = constants.%impl.elem1.e3e] +// CHECK:STDOUT: %rewrite.loc11_35.2 = requirement_rewrite %impl.elem0.loc11_32.2, %impl.elem1.loc11_37.2 [concrete] +// CHECK:STDOUT: %impl.elem1.loc11_44.2: type = impl_witness_access constants.%M.lookup_impl_witness.e09, element1 [symbolic_self = constants.%impl.elem1.e3e] +// CHECK:STDOUT: %impl.elem0.loc11_49.2: type = impl_witness_access constants.%M.lookup_impl_witness.e09, element0 [symbolic_self = constants.%impl.elem0.c24] +// CHECK:STDOUT: %impl.elem1.loc11_37.3: type = impl_witness_access constants.%M.lookup_impl_witness.e09, element1 [symbolic_self = constants.%impl.elem1.e3e] +// CHECK:STDOUT: %impl.elem0.subst.loc11_49.2: type = impl_witness_access_substituted %impl.elem0.loc11_49.2, %impl.elem1.loc11_37.3 [symbolic_self = constants.%impl.elem1.e3e] +// CHECK:STDOUT: %rewrite.loc11_47.2 = requirement_rewrite %impl.elem1.loc11_44.2, %impl.elem0.subst.loc11_49.2 [concrete] +// CHECK:STDOUT: %impl.elem2.loc11_56.2: type = impl_witness_access constants.%M.lookup_impl_witness.e09, element2 [symbolic_self = constants.%impl.elem2.017] +// CHECK:STDOUT: %rewrite.loc11_59.2 = requirement_rewrite %impl.elem2.loc11_56.2, %.loc11_62.2 [concrete] +// CHECK:STDOUT: %.loc11_26.2: type = where_expr [concrete = ] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %M.ref [concrete] -// CHECK:STDOUT: %rewrite.loc13_35.2 = requirement_rewrite %impl.elem0.loc13_32.2, %impl.elem1.loc13_37.2 [concrete] -// CHECK:STDOUT: %rewrite.loc13_47.2 = requirement_rewrite %impl.elem1.loc13_44.2, %impl.elem0.subst.loc13_49.2 [concrete] -// CHECK:STDOUT: %rewrite.loc13_59.2 = requirement_rewrite %impl.elem2.loc13_56.2, %.loc13_62.2 [concrete] +// CHECK:STDOUT: %rewrite.loc11_35.2 = requirement_rewrite %impl.elem0.loc11_32.2, %impl.elem1.loc11_37.2 [concrete] +// CHECK:STDOUT: %rewrite.loc11_47.2 = requirement_rewrite %impl.elem1.loc11_44.2, %impl.elem0.subst.loc11_49.2 [concrete] +// CHECK:STDOUT: %rewrite.loc11_59.2 = requirement_rewrite %impl.elem2.loc11_56.2, %.loc11_62.2 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: %T: = symbolic_binding T, 0 [concrete = ] diff --git a/toolchain/check/testdata/facet/fail_convert_class_type_to_generic_facet_value.carbon b/toolchain/check/testdata/facet/fail_convert_class_type_to_generic_facet_value.carbon index 6d1095262288..1295aa6cace2 100644 --- a/toolchain/check/testdata/facet/fail_convert_class_type_to_generic_facet_value.carbon +++ b/toolchain/check/testdata/facet/fail_convert_class_type_to_generic_facet_value.carbon @@ -27,12 +27,8 @@ impl ImplsGeneric as Generic(GenericParam) { fn CallGenericMethod(generic T: type, unused generic U: Generic(T)) {} fn G() { - // CHECK:STDERR: fail_convert_class_type_to_generic_facet_value.carbon:[[@LINE+7]]:3: error: cannot convert type `ImplsGeneric` into type implementing `Generic(WrongGenericParam)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: CallGenericMethod(WrongGenericParam, ImplsGeneric); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_convert_class_type_to_generic_facet_value.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn CallGenericMethod(generic T: type, unused generic U: Generic(T)) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_convert_class_type_to_generic_facet_value.carbon:[[@LINE+3]]:3-52: error: cannot convert type `ImplsGeneric` into type implementing `Generic(WrongGenericParam)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_convert_class_type_to_generic_facet_value.carbon:[[@LINE-4]]:1-69: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: CallGenericMethod(WrongGenericParam, ImplsGeneric); } diff --git a/toolchain/check/testdata/facet/fail_convert_facet_value_to_missing_impl.carbon b/toolchain/check/testdata/facet/fail_convert_facet_value_to_missing_impl.carbon index 0944fc6c58dc..428fbf9a7286 100644 --- a/toolchain/check/testdata/facet/fail_convert_facet_value_to_missing_impl.carbon +++ b/toolchain/check/testdata/facet/fail_convert_facet_value_to_missing_impl.carbon @@ -17,12 +17,8 @@ interface Animal {} fn Feed[T: Eats](unused e: T) {} -// CHECK:STDERR: fail_convert_facet_value_to_missing_impl.carbon:[[@LINE+7]]:36: error: cannot convert type `T` that implements `Animal` into type implementing `Eats` [ConversionFailureFacetToFacet] -// CHECK:STDERR: fn HandleAnimal[T: Animal](a: T) { Feed(a); } -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_convert_facet_value_to_missing_impl.carbon:[[@LINE-5]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: fn Feed[T: Eats](unused e: T) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_convert_facet_value_to_missing_impl.carbon:[[@LINE+3]]:36-42: error: cannot convert type `T` that implements `Animal` into type implementing `Eats` [ConversionFailureFacetToFacet] +// CHECK:STDERR: fail_convert_facet_value_to_missing_impl.carbon:[[@LINE-3]]:1-31: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: fn HandleAnimal[T: Animal](a: T) { Feed(a); } @@ -94,22 +90,22 @@ fn HandleAnimal[T: Animal](a: T) { Feed(a); } // CHECK:STDOUT: %e: @Feed.%T.as_type.loc18_28.1 (%T.as_type.422) = wrapper_binding e, %e.param // CHECK:STDOUT: } // CHECK:STDOUT: %HandleAnimal.decl: %HandleAnimal.type = fn_decl @HandleAnimal [concrete = constants.%HandleAnimal] { -// CHECK:STDOUT: %T.patt.loc27_18.1: %pattern_type.333 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc27_18.2 (constants.%T.patt.e44)] -// CHECK:STDOUT: %a.param_patt.loc27_29.1: @HandleAnimal.%pattern_type (%pattern_type.e90) = value_param_pattern [symbolic = %a.param_patt.loc27_29.2 (constants.%a.param_patt)] -// CHECK:STDOUT: %a.patt.loc27_29.1: @HandleAnimal.%pattern_type (%pattern_type.e90) = wrapper_binding_pattern a, %a.param_patt.loc27_29.1 [symbolic = %a.patt.loc27_29.2 (constants.%a.patt)] +// CHECK:STDOUT: %T.patt.loc23_18.1: %pattern_type.333 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc23_18.2 (constants.%T.patt.e44)] +// CHECK:STDOUT: %a.param_patt.loc23_29.1: @HandleAnimal.%pattern_type (%pattern_type.e90) = value_param_pattern [symbolic = %a.param_patt.loc23_29.2 (constants.%a.param_patt)] +// CHECK:STDOUT: %a.patt.loc23_29.1: @HandleAnimal.%pattern_type (%pattern_type.e90) = wrapper_binding_pattern a, %a.param_patt.loc23_29.1 [symbolic = %a.patt.loc23_29.2 (constants.%a.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc27_20: type = splice_block %Animal.ref [concrete = constants.%Animal.type] { +// CHECK:STDOUT: %.loc23_20: type = splice_block %Animal.ref [concrete = constants.%Animal.type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc27_18.2: %Animal.type = symbolic_binding T, 0 [symbolic = %T.loc27_18.1 (constants.%T.443)] -// CHECK:STDOUT: %a.param: @HandleAnimal.%T.as_type.loc27_31.1 (%T.as_type.01d) = value_param call_param0 -// CHECK:STDOUT: %.loc27_31.1: type = splice_block %.loc27_31.2 [symbolic = %T.as_type.loc27_31.1 (constants.%T.as_type.01d)] { -// CHECK:STDOUT: %T.ref: %Animal.type = name_ref T, %T.loc27_18.2 [symbolic = %T.loc27_18.1 (constants.%T.443)] -// CHECK:STDOUT: %T.as_type.loc27_31.2: type = facet_access_type %T.ref [symbolic = %T.as_type.loc27_31.1 (constants.%T.as_type.01d)] -// CHECK:STDOUT: %.loc27_31.2: type = converted %T.ref, %T.as_type.loc27_31.2 [symbolic = %T.as_type.loc27_31.1 (constants.%T.as_type.01d)] +// CHECK:STDOUT: %T.loc23_18.2: %Animal.type = symbolic_binding T, 0 [symbolic = %T.loc23_18.1 (constants.%T.443)] +// CHECK:STDOUT: %a.param: @HandleAnimal.%T.as_type.loc23_31.1 (%T.as_type.01d) = value_param call_param0 +// CHECK:STDOUT: %.loc23_31.1: type = splice_block %.loc23_31.2 [symbolic = %T.as_type.loc23_31.1 (constants.%T.as_type.01d)] { +// CHECK:STDOUT: %T.ref: %Animal.type = name_ref T, %T.loc23_18.2 [symbolic = %T.loc23_18.1 (constants.%T.443)] +// CHECK:STDOUT: %T.as_type.loc23_31.2: type = facet_access_type %T.ref [symbolic = %T.as_type.loc23_31.1 (constants.%T.as_type.01d)] +// CHECK:STDOUT: %.loc23_31.2: type = converted %T.ref, %T.as_type.loc23_31.2 [symbolic = %T.as_type.loc23_31.1 (constants.%T.as_type.01d)] // CHECK:STDOUT: } -// CHECK:STDOUT: %a: @HandleAnimal.%T.as_type.loc27_31.1 (%T.as_type.01d) = wrapper_binding a, %a.param +// CHECK:STDOUT: %a: @HandleAnimal.%T.as_type.loc23_31.1 (%T.as_type.01d) = wrapper_binding a, %a.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -152,21 +148,21 @@ fn HandleAnimal[T: Animal](a: T) { Feed(a); } // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @HandleAnimal(%T.loc27_18.2: %Animal.type) { -// CHECK:STDOUT: %T.patt.loc27_18.2: %pattern_type.333 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc27_18.2 (constants.%T.patt.e44)] -// CHECK:STDOUT: %T.loc27_18.1: %Animal.type = symbolic_binding T, 0 [symbolic = %T.loc27_18.1 (constants.%T.443)] -// CHECK:STDOUT: %T.as_type.loc27_31.1: type = facet_access_type %T.loc27_18.1 [symbolic = %T.as_type.loc27_31.1 (constants.%T.as_type.01d)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %T.as_type.loc27_31.1 [symbolic = %pattern_type (constants.%pattern_type.e90)] -// CHECK:STDOUT: %a.param_patt.loc27_29.2: @HandleAnimal.%pattern_type (%pattern_type.e90) = value_param_pattern [symbolic = %a.param_patt.loc27_29.2 (constants.%a.param_patt)] -// CHECK:STDOUT: %a.patt.loc27_29.2: @HandleAnimal.%pattern_type (%pattern_type.e90) = wrapper_binding_pattern a, %a.param_patt.loc27_29.2 [symbolic = %a.patt.loc27_29.2 (constants.%a.patt)] +// CHECK:STDOUT: generic fn @HandleAnimal(%T.loc23_18.2: %Animal.type) { +// CHECK:STDOUT: %T.patt.loc23_18.2: %pattern_type.333 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc23_18.2 (constants.%T.patt.e44)] +// CHECK:STDOUT: %T.loc23_18.1: %Animal.type = symbolic_binding T, 0 [symbolic = %T.loc23_18.1 (constants.%T.443)] +// CHECK:STDOUT: %T.as_type.loc23_31.1: type = facet_access_type %T.loc23_18.1 [symbolic = %T.as_type.loc23_31.1 (constants.%T.as_type.01d)] +// CHECK:STDOUT: %pattern_type: type = pattern_type %T.as_type.loc23_31.1 [symbolic = %pattern_type (constants.%pattern_type.e90)] +// CHECK:STDOUT: %a.param_patt.loc23_29.2: @HandleAnimal.%pattern_type (%pattern_type.e90) = value_param_pattern [symbolic = %a.param_patt.loc23_29.2 (constants.%a.param_patt)] +// CHECK:STDOUT: %a.patt.loc23_29.2: @HandleAnimal.%pattern_type (%pattern_type.e90) = wrapper_binding_pattern a, %a.param_patt.loc23_29.2 [symbolic = %a.patt.loc23_29.2 (constants.%a.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %T.as_type.loc27_31.1 [symbolic = %require_complete (constants.%require_complete.db4)] +// CHECK:STDOUT: %require_complete: = require_complete_type %T.as_type.loc23_31.1 [symbolic = %require_complete (constants.%require_complete.db4)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%a.param: @HandleAnimal.%T.as_type.loc27_31.1 (%T.as_type.01d)) { +// CHECK:STDOUT: fn(%a.param: @HandleAnimal.%T.as_type.loc23_31.1 (%T.as_type.01d)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Feed.ref: %Feed.type = name_ref Feed, file.%Feed.decl [concrete = constants.%Feed] -// CHECK:STDOUT: %a.ref: @HandleAnimal.%T.as_type.loc27_31.1 (%T.as_type.01d) = name_ref a, %a +// CHECK:STDOUT: %a.ref: @HandleAnimal.%T.as_type.loc23_31.1 (%T.as_type.01d) = name_ref a, %a // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -185,11 +181,11 @@ fn HandleAnimal[T: Animal](a: T) { Feed(a); } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @HandleAnimal(constants.%T.443) { -// CHECK:STDOUT: %T.patt.loc27_18.2 => constants.%T.patt.e44 -// CHECK:STDOUT: %T.loc27_18.1 => constants.%T.443 -// CHECK:STDOUT: %T.as_type.loc27_31.1 => constants.%T.as_type.01d +// CHECK:STDOUT: %T.patt.loc23_18.2 => constants.%T.patt.e44 +// CHECK:STDOUT: %T.loc23_18.1 => constants.%T.443 +// CHECK:STDOUT: %T.as_type.loc23_31.1 => constants.%T.as_type.01d // CHECK:STDOUT: %pattern_type => constants.%pattern_type.e90 -// CHECK:STDOUT: %a.param_patt.loc27_29.2 => constants.%a.param_patt -// CHECK:STDOUT: %a.patt.loc27_29.2 => constants.%a.patt +// CHECK:STDOUT: %a.param_patt.loc23_29.2 => constants.%a.param_patt +// CHECK:STDOUT: %a.patt.loc23_29.2 => constants.%a.patt // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/facet/fail_convert_type_erased_type_to_facet.carbon b/toolchain/check/testdata/facet/fail_convert_type_erased_type_to_facet.carbon index cd827b98ccdf..e7bbb566be12 100644 --- a/toolchain/check/testdata/facet/fail_convert_type_erased_type_to_facet.carbon +++ b/toolchain/check/testdata/facet/fail_convert_type_erased_type_to_facet.carbon @@ -20,9 +20,7 @@ impl Goat as Animal {} fn WalkAnimal(unused generic a: Animal) {} fn F() { - // CHECK:STDERR: fail_convert_type_erased_type_to_facet.carbon:[[@LINE+4]]:15: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] - // CHECK:STDERR: let generic x: type = Goat; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_convert_type_erased_type_to_facet.carbon:[[@LINE+2]]:15-21: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] // CHECK:STDERR: let generic x: type = Goat; WalkAnimal(x); diff --git a/toolchain/check/testdata/facet/fail_deduction_uses_runtime_type_conversion.carbon b/toolchain/check/testdata/facet/fail_deduction_uses_runtime_type_conversion.carbon index 18adbceaa138..54d3f1503804 100644 --- a/toolchain/check/testdata/facet/fail_deduction_uses_runtime_type_conversion.carbon +++ b/toolchain/check/testdata/facet/fail_deduction_uses_runtime_type_conversion.carbon @@ -27,15 +27,9 @@ impl RuntimeConvertFrom as Core.ImplicitAs(RuntimeConvertTo) { fn F[T: (type, )](unused generic A: T.0, unused x: HoldsType(T)) {} fn G(holds_to: HoldsType((RuntimeConvertTo, )), generic from: RuntimeConvertFrom) { - // CHECK:STDERR: fail_deduction_uses_runtime_type_conversion.carbon:[[@LINE+10]]:3: error: compile-time value requires runtime conversion, constructing value of type `RuntimeConvertTo` [RuntimeConversionDuringCompTimeDeduction] - // CHECK:STDERR: F(from, holds_to); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_deduction_uses_runtime_type_conversion.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn F[T: (type, )](unused generic A: T.0, unused x: HoldsType(T)) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_deduction_uses_runtime_type_conversion.carbon:[[@LINE-9]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn F[T: (type, )](unused generic A: T.0, unused x: HoldsType(T)) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_deduction_uses_runtime_type_conversion.carbon:[[@LINE+4]]:3-19: error: compile-time value requires runtime conversion, constructing value of type `RuntimeConvertTo` [RuntimeConversionDuringCompTimeDeduction] + // CHECK:STDERR: fail_deduction_uses_runtime_type_conversion.carbon:[[@LINE-4]]:1-66: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: fail_deduction_uses_runtime_type_conversion.carbon:[[@LINE-5]]:1-66: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: F(from, holds_to); } @@ -107,17 +101,17 @@ fn G(holds_to: HoldsType((RuntimeConvertTo, )), generic from: RuntimeConvertFrom // CHECK:STDOUT: %pattern_type.a96: type = pattern_type %empty_struct_type [concrete] // CHECK:STDOUT: %self.param_patt.52f: %pattern_type.a96 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.4b1: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt.52f [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc40_19.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc34_19.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc40_19.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc34_19.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.1: %Destroy.WithSelf.Op.type.ef016f.1 = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.afb: %pattern_type.c10 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.a97: %pattern_type.c10 = wrapper_binding_pattern self, %self.param_patt.afb [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc40_19.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc34_19.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc40_19.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc34_19.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.2: %Destroy.WithSelf.Op.type.ef016f.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc40_19.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc34_19.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.2: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -133,28 +127,28 @@ fn G(holds_to: HoldsType((RuntimeConvertTo, )), generic from: RuntimeConvertFrom // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc40_19.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc34_19.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.a96 = ref_param_pattern [concrete = constants.%self.param_patt.52f] // CHECK:STDOUT: %self.patt: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.4b1] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %empty_struct_type = ref_param call_param0 // CHECK:STDOUT: %self: ref %empty_struct_type = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc40_19.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc34_19.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.a96 = ref_param_pattern [concrete = constants.%self.param_patt.52f] // CHECK:STDOUT: %self.patt: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.4b1] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %empty_struct_type = ref_param call_param0 // CHECK:STDOUT: %self: ref %empty_struct_type = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc40_19.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc34_19.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.c10 = ref_param_pattern [concrete = constants.%self.param_patt.afb] // CHECK:STDOUT: %self.patt: %pattern_type.c10 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.a97] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %RuntimeConvertTo = ref_param call_param0 // CHECK:STDOUT: %self: ref %RuntimeConvertTo = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc40_19.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc34_19.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.c10 = ref_param_pattern [concrete = constants.%self.param_patt.afb] // CHECK:STDOUT: %self.patt: %pattern_type.c10 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.a97] // CHECK:STDOUT: } { @@ -344,37 +338,37 @@ fn G(holds_to: HoldsType((RuntimeConvertTo, )), generic from: RuntimeConvertFrom // CHECK:STDOUT: %holds_to.ref: %HoldsType.30a = name_ref holds_to, %holds_to // CHECK:STDOUT: %impl.elem0: %.0aa = impl_witness_access constants.%ImplicitAs.impl_witness, element0 [concrete = constants.%RuntimeConvertFrom.as.ImplicitAs.impl.Convert] // CHECK:STDOUT: %bound_method: = bound_method constants.%from, %impl.elem0 [symbolic = %RuntimeConvertFrom.as.ImplicitAs.impl.Convert.bound (constants.%RuntimeConvertFrom.as.ImplicitAs.impl.Convert.bound)] -// CHECK:STDOUT: %.loc40_19.1: ref %RuntimeConvertTo = temporary_storage -// CHECK:STDOUT: %RuntimeConvertFrom.as.ImplicitAs.impl.Convert.call: init %RuntimeConvertTo to %.loc40_19.1 = call %bound_method(constants.%from) -// CHECK:STDOUT: %.loc40_19.2: init %RuntimeConvertTo = converted constants.%from, %RuntimeConvertFrom.as.ImplicitAs.impl.Convert.call -// CHECK:STDOUT: %.loc40_19.3: ref %RuntimeConvertTo = temporary %.loc40_19.1, %.loc40_19.2 -// CHECK:STDOUT: %.loc40_19.4: %RuntimeConvertTo = acquire_value %.loc40_19.3 +// CHECK:STDOUT: %.loc34_19.1: ref %RuntimeConvertTo = temporary_storage +// CHECK:STDOUT: %RuntimeConvertFrom.as.ImplicitAs.impl.Convert.call: init %RuntimeConvertTo to %.loc34_19.1 = call %bound_method(constants.%from) +// CHECK:STDOUT: %.loc34_19.2: init %RuntimeConvertTo = converted constants.%from, %RuntimeConvertFrom.as.ImplicitAs.impl.Convert.call +// CHECK:STDOUT: %.loc34_19.3: ref %RuntimeConvertTo = temporary %.loc34_19.1, %.loc34_19.2 +// CHECK:STDOUT: %.loc34_19.4: %RuntimeConvertTo = acquire_value %.loc34_19.3 // CHECK:STDOUT: %F.specific_fn: = specific_function %F.ref, @F(constants.%tuple.eb2, ) [concrete = ] -// CHECK:STDOUT: %.loc40_19.5: %empty_tuple.type = call %F.specific_fn(%holds_to.ref) +// CHECK:STDOUT: %.loc34_19.5: %empty_tuple.type = call %F.specific_fn(%holds_to.ref) // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc40_19.6: %empty_tuple.type = converted %.loc40_19.5, %empty_tuple [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc40_19.3, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc40_19.3) +// CHECK:STDOUT: %.loc34_19.6: %empty_tuple.type = converted %.loc34_19.5, %empty_tuple [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc34_19.3, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc34_19.3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc40_19.1(%self.param: ref %empty_struct_type) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc34_19.1(%self.param: ref %empty_struct_type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc40_19.1(%self.param: ref %empty_struct_type) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc34_19.1(%self.param: ref %empty_struct_type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc40_19.1(%self.param: ref %empty_struct_type) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc34_19.1(%self.param: ref %empty_struct_type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.1(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.1(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc40_19.2(%self.param: ref %RuntimeConvertTo) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc34_19.2(%self.param: ref %RuntimeConvertTo) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc40_19.2(%self.param: ref %RuntimeConvertTo) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc34_19.2(%self.param: ref %RuntimeConvertTo) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc40_19.2(%self.param: ref %RuntimeConvertTo) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc34_19.2(%self.param: ref %RuntimeConvertTo) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.2(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.2(%self.param) diff --git a/toolchain/check/testdata/facet/fail_namespace_type.carbon b/toolchain/check/testdata/facet/fail_namespace_type.carbon index ec97de64d36b..70b340ac3688 100644 --- a/toolchain/check/testdata/facet/fail_namespace_type.carbon +++ b/toolchain/check/testdata/facet/fail_namespace_type.carbon @@ -20,9 +20,7 @@ interface Z {} impl forall [T: type] T as Z {} fn F() { - // CHECK:STDERR: fail_namespace_as.carbon:[[@LINE+4]]:3: error: expression cannot be used as a value [UseOfNonExprAsValue] - // CHECK:STDERR: N as Z; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_namespace_as.carbon:[[@LINE+2]]:3: error: expression cannot be used as a value [UseOfNonExprAsValue] // CHECK:STDERR: N as Z; } @@ -39,12 +37,8 @@ impl forall [T: type] T as Z {} fn G[T: Z](unused a: T) {} fn F() { - // CHECK:STDERR: fail_namespace_argument.carbon:[[@LINE+7]]:5: error: expression cannot be used as a value [UseOfNonExprAsValue] - // CHECK:STDERR: G(N); - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_namespace_argument.carbon:[[@LINE-6]]:19: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn G[T: Z](unused a: T) {} - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_namespace_argument.carbon:[[@LINE+3]]:5: error: expression cannot be used as a value [UseOfNonExprAsValue] + // CHECK:STDERR: fail_namespace_argument.carbon:[[@LINE-4]]:19-22: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: G(N); } diff --git a/toolchain/check/testdata/facet/named_constant.carbon b/toolchain/check/testdata/facet/named_constant.carbon index b6e68f8b7044..caf55d254aad 100644 --- a/toolchain/check/testdata/facet/named_constant.carbon +++ b/toolchain/check/testdata/facet/named_constant.carbon @@ -19,9 +19,7 @@ interface I { } fn Test() { - // CHECK:STDERR: fail_todo_named_constant_in_rewrite.carbon:[[@LINE+4]]:15: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] - // CHECK:STDERR: let generic Constant: type = (); - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_named_constant_in_rewrite.carbon:[[@LINE+2]]:15-28: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] // CHECK:STDERR: let generic Constant: type = (); @@ -42,9 +40,7 @@ interface I { } fn Test() { - // CHECK:STDERR: fail_todo_named_constant_two_levels_in_rewrite.carbon:[[@LINE+4]]:15: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] - // CHECK:STDERR: let generic Constant2: type = (); - // CHECK:STDERR: ^~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_named_constant_two_levels_in_rewrite.carbon:[[@LINE+2]]:15-29: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] // CHECK:STDERR: let generic Constant2: type = (); let generic Constant: type = (Constant2, ); @@ -66,9 +62,7 @@ interface I { } fn Test() { - // CHECK:STDERR: fail_todo_named_constant_in_rewrite_callee.carbon:[[@LINE+4]]:15: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] - // CHECK:STDERR: let generic Constant: type = (); - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_named_constant_in_rewrite_callee.carbon:[[@LINE+2]]:15-28: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] // CHECK:STDERR: let generic Constant: type = (); @@ -89,9 +83,7 @@ interface I { } fn Test() { - // CHECK:STDERR: fail_todo_named_constant_in_rewrite_caller.carbon:[[@LINE+4]]:15: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] - // CHECK:STDERR: let generic Constant: type = (); - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_named_constant_in_rewrite_caller.carbon:[[@LINE+2]]:15-28: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] // CHECK:STDERR: let generic Constant: type = (); @@ -112,9 +104,7 @@ interface I { } fn Test() { - // CHECK:STDERR: fail_todo_named_constant_in_nested_facet_type.carbon:[[@LINE+4]]:15: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] - // CHECK:STDERR: let generic Constant: type = (); - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_named_constant_in_nested_facet_type.carbon:[[@LINE+2]]:15-28: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] // CHECK:STDERR: let generic Constant: type = (); @@ -137,9 +127,7 @@ interface I { } fn Test() { - // CHECK:STDERR: fail_todo_named_constant_in_nested_facet_type_caller.carbon:[[@LINE+4]]:15: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] - // CHECK:STDERR: let generic Constant: type = (); - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_named_constant_in_nested_facet_type_caller.carbon:[[@LINE+2]]:15-28: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] // CHECK:STDERR: let generic Constant: type = (); @@ -162,9 +150,7 @@ interface I { } fn Test() { - // CHECK:STDERR: fail_named_constant_in_nested_facet_type_callee.carbon:[[@LINE+4]]:15: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] - // CHECK:STDERR: let generic Constant: type = (); - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_named_constant_in_nested_facet_type_callee.carbon:[[@LINE+2]]:15-28: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] // CHECK:STDERR: let generic Constant: type = (); diff --git a/toolchain/check/testdata/facet/nested_facet_types.carbon b/toolchain/check/testdata/facet/nested_facet_types.carbon index 9f4d8e53efe7..436a0dac776d 100644 --- a/toolchain/check/testdata/facet/nested_facet_types.carbon +++ b/toolchain/check/testdata/facet/nested_facet_types.carbon @@ -72,9 +72,7 @@ interface Z { let T: type; } -// CHECK:STDERR: fail_nested_facet_types_different.carbon:[[@LINE+4]]:25: error: associated constant `.(Z.T)` given two different values `()` and `{}` [AssociatedConstantWithDifferentValues] -// CHECK:STDERR: fn F(unused generic FF: (Z where .T = ()) where .T = {}) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_nested_facet_types_different.carbon:[[@LINE+2]]:25-55: error: associated constant `.(Z.T)` given two different values `()` and `{}` [AssociatedConstantWithDifferentValues] // CHECK:STDERR: fn F(unused generic FF: (Z where .T = ()) where .T = {}) {} @@ -86,9 +84,7 @@ interface Z { let U: type; } -// CHECK:STDERR: fail_nested_facet_types_different_with_associated.carbon:[[@LINE+4]]:25: error: associated constant `.(Z.T)` given two different values `.(Z.U)` and `{}` [AssociatedConstantWithDifferentValues] -// CHECK:STDERR: fn F(unused generic FF: (Z where .T = .U) where .T = {}) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_nested_facet_types_different_with_associated.carbon:[[@LINE+2]]:25-55: error: associated constant `.(Z.T)` given two different values `.(Z.U)` and `{}` [AssociatedConstantWithDifferentValues] // CHECK:STDERR: fn F(unused generic FF: (Z where .T = .U) where .T = {}) {} @@ -101,9 +97,7 @@ interface Z { } interface Y {} -// CHECK:STDERR: fail_nested_facet_types_different_with_impls_interface.carbon:[[@LINE+4]]:25: error: associated constant `.(Z.T)` given two different values `()` and `{}` [AssociatedConstantWithDifferentValues] -// CHECK:STDERR: fn F(unused generic FF: (Z where .Self impls Y and .T = ()) where .T = {}) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_nested_facet_types_different_with_impls_interface.carbon:[[@LINE+2]]:25-73: error: associated constant `.(Z.T)` given two different values `()` and `{}` [AssociatedConstantWithDifferentValues] // CHECK:STDERR: fn F(unused generic FF: (Z where .Self impls Y and .T = ()) where .T = {}) {} @@ -116,9 +110,7 @@ interface Z { } constraint Y {} -// CHECK:STDERR: fail_nested_facet_types_different_with_impls_constraint.carbon:[[@LINE+4]]:25: error: associated constant `.(Z.T)` given two different values `()` and `{}` [AssociatedConstantWithDifferentValues] -// CHECK:STDERR: fn F(unused generic FF: (Z where .Self impls Y and .T = ()) where .T = {}) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_nested_facet_types_different_with_impls_constraint.carbon:[[@LINE+2]]:25-73: error: associated constant `.(Z.T)` given two different values `()` and `{}` [AssociatedConstantWithDifferentValues] // CHECK:STDERR: fn F(unused generic FF: (Z where .Self impls Y and .T = ()) where .T = {}) {} @@ -131,9 +123,7 @@ interface Z { } class C(T: type) {} -// CHECK:STDERR: fail_nested_facet_types_different_with_associated_in_generic_parameter.carbon:[[@LINE+4]]:25: error: associated constant `.(Z.T)` given two different values `C(.(Z.U))` and `{}` [AssociatedConstantWithDifferentValues] -// CHECK:STDERR: fn F(unused generic FF: (Z where .T = C(.U)) where .T = {}) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_nested_facet_types_different_with_associated_in_generic_parameter.carbon:[[@LINE+2]]:25-58: error: associated constant `.(Z.T)` given two different values `C(.(Z.U))` and `{}` [AssociatedConstantWithDifferentValues] // CHECK:STDERR: fn F(unused generic FF: (Z where .T = C(.U)) where .T = {}) {} @@ -155,9 +145,7 @@ interface Z { let U: type; } -// CHECK:STDERR: fail_nested_facet_types_different_with_bitand.carbon:[[@LINE+4]]:25: error: associated constant `.(Z.T)` given two different values `.(Z.U)` and `{}` [AssociatedConstantWithDifferentValues] -// CHECK:STDERR: fn F(unused generic FF: ((Z where .T = .U) where .T = .U) & (Z where .T = {})) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_nested_facet_types_different_with_bitand.carbon:[[@LINE+2]]:25-77: error: associated constant `.(Z.T)` given two different values `.(Z.U)` and `{}` [AssociatedConstantWithDifferentValues] // CHECK:STDERR: fn F(unused generic FF: ((Z where .T = .U) where .T = .U) & (Z where .T = {})) {} @@ -169,9 +157,7 @@ interface Z { let U: type; } -// CHECK:STDERR: fail_nested_facet_type_cycle.carbon:[[@LINE+4]]:25: error: found cycle in facet type constraint for `.(Z.U)` [FacetTypeConstraintCycle] -// CHECK:STDERR: fn F(unused generic FF: (Z where .T = .U) where .U = .T) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_nested_facet_type_cycle.carbon:[[@LINE+2]]:25-55: error: found cycle in facet type constraint for `.(Z.U)` [FacetTypeConstraintCycle] // CHECK:STDERR: fn F(unused generic FF: (Z where .T = .U) where .U = .T) {} @@ -188,9 +174,7 @@ interface Z { // The ordering here is meant to find a way to insert a LHS between the two `.S` // ids, by producing different orderings to get an id between them. -// CHECK:STDERR: fail_nested_facet_types_different_separated_order_one.carbon:[[@LINE+4]]:25: error: associated constant `.(Z.S)` given two different values `.(Z.U)` and `{}` [AssociatedConstantWithDifferentValues] -// CHECK:STDERR: fn F(unused generic FF: (((Z where .S = .U) where .V = {}) where .T = .U) & (Z where .S = {})) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_nested_facet_types_different_separated_order_one.carbon:[[@LINE+2]]:25-93: error: associated constant `.(Z.S)` given two different values `.(Z.U)` and `{}` [AssociatedConstantWithDifferentValues] // CHECK:STDERR: fn F(unused generic FF: (((Z where .S = .U) where .V = {}) where .T = .U) & (Z where .S = {})) {} @@ -208,9 +192,7 @@ interface Z { // ids, by producing different orderings to get an id between them. As of today, // this is the case where `.T` is sorted between the two `.S` rewrite rules. -// CHECK:STDERR: fail_nested_facet_types_different_separated_order_two.carbon:[[@LINE+4]]:25: error: associated constant `.(Z.S)` given two different values `{}` and `.(Z.U)` [AssociatedConstantWithDifferentValues] -// CHECK:STDERR: fn F(unused generic FF: (((Z where .V = {}) where .S = .U) where .T = .U) & (Z where .S = {})) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_nested_facet_types_different_separated_order_two.carbon:[[@LINE+2]]:25-93: error: associated constant `.(Z.S)` given two different values `{}` and `.(Z.U)` [AssociatedConstantWithDifferentValues] // CHECK:STDERR: fn F(unused generic FF: (((Z where .V = {}) where .S = .U) where .T = .U) & (Z where .S = {})) {} @@ -227,9 +209,7 @@ interface Z { // The ordering here is meant to find a way to insert a LHS between the two `.S` // ids, by producing different orderings to get an id between them. -// CHECK:STDERR: fail_nested_facet_types_different_separated_order_three.carbon:[[@LINE+4]]:25: error: associated constant `.(Z.S)` given two different values `{}` and `.(Z.U)` [AssociatedConstantWithDifferentValues] -// CHECK:STDERR: fn F(unused generic FF: (((Z where .V = {}) where .T = .U) where .S = .U) & (Z where .S = {})) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_nested_facet_types_different_separated_order_three.carbon:[[@LINE+2]]:25-93: error: associated constant `.(Z.S)` given two different values `{}` and `.(Z.U)` [AssociatedConstantWithDifferentValues] // CHECK:STDERR: fn F(unused generic FF: (((Z where .V = {}) where .T = .U) where .S = .U) & (Z where .S = {})) {} @@ -308,12 +288,8 @@ constraint NZ2 { } fn F(generic FF: ((Y where .Y1 = ()) where .Self impls NZ1) where .Self impls NZ2) -> FF.(Z.Z1) { - // CHECK:STDERR: fail_todo_nested_impl_combine_rewrites_from_named_constraints.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `C(())` to `FF.(Z.Z1)` [ConversionFailure] - // CHECK:STDERR: return () as C(()); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_nested_impl_combine_rewrites_from_named_constraints.carbon:[[@LINE+4]]:3: note: type `C(())` does not implement interface `Core.ImplicitAs(FF.(Z.Z1))` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return () as C(()); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_nested_impl_combine_rewrites_from_named_constraints.carbon:[[@LINE+3]]:3-21: error: cannot implicitly convert expression of type `C(())` to `FF.(Z.Z1)` [ConversionFailure] + // CHECK:STDERR: fail_todo_nested_impl_combine_rewrites_from_named_constraints.carbon:[[@LINE+2]]:3-21: note: type `C(())` does not implement interface `Core.ImplicitAs(FF.(Z.Z1))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return () as C(()); } @@ -321,12 +297,8 @@ fn F(generic FF: ((Y where .Y1 = ()) where .Self impls NZ1) where .Self impls NZ // --- fail_where_nested_inside_where_impls.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_where_nested_inside_where_impls.carbon:[[@LINE+7]]:41: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] -// CHECK:STDERR: fn F(generic _: type where .Self impls (type where .Self impls type)) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_where_nested_inside_where_impls.carbon:[[@LINE+4]]:17: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] -// CHECK:STDERR: fn F(generic _: type where .Self impls (type where .Self impls type)) {} -// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: fail_where_nested_inside_where_impls.carbon:[[@LINE+3]]:41-67: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] +// CHECK:STDERR: fail_where_nested_inside_where_impls.carbon:[[@LINE+2]]:17-26: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] // CHECK:STDERR: fn F(generic _: type where .Self impls (type where .Self impls type)) {} @@ -337,12 +309,8 @@ interface Z { let Z1: type; } -// CHECK:STDERR: fail_where_nested_inside_where_rewrite.carbon:[[@LINE+7]]:32: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] -// CHECK:STDERR: fn F(generic _: Z where .Z1 = (type where .Self impls type)) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_where_nested_inside_where_rewrite.carbon:[[@LINE+4]]:17: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] -// CHECK:STDERR: fn F(generic _: Z where .Z1 = (type where .Self impls type)) {} -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_where_nested_inside_where_rewrite.carbon:[[@LINE+3]]:32-58: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] +// CHECK:STDERR: fail_where_nested_inside_where_rewrite.carbon:[[@LINE+2]]:17-23: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] // CHECK:STDERR: fn F(generic _: Z where .Z1 = (type where .Self impls type)) {} @@ -352,12 +320,8 @@ library "[[@TEST_NAME]]"; interface Z {} class C; -// CHECK:STDERR: fail_where_nested_inside_where_same_type.carbon:[[@LINE+7]]:31: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] -// CHECK:STDERR: fn F(generic _: Z where C == (type where .Self impls type)) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_where_nested_inside_where_same_type.carbon:[[@LINE+4]]:17: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] -// CHECK:STDERR: fn F(generic _: Z where C == (type where .Self impls type)) {} -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_where_nested_inside_where_same_type.carbon:[[@LINE+3]]:31-57: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] +// CHECK:STDERR: fail_where_nested_inside_where_same_type.carbon:[[@LINE+2]]:17-23: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] // CHECK:STDERR: fn F(generic _: Z where C == (type where .Self impls type)) {} @@ -367,9 +331,7 @@ library "[[@TEST_NAME]]"; interface Z(T: type) {} interface Y {} -// CHECK:STDERR: fail_where_nested_inside_binding.carbon:[[@LINE+4]]:17: error: found `where` expression in binding's type that does not constrain the binding [InvalidWhereInsideBinding] -// CHECK:STDERR: fn F(generic _: Z(type where .Self impls Y)) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_where_nested_inside_binding.carbon:[[@LINE+2]]:17-43: error: found `where` expression in binding's type that does not constrain the binding [InvalidWhereInsideBinding] // CHECK:STDERR: fn F(generic _: Z(type where .Self impls Y)) {} @@ -379,9 +341,7 @@ library "[[@TEST_NAME]]"; interface Z(T: type) {} interface Y {} -// CHECK:STDERR: fail_where_double_nested_inside_binding.carbon:[[@LINE+4]]:17: error: found `where` expression in binding's type that does not constrain the binding [InvalidWhereInsideBinding] -// CHECK:STDERR: fn F(generic _: Z(type where .Self impls Y) where .Self impls Y) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_where_double_nested_inside_binding.carbon:[[@LINE+2]]:17-43: error: found `where` expression in binding's type that does not constrain the binding [InvalidWhereInsideBinding] // CHECK:STDERR: fn F(generic _: Z(type where .Self impls Y) where .Self impls Y) {} @@ -391,9 +351,7 @@ library "[[@TEST_NAME]]"; interface Z(T: type) {} interface Y {} -// CHECK:STDERR: fail_where_triple_nested_inside_binding.carbon:[[@LINE+4]]:18: error: found `where` expression in binding's type that does not constrain the binding [InvalidWhereInsideBinding] -// CHECK:STDERR: fn F(generic _: (Z(type where .Self impls Y) where .Self impls Y) where .Self impls Y) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_where_triple_nested_inside_binding.carbon:[[@LINE+2]]:18-44: error: found `where` expression in binding's type that does not constrain the binding [InvalidWhereInsideBinding] // CHECK:STDERR: fn F(generic _: (Z(type where .Self impls Y) where .Self impls Y) where .Self impls Y) {} @@ -403,9 +361,7 @@ library "[[@TEST_NAME]]"; interface Z(T: type) {} interface Y {} -// CHECK:STDERR: fail_where_nested_inside_binding_combined.carbon:[[@LINE+4]]:17: error: found `where` expression in binding's type that does not constrain the binding [InvalidWhereInsideBinding] -// CHECK:STDERR: fn F(generic _: Z(type where .Self impls Y) & Y) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_where_nested_inside_binding_combined.carbon:[[@LINE+2]]:17-47: error: found `where` expression in binding's type that does not constrain the binding [InvalidWhereInsideBinding] // CHECK:STDERR: fn F(generic _: Z(type where .Self impls Y) & Y) {} @@ -415,9 +371,7 @@ library "[[@TEST_NAME]]"; interface Z(T: type) {} interface Y {} -// CHECK:STDERR: fail_where_double_nested_inside_binding_combined.carbon:[[@LINE+4]]:17: error: found `where` expression in binding's type that does not constrain the binding [InvalidWhereInsideBinding] -// CHECK:STDERR: fn F(generic _: (Z(type where .Self impls Y) where .Self impls Y) & Y) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_where_double_nested_inside_binding_combined.carbon:[[@LINE+2]]:17-69: error: found `where` expression in binding's type that does not constrain the binding [InvalidWhereInsideBinding] // CHECK:STDERR: fn F(generic _: (Z(type where .Self impls Y) where .Self impls Y) & Y) {} @@ -427,9 +381,7 @@ library "[[@TEST_NAME]]"; interface Z(T: type) {} interface Y {} -// CHECK:STDERR: fail_where_triple_nested_inside_binding_combined.carbon:[[@LINE+4]]:17: error: found `where` expression in binding's type that does not constrain the binding [InvalidWhereInsideBinding] -// CHECK:STDERR: fn F(generic _: ((Z(type where .Self impls Y) where .Self impls Y) where .Self impls Y) & Y) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_where_triple_nested_inside_binding_combined.carbon:[[@LINE+2]]:17-91: error: found `where` expression in binding's type that does not constrain the binding [InvalidWhereInsideBinding] // CHECK:STDERR: fn F(generic _: ((Z(type where .Self impls Y) where .Self impls Y) where .Self impls Y) & Y) {} @@ -439,9 +391,7 @@ library "[[@TEST_NAME]]"; class C(T: type); interface Y {} -// CHECK:STDERR: fail_where_nested_inside_binding_of_non_facet_type.carbon:[[@LINE+4]]:17: error: found `where` expression in binding's type that does not constrain the binding [InvalidWhereInsideBinding] -// CHECK:STDERR: fn F(generic _: C(type where .Self impls Y)) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_where_nested_inside_binding_of_non_facet_type.carbon:[[@LINE+2]]:17-43: error: found `where` expression in binding's type that does not constrain the binding [InvalidWhereInsideBinding] // CHECK:STDERR: fn F(generic _: C(type where .Self impls Y)) {} @@ -451,9 +401,7 @@ library "[[@TEST_NAME]]"; interface Z(T: type) {} interface Y {} -// CHECK:STDERR: fail_where_nested_inside_runtime_let_binding.carbon:[[@LINE+4]]:9: error: found `where` expression in binding's type that does not constrain the binding [InvalidWhereInsideBinding] -// CHECK:STDERR: fn F(_: Z(type where .Self impls Y)) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_where_nested_inside_runtime_let_binding.carbon:[[@LINE+2]]:9-35: error: found `where` expression in binding's type that does not constrain the binding [InvalidWhereInsideBinding] // CHECK:STDERR: fn F(_: Z(type where .Self impls Y)) {} @@ -463,9 +411,7 @@ library "[[@TEST_NAME]]"; interface Z(T: type) {} interface Y {} -// CHECK:STDERR: fail_where_nested_inside_form_binding.carbon:[[@LINE+4]]:10: error: found `where` expression in binding's type that does not constrain the binding [InvalidWhereInsideBinding] -// CHECK:STDERR: fn F(_:? Z(type where .Self impls Y)) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_where_nested_inside_form_binding.carbon:[[@LINE+2]]:10-36: error: found `where` expression in binding's type that does not constrain the binding [InvalidWhereInsideBinding] // CHECK:STDERR: fn F(_:? Z(type where .Self impls Y)) {} @@ -475,8 +421,6 @@ library "[[@TEST_NAME]]"; interface Z(T: type) {} interface Y {} -// CHECK:STDERR: fail_where_nested_inside_var_binding.carbon:[[@LINE+4]]:13: error: found `where` expression in binding's type that does not constrain the binding [InvalidWhereInsideBinding] -// CHECK:STDERR: fn F(var _: Z(type where .Self impls Y)) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_where_nested_inside_var_binding.carbon:[[@LINE+2]]:13-39: error: found `where` expression in binding's type that does not constrain the binding [InvalidWhereInsideBinding] // CHECK:STDERR: fn F(var _: Z(type where .Self impls Y)) {} diff --git a/toolchain/check/testdata/facet/nested_facet_types_from_eval.carbon b/toolchain/check/testdata/facet/nested_facet_types_from_eval.carbon index d99fe4e4a005..1368e31fe93c 100644 --- a/toolchain/check/testdata/facet/nested_facet_types_from_eval.carbon +++ b/toolchain/check/testdata/facet/nested_facet_types_from_eval.carbon @@ -21,9 +21,7 @@ alias A = I where .Self == C; // The use of `A` introduces a `where` expression inside the `where` written // here, which is an error. // -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_lhs.carbon:[[@LINE+4]]:28: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] -// CHECK:STDERR: fn F(generic _: type where C(A) impls type) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_lhs.carbon:[[@LINE+2]]:28-42: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] // CHECK:STDERR: fn F(generic _: type where C(A) impls type) {} @@ -37,12 +35,8 @@ alias A = type where .Self impls I; // The use of `A` introduces a `where` expression inside the `where` written // here, which is an error. // -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_self_impls_interface.carbon:[[@LINE+7]]:40: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] -// CHECK:STDERR: fn F(generic _: type where .Self impls A) {} -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_self_impls_interface.carbon:[[@LINE+4]]:17: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] -// CHECK:STDERR: fn F(generic _: type where .Self impls A) {} -// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_self_impls_interface.carbon:[[@LINE+3]]:40: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] +// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_self_impls_interface.carbon:[[@LINE+2]]:17-26: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] // CHECK:STDERR: fn F(generic _: type where .Self impls A) {} @@ -56,12 +50,8 @@ alias A = type where .Self impls N; // The use of `A` introduces a `where` expression inside the `where` written // here, which is an error. // -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_self_impls_named_constraint.carbon:[[@LINE+7]]:40: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] -// CHECK:STDERR: fn F(generic _: type where .Self impls A) {} -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_self_impls_named_constraint.carbon:[[@LINE+4]]:17: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] -// CHECK:STDERR: fn F(generic _: type where .Self impls A) {} -// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_self_impls_named_constraint.carbon:[[@LINE+3]]:40: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] +// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_self_impls_named_constraint.carbon:[[@LINE+2]]:17-26: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] // CHECK:STDERR: fn F(generic _: type where .Self impls A) {} @@ -76,12 +66,8 @@ alias A = type where C impls I(.Self); // The use of `A` introduces a `where` expression inside the `where` written // here, which is an error. // -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_type_impls_interface.carbon:[[@LINE+7]]:40: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] -// CHECK:STDERR: fn F(generic _: type where .Self impls A) {} -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_type_impls_interface.carbon:[[@LINE+4]]:17: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] -// CHECK:STDERR: fn F(generic _: type where .Self impls A) {} -// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_type_impls_interface.carbon:[[@LINE+3]]:40: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] +// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_type_impls_interface.carbon:[[@LINE+2]]:17-26: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] // CHECK:STDERR: fn F(generic _: type where .Self impls A) {} @@ -96,12 +82,8 @@ alias A = type where C impls N(.Self); // The use of `A` introduces a `where` expression inside the `where` written // here, which is an error. // -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_type_impls_named_constraint.carbon:[[@LINE+7]]:40: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] -// CHECK:STDERR: fn F(generic _: type where .Self impls A) {} -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_type_impls_named_constraint.carbon:[[@LINE+4]]:17: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] -// CHECK:STDERR: fn F(generic _: type where .Self impls A) {} -// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_type_impls_named_constraint.carbon:[[@LINE+3]]:40: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] +// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_type_impls_named_constraint.carbon:[[@LINE+2]]:17-26: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] // CHECK:STDERR: fn F(generic _: type where .Self impls A) {} @@ -116,12 +98,8 @@ alias A = I where .I1 = C; // The use of `A` introduces a `where` expression inside the `where` written // here, which is an error. // -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_rewrite.carbon:[[@LINE+7]]:40: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] -// CHECK:STDERR: fn F(generic _: type where .Self impls A) {} -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_rewrite.carbon:[[@LINE+4]]:17: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] -// CHECK:STDERR: fn F(generic _: type where .Self impls A) {} -// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_rewrite.carbon:[[@LINE+3]]:40: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] +// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_rewrite.carbon:[[@LINE+2]]:17-26: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] // CHECK:STDERR: fn F(generic _: type where .Self impls A) {} @@ -135,12 +113,8 @@ alias A = type where .Self == C; // The use of `A` introduces a `where` expression inside the `where` written // here, which is an error. // -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_equiv.carbon:[[@LINE+7]]:40: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] -// CHECK:STDERR: fn F(generic _: type where .Self impls A) {} -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_equiv.carbon:[[@LINE+4]]:17: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] -// CHECK:STDERR: fn F(generic _: type where .Self impls A) {} -// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_equiv.carbon:[[@LINE+3]]:40: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] +// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_equiv.carbon:[[@LINE+2]]:17-26: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] // CHECK:STDERR: fn F(generic _: type where .Self impls A) {} @@ -155,12 +129,8 @@ alias A = I where .Self == C; // The use of `A` introduces a `where` expression inside the `where` written // here, which is an error. // -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_rewrite_rhs.carbon:[[@LINE+7]]:31: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] -// CHECK:STDERR: fn F(generic _: I where .I1 = A) {} -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_rewrite_rhs.carbon:[[@LINE+4]]:17: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] -// CHECK:STDERR: fn F(generic _: I where .I1 = A) {} -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_where_nested_inside_where_through_alias_rewrite_rhs.carbon:[[@LINE+3]]:31: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] +// CHECK:STDERR: fail_where_nested_inside_where_through_alias_rewrite_rhs.carbon:[[@LINE+2]]:17-23: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] // CHECK:STDERR: fn F(generic _: I where .I1 = A) {} @@ -175,12 +145,8 @@ alias A = I where .Self == C; // The use of `A` introduces a `where` expression inside the `where` written // here, which is an error. // -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_equiv_lhs.carbon:[[@LINE+7]]:28: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] -// CHECK:STDERR: fn F(generic _: type where A == .Self) {} -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_equiv_lhs.carbon:[[@LINE+4]]:17: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] -// CHECK:STDERR: fn F(generic _: type where A == .Self) {} -// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: fail_where_nested_inside_where_through_alias_equiv_lhs.carbon:[[@LINE+3]]:28: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] +// CHECK:STDERR: fail_where_nested_inside_where_through_alias_equiv_lhs.carbon:[[@LINE+2]]:17-26: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] // CHECK:STDERR: fn F(generic _: type where A == .Self) {} @@ -195,12 +161,8 @@ alias A = I where .Self == C; // The use of `A` introduces a `where` expression inside the `where` written // here, which is an error. // -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_equiv_rhs.carbon:[[@LINE+7]]:37: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] -// CHECK:STDERR: fn F(generic _: type where .Self == A) {} -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_equiv_rhs.carbon:[[@LINE+4]]:17: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] -// CHECK:STDERR: fn F(generic _: type where .Self == A) {} -// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: fail_where_nested_inside_where_through_alias_equiv_rhs.carbon:[[@LINE+3]]:37: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] +// CHECK:STDERR: fail_where_nested_inside_where_through_alias_equiv_rhs.carbon:[[@LINE+2]]:17-26: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] // CHECK:STDERR: fn F(generic _: type where .Self == A) {} @@ -217,12 +179,8 @@ eval fn E() -> type { // The use of `E()` introduces a `where` expression inside the `where` // written here, which is an error. // -// CHECK:STDERR: fail_where_nested_inside_where_through_fn_eval.carbon:[[@LINE+7]]:40: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] -// CHECK:STDERR: fn F(generic _: type where .Self impls E()) {} -// CHECK:STDERR: ^~~ -// CHECK:STDERR: fail_where_nested_inside_where_through_fn_eval.carbon:[[@LINE+4]]:17: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] -// CHECK:STDERR: fn F(generic _: type where .Self impls E()) {} -// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: fail_where_nested_inside_where_through_fn_eval.carbon:[[@LINE+3]]:40-42: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] +// CHECK:STDERR: fail_where_nested_inside_where_through_fn_eval.carbon:[[@LINE+2]]:17-26: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] // CHECK:STDERR: fn F(generic _: type where .Self impls E()) {} @@ -244,11 +202,7 @@ alias X = {} as X1; // The use of `type * X` introduces a `where` expression inside the `where` // written here, which is an error. // -// CHECK:STDERR: fail_where_nested_inside_where_through_operator_eval.carbon:[[@LINE+7]]:40: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] -// CHECK:STDERR: fn F(generic _: type where .Self impls type * X) {} -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_where_nested_inside_where_through_operator_eval.carbon:[[@LINE+4]]:17: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] -// CHECK:STDERR: fn F(generic _: type where .Self impls type * X) {} -// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: fail_where_nested_inside_where_through_operator_eval.carbon:[[@LINE+3]]:40-47: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] +// CHECK:STDERR: fail_where_nested_inside_where_through_operator_eval.carbon:[[@LINE+2]]:17-26: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] // CHECK:STDERR: fn F(generic _: type where .Self impls type * X) {} diff --git a/toolchain/check/testdata/facet/partially_identified.carbon b/toolchain/check/testdata/facet/partially_identified.carbon index 69d33cdf4a93..3707ff6c1a34 100644 --- a/toolchain/check/testdata/facet/partially_identified.carbon +++ b/toolchain/check/testdata/facet/partially_identified.carbon @@ -16,12 +16,8 @@ library "[[@TEST_NAME]]"; interface Y {} interface NeedsY(T: Y) {} constraint W { - // CHECK:STDERR: fail_self_doesnt_meet_constraint.carbon:[[@LINE+7]]:24: error: cannot convert type `Self` that implements `W` into type implementing `Y` [ConversionFailureFacetToFacet] - // CHECK:STDERR: extend require impls NeedsY(Self); - // CHECK:STDERR: ^~~~~~~~~~~~ - // CHECK:STDERR: fail_self_doesnt_meet_constraint.carbon:[[@LINE-5]]:18: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: interface NeedsY(T: Y) {} - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_self_doesnt_meet_constraint.carbon:[[@LINE+3]]:24-35: error: cannot convert type `Self` that implements `W` into type implementing `Y` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_self_doesnt_meet_constraint.carbon:[[@LINE-3]]:18-21: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: extend require impls NeedsY(Self); } @@ -172,12 +168,8 @@ interface X { let XZ: Z; } constraint W { require impls Z; // Target of impl lookup can not be partially identified. - // CHECK:STDERR: fail_impl_lookup_target_partially_identified.carbon:[[@LINE+7]]:32: error: facet type `Z & W` can not be identified [ImplLookupInUnidentifiedFacetType] - // CHECK:STDERR: require impls X where .XZ = (Self as (W & Z)); - // CHECK:STDERR: ^~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_lookup_target_partially_identified.carbon:[[@LINE-6]]:1: note: constraint is currently being defined [NamedConstraintIncompleteWithinDefinition] - // CHECK:STDERR: constraint W { - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_impl_lookup_target_partially_identified.carbon:[[@LINE+3]]:32-46: error: facet type `Z & W` can not be identified [ImplLookupInUnidentifiedFacetType] + // CHECK:STDERR: fail_impl_lookup_target_partially_identified.carbon:[[@LINE-4]]:1-14: note: constraint is currently being defined [NamedConstraintIncompleteWithinDefinition] // CHECK:STDERR: require impls X where .XZ = (Self as (W & Z)); } diff --git a/toolchain/check/testdata/facet/period_self.carbon b/toolchain/check/testdata/facet/period_self.carbon index e7aa53936a1e..e54243a43a31 100644 --- a/toolchain/check/testdata/facet/period_self.carbon +++ b/toolchain/check/testdata/facet/period_self.carbon @@ -41,9 +41,7 @@ fn G(generic _: I(.Self) where .I1 = ()) {} // --- fail_period_self_as_type.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_period_self_as_type.carbon:[[@LINE+4]]:16: error: `.Self` used in a type that is not a facet type [PeriodSelfInNonFacetType] -// CHECK:STDERR: interface I(T: .Self) { -// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: fail_period_self_as_type.carbon:[[@LINE+2]]:16-20: error: `.Self` used in a type that is not a facet type [PeriodSelfInNonFacetType] // CHECK:STDERR: interface I(T: .Self) { fn G() -> T; @@ -86,23 +84,17 @@ fn F2[U: I(.Self)](unused T: U*) {} fn F(generic U: I(.Self)) { // Caller sees the returned `.Self` type from `F()` as the full `U`. - // CHECK:STDERR: fail_todo_return_of_type_period_self.carbon:[[@LINE+4]]:3: error: type `.Self` does not support qualified expressions [QualifiedExprUnsupported] - // CHECK:STDERR: U.G()->G()->G(); - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_todo_return_of_type_period_self.carbon:[[@LINE+2]]:3-10: error: type `.Self` does not support qualified expressions [QualifiedExprUnsupported] // CHECK:STDERR: U.G()->G()->G(); // Conversion to `type` retains access to all of `U`. - // CHECK:STDERR: fail_todo_return_of_type_period_self.carbon:[[@LINE+4]]:3: error: type `.Self` does not support qualified expressions [QualifiedExprUnsupported] - // CHECK:STDERR: (U as type).G()->G()->G(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_return_of_type_period_self.carbon:[[@LINE+2]]:3-20: error: type `.Self` does not support qualified expressions [QualifiedExprUnsupported] // CHECK:STDERR: (U as type).G()->G()->G(); // Using the returned `.Self` as a facet value works, not just member lookup // on its facet type. - // CHECK:STDERR: fail_todo_return_of_type_period_self.carbon:[[@LINE+4]]:6: error: type `.Self` does not support qualified expressions [QualifiedExprUnsupported] - // CHECK:STDERR: F2(U.G()->G()->G()); - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_todo_return_of_type_period_self.carbon:[[@LINE+2]]:6-13: error: type `.Self` does not support qualified expressions [QualifiedExprUnsupported] // CHECK:STDERR: F2(U.G()->G()->G()); } @@ -123,21 +115,15 @@ fn F2[U: I(.Self) & J(.Self)](unused T: U*) {} fn F(generic U: I(.Self) & J(.Self)) { // TODO: The returned value of `I1` and `J1` has type `U` which has access to // the methods of `I` and `J`. - // CHECK:STDERR: fail_todo_return_of_type_period_self_extends_interface.carbon:[[@LINE+4]]:3: error: type `.Self` does not support qualified expressions [QualifiedExprUnsupported] - // CHECK:STDERR: U.I1()->J1()->I1()->J1()->I1()->J1(); - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_todo_return_of_type_period_self_extends_interface.carbon:[[@LINE+2]]:3-12: error: type `.Self` does not support qualified expressions [QualifiedExprUnsupported] // CHECK:STDERR: U.I1()->J1()->I1()->J1()->I1()->J1(); - // CHECK:STDERR: fail_todo_return_of_type_period_self_extends_interface.carbon:[[@LINE+4]]:3: error: type `.Self` does not support qualified expressions [QualifiedExprUnsupported] - // CHECK:STDERR: (U as type).I1()->J1()->I1()->J1()->I1()->J1(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_return_of_type_period_self_extends_interface.carbon:[[@LINE+2]]:3-22: error: type `.Self` does not support qualified expressions [QualifiedExprUnsupported] // CHECK:STDERR: (U as type).I1()->J1()->I1()->J1()->I1()->J1(); // TODO: Using the returned value of type `U` as a facet value works. - // CHECK:STDERR: fail_todo_return_of_type_period_self_extends_interface.carbon:[[@LINE+4]]:6: error: type `.Self` does not support qualified expressions [QualifiedExprUnsupported] - // CHECK:STDERR: F2(U.I1()->J1()->I1()->J1()->I1()->J1()); - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_todo_return_of_type_period_self_extends_interface.carbon:[[@LINE+2]]:6-15: error: type `.Self` does not support qualified expressions [QualifiedExprUnsupported] // CHECK:STDERR: F2(U.I1()->J1()->I1()->J1()->I1()->J1()); } @@ -161,30 +147,22 @@ fn G(generic U: I(.Self) where .Self impls J(.Self)) { // TODO: This step should work. // - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let u: U = U.I1(); - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_todo_return_of_period_self_impls_interface.carbon:[[@LINE+3]]:14-19: error: cannot implicitly convert expression of type `.Self` to `U` [ConversionFailure] + // CHECK:STDERR: fail_todo_return_of_period_self_impls_interface.carbon:[[@LINE+2]]:14-19: note: type `.Self` does not implement interface `Core.ImplicitAs(U)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let u: U = U.I1(); // `u` is a non-type value. Can call methods with `self` through compound // member lookup, but can't call methods without `self`. See the // `compound_access_through_call_with_self_param.carbon` test for the former. // - // CHECK:STDERR: fail_todo_return_of_period_self_impls_interface.carbon:[[@LINE+4]]:6: error: type `` does not support qualified expressions [QualifiedExprUnsupported] - // CHECK:STDERR: u.(J.J1)(); - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_todo_return_of_period_self_impls_interface.carbon:[[@LINE+2]]:6-9: error: type `` does not support qualified expressions [QualifiedExprUnsupported] // CHECK:STDERR: u.(J.J1)(); // This is the same as the above, since U.I1() returns a non-type value of // type `U`. // - // CHECK:STDERR: fail_todo_return_of_period_self_impls_interface.carbon:[[@LINE+4]]:11: error: type `` does not support qualified expressions [QualifiedExprUnsupported] - // CHECK:STDERR: U.I1().(J.J1)(); - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_todo_return_of_period_self_impls_interface.carbon:[[@LINE+2]]:11-14: error: type `` does not support qualified expressions [QualifiedExprUnsupported] // CHECK:STDERR: U.I1().(J.J1)(); } @@ -197,12 +175,8 @@ interface I(T: type) { } fn F(generic 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let unused a: U = U.G(); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_todo_return_of_type_period_self_has_type_u.carbon:[[@LINE+3]]:21-25: error: cannot implicitly convert expression of type `.Self` to `U` [ConversionFailure] + // CHECK:STDERR: fail_todo_return_of_type_period_self_has_type_u.carbon:[[@LINE+2]]:21-25: note: type `.Self` does not implement interface `Core.ImplicitAs(U)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused a: U = U.G(); } @@ -235,12 +209,8 @@ interface I(T: Core.Destroy) {} // TODO: Implied constraints that `.Self` impls `Core.Destroy` are satisfied by // the `&` expression. // -// CHECK:STDERR: fail_todo_period_self_parameter_constraint_satisfied_with_type_and.carbon:[[@LINE+7]]:39: error: cannot convert type `.Self` into type implementing `Core.Destroy` [ConversionFailureTypeToFacet] -// CHECK:STDERR: fn F(unused generic U: Core.Destroy & I(.Self)) {} -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_todo_period_self_parameter_constraint_satisfied_with_type_and.carbon:[[@LINE-8]]:13: note: initializing generic parameter `T` declared here [InitializingGenericParam] -// CHECK:STDERR: interface I(T: Core.Destroy) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_period_self_parameter_constraint_satisfied_with_type_and.carbon:[[@LINE+3]]:39-46: error: cannot convert type `.Self` into type implementing `Core.Destroy` [ConversionFailureTypeToFacet] +// CHECK:STDERR: fail_todo_period_self_parameter_constraint_satisfied_with_type_and.carbon:[[@LINE-6]]:13-27: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: fn F(unused generic U: Core.Destroy & I(.Self)) {} @@ -301,12 +271,8 @@ interface Z {} // This is missing `.Self impls M` so the `final impl` is not used, through // deduction is attempted. // -// CHECK:STDERR: fail_infinite_cycle_identifying_associated_constant_as_impls_type_missing_impls_m.carbon:[[@LINE+7]]:53: error: cannot implicitly convert expression of type `T.(L.W)` to `{}` [ConversionFailure] -// CHECK:STDERR: fn F(generic T: L where .W impls Z, a: T.W) -> {} { return a; } -// CHECK:STDERR: ^~~~~~~~~ -// CHECK:STDERR: fail_infinite_cycle_identifying_associated_constant_as_impls_type_missing_impls_m.carbon:[[@LINE+4]]:53: note: type `T.(L.W)` does not implement interface `Core.ImplicitAs({})` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: fn F(generic T: L where .W impls Z, a: T.W) -> {} { return a; } -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_infinite_cycle_identifying_associated_constant_as_impls_type_missing_impls_m.carbon:[[@LINE+3]]:53-61: error: cannot implicitly convert expression of type `T.(L.W)` to `{}` [ConversionFailure] +// CHECK:STDERR: fail_infinite_cycle_identifying_associated_constant_as_impls_type_missing_impls_m.carbon:[[@LINE+2]]:53-61: note: type `T.(L.W)` does not implement interface `Core.ImplicitAs({})` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn F(generic T: L where .W impls Z, a: T.W) -> {} { return a; } @@ -345,12 +311,8 @@ interface Z(T: type) {} // This is missing `.Self impls M` so the `final impl` is not used, through // deduction is attempted. // -// CHECK:STDERR: fail_infinite_cycle_identifying_associated_constant_in_impls_interface_as_type_missing_m.carbon:[[@LINE+7]]:60: error: cannot implicitly convert expression of type `T.(L.W)` to `()` [ConversionFailure] -// CHECK:STDERR: fn F(generic T: L where .Self impls Z(.W), a: T.W) -> () { return a; } -// CHECK:STDERR: ^~~~~~~~~ -// CHECK:STDERR: fail_infinite_cycle_identifying_associated_constant_in_impls_interface_as_type_missing_m.carbon:[[@LINE+4]]:60: note: type `T.(L.W)` does not implement interface `Core.ImplicitAs(())` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: fn F(generic T: L where .Self impls Z(.W), a: T.W) -> () { return a; } -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_infinite_cycle_identifying_associated_constant_in_impls_interface_as_type_missing_m.carbon:[[@LINE+3]]:60-68: error: cannot implicitly convert expression of type `T.(L.W)` to `()` [ConversionFailure] +// CHECK:STDERR: fail_infinite_cycle_identifying_associated_constant_in_impls_interface_as_type_missing_m.carbon:[[@LINE+2]]:60-68: note: type `T.(L.W)` does not implement interface `Core.ImplicitAs(())` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn F(generic T: L where .Self impls Z(.W), a: T.W) -> () { return a; } @@ -367,12 +329,8 @@ interface Z(T: L) {} // This is missing `.Self impls M` so the `final impl` is not used, through // deduction is attempted. // -// CHECK:STDERR: fail_infinite_cycle_identifying_period_self_in_impls_interface_as_type_missing_m.carbon:[[@LINE+7]]:63: error: cannot implicitly convert expression of type `T.(L.W)` to `()` [ConversionFailure] -// CHECK:STDERR: fn F(generic T: L where .Self impls Z(.Self), a: T.W) -> () { return a; } -// CHECK:STDERR: ^~~~~~~~~ -// CHECK:STDERR: fail_infinite_cycle_identifying_period_self_in_impls_interface_as_type_missing_m.carbon:[[@LINE+4]]:63: note: type `T.(L.W)` does not implement interface `Core.ImplicitAs(())` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: fn F(generic T: L where .Self impls Z(.Self), a: T.W) -> () { return a; } -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_infinite_cycle_identifying_period_self_in_impls_interface_as_type_missing_m.carbon:[[@LINE+3]]:63-71: error: cannot implicitly convert expression of type `T.(L.W)` to `()` [ConversionFailure] +// CHECK:STDERR: fail_infinite_cycle_identifying_period_self_in_impls_interface_as_type_missing_m.carbon:[[@LINE+2]]:63-71: note: type `T.(L.W)` does not implement interface `Core.ImplicitAs(())` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn F(generic T: L where .Self impls Z(.Self), a: T.W) -> () { return a; } @@ -412,12 +370,8 @@ interface Z(T: Y) {} // This is missing `.Self impls M` so the `final impl` is not used, through // deduction is attempted. // -// CHECK:STDERR: fail_infinite_cycle_identifying_associated_constant_in_impls_interface_as_facet_type_missing_m.carbon:[[@LINE+7]]:75: error: cannot implicitly convert expression of type `T.(L.W)` to `()` [ConversionFailure] -// CHECK:STDERR: fn F(generic T: L where .W impls Y and .Self impls Z(.W), a: T.W) -> () { return a; } -// CHECK:STDERR: ^~~~~~~~~ -// CHECK:STDERR: fail_infinite_cycle_identifying_associated_constant_in_impls_interface_as_facet_type_missing_m.carbon:[[@LINE+4]]:75: note: type `T.(L.W)` does not implement interface `Core.ImplicitAs(())` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: fn F(generic T: L where .W impls Y and .Self impls Z(.W), a: T.W) -> () { return a; } -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_infinite_cycle_identifying_associated_constant_in_impls_interface_as_facet_type_missing_m.carbon:[[@LINE+3]]:75-83: error: cannot implicitly convert expression of type `T.(L.W)` to `()` [ConversionFailure] +// CHECK:STDERR: fail_infinite_cycle_identifying_associated_constant_in_impls_interface_as_facet_type_missing_m.carbon:[[@LINE+2]]:75-83: note: type `T.(L.W)` does not implement interface `Core.ImplicitAs(())` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn F(generic T: L where .W impls Y and .Self impls Z(.W), a: T.W) -> () { return a; } @@ -619,9 +573,7 @@ class C(C1: type); // // TODO: We have a witness for `L(.Self: type)` but we need a witness for // `L(.Self: (L(.Self: type) & M(.Self: type)))`, so this fails to convert. -// CHECK:STDERR: fail_todo_concrete_access_witness_generic_m_in_extend_constraint_compound_access.carbon:[[@LINE+4]]:47: error: cannot convert type `.Self` that implements `L(.Self) & M(.Self)` into type implementing `L(.Self)` [ConversionFailureFacetToFacet] -// CHECK:STDERR: fn H(generic T: (L(.Self) & M(.Self)) where C(.Self.(L(.Self).W)) impls Z(.Self)) { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_concrete_access_witness_generic_m_in_extend_constraint_compound_access.carbon:[[@LINE+2]]:47-64: error: cannot convert type `.Self` that implements `L(.Self) & M(.Self)` into type implementing `L(.Self)` [ConversionFailureFacetToFacet] // CHECK:STDERR: fn H(generic T: (L(.Self) & M(.Self)) where C(.Self.(L(.Self).W)) impls Z(.Self)) { C(()) as Z(T); @@ -649,9 +601,7 @@ class C(C1: type); // witness for `M(.Self: L(.Self: type))` instead, so we don't use the impl. // The test passes if we write `.W` as `.Self.(L(.Self).W)` instead. fn H(generic T: (L(.Self) where .Self impls M(.Self)) where C(.W) impls Z(.Self)) { - // CHECK:STDERR: fail_todo_concrete_access_witness_generic_m_in_impls_interface.carbon:[[@LINE+4]]:3: error: cannot convert type `C(())` into type implementing `Z(T)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: C(()) as Z(T); - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_concrete_access_witness_generic_m_in_impls_interface.carbon:[[@LINE+2]]:3-15: error: cannot convert type `C(())` into type implementing `Z(T)` [ConversionFailureTypeToFacet] // CHECK:STDERR: C(()) as Z(T); } @@ -679,9 +629,7 @@ class C(C1: type); // witness for `M(.Self: L(.Self: type))` instead, so we don't use the impl. // The test passes if we write `.W` as `.Self.(L(.Self).W)` instead. fn H(generic T: (L(.Self) where .Self impls GivesM(.Self)) where C(.W) impls Z(.Self)) { - // CHECK:STDERR: fail_todo_concrete_access_witness_generic_m_in_impls_constraint.carbon:[[@LINE+4]]:3: error: cannot convert type `C(())` into type implementing `Z(T)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: C(()) as Z(T); - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_concrete_access_witness_generic_m_in_impls_constraint.carbon:[[@LINE+2]]:3-15: error: cannot convert type `C(())` into type implementing `Z(T)` [ConversionFailureTypeToFacet] // CHECK:STDERR: C(()) as Z(T); } @@ -749,9 +697,7 @@ class C(C1: type); // witness for `M(.Self: L(.Self: type))` instead, so we don't use the impl. // The test passes if we write `.W` as `.Self.(L(.Self).W)` instead. fn H(generic T: L(.Self) where .Self impls M(.Self) and C(.W) impls Z(.Self)) { - // CHECK:STDERR: fail_todo_concrete_access_witness_generic_m_in_earlier_requirement.carbon:[[@LINE+4]]:3: error: cannot convert type `C(())` into type implementing `Z(T)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: C(()) as Z(T); - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_concrete_access_witness_generic_m_in_earlier_requirement.carbon:[[@LINE+2]]:3-15: error: cannot convert type `C(())` into type implementing `Z(T)` [ConversionFailureTypeToFacet] // CHECK:STDERR: C(()) as Z(T); } @@ -777,9 +723,7 @@ class C(C1: type); // cycle that identifies `T`, which deduces `T: M` for the `impl`, which // identifies `T`. See TODO in CollectFacetWitnessSources for ideas. fn F(generic T: L where C(.W) impls Z(.Self) and .Self impls M) { - // CHECK:STDERR: fail_todo_concrete_access_witness.carbon:[[@LINE+4]]:3: error: cannot convert type `C(())` into type implementing `Z(T)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: C(()) as Z(T); - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_concrete_access_witness.carbon:[[@LINE+2]]:3-15: error: cannot convert type `C(())` into type implementing `Z(T)` [ConversionFailureTypeToFacet] // CHECK:STDERR: C(()) as Z(T); } @@ -789,9 +733,7 @@ library "[[@TEST_NAME]]"; class C(T: type); -// CHECK:STDERR: fail_period_self_in_class_argument.carbon:[[@LINE+4]]:17: error: `.Self` used in a type that is not a facet type [PeriodSelfInNonFacetType] -// CHECK:STDERR: fn F(generic _: C(.Self)) {} -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_period_self_in_class_argument.carbon:[[@LINE+2]]:17-24: error: `.Self` used in a type that is not a facet type [PeriodSelfInNonFacetType] // CHECK:STDERR: fn F(generic _: C(.Self)) {} @@ -800,13 +742,9 @@ library "[[@TEST_NAME]]"; class C(T: type); -// CHECK:STDERR: fail_period_self_in_class_argument_in_where.carbon:[[@LINE+8]]:17: error: left argument of `where` operator must be a facet type [WhereOnNonFacetType] -// CHECK:STDERR: fn F(generic _: C(.Self) where type == type) {} -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_period_self_in_class_argument_in_where.carbon:[[@LINE+4]]:17-24: error: left argument of `where` operator must be a facet type [WhereOnNonFacetType] // CHECK:STDERR: -// CHECK:STDERR: fail_period_self_in_class_argument_in_where.carbon:[[@LINE+4]]:32: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] -// CHECK:STDERR: fn F(generic _: C(.Self) where type == type) {} -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_period_self_in_class_argument_in_where.carbon:[[@LINE+2]]:32-43: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] // CHECK:STDERR: fn F(generic _: C(.Self) where type == type) {} @@ -816,9 +754,7 @@ library "[[@TEST_NAME]]"; class C(T: type); interface Z(T: type); -// CHECK:STDERR: fail_period_self_in_interface_argument_in_class_argument.carbon:[[@LINE+4]]:17: error: `.Self` used in a type that is not a facet type [PeriodSelfInNonFacetType] -// CHECK:STDERR: fn F(generic _: C(Z(.Self))) {} -// CHECK:STDERR: ^~~~~~~~~~~ +// CHECK:STDERR: fail_period_self_in_interface_argument_in_class_argument.carbon:[[@LINE+2]]:17-27: error: `.Self` used in a type that is not a facet type [PeriodSelfInNonFacetType] // CHECK:STDERR: fn F(generic _: C(Z(.Self))) {} @@ -838,9 +774,7 @@ interface Y(T: type) { // TODO: We crash if this impl is not generic, as the call to `.YF()` produces a // symbolic-dependent instruction, but there's no generic eval block for it. -// CHECK:STDERR: fail_todo_period_self_in_generic_argument.carbon:[[@LINE+4]]:60: error: cannot convert type `.(Y(Z where .(Z.Z1) = ()).YF)()` that implements `Z where .(Z.Z1) = ()` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] -// CHECK:STDERR: impl forall [T: type] T as Y(Z where .Z1 = ()) where .Y1 = .YF() {} -// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: fail_todo_period_self_in_generic_argument.carbon:[[@LINE+2]]:60-64: error: cannot convert type `.(Y(Z where .(Z.Z1) = ()).YF)()` that implements `Z where .(Z.Z1) = ()` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] // CHECK:STDERR: impl forall [T: type] T as Y(Z where .Z1 = ()) where .Y1 = .YF() {} diff --git a/toolchain/check/testdata/facet/require_import.carbon b/toolchain/check/testdata/facet/require_import.carbon index aed241bc84c8..b72dfdcd256c 100644 --- a/toolchain/check/testdata/facet/require_import.carbon +++ b/toolchain/check/testdata/facet/require_import.carbon @@ -43,9 +43,7 @@ fn F(generic B: Y) { // Y` since the identified facet type doesn't include Z. We need to be able to // find a symbolic facet from the require decl in Y during impl lookup. // - // CHECK:STDERR: fail_todo_symbolic_facet_interface_requires_interface.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Z(B)` in type `B` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: B.F(); - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_todo_symbolic_facet_interface_requires_interface.carbon:[[@LINE+2]]:3-5: error: cannot access member of interface `Z(B)` in type `B` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: B.F(); } diff --git a/toolchain/check/testdata/facet/require_invalid.carbon b/toolchain/check/testdata/facet/require_invalid.carbon index 836467ad4823..d5366f0b5ddd 100644 --- a/toolchain/check/testdata/facet/require_invalid.carbon +++ b/toolchain/check/testdata/facet/require_invalid.carbon @@ -15,9 +15,7 @@ library "[[@TEST_NAME]]"; interface Y {} -// CHECK:STDERR: fail_require_outside_scope.carbon:[[@LINE+4]]:1: error: `require` can only be used in an `interface` or `constraint` [RequireInWrongScope] -// CHECK:STDERR: require impls Y; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_require_outside_scope.carbon:[[@LINE+2]]:1-7: error: `require` can only be used in an `interface` or `constraint` [RequireInWrongScope] // CHECK:STDERR: require impls Y; @@ -27,9 +25,7 @@ library "[[@TEST_NAME]]"; interface Y {} class C { - // CHECK:STDERR: fail_require_in_class.carbon:[[@LINE+4]]:3: error: `require` can only be used in an `interface` or `constraint` [RequireInWrongScope] - // CHECK:STDERR: require impls Y; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_require_in_class.carbon:[[@LINE+2]]:3-9: error: `require` can only be used in an `interface` or `constraint` [RequireInWrongScope] // CHECK:STDERR: require impls Y; } @@ -42,13 +38,9 @@ interface Y {} fn F() { // require is not allowed outside of `interface` or `constraint`. // - // CHECK:STDERR: fail_require_in_fn.carbon:[[@LINE+8]]:3: error: expected expression [ExpectedExpr] - // CHECK:STDERR: require impls Y; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_require_in_fn.carbon:[[@LINE+4]]:3-9: error: expected expression [ExpectedExpr] // CHECK:STDERR: - // CHECK:STDERR: fail_require_in_fn.carbon:[[@LINE+4]]:3: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] - // CHECK:STDERR: require impls Y; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_require_in_fn.carbon:[[@LINE+2]]:3-9: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: require impls Y; } @@ -62,9 +54,7 @@ interface Z { // TODO: Add `default` modifier. fn F() { class C { - // CHECK:STDERR: fail_require_in_nested_class.carbon:[[@LINE+4]]:7: error: `require` can only be used in an `interface` or `constraint` [RequireInWrongScope] - // CHECK:STDERR: require impls Y; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_require_in_nested_class.carbon:[[@LINE+2]]:7-13: error: `require` can only be used in an `interface` or `constraint` [RequireInWrongScope] // CHECK:STDERR: require impls Y; } @@ -81,13 +71,9 @@ interface Z { fn F() { // require is not allowed outside of `interface` or `constraint`. // - // CHECK:STDERR: fail_require_in_nested_fn.carbon:[[@LINE+8]]:5: error: expected expression [ExpectedExpr] - // CHECK:STDERR: require impls Y; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_require_in_nested_fn.carbon:[[@LINE+4]]:5-11: error: expected expression [ExpectedExpr] // CHECK:STDERR: - // CHECK:STDERR: fail_require_in_nested_fn.carbon:[[@LINE+4]]:5: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] - // CHECK:STDERR: require impls Y; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_require_in_nested_fn.carbon:[[@LINE+2]]:5-11: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: require impls Y; } @@ -100,13 +86,9 @@ class C { // The `require` is diagnosed as being in the wrong place. But we can still // diagnose issues inside the decl too. // - // CHECK:STDERR: fail_errors_in_require_still_found.carbon:[[@LINE+8]]:3: error: `require` can only be used in an `interface` or `constraint` [RequireInWrongScope] - // CHECK:STDERR: require impls Y; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_errors_in_require_still_found.carbon:[[@LINE+4]]:3-9: error: `require` can only be used in an `interface` or `constraint` [RequireInWrongScope] // CHECK:STDERR: - // CHECK:STDERR: fail_errors_in_require_still_found.carbon:[[@LINE+4]]:17: error: name `Y` not found [NameNotFound] - // CHECK:STDERR: require impls Y; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_errors_in_require_still_found.carbon:[[@LINE+2]]:17: error: name `Y` not found [NameNotFound] // CHECK:STDERR: require impls Y; } @@ -117,9 +99,7 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z { - // CHECK:STDERR: fail_extend_require_type.carbon:[[@LINE+4]]:18: error: `extend require impls` with explicit type [RequireImplsExtendWithExplicitSelf] - // CHECK:STDERR: extend require () impls Y; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_extend_require_type.carbon:[[@LINE+2]]:18-19: error: `extend require impls` with explicit type [RequireImplsExtendWithExplicitSelf] // CHECK:STDERR: extend require () impls Y; @@ -137,17 +117,13 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z { - // CHECK:STDERR: fail_require_with_nonexistent_type.carbon:[[@LINE+4]]:11: error: name `nonexistent` not found [NameNotFound] - // CHECK:STDERR: require nonexistent impls Y; - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_require_with_nonexistent_type.carbon:[[@LINE+2]]:11-21: error: name `nonexistent` not found [NameNotFound] // CHECK:STDERR: require nonexistent impls Y; fn F() { // The name lookup error still happens, since the `require` is not `extend`. - // CHECK:STDERR: fail_require_with_nonexistent_type.carbon:[[@LINE+4]]:5: error: member name `A` not found in `Z` [MemberNameNotFoundInSpecificScope] - // CHECK:STDERR: Self.A; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_require_with_nonexistent_type.carbon:[[@LINE+2]]:5-10: error: member name `A` not found in `Z` [MemberNameNotFoundInSpecificScope] // CHECK:STDERR: Self.A; } @@ -159,9 +135,7 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z { - // CHECK:STDERR: fail_extend_require_with_nonexistent_type.carbon:[[@LINE+4]]:18: error: name `nonexistent` not found [NameNotFound] - // CHECK:STDERR: extend require nonexistent impls Y; - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_extend_require_with_nonexistent_type.carbon:[[@LINE+2]]:18-28: error: name `nonexistent` not found [NameNotFound] // CHECK:STDERR: extend require nonexistent impls Y; @@ -179,9 +153,7 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z { - // CHECK:STDERR: fail_extend_require_with_nonexistent_type_pointer.carbon:[[@LINE+4]]:18: error: name `nonexistent` not found [NameNotFound] - // CHECK:STDERR: extend require nonexistent* impls Y; - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_extend_require_with_nonexistent_type_pointer.carbon:[[@LINE+2]]:18-28: error: name `nonexistent` not found [NameNotFound] // CHECK:STDERR: extend require nonexistent* impls Y; @@ -206,9 +178,7 @@ fn G() { class C {} // .Z0 has the wrong type for M. impl C as Z where .Z0 = () {} - // CHECK:STDERR: fail_impl_mismatch_named_constraint_rewrites.carbon:[[@LINE+4]]:3: error: cannot convert type `C` into type implementing `M` [ConversionFailureTypeToFacet] - // CHECK:STDERR: C as M; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_impl_mismatch_named_constraint_rewrites.carbon:[[@LINE+2]]:3-8: error: cannot convert type `C` into type implementing `M` [ConversionFailureTypeToFacet] // CHECK:STDERR: C as M; } diff --git a/toolchain/check/testdata/facet/runtime_value.carbon b/toolchain/check/testdata/facet/runtime_value.carbon index 54bfb7bfb7b7..4b6db6b7f252 100644 --- a/toolchain/check/testdata/facet/runtime_value.carbon +++ b/toolchain/check/testdata/facet/runtime_value.carbon @@ -44,9 +44,7 @@ fn F(c: C) { // TODO: This copy should work, but the narrowing prevents it currently. // //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_facet_copy_narrowing_from_reference.carbon:[[@LINE+4]]:21: error: semantics TODO: `conversion of runtime facet value` [SemanticsTodo] - // CHECK:STDERR: let unused a: I = c.ij; - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_todo_facet_copy_narrowing_from_reference.carbon:[[@LINE+2]]:21-24: error: semantics TODO: `conversion of runtime facet value` [SemanticsTodo] // CHECK:STDERR: let unused a: I = c.ij; //@dump-sem-ir-end @@ -59,9 +57,7 @@ interface Z { let X: type; } -// CHECK:STDERR: fail_compound_member_lookup_in_runtime_facet_without_value.carbon:[[@LINE+4]]:15: error: semantics TODO: `associated value lookup on runtime facet value` [SemanticsTodo] -// CHECK:STDERR: fn F(T: Z, v: T.(Z.X)); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_compound_member_lookup_in_runtime_facet_without_value.carbon:[[@LINE+2]]:15-21: error: semantics TODO: `associated value lookup on runtime facet value` [SemanticsTodo] // CHECK:STDERR: fn F(T: Z, v: T.(Z.X)); @@ -76,9 +72,7 @@ interface Z { // _and_ its facet type doesn't specific a value for `.X`. Or make this work // by producing an ImplWitnessAccess that functions against a runtime facet. // -// CHECK:STDERR: fail_member_lookup_in_runtime_facet_without_value.carbon:[[@LINE+4]]:15: error: cannot access member of interface `Z` in type `Z` that does not implement that interface [MissingImplInMemberAccess] -// CHECK:STDERR: fn F(T: Z, v: T.X); -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_member_lookup_in_runtime_facet_without_value.carbon:[[@LINE+2]]:15-17: error: cannot access member of interface `Z` in type `Z` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: fn F(T: Z, v: T.X); @@ -92,9 +86,7 @@ interface Z { // TODO: We should be able to get the value of `.X` from the `FacetType` of // `T`. // -// CHECK:STDERR: fail_todo_compound_member_lookup_in_runtime_facet_with_value.carbon:[[@LINE+4]]:29: error: semantics TODO: `conversion of runtime facet value` [SemanticsTodo] -// CHECK:STDERR: fn F(T: Z where .X = (), v: T.(Z.X)); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_todo_compound_member_lookup_in_runtime_facet_with_value.carbon:[[@LINE+2]]:29-35: error: semantics TODO: `conversion of runtime facet value` [SemanticsTodo] // CHECK:STDERR: fn F(T: Z where .X = (), v: T.(Z.X)); @@ -108,9 +100,7 @@ interface Z { // TODO: We should be able to get the value of `.X` from the `FacetType` of // `T`. // -// CHECK:STDERR: fail_todo_member_lookup_in_runtime_facet_with_value.carbon:[[@LINE+4]]:29: error: cannot access member of interface `Z` in type `Z where .(Z.X) = ()` that does not implement that interface [MissingImplInMemberAccess] -// CHECK:STDERR: fn F(T: Z where .X = (), v: T.X); -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_todo_member_lookup_in_runtime_facet_with_value.carbon:[[@LINE+2]]:29-31: error: cannot access member of interface `Z` in type `Z where .(Z.X) = ()` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: fn F(T: Z where .X = (), v: T.X); @@ -122,9 +112,7 @@ interface Z { } fn F(T: Z) { - // CHECK:STDERR: fail_todo_member_lookup_in_type_of_runtime_facet_with_value.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Z` in type `Z` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: T.G(); - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_todo_member_lookup_in_type_of_runtime_facet_with_value.carbon:[[@LINE+2]]:3-5: error: cannot access member of interface `Z` in type `Z` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: T.G(); } @@ -137,9 +125,7 @@ interface Z { } fn F(T: Z) { - // CHECK:STDERR: fail_member_access_runtime_facet.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Z` in type `Z` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: T.G(); - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_member_access_runtime_facet.carbon:[[@LINE+2]]:3-5: error: cannot access member of interface `Z` in type `Z` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: T.G(); } @@ -148,9 +134,7 @@ fn F(T: Z) { library "[[@TEST_NAME]]"; fn F(T: type) { - // CHECK:STDERR: fail_member_access_runtime_type.carbon:[[@LINE+4]]:3: error: type `type` does not support qualified expressions [QualifiedExprUnsupported] - // CHECK:STDERR: T.G(); - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_member_access_runtime_type.carbon:[[@LINE+2]]:3-5: error: type `type` does not support qualified expressions [QualifiedExprUnsupported] // CHECK:STDERR: T.G(); } @@ -196,8 +180,8 @@ fn F(T: type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %c.ref: %C = name_ref c, %c // CHECK:STDOUT: %ij.ref: %C.elem = name_ref ij, @C.%field_decl [concrete = @C.%field_decl] -// CHECK:STDOUT: %.loc21_22.1: ref %facet_type = class_element_access %c.ref, element0 -// CHECK:STDOUT: %.loc21_22.2: %facet_type = acquire_value %.loc21_22.1 +// CHECK:STDOUT: %.loc19_22.1: ref %facet_type = class_element_access %c.ref, element0 +// CHECK:STDOUT: %.loc19_22.2: %facet_type = acquire_value %.loc19_22.1 // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: %a: %I.type = wrapper_binding a, [concrete = ] // CHECK:STDOUT: name_binding_decl { 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 f9e5828bf8ca..9a53e516811e 100644 --- a/toolchain/check/testdata/facet/tuple_and_struct_type_literal.carbon +++ b/toolchain/check/testdata/facet/tuple_and_struct_type_literal.carbon @@ -48,9 +48,7 @@ interface Z { impl ((), {}) as Y {} -// CHECK:STDERR: fail_mismatch_tuple_literal_to_facet_value.carbon:[[@LINE+4]]:41: error: cannot convert type `({}, {})` into type implementing `Y` [ConversionFailureTypeToFacet] -// CHECK:STDERR: impl forall [T: type] T as Z where .X = ({}, {}) {} -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_mismatch_tuple_literal_to_facet_value.carbon:[[@LINE+2]]:41-48: error: cannot convert type `({}, {})` into type implementing `Y` [ConversionFailureTypeToFacet] // CHECK:STDERR: impl forall [T: type] T as Z where .X = ({}, {}) {} @@ -92,9 +90,7 @@ interface Z { impl {.a: (), .b: {}} as Y {} -// CHECK:STDERR: fail_mismatch_struct_literal_to_facet_value.carbon:[[@LINE+4]]:41: error: cannot convert type `{.a: {}, .b: {}}` into type implementing `Y` [ConversionFailureTypeToFacet] -// CHECK:STDERR: impl forall [T: type] T as Z where .X = {.a: {}, .b: {}} {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_mismatch_struct_literal_to_facet_value.carbon:[[@LINE+2]]:41-56: error: cannot convert type `{.a: {}, .b: {}}` into type implementing `Y` [ConversionFailureTypeToFacet] // CHECK:STDERR: impl forall [T: type] T as Z where .X = {.a: {}, .b: {}} {} @@ -126,26 +122,14 @@ fn InterfaceParam(unused generic U: Z) {} fn ConstraintParam(unused generic U: N) {} 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: InterfaceParam({.a = ()}); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_struct_literal_with_field_to_facet_type_parameter.carbon:[[@LINE-10]]:34: note: initializing generic parameter `U` declared here [InitializingGenericParam] - // CHECK:STDERR: fn InterfaceParam(unused generic U: Z) {} - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_struct_literal_with_field_to_facet_type_parameter.carbon:[[@LINE+4]]:3-27: error: cannot implicitly convert non-type value of type `{.a: ()}` into type implementing `Z` [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: fail_struct_literal_with_field_to_facet_type_parameter.carbon:[[@LINE+3]]:3-27: note: type `{.a: ()}` does not implement interface `Core.ImplicitAs(Z)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: fail_struct_literal_with_field_to_facet_type_parameter.carbon:[[@LINE-6]]:34-37: note: initializing generic parameter `U` declared here [InitializingGenericParam] // CHECK:STDERR: InterfaceParam({.a = ()}); - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: ConstraintParam({.a = ()}); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_struct_literal_with_field_to_facet_type_parameter.carbon:[[@LINE-20]]:35: note: initializing generic parameter `U` declared here [InitializingGenericParam] - // CHECK:STDERR: fn ConstraintParam(unused generic U: N) {} - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_struct_literal_with_field_to_facet_type_parameter.carbon:[[@LINE+4]]:3-28: error: cannot implicitly convert non-type value of type `{.a: ()}` into type implementing `N` [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: fail_struct_literal_with_field_to_facet_type_parameter.carbon:[[@LINE+3]]:3-28: note: type `{.a: ()}` does not implement interface `Core.ImplicitAs(N)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: fail_struct_literal_with_field_to_facet_type_parameter.carbon:[[@LINE-10]]:35-38: note: initializing generic parameter `U` declared here [InitializingGenericParam] // CHECK:STDERR: ConstraintParam({.a = ()}); } 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 e455e78154f4..73521f9839f3 100644 --- a/toolchain/check/testdata/facet/tuple_and_struct_type_value.carbon +++ b/toolchain/check/testdata/facet/tuple_and_struct_type_value.carbon @@ -75,26 +75,14 @@ fn InterfaceParam(unused generic U: Z) {} fn ConstraintParam(unused generic U: N) {} fn F(generic 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: InterfaceParam(T); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_struct_value_with_field_to_facet_value.carbon:[[@LINE-10]]:34: note: initializing generic parameter `U` declared here [InitializingGenericParam] - // CHECK:STDERR: fn InterfaceParam(unused generic U: Z) {} - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_struct_value_with_field_to_facet_value.carbon:[[@LINE+4]]:3-19: error: cannot implicitly convert non-type value of type `{.a: type}` into type implementing `Z` [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: fail_struct_value_with_field_to_facet_value.carbon:[[@LINE+3]]:3-19: note: type `{.a: type}` does not implement interface `Core.ImplicitAs(Z)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: fail_struct_value_with_field_to_facet_value.carbon:[[@LINE-6]]:34-37: note: initializing generic parameter `U` declared here [InitializingGenericParam] // CHECK:STDERR: InterfaceParam(T); - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: ConstraintParam(T); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_struct_value_with_field_to_facet_value.carbon:[[@LINE-20]]:35: note: initializing generic parameter `U` declared here [InitializingGenericParam] - // CHECK:STDERR: fn ConstraintParam(unused generic U: N) {} - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_struct_value_with_field_to_facet_value.carbon:[[@LINE+4]]:3-20: error: cannot implicitly convert non-type value of type `{.a: type}` into type implementing `N` [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: fail_struct_value_with_field_to_facet_value.carbon:[[@LINE+3]]:3-20: note: type `{.a: type}` does not implement interface `Core.ImplicitAs(N)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: fail_struct_value_with_field_to_facet_value.carbon:[[@LINE-10]]:35-38: note: initializing generic parameter `U` declared here [InitializingGenericParam] // CHECK:STDERR: ConstraintParam(T); } diff --git a/toolchain/check/testdata/facet/validate_impl_constraints.carbon b/toolchain/check/testdata/facet/validate_impl_constraints.carbon index 41950a0d687b..e1a8403cb13b 100644 --- a/toolchain/check/testdata/facet/validate_impl_constraints.carbon +++ b/toolchain/check/testdata/facet/validate_impl_constraints.carbon @@ -22,12 +22,8 @@ constraint N { } fn G(generic T: I where .Self impls N) { - // CHECK:STDERR: fail_todo_self_impls_modifies_assoc_constant.carbon:[[@LINE+7]]:3: error: cannot convert type `T` that implements `I where .Self impls N` into type implementing `I where .(I.X) = ()` [ConversionFailureFacetToFacet] - // CHECK:STDERR: F(T); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_todo_self_impls_modifies_assoc_constant.carbon:[[@LINE-10]]:21: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(unused generic T: I where .X = ()) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_self_impls_modifies_assoc_constant.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `I where .Self impls N` into type implementing `I where .(I.X) = ()` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_todo_self_impls_modifies_assoc_constant.carbon:[[@LINE-8]]:21-38: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: F(T); } @@ -44,12 +40,8 @@ constraint N { } fn G(generic T: I where .Self impls N) { - // CHECK:STDERR: fail_self_impls_modifies_assoc_constant_type_differs.carbon:[[@LINE+7]]:3: error: cannot convert type `T` that implements `I where .Self impls N` into type implementing `I where .(I.X) = ()` [ConversionFailureFacetToFacet] - // CHECK:STDERR: F(T); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_self_impls_modifies_assoc_constant_type_differs.carbon:[[@LINE-10]]:21: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(unused generic T: I where .X = ()) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_self_impls_modifies_assoc_constant_type_differs.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `I where .Self impls N` into type implementing `I where .(I.X) = ()` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_self_impls_modifies_assoc_constant_type_differs.carbon:[[@LINE-8]]:21-38: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: F(T); } @@ -78,12 +70,8 @@ fn G(generic T: L) { // `(C(T) as M).M0` concretely, so we don't know that it is `{}` and we can't // convert assuming it is. // - // CHECK:STDERR: fail_where_impls_tests_associated_constant_of_generic_type_non_final_impl.carbon:[[@LINE+7]]:3: error: cannot convert type `T` that implements `L` into type implementing `type where C(.Self) impls M0IsStruct` [ConversionFailureFacetToFacet] - // CHECK:STDERR: F(T); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_where_impls_tests_associated_constant_of_generic_type_non_final_impl.carbon:[[@LINE-10]]:21: note: initializing generic parameter `U` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(unused generic U: type where C(.Self) impls M0IsStruct) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_where_impls_tests_associated_constant_of_generic_type_non_final_impl.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `L` into type implementing `type where C(.Self) impls M0IsStruct` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_where_impls_tests_associated_constant_of_generic_type_non_final_impl.carbon:[[@LINE-8]]:21-59: note: initializing generic parameter `U` declared here [InitializingGenericParam] // CHECK:STDERR: F(T); } @@ -133,12 +121,8 @@ fn F(unused generic U: type where C(.Self) impls M0IsStruct) {} fn G(generic T: L) { // F requires .M0 = {}, but the final impl provides .M0 = (). // - // CHECK:STDERR: fail_where_impls_tests_associated_constant_of_generic_type_type_differs.carbon:[[@LINE+7]]:3: error: cannot convert type `T` that implements `L` into type implementing `type where C(.Self) impls M0IsStruct` [ConversionFailureFacetToFacet] - // CHECK:STDERR: F(T); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_where_impls_tests_associated_constant_of_generic_type_type_differs.carbon:[[@LINE-8]]:21: note: initializing generic parameter `U` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(unused generic U: type where C(.Self) impls M0IsStruct) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_where_impls_tests_associated_constant_of_generic_type_type_differs.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `L` into type implementing `type where C(.Self) impls M0IsStruct` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_where_impls_tests_associated_constant_of_generic_type_type_differs.carbon:[[@LINE-6]]:21-59: note: initializing generic parameter `U` declared here [InitializingGenericParam] // CHECK:STDERR: F(T); } @@ -167,12 +151,8 @@ fn G(generic T: L) { // `(C as M(T)).M0` concretely, so we don't know that it is `{}` and we can't // convert assuming it is. // - // CHECK:STDERR: fail_where_impls_tests_associated_constant_of_generic_interface_non_final_impl.carbon:[[@LINE+7]]:3: error: cannot convert type `T` that implements `L` into type implementing `type where C impls M0IsStruct(.Self)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: F(T); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_where_impls_tests_associated_constant_of_generic_interface_non_final_impl.carbon:[[@LINE-10]]:21: note: initializing generic parameter `U` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(unused generic U: type where C impls M0IsStruct(.Self)) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_where_impls_tests_associated_constant_of_generic_interface_non_final_impl.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `L` into type implementing `type where C impls M0IsStruct(.Self)` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_where_impls_tests_associated_constant_of_generic_interface_non_final_impl.carbon:[[@LINE-8]]:21-59: note: initializing generic parameter `U` declared here [InitializingGenericParam] // CHECK:STDERR: F(T); } @@ -223,12 +203,8 @@ fn G(generic T: L) { // F requires that .M0 = {} but the final impl provides that .M0 = (). // // TODO: This should fail. - // CHECK:STDERR: fail_where_impls_tests_associated_constant_of_generic_interface_type_differs.carbon:[[@LINE+7]]:3: error: cannot convert type `T` that implements `L` into type implementing `type where C impls M0IsStruct(.Self)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: F(T); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_where_impls_tests_associated_constant_of_generic_interface_type_differs.carbon:[[@LINE-9]]:21: note: initializing generic parameter `U` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(unused generic U: type where C impls M0IsStruct(.Self)) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_where_impls_tests_associated_constant_of_generic_interface_type_differs.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `L` into type implementing `type where C impls M0IsStruct(.Self)` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_where_impls_tests_associated_constant_of_generic_interface_type_differs.carbon:[[@LINE-7]]:21-59: note: initializing generic parameter `U` declared here [InitializingGenericParam] // CHECK:STDERR: F(T); } @@ -254,21 +230,13 @@ interface I(T: Z) {} // TODO: I(.Self) introduces an implied constraint `.Self impls Z`, which is // satisfied and checked at the end of the fn signature. // -// CHECK:STDERR: fail_todo_self_in_interface_generic_param_constrained.carbon:[[@LINE+7]]:24: error: cannot convert type `.Self` into type implementing `Z` [ConversionFailureTypeToFacet] -// CHECK:STDERR: fn F(unused generic T: I(.Self) where .Self impls Z) {} -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_todo_self_in_interface_generic_param_constrained.carbon:[[@LINE-8]]:13: note: initializing generic parameter `T` declared here [InitializingGenericParam] -// CHECK:STDERR: interface I(T: Z) {} -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_todo_self_in_interface_generic_param_constrained.carbon:[[@LINE+3]]:24-31: error: cannot convert type `.Self` into type implementing `Z` [ConversionFailureTypeToFacet] +// CHECK:STDERR: fail_todo_self_in_interface_generic_param_constrained.carbon:[[@LINE-6]]:13-16: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: fn F(unused generic T: I(.Self) where .Self impls Z) {} -// CHECK:STDERR: fail_todo_self_in_interface_generic_param_constrained.carbon:[[@LINE+7]]:21: error: cannot convert type `.Self` into type implementing `Z` [ConversionFailureTypeToFacet] -// CHECK:STDERR: fn G(generic T: Z & I(.Self)) { -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_todo_self_in_interface_generic_param_constrained.carbon:[[@LINE-17]]:13: note: initializing generic parameter `T` declared here [InitializingGenericParam] -// CHECK:STDERR: interface I(T: Z) {} -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_todo_self_in_interface_generic_param_constrained.carbon:[[@LINE+3]]:21-28: error: cannot convert type `.Self` into type implementing `Z` [ConversionFailureTypeToFacet] +// CHECK:STDERR: fail_todo_self_in_interface_generic_param_constrained.carbon:[[@LINE-11]]:13-16: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: fn G(generic T: Z & I(.Self)) { F(T); @@ -364,12 +332,8 @@ fn G() { // ImplWitnessAccess would become concrete without being able to provide any // value, since it's still a `LookupImplWitness` type of witness. - // CHECK:STDERR: fail_concrete_witness_without_impl.carbon:[[@LINE+7]]:3: error: cannot convert type `C` into type implementing `I where .(I.I1) impls J` [ConversionFailureTypeToFacet] - // CHECK:STDERR: F(C); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_concrete_witness_without_impl.carbon:[[@LINE-16]]:14: note: initializing generic parameter `_` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(generic _: I where .I1 impls J) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_concrete_witness_without_impl.carbon:[[@LINE+3]]:3-6: error: cannot convert type `C` into type implementing `I where .(I.I1) impls J` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_concrete_witness_without_impl.carbon:[[@LINE-14]]:14-35: note: initializing generic parameter `_` declared here [InitializingGenericParam] // CHECK:STDERR: F(C); } diff --git a/toolchain/check/testdata/facet/validate_rewrite_constraints.carbon b/toolchain/check/testdata/facet/validate_rewrite_constraints.carbon index 3e254fc4f470..ddf0f9d96d74 100644 --- a/toolchain/check/testdata/facet/validate_rewrite_constraints.carbon +++ b/toolchain/check/testdata/facet/validate_rewrite_constraints.carbon @@ -48,12 +48,8 @@ fn F(generic U: type, unused generic T: I(U) where .X = ()) {} fn G() { // This finds the impl where `.X = {}`, but F requires that `.X = ()`. // - // CHECK:STDERR: fail_generic_interface_facet_value_wrong_specific_impl.carbon:[[@LINE+7]]:3: error: cannot convert type `C` into type implementing `I({}) where {} = ()` [ConversionFailureTypeToFacet] - // CHECK:STDERR: F({}, C); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_generic_interface_facet_value_wrong_specific_impl.carbon:[[@LINE-7]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn F(generic U: type, unused generic T: I(U) where .X = ()) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_generic_interface_facet_value_wrong_specific_impl.carbon:[[@LINE+3]]:3-10: error: cannot convert type `C` into type implementing `I({}) where {} = ()` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_generic_interface_facet_value_wrong_specific_impl.carbon:[[@LINE-5]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: F({}, C); } @@ -80,23 +76,15 @@ fn F(unused generic T: I where .X = {.a: (), .b: {}}) {} fn H() { class C; impl C as I where .X = {.b: {}, .a: ()} {} - // CHECK:STDERR: fail_convert.carbon:[[@LINE+7]]:3: error: cannot convert type `C` into type implementing `I where .(I.X) = {.a: (), .b: {}}` [ConversionFailureTypeToFacet] - // CHECK:STDERR: F(C); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_convert.carbon:[[@LINE-8]]:21: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(unused generic T: I where .X = {.a: (), .b: {}}) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_convert.carbon:[[@LINE+3]]:3-6: error: cannot convert type `C` into type implementing `I where .(I.X) = {.a: (), .b: {}}` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_convert.carbon:[[@LINE-6]]:21-52: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: F(C); } fn G(generic T: I where .X = {.b: {}, .a: ()}) { - // CHECK:STDERR: fail_convert.carbon:[[@LINE+7]]:3: error: cannot convert type `T` that implements `I where .(I.X) = {.b: {}, .a: ()}` into type implementing `I where .(I.X) = {.a: (), .b: {}}` [ConversionFailureFacetToFacet] - // CHECK:STDERR: F(T); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_convert.carbon:[[@LINE-19]]:21: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(unused generic T: I where .X = {.a: (), .b: {}}) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_convert.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `I where .(I.X) = {.b: {}, .a: ()}` into type implementing `I where .(I.X) = {.a: (), .b: {}}` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_convert.carbon:[[@LINE-13]]:21-52: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: F(T); } @@ -107,17 +95,11 @@ library "[[@TEST_NAME]]"; interface I { let X: type; } interface J { let Y: type; } -// CHECK:STDERR: fail_todo_dependent_rules_compound.carbon:[[@LINE+12]]:30: error: expected identifier or `Self` after `.` [ExpectedIdentifierOrSelfAfterPeriod] -// CHECK:STDERR: fn F(generic T: I & J where .(I.X) = .(J.Y)) { -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_todo_dependent_rules_compound.carbon:[[@LINE+6]]:30: error: expected identifier or `Self` after `.` [ExpectedIdentifierOrSelfAfterPeriod] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_dependent_rules_compound.carbon:[[@LINE+8]]:30: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] -// CHECK:STDERR: fn F(generic T: I & J where .(I.X) = .(J.Y)) { -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_todo_dependent_rules_compound.carbon:[[@LINE+4]]:30: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_dependent_rules_compound.carbon:[[@LINE+4]]:39: error: expected identifier or `Self` after `.` [ExpectedIdentifierOrSelfAfterPeriod] -// CHECK:STDERR: fn F(generic T: I & J where .(I.X) = .(J.Y)) { -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_todo_dependent_rules_compound.carbon:[[@LINE+2]]:39: error: expected identifier or `Self` after `.` [ExpectedIdentifierOrSelfAfterPeriod] // CHECK:STDERR: fn F(generic T: I & J where .(I.X) = .(J.Y)) { // Allowed since `T impls I`, `T impls J`, and has constraint providing @@ -145,17 +127,11 @@ interface I(T: type) { let X: type; } final impl forall [J: I(())] J as I({}) where .X = {} {} -// CHECK:STDERR: fail_todo_parameterized_interface_compound.carbon:[[@LINE+12]]:38: error: expected identifier or `Self` after `.` [ExpectedIdentifierOrSelfAfterPeriod] -// CHECK:STDERR: fn F(generic T: I(()) & I({}) where .(I(()).X) = () and .(I({}).X) = {}) {} -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_todo_parameterized_interface_compound.carbon:[[@LINE+6]]:38: error: expected identifier or `Self` after `.` [ExpectedIdentifierOrSelfAfterPeriod] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_parameterized_interface_compound.carbon:[[@LINE+8]]:38: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] -// CHECK:STDERR: fn F(generic T: I(()) & I({}) where .(I(()).X) = () and .(I({}).X) = {}) {} -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_todo_parameterized_interface_compound.carbon:[[@LINE+4]]:38: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_parameterized_interface_compound.carbon:[[@LINE+4]]:58: error: expected identifier or `Self` after `.` [ExpectedIdentifierOrSelfAfterPeriod] -// CHECK:STDERR: fn F(generic T: I(()) & I({}) where .(I(()).X) = () and .(I({}).X) = {}) {} -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_todo_parameterized_interface_compound.carbon:[[@LINE+2]]:58: error: expected identifier or `Self` after `.` [ExpectedIdentifierOrSelfAfterPeriod] // CHECK:STDERR: fn F(generic T: I(()) & I({}) where .(I(()).X) = () and .(I({}).X) = {}) {} @@ -173,12 +149,8 @@ final impl forall [J: I(()) where .X = {}] J as I({}) where .X = {} {} fn F(unused generic T: I({}) where .X = {}) {} fn G(generic T: I(()) where .X = ()) { - // CHECK:STDERR: fail_parameterized_interface_with_wrong_where_in_impl_deduction.carbon:[[@LINE+7]]:3: error: cannot convert type `T` that implements `I(()) where .(I(()).X) = ()` into type implementing `I({}) where .(I({}).X) = {}` [ConversionFailureFacetToFacet] - // CHECK:STDERR: F(T); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_parameterized_interface_with_wrong_where_in_impl_deduction.carbon:[[@LINE-6]]:21: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(unused generic T: I({}) where .X = {}) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_parameterized_interface_with_wrong_where_in_impl_deduction.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `I(()) where .(I(()).X) = ()` into type implementing `I({}) where .(I({}).X) = {}` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_parameterized_interface_with_wrong_where_in_impl_deduction.carbon:[[@LINE-4]]:21-42: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: F(T); } @@ -265,22 +237,14 @@ class C; // .X2 is not set in the impl definition, so its value is an ErrorInst // in the impl's witness table. // -// CHECK:STDERR: fail_error_in_witness_table.carbon:[[@LINE+7]]:1: error: associated constant X2 not given a value in impl of interface I [ImplAssociatedConstantNeedsValue] -// CHECK:STDERR: impl C as I where .X1 = () {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_error_in_witness_table.carbon:[[@LINE-12]]:7: note: associated constant declared here [AssociatedConstantHere] -// CHECK:STDERR: let X2: type; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_error_in_witness_table.carbon:[[@LINE+3]]:1-28: error: associated constant X2 not given a value in impl of interface I [ImplAssociatedConstantNeedsValue] +// CHECK:STDERR: fail_error_in_witness_table.carbon:[[@LINE-10]]:7-14: note: associated constant declared here [AssociatedConstantHere] // CHECK:STDERR: impl C as I where .X1 = () {} fn G() { - // CHECK:STDERR: fail_error_in_witness_table.carbon:[[@LINE+7]]:3: error: cannot convert type `C` into type implementing `I where .(I.X1) = .(I.X2)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: F(C); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_error_in_witness_table.carbon:[[@LINE-19]]:21: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(unused generic T: I where .X1 = .X2) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_error_in_witness_table.carbon:[[@LINE+3]]:3-6: error: cannot convert type `C` into type implementing `I where .(I.X1) = .(I.X2)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_error_in_witness_table.carbon:[[@LINE-13]]:21-40: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: F(C); } @@ -330,12 +294,8 @@ fn G(generic T: type) { // The type `C(T)` is generic so that the resulting impl witness will not be // effectively final. // - // CHECK:STDERR: fail_non_final_impl_deduce.carbon:[[@LINE+7]]:3: error: cannot convert type `C(T)` into type implementing `I where .(I.X) = ()` [ConversionFailureTypeToFacet] - // CHECK:STDERR: F(C(T)); - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_non_final_impl_deduce.carbon:[[@LINE-11]]:21: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(unused generic T: I where .X = ()) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_non_final_impl_deduce.carbon:[[@LINE+3]]:3-9: error: cannot convert type `C(T)` into type implementing `I where .(I.X) = ()` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_non_final_impl_deduce.carbon:[[@LINE-9]]:21-38: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: F(C(T)); } @@ -353,9 +313,7 @@ fn F(generic T: type) { // The type `C(T)` is generic so that the resulting impl witness will not be // effectively final. // - // CHECK:STDERR: fail_non_final_impl_explicit.carbon:[[@LINE+4]]:3: error: cannot convert type `C(T)` into type implementing `I where .(I.X) = ()` [ConversionFailureTypeToFacet] - // CHECK:STDERR: C(T) as (I where .X = ()); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_non_final_impl_explicit.carbon:[[@LINE+2]]:3-27: error: cannot convert type `C(T)` into type implementing `I where .(I.X) = ()` [ConversionFailureTypeToFacet] // CHECK:STDERR: C(T) as (I where .X = ()); } @@ -466,12 +424,8 @@ class C(T: type); fn F(unused generic T: I where .X = C(.Y)) {} fn G(generic T: I where .X = C(()) and .Y = {}) { - // CHECK:STDERR: fail_wrong_rewrite_value_in_class_param.carbon:[[@LINE+7]]:3: error: cannot convert type `T` that implements `I where .(I.X) = C(()) and .(I.Y) = {}` into type implementing `I where .(I.X) = C(.(I.Y))` [ConversionFailureFacetToFacet] - // CHECK:STDERR: F(T); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_wrong_rewrite_value_in_class_param.carbon:[[@LINE-6]]:21: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(unused generic T: I where .X = C(.Y)) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_wrong_rewrite_value_in_class_param.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `I where .(I.X) = C(()) and .(I.Y) = {}` into type implementing `I where .(I.X) = C(.(I.Y))` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_wrong_rewrite_value_in_class_param.carbon:[[@LINE-4]]:21-41: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: F(T); } @@ -518,12 +472,8 @@ interface I { fn F(unused generic T: I where .Y = .A) {} fn G(generic T: I where .Y = .B) { - // CHECK:STDERR: fail_wrong_function_as_rewrite_value.carbon:[[@LINE+7]]:3: error: cannot convert type `T` that implements `I where .(I.Y) = .(I.B)` into type implementing `I where .(I.Y) = .(I.A)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: F(T); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_wrong_function_as_rewrite_value.carbon:[[@LINE-6]]:21: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(unused generic T: I where .Y = .A) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_wrong_function_as_rewrite_value.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `I where .(I.Y) = .(I.B)` into type implementing `I where .(I.Y) = .(I.A)` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_wrong_function_as_rewrite_value.carbon:[[@LINE-4]]:21-38: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: F(T); } @@ -548,12 +498,8 @@ interface J { fn F(unused generic T: I & J where .Y = .A) {} fn G(generic T: I & J where .Y = .B) { - // CHECK:STDERR: fail_wrong_function_as_rewrite_value_in_other_interface.carbon:[[@LINE+7]]:3: error: cannot convert type `T` that implements `I & J where .(I.Y) = .(J.B)` into type implementing `I & J where .(I.Y) = .(I.A)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: F(T); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_wrong_function_as_rewrite_value_in_other_interface.carbon:[[@LINE-6]]:21: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(unused generic T: I & J where .Y = .A) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_wrong_function_as_rewrite_value_in_other_interface.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `I & J where .(I.Y) = .(J.B)` into type implementing `I & J where .(I.Y) = .(I.A)` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_wrong_function_as_rewrite_value_in_other_interface.carbon:[[@LINE-4]]:21-42: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: F(T); } @@ -584,9 +530,7 @@ fn F(generic AA: A where .X = (), generic BB: B where .Y = {}) { // The types match but there may be a specialization that specifies different // types and would be prefered for a specific `AA` or `BB`. // - // CHECK:STDERR: fail_facet_type_concrete_types_match_blanket_impl_concrete_types.carbon:[[@LINE+4]]:3: error: cannot convert type `AA` that implements `A where .(A.X) = ()` into type implementing `C(BB as B) where .(C(BB as B).AX) = () and .(C(BB as B).BY) = {}` [ConversionFailureFacetToFacet] - // CHECK:STDERR: AA as (C(BB) where .AX = () and .BY = {}); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_facet_type_concrete_types_match_blanket_impl_concrete_types.carbon:[[@LINE+2]]:3-43: error: cannot convert type `AA` that implements `A where .(A.X) = ()` into type implementing `C(BB as B) where .(C(BB as B).AX) = () and .(C(BB as B).BY) = {}` [ConversionFailureFacetToFacet] // CHECK:STDERR: AA as (C(BB) where .AX = () and .BY = {}); } @@ -605,9 +549,7 @@ fn F(generic AA: A where .X = (), generic BB: B where .Y = {}) { // The types match but there may be a specialization that specifies different // types and would be prefered for a specific `AA` or `BB`. // - // CHECK:STDERR: fail_facet_type_concrete_types_become_blank_impl_types.carbon:[[@LINE+4]]:3: error: cannot convert type `AA` that implements `A where .(A.X) = ()` into type implementing `C(BB as B) where .(C(BB as B).AX) = () and .(C(BB as B).BY) = {}` [ConversionFailureFacetToFacet] - // CHECK:STDERR: AA as (C(BB) where .AX = () and .BY = {}); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_facet_type_concrete_types_become_blank_impl_types.carbon:[[@LINE+2]]:3-43: error: cannot convert type `AA` that implements `A where .(A.X) = ()` into type implementing `C(BB as B) where .(C(BB as B).AX) = () and .(C(BB as B).BY) = {}` [ConversionFailureFacetToFacet] // CHECK:STDERR: AA as (C(BB) where .AX = () and .BY = {}); } @@ -651,9 +593,7 @@ interface C(BB: B) { let AX: type; let BY: type; } final impl forall [AA: A, BB: B] AA as C(BB) where .AX = AA.X and .BY = BB.Y {} fn F(generic AA: A where .X = (), generic BB: B where .Y = {}) { - // CHECK:STDERR: fail_facet_type_concrete_types_become_final_blanket_impl_types_wrong_types.carbon:[[@LINE+4]]:3: error: cannot convert type `AA` that implements `A where .(A.X) = ()` into type implementing `C(BB as B) where .(C(BB as B).AX) = {} and .(C(BB as B).BY) = ()` [ConversionFailureFacetToFacet] - // CHECK:STDERR: AA as (C(BB) where .AX = {} and .BY = ()); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_facet_type_concrete_types_become_final_blanket_impl_types_wrong_types.carbon:[[@LINE+2]]:3-43: error: cannot convert type `AA` that implements `A where .(A.X) = ()` into type implementing `C(BB as B) where .(C(BB as B).AX) = {} and .(C(BB as B).BY) = ()` [ConversionFailureFacetToFacet] // CHECK:STDERR: AA as (C(BB) where .AX = {} and .BY = ()); } @@ -769,12 +709,8 @@ interface J(T: type) {} fn F(unused generic T: I where .X = J(())) {} fn G(generic T: I where .X = J({}) and .Y = ()) { - // CHECK:STDERR: fail_facet_type_in_assoc_constant_differs.carbon:[[@LINE+7]]:3: error: cannot convert type `T` that implements `I where .(I.X) = J({}) and .(I.Y) = ()` into type implementing `I where .(I.X) = J(())` [ConversionFailureFacetToFacet] - // CHECK:STDERR: F(T); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_facet_type_in_assoc_constant_differs.carbon:[[@LINE-6]]:21: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(unused generic T: I where .X = J(())) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_facet_type_in_assoc_constant_differs.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `I where .(I.X) = J({}) and .(I.Y) = ()` into type implementing `I where .(I.X) = J(())` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_facet_type_in_assoc_constant_differs.carbon:[[@LINE-4]]:21-41: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: F(T); } @@ -867,36 +803,24 @@ fn F(unused generic T: I & J & K where .K1 = .Self and .J1 = .Self and .I1 = (.K // F's requirement I1 = I2 is not met, as I1 = () and I2 = {} fn G(generic T: I & J & K where .K1 = .Self and .J1 = .Self and .I1 = () and .I2 = {}) { - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_self_wrong_type.carbon:[[@LINE+7]]:3: error: cannot convert type `T` that implements `I & J & K where .(K.K1) = .Self as J and .(J.J1) = .Self as I and .(I.I1) = () and .(I.I2) = {}` into type implementing `I & J & K where .(K.K1) = .Self as J and .(J.J1) = .Self as I and .(I.I1) = .(I.I2)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: F(T); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_self_wrong_type.carbon:[[@LINE-7]]:21: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(unused generic T: I & J & K where .K1 = .Self and .J1 = .Self and .I1 = (.K1.J1).I2) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_self_wrong_type.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `I & J & K where .(K.K1) = .Self as J and .(J.J1) = .Self as I and .(I.I1) = () and .(I.I2) = {}` into type implementing `I & J & K where .(K.K1) = .Self as J and .(J.J1) = .Self as I and .(I.I1) = .(I.I2)` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_self_wrong_type.carbon:[[@LINE-5]]:21-88: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: F(T); } // F's requirement I1 = I2 is not met, as I1 = {} and I2 is unspecified fn G2(generic T: I & J & K where .K1 = .Self and .J1 = .Self and .I1 = {}) { - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_self_wrong_type.carbon:[[@LINE+7]]:3: error: cannot convert type `T` that implements `I & J & K where .(K.K1) = .Self as J and .(J.J1) = .Self as I and .(I.I1) = {}` into type implementing `I & J & K where .(K.K1) = .Self as J and .(J.J1) = .Self as I and .(I.I1) = .(I.I2)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: F(T); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_self_wrong_type.carbon:[[@LINE-19]]:21: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(unused generic T: I & J & K where .K1 = .Self and .J1 = .Self and .I1 = (.K1.J1).I2) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_self_wrong_type.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `I & J & K where .(K.K1) = .Self as J and .(J.J1) = .Self as I and .(I.I1) = {}` into type implementing `I & J & K where .(K.K1) = .Self as J and .(J.J1) = .Self as I and .(I.I1) = .(I.I2)` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_self_wrong_type.carbon:[[@LINE-13]]:21-88: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: F(T); } // F's requirement I1 = I2 is not met, as I2 = {} and I1 is unspecified fn G3(generic T: I & J & K where .K1 = .Self and .J1 = .Self and .I2 = {}) { - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_self_wrong_type.carbon:[[@LINE+7]]:3: error: cannot convert type `T` that implements `I & J & K where .(K.K1) = .Self as J and .(J.J1) = .Self as I and .(I.I2) = {}` into type implementing `I & J & K where .(K.K1) = .Self as J and .(J.J1) = .Self as I and .(I.I1) = .(I.I2)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: F(T); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_self_wrong_type.carbon:[[@LINE-31]]:21: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(unused generic T: I & J & K where .K1 = .Self and .J1 = .Self and .I1 = (.K1.J1).I2) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_self_wrong_type.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `I & J & K where .(K.K1) = .Self as J and .(J.J1) = .Self as I and .(I.I2) = {}` into type implementing `I & J & K where .(K.K1) = .Self as J and .(J.J1) = .Self as I and .(I.I1) = .(I.I2)` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_self_wrong_type.carbon:[[@LINE-21]]:21-88: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: F(T); } @@ -946,36 +870,24 @@ fn F(unused generic U: I, unused generic T: J & K where .J2 = (.K1.J1).I1) {} // F's requirement J2 = I1 is not met as J2 = () and I1 = {} fn G(generic U: I where .I1 = {}, generic T: J & K where .K1 = .Self and .J1 = U and .J2 = ()) { - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_wrong_type.carbon:[[@LINE+7]]:3: error: cannot convert type `T` that implements `J & K where .(J.J2) = () and .(K.K1) = .Self as J and .(J.J1) = U as I` into type implementing `J & K where .(J.J2) = .(K.K1).(J.J1).(I.I1)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: F(U, T); - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_wrong_type.carbon:[[@LINE-7]]:42: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(unused generic U: I, unused generic T: J & K where .J2 = (.K1.J1).I1) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_wrong_type.carbon:[[@LINE+3]]:3-9: error: cannot convert type `T` that implements `J & K where .(J.J2) = () and .(K.K1) = .Self as J and .(J.J1) = U as I` into type implementing `J & K where .(J.J2) = .(K.K1).(J.J1).(I.I1)` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_wrong_type.carbon:[[@LINE-5]]:42-73: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: F(U, T); } // F's requirement J2 = I1 is not met as J2 = () and I1 is unspecified fn G2(generic U: I, generic T: J & K where .K1 = .Self and .J1 = U and .J2 = ()) { - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_wrong_type.carbon:[[@LINE+7]]:3: error: cannot convert type `T` that implements `J & K where .(J.J2) = () and .(K.K1) = .Self as J and .(J.J1) = U` into type implementing `J & K where .(J.J2) = .(K.K1).(J.J1).(I.I1)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: F(U, T); - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_wrong_type.carbon:[[@LINE-19]]:42: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(unused generic U: I, unused generic T: J & K where .J2 = (.K1.J1).I1) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_wrong_type.carbon:[[@LINE+3]]:3-9: error: cannot convert type `T` that implements `J & K where .(J.J2) = () and .(K.K1) = .Self as J and .(J.J1) = U` into type implementing `J & K where .(J.J2) = .(K.K1).(J.J1).(I.I1)` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_wrong_type.carbon:[[@LINE-13]]:42-73: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: F(U, T); } // F's requirement J2 = I1 is not met as I1 = {} and J2 is unspecified fn G3(generic U: I where .I1 = {}, generic T: J & K where .K1 = .Self and .J1 = U) { - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_wrong_type.carbon:[[@LINE+7]]:3: error: cannot convert type `T` that implements `J & K where .(K.K1) = .Self as J and .(J.J1) = U as I` into type implementing `J & K where .(J.J2) = .(K.K1).(J.J1).(I.I1)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: F(U, T); - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_wrong_type.carbon:[[@LINE-31]]:42: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(unused generic U: I, unused generic T: J & K where .J2 = (.K1.J1).I1) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_wrong_type.carbon:[[@LINE+3]]:3-9: error: cannot convert type `T` that implements `J & K where .(K.K1) = .Self as J and .(J.J1) = U as I` into type implementing `J & K where .(J.J2) = .(K.K1).(J.J1).(I.I1)` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_wrong_type.carbon:[[@LINE-21]]:42-73: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: F(U, T); } @@ -1024,60 +936,40 @@ fn F(unused generic U: I & J, unused generic T: K where .K2 = .K1.I1 and .K3 = . // K2 = I1 fails since K2 = {} and I1 = () fn G(generic U: I & J where .I1 = () and .J1 = {}, generic T: K where .K1 = U and .K2 = {} and .K3 = {}) { - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE+7]]:3: error: cannot convert type `T` that implements `K where .(K.K2) = {} and .(K.K1) = U as I & J and .(K.K3) = {}` into type implementing `K where .(K.K2) = .(K.K1).(I.I1) and .(K.K3) = .(K.K1).(J.J1)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: F(U, T); - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE-7]]:46: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(unused generic U: I & J, unused generic T: K where .K2 = .K1.I1 and .K3 = .K1.J1) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE+3]]:3-9: error: cannot convert type `T` that implements `K where .(K.K2) = {} and .(K.K1) = U as I & J and .(K.K3) = {}` into type implementing `K where .(K.K2) = .(K.K1).(I.I1) and .(K.K3) = .(K.K1).(J.J1)` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE-5]]:46-85: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: F(U, T); } // K2 = I1 fails since I1 = () and K2 is unspecified. fn G2(generic U: I & J where .I1 = () and .J1 = {}, generic T: K where .K1 = U and .K3 = {}) { - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE+7]]:3: error: cannot convert type `T` that implements `K where .(K.K1) = U as I & J and .(K.K3) = {}` into type implementing `K where .(K.K2) = .(K.K1).(I.I1) and .(K.K3) = .(K.K1).(J.J1)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: F(U, T); - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE-19]]:46: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(unused generic U: I & J, unused generic T: K where .K2 = .K1.I1 and .K3 = .K1.J1) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE+3]]:3-9: error: cannot convert type `T` that implements `K where .(K.K1) = U as I & J and .(K.K3) = {}` into type implementing `K where .(K.K2) = .(K.K1).(I.I1) and .(K.K3) = .(K.K1).(J.J1)` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE-13]]:46-85: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: F(U, T); } // K2 = I1 fails since K2 = () and I1 is unspecified. fn G3(generic U: I & J where .J1 = {}, generic T: K where .K1 = U and .K2 = () and .K3 = {}) { - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE+7]]:3: error: cannot convert type `T` that implements `K where .(K.K2) = () and .(K.K1) = U as I & J and .(K.K3) = {}` into type implementing `K where .(K.K2) = .(K.K1).(I.I1) and .(K.K3) = .(K.K1).(J.J1)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: F(U, T); - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE-31]]:46: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(unused generic U: I & J, unused generic T: K where .K2 = .K1.I1 and .K3 = .K1.J1) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE+3]]:3-9: error: cannot convert type `T` that implements `K where .(K.K2) = () and .(K.K1) = U as I & J and .(K.K3) = {}` into type implementing `K where .(K.K2) = .(K.K1).(I.I1) and .(K.K3) = .(K.K1).(J.J1)` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE-21]]:46-85: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: F(U, T); } // K3 = J1 fails since J1 = {} and K3 is unspecified. fn G4(generic U: I & J where .I1 = () and .J1 = {}, generic T: K where .K1 = U and .K2 = ()) { - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE+7]]:3: error: cannot convert type `T` that implements `K where .(K.K2) = () and .(K.K1) = U as I & J` into type implementing `K where .(K.K2) = .(K.K1).(I.I1) and .(K.K3) = .(K.K1).(J.J1)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: F(U, T); - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE-43]]:46: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(unused generic U: I & J, unused generic T: K where .K2 = .K1.I1 and .K3 = .K1.J1) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE+3]]:3-9: error: cannot convert type `T` that implements `K where .(K.K2) = () and .(K.K1) = U as I & J` into type implementing `K where .(K.K2) = .(K.K1).(I.I1) and .(K.K3) = .(K.K1).(J.J1)` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE-29]]:46-85: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: F(U, T); } // K3 = J1 fails since K3 = {} and J1 is unspecified. fn G5(generic U: I & J where .I1 = (), generic T: K where .K1 = U and .K2 = () and .K3 = {}) { - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE+7]]:3: error: cannot convert type `T` that implements `K where .(K.K2) = () and .(K.K1) = U as I & J and .(K.K3) = {}` into type implementing `K where .(K.K2) = .(K.K1).(I.I1) and .(K.K3) = .(K.K1).(J.J1)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: F(U, T); - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE-55]]:46: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(unused generic U: I & J, unused generic T: K where .K2 = .K1.I1 and .K3 = .K1.J1) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE+3]]:3-9: error: cannot convert type `T` that implements `K where .(K.K2) = () and .(K.K1) = U as I & J and .(K.K3) = {}` into type implementing `K where .(K.K2) = .(K.K1).(I.I1) and .(K.K3) = .(K.K1).(J.J1)` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE-37]]:46-85: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: F(U, T); } @@ -1095,12 +987,8 @@ interface I { fn F(unused generic T: I where .I1 = () and .I2 = ()) {} fn G(generic T: I where .I1 = .I2) { - // CHECK:STDERR: fail_target_rewrites_dont_apply_to_source.carbon:[[@LINE+7]]:3: error: cannot convert type `T` that implements `I where .(I.I1) = .(I.I2)` into type implementing `I where .(I.I1) = () and .(I.I2) = ()` [ConversionFailureFacetToFacet] - // CHECK:STDERR: F(T); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_target_rewrites_dont_apply_to_source.carbon:[[@LINE-6]]:21: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(unused generic T: I where .I1 = () and .I2 = ()) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_target_rewrites_dont_apply_to_source.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `I where .(I.I1) = .(I.I2)` into type implementing `I where .(I.I1) = () and .(I.I2) = ()` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_target_rewrites_dont_apply_to_source.carbon:[[@LINE-4]]:21-52: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: F(T); } @@ -1139,12 +1027,8 @@ fn F(unused generic T: I where .X = NI({}), unused generic U: I where .Y = {}) { fn G(generic T: I where .X = NI({}), generic U: T.X) { // TODO: This should pass, the rewrite in the constraint `NI` should be visible. - // CHECK:STDERR: fail_todo_nested_facet_type_used_as_root_facet_type_in_caller.carbon:[[@LINE+7]]:3: error: cannot convert type `U` that implements `NI({})` into type implementing `I where .(I.Y) = {}` [ConversionFailureFacetToFacet] - // CHECK:STDERR: F(T, U); - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_todo_nested_facet_type_used_as_root_facet_type_in_caller.carbon:[[@LINE-7]]:60: note: initializing generic parameter `U` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(unused generic T: I where .X = NI({}), unused generic U: I where .Y = {}) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_nested_facet_type_used_as_root_facet_type_in_caller.carbon:[[@LINE+3]]:3-9: error: cannot convert type `U` that implements `NI({})` into type implementing `I where .(I.Y) = {}` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_todo_nested_facet_type_used_as_root_facet_type_in_caller.carbon:[[@LINE-5]]:60-77: note: initializing generic parameter `U` declared here [InitializingGenericParam] // CHECK:STDERR: F(T, U); } @@ -1168,12 +1052,8 @@ constraint NI(V: type) { fn F(generic T: I where .X = NI({}), unused generic U: T.X) {} fn G(generic T: I where .X = NI({}), generic U: J where .Y = ()) { - // CHECK:STDERR: fail_nested_facet_type_used_as_root_facet_type_differs_in_interface.carbon:[[@LINE+7]]:3: error: cannot convert type `U` that implements `J where .(J.Y) = ()` into type implementing `NI({})` [ConversionFailureFacetToFacet] - // CHECK:STDERR: F(T, U); - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_nested_facet_type_used_as_root_facet_type_differs_in_interface.carbon:[[@LINE-6]]:53: note: initializing generic parameter `U` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(generic T: I where .X = NI({}), unused generic U: T.X) {} - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_nested_facet_type_used_as_root_facet_type_differs_in_interface.carbon:[[@LINE+3]]:3-9: error: cannot convert type `U` that implements `J where .(J.Y) = ()` into type implementing `NI({})` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_nested_facet_type_used_as_root_facet_type_differs_in_interface.carbon:[[@LINE-4]]:53-58: note: initializing generic parameter `U` declared here [InitializingGenericParam] // CHECK:STDERR: F(T, U); } @@ -1196,12 +1076,8 @@ fn G(generic T: I where .X = NI({}), generic U: I where .Y = ()) { // The caller's `U` has type `I where .Y = ()` but the callee wants something // of type `I where .Y = {}`. // - // CHECK:STDERR: fail_nested_facet_type_used_as_root_facet_type_differs_in_rewrite_callee_access.carbon:[[@LINE+7]]:3: error: cannot convert type `U` that implements `I where .(I.Y) = ()` into type implementing `NI({})` [ConversionFailureFacetToFacet] - // CHECK:STDERR: F(T, U); - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_nested_facet_type_used_as_root_facet_type_differs_in_rewrite_callee_access.carbon:[[@LINE-9]]:53: note: initializing generic parameter `U` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(generic T: I where .X = NI({}), unused generic U: T.X) {} - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_nested_facet_type_used_as_root_facet_type_differs_in_rewrite_callee_access.carbon:[[@LINE+3]]:3-9: error: cannot convert type `U` that implements `I where .(I.Y) = ()` into type implementing `NI({})` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_nested_facet_type_used_as_root_facet_type_differs_in_rewrite_callee_access.carbon:[[@LINE-7]]:53-58: note: initializing generic parameter `U` declared here [InitializingGenericParam] // CHECK:STDERR: F(T, U); } @@ -1224,12 +1100,8 @@ fn G(generic T: I where .X = NI({}), generic U: T.X) { // The caller's `U` has type `I where .Y = {}` but the callee wants something // of type `I where .Y = ()`. // - // CHECK:STDERR: fail_nested_facet_type_used_as_root_facet_type_differs_in_rewrite_caller_access.carbon:[[@LINE+7]]:3: error: cannot convert type `U` that implements `NI({})` into type implementing `I where .(I.Y) = ()` [ConversionFailureFacetToFacet] - // CHECK:STDERR: F(T, U); - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_nested_facet_type_used_as_root_facet_type_differs_in_rewrite_caller_access.carbon:[[@LINE-9]]:60: note: initializing generic parameter `U` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(unused generic T: I where .X = NI({}), unused generic U: I where .Y = ()) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_nested_facet_type_used_as_root_facet_type_differs_in_rewrite_caller_access.carbon:[[@LINE+3]]:3-9: error: cannot convert type `U` that implements `NI({})` into type implementing `I where .(I.Y) = ()` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_nested_facet_type_used_as_root_facet_type_differs_in_rewrite_caller_access.carbon:[[@LINE-7]]:60-77: note: initializing generic parameter `U` declared here [InitializingGenericParam] // CHECK:STDERR: F(T, U); } @@ -1352,12 +1224,8 @@ constraint N { fn G(generic T: N) { // TODO: This should pass. - // CHECK:STDERR: fail_todo_rewrite_provided_by_named_constraint.carbon:[[@LINE+7]]:3: error: cannot convert type `T` that implements `N` into type implementing `Z where .(Z.Z1) = {}` [ConversionFailureFacetToFacet] - // CHECK:STDERR: F(T); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_todo_rewrite_provided_by_named_constraint.carbon:[[@LINE-13]]:14: note: initializing generic parameter `_` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(generic _: Z where .Z1 = {}) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_rewrite_provided_by_named_constraint.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `N` into type implementing `Z where .(Z.Z1) = {}` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_todo_rewrite_provided_by_named_constraint.carbon:[[@LINE-11]]:14-32: note: initializing generic parameter `_` declared here [InitializingGenericParam] // CHECK:STDERR: F(T); } @@ -1380,12 +1248,8 @@ constraint N { } fn G(generic T: N) { - // CHECK:STDERR: fail_rewrite_not_provided_by_named_constraint_without_extend.carbon:[[@LINE+7]]:3: error: cannot convert type `T` that implements `N` into type implementing `Z where .(Z.Z1) = {}` [ConversionFailureFacetToFacet] - // CHECK:STDERR: F(T); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_rewrite_not_provided_by_named_constraint_without_extend.carbon:[[@LINE-14]]:14: note: initializing generic parameter `_` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(generic _: Z where .Z1 = {}) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_rewrite_not_provided_by_named_constraint_without_extend.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `N` into type implementing `Z where .(Z.Z1) = {}` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_rewrite_not_provided_by_named_constraint_without_extend.carbon:[[@LINE-12]]:14-32: note: initializing generic parameter `_` declared here [InitializingGenericParam] // CHECK:STDERR: F(T); } diff --git a/toolchain/check/testdata/for/basic.carbon b/toolchain/check/testdata/for/basic.carbon index 30290006f5b0..17026612084e 100644 --- a/toolchain/check/testdata/for/basic.carbon +++ b/toolchain/check/testdata/for/basic.carbon @@ -16,9 +16,7 @@ library "[[@TEST_NAME]]"; fn Run() { // TODO: These diagnostics could be better. - // CHECK:STDERR: fail_not_range.carbon:[[@LINE+4]]:7: error: cannot access member of interface `Core.Iterate` in type `{}` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: for (unused c: {} in {}) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_not_range.carbon:[[@LINE+2]]:7-26: error: cannot access member of interface `Core.Iterate` in type `{}` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: for (unused c: {} in {}) { } diff --git a/toolchain/check/testdata/for/pattern.carbon b/toolchain/check/testdata/for/pattern.carbon index 5dc9ae8bd753..46f18c8653b8 100644 --- a/toolchain/check/testdata/for/pattern.carbon +++ b/toolchain/check/testdata/for/pattern.carbon @@ -106,12 +106,8 @@ import library "empty_range"; class X {} 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: for (unused x: X in EmptyRange(C).Make()) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_bad_pattern.carbon:[[@LINE+3]]:7-43: error: cannot implicitly convert expression of type `C` to `X` [ConversionFailure] + // CHECK:STDERR: fail_bad_pattern.carbon:[[@LINE+2]]:7-43: note: type `C` does not implement interface `Core.ImplicitAs(X)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: for (unused x: X in EmptyRange(C).Make()) { } diff --git a/toolchain/check/testdata/function/builtin/adapted_type.carbon b/toolchain/check/testdata/function/builtin/adapted_type.carbon index ed96fb67be51..44582159a299 100644 --- a/toolchain/check/testdata/function/builtin/adapted_type.carbon +++ b/toolchain/check/testdata/function/builtin/adapted_type.carbon @@ -45,9 +45,7 @@ class MyIntLiteral { adapt {}; } -// CHECK:STDERR: fail_bad_adapt.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.make_type_signed" [InvalidBuiltinSignature] -// CHECK:STDERR: fn Int(N: MyIntLiteral) -> type = "int.make_type_signed"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_adapt.carbon:[[@LINE+2]]:1-33: error: invalid signature for builtin function "int.make_type_signed" [InvalidBuiltinSignature] // CHECK:STDERR: fn Int(N: MyIntLiteral) -> type = "int.make_type_signed"; @@ -289,10 +287,10 @@ fn Int(N: MyIntLiteral) -> type = "int.make_type_signed"; // CHECK:STDOUT: %N.param_patt: %pattern_type.129 = value_param_pattern [concrete = constants.%N.param_patt] // CHECK:STDOUT: %N.patt: %pattern_type.129 = wrapper_binding_pattern N, %N.param_patt [concrete = constants.%N.patt] // CHECK:STDOUT: %return.param_patt: %pattern_type.9a5 = out_param_pattern [concrete = constants.%return.param_patt] -// CHECK:STDOUT: %return.patt: %pattern_type.9a5 = return_slot_pattern %return.param_patt, %.loc12_28.1 [concrete = constants.%return.patt] +// CHECK:STDOUT: %return.patt: %pattern_type.9a5 = return_slot_pattern %return.param_patt, %.loc10_28.1 [concrete = constants.%return.patt] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc12_28.1: type = type_literal type [concrete = type] -// CHECK:STDOUT: %.loc12_28.2: Core.Form = init_form %.loc12_28.1 [concrete = constants.%.576] +// CHECK:STDOUT: %.loc10_28.1: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc10_28.2: Core.Form = init_form %.loc10_28.1 [concrete = constants.%.576] // CHECK:STDOUT: %N.param: %MyIntLiteral = value_param call_param0 // CHECK:STDOUT: %MyIntLiteral.ref: type = name_ref MyIntLiteral, file.%MyIntLiteral.decl [concrete = constants.%MyIntLiteral] // CHECK:STDOUT: %N: %MyIntLiteral = wrapper_binding N, %N.param diff --git a/toolchain/check/testdata/function/builtin/fail_redefined.carbon b/toolchain/check/testdata/function/builtin/fail_redefined.carbon index 5b097fc434ba..1aefb21ebbf2 100644 --- a/toolchain/check/testdata/function/builtin/fail_redefined.carbon +++ b/toolchain/check/testdata/function/builtin/fail_redefined.carbon @@ -13,32 +13,20 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/builtin/fail_redefined.carbon fn A(n: i32, m: i32) -> i32 = "int.sadd"; -// CHECK:STDERR: fail_redefined.carbon:[[@LINE+7]]:1: error: redefinition of `fn A` [RedeclRedef] -// CHECK:STDERR: fn A(n: i32, unused m: i32) -> i32 { return n; } -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_redefined.carbon:[[@LINE-4]]:1: note: previously defined here [RedeclPrevDef] -// CHECK:STDERR: fn A(n: i32, m: i32) -> i32 = "int.sadd"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_redefined.carbon:[[@LINE+3]]:1-36: error: redefinition of `fn A` [RedeclRedef] +// CHECK:STDERR: fail_redefined.carbon:[[@LINE-2]]:1-29: note: previously defined here [RedeclPrevDef] // CHECK:STDERR: fn A(n: i32, unused m: i32) -> i32 { return n; } fn B(n: i32, unused m: i32) -> i32 { return n; } -// CHECK:STDERR: fail_redefined.carbon:[[@LINE+7]]:1: error: redefinition of `fn B` [RedeclRedef] -// CHECK:STDERR: fn B(n: i32, m: i32) -> i32 = "int.sadd"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_redefined.carbon:[[@LINE-4]]:1: note: previously defined here [RedeclPrevDef] -// CHECK:STDERR: fn B(n: i32, unused m: i32) -> i32 { return n; } -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_redefined.carbon:[[@LINE+3]]:1-29: error: redefinition of `fn B` [RedeclRedef] +// CHECK:STDERR: fail_redefined.carbon:[[@LINE-2]]:1-36: note: previously defined here [RedeclPrevDef] // CHECK:STDERR: fn B(n: i32, m: i32) -> i32 = "int.sadd"; fn C(n: i32, m: i32) -> i32 = "int.sadd"; -// CHECK:STDERR: fail_redefined.carbon:[[@LINE+7]]:1: error: redefinition of `fn C` [RedeclRedef] -// CHECK:STDERR: fn C(n: i32, m: i32) -> i32 = "int.sadd"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_redefined.carbon:[[@LINE-4]]:1: note: previously defined here [RedeclPrevDef] -// CHECK:STDERR: fn C(n: i32, m: i32) -> i32 = "int.sadd"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_redefined.carbon:[[@LINE+3]]:1-29: error: redefinition of `fn C` [RedeclRedef] +// CHECK:STDERR: fail_redefined.carbon:[[@LINE-2]]:1-29: note: previously defined here [RedeclPrevDef] // CHECK:STDERR: fn C(n: i32, m: i32) -> i32 = "int.sadd"; @@ -61,7 +49,7 @@ fn C(n: i32, m: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: %return.patt.6fa: %pattern_type.d94 = return_slot_pattern %return.param_patt.299, %i32 [concrete] // CHECK:STDOUT: %A.type.9f4a6d.1: type = fn_type @A.loc15 [concrete] // CHECK:STDOUT: %A.921eb9.1: %A.type.9f4a6d.1 = struct_value () [concrete] -// CHECK:STDOUT: %A.type.9f4a6d.2: type = fn_type @A.loc23 [concrete] +// CHECK:STDOUT: %A.type.9f4a6d.2: type = fn_type @A.loc19 [concrete] // CHECK:STDOUT: %A.921eb9.2: %A.type.9f4a6d.2 = struct_value () [concrete] // CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete] // CHECK:STDOUT: %Int.as.Copy.impl.Op.type.a1d: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%N) [symbolic] @@ -73,13 +61,13 @@ fn C(n: i32, m: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: %Copy.WithSelf.Op.type.f76: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%Copy.facet) [concrete] // CHECK:STDOUT: %.2b9: type = fn_type_with_self_type %Copy.WithSelf.Op.type.f76, %Copy.facet [concrete] // CHECK:STDOUT: %Int.as.Copy.impl.Op.specific_fn: = specific_function %Int.as.Copy.impl.Op.cae, @Int.as.Copy.impl.Op(%int_32) [concrete] -// CHECK:STDOUT: %B.type.573c71.1: type = fn_type @B.loc25 [concrete] +// CHECK:STDOUT: %B.type.573c71.1: type = fn_type @B.loc21 [concrete] // CHECK:STDOUT: %B.08ed21.1: %B.type.573c71.1 = struct_value () [concrete] -// CHECK:STDOUT: %B.type.573c71.2: type = fn_type @B.loc33 [concrete] +// CHECK:STDOUT: %B.type.573c71.2: type = fn_type @B.loc25 [concrete] // CHECK:STDOUT: %B.08ed21.2: %B.type.573c71.2 = struct_value () [concrete] -// CHECK:STDOUT: %C.type.322e3b.1: type = fn_type @C.loc35 [concrete] +// CHECK:STDOUT: %C.type.322e3b.1: type = fn_type @C.loc27 [concrete] // CHECK:STDOUT: %C.010386.1: %C.type.322e3b.1 = struct_value () [concrete] -// CHECK:STDOUT: %C.type.322e3b.2: type = fn_type @C.loc43 [concrete] +// CHECK:STDOUT: %C.type.322e3b.2: type = fn_type @C.loc31 [concrete] // CHECK:STDOUT: %C.010386.2: %C.type.322e3b.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -100,8 +88,8 @@ fn C(n: i32, m: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: package: = namespace [concrete] { // CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .A = %A.decl.loc15 -// CHECK:STDOUT: .B = %B.decl.loc25 -// CHECK:STDOUT: .C = %C.decl.loc35 +// CHECK:STDOUT: .B = %B.decl.loc21 +// CHECK:STDOUT: .C = %C.decl.loc27 // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %A.decl.loc15: %A.type.9f4a6d.1 = fn_decl @A.loc15 [concrete = constants.%A.921eb9.1] { @@ -123,97 +111,97 @@ fn C(n: i32, m: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param2 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %A.decl.loc23: %A.type.9f4a6d.2 = fn_decl @A.loc23 [concrete = constants.%A.921eb9.2] { +// CHECK:STDOUT: %A.decl.loc19: %A.type.9f4a6d.2 = fn_decl @A.loc19 [concrete = constants.%A.921eb9.2] { // CHECK:STDOUT: %n.param_patt: %pattern_type.d94 = value_param_pattern [concrete = constants.%n.param_patt] // CHECK:STDOUT: %n.patt: %pattern_type.d94 = wrapper_binding_pattern n, %n.param_patt [concrete = constants.%n.patt] // CHECK:STDOUT: %m.param_patt: %pattern_type.d94 = value_param_pattern [concrete = constants.%m.param_patt] // CHECK:STDOUT: %m.patt: %pattern_type.d94 = wrapper_binding_pattern m, %m.param_patt [concrete = constants.%m.patt] // CHECK:STDOUT: %return.param_patt: %pattern_type.d94 = out_param_pattern [concrete = constants.%return.param_patt.299] -// CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32.loc23_32 [concrete = constants.%return.patt.6fa] +// CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32.loc19_32 [concrete = constants.%return.patt.6fa] // CHECK:STDOUT: } { -// CHECK:STDOUT: %i32.loc23_32: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc23: Core.Form = init_form %i32.loc23_32 [concrete = constants.%.0b3] +// CHECK:STDOUT: %i32.loc19_32: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc19: Core.Form = init_form %i32.loc19_32 [concrete = constants.%.0b3] // CHECK:STDOUT: %n.param: %i32 = value_param call_param0 -// CHECK:STDOUT: %i32.loc23_9: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc19_9: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %n: %i32 = wrapper_binding n, %n.param // CHECK:STDOUT: %m.param: %i32 = value_param call_param1 -// CHECK:STDOUT: %i32.loc23_24: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc19_24: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %m: %i32 = wrapper_binding m, %m.param // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param2 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %B.decl.loc25: %B.type.573c71.1 = fn_decl @B.loc25 [concrete = constants.%B.08ed21.1] { +// CHECK:STDOUT: %B.decl.loc21: %B.type.573c71.1 = fn_decl @B.loc21 [concrete = constants.%B.08ed21.1] { // CHECK:STDOUT: %n.param_patt: %pattern_type.d94 = value_param_pattern [concrete = constants.%n.param_patt] // CHECK:STDOUT: %n.patt: %pattern_type.d94 = wrapper_binding_pattern n, %n.param_patt [concrete = constants.%n.patt] // CHECK:STDOUT: %m.param_patt: %pattern_type.d94 = value_param_pattern [concrete = constants.%m.param_patt] // CHECK:STDOUT: %m.patt: %pattern_type.d94 = wrapper_binding_pattern m, %m.param_patt [concrete = constants.%m.patt] // CHECK:STDOUT: %return.param_patt: %pattern_type.d94 = out_param_pattern [concrete = constants.%return.param_patt.299] -// CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32.loc25_32 [concrete = constants.%return.patt.6fa] +// CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32.loc21_32 [concrete = constants.%return.patt.6fa] // CHECK:STDOUT: } { -// CHECK:STDOUT: %i32.loc25_32: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc25: Core.Form = init_form %i32.loc25_32 [concrete = constants.%.0b3] +// CHECK:STDOUT: %i32.loc21_32: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc21: Core.Form = init_form %i32.loc21_32 [concrete = constants.%.0b3] +// CHECK:STDOUT: %n.param: %i32 = value_param call_param0 +// CHECK:STDOUT: %i32.loc21_9: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %n: %i32 = wrapper_binding n, %n.param +// CHECK:STDOUT: %m.param: %i32 = value_param call_param1 +// CHECK:STDOUT: %i32.loc21_24: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %m: %i32 = wrapper_binding m, %m.param +// CHECK:STDOUT: %return.param: ref %i32 = out_param call_param2 +// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %B.decl.loc25: %B.type.573c71.2 = fn_decl @B.loc25 [concrete = constants.%B.08ed21.2] { +// CHECK:STDOUT: %n.param_patt: %pattern_type.d94 = value_param_pattern [concrete = constants.%n.param_patt] +// CHECK:STDOUT: %n.patt: %pattern_type.d94 = wrapper_binding_pattern n, %n.param_patt [concrete = constants.%n.patt] +// CHECK:STDOUT: %m.param_patt: %pattern_type.d94 = value_param_pattern [concrete = constants.%m.param_patt] +// CHECK:STDOUT: %m.patt: %pattern_type.d94 = wrapper_binding_pattern m, %m.param_patt [concrete = constants.%m.patt] +// CHECK:STDOUT: %return.param_patt: %pattern_type.d94 = out_param_pattern [concrete = constants.%return.param_patt.299] +// CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32.loc25_25 [concrete = constants.%return.patt.6fa] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %i32.loc25_25: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc25: Core.Form = init_form %i32.loc25_25 [concrete = constants.%.0b3] // CHECK:STDOUT: %n.param: %i32 = value_param call_param0 // CHECK:STDOUT: %i32.loc25_9: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %n: %i32 = wrapper_binding n, %n.param // CHECK:STDOUT: %m.param: %i32 = value_param call_param1 -// CHECK:STDOUT: %i32.loc25_24: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc25_17: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %m: %i32 = wrapper_binding m, %m.param // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param2 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %B.decl.loc33: %B.type.573c71.2 = fn_decl @B.loc33 [concrete = constants.%B.08ed21.2] { +// CHECK:STDOUT: %C.decl.loc27: %C.type.322e3b.1 = fn_decl @C.loc27 [concrete = constants.%C.010386.1] { // CHECK:STDOUT: %n.param_patt: %pattern_type.d94 = value_param_pattern [concrete = constants.%n.param_patt] // CHECK:STDOUT: %n.patt: %pattern_type.d94 = wrapper_binding_pattern n, %n.param_patt [concrete = constants.%n.patt] // CHECK:STDOUT: %m.param_patt: %pattern_type.d94 = value_param_pattern [concrete = constants.%m.param_patt] // CHECK:STDOUT: %m.patt: %pattern_type.d94 = wrapper_binding_pattern m, %m.param_patt [concrete = constants.%m.patt] // CHECK:STDOUT: %return.param_patt: %pattern_type.d94 = out_param_pattern [concrete = constants.%return.param_patt.299] -// CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32.loc33_25 [concrete = constants.%return.patt.6fa] +// CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32.loc27_25 [concrete = constants.%return.patt.6fa] // CHECK:STDOUT: } { -// CHECK:STDOUT: %i32.loc33_25: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc33: Core.Form = init_form %i32.loc33_25 [concrete = constants.%.0b3] +// CHECK:STDOUT: %i32.loc27_25: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc27: Core.Form = init_form %i32.loc27_25 [concrete = constants.%.0b3] // CHECK:STDOUT: %n.param: %i32 = value_param call_param0 -// CHECK:STDOUT: %i32.loc33_9: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc27_9: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %n: %i32 = wrapper_binding n, %n.param // CHECK:STDOUT: %m.param: %i32 = value_param call_param1 -// CHECK:STDOUT: %i32.loc33_17: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc27_17: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %m: %i32 = wrapper_binding m, %m.param // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param2 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %C.decl.loc35: %C.type.322e3b.1 = fn_decl @C.loc35 [concrete = constants.%C.010386.1] { +// CHECK:STDOUT: %C.decl.loc31: %C.type.322e3b.2 = fn_decl @C.loc31 [concrete = constants.%C.010386.2] { // CHECK:STDOUT: %n.param_patt: %pattern_type.d94 = value_param_pattern [concrete = constants.%n.param_patt] // CHECK:STDOUT: %n.patt: %pattern_type.d94 = wrapper_binding_pattern n, %n.param_patt [concrete = constants.%n.patt] // CHECK:STDOUT: %m.param_patt: %pattern_type.d94 = value_param_pattern [concrete = constants.%m.param_patt] // CHECK:STDOUT: %m.patt: %pattern_type.d94 = wrapper_binding_pattern m, %m.param_patt [concrete = constants.%m.patt] // CHECK:STDOUT: %return.param_patt: %pattern_type.d94 = out_param_pattern [concrete = constants.%return.param_patt.299] -// CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32.loc35_25 [concrete = constants.%return.patt.6fa] +// CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32.loc31_25 [concrete = constants.%return.patt.6fa] // CHECK:STDOUT: } { -// CHECK:STDOUT: %i32.loc35_25: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc35: Core.Form = init_form %i32.loc35_25 [concrete = constants.%.0b3] +// CHECK:STDOUT: %i32.loc31_25: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc31: Core.Form = init_form %i32.loc31_25 [concrete = constants.%.0b3] // CHECK:STDOUT: %n.param: %i32 = value_param call_param0 -// CHECK:STDOUT: %i32.loc35_9: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc31_9: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %n: %i32 = wrapper_binding n, %n.param // CHECK:STDOUT: %m.param: %i32 = value_param call_param1 -// CHECK:STDOUT: %i32.loc35_17: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %m: %i32 = wrapper_binding m, %m.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param call_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %C.decl.loc43: %C.type.322e3b.2 = fn_decl @C.loc43 [concrete = constants.%C.010386.2] { -// CHECK:STDOUT: %n.param_patt: %pattern_type.d94 = value_param_pattern [concrete = constants.%n.param_patt] -// CHECK:STDOUT: %n.patt: %pattern_type.d94 = wrapper_binding_pattern n, %n.param_patt [concrete = constants.%n.patt] -// CHECK:STDOUT: %m.param_patt: %pattern_type.d94 = value_param_pattern [concrete = constants.%m.param_patt] -// CHECK:STDOUT: %m.patt: %pattern_type.d94 = wrapper_binding_pattern m, %m.param_patt [concrete = constants.%m.patt] -// CHECK:STDOUT: %return.param_patt: %pattern_type.d94 = out_param_pattern [concrete = constants.%return.param_patt.299] -// CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32.loc43_25 [concrete = constants.%return.patt.6fa] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %i32.loc43_25: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc43: Core.Form = init_form %i32.loc43_25 [concrete = constants.%.0b3] -// CHECK:STDOUT: %n.param: %i32 = value_param call_param0 -// CHECK:STDOUT: %i32.loc43_9: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %n: %i32 = wrapper_binding n, %n.param -// CHECK:STDOUT: %m.param: %i32 = value_param call_param1 -// CHECK:STDOUT: %i32.loc43_17: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc31_17: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %m: %i32 = wrapper_binding m, %m.param // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param2 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param @@ -222,31 +210,31 @@ fn C(n: i32, m: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: // CHECK:STDOUT: fn @A.loc15(%n.param: %i32, %m.param: %i32) -> out %return.param: %i32 = "int.sadd"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @A.loc23(%n.param: %i32, %m.param: %i32) -> out %return.param: %i32 { +// CHECK:STDOUT: fn @A.loc19(%n.param: %i32, %m.param: %i32) -> out %return.param: %i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %n.ref: %i32 = name_ref n, %n // CHECK:STDOUT: %impl.elem0: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] -// CHECK:STDOUT: %bound_method.loc23_45.1: = bound_method %n.ref, %impl.elem0 +// CHECK:STDOUT: %bound_method.loc19_45.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.loc23_45.2: = bound_method %n.ref, %specific_fn -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc23_45.2(%n.ref) +// CHECK:STDOUT: %bound_method.loc19_45.2: = bound_method %n.ref, %specific_fn +// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc19_45.2(%n.ref) // CHECK:STDOUT: return %Int.as.Copy.impl.Op.call // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @B.loc25(%n.param: %i32, %m.param: %i32) -> out %return.param: %i32 { +// CHECK:STDOUT: fn @B.loc21(%n.param: %i32, %m.param: %i32) -> out %return.param: %i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %n.ref: %i32 = name_ref n, %n // CHECK:STDOUT: %impl.elem0: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] -// CHECK:STDOUT: %bound_method.loc25_45.1: = bound_method %n.ref, %impl.elem0 +// CHECK:STDOUT: %bound_method.loc21_45.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.loc25_45.2: = bound_method %n.ref, %specific_fn -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc25_45.2(%n.ref) +// CHECK:STDOUT: %bound_method.loc21_45.2: = bound_method %n.ref, %specific_fn +// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc21_45.2(%n.ref) // CHECK:STDOUT: return %Int.as.Copy.impl.Op.call // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @B.loc33(%n.param: %i32, %m.param: %i32) -> out %return.param: %i32 = "int.sadd"; +// CHECK:STDOUT: fn @B.loc25(%n.param: %i32, %m.param: %i32) -> out %return.param: %i32 = "int.sadd"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @C.loc35(%n.param: %i32, %m.param: %i32) -> out %return.param: %i32 = "int.sadd"; +// CHECK:STDOUT: fn @C.loc27(%n.param: %i32, %m.param: %i32) -> out %return.param: %i32 = "int.sadd"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @C.loc43(%n.param: %i32, %m.param: %i32) -> out %return.param: %i32 = "int.sadd"; +// CHECK:STDOUT: fn @C.loc31(%n.param: %i32, %m.param: %i32) -> out %return.param: %i32 = "int.sadd"; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/builtin/fail_unknown.carbon b/toolchain/check/testdata/function/builtin/fail_unknown.carbon index ee9e2da86b57..929d37e1adc8 100644 --- a/toolchain/check/testdata/function/builtin/fail_unknown.carbon +++ b/toolchain/check/testdata/function/builtin/fail_unknown.carbon @@ -12,9 +12,7 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/builtin/fail_unknown.carbon -// CHECK:STDERR: fail_unknown.carbon:[[@LINE+4]]:23: error: unknown builtin function name "unknown.builtin.name" [UnknownBuiltinFunctionName] -// CHECK:STDERR: fn UnknownBuiltin() = "unknown.builtin.name"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_unknown.carbon:[[@LINE+2]]:23-44: error: unknown builtin function name "unknown.builtin.name" [UnknownBuiltinFunctionName] // CHECK:STDERR: fn UnknownBuiltin() = "unknown.builtin.name"; diff --git a/toolchain/check/testdata/function/builtin/positional.carbon b/toolchain/check/testdata/function/builtin/positional.carbon index c16c26b66792..3b50a34e4e22 100644 --- a/toolchain/check/testdata/function/builtin/positional.carbon +++ b/toolchain/check/testdata/function/builtin/positional.carbon @@ -14,23 +14,15 @@ // --- fail_positional.carbon -// CHECK:STDERR: fail_positional.carbon:[[@LINE+8]]:1: error: semantics TODO: `function with positional parameters` [SemanticsTodo] -// CHECK:STDERR: fn Add -> i32 = "int.sadd"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_positional.carbon:[[@LINE+4]]:1-15: error: semantics TODO: `function with positional parameters` [SemanticsTodo] // CHECK:STDERR: -// CHECK:STDERR: fail_positional.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] -// CHECK:STDERR: fn Add -> i32 = "int.sadd"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_positional.carbon:[[@LINE+2]]:1-15: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] // CHECK:STDERR: fn Add -> i32 = "int.sadd"; -// CHECK:STDERR: fail_positional.carbon:[[@LINE+8]]:1: error: semantics TODO: `function with positional parameters` [SemanticsTodo] -// CHECK:STDERR: fn Mul = "int.smul"; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_positional.carbon:[[@LINE+4]]:1-8: error: semantics TODO: `function with positional parameters` [SemanticsTodo] // CHECK:STDERR: -// CHECK:STDERR: fail_positional.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.smul" [InvalidBuiltinSignature] -// CHECK:STDERR: fn Mul = "int.smul"; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_positional.carbon:[[@LINE+2]]:1-8: error: invalid signature for builtin function "int.smul" [InvalidBuiltinSignature] // CHECK:STDERR: fn Mul = "int.smul"; @@ -73,7 +65,7 @@ fn Mul = "int.smul"; // CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32 [concrete = constants.%return.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc10: Core.Form = init_form %i32 [concrete = constants.%.0b3] +// CHECK:STDOUT: %.loc6: Core.Form = init_form %i32 [concrete = constants.%.0b3] // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param0 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/call/default_values.carbon b/toolchain/check/testdata/function/call/default_values.carbon index b68969246c42..dd5b3c299d8d 100644 --- a/toolchain/check/testdata/function/call/default_values.carbon +++ b/toolchain/check/testdata/function/call/default_values.carbon @@ -18,19 +18,11 @@ fn F(unused x: C = {}, unused y: C = {}, unused z: C = {}) {} fn H(unused x: C = {}, (unused y: C = {}, unused z: C = {}) = ({}, {})) {} fn G() { - // CHECK:STDERR: fail_caller_too_many_arguments.carbon:[[@LINE+14]]:3: error: 4 arguments passed to function expecting 3 arguments [CallArgCountMismatch] - // CHECK:STDERR: F({}, {}, {}, {}); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_caller_too_many_arguments.carbon:[[@LINE-7]]:1: note: calling function declared here [InCallToEntity] - // CHECK:STDERR: fn F(unused x: C = {}, unused y: C = {}, unused z: C = {}) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_caller_too_many_arguments.carbon:[[@LINE+6]]:3-19: error: 4 arguments passed to function expecting 3 arguments [CallArgCountMismatch] + // CHECK:STDERR: fail_caller_too_many_arguments.carbon:[[@LINE-5]]:1-60: note: calling function declared here [InCallToEntity] // CHECK:STDERR: - // CHECK:STDERR: fail_caller_too_many_arguments.carbon:[[@LINE-10]]:24: error: tuple pattern expects 2 elements, but tuple literal has 3 [TuplePatternSizeDoesntMatchLiteral] - // CHECK:STDERR: fn H(unused x: C = {}, (unused y: C = {}, unused z: C = {}) = ({}, {})) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_caller_too_many_arguments.carbon:[[@LINE-13]]:24: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn H(unused x: C = {}, (unused y: C = {}, unused z: C = {}) = ({}, {})) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_caller_too_many_arguments.carbon:[[@LINE-6]]:24-59: error: tuple pattern expects 2 elements, but tuple literal has 3 [TuplePatternSizeDoesntMatchLiteral] + // CHECK:STDERR: fail_caller_too_many_arguments.carbon:[[@LINE-7]]:24-70: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: F({}, {}, {}, {}); H({}, ({}, {}, {})); @@ -43,12 +35,8 @@ class C {} fn F(unused x: C, unused y: C = {}) {} fn G() { - // CHECK:STDERR: fail_caller_too_few_arguments.carbon:[[@LINE+7]]:3: error: 0 arguments passed to function expecting 2 arguments [CallArgCountMismatch] - // CHECK:STDERR: F(); - // CHECK:STDERR: ^~~ - // CHECK:STDERR: fail_caller_too_few_arguments.carbon:[[@LINE-6]]:1: note: calling function declared here [InCallToEntity] - // CHECK:STDERR: fn F(unused x: C, unused y: C = {}) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_caller_too_few_arguments.carbon:[[@LINE+3]]:3-5: error: 0 arguments passed to function expecting 2 arguments [CallArgCountMismatch] + // CHECK:STDERR: fail_caller_too_few_arguments.carbon:[[@LINE-4]]:1-37: note: calling function declared here [InCallToEntity] // CHECK:STDERR: F(); } diff --git a/toolchain/check/testdata/function/call/eval_musteval.carbon b/toolchain/check/testdata/function/call/eval_musteval.carbon index d2cd499d86eb..1baa3b13d62b 100644 --- a/toolchain/check/testdata/function/call/eval_musteval.carbon +++ b/toolchain/check/testdata/function/call/eval_musteval.carbon @@ -29,12 +29,8 @@ library "[[@TEST_NAME]]"; musteval fn MustEval(unused n: i32) {} fn RuntimeArg(n: i32) { - // CHECK:STDERR: fail_no_eval_musteval.carbon:[[@LINE+7]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: MustEval(n); - // CHECK:STDERR: ^~~~~~~~~~~ - // CHECK:STDERR: fail_no_eval_musteval.carbon:[[@LINE-6]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] - // CHECK:STDERR: musteval fn MustEval(unused n: i32) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_no_eval_musteval.carbon:[[@LINE+3]]:3-13: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: fail_no_eval_musteval.carbon:[[@LINE-4]]:1-37: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] // CHECK:STDERR: MustEval(n); } @@ -61,12 +57,8 @@ musteval fn MustEval(unused n: i32) {} // TODO: This should be accepted. musteval fn CallMustEval(n: i32) { - // CHECK:STDERR: fail_todo_musteval_calls_musteval.carbon:[[@LINE+7]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: MustEval(n); - // CHECK:STDERR: ^~~~~~~~~~~ - // CHECK:STDERR: fail_todo_musteval_calls_musteval.carbon:[[@LINE-7]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] - // CHECK:STDERR: musteval fn MustEval(unused n: i32) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_musteval_calls_musteval.carbon:[[@LINE+3]]:3-13: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: fail_todo_musteval_calls_musteval.carbon:[[@LINE-5]]:1-37: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] // CHECK:STDERR: MustEval(n); } diff --git a/toolchain/check/testdata/function/call/fail_not_callable.carbon b/toolchain/check/testdata/function/call/fail_not_callable.carbon index c22499bea4d7..f0a93aa5ad92 100644 --- a/toolchain/check/testdata/function/call/fail_not_callable.carbon +++ b/toolchain/check/testdata/function/call/fail_not_callable.carbon @@ -11,9 +11,7 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/call/fail_not_callable.carbon fn Run() { - // CHECK:STDERR: fail_not_callable.carbon:[[@LINE+4]]:23: error: value of type `str` is not callable [CallToNonCallable] - // CHECK:STDERR: var unused x: i32 = "hello"(); - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_not_callable.carbon:[[@LINE+2]]:23-31: error: value of type `str` is not callable [CallToNonCallable] // CHECK:STDERR: var unused x: i32 = "hello"(); } diff --git a/toolchain/check/testdata/function/call/fail_param_count.carbon b/toolchain/check/testdata/function/call/fail_param_count.carbon index 6a7141daf5fe..2836e360cbfe 100644 --- a/toolchain/check/testdata/function/call/fail_param_count.carbon +++ b/toolchain/check/testdata/function/call/fail_param_count.carbon @@ -17,54 +17,30 @@ fn Run1(unused a: i32) {} fn Run2(unused a: i32, unused b: i32) {} fn Main() { - // CHECK:STDERR: fail_param_count.carbon:[[@LINE+7]]:3: error: 1 argument passed to function expecting 0 arguments [CallArgCountMismatch] - // CHECK:STDERR: Run0(1); - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_param_count.carbon:[[@LINE-8]]:1: note: calling function declared here [InCallToEntity] - // CHECK:STDERR: fn Run0() {} - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_param_count.carbon:[[@LINE+3]]:3-9: error: 1 argument passed to function expecting 0 arguments [CallArgCountMismatch] + // CHECK:STDERR: fail_param_count.carbon:[[@LINE-6]]:1-11: note: calling function declared here [InCallToEntity] // CHECK:STDERR: Run0(1); - // CHECK:STDERR: fail_param_count.carbon:[[@LINE+7]]:3: error: 2 arguments passed to function expecting 0 arguments [CallArgCountMismatch] - // CHECK:STDERR: Run0(0, 1); - // CHECK:STDERR: ^~~~~~~~~~ - // CHECK:STDERR: fail_param_count.carbon:[[@LINE-16]]:1: note: calling function declared here [InCallToEntity] - // CHECK:STDERR: fn Run0() {} - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_param_count.carbon:[[@LINE+3]]:3-12: error: 2 arguments passed to function expecting 0 arguments [CallArgCountMismatch] + // CHECK:STDERR: fail_param_count.carbon:[[@LINE-10]]:1-11: note: calling function declared here [InCallToEntity] // CHECK:STDERR: Run0(0, 1); - // CHECK:STDERR: fail_param_count.carbon:[[@LINE+7]]:3: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] - // CHECK:STDERR: Run1(); - // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_param_count.carbon:[[@LINE-24]]:1: note: calling function declared here [InCallToEntity] - // CHECK:STDERR: fn Run1(unused a: i32) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_param_count.carbon:[[@LINE+3]]:3-8: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] + // CHECK:STDERR: fail_param_count.carbon:[[@LINE-14]]:1-24: note: calling function declared here [InCallToEntity] // CHECK:STDERR: Run1(); - // CHECK:STDERR: fail_param_count.carbon:[[@LINE+7]]:3: error: 2 arguments passed to function expecting 1 argument [CallArgCountMismatch] - // CHECK:STDERR: Run1(0, 1); - // CHECK:STDERR: ^~~~~~~~~~ - // CHECK:STDERR: fail_param_count.carbon:[[@LINE-32]]:1: note: calling function declared here [InCallToEntity] - // CHECK:STDERR: fn Run1(unused a: i32) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_param_count.carbon:[[@LINE+3]]:3-12: error: 2 arguments passed to function expecting 1 argument [CallArgCountMismatch] + // CHECK:STDERR: fail_param_count.carbon:[[@LINE-18]]:1-24: note: calling function declared here [InCallToEntity] // CHECK:STDERR: Run1(0, 1); - // CHECK:STDERR: fail_param_count.carbon:[[@LINE+7]]:3: error: 0 arguments passed to function expecting 2 arguments [CallArgCountMismatch] - // CHECK:STDERR: Run2(); - // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_param_count.carbon:[[@LINE-40]]:1: note: calling function declared here [InCallToEntity] - // CHECK:STDERR: fn Run2(unused a: i32, unused b: i32) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_param_count.carbon:[[@LINE+3]]:3-8: error: 0 arguments passed to function expecting 2 arguments [CallArgCountMismatch] + // CHECK:STDERR: fail_param_count.carbon:[[@LINE-22]]:1-39: note: calling function declared here [InCallToEntity] // CHECK:STDERR: Run2(); - // CHECK:STDERR: fail_param_count.carbon:[[@LINE+7]]:3: error: 1 argument passed to function expecting 2 arguments [CallArgCountMismatch] - // CHECK:STDERR: Run2(0); - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_param_count.carbon:[[@LINE-48]]:1: note: calling function declared here [InCallToEntity] - // CHECK:STDERR: fn Run2(unused a: i32, unused b: i32) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_param_count.carbon:[[@LINE+3]]:3-9: error: 1 argument passed to function expecting 2 arguments [CallArgCountMismatch] + // CHECK:STDERR: fail_param_count.carbon:[[@LINE-26]]:1-39: note: calling function declared here [InCallToEntity] // CHECK:STDERR: Run2(0); } @@ -155,18 +131,18 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Run0.ref.loc23: %Run0.type = name_ref Run0, file.%Run0.decl [concrete = constants.%Run0] +// CHECK:STDOUT: %int_1.loc23: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] // CHECK:STDOUT: %Run0.ref.loc27: %Run0.type = name_ref Run0, file.%Run0.decl [concrete = constants.%Run0] +// CHECK:STDOUT: %int_0.loc27: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] // CHECK:STDOUT: %int_1.loc27: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %Run0.ref.loc35: %Run0.type = name_ref Run0, file.%Run0.decl [concrete = constants.%Run0] -// CHECK:STDOUT: %int_0.loc35: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] -// CHECK:STDOUT: %int_1.loc35: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %Run1.ref.loc44: %Run1.type = name_ref Run1, file.%Run1.decl [concrete = constants.%Run1] -// CHECK:STDOUT: %Run1.ref.loc52: %Run1.type = name_ref Run1, file.%Run1.decl [concrete = constants.%Run1] -// CHECK:STDOUT: %int_0.loc52: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] -// CHECK:STDOUT: %int_1.loc52: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %Run2.ref.loc61: %Run2.type = name_ref Run2, file.%Run2.decl [concrete = constants.%Run2] -// CHECK:STDOUT: %Run2.ref.loc69: %Run2.type = name_ref Run2, file.%Run2.decl [concrete = constants.%Run2] -// CHECK:STDOUT: %int_0.loc69: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] +// CHECK:STDOUT: %Run1.ref.loc32: %Run1.type = name_ref Run1, file.%Run1.decl [concrete = constants.%Run1] +// CHECK:STDOUT: %Run1.ref.loc36: %Run1.type = name_ref Run1, file.%Run1.decl [concrete = constants.%Run1] +// CHECK:STDOUT: %int_0.loc36: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] +// CHECK:STDOUT: %int_1.loc36: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %Run2.ref.loc41: %Run2.type = name_ref Run2, file.%Run2.decl [concrete = constants.%Run2] +// CHECK:STDOUT: %Run2.ref.loc45: %Run2.type = name_ref Run2, file.%Run2.decl [concrete = constants.%Run2] +// CHECK:STDOUT: %int_0.loc45: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/fail_param_type.carbon b/toolchain/check/testdata/function/call/fail_param_type.carbon index 35fbadfbb707..37820f5f6745 100644 --- a/toolchain/check/testdata/function/call/fail_param_type.carbon +++ b/toolchain/check/testdata/function/call/fail_param_type.carbon @@ -15,15 +15,9 @@ fn G(unused a: i32) {} 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: G(1.0); - // CHECK:STDERR: ^~~ - // CHECK:STDERR: fail_param_type.carbon:[[@LINE-9]]:13: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn G(unused a: i32) {} - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_param_type.carbon:[[@LINE+4]]:5-7: error: cannot implicitly convert expression of type `Core.FloatLiteral` to `i32` [ConversionFailure] + // CHECK:STDERR: fail_param_type.carbon:[[@LINE+3]]:5-7: note: type `Core.FloatLiteral` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: fail_param_type.carbon:[[@LINE-5]]:13-18: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: G(1.0); } @@ -87,7 +81,7 @@ fn F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %G.ref: %G.type = name_ref G, file.%G.decl [concrete = constants.%G] // CHECK:STDOUT: %float: Core.FloatLiteral = float_literal_value 10e-1 [concrete = constants.%float] -// CHECK:STDOUT: %.loc28: %i32 = converted %float, [concrete = ] +// CHECK:STDOUT: %.loc22: %i32 = converted %float, [concrete = ] // CHECK:STDOUT: %G.call: init %empty_tuple.type = call %G.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } 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 6d3ea7d93ed0..869a1a913695 100644 --- a/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon +++ b/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon @@ -15,12 +15,8 @@ fn Foo() -> f64 { return 1.0; } 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var unused x: i32 = Foo(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_return_type_mismatch.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `f64` to `i32` [ConversionFailure] + // CHECK:STDERR: fail_return_type_mismatch.carbon:[[@LINE+2]]:3-19: note: type `f64` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused x: i32 = Foo(); } @@ -69,11 +65,11 @@ fn Run() { // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] // CHECK:STDOUT: %self.param_patt.0c5: %pattern_type.d94 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.749: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt.0c5 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfc: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc25 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfc: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc21 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01: %Destroy.WithSelf.SubobjectDestroy.type.dfc = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef0: type = fn_type @Destroy.WithSelf.Op.loc25 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef0: type = fn_type @Destroy.WithSelf.Op.loc21 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403: %Destroy.WithSelf.Op.type.ef0 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbc: type = fn_type @Destroy.WithSelf.SelfDestruct.loc25 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbc: type = fn_type @Destroy.WithSelf.SelfDestruct.loc21 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3: %Destroy.WithSelf.SelfDestruct.type.fbc = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -95,14 +91,14 @@ fn Run() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl: %Destroy.WithSelf.SubobjectDestroy.type.dfc = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc25 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl: %Destroy.WithSelf.SubobjectDestroy.type.dfc = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc21 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d94 = ref_param_pattern [concrete = constants.%self.param_patt.0c5] // CHECK:STDOUT: %self.patt: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.749] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %i32 = ref_param call_param0 // CHECK:STDOUT: %self: ref %i32 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl: %Destroy.WithSelf.Op.type.ef0 = fn_decl @Destroy.WithSelf.Op.loc25 [concrete = constants.%Destroy.WithSelf.Op.403] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl: %Destroy.WithSelf.Op.type.ef0 = fn_decl @Destroy.WithSelf.Op.loc21 [concrete = constants.%Destroy.WithSelf.Op.403] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d94 = ref_param_pattern [concrete = constants.%self.param_patt.0c5] // CHECK:STDOUT: %self.patt: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.749] // CHECK:STDOUT: } { @@ -147,7 +143,7 @@ fn Run() { // CHECK:STDOUT: %x.var: ref %i32 = var_storage %x.var_patt // CHECK:STDOUT: %Foo.ref: %Foo.type = name_ref Foo, file.%Foo.decl [concrete = constants.%Foo] // CHECK:STDOUT: %Foo.call: init %f64.761 = call %Foo.ref() -// CHECK:STDOUT: %.loc25: %i32 = converted %Foo.call, [concrete = ] +// CHECK:STDOUT: %.loc21: %i32 = converted %Foo.call, [concrete = ] // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %x: ref %i32 = wrapper_binding x, %x.var @@ -160,11 +156,11 @@ fn Run() { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc25(%self.param: ref %i32) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc21(%self.param: ref %i32) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc25(%self.param: ref %i32) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc21(%self.param: ref %i32) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc25(%self.param: ref %i32) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc21(%self.param: ref %i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl(%self.param) diff --git a/toolchain/check/testdata/function/call/fail_runtime_implicit_param.carbon b/toolchain/check/testdata/function/call/fail_runtime_implicit_param.carbon index 4ba086a45816..e36fbc2063a3 100644 --- a/toolchain/check/testdata/function/call/fail_runtime_implicit_param.carbon +++ b/toolchain/check/testdata/function/call/fail_runtime_implicit_param.carbon @@ -12,9 +12,7 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/call/fail_runtime_implicit_param.carbon -// CHECK:STDERR: fail_runtime_implicit_param.carbon:[[@LINE+4]]:6: error: implicit parameters of functions must be constant [ImplictParamMustBeConstant] -// CHECK:STDERR: fn F[runtime s: ()](); -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_runtime_implicit_param.carbon:[[@LINE+2]]:6-18: error: implicit parameters of functions must be constant [ImplictParamMustBeConstant] // CHECK:STDERR: fn F[runtime s: ()](); diff --git a/toolchain/check/testdata/function/call/form.carbon b/toolchain/check/testdata/function/call/form.carbon index 9b5466cd8766..0cdec4ea04a0 100644 --- a/toolchain/check/testdata/function/call/form.carbon +++ b/toolchain/check/testdata/function/call/form.carbon @@ -61,30 +61,20 @@ fn F(x:? form(ref ())); library "[[@TEST_NAME]]"; fn F() -> Core.Form; -// CHECK:STDERR: fail_param_form_not_constant.carbon:[[@LINE+4]]:10: error: cannot evaluate form expression [FormExprEvaluationFailure] -// CHECK:STDERR: fn G(x:? F()); -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_param_form_not_constant.carbon:[[@LINE+2]]:10-12: error: cannot evaluate form expression [FormExprEvaluationFailure] // CHECK:STDERR: fn G(x:? F()); // --- fail_form_param_not_form.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_form_param_not_form.carbon:[[@LINE+7]]:10: error: cannot implicitly convert expression of type `type` to `Core.Form` [ConversionFailure] -// CHECK:STDERR: fn F(x:? i32); -// CHECK:STDERR: ^~~ -// CHECK:STDERR: fail_form_param_not_form.carbon:[[@LINE+4]]:10: note: type `type` does not implement interface `Core.ImplicitAs(Core.Form)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: fn F(x:? i32); -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_form_param_not_form.carbon:[[@LINE+3]]:10-12: error: cannot implicitly convert expression of type `type` to `Core.Form` [ConversionFailure] +// CHECK:STDERR: fail_form_param_not_form.carbon:[[@LINE+2]]:10-12: note: type `type` does not implement interface `Core.ImplicitAs(Core.Form)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn F(x:? i32); -// CHECK:STDERR: fail_form_param_not_form.carbon:[[@LINE+8]]:6: error: `ref` is only allowed on a runtime binding [ExpectedRuntimeBindingPatternAfterRef] -// CHECK:STDERR: fn G(ref x:? i32); -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_form_param_not_form.carbon:[[@LINE+4]]:6-8: error: `ref` is only allowed on a runtime binding [ExpectedRuntimeBindingPatternAfterRef] // CHECK:STDERR: -// CHECK:STDERR: fail_form_param_not_form.carbon:[[@LINE+4]]:11: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] -// CHECK:STDERR: fn G(ref x:? i32); -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_form_param_not_form.carbon:[[@LINE+2]]:11-12: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: fn G(ref x:? i32); @@ -95,12 +85,8 @@ fn F(x:? form(ref i32)); fn G() { var y: i32 = 0; - // CHECK:STDERR: fail_missing_ref_tag.carbon:[[@LINE+7]]:5: error: argument to `ref` parameter not marked with `ref` [RefParamNoRefTag] - // CHECK:STDERR: F(y); - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_missing_ref_tag.carbon:[[@LINE-7]]:6: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn F(x:? form(ref i32)); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_missing_ref_tag.carbon:[[@LINE+3]]:5: error: argument to `ref` parameter not marked with `ref` [RefParamNoRefTag] + // CHECK:STDERR: fail_missing_ref_tag.carbon:[[@LINE-5]]:6-22: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: F(y); } @@ -122,15 +108,9 @@ fn F(generic Fm: Core.Form, unused x:? Fm) {} fn G() { var x: i32; - // CHECK:STDERR: fail_todo_composite_generic_form.carbon:[[@LINE+10]]:3: error: cannot implicitly convert expression of type `(Core.Form, Core.Form)` to `Core.Form` [ConversionFailure] - // CHECK:STDERR: F((form(var i32), form(ref i32)), (x, ref x)); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_composite_generic_form.carbon:[[@LINE+7]]:3: note: type `(Core.Form, Core.Form)` does not implement interface `Core.ImplicitAs(Core.Form)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: F((form(var i32), form(ref i32)), (x, ref x)); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_composite_generic_form.carbon:[[@LINE-10]]:14: note: initializing generic parameter `Fm` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(generic Fm: Core.Form, unused x:? Fm) {} - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_composite_generic_form.carbon:[[@LINE+4]]:3-47: error: cannot implicitly convert expression of type `(Core.Form, Core.Form)` to `Core.Form` [ConversionFailure] + // CHECK:STDERR: fail_todo_composite_generic_form.carbon:[[@LINE+3]]:3-47: note: type `(Core.Form, Core.Form)` does not implement interface `Core.ImplicitAs(Core.Form)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: fail_todo_composite_generic_form.carbon:[[@LINE-6]]:14-26: note: initializing generic parameter `Fm` declared here [InitializingGenericParam] // CHECK:STDERR: F((form(var i32), form(ref i32)), (x, ref x)); } @@ -142,12 +122,8 @@ fn F[Fm: Core.Form](v:? Fm); fn G() { var v: i32 = 0; - // CHECK:STDERR: fail_todo_deduce_generic_form.carbon:[[@LINE+7]]:3: error: cannot deduce value for generic parameter `Fm` [DeductionIncomplete] - // CHECK:STDERR: F(ref v); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_todo_deduce_generic_form.carbon:[[@LINE-7]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn F[Fm: Core.Form](v:? Fm); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_deduce_generic_form.carbon:[[@LINE+3]]:3-10: error: cannot deduce value for generic parameter `Fm` [DeductionIncomplete] + // CHECK:STDERR: fail_todo_deduce_generic_form.carbon:[[@LINE-5]]:1-28: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: F(ref v); } @@ -159,15 +135,9 @@ fn F(generic Fm: Core.Form, unused x:? Fm) {} fn G() { var x: i32; - // CHECK:STDERR: fail_form_generic_arg_not_form.carbon:[[@LINE+10]]:3: error: cannot implicitly convert expression of type `type` to `Core.Form` [ConversionFailure] - // CHECK:STDERR: F(i32, x); - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_form_generic_arg_not_form.carbon:[[@LINE+7]]:3: note: type `type` does not implement interface `Core.ImplicitAs(Core.Form)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: F(i32, x); - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_form_generic_arg_not_form.carbon:[[@LINE-10]]:14: note: initializing generic parameter `Fm` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(generic Fm: Core.Form, unused x:? Fm) {} - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_form_generic_arg_not_form.carbon:[[@LINE+4]]:3-11: error: cannot implicitly convert expression of type `type` to `Core.Form` [ConversionFailure] + // CHECK:STDERR: fail_form_generic_arg_not_form.carbon:[[@LINE+3]]:3-11: note: type `type` does not implement interface `Core.ImplicitAs(Core.Form)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: fail_form_generic_arg_not_form.carbon:[[@LINE-6]]:14-26: note: initializing generic parameter `Fm` declared here [InitializingGenericParam] // CHECK:STDERR: F(i32, x); } @@ -179,13 +149,9 @@ fn F(generic Fm: Core.Form, unused x:? Fm) {} fn G() { var x: i32; - // CHECK:STDERR: fail_form_generic_missing_ref_tag.carbon:[[@LINE+8]]:20: error: argument to `ref` parameter not marked with `ref` [RefParamNoRefTag] - // CHECK:STDERR: F(form(ref i32), x); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_form_generic_missing_ref_tag.carbon:[[@LINE+4]]:20: error: argument to `ref` parameter not marked with `ref` [RefParamNoRefTag] // CHECK:STDERR: fail_form_generic_missing_ref_tag.carbon: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fail_form_generic_missing_ref_tag.carbon:[[@LINE-8]]:36: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn F(generic Fm: Core.Form, unused x:? Fm) {} - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_form_generic_missing_ref_tag.carbon:[[@LINE-6]]:36-41: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: F(form(ref i32), x); } @@ -194,9 +160,7 @@ fn G() { library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: fail_todo_local_init_form_binding.carbon:[[@LINE+4]]:7: error: semantics TODO: `support local form bindings` [SemanticsTodo] - // CHECK:STDERR: let x:? form(var i32) = 0; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_local_init_form_binding.carbon:[[@LINE+2]]:7-23: error: semantics TODO: `support local form bindings` [SemanticsTodo] // CHECK:STDERR: let x:? form(var i32) = 0; } @@ -207,9 +171,7 @@ library "[[@TEST_NAME]]"; // TODO: this code should fail for a different reason, but right now we don't // have a way to write correct code that reaches the TODO we're exercising here. fn F(generic Form: Core.Form) { - // CHECK:STDERR: fail_todo_local_symbolic_form_binding.carbon:[[@LINE+4]]:7: error: semantics TODO: `support local form bindings` [SemanticsTodo] - // CHECK:STDERR: let y:? Form = 0; - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_todo_local_symbolic_form_binding.carbon:[[@LINE+2]]:7-14: error: semantics TODO: `support local form bindings` [SemanticsTodo] // CHECK:STDERR: let y:? Form = 0; } @@ -310,17 +272,11 @@ fn G[T: I](x: T) { // --- fail_return_form_not_form.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_return_form_not_form.carbon:[[@LINE+7]]:12: error: cannot implicitly convert expression of type `type` to `Core.Form` [ConversionFailure] -// CHECK:STDERR: fn F() ->? i32; -// CHECK:STDERR: ^~~ -// CHECK:STDERR: fail_return_form_not_form.carbon:[[@LINE+4]]:12: note: type `type` does not implement interface `Core.ImplicitAs(Core.Form)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: fn F() ->? i32; -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_return_form_not_form.carbon:[[@LINE+3]]:12-14: error: cannot implicitly convert expression of type `type` to `Core.Form` [ConversionFailure] +// CHECK:STDERR: fail_return_form_not_form.carbon:[[@LINE+2]]:12-14: note: type `type` does not implement interface `Core.ImplicitAs(Core.Form)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn F() ->? i32; -// CHECK:STDERR: fail_return_form_not_form.carbon:[[@LINE+4]]:12: error: `ref` tag is not an argument to a `ref` parameter [RefTagNoRefParam] -// CHECK:STDERR: fn F() ->? ref i32; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_return_form_not_form.carbon:[[@LINE+2]]:12-18: error: `ref` tag is not an argument to a `ref` parameter [RefTagNoRefParam] // CHECK:STDERR: fn F() ->? ref i32; diff --git a/toolchain/check/testdata/function/call/ref.carbon b/toolchain/check/testdata/function/call/ref.carbon index 8c20b4a8f47a..9355a73d7923 100644 --- a/toolchain/check/testdata/function/call/ref.carbon +++ b/toolchain/check/testdata/function/call/ref.carbon @@ -49,12 +49,8 @@ fn F(ref x: i32); fn G() { let y: i32 = 0; - // CHECK:STDERR: fail_ref_not_durable_ref.carbon:[[@LINE+7]]:5: error: value expression passed to reference parameter [ValueForRefParam] - // CHECK:STDERR: F(ref y); - // CHECK:STDERR: ^~~~~ - // CHECK:STDERR: fail_ref_not_durable_ref.carbon:[[@LINE-7]]:6: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn F(ref x: i32); - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_ref_not_durable_ref.carbon:[[@LINE+3]]:5-9: error: value expression passed to reference parameter [ValueForRefParam] + // CHECK:STDERR: fail_ref_not_durable_ref.carbon:[[@LINE-5]]:6-15: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: F(ref y); } @@ -67,12 +63,8 @@ fn F(ref x: i32); fn G() { var y: i32 = 0; - // CHECK:STDERR: fail_missing_ref.carbon:[[@LINE+7]]:5: error: argument to `ref` parameter not marked with `ref` [RefParamNoRefTag] - // CHECK:STDERR: F(y); - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_missing_ref.carbon:[[@LINE-7]]:6: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn F(ref x: i32); - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_missing_ref.carbon:[[@LINE+3]]:5: error: argument to `ref` parameter not marked with `ref` [RefParamNoRefTag] + // CHECK:STDERR: fail_missing_ref.carbon:[[@LINE-5]]:6-15: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: F(y); } @@ -86,17 +78,11 @@ fn F(x: i32); fn G() { var y: i32 = 0; - // CHECK:STDERR: fail_unnecessary_ref.carbon:[[@LINE+4]]:27: error: `ref` tag is not an argument to a `ref` parameter [RefTagNoRefParam] - // CHECK:STDERR: var unused z: (i32,) = (ref y,); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_unnecessary_ref.carbon:[[@LINE+2]]:27-31: error: `ref` tag is not an argument to a `ref` parameter [RefTagNoRefParam] // CHECK:STDERR: var unused z: (i32,) = (ref y,); - // CHECK:STDERR: fail_unnecessary_ref.carbon:[[@LINE+7]]:5: error: `ref` tag is not an argument to a `ref` parameter [RefTagNoRefParam] - // CHECK:STDERR: F(ref y); - // CHECK:STDERR: ^~~~~ - // CHECK:STDERR: fail_unnecessary_ref.carbon:[[@LINE-13]]:6: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn F(x: i32); - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_unnecessary_ref.carbon:[[@LINE+3]]:5-9: error: `ref` tag is not an argument to a `ref` parameter [RefTagNoRefParam] + // CHECK:STDERR: fail_unnecessary_ref.carbon:[[@LINE-9]]:6-11: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: F(ref y); } diff --git a/toolchain/check/testdata/function/capture/uncaptured_locals.carbon b/toolchain/check/testdata/function/capture/uncaptured_locals.carbon index fd6f4e2231b1..335345afa4dd 100644 --- a/toolchain/check/testdata/function/capture/uncaptured_locals.carbon +++ b/toolchain/check/testdata/function/capture/uncaptured_locals.carbon @@ -24,9 +24,7 @@ fn Test() { } // Intentionally include an error here so we skip dominance checking, which CHECK-fails for the above example. -// CHECK:STDERR: fail_todo_reference_uncaptured.carbon:[[@LINE+4]]:14: error: name `error` not found [NameNotFound] -// CHECK:STDERR: fn Error() { error; } -// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: fail_todo_reference_uncaptured.carbon:[[@LINE+2]]:14-18: error: name `error` not found [NameNotFound] // CHECK:STDERR: fn Error() { error; } @@ -44,8 +42,6 @@ fn Test() { } // Intentionally include an error here so we skip dominance checking, which CHECK-fails for the above example. -// CHECK:STDERR: fail_todo_reference_uncaptured_lambda.carbon:[[@LINE+4]]:14: error: name `error` not found [NameNotFound] -// CHECK:STDERR: fn Error() { error; } -// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: fail_todo_reference_uncaptured_lambda.carbon:[[@LINE+2]]:14-18: error: name `error` not found [NameNotFound] // CHECK:STDERR: fn Error() { error; } diff --git a/toolchain/check/testdata/function/declaration/default_values.carbon b/toolchain/check/testdata/function/declaration/default_values.carbon index 68091b48416d..f452e62ccc2f 100644 --- a/toolchain/check/testdata/function/declaration/default_values.carbon +++ b/toolchain/check/testdata/function/declaration/default_values.carbon @@ -15,9 +15,7 @@ library "[[@TEST_NAME]]"; class C {} -// CHECK:STDERR: fail_value_not_constant.carbon:[[@LINE+4]]:19: error: default value is not a constant [PatternDefaultValueNotConstant] -// CHECK:STDERR: fn H(x: C, y: C = x); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_value_not_constant.carbon:[[@LINE+2]]:19: error: default value is not a constant [PatternDefaultValueNotConstant] // CHECK:STDERR: fn H(x: C, y: C = x); @@ -27,12 +25,8 @@ library "[[@TEST_NAME]]"; class C {} class D {} -// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+7]]:13: error: cannot implicitly convert expression of type `D` to `C` [ConversionFailure] -// CHECK:STDERR: fn K(x: C = {} as D); -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+4]]:13: note: type `D` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: fn K(x: C = {} as D); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+3]]:13-19: error: cannot implicitly convert expression of type `D` to `C` [ConversionFailure] +// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+2]]:13-19: note: type `D` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn K(x: C = {} as D); @@ -41,9 +35,7 @@ library "[[@TEST_NAME]]"; class C {} -// CHECK:STDERR: fail_pattern_defaults_not_in_parameter_list.carbon:[[@LINE+4]]:19: error: default values are only supported in parameter lists [PatternDefaultValueNotInParameterList] -// CHECK:STDERR: let (y: C, x: C = {}) = ({}, {}); -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_pattern_defaults_not_in_parameter_list.carbon:[[@LINE+2]]:19-20: error: default values are only supported in parameter lists [PatternDefaultValueNotInParameterList] // CHECK:STDERR: let (y: C, x: C = {}) = ({}, {}); @@ -52,22 +44,12 @@ library "[[@TEST_NAME]]"; class C {} -// CHECK:STDERR: fail_required_default_values_missing.carbon:[[@LINE+17]]:35: error: this pattern is missing a required default value. [RequiredPatternDefaultValueMissing] -// CHECK:STDERR: fn Z(v: C, x: C = {}, (y: C = {}, z: C), w: C = {}, k: C); -// CHECK:STDERR: ^~~~ -// CHECK:STDERR: fail_required_default_values_missing.carbon:[[@LINE+14]]:24: note: all patterns to the right of this first pattern with a default value must also specify a default value. [RequiredPatternDefaultValueFirstDefault] -// CHECK:STDERR: fn Z(v: C, x: C = {}, (y: C = {}, z: C), w: C = {}, k: C); -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_required_default_values_missing.carbon:[[@LINE+7]]:35-38: error: this pattern is missing a required default value. [RequiredPatternDefaultValueMissing] +// CHECK:STDERR: fail_required_default_values_missing.carbon:[[@LINE+6]]:24-27: note: all patterns to the right of this first pattern with a default value must also specify a default value. [RequiredPatternDefaultValueFirstDefault] // CHECK:STDERR: -// CHECK:STDERR: fail_required_default_values_missing.carbon:[[@LINE+10]]:23: error: this pattern is missing a required default value. [RequiredPatternDefaultValueMissing] -// CHECK:STDERR: fn Z(v: C, x: C = {}, (y: C = {}, z: C), w: C = {}, k: C); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_required_default_values_missing.carbon:[[@LINE+7]]:53: note: this pattern is also missing a required default value. [RequiredPatternDefaultValueMissingAdditional] -// CHECK:STDERR: fn Z(v: C, x: C = {}, (y: C = {}, z: C), w: C = {}, k: C); -// CHECK:STDERR: ^~~~ -// CHECK:STDERR: fail_required_default_values_missing.carbon:[[@LINE+4]]:12: note: all patterns to the right of this first pattern with a default value must also specify a default value. [RequiredPatternDefaultValueFirstDefault] -// CHECK:STDERR: fn Z(v: C, x: C = {}, (y: C = {}, z: C), w: C = {}, k: C); -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_required_default_values_missing.carbon:[[@LINE+4]]:23-39: error: this pattern is missing a required default value. [RequiredPatternDefaultValueMissing] +// CHECK:STDERR: fail_required_default_values_missing.carbon:[[@LINE+3]]:53-56: note: this pattern is also missing a required default value. [RequiredPatternDefaultValueMissingAdditional] +// CHECK:STDERR: fail_required_default_values_missing.carbon:[[@LINE+2]]:12-15: note: all patterns to the right of this first pattern with a default value must also specify a default value. [RequiredPatternDefaultValueFirstDefault] // CHECK:STDERR: fn Z(v: C, x: C = {}, (y: C = {}, z: C), w: C = {}, k: C); @@ -76,19 +58,11 @@ library "[[@TEST_NAME]]"; class C {} -// CHECK:STDERR: fail_nesting_required_default_values_missing.carbon:[[@LINE+14]]:36: error: this pattern is missing a required default value. [RequiredPatternDefaultValueMissing] -// CHECK:STDERR: fn F(a: C, (b: C = {}, (c: C = {}, (d: C, e: C)))); -// CHECK:STDERR: ^~~~~~~~~~~~ -// CHECK:STDERR: fail_nesting_required_default_values_missing.carbon:[[@LINE+11]]:25: note: all patterns to the right of this first pattern with a default value must also specify a default value. [RequiredPatternDefaultValueFirstDefault] -// CHECK:STDERR: fn F(a: C, (b: C = {}, (c: C = {}, (d: C, e: C)))); -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_nesting_required_default_values_missing.carbon:[[@LINE+6]]:36-47: error: this pattern is missing a required default value. [RequiredPatternDefaultValueMissing] +// CHECK:STDERR: fail_nesting_required_default_values_missing.carbon:[[@LINE+5]]:25-28: note: all patterns to the right of this first pattern with a default value must also specify a default value. [RequiredPatternDefaultValueFirstDefault] // CHECK:STDERR: -// CHECK:STDERR: fail_nesting_required_default_values_missing.carbon:[[@LINE+7]]:24: error: this pattern is missing a required default value. [RequiredPatternDefaultValueMissing] -// CHECK:STDERR: fn F(a: C, (b: C = {}, (c: C = {}, (d: C, e: C)))); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_nesting_required_default_values_missing.carbon:[[@LINE+4]]:13: note: all patterns to the right of this first pattern with a default value must also specify a default value. [RequiredPatternDefaultValueFirstDefault] -// CHECK:STDERR: fn F(a: C, (b: C = {}, (c: C = {}, (d: C, e: C)))); -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_nesting_required_default_values_missing.carbon:[[@LINE+3]]:24-48: error: this pattern is missing a required default value. [RequiredPatternDefaultValueMissing] +// CHECK:STDERR: fail_nesting_required_default_values_missing.carbon:[[@LINE+2]]:13-16: note: all patterns to the right of this first pattern with a default value must also specify a default value. [RequiredPatternDefaultValueFirstDefault] // CHECK:STDERR: fn F(a: C, (b: C = {}, (c: C = {}, (d: C, e: C)))); @@ -101,12 +75,8 @@ impl C as Core.As(D) { fn Convert(unused self: C) -> D { return {} as D; } } -// CHECK:STDERR: fail_explicit_conversion_not_supported.carbon:[[@LINE+7]]:13: error: cannot implicitly convert expression of type `C` to `D` [ConversionFailure] -// CHECK:STDERR: fn F(a: D = {} as C); -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_explicit_conversion_not_supported.carbon:[[@LINE+4]]:13: note: type `C` does not implement interface `Core.ImplicitAs(D)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: fn F(a: D = {} as C); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_explicit_conversion_not_supported.carbon:[[@LINE+3]]:13-19: error: cannot implicitly convert expression of type `C` to `D` [ConversionFailure] +// CHECK:STDERR: fail_explicit_conversion_not_supported.carbon:[[@LINE+2]]:13-19: note: type `C` does not implement interface `Core.ImplicitAs(D)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn F(a: D = {} as C); diff --git a/toolchain/check/testdata/function/declaration/eval_musteval.carbon b/toolchain/check/testdata/function/declaration/eval_musteval.carbon index a43b0299a79c..4f0df384e807 100644 --- a/toolchain/check/testdata/function/declaration/eval_musteval.carbon +++ b/toolchain/check/testdata/function/declaration/eval_musteval.carbon @@ -38,12 +38,8 @@ private musteval fn MustEval() -> i32 { return 0; } library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+7]]:6: error: `musteval` not allowed on declaration with `eval` [ModifierNotAllowedWith] -// CHECK:STDERR: eval musteval fn Mixed(); -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+4]]:1: note: `eval` previously appeared here [ModifierPrevious] -// CHECK:STDERR: eval musteval fn Mixed(); -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_conflict.carbon:[[@LINE+3]]:6-13: error: `musteval` not allowed on declaration with `eval` [ModifierNotAllowedWith] +// CHECK:STDERR: fail_conflict.carbon:[[@LINE+2]]:1-4: note: `eval` previously appeared here [ModifierPrevious] // CHECK:STDERR: eval musteval fn Mixed(); @@ -51,31 +47,19 @@ eval musteval fn Mixed(); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_order.carbon:[[@LINE+7]]:6: error: `export` must appear before `eval` [ModifierMustAppearBefore] -// CHECK:STDERR: eval export fn ExportEval(); -// CHECK:STDERR: ^~~~~~ -// CHECK:STDERR: fail_order.carbon:[[@LINE+4]]:1: note: `eval` previously appeared here [ModifierPrevious] -// CHECK:STDERR: eval export fn ExportEval(); -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_order.carbon:[[@LINE+3]]:6-11: error: `export` must appear before `eval` [ModifierMustAppearBefore] +// CHECK:STDERR: fail_order.carbon:[[@LINE+2]]:1-4: note: `eval` previously appeared here [ModifierPrevious] // CHECK:STDERR: eval export fn ExportEval(); -// CHECK:STDERR: fail_order.carbon:[[@LINE+7]]:6: error: `private` must appear before `eval` [ModifierMustAppearBefore] -// CHECK:STDERR: eval private fn PrivateEval(); -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_order.carbon:[[@LINE+4]]:1: note: `eval` previously appeared here [ModifierPrevious] -// CHECK:STDERR: eval private fn PrivateEval(); -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_order.carbon:[[@LINE+3]]:6-12: error: `private` must appear before `eval` [ModifierMustAppearBefore] +// CHECK:STDERR: fail_order.carbon:[[@LINE+2]]:1-4: note: `eval` previously appeared here [ModifierPrevious] // CHECK:STDERR: eval private fn PrivateEval(); class C { - // CHECK:STDERR: fail_order.carbon:[[@LINE+7]]:8: error: `virtual` must appear before `eval` [ModifierMustAppearBefore] - // CHECK:STDERR: eval virtual fn VirtualEval(); - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_order.carbon:[[@LINE+4]]:3: note: `eval` previously appeared here [ModifierPrevious] - // CHECK:STDERR: eval virtual fn VirtualEval(); - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_order.carbon:[[@LINE+3]]:8-14: error: `virtual` must appear before `eval` [ModifierMustAppearBefore] + // CHECK:STDERR: fail_order.carbon:[[@LINE+2]]:3-6: note: `eval` previously appeared here [ModifierPrevious] // CHECK:STDERR: eval virtual fn VirtualEval(); } @@ -84,15 +68,11 @@ class C { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_not_fn.carbon:[[@LINE+4]]:1: error: `eval` not allowed on `var` declaration [ModifierNotAllowedOnDeclaration] -// CHECK:STDERR: eval var x: i32; -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_not_fn.carbon:[[@LINE+2]]:1-4: error: `eval` not allowed on `var` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: eval var x: i32; -// CHECK:STDERR: fail_not_fn.carbon:[[@LINE+4]]:1: error: `eval` not allowed on `class` declaration [ModifierNotAllowedOnDeclaration] -// CHECK:STDERR: eval class C {}; -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_not_fn.carbon:[[@LINE+2]]:1-4: error: `eval` not allowed on `class` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: eval class C {}; @@ -117,56 +97,32 @@ eval fn EvalThenMustEval(); musteval fn MustEvalThenNone(); musteval fn MustEvalThenEval(); -// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE+7]]:1: error: function redeclaration differs because new function is `eval` [FunctionRedeclEvaluationModeDiffers] -// CHECK:STDERR: eval fn NoneThenEval() {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE-10]]:1: note: previously not declared as `eval` [FunctionRedeclEvaluationModePrevious] -// CHECK:STDERR: fn NoneThenEval(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE+3]]:1-24: error: function redeclaration differs because new function is `eval` [FunctionRedeclEvaluationModeDiffers] +// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE-8]]:1-18: note: previously not declared as `eval` [FunctionRedeclEvaluationModePrevious] // CHECK:STDERR: eval fn NoneThenEval() {} -// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE+7]]:1: error: function redeclaration differs because new function is `musteval` [FunctionRedeclEvaluationModeDiffers] -// CHECK:STDERR: musteval fn NoneThenMustEval() {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE-18]]:1: note: previously not declared as `musteval` [FunctionRedeclEvaluationModePrevious] -// CHECK:STDERR: fn NoneThenMustEval(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE+3]]:1-32: error: function redeclaration differs because new function is `musteval` [FunctionRedeclEvaluationModeDiffers] +// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE-12]]:1-22: note: previously not declared as `musteval` [FunctionRedeclEvaluationModePrevious] // CHECK:STDERR: musteval fn NoneThenMustEval() {} -// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE+7]]:1: error: function redeclaration differs because new function is not `eval` [FunctionRedeclEvaluationModeDiffers] -// CHECK:STDERR: fn EvalThenNone() {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE-26]]:1: note: previously declared as `eval` [FunctionRedeclEvaluationModePrevious] -// CHECK:STDERR: eval fn EvalThenNone(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE+3]]:1-19: error: function redeclaration differs because new function is not `eval` [FunctionRedeclEvaluationModeDiffers] +// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE-16]]:1-23: note: previously declared as `eval` [FunctionRedeclEvaluationModePrevious] // CHECK:STDERR: fn EvalThenNone() {} -// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE+7]]:1: error: function redeclaration differs because new function is `musteval` [FunctionRedeclEvaluationModeDiffers] -// CHECK:STDERR: musteval fn EvalThenMustEval() {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE-34]]:1: note: previously declared as `eval` [FunctionRedeclEvaluationModePrevious] -// CHECK:STDERR: eval fn EvalThenMustEval(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE+3]]:1-32: error: function redeclaration differs because new function is `musteval` [FunctionRedeclEvaluationModeDiffers] +// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE-20]]:1-27: note: previously declared as `eval` [FunctionRedeclEvaluationModePrevious] // CHECK:STDERR: musteval fn EvalThenMustEval() {} -// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE+7]]:1: error: function redeclaration differs because new function is not `musteval` [FunctionRedeclEvaluationModeDiffers] -// CHECK:STDERR: fn MustEvalThenNone() {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE-42]]:1: note: previously declared as `musteval` [FunctionRedeclEvaluationModePrevious] -// CHECK:STDERR: musteval fn MustEvalThenNone(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE+3]]:1-23: error: function redeclaration differs because new function is not `musteval` [FunctionRedeclEvaluationModeDiffers] +// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE-24]]:1-31: note: previously declared as `musteval` [FunctionRedeclEvaluationModePrevious] // CHECK:STDERR: fn MustEvalThenNone() {} -// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE+7]]:1: error: function redeclaration differs because new function is `eval` [FunctionRedeclEvaluationModeDiffers] -// CHECK:STDERR: eval fn MustEvalThenEval() {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE-50]]:1: note: previously declared as `musteval` [FunctionRedeclEvaluationModePrevious] -// CHECK:STDERR: musteval fn MustEvalThenEval(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE+3]]:1-28: error: function redeclaration differs because new function is `eval` [FunctionRedeclEvaluationModeDiffers] +// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE-28]]:1-31: note: previously declared as `musteval` [FunctionRedeclEvaluationModePrevious] // CHECK:STDERR: eval fn MustEvalThenEval() {} diff --git a/toolchain/check/testdata/function/declaration/extern.carbon b/toolchain/check/testdata/function/declaration/extern.carbon index 5f79c588eeae..bf0a5368e218 100644 --- a/toolchain/check/testdata/function/declaration/extern.carbon +++ b/toolchain/check/testdata/function/declaration/extern.carbon @@ -29,12 +29,8 @@ var x: () = F(); library "[[@TEST_NAME]]"; extern fn F(); -// CHECK:STDERR: fail_redecl.carbon:[[@LINE+7]]:1: error: redeclaration of `fn F` is redundant [RedeclRedundant] -// CHECK:STDERR: extern fn F(); -// CHECK:STDERR: ^~~~~~~~~~~~~~ -// CHECK:STDERR: fail_redecl.carbon:[[@LINE-4]]:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: extern fn F(); -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_redecl.carbon:[[@LINE+3]]:1-14: error: redeclaration of `fn F` is redundant [RedeclRedundant] +// CHECK:STDERR: fail_redecl.carbon:[[@LINE-2]]:1-14: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: extern fn F(); @@ -43,12 +39,8 @@ extern fn F(); library "[[@TEST_NAME]]"; extern fn F(); -// CHECK:STDERR: fail_redecl_extern.carbon:[[@LINE+7]]:1: error: redeclaration of `fn F` is redundant [RedeclRedundant] -// CHECK:STDERR: fn F(); -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_redecl_extern.carbon:[[@LINE-4]]:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: extern fn F(); -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_redecl_extern.carbon:[[@LINE+3]]:1-7: error: redeclaration of `fn F` is redundant [RedeclRedundant] +// CHECK:STDERR: fail_redecl_extern.carbon:[[@LINE-2]]:1-14: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: fn F(); @@ -57,14 +49,10 @@ fn F(); library "[[@TEST_NAME]]"; class C { - // CHECK:STDERR: fail_member_extern.carbon:[[@LINE+4]]:3: error: `extern` not allowed; requires file or namespace scope [ModifierExternNotAllowed] - // CHECK:STDERR: extern fn F(); - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_member_extern.carbon:[[@LINE+2]]:3-8: error: `extern` not allowed; requires file or namespace scope [ModifierExternNotAllowed] // CHECK:STDERR: extern fn F(); - // CHECK:STDERR: fail_member_extern.carbon:[[@LINE+4]]:3: error: `extern` not allowed; requires file or namespace scope [ModifierExternNotAllowed] - // CHECK:STDERR: extern fn G(self); - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_member_extern.carbon:[[@LINE+2]]:3-8: error: `extern` not allowed; requires file or namespace scope [ModifierExternNotAllowed] // CHECK:STDERR: extern fn G(self); } @@ -75,13 +63,9 @@ library "[[@TEST_NAME]]"; import library "basic"; -// CHECK:STDERR: fail_extern_library_in_importer.carbon:[[@LINE+8]]:1: error: cannot declare imported `fn F` as `extern library` [ExternLibraryInImporter] -// CHECK:STDERR: extern library "basic" fn F(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_extern_library_in_importer.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: basic.carbon:4:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: extern fn F(); -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_extern_library_in_importer.carbon:[[@LINE+4]]:1-30: error: cannot declare imported `fn F` as `extern library` [ExternLibraryInImporter] +// CHECK:STDERR: imported from: fail_extern_library_in_importer.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: basic.carbon:4:1-14: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: extern library "basic" fn F(); @@ -160,7 +144,7 @@ extern library "basic" fn F(); // CHECK:STDOUT: .F = %F.decl.loc4 // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl.loc4: %F.type = fn_decl @F [concrete = constants.%F] {} {} -// CHECK:STDOUT: %F.decl.loc12: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: %F.decl.loc8: %F.type = fn_decl @F [concrete = constants.%F] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: extern fn @F(); @@ -178,7 +162,7 @@ extern library "basic" fn F(); // CHECK:STDOUT: .F = %F.decl.loc4 // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl.loc4: %F.type = fn_decl @F [concrete = constants.%F] {} {} -// CHECK:STDOUT: %F.decl.loc12: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: %F.decl.loc8: %F.type = fn_decl @F [concrete = constants.%F] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: extern fn @F(); diff --git a/toolchain/check/testdata/function/declaration/extern_library.carbon b/toolchain/check/testdata/function/declaration/extern_library.carbon index 1bc93da4c7db..ab1de916fab7 100644 --- a/toolchain/check/testdata/function/declaration/extern_library.carbon +++ b/toolchain/check/testdata/function/declaration/extern_library.carbon @@ -32,13 +32,9 @@ library "[[@TEST_NAME]]"; import library "extern_library"; -// CHECK:STDERR: fail_extern_library_nonowner.carbon:[[@LINE+8]]:1: error: declaration in library "extern_library_nonowner" doesn't match `extern library` declaration [ExternLibraryIncorrect] -// CHECK:STDERR: extern fn F(); -// CHECK:STDERR: ^~~~~~~~~~~~~~ -// CHECK:STDERR: fail_extern_library_nonowner.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: extern_library.carbon:4:1: note: previously declared with `extern library` here [ExternLibraryExpected] -// CHECK:STDERR: extern library "extern_library_owner" fn F(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_extern_library_nonowner.carbon:[[@LINE+4]]:1-14: error: declaration in library "extern_library_nonowner" doesn't match `extern library` declaration [ExternLibraryIncorrect] +// CHECK:STDERR: imported from: fail_extern_library_nonowner.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: extern_library.carbon:4:1-45: note: previously declared with `extern library` here [ExternLibraryExpected] // CHECK:STDERR: extern fn F(); @@ -48,13 +44,9 @@ library "[[@TEST_NAME]]"; import library "extern_library"; -// CHECK:STDERR: fail_extern_library_nonextern.carbon:[[@LINE+8]]:1: error: redeclarations of `fn F` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: fn F(); -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_extern_library_nonextern.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: extern_library.carbon:4:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: extern library "extern_library_owner" fn F(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_extern_library_nonextern.carbon:[[@LINE+4]]:1-7: error: redeclarations of `fn F` must match use of `extern` [RedeclExternMismatch] +// CHECK:STDERR: imported from: fail_extern_library_nonextern.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: extern_library.carbon:4:1-45: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: fn F(); @@ -64,13 +56,9 @@ library "[[@TEST_NAME]]"; import library "extern_library"; -// CHECK:STDERR: fail_extern_library_redecl.carbon:[[@LINE+8]]:1: error: declaration in library "extern_library_redecl" doesn't match `extern library` declaration [ExternLibraryIncorrect] -// CHECK:STDERR: extern library "extern_library_owner" fn F(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_extern_library_redecl.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: extern_library.carbon:4:1: note: previously declared with `extern library` here [ExternLibraryExpected] -// CHECK:STDERR: extern library "extern_library_owner" fn F(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_extern_library_redecl.carbon:[[@LINE+4]]:1-45: error: declaration in library "extern_library_redecl" doesn't match `extern library` declaration [ExternLibraryIncorrect] +// CHECK:STDERR: imported from: fail_extern_library_redecl.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: extern_library.carbon:4:1-45: note: previously declared with `extern library` here [ExternLibraryExpected] // CHECK:STDERR: extern library "extern_library_owner" fn F(); @@ -84,14 +72,10 @@ extern library "extern_library_owner" fn F(); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_extern_library_collision.carbon:[[@LINE+9]]:1: in import [InImport] -// CHECK:STDERR: extern_library_copy.carbon:4:1: error: duplicate name `F` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: extern library "extern_library_owner" fn F(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_extern_library_collision.carbon:[[@LINE+5]]:1: in import [InImport] -// CHECK:STDERR: extern_library.carbon:4:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: extern library "extern_library_owner" fn F(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: imported from: fail_extern_library_collision.carbon:[[@LINE+5]]:1 [InImport] +// CHECK:STDERR: extern_library_copy.carbon:4:1-45: error: duplicate name `F` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_extern_library_collision.carbon:[[@LINE+3]]:1 [InImport] +// CHECK:STDERR: extern_library.carbon:4:1-45: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: import library "extern_library"; import library "extern_library_copy"; @@ -108,13 +92,9 @@ library "[[@TEST_NAME]]"; import library "extern_library_mismatch" -// CHECK:STDERR: fail_extern_library_mismatch_owner.carbon:[[@LINE+8]]:1: error: `import` declarations must end with a `;` [ExpectedDeclSemi] -// CHECK:STDERR: extern fn F(); -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_extern_library_mismatch_owner.carbon:[[@LINE+4]]:1-6: error: `import` declarations must end with a `;` [ExpectedDeclSemi] // CHECK:STDERR: -// CHECK:STDERR: fail_extern_library_mismatch_owner.carbon:[[@LINE-6]]:1: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] -// CHECK:STDERR: import library "extern_library_mismatch" -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_extern_library_mismatch_owner.carbon:[[@LINE-4]]:1-40: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: extern fn F(); @@ -122,9 +102,7 @@ extern fn F(); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_extern_self_library.carbon:[[@LINE+4]]:1: error: `extern library` cannot specify the current library [ExternLibraryIsCurrentLibrary] -// CHECK:STDERR: extern library "extern_self_library" fn F(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_extern_self_library.carbon:[[@LINE+2]]:1-36: error: `extern library` cannot specify the current library [ExternLibraryIsCurrentLibrary] // CHECK:STDERR: extern library "extern_self_library" fn F(); @@ -140,13 +118,9 @@ library "[[@TEST_NAME]]"; import library "extern_of_import"; -// CHECK:STDERR: fail_extern_of_import_redecl.carbon:[[@LINE+8]]:1: error: redeclarations of `fn F` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: extern library "extern_of_import" fn F(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_extern_of_import_redecl.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: extern_of_import.carbon:4:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: fn F(); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_extern_of_import_redecl.carbon:[[@LINE+4]]:1-41: error: redeclarations of `fn F` must match use of `extern` [RedeclExternMismatch] +// CHECK:STDERR: imported from: fail_extern_of_import_redecl.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: extern_of_import.carbon:4:1-7: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: extern library "extern_of_import" fn F(); @@ -154,9 +128,7 @@ extern library "extern_of_import" fn F(); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_extern_library_on_definition.carbon:[[@LINE+4]]:1: error: a library cannot be provided for an `extern` modifier on a definition [ExternLibraryOnDefinition] -// CHECK:STDERR: extern library "extern_library_owner" fn F() {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_extern_library_on_definition.carbon:[[@LINE+2]]:1-37: error: a library cannot be provided for an `extern` modifier on a definition [ExternLibraryOnDefinition] // CHECK:STDERR: extern library "extern_library_owner" fn F() {} diff --git a/toolchain/check/testdata/function/declaration/extern_library_for_default.carbon b/toolchain/check/testdata/function/declaration/extern_library_for_default.carbon index 20dedb45d978..5ef734a2ffef 100644 --- a/toolchain/check/testdata/function/declaration/extern_library_for_default.carbon +++ b/toolchain/check/testdata/function/declaration/extern_library_for_default.carbon @@ -32,13 +32,9 @@ package Foo library "[[@TEST_NAME]]"; import library default; -// CHECK:STDERR: fail_wrong_library.carbon:[[@LINE+8]]:1: error: declaration in library "wrong_library" doesn't match `extern library` declaration [ExternLibraryIncorrect] -// CHECK:STDERR: extern fn F(); -// CHECK:STDERR: ^~~~~~~~~~~~~~ -// CHECK:STDERR: fail_wrong_library.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: default.carbon:4:1: note: previously declared with `extern library` here [ExternLibraryExpected] -// CHECK:STDERR: extern library "expected" fn F(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_wrong_library.carbon:[[@LINE+4]]:1-14: error: declaration in library "wrong_library" doesn't match `extern library` declaration [ExternLibraryIncorrect] +// CHECK:STDERR: imported from: fail_wrong_library.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: default.carbon:4:1-33: note: previously declared with `extern library` here [ExternLibraryExpected] // CHECK:STDERR: extern fn F(); diff --git a/toolchain/check/testdata/function/declaration/extern_library_from_default.carbon b/toolchain/check/testdata/function/declaration/extern_library_from_default.carbon index f6d09107efe0..4cd9323750c0 100644 --- a/toolchain/check/testdata/function/declaration/extern_library_from_default.carbon +++ b/toolchain/check/testdata/function/declaration/extern_library_from_default.carbon @@ -30,13 +30,9 @@ library "[[@TEST_NAME]]"; import library "extern_library"; -// CHECK:STDERR: fail_wrong_library.carbon:[[@LINE+8]]:1: error: declaration in library "wrong_library" doesn't match `extern library` declaration [ExternLibraryIncorrect] -// CHECK:STDERR: extern fn F(); -// CHECK:STDERR: ^~~~~~~~~~~~~~ -// CHECK:STDERR: fail_wrong_library.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: extern_library.carbon:4:1: note: previously declared with `extern library` here [ExternLibraryExpected] -// CHECK:STDERR: extern library default fn F(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_wrong_library.carbon:[[@LINE+4]]:1-14: error: declaration in library "wrong_library" doesn't match `extern library` declaration [ExternLibraryIncorrect] +// CHECK:STDERR: imported from: fail_wrong_library.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: extern_library.carbon:4:1-30: note: previously declared with `extern library` here [ExternLibraryExpected] // CHECK:STDERR: extern fn F(); diff --git a/toolchain/check/testdata/function/declaration/fail_import_incomplete_return.carbon b/toolchain/check/testdata/function/declaration/fail_import_incomplete_return.carbon index c06de5cdab96..6a04efc9a356 100644 --- a/toolchain/check/testdata/function/declaration/fail_import_incomplete_return.carbon +++ b/toolchain/check/testdata/function/declaration/fail_import_incomplete_return.carbon @@ -25,26 +25,14 @@ fn ReturnDUnused() -> D; fn ReturnDUsed() -> D; fn Call() { - // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE+10]]:3: error: function returns incomplete type `C` [IncompleteTypeInFunctionReturnType] - // CHECK:STDERR: ReturnCUsed(); - // CHECK:STDERR: ^~~~~~~~~~~~~ - // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE-12]]:1: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: class C; - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE-11]]:18: note: return type declared here [IncompleteReturnTypeHere] - // CHECK:STDERR: fn ReturnCUsed() -> C; - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE+4]]:3-15: error: function returns incomplete type `C` [IncompleteTypeInFunctionReturnType] + // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE-10]]:1-8: note: class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE-7]]:18-21: note: return type declared here [IncompleteReturnTypeHere] // CHECK:STDERR: ReturnCUsed(); - // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE+10]]:3: error: function returns incomplete type `D` [IncompleteTypeInFunctionReturnType] - // CHECK:STDERR: ReturnDUsed(); - // CHECK:STDERR: ^~~~~~~~~~~~~ - // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE-22]]:1: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: class D; - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE-20]]:18: note: return type declared here [IncompleteReturnTypeHere] - // CHECK:STDERR: fn ReturnDUsed() -> D; - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE+4]]:3-15: error: function returns incomplete type `D` [IncompleteTypeInFunctionReturnType] + // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE-14]]:1-8: note: class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE-10]]:18-21: note: return type declared here [IncompleteReturnTypeHere] // CHECK:STDERR: ReturnDUsed(); } @@ -58,30 +46,16 @@ library "[[@TEST_NAME]]"; import library "incomplete_return"; fn CallFAndGIncomplete() { - // CHECK:STDERR: fail_use_imported.carbon:[[@LINE+12]]:3: error: function returns incomplete type `C` [IncompleteTypeInFunctionReturnType] - // CHECK:STDERR: ReturnCUnused(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_use_imported.carbon:[[@LINE-6]]:1: in import [InImport] - // CHECK:STDERR: fail_incomplete_return.carbon:4:1: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: class C; - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_use_imported.carbon:[[@LINE-10]]:1: in import [InImport] - // CHECK:STDERR: fail_incomplete_return.carbon:7:20: note: return type declared here [IncompleteReturnTypeHere] - // CHECK:STDERR: fn ReturnCUnused() -> C; - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_use_imported.carbon:[[@LINE+5]]:3-17: error: function returns incomplete type `C` [IncompleteTypeInFunctionReturnType] + // CHECK:STDERR: imported from: fail_use_imported.carbon:[[@LINE-4]]:1 [InImport] + // CHECK:STDERR: fail_incomplete_return.carbon:4:1-8: note: class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: fail_incomplete_return.carbon:7:20-23: note: return type declared here [IncompleteReturnTypeHere] // CHECK:STDERR: ReturnCUnused(); - // CHECK:STDERR: fail_use_imported.carbon:[[@LINE+12]]:3: error: function returns incomplete type `C` [IncompleteTypeInFunctionReturnType] - // CHECK:STDERR: ReturnCUsed(); - // CHECK:STDERR: ^~~~~~~~~~~~~ - // CHECK:STDERR: fail_use_imported.carbon:[[@LINE-19]]:1: in import [InImport] - // CHECK:STDERR: fail_incomplete_return.carbon:4:1: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: class C; - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_use_imported.carbon:[[@LINE-23]]:1: in import [InImport] - // CHECK:STDERR: fail_incomplete_return.carbon:8:18: note: return type declared here [IncompleteReturnTypeHere] - // CHECK:STDERR: fn ReturnCUsed() -> C; - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_use_imported.carbon:[[@LINE+5]]:3-15: error: function returns incomplete type `C` [IncompleteTypeInFunctionReturnType] + // CHECK:STDERR: imported from: fail_use_imported.carbon:[[@LINE-10]]:1 [InImport] + // CHECK:STDERR: fail_incomplete_return.carbon:4:1-8: note: class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: fail_incomplete_return.carbon:8:18-21: note: return type declared here [IncompleteReturnTypeHere] // CHECK:STDERR: ReturnCUsed(); ReturnDUnused(); @@ -174,7 +148,7 @@ fn CallFAndGIncomplete() { // CHECK:STDOUT: %return: ref %D = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %Call.decl: %Call.type = fn_decl @Call [concrete = constants.%Call] {} {} -// CHECK:STDOUT: %D.decl.loc37: type = class_decl @D [concrete = constants.%D] {} {} +// CHECK:STDOUT: %D.decl.loc25: type = class_decl @D [concrete = constants.%D] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C; @@ -225,17 +199,17 @@ fn CallFAndGIncomplete() { // CHECK:STDOUT: %pattern_type.a96: type = pattern_type %empty_struct_type [concrete] // CHECK:STDOUT: %self.param_patt.52f: %pattern_type.a96 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.4b1: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt.52f [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc33_17.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc19_17.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc33_17.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc19_17.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.1: %Destroy.WithSelf.Op.type.ef016f.1 = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.b8e: %pattern_type.d8d = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.86b: %pattern_type.d8d = wrapper_binding_pattern self, %self.param_patt.b8e [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc33_17.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc19_17.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc33_17.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc19_17.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.2: %Destroy.WithSelf.Op.type.ef016f.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc33_17.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc19_17.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.2: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2 = struct_value () [concrete] // CHECK:STDOUT: %ReturnDUsed.type: type = fn_type @ReturnDUsed [concrete] // CHECK:STDOUT: %ReturnDUsed: %ReturnDUsed.type = struct_value () [concrete] @@ -254,34 +228,34 @@ fn CallFAndGIncomplete() { // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } -// CHECK:STDOUT: %Main.import_ref.8f2: = import_ref Main//incomplete_return, loc37_10, loaded [concrete = constants.%complete_type] +// CHECK:STDOUT: %Main.import_ref.8f2: = import_ref Main//incomplete_return, loc25_10, loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Main.import_ref.54a = import_ref Main//incomplete_return, inst{{[0-9A-F]+}} [no loc], unloaded // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc33_17.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc19_17.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.a96 = ref_param_pattern [concrete = constants.%self.param_patt.52f] // CHECK:STDOUT: %self.patt: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.4b1] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %empty_struct_type = ref_param call_param0 // CHECK:STDOUT: %self: ref %empty_struct_type = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc33_17.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc19_17.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.a96 = ref_param_pattern [concrete = constants.%self.param_patt.52f] // CHECK:STDOUT: %self.patt: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.4b1] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %empty_struct_type = ref_param call_param0 // CHECK:STDOUT: %self: ref %empty_struct_type = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc33_17.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc19_17.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d8d = ref_param_pattern [concrete = constants.%self.param_patt.b8e] // CHECK:STDOUT: %self.patt: %pattern_type.d8d = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.86b] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %D = ref_param call_param0 // CHECK:STDOUT: %self: ref %D = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc33_17.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc19_17.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d8d = ref_param_pattern [concrete = constants.%self.param_patt.b8e] // CHECK:STDOUT: %self.patt: %pattern_type.d8d = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.86b] // CHECK:STDOUT: } { @@ -323,17 +297,17 @@ fn CallFAndGIncomplete() { // CHECK:STDOUT: %ReturnCUsed.ref: %ReturnCUsed.type = name_ref ReturnCUsed, imports.%Main.ReturnCUsed [concrete = constants.%ReturnCUsed] // CHECK:STDOUT: %ReturnCUsed.call: init = call %ReturnCUsed.ref() // CHECK:STDOUT: %ReturnDUnused.ref: %ReturnDUnused.type = name_ref ReturnDUnused, imports.%Main.ReturnDUnused [concrete = constants.%ReturnDUnused] -// CHECK:STDOUT: %.loc33_17.1: ref %D = temporary_storage -// CHECK:STDOUT: %ReturnDUnused.call: init %D to %.loc33_17.1 = call %ReturnDUnused.ref() -// CHECK:STDOUT: %.loc33_17.2: ref %D = temporary %.loc33_17.1, %ReturnDUnused.call -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc33: = bound_method %.loc33_17.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc33: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc33(%.loc33_17.2) +// CHECK:STDOUT: %.loc19_17.1: ref %D = temporary_storage +// CHECK:STDOUT: %ReturnDUnused.call: init %D to %.loc19_17.1 = call %ReturnDUnused.ref() +// CHECK:STDOUT: %.loc19_17.2: ref %D = temporary %.loc19_17.1, %ReturnDUnused.call +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc19: = bound_method %.loc19_17.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc19: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc19(%.loc19_17.2) // CHECK:STDOUT: %ReturnDUsed.ref: %ReturnDUsed.type = name_ref ReturnDUsed, imports.%Main.ReturnDUsed [concrete = constants.%ReturnDUsed] -// CHECK:STDOUT: %.loc34_15.1: ref %D = temporary_storage -// CHECK:STDOUT: %ReturnDUsed.call: init %D to %.loc34_15.1 = call %ReturnDUsed.ref() -// CHECK:STDOUT: %.loc34_15.2: ref %D = temporary %.loc34_15.1, %ReturnDUsed.call -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc34: = bound_method %.loc34_15.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc34: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc34(%.loc34_15.2) +// CHECK:STDOUT: %.loc20_15.1: ref %D = temporary_storage +// CHECK:STDOUT: %ReturnDUsed.call: init %D to %.loc20_15.1 = call %ReturnDUsed.ref() +// CHECK:STDOUT: %.loc20_15.2: ref %D = temporary %.loc20_15.1, %ReturnDUsed.call +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc20: = bound_method %.loc20_15.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc20: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc20(%.loc20_15.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -343,22 +317,22 @@ fn CallFAndGIncomplete() { // CHECK:STDOUT: // CHECK:STDOUT: fn @ReturnDUnused [from "fail_incomplete_return.carbon"]; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc33_17.1(%self.param: ref %empty_struct_type) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc19_17.1(%self.param: ref %empty_struct_type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc33_17.1(%self.param: ref %empty_struct_type) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc19_17.1(%self.param: ref %empty_struct_type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc33_17.1(%self.param: ref %empty_struct_type) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc19_17.1(%self.param: ref %empty_struct_type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.1(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.1(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc33_17.2(%self.param: ref %D) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc19_17.2(%self.param: ref %D) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc33_17.2(%self.param: ref %D) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc19_17.2(%self.param: ref %D) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc33_17.2(%self.param: ref %D) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc19_17.2(%self.param: ref %D) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.2(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.2(%self.param) diff --git a/toolchain/check/testdata/function/declaration/fail_modifiers.carbon b/toolchain/check/testdata/function/declaration/fail_modifiers.carbon index f5fdcda76741..45845f75cd51 100644 --- a/toolchain/check/testdata/function/declaration/fail_modifiers.carbon +++ b/toolchain/check/testdata/function/declaration/fail_modifiers.carbon @@ -12,86 +12,48 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/declaration/fail_modifiers.carbon -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+11]]:9: error: `protected` must appear before `default` [ModifierMustAppearBefore] -// CHECK:STDERR: default protected fn WrongOrder(); -// CHECK:STDERR: ^~~~~~~~~ -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+8]]:1: note: `default` previously appeared here [ModifierPrevious] -// CHECK:STDERR: default protected fn WrongOrder(); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+5]]:9-17: error: `protected` must appear before `default` [ModifierMustAppearBefore] +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1-7: note: `default` previously appeared here [ModifierPrevious] // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `default` not allowed; requires interface scope [ModifierRequiresInterface] -// CHECK:STDERR: default protected fn WrongOrder(); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-7: error: `default` not allowed; requires interface scope [ModifierRequiresInterface] // CHECK:STDERR: default protected fn WrongOrder(); -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+11]]:9: error: `virtual` repeated on declaration [ModifierRepeated] -// CHECK:STDERR: virtual virtual fn DuplicateVirtual() {} -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+8]]:1: note: `virtual` previously appeared here [ModifierPrevious] -// CHECK:STDERR: virtual virtual fn DuplicateVirtual() {} -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+5]]:9-15: error: `virtual` repeated on declaration [ModifierRepeated] +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1-7: note: `virtual` previously appeared here [ModifierPrevious] // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `virtual` not allowed; requires class scope [ModifierRequiresClass] -// CHECK:STDERR: virtual virtual fn DuplicateVirtual() {} -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-7: error: `virtual` not allowed; requires class scope [ModifierRequiresClass] // CHECK:STDERR: virtual virtual fn DuplicateVirtual() {} -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:9: error: `protected` not allowed on declaration with `private` [ModifierNotAllowedWith] -// CHECK:STDERR: private protected fn TwoAccess(); -// CHECK:STDERR: ^~~~~~~~~ -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: note: `private` previously appeared here [ModifierPrevious] -// CHECK:STDERR: private protected fn TwoAccess(); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+3]]:9-17: error: `protected` not allowed on declaration with `private` [ModifierNotAllowedWith] +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-7: note: `private` previously appeared here [ModifierPrevious] // CHECK:STDERR: private protected fn TwoAccess(); -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+11]]:10: error: `virtual` not allowed on declaration with `abstract` [ModifierNotAllowedWith] -// CHECK:STDERR: abstract virtual fn ModifiersConflict() {} -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+8]]:1: note: `abstract` previously appeared here [ModifierPrevious] -// CHECK:STDERR: abstract virtual fn ModifiersConflict() {} -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+5]]:10-16: error: `virtual` not allowed on declaration with `abstract` [ModifierNotAllowedWith] +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1-8: note: `abstract` previously appeared here [ModifierPrevious] // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `abstract` not allowed; requires class scope [ModifierRequiresClass] -// CHECK:STDERR: abstract virtual fn ModifiersConflict() {} -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-8: error: `abstract` not allowed; requires class scope [ModifierRequiresClass] // CHECK:STDERR: abstract virtual fn ModifiersConflict() {} -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `base` not allowed on `fn` declaration [ModifierNotAllowedOnDeclaration] -// CHECK:STDERR: base fn InvalidModifier(); -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-4: error: `base` not allowed on `fn` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: base fn InvalidModifier(); -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+18]]:9: error: `final` not allowed on declaration with `default` [ModifierNotAllowedWith] -// CHECK:STDERR: default final virtual fn ModifiersConflict2() {} -// CHECK:STDERR: ^~~~~ -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+15]]:1: note: `default` previously appeared here [ModifierPrevious] -// CHECK:STDERR: default final virtual fn ModifiersConflict2() {} -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+8]]:9-13: error: `final` not allowed on declaration with `default` [ModifierNotAllowedWith] +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:1-7: note: `default` previously appeared here [ModifierPrevious] // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+11]]:15: error: `virtual` not allowed on declaration with `default` [ModifierNotAllowedWith] -// CHECK:STDERR: default final virtual fn ModifiersConflict2() {} -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+8]]:1: note: `default` previously appeared here [ModifierPrevious] -// CHECK:STDERR: default final virtual fn ModifiersConflict2() {} -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+5]]:15-21: error: `virtual` not allowed on declaration with `default` [ModifierNotAllowedWith] +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1-7: note: `default` previously appeared here [ModifierPrevious] // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `default` not allowed; requires interface scope [ModifierRequiresInterface] -// CHECK:STDERR: default final virtual fn ModifiersConflict2() {} -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-7: error: `default` not allowed; requires interface scope [ModifierRequiresInterface] // CHECK:STDERR: default final virtual fn ModifiersConflict2() {} -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:8: error: `private` must appear before `extern` [ModifierMustAppearBefore] -// CHECK:STDERR: extern private fn ExternOrderAndConflict() {} -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: note: `extern` previously appeared here [ModifierPrevious] -// CHECK:STDERR: extern private fn ExternOrderAndConflict() {} -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+3]]:8-14: error: `private` must appear before `extern` [ModifierMustAppearBefore] +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-6: note: `extern` previously appeared here [ModifierPrevious] // CHECK:STDERR: extern private fn ExternOrderAndConflict() {} diff --git a/toolchain/check/testdata/function/declaration/fail_param_in_type.carbon b/toolchain/check/testdata/function/declaration/fail_param_in_type.carbon index c54fa3d392e0..5dd75713398c 100644 --- a/toolchain/check/testdata/function/declaration/fail_param_in_type.carbon +++ b/toolchain/check/testdata/function/declaration/fail_param_in_type.carbon @@ -12,9 +12,7 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/declaration/fail_param_in_type.carbon -// CHECK:STDERR: fail_param_in_type.carbon:[[@LINE+4]]:28: error: array bound is not a constant [InvalidArrayExpr] -// CHECK:STDERR: fn F(n: i32, a: array(i32, n)*); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_param_in_type.carbon:[[@LINE+2]]:28: error: array bound is not a constant [InvalidArrayExpr] // CHECK:STDERR: fn F(n: i32, a: array(i32, n)*); @@ -55,11 +53,11 @@ fn F(n: i32, a: array(i32, n)*); // CHECK:STDOUT: %a.patt: = wrapper_binding_pattern a, %a.param_patt [concrete = ] // CHECK:STDOUT: } { // CHECK:STDOUT: %n.param: %i32 = value_param call_param0 -// CHECK:STDOUT: %i32.loc19_9: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc17_9: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %n: %i32 = wrapper_binding n, %n.param // CHECK:STDOUT: %a.param: = value_param call_param1 -// CHECK:STDOUT: %.loc19: type = splice_block %ptr [concrete = ] { -// CHECK:STDOUT: %i32.loc19_23: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc17: type = splice_block %ptr [concrete = ] { +// CHECK:STDOUT: %i32.loc17_23: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %n.ref: %i32 = name_ref n, %n // CHECK:STDOUT: %ptr: type = ptr_type [concrete = ] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/declaration/fail_param_redecl.carbon b/toolchain/check/testdata/function/declaration/fail_param_redecl.carbon index 507ef01d6c3b..62e1ffa1a81c 100644 --- a/toolchain/check/testdata/function/declaration/fail_param_redecl.carbon +++ b/toolchain/check/testdata/function/declaration/fail_param_redecl.carbon @@ -12,12 +12,8 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/declaration/fail_param_redecl.carbon -// CHECK:STDERR: fail_param_redecl.carbon:[[@LINE+7]]:14: error: duplicate name `n` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: fn F(n: i32, n: i32); -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_param_redecl.carbon:[[@LINE+4]]:6: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: fn F(n: i32, n: i32); -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_param_redecl.carbon:[[@LINE+3]]:14: error: duplicate name `n` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_param_redecl.carbon:[[@LINE+2]]:6-11: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: fn F(n: i32, n: i32); @@ -52,19 +48,19 @@ fn F(n: i32, n: i32); // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { -// CHECK:STDOUT: %n.param_patt.loc22_7: %pattern_type.d94 = value_param_pattern [concrete = constants.%n.param_patt] -// CHECK:STDOUT: %n.patt.loc22_7: %pattern_type.d94 = wrapper_binding_pattern n, %n.param_patt.loc22_7 [concrete = constants.%n.patt] -// CHECK:STDOUT: %n.param_patt.loc22_15: %pattern_type.d94 = value_param_pattern [concrete = constants.%n.param_patt] -// CHECK:STDOUT: %n.patt.loc22_15: %pattern_type.d94 = wrapper_binding_pattern n, %n.param_patt.loc22_15 [concrete = constants.%n.patt] +// CHECK:STDOUT: %n.param_patt.loc18_7: %pattern_type.d94 = value_param_pattern [concrete = constants.%n.param_patt] +// CHECK:STDOUT: %n.patt.loc18_7: %pattern_type.d94 = wrapper_binding_pattern n, %n.param_patt.loc18_7 [concrete = constants.%n.patt] +// CHECK:STDOUT: %n.param_patt.loc18_15: %pattern_type.d94 = value_param_pattern [concrete = constants.%n.param_patt] +// CHECK:STDOUT: %n.patt.loc18_15: %pattern_type.d94 = wrapper_binding_pattern n, %n.param_patt.loc18_15 [concrete = constants.%n.patt] // CHECK:STDOUT: } { -// CHECK:STDOUT: %n.param.loc22_7: %i32 = value_param call_param0 -// CHECK:STDOUT: %i32.loc22_9: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %n.loc22_7: %i32 = wrapper_binding n, %n.param.loc22_7 -// CHECK:STDOUT: %n.param.loc22_15: %i32 = value_param call_param1 -// CHECK:STDOUT: %i32.loc22_17: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %n.loc22_15: %i32 = wrapper_binding n, %n.param.loc22_15 +// CHECK:STDOUT: %n.param.loc18_7: %i32 = value_param call_param0 +// CHECK:STDOUT: %i32.loc18_9: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %n.loc18_7: %i32 = wrapper_binding n, %n.param.loc18_7 +// CHECK:STDOUT: %n.param.loc18_15: %i32 = value_param call_param1 +// CHECK:STDOUT: %i32.loc18_17: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %n.loc18_15: %i32 = wrapper_binding n, %n.param.loc18_15 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F(%n.param.loc22_7: %i32, %n.param.loc22_15: %i32); +// CHECK:STDOUT: fn @F(%n.param.loc18_7: %i32, %n.param.loc18_15: %i32); // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/declaration/fail_redecl.carbon b/toolchain/check/testdata/function/declaration/fail_redecl.carbon index 0fea0da6d74e..cb4204bb646c 100644 --- a/toolchain/check/testdata/function/declaration/fail_redecl.carbon +++ b/toolchain/check/testdata/function/declaration/fail_redecl.carbon @@ -13,52 +13,32 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/declaration/fail_redecl.carbon fn A(); -// CHECK:STDERR: fail_redecl.carbon:[[@LINE+7]]:1: error: redeclaration of `fn A` is redundant [RedeclRedundant] -// CHECK:STDERR: fn A(); -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_redecl.carbon:[[@LINE-4]]:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: fn A(); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_redecl.carbon:[[@LINE+3]]:1-7: error: redeclaration of `fn A` is redundant [RedeclRedundant] +// CHECK:STDERR: fail_redecl.carbon:[[@LINE-2]]:1-7: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: fn A(); fn B(x: ()); -// CHECK:STDERR: fail_redecl.carbon:[[@LINE+7]]:1: error: redeclaration of `fn B` is redundant [RedeclRedundant] -// CHECK:STDERR: fn B(x: ()); -// CHECK:STDERR: ^~~~~~~~~~~~ -// CHECK:STDERR: fail_redecl.carbon:[[@LINE-4]]:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: fn B(x: ()); -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_redecl.carbon:[[@LINE+3]]:1-12: error: redeclaration of `fn B` is redundant [RedeclRedundant] +// CHECK:STDERR: fail_redecl.carbon:[[@LINE-2]]:1-12: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: fn B(x: ()); fn C(); -// CHECK:STDERR: fail_redecl.carbon:[[@LINE+7]]:1: error: redeclaration differs because of parameter count of 1 [RedeclParamCountDiffers] -// CHECK:STDERR: fn C(x: ()); -// CHECK:STDERR: ^~~~~~~~~~~~ -// CHECK:STDERR: fail_redecl.carbon:[[@LINE-4]]:1: note: previously declared with parameter count of 0 [RedeclParamCountPrevious] -// CHECK:STDERR: fn C(); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_redecl.carbon:[[@LINE+3]]:1-12: error: redeclaration differs because of parameter count of 1 [RedeclParamCountDiffers] +// CHECK:STDERR: fail_redecl.carbon:[[@LINE-2]]:1-7: note: previously declared with parameter count of 0 [RedeclParamCountPrevious] // CHECK:STDERR: fn C(x: ()); fn D() {} -// CHECK:STDERR: fail_redecl.carbon:[[@LINE+7]]:1: error: redeclaration of `fn D` is redundant [RedeclRedundant] -// CHECK:STDERR: fn D(); -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_redecl.carbon:[[@LINE-4]]:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: fn D() {} -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_redecl.carbon:[[@LINE+3]]:1-7: error: redeclaration of `fn D` is redundant [RedeclRedundant] +// CHECK:STDERR: fail_redecl.carbon:[[@LINE-2]]:1-8: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: fn D(); fn E() {} -// CHECK:STDERR: fail_redecl.carbon:[[@LINE+7]]:1: error: redefinition of `fn E` [RedeclRedef] -// CHECK:STDERR: fn E() {} -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_redecl.carbon:[[@LINE-4]]:1: note: previously defined here [RedeclPrevDef] -// CHECK:STDERR: fn E() {} -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_redecl.carbon:[[@LINE+3]]:1-8: error: redefinition of `fn E` [RedeclRedef] +// CHECK:STDERR: fail_redecl.carbon:[[@LINE-2]]:1-8: note: previously defined here [RedeclPrevDef] // CHECK:STDERR: fn E() {} @@ -75,28 +55,39 @@ fn E() {} // CHECK:STDOUT: %x.patt: %pattern_type = wrapper_binding_pattern x, %x.param_patt [concrete] // CHECK:STDOUT: %B.type: type = fn_type @B [concrete] // CHECK:STDOUT: %B: %B.type = struct_value () [concrete] -// CHECK:STDOUT: %C.type.322e3b.1: type = fn_type @C.loc35 [concrete] +// CHECK:STDOUT: %C.type.322e3b.1: type = fn_type @C.loc27 [concrete] // CHECK:STDOUT: %C.010386.1: %C.type.322e3b.1 = struct_value () [concrete] -// CHECK:STDOUT: %C.type.322e3b.2: type = fn_type @C.loc43 [concrete] +// CHECK:STDOUT: %C.type.322e3b.2: type = fn_type @C.loc31 [concrete] // CHECK:STDOUT: %C.010386.2: %C.type.322e3b.2 = struct_value () [concrete] // CHECK:STDOUT: %D.type: type = fn_type @D [concrete] // CHECK:STDOUT: %D: %D.type = struct_value () [concrete] -// CHECK:STDOUT: %E.type.53e05b.1: type = fn_type @E.loc55 [concrete] +// CHECK:STDOUT: %E.type.53e05b.1: type = fn_type @E.loc39 [concrete] // CHECK:STDOUT: %E.3f2512.1: %E.type.53e05b.1 = struct_value () [concrete] -// CHECK:STDOUT: %E.type.53e05b.2: type = fn_type @E.loc63 [concrete] +// CHECK:STDOUT: %E.type.53e05b.2: type = fn_type @E.loc43 [concrete] // CHECK:STDOUT: %E.3f2512.2: %E.type.53e05b.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { // CHECK:STDOUT: .A = %A.decl.loc15 -// CHECK:STDOUT: .B = %B.decl.loc25 -// CHECK:STDOUT: .C = %C.decl.loc35 -// CHECK:STDOUT: .D = %D.decl.loc45 -// CHECK:STDOUT: .E = %E.decl.loc55 +// CHECK:STDOUT: .B = %B.decl.loc21 +// CHECK:STDOUT: .C = %C.decl.loc27 +// CHECK:STDOUT: .D = %D.decl.loc33 +// CHECK:STDOUT: .E = %E.decl.loc39 // CHECK:STDOUT: } // CHECK:STDOUT: %A.decl.loc15: %A.type = fn_decl @A [concrete = constants.%A] {} {} -// CHECK:STDOUT: %A.decl.loc23: %A.type = fn_decl @A [concrete = constants.%A] {} {} +// CHECK:STDOUT: %A.decl.loc19: %A.type = fn_decl @A [concrete = constants.%A] {} {} +// CHECK:STDOUT: %B.decl.loc21: %B.type = fn_decl @B [concrete = constants.%B] { +// CHECK:STDOUT: %x.param_patt: %pattern_type = value_param_pattern [concrete = constants.%x.param_patt] +// CHECK:STDOUT: %x.patt: %pattern_type = wrapper_binding_pattern x, %x.param_patt [concrete = constants.%x.patt] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %x.param.loc21: %empty_tuple.type = value_param call_param0 +// CHECK:STDOUT: %.loc21_10.1: type = splice_block %.loc21_10.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc21_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc21_10.3: type = converted %.loc21_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %x.loc21: %empty_tuple.type = wrapper_binding x, %x.param.loc21 +// CHECK:STDOUT: } // CHECK:STDOUT: %B.decl.loc25: %B.type = fn_decl @B [concrete = constants.%B] { // CHECK:STDOUT: %x.param_patt: %pattern_type = value_param_pattern [concrete = constants.%x.param_patt] // CHECK:STDOUT: %x.patt: %pattern_type = wrapper_binding_pattern x, %x.param_patt [concrete = constants.%x.patt] @@ -108,54 +99,43 @@ fn E() {} // CHECK:STDOUT: } // CHECK:STDOUT: %x.loc25: %empty_tuple.type = wrapper_binding x, %x.param.loc25 // CHECK:STDOUT: } -// CHECK:STDOUT: %B.decl.loc33: %B.type = fn_decl @B [concrete = constants.%B] { -// CHECK:STDOUT: %x.param_patt: %pattern_type = value_param_pattern [concrete = constants.%x.param_patt] -// CHECK:STDOUT: %x.patt: %pattern_type = wrapper_binding_pattern x, %x.param_patt [concrete = constants.%x.patt] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %x.param.loc33: %empty_tuple.type = value_param call_param0 -// CHECK:STDOUT: %.loc33_10.1: type = splice_block %.loc33_10.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc33_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc33_10.3: type = converted %.loc33_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %x.loc33: %empty_tuple.type = wrapper_binding x, %x.param.loc33 -// CHECK:STDOUT: } -// CHECK:STDOUT: %C.decl.loc35: %C.type.322e3b.1 = fn_decl @C.loc35 [concrete = constants.%C.010386.1] {} {} -// CHECK:STDOUT: %C.decl.loc43: %C.type.322e3b.2 = fn_decl @C.loc43 [concrete = constants.%C.010386.2] { +// CHECK:STDOUT: %C.decl.loc27: %C.type.322e3b.1 = fn_decl @C.loc27 [concrete = constants.%C.010386.1] {} {} +// CHECK:STDOUT: %C.decl.loc31: %C.type.322e3b.2 = fn_decl @C.loc31 [concrete = constants.%C.010386.2] { // CHECK:STDOUT: %x.param_patt: %pattern_type = value_param_pattern [concrete = constants.%x.param_patt] // CHECK:STDOUT: %x.patt: %pattern_type = wrapper_binding_pattern x, %x.param_patt [concrete = constants.%x.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %x.param: %empty_tuple.type = value_param call_param0 -// CHECK:STDOUT: %.loc43_10.1: type = splice_block %.loc43_10.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc43_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc43_10.3: type = converted %.loc43_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc31_10.1: type = splice_block %.loc31_10.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc31_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc31_10.3: type = converted %.loc31_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %x: %empty_tuple.type = wrapper_binding x, %x.param // CHECK:STDOUT: } -// CHECK:STDOUT: %D.decl.loc45: %D.type = fn_decl @D [concrete = constants.%D] {} {} -// CHECK:STDOUT: %D.decl.loc53: %D.type = fn_decl @D [concrete = constants.%D] {} {} -// CHECK:STDOUT: %E.decl.loc55: %E.type.53e05b.1 = fn_decl @E.loc55 [concrete = constants.%E.3f2512.1] {} {} -// CHECK:STDOUT: %E.decl.loc63: %E.type.53e05b.2 = fn_decl @E.loc63 [concrete = constants.%E.3f2512.2] {} {} +// CHECK:STDOUT: %D.decl.loc33: %D.type = fn_decl @D [concrete = constants.%D] {} {} +// CHECK:STDOUT: %D.decl.loc37: %D.type = fn_decl @D [concrete = constants.%D] {} {} +// CHECK:STDOUT: %E.decl.loc39: %E.type.53e05b.1 = fn_decl @E.loc39 [concrete = constants.%E.3f2512.1] {} {} +// CHECK:STDOUT: %E.decl.loc43: %E.type.53e05b.2 = fn_decl @E.loc43 [concrete = constants.%E.3f2512.2] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A(); // CHECK:STDOUT: -// CHECK:STDOUT: fn @B(%x.param.loc25: %empty_tuple.type); +// CHECK:STDOUT: fn @B(%x.param.loc21: %empty_tuple.type); // CHECK:STDOUT: -// CHECK:STDOUT: fn @C.loc35(); +// CHECK:STDOUT: fn @C.loc27(); // CHECK:STDOUT: -// CHECK:STDOUT: fn @C.loc43(%x.param: %empty_tuple.type); +// CHECK:STDOUT: fn @C.loc31(%x.param: %empty_tuple.type); // CHECK:STDOUT: // CHECK:STDOUT: fn @D() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @E.loc55() { +// CHECK:STDOUT: fn @E.loc39() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @E.loc63() { +// CHECK:STDOUT: fn @E.loc43() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/declaration/fail_todo_no_params.carbon b/toolchain/check/testdata/function/declaration/fail_todo_no_params.carbon index 0b2bcc8460f3..4892a016ed32 100644 --- a/toolchain/check/testdata/function/declaration/fail_todo_no_params.carbon +++ b/toolchain/check/testdata/function/declaration/fail_todo_no_params.carbon @@ -15,18 +15,14 @@ // --- fail_no_body.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_no_body.carbon:[[@LINE+4]]:1: error: semantics TODO: `function with positional parameters` [SemanticsTodo] -// CHECK:STDERR: fn A; -// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: fail_no_body.carbon:[[@LINE+2]]:1-5: error: semantics TODO: `function with positional parameters` [SemanticsTodo] // CHECK:STDERR: fn A; // --- fail_todo_brace_body.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_todo_brace_body.carbon:[[@LINE+4]]:1: error: semantics TODO: `function with positional parameters` [SemanticsTodo] -// CHECK:STDERR: fn A { -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_todo_brace_body.carbon:[[@LINE+2]]:1-6: error: semantics TODO: `function with positional parameters` [SemanticsTodo] // CHECK:STDERR: fn A { } @@ -34,18 +30,14 @@ fn A { // --- fail_todo_return_type.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_todo_return_type.carbon:[[@LINE+4]]:1: error: semantics TODO: `function with positional parameters` [SemanticsTodo] -// CHECK:STDERR: fn A -> (); -// CHECK:STDERR: ^~~~~~~~~~~ +// CHECK:STDERR: fail_todo_return_type.carbon:[[@LINE+2]]:1-11: error: semantics TODO: `function with positional parameters` [SemanticsTodo] // CHECK:STDERR: fn A -> (); // --- fail_todo_implicit_only.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_todo_implicit_only.carbon:[[@LINE+4]]:1: error: semantics TODO: `function with positional parameters` [SemanticsTodo] -// CHECK:STDERR: fn A[] -> (); -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_implicit_only.carbon:[[@LINE+2]]:1-13: error: semantics TODO: `function with positional parameters` [SemanticsTodo] // CHECK:STDERR: fn A[] -> (); @@ -53,13 +45,9 @@ fn A[] -> (); // TODO: We don't have parsing support for this yet. library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_todo_arrow_body.carbon:[[@LINE+8]]:1: error: semantics TODO: `function with positional parameters` [SemanticsTodo] -// CHECK:STDERR: fn A => 0; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_todo_arrow_body.carbon:[[@LINE+4]]:1-7: error: semantics TODO: `function with positional parameters` [SemanticsTodo] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_arrow_body.carbon:[[@LINE+4]]:1: error: semantics TODO: `HandleFunctionTerseDefinition` [SemanticsTodo] -// CHECK:STDERR: fn A => 0; -// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: fail_todo_arrow_body.carbon:[[@LINE+2]]:1-10: error: semantics TODO: `HandleFunctionTerseDefinition` [SemanticsTodo] // CHECK:STDERR: fn A => 0; @@ -67,13 +55,9 @@ fn A => 0; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_invalid_file_generic_regression_test.carbon:[[@LINE+8]]:13: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] -// CHECK:STDERR: var generic x: () = (); -// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: fail_invalid_file_generic_regression_test.carbon:[[@LINE+4]]:13-17: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: -// CHECK:STDERR: fail_invalid_file_generic_regression_test.carbon:[[@LINE+4]]:19: error: found generic binding inside `var` pattern [NonRegularBindingInVarDecl] -// CHECK:STDERR: var generic x: () = (); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_invalid_file_generic_regression_test.carbon:[[@LINE+2]]:19: error: found generic binding inside `var` pattern [NonRegularBindingInVarDecl] // CHECK:STDERR: var generic x: () = (); @@ -138,11 +122,11 @@ fn A { // CHECK:STDOUT: } // CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [concrete = constants.%A] { // CHECK:STDOUT: %return.param_patt: %pattern_type = out_param_pattern [concrete = constants.%return.param_patt] -// CHECK:STDOUT: %return.patt: %pattern_type = return_slot_pattern %return.param_patt, %.loc7_10.2 [concrete = constants.%return.patt] +// CHECK:STDOUT: %return.patt: %pattern_type = return_slot_pattern %return.param_patt, %.loc5_10.2 [concrete = constants.%return.patt] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc7_10.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc7_10.2: type = converted %.loc7_10.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc7_10.3: Core.Form = init_form %.loc7_10.2 [concrete = constants.%.262] +// CHECK:STDOUT: %.loc5_10.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc5_10.2: type = converted %.loc5_10.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc5_10.3: Core.Form = init_form %.loc5_10.2 [concrete = constants.%.262] // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0 // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param // CHECK:STDOUT: } @@ -170,11 +154,11 @@ fn A { // CHECK:STDOUT: } // CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [concrete = constants.%A] { // CHECK:STDOUT: %return.param_patt: %pattern_type = out_param_pattern [concrete = constants.%return.param_patt] -// CHECK:STDOUT: %return.patt: %pattern_type = return_slot_pattern %return.param_patt, %.loc7_12.2 [concrete = constants.%return.patt] +// CHECK:STDOUT: %return.patt: %pattern_type = return_slot_pattern %return.param_patt, %.loc5_12.2 [concrete = constants.%return.patt] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc7_12.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc7_12.2: type = converted %.loc7_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc7_12.3: Core.Form = init_form %.loc7_12.2 [concrete = constants.%.262] +// CHECK:STDOUT: %.loc5_12.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc5_12.2: type = converted %.loc5_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc5_12.3: Core.Form = init_form %.loc5_12.2 [concrete = constants.%.262] // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0 // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/declaration/implicit_import.carbon b/toolchain/check/testdata/function/declaration/implicit_import.carbon index 6aeb44d4ffcf..8d68f310d561 100644 --- a/toolchain/check/testdata/function/declaration/implicit_import.carbon +++ b/toolchain/check/testdata/function/declaration/implicit_import.carbon @@ -34,17 +34,11 @@ extern fn A(); impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_extern_api.impl.carbon:[[@LINE+12]]:1: error: redeclarations of `fn A` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: fn A(); -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_extern_api.impl.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: extern_api.carbon:4:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: extern fn A(); -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_extern_api.impl.carbon:[[@LINE+6]]:1-7: error: redeclarations of `fn A` must match use of `extern` [RedeclExternMismatch] +// CHECK:STDERR: imported from: fail_extern_api.impl.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: extern_api.carbon:4:1-14: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: -// CHECK:STDERR: fail_extern_api.impl.carbon:[[@LINE+4]]:1: error: no definition found for declaration in impl file [MissingDefinitionInImpl] -// CHECK:STDERR: fn A(); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_extern_api.impl.carbon:[[@LINE+2]]:1-7: error: no definition found for declaration in impl file [MissingDefinitionInImpl] // CHECK:STDERR: fn A(); @@ -58,13 +52,9 @@ fn A(); impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_extern_impl.impl.carbon:[[@LINE+8]]:1: error: redeclarations of `fn A` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: extern fn A(); -// CHECK:STDERR: ^~~~~~~~~~~~~~ -// CHECK:STDERR: fail_extern_impl.impl.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: extern_impl.carbon:4:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: fn A(); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_extern_impl.impl.carbon:[[@LINE+4]]:1-14: error: redeclarations of `fn A` must match use of `extern` [RedeclExternMismatch] +// CHECK:STDERR: imported from: fail_extern_impl.impl.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: extern_impl.carbon:4:1-7: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: extern fn A(); diff --git a/toolchain/check/testdata/function/declaration/import.carbon b/toolchain/check/testdata/function/declaration/import.carbon index a68337040658..b3d8dd99e2f1 100644 --- a/toolchain/check/testdata/function/declaration/import.carbon +++ b/toolchain/check/testdata/function/declaration/import.carbon @@ -62,49 +62,29 @@ library "[[@TEST_NAME]]"; import library "api"; -// CHECK:STDERR: fail_redecl_api.carbon:[[@LINE+8]]:1: error: redeclarations of `fn A` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: extern fn A(); -// CHECK:STDERR: ^~~~~~~~~~~~~~ -// CHECK:STDERR: fail_redecl_api.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: api.carbon:4:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: fn A(); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_redecl_api.carbon:[[@LINE+4]]:1-14: error: redeclarations of `fn A` must match use of `extern` [RedeclExternMismatch] +// CHECK:STDERR: imported from: fail_redecl_api.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: api.carbon:4:1-7: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: extern fn A(); -// CHECK:STDERR: fail_redecl_api.carbon:[[@LINE+8]]:1: error: redeclarations of `fn B` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: extern fn B(b: i32) -> i32; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_redecl_api.carbon:[[@LINE-14]]:1: in import [InImport] -// CHECK:STDERR: api.carbon:5:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: fn B(b: i32) -> i32; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_redecl_api.carbon:[[@LINE+4]]:1-27: error: redeclarations of `fn B` must match use of `extern` [RedeclExternMismatch] +// CHECK:STDERR: imported from: fail_redecl_api.carbon:[[@LINE-8]]:1 [InImport] +// CHECK:STDERR: api.carbon:5:1-20: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: extern fn B(b: i32) -> i32; -// CHECK:STDERR: fail_redecl_api.carbon:[[@LINE+8]]:1: error: redeclarations of `fn C` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: extern fn C(c: (i32,)) -> {.c: i32}; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_redecl_api.carbon:[[@LINE-23]]:1: in import [InImport] -// CHECK:STDERR: api.carbon:6:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: fn C(c: (i32,)) -> {.c: i32}; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_redecl_api.carbon:[[@LINE+4]]:1-36: error: redeclarations of `fn C` must match use of `extern` [RedeclExternMismatch] +// CHECK:STDERR: imported from: fail_redecl_api.carbon:[[@LINE-13]]:1 [InImport] +// CHECK:STDERR: api.carbon:6:1-29: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: extern fn C(c: (i32,)) -> {.c: i32}; -// CHECK:STDERR: fail_redecl_api.carbon:[[@LINE+8]]:1: error: redeclaration of `fn D` is redundant [RedeclRedundant] -// CHECK:STDERR: extern fn D(); -// CHECK:STDERR: ^~~~~~~~~~~~~~ -// CHECK:STDERR: fail_redecl_api.carbon:[[@LINE-32]]:1: in import [InImport] -// CHECK:STDERR: api.carbon:7:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: extern fn D(); -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_redecl_api.carbon:[[@LINE+4]]:1-14: error: redeclaration of `fn D` is redundant [RedeclRedundant] +// CHECK:STDERR: imported from: fail_redecl_api.carbon:[[@LINE-18]]:1 [InImport] +// CHECK:STDERR: api.carbon:7:1-14: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: extern fn D(); -// CHECK:STDERR: fail_redecl_api.carbon:[[@LINE+8]]:1: error: redeclarations of `fn E` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: extern fn NS.E(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_redecl_api.carbon:[[@LINE-41]]:1: in import [InImport] -// CHECK:STDERR: api.carbon:10:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: fn NS.E(); -// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: fail_redecl_api.carbon:[[@LINE+4]]:1-17: error: redeclarations of `fn E` must match use of `extern` [RedeclExternMismatch] +// CHECK:STDERR: imported from: fail_redecl_api.carbon:[[@LINE-23]]:1 [InImport] +// CHECK:STDERR: api.carbon:10:1-10: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: extern fn NS.E(); @@ -136,50 +116,30 @@ var e: () = NS.E(); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_merge.carbon:[[@LINE+45]]:1: in import [InImport] -// CHECK:STDERR: extern_api.carbon:4:1: error: duplicate name `A` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: extern library "redecl_extern_api" fn A(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_merge.carbon:[[@LINE+41]]:1: in import [InImport] -// CHECK:STDERR: api.carbon:4:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: fn A(); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: imported from: fail_merge.carbon:[[@LINE+25]]:1 [InImport] +// CHECK:STDERR: extern_api.carbon:4:1-42: error: duplicate name `A` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_merge.carbon:[[@LINE+23]]:1 [InImport] +// CHECK:STDERR: api.carbon:4:1-7: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: -// CHECK:STDERR: fail_merge.carbon:[[@LINE+36]]:1: in import [InImport] -// CHECK:STDERR: extern_api.carbon:5:1: error: duplicate name `B` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: extern library "redecl_extern_api" fn B(b: i32) -> i32; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_merge.carbon:[[@LINE+32]]:1: in import [InImport] -// CHECK:STDERR: api.carbon:5:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: fn B(b: i32) -> i32; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: imported from: fail_merge.carbon:[[@LINE+20]]:1 [InImport] +// CHECK:STDERR: extern_api.carbon:5:1-55: error: duplicate name `B` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_merge.carbon:[[@LINE+18]]:1 [InImport] +// CHECK:STDERR: api.carbon:5:1-20: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: -// CHECK:STDERR: fail_merge.carbon:[[@LINE+27]]:1: in import [InImport] -// CHECK:STDERR: extern_api.carbon:6:1: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: extern library "redecl_extern_api" fn C(c: (i32,)) -> {.c: i32}; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_merge.carbon:[[@LINE+23]]:1: in import [InImport] -// CHECK:STDERR: api.carbon:6:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: fn C(c: (i32,)) -> {.c: i32}; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: imported from: fail_merge.carbon:[[@LINE+15]]:1 [InImport] +// CHECK:STDERR: extern_api.carbon:6:1-64: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_merge.carbon:[[@LINE+13]]:1 [InImport] +// CHECK:STDERR: api.carbon:6:1-29: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: -// CHECK:STDERR: fail_merge.carbon:[[@LINE+18]]:1: in import [InImport] -// CHECK:STDERR: extern_api.carbon:7:1: error: duplicate name `D` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: extern library "redecl_extern_api" fn D(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_merge.carbon:[[@LINE+14]]:1: in import [InImport] -// CHECK:STDERR: api.carbon:7:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: extern fn D(); -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: imported from: fail_merge.carbon:[[@LINE+10]]:1 [InImport] +// CHECK:STDERR: extern_api.carbon:7:1-42: error: duplicate name `D` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_merge.carbon:[[@LINE+8]]:1 [InImport] +// CHECK:STDERR: api.carbon:7:1-14: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: -// CHECK:STDERR: fail_merge.carbon:[[@LINE+9]]:1: in import [InImport] -// CHECK:STDERR: extern_api.carbon:10:1: error: duplicate name `E` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: extern library "redecl_extern_api" fn NS.E(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_merge.carbon:[[@LINE+5]]:1: in import [InImport] -// CHECK:STDERR: api.carbon:10:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: fn NS.E(); -// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: imported from: fail_merge.carbon:[[@LINE+5]]:1 [InImport] +// CHECK:STDERR: extern_api.carbon:10:1-45: error: duplicate name `E` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_merge.carbon:[[@LINE+3]]:1 [InImport] +// CHECK:STDERR: api.carbon:10:1-10: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: import library "api"; import library "extern_api"; @@ -194,50 +154,30 @@ var e: () = NS.E(); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+45]]:1: in import [InImport] -// CHECK:STDERR: api.carbon:4:1: error: duplicate name `A` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: fn A(); -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+41]]:1: in import [InImport] -// CHECK:STDERR: extern_api.carbon:4:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: extern library "redecl_extern_api" fn A(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: imported from: fail_merge_reverse.carbon:[[@LINE+25]]:1 [InImport] +// CHECK:STDERR: api.carbon:4:1-7: error: duplicate name `A` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_merge_reverse.carbon:[[@LINE+23]]:1 [InImport] +// CHECK:STDERR: extern_api.carbon:4:1-42: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: -// CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+36]]:1: in import [InImport] -// CHECK:STDERR: api.carbon:5:1: error: duplicate name `B` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: fn B(b: i32) -> i32; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+32]]:1: in import [InImport] -// CHECK:STDERR: extern_api.carbon:5:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: extern library "redecl_extern_api" fn B(b: i32) -> i32; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: imported from: fail_merge_reverse.carbon:[[@LINE+20]]:1 [InImport] +// CHECK:STDERR: api.carbon:5:1-20: error: duplicate name `B` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_merge_reverse.carbon:[[@LINE+18]]:1 [InImport] +// CHECK:STDERR: extern_api.carbon:5:1-55: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: -// CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+27]]:1: in import [InImport] -// CHECK:STDERR: api.carbon:6:1: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: fn C(c: (i32,)) -> {.c: i32}; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+23]]:1: in import [InImport] -// CHECK:STDERR: extern_api.carbon:6:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: extern library "redecl_extern_api" fn C(c: (i32,)) -> {.c: i32}; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: imported from: fail_merge_reverse.carbon:[[@LINE+15]]:1 [InImport] +// CHECK:STDERR: api.carbon:6:1-29: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_merge_reverse.carbon:[[@LINE+13]]:1 [InImport] +// CHECK:STDERR: extern_api.carbon:6:1-64: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: -// CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+18]]:1: in import [InImport] -// CHECK:STDERR: api.carbon:7:1: error: duplicate name `D` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: extern fn D(); -// CHECK:STDERR: ^~~~~~~~~~~~~~ -// CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+14]]:1: in import [InImport] -// CHECK:STDERR: extern_api.carbon:7:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: extern library "redecl_extern_api" fn D(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: imported from: fail_merge_reverse.carbon:[[@LINE+10]]:1 [InImport] +// CHECK:STDERR: api.carbon:7:1-14: error: duplicate name `D` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_merge_reverse.carbon:[[@LINE+8]]:1 [InImport] +// CHECK:STDERR: extern_api.carbon:7:1-42: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: -// CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+9]]:1: in import [InImport] -// CHECK:STDERR: api.carbon:10:1: error: duplicate name `E` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: fn NS.E(); -// CHECK:STDERR: ^~~~~~~~~~ -// CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+5]]:1: in import [InImport] -// CHECK:STDERR: extern_api.carbon:10:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: extern library "redecl_extern_api" fn NS.E(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: imported from: fail_merge_reverse.carbon:[[@LINE+5]]:1 [InImport] +// CHECK:STDERR: api.carbon:10:1-10: error: duplicate name `E` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_merge_reverse.carbon:[[@LINE+3]]:1 [InImport] +// CHECK:STDERR: extern_api.carbon:10:1-45: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: import library "extern_api"; import library "api"; @@ -764,23 +704,23 @@ import library "extern_api"; // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [concrete = constants.%A] {} {} // CHECK:STDOUT: %B.decl: %B.type = fn_decl @B [concrete = constants.%B] {} { -// CHECK:STDOUT: %i32.loc23_24: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc23: Core.Form = init_form %i32.loc23_24 [concrete = constants.%.0b3] +// CHECK:STDOUT: %i32.loc15_24: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc15: Core.Form = init_form %i32.loc15_24 [concrete = constants.%.0b3] // CHECK:STDOUT: %b.param: %i32 = value_param call_param0 -// CHECK:STDOUT: %i32.loc23_16: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc15_16: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %b: %i32 = wrapper_binding b, %b.param // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param1 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %C.decl: %C.type = fn_decl @C [concrete = constants.%C] {} { -// CHECK:STDOUT: %i32.loc32_32: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc20_32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %i32} [concrete = constants.%struct_type.c] -// CHECK:STDOUT: %.loc32_35: Core.Form = init_form %struct_type.c [concrete = constants.%.fc2] +// CHECK:STDOUT: %.loc20_35: Core.Form = init_form %struct_type.c [concrete = constants.%.fc2] // CHECK:STDOUT: %c.param: %tuple.type.294 = value_param call_param0 -// CHECK:STDOUT: %.loc32_21.1: type = splice_block %.loc32_21.3 [concrete = constants.%tuple.type.294] { -// CHECK:STDOUT: %i32.loc32_17: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc32_21.2: %tuple.type.135 = tuple_literal (%i32.loc32_17) [concrete = constants.%tuple.f7a] -// CHECK:STDOUT: %.loc32_21.3: type = converted %.loc32_21.2, constants.%tuple.type.294 [concrete = constants.%tuple.type.294] +// CHECK:STDOUT: %.loc20_21.1: type = splice_block %.loc20_21.3 [concrete = constants.%tuple.type.294] { +// CHECK:STDOUT: %i32.loc20_17: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc20_21.2: %tuple.type.135 = tuple_literal (%i32.loc20_17) [concrete = constants.%tuple.f7a] +// CHECK:STDOUT: %.loc20_21.3: type = converted %.loc20_21.2, constants.%tuple.type.294 [concrete = constants.%tuple.type.294] // CHECK:STDOUT: } // CHECK:STDOUT: %c: %tuple.type.294 = wrapper_binding c, %c.param // CHECK:STDOUT: %return.param: ref %struct_type.c = out_param call_param1 @@ -789,9 +729,9 @@ import library "extern_api"; // CHECK:STDOUT: %D.decl: %D.type = fn_decl @D [concrete = constants.%D] {} {} // CHECK:STDOUT: %E.decl: %E.type = fn_decl @E [concrete = constants.%E] {} {} // CHECK:STDOUT: %a.var: ref %empty_tuple.type = var_storage %a.var_patt [concrete] -// CHECK:STDOUT: %.loc52_9.1: type = splice_block %.loc52_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc52_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc52_9.3: type = converted %.loc52_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc32_9.1: type = splice_block %.loc32_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc32_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc32_9.3: type = converted %.loc32_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %a: ref %empty_tuple.type = wrapper_binding a, %a.var [concrete = %a.var] // CHECK:STDOUT: name_binding_decl { @@ -799,15 +739,15 @@ import library "extern_api"; // CHECK:STDOUT: %a.var_patt: %pattern_type.cb1 = var_pattern %a.patt [concrete = constants.%a.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %b.var: ref %i32 = var_storage %b.var_patt [concrete] -// CHECK:STDOUT: %i32.loc53: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc33: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %b: ref %i32 = wrapper_binding b, %b.var [concrete = %b.var] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %b.patt: %pattern_type.d94 = ref_binding_pattern b [concrete = constants.%b.patt.920] // CHECK:STDOUT: %b.var_patt: %pattern_type.d94 = var_pattern %b.patt [concrete = constants.%b.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %c.var: ref %struct_type.c = var_storage %c.var_patt [concrete] -// CHECK:STDOUT: %.loc54: type = splice_block %struct_type.c [concrete = constants.%struct_type.c] { -// CHECK:STDOUT: %i32.loc54: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc34: type = splice_block %struct_type.c [concrete = constants.%struct_type.c] { +// CHECK:STDOUT: %i32.loc34: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %i32} [concrete = constants.%struct_type.c] // CHECK:STDOUT: } // CHECK:STDOUT: %c: ref %struct_type.c = wrapper_binding c, %c.var [concrete = %c.var] @@ -816,9 +756,9 @@ import library "extern_api"; // CHECK:STDOUT: %c.var_patt: %pattern_type.51a = var_pattern %c.patt [concrete = constants.%c.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %d.var: ref %empty_tuple.type = var_storage %d.var_patt [concrete] -// CHECK:STDOUT: %.loc55_9.1: type = splice_block %.loc55_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc55_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc55_9.3: type = converted %.loc55_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc35_9.1: type = splice_block %.loc35_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc35_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc35_9.3: type = converted %.loc35_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %d: ref %empty_tuple.type = wrapper_binding d, %d.var [concrete = %d.var] // CHECK:STDOUT: name_binding_decl { @@ -826,9 +766,9 @@ import library "extern_api"; // CHECK:STDOUT: %d.var_patt: %pattern_type.cb1 = var_pattern %d.patt [concrete = constants.%d.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %e.var: ref %empty_tuple.type = var_storage %e.var_patt [concrete] -// CHECK:STDOUT: %.loc56_9.1: type = splice_block %.loc56_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc56_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc56_9.3: type = converted %.loc56_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc36_9.1: type = splice_block %.loc36_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc36_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc36_9.3: type = converted %.loc36_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %e: ref %empty_tuple.type = wrapper_binding e, %e.var [concrete = %e.var] // CHECK:STDOUT: name_binding_decl { @@ -853,29 +793,29 @@ import library "extern_api"; // CHECK:STDOUT: %A.call: init %empty_tuple.type = call %A.ref() // CHECK:STDOUT: assign file.%a.var, %A.call // CHECK:STDOUT: %B.ref: %B.type = name_ref B, file.%B.decl [concrete = constants.%B] -// CHECK:STDOUT: %int_1.loc53: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %impl.elem0.loc53: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc53_16.1: = bound_method %int_1.loc53, %impl.elem0.loc53 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc53: = specific_function %impl.elem0.loc53, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc53_16.2: = bound_method %int_1.loc53, %specific_fn.loc53 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc53: init %i32 = call %bound_method.loc53_16.2(%int_1.loc53) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc53_16.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc53 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc53_16.2: %i32 = converted %int_1.loc53, %.loc53_16.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %B.call: init %i32 = call %B.ref(%.loc53_16.2) +// CHECK:STDOUT: %int_1.loc33: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %impl.elem0.loc33: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc33_16.1: = bound_method %int_1.loc33, %impl.elem0.loc33 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc33: = specific_function %impl.elem0.loc33, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc33_16.2: = bound_method %int_1.loc33, %specific_fn.loc33 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc33: init %i32 = call %bound_method.loc33_16.2(%int_1.loc33) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc33_16.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc33 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc33_16.2: %i32 = converted %int_1.loc33, %.loc33_16.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %B.call: init %i32 = call %B.ref(%.loc33_16.2) // CHECK:STDOUT: assign file.%b.var, %B.call // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %int_1.loc54: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %.loc54_25.1: %tuple.type.985 = tuple_literal (%int_1.loc54) [concrete = constants.%tuple.378] -// CHECK:STDOUT: %impl.elem0.loc54: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc54_25.1: = bound_method %int_1.loc54, %impl.elem0.loc54 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc54: = specific_function %impl.elem0.loc54, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc54_25.2: = bound_method %int_1.loc54, %specific_fn.loc54 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc54: init %i32 = call %bound_method.loc54_25.2(%int_1.loc54) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc54_25.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc54 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc54_25.3: %i32 = converted %int_1.loc54, %.loc54_25.2 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %tuple: %tuple.type.294 = tuple_value (%.loc54_25.3) [concrete = constants.%tuple.f6b] -// CHECK:STDOUT: %.loc54_25.4: %tuple.type.294 = converted %.loc54_25.1, %tuple [concrete = constants.%tuple.f6b] -// CHECK:STDOUT: %C.call: init %struct_type.c = call %C.ref(%.loc54_25.4) +// CHECK:STDOUT: %int_1.loc34: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %.loc34_25.1: %tuple.type.985 = tuple_literal (%int_1.loc34) [concrete = constants.%tuple.378] +// CHECK:STDOUT: %impl.elem0.loc34: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc34_25.1: = bound_method %int_1.loc34, %impl.elem0.loc34 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc34: = specific_function %impl.elem0.loc34, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc34_25.2: = bound_method %int_1.loc34, %specific_fn.loc34 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc34: init %i32 = call %bound_method.loc34_25.2(%int_1.loc34) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc34_25.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc34 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc34_25.3: %i32 = converted %int_1.loc34, %.loc34_25.2 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %tuple: %tuple.type.294 = tuple_value (%.loc34_25.3) [concrete = constants.%tuple.f6b] +// CHECK:STDOUT: %.loc34_25.4: %tuple.type.294 = converted %.loc34_25.1, %tuple [concrete = constants.%tuple.f6b] +// CHECK:STDOUT: %C.call: init %struct_type.c = call %C.ref(%.loc34_25.4) // CHECK:STDOUT: assign file.%c.var, %C.call // CHECK:STDOUT: %D.ref: %D.type = name_ref D, file.%D.decl [concrete = constants.%D] // CHECK:STDOUT: %D.call: init %empty_tuple.type = call %D.ref() @@ -1202,9 +1142,9 @@ import library "extern_api"; // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %a.var: ref %empty_tuple.type = var_storage %a.var_patt [concrete] -// CHECK:STDOUT: %.loc52_9.1: type = splice_block %.loc52_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc52_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc52_9.3: type = converted %.loc52_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc32_9.1: type = splice_block %.loc32_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc32_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc32_9.3: type = converted %.loc32_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %a: ref %empty_tuple.type = wrapper_binding a, %a.var [concrete = %a.var] // CHECK:STDOUT: name_binding_decl { @@ -1212,15 +1152,15 @@ import library "extern_api"; // CHECK:STDOUT: %a.var_patt: %pattern_type.cb1 = var_pattern %a.patt [concrete = constants.%a.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %b.var: ref %i32 = var_storage %b.var_patt [concrete] -// CHECK:STDOUT: %i32.loc53: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc33: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %b: ref %i32 = wrapper_binding b, %b.var [concrete = %b.var] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %b.patt: %pattern_type.d94 = ref_binding_pattern b [concrete = constants.%b.patt.920] // CHECK:STDOUT: %b.var_patt: %pattern_type.d94 = var_pattern %b.patt [concrete = constants.%b.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %c.var: ref %struct_type.c = var_storage %c.var_patt [concrete] -// CHECK:STDOUT: %.loc54: type = splice_block %struct_type.c [concrete = constants.%struct_type.c] { -// CHECK:STDOUT: %i32.loc54: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc34: type = splice_block %struct_type.c [concrete = constants.%struct_type.c] { +// CHECK:STDOUT: %i32.loc34: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %i32} [concrete = constants.%struct_type.c] // CHECK:STDOUT: } // CHECK:STDOUT: %c: ref %struct_type.c = wrapper_binding c, %c.var [concrete = %c.var] @@ -1229,9 +1169,9 @@ import library "extern_api"; // CHECK:STDOUT: %c.var_patt: %pattern_type.51a = var_pattern %c.patt [concrete = constants.%c.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %d.var: ref %empty_tuple.type = var_storage %d.var_patt [concrete] -// CHECK:STDOUT: %.loc55_9.1: type = splice_block %.loc55_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc55_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc55_9.3: type = converted %.loc55_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc35_9.1: type = splice_block %.loc35_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc35_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc35_9.3: type = converted %.loc35_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %d: ref %empty_tuple.type = wrapper_binding d, %d.var [concrete = %d.var] // CHECK:STDOUT: name_binding_decl { @@ -1239,9 +1179,9 @@ import library "extern_api"; // CHECK:STDOUT: %d.var_patt: %pattern_type.cb1 = var_pattern %d.patt [concrete = constants.%d.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %e.var: ref %empty_tuple.type = var_storage %e.var_patt [concrete] -// CHECK:STDOUT: %.loc56_9.1: type = splice_block %.loc56_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc56_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc56_9.3: type = converted %.loc56_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc36_9.1: type = splice_block %.loc36_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc36_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc36_9.3: type = converted %.loc36_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %e: ref %empty_tuple.type = wrapper_binding e, %e.var [concrete = %e.var] // CHECK:STDOUT: name_binding_decl { @@ -1266,29 +1206,29 @@ import library "extern_api"; // CHECK:STDOUT: %A.call: init %empty_tuple.type = call %A.ref() // CHECK:STDOUT: assign file.%a.var, %A.call // CHECK:STDOUT: %B.ref: %B.type = name_ref B, imports.%Main.B [concrete = constants.%B] -// CHECK:STDOUT: %int_1.loc53: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %impl.elem0.loc53: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc53_16.1: = bound_method %int_1.loc53, %impl.elem0.loc53 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc53: = specific_function %impl.elem0.loc53, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc53_16.2: = bound_method %int_1.loc53, %specific_fn.loc53 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc53: init %i32 = call %bound_method.loc53_16.2(%int_1.loc53) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc53_16.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc53 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc53_16.2: %i32 = converted %int_1.loc53, %.loc53_16.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %B.call: init %i32 = call %B.ref(%.loc53_16.2) +// CHECK:STDOUT: %int_1.loc33: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %impl.elem0.loc33: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc33_16.1: = bound_method %int_1.loc33, %impl.elem0.loc33 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc33: = specific_function %impl.elem0.loc33, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc33_16.2: = bound_method %int_1.loc33, %specific_fn.loc33 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc33: init %i32 = call %bound_method.loc33_16.2(%int_1.loc33) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc33_16.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc33 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc33_16.2: %i32 = converted %int_1.loc33, %.loc33_16.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %B.call: init %i32 = call %B.ref(%.loc33_16.2) // CHECK:STDOUT: assign file.%b.var, %B.call // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%Main.C [concrete = constants.%C] -// CHECK:STDOUT: %int_1.loc54: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %.loc54_25.1: %tuple.type.985 = tuple_literal (%int_1.loc54) [concrete = constants.%tuple.378] -// CHECK:STDOUT: %impl.elem0.loc54: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc54_25.1: = bound_method %int_1.loc54, %impl.elem0.loc54 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc54: = specific_function %impl.elem0.loc54, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc54_25.2: = bound_method %int_1.loc54, %specific_fn.loc54 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc54: init %i32 = call %bound_method.loc54_25.2(%int_1.loc54) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc54_25.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc54 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc54_25.3: %i32 = converted %int_1.loc54, %.loc54_25.2 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %tuple: %tuple.type.294 = tuple_value (%.loc54_25.3) [concrete = constants.%tuple.f6b] -// CHECK:STDOUT: %.loc54_25.4: %tuple.type.294 = converted %.loc54_25.1, %tuple [concrete = constants.%tuple.f6b] -// CHECK:STDOUT: %C.call: init %struct_type.c = call %C.ref(%.loc54_25.4) +// CHECK:STDOUT: %int_1.loc34: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %.loc34_25.1: %tuple.type.985 = tuple_literal (%int_1.loc34) [concrete = constants.%tuple.378] +// CHECK:STDOUT: %impl.elem0.loc34: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc34_25.1: = bound_method %int_1.loc34, %impl.elem0.loc34 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc34: = specific_function %impl.elem0.loc34, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc34_25.2: = bound_method %int_1.loc34, %specific_fn.loc34 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc34: init %i32 = call %bound_method.loc34_25.2(%int_1.loc34) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc34_25.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc34 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc34_25.3: %i32 = converted %int_1.loc34, %.loc34_25.2 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %tuple: %tuple.type.294 = tuple_value (%.loc34_25.3) [concrete = constants.%tuple.f6b] +// CHECK:STDOUT: %.loc34_25.4: %tuple.type.294 = converted %.loc34_25.1, %tuple [concrete = constants.%tuple.f6b] +// CHECK:STDOUT: %C.call: init %struct_type.c = call %C.ref(%.loc34_25.4) // CHECK:STDOUT: assign file.%c.var, %C.call // CHECK:STDOUT: %D.ref: %D.type = name_ref D, imports.%Main.D [concrete = constants.%D] // CHECK:STDOUT: %D.call: init %empty_tuple.type = call %D.ref() @@ -1396,9 +1336,9 @@ import library "extern_api"; // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %a.var: ref %empty_tuple.type = var_storage %a.var_patt [concrete] -// CHECK:STDOUT: %.loc52_9.1: type = splice_block %.loc52_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc52_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc52_9.3: type = converted %.loc52_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc32_9.1: type = splice_block %.loc32_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc32_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc32_9.3: type = converted %.loc32_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %a: ref %empty_tuple.type = wrapper_binding a, %a.var [concrete = %a.var] // CHECK:STDOUT: name_binding_decl { @@ -1406,15 +1346,15 @@ import library "extern_api"; // CHECK:STDOUT: %a.var_patt: %pattern_type.cb1 = var_pattern %a.patt [concrete = constants.%a.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %b.var: ref %i32 = var_storage %b.var_patt [concrete] -// CHECK:STDOUT: %i32.loc53: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc33: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %b: ref %i32 = wrapper_binding b, %b.var [concrete = %b.var] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %b.patt: %pattern_type.d94 = ref_binding_pattern b [concrete = constants.%b.patt.920] // CHECK:STDOUT: %b.var_patt: %pattern_type.d94 = var_pattern %b.patt [concrete = constants.%b.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %c.var: ref %struct_type.c = var_storage %c.var_patt [concrete] -// CHECK:STDOUT: %.loc54: type = splice_block %struct_type.c [concrete = constants.%struct_type.c] { -// CHECK:STDOUT: %i32.loc54: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc34: type = splice_block %struct_type.c [concrete = constants.%struct_type.c] { +// CHECK:STDOUT: %i32.loc34: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %i32} [concrete = constants.%struct_type.c] // CHECK:STDOUT: } // CHECK:STDOUT: %c: ref %struct_type.c = wrapper_binding c, %c.var [concrete = %c.var] @@ -1423,9 +1363,9 @@ import library "extern_api"; // CHECK:STDOUT: %c.var_patt: %pattern_type.51a = var_pattern %c.patt [concrete = constants.%c.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %d.var: ref %empty_tuple.type = var_storage %d.var_patt [concrete] -// CHECK:STDOUT: %.loc55_9.1: type = splice_block %.loc55_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc55_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc55_9.3: type = converted %.loc55_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc35_9.1: type = splice_block %.loc35_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc35_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc35_9.3: type = converted %.loc35_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %d: ref %empty_tuple.type = wrapper_binding d, %d.var [concrete = %d.var] // CHECK:STDOUT: name_binding_decl { @@ -1433,9 +1373,9 @@ import library "extern_api"; // CHECK:STDOUT: %d.var_patt: %pattern_type.cb1 = var_pattern %d.patt [concrete = constants.%d.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %e.var: ref %empty_tuple.type = var_storage %e.var_patt [concrete] -// CHECK:STDOUT: %.loc56_9.1: type = splice_block %.loc56_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc56_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc56_9.3: type = converted %.loc56_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc36_9.1: type = splice_block %.loc36_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc36_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc36_9.3: type = converted %.loc36_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %e: ref %empty_tuple.type = wrapper_binding e, %e.var [concrete = %e.var] // CHECK:STDOUT: name_binding_decl { @@ -1460,29 +1400,29 @@ import library "extern_api"; // CHECK:STDOUT: %A.call: init %empty_tuple.type = call %A.ref() // CHECK:STDOUT: assign file.%a.var, %A.call // CHECK:STDOUT: %B.ref: %B.type = name_ref B, imports.%Main.B [concrete = constants.%B] -// CHECK:STDOUT: %int_1.loc53: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %impl.elem0.loc53: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc53_16.1: = bound_method %int_1.loc53, %impl.elem0.loc53 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc53: = specific_function %impl.elem0.loc53, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc53_16.2: = bound_method %int_1.loc53, %specific_fn.loc53 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc53: init %i32 = call %bound_method.loc53_16.2(%int_1.loc53) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc53_16.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc53 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc53_16.2: %i32 = converted %int_1.loc53, %.loc53_16.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %B.call: init %i32 = call %B.ref(%.loc53_16.2) +// CHECK:STDOUT: %int_1.loc33: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %impl.elem0.loc33: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc33_16.1: = bound_method %int_1.loc33, %impl.elem0.loc33 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc33: = specific_function %impl.elem0.loc33, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc33_16.2: = bound_method %int_1.loc33, %specific_fn.loc33 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc33: init %i32 = call %bound_method.loc33_16.2(%int_1.loc33) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc33_16.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc33 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc33_16.2: %i32 = converted %int_1.loc33, %.loc33_16.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %B.call: init %i32 = call %B.ref(%.loc33_16.2) // CHECK:STDOUT: assign file.%b.var, %B.call // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%Main.C [concrete = constants.%C] -// CHECK:STDOUT: %int_1.loc54: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %.loc54_25.1: %tuple.type.985 = tuple_literal (%int_1.loc54) [concrete = constants.%tuple.378] -// CHECK:STDOUT: %impl.elem0.loc54: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc54_25.1: = bound_method %int_1.loc54, %impl.elem0.loc54 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc54: = specific_function %impl.elem0.loc54, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc54_25.2: = bound_method %int_1.loc54, %specific_fn.loc54 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc54: init %i32 = call %bound_method.loc54_25.2(%int_1.loc54) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc54_25.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc54 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc54_25.3: %i32 = converted %int_1.loc54, %.loc54_25.2 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %tuple: %tuple.type.294 = tuple_value (%.loc54_25.3) [concrete = constants.%tuple.f6b] -// CHECK:STDOUT: %.loc54_25.4: %tuple.type.294 = converted %.loc54_25.1, %tuple [concrete = constants.%tuple.f6b] -// CHECK:STDOUT: %C.call: init %struct_type.c = call %C.ref(%.loc54_25.4) +// CHECK:STDOUT: %int_1.loc34: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %.loc34_25.1: %tuple.type.985 = tuple_literal (%int_1.loc34) [concrete = constants.%tuple.378] +// CHECK:STDOUT: %impl.elem0.loc34: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc34_25.1: = bound_method %int_1.loc34, %impl.elem0.loc34 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc34: = specific_function %impl.elem0.loc34, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc34_25.2: = bound_method %int_1.loc34, %specific_fn.loc34 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc34: init %i32 = call %bound_method.loc34_25.2(%int_1.loc34) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc34_25.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc34 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc34_25.3: %i32 = converted %int_1.loc34, %.loc34_25.2 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %tuple: %tuple.type.294 = tuple_value (%.loc34_25.3) [concrete = constants.%tuple.f6b] +// CHECK:STDOUT: %.loc34_25.4: %tuple.type.294 = converted %.loc34_25.1, %tuple [concrete = constants.%tuple.f6b] +// CHECK:STDOUT: %C.call: init %struct_type.c = call %C.ref(%.loc34_25.4) // CHECK:STDOUT: assign file.%c.var, %C.call // CHECK:STDOUT: %D.ref: %D.type = name_ref D, imports.%Main.D [concrete = constants.%D] // CHECK:STDOUT: %D.call: init %empty_tuple.type = call %D.ref() diff --git a/toolchain/check/testdata/function/declaration/name_poisoning.carbon b/toolchain/check/testdata/function/declaration/name_poisoning.carbon index f6e8ea125fc1..e2cf3f448814 100644 --- a/toolchain/check/testdata/function/declaration/name_poisoning.carbon +++ b/toolchain/check/testdata/function/declaration/name_poisoning.carbon @@ -47,15 +47,11 @@ fn F1(); namespace N; // Use `package.F1` and poison `N.F1`. -// CHECK:STDERR: fail_declare_after_poison.carbon:[[@LINE+3]]:14: error: name `F1` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: alias N.F2 = F1; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_declare_after_poison.carbon:[[@LINE+1]]:14-15: error: name `F1` used before it was declared [NameUseBeforeDecl] alias N.F2 = F1; // Failure: `N.F1` declared after it was poisoned. -// CHECK:STDERR: fail_declare_after_poison.carbon:[[@LINE+4]]:6: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: fn N.F1(); -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_declare_after_poison.carbon:[[@LINE+2]]:6-7: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: fn N.F1(); @@ -69,9 +65,7 @@ fn F1(); namespace N; alias N.F2 = F1; -// CHECK:STDERR: fail_use_poison.carbon:[[@LINE+4]]:14: error: member name `F1` not found in `N` [MemberNameNotFoundInInstScope] -// CHECK:STDERR: alias N.F3 = N.F1; -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_use_poison.carbon:[[@LINE+2]]:14-17: error: member name `F1` not found in `N` [MemberNameNotFoundInInstScope] // CHECK:STDERR: alias N.F3 = N.F1; @@ -83,15 +77,11 @@ fn F1(); namespace N; // Use `package.F1` and poison `N.F1`. -// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+3]]:14: error: name `F1` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: alias N.F2 = F1; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+1]]:14-15: error: name `F1` used before it was declared [NameUseBeforeDecl] alias N.F2 = F1; // Failure: `N.F1` declared after it was poisoned. -// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+4]]:6: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: fn N.F1(); -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+2]]:6-7: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: fn N.F1(); @@ -111,30 +101,18 @@ namespace N1.N2.N3; // * `N1.F1` // * `N1.N2.F1` // * `N1.N2.N3.F1` -// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+3]]:21: error: name `F1` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: alias N1.N2.N3.F2 = F1; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+1]]:21-22: error: name `F1` used before it was declared [NameUseBeforeDecl] alias N1.N2.N3.F2 = F1; -// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+7]]:7: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: fn N1.F1(); -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+3]]:7-8: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: -// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE-6]]:21: error: name `F1` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: alias N1.N2.N3.F2 = F1; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE-4]]:21-22: error: name `F1` used before it was declared [NameUseBeforeDecl] fn N1.F1(); -// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+7]]:10: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: fn N1.N2.F1(); -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+3]]:10-11: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: -// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE-14]]:21: error: name `F1` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: alias N1.N2.N3.F2 = F1; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE-8]]:21-22: error: name `F1` used before it was declared [NameUseBeforeDecl] fn N1.N2.F1(); -// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+4]]:13: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: fn N1.N2.N3.F1(); -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+2]]:13-14: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: fn N1.N2.N3.F1(); @@ -145,12 +123,8 @@ library "[[@TEST_NAME]]"; fn F(); namespace N; -// CHECK:STDERR: fail_alias.carbon:[[@LINE+7]]:13: error: name `F` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: alias N.F = F; -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_alias.carbon:[[@LINE+4]]:9: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: alias N.F = F; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_alias.carbon:[[@LINE+3]]:13: error: name `F` used before it was declared [NameUseBeforeDecl] +// CHECK:STDERR: fail_alias.carbon:[[@LINE+2]]:9: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: alias N.F = F; @@ -175,27 +149,17 @@ library "[[@TEST_NAME]]"; namespace N; // `N.F1` poisoned when not found. -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+7]]:14: error: name `F1` not found [NameNotFound] -// CHECK:STDERR: alias N.F2 = F1; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+3]]:14-15: error: name `F1` not found [NameNotFound] // CHECK:STDERR: -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+3]]:14: error: name `F1` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: alias N.F2 = F1; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+1]]:14-15: error: name `F1` used before it was declared [NameUseBeforeDecl] alias N.F2 = F1; // TODO: We should ideally only produce one diagnostic here. -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+7]]:4: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: fn F1(); -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+3]]:4-5: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE-7]]:14: error: name `F1` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: alias N.F2 = F1; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE-5]]:14-15: error: name `F1` used before it was declared [NameUseBeforeDecl] fn F1(); -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+4]]:6: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: fn N.F1(); -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+2]]:6-7: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: fn N.F1(); @@ -207,14 +171,10 @@ fn F1() { fn F2(); class C { - // CHECK:STDERR: fail_poison_with_lexical_result.carbon:[[@LINE+3]]:16: error: name `F2` used before it was declared [NameUseBeforeDecl] - // CHECK:STDERR: alias F3 = F2; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_poison_with_lexical_result.carbon:[[@LINE+1]]:16-17: error: name `F2` used before it was declared [NameUseBeforeDecl] alias F3 = F2; - // CHECK:STDERR: fail_poison_with_lexical_result.carbon:[[@LINE+4]]:8: note: declared here [NameUseBeforeDeclNote] - // CHECK:STDERR: fn F2(); - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_poison_with_lexical_result.carbon:[[@LINE+2]]:8-9: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: fn F2(); } diff --git a/toolchain/check/testdata/function/declaration/no_definition_in_impl_file.carbon b/toolchain/check/testdata/function/declaration/no_definition_in_impl_file.carbon index 270458dee837..b9351ca6ef7a 100644 --- a/toolchain/check/testdata/function/declaration/no_definition_in_impl_file.carbon +++ b/toolchain/check/testdata/function/declaration/no_definition_in_impl_file.carbon @@ -52,17 +52,11 @@ fn C(); impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+12]]:1: error: redeclaration of `fn C` is redundant [RedeclRedundant] -// CHECK:STDERR: fn C(); -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: decl_in_api_decl_in_impl.carbon:4:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: fn C(); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+6]]:1-7: error: redeclaration of `fn C` is redundant [RedeclRedundant] +// CHECK:STDERR: imported from: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: decl_in_api_decl_in_impl.carbon:4:1-7: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: -// CHECK:STDERR: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+4]]:1: error: no definition found for declaration in impl file [MissingDefinitionInImpl] -// CHECK:STDERR: fn C(); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+2]]:1-7: error: no definition found for declaration in impl file [MissingDefinitionInImpl] // CHECK:STDERR: fn C(); @@ -76,13 +70,9 @@ fn D(); impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_decl_in_api_decl_and_definition_in_impl.impl.carbon:[[@LINE+8]]:1: error: redeclaration of `fn D` is redundant [RedeclRedundant] -// CHECK:STDERR: fn D(); -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_decl_in_api_decl_and_definition_in_impl.impl.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: decl_in_api_decl_and_definition_in_impl.carbon:4:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: fn D(); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_decl_in_api_decl_and_definition_in_impl.impl.carbon:[[@LINE+4]]:1-7: error: redeclaration of `fn D` is redundant [RedeclRedundant] +// CHECK:STDERR: imported from: fail_decl_in_api_decl_and_definition_in_impl.impl.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: decl_in_api_decl_and_definition_in_impl.carbon:4:1-7: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: fn D(); @@ -96,8 +86,6 @@ library "[[@TEST_NAME]]"; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_decl_only_in_impl.impl.carbon:[[@LINE+4]]:1: error: no definition found for declaration in impl file [MissingDefinitionInImpl] -// CHECK:STDERR: fn E(); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_decl_only_in_impl.impl.carbon:[[@LINE+2]]:1-7: error: no definition found for declaration in impl file [MissingDefinitionInImpl] // CHECK:STDERR: fn E(); diff --git a/toolchain/check/testdata/function/declaration/ref.carbon b/toolchain/check/testdata/function/declaration/ref.carbon index 0ce2c805108b..87153a45ae4b 100644 --- a/toolchain/check/testdata/function/declaration/ref.carbon +++ b/toolchain/check/testdata/function/declaration/ref.carbon @@ -33,9 +33,7 @@ library "[[@TEST_NAME]]"; // TODO: Per p5434, a return form starting with `(` is a compound form, which // isn't supported yet. -// CHECK:STDERR: fail_todo_ref_return_parenthesized.carbon:[[@LINE+4]]:12: error: `ref` tag is not an argument to a `ref` parameter [RefTagNoRefParam] -// CHECK:STDERR: fn F() -> (ref i32); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_todo_ref_return_parenthesized.carbon:[[@LINE+2]]:12-18: error: `ref` tag is not an argument to a `ref` parameter [RefTagNoRefParam] // CHECK:STDERR: fn F() -> (ref i32); diff --git a/toolchain/check/testdata/function/declaration/val_var_return.carbon b/toolchain/check/testdata/function/declaration/val_var_return.carbon index 64c014ed461b..3d2dd2227aba 100644 --- a/toolchain/check/testdata/function/declaration/val_var_return.carbon +++ b/toolchain/check/testdata/function/declaration/val_var_return.carbon @@ -67,12 +67,8 @@ fn F() -> var i32 { library "[[@TEST_NAME]]"; fn F() -> val i32 { - // CHECK:STDERR: fail_val_return_returned_var.carbon:[[@LINE+7]]:3: error: `returned var` declaration in function with non-initializing return form [ReturnedVarNotInit] - // CHECK:STDERR: returned var v: i32 = 1; - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_val_return_returned_var.carbon:[[@LINE-4]]:11: note: return form declared here [ReturnFormHereNote] - // CHECK:STDERR: fn F() -> val i32 { - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_val_return_returned_var.carbon:[[@LINE+3]]:3-10: error: `returned var` declaration in function with non-initializing return form [ReturnedVarNotInit] + // CHECK:STDERR: fail_val_return_returned_var.carbon:[[@LINE-2]]:11-17: note: return form declared here [ReturnFormHereNote] // CHECK:STDERR: returned var v: i32 = 1; return var; diff --git a/toolchain/check/testdata/function/deduced_return/fail_member.carbon b/toolchain/check/testdata/function/deduced_return/fail_member.carbon index e9e7888e6b9e..8768cb414e66 100644 --- a/toolchain/check/testdata/function/deduced_return/fail_member.carbon +++ b/toolchain/check/testdata/function/deduced_return/fail_member.carbon @@ -14,9 +14,7 @@ library "[[@TEST_NAME]]"; interface I { - // CHECK:STDERR: fail_interface.carbon:[[@LINE+4]]:10: error: interface member with deduced return type [DeducedReturnTypeNotAllowed] - // CHECK:STDERR: fn F() -> auto; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_interface.carbon:[[@LINE+2]]:10-16: error: interface member with deduced return type [DeducedReturnTypeNotAllowed] // CHECK:STDERR: fn F() -> auto; } @@ -25,9 +23,7 @@ interface I { library "[[@TEST_NAME]]"; interface I { - // CHECK:STDERR: fail_interface_default.carbon:[[@LINE+4]]:18: error: interface member with deduced return type [DeducedReturnTypeNotAllowed] - // CHECK:STDERR: default fn F() -> auto { return 0 as i32; } - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_interface_default.carbon:[[@LINE+2]]:18-24: error: interface member with deduced return type [DeducedReturnTypeNotAllowed] // CHECK:STDERR: default fn F() -> auto { return 0 as i32; } } @@ -36,9 +32,7 @@ interface I { library "[[@TEST_NAME]]"; base class B { - // CHECK:STDERR: fail_virtual.carbon:[[@LINE+4]]:29: error: virtual function with deduced return type [DeducedReturnTypeNotAllowed] - // CHECK:STDERR: virtual fn F(unused self) -> auto { return 0 as i32; } - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_virtual.carbon:[[@LINE+2]]:29-35: error: virtual function with deduced return type [DeducedReturnTypeNotAllowed] // CHECK:STDERR: virtual fn F(unused self) -> auto { return 0 as i32; } } @@ -47,9 +41,7 @@ base class B { library "[[@TEST_NAME]]"; abstract class A { - // CHECK:STDERR: fail_abstract.carbon:[[@LINE+4]]:23: error: virtual function with deduced return type [DeducedReturnTypeNotAllowed] - // CHECK:STDERR: abstract fn F(self) -> auto; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_abstract.carbon:[[@LINE+2]]:23-29: error: virtual function with deduced return type [DeducedReturnTypeNotAllowed] // CHECK:STDERR: abstract fn F(self) -> auto; } @@ -63,9 +55,7 @@ base class B { class D { extend base: B; - // CHECK:STDERR: fail_override.carbon:[[@LINE+4]]:30: error: virtual function with deduced return type [DeducedReturnTypeNotAllowed] - // CHECK:STDERR: override fn F(unused self) -> auto { return 0 as i32; } - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_override.carbon:[[@LINE+2]]:30-36: error: virtual function with deduced return type [DeducedReturnTypeNotAllowed] // CHECK:STDERR: override fn F(unused self) -> auto { return 0 as i32; } } @@ -80,9 +70,7 @@ interface I { class C {} impl C as I { - // CHECK:STDERR: fail_todo_impl.carbon:[[@LINE+4]]:10: error: semantics TODO: `deduced return type for `impl` member` [SemanticsTodo] - // CHECK:STDERR: fn F() -> auto { return 0 as i32; } - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_todo_impl.carbon:[[@LINE+2]]:10-16: error: semantics TODO: `deduced return type for `impl` member` [SemanticsTodo] // CHECK:STDERR: fn F() -> auto { return 0 as i32; } } diff --git a/toolchain/check/testdata/function/deduced_return/fail_redecl.carbon b/toolchain/check/testdata/function/deduced_return/fail_redecl.carbon index d7eda329e3c2..24664e621687 100644 --- a/toolchain/check/testdata/function/deduced_return/fail_redecl.carbon +++ b/toolchain/check/testdata/function/deduced_return/fail_redecl.carbon @@ -13,26 +13,18 @@ // --- fail_forward_decl.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+4]]:8: error: forward declaration of function with deduced return type [DeducedReturnTypeNotDefinition] -// CHECK:STDERR: fn F() -> auto; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+2]]:8-14: error: forward declaration of function with deduced return type [DeducedReturnTypeNotDefinition] // CHECK:STDERR: fn F() -> auto; // --- fail_forward_decl_then_def.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_forward_decl_then_def.carbon:[[@LINE+4]]:8: error: forward declaration of function with deduced return type [DeducedReturnTypeNotDefinition] -// CHECK:STDERR: fn F() -> auto; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_forward_decl_then_def.carbon:[[@LINE+2]]:8-14: error: forward declaration of function with deduced return type [DeducedReturnTypeNotDefinition] // CHECK:STDERR: fn F() -> auto; -// CHECK:STDERR: fail_forward_decl_then_def.carbon:[[@LINE+7]]:1: error: redeclaration of function with deduced return type [DeducedReturnTypeRedecl] -// CHECK:STDERR: fn F() -> auto { return 0 as i32; } -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_forward_decl_then_def.carbon:[[@LINE-4]]:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: fn F() -> auto; -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_forward_decl_then_def.carbon:[[@LINE+3]]:1-16: error: redeclaration of function with deduced return type [DeducedReturnTypeRedecl] +// CHECK:STDERR: fail_forward_decl_then_def.carbon:[[@LINE-2]]:1-15: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: fn F() -> auto { return 0 as i32; } @@ -40,12 +32,8 @@ fn F() -> auto { return 0 as i32; } library "[[@TEST_NAME]]"; fn F() -> i32; -// CHECK:STDERR: fail_decl_then_auto_def.carbon:[[@LINE+7]]:1: error: redeclaration of function with deduced return type [DeducedReturnTypeRedecl] -// CHECK:STDERR: fn F() -> auto { return 0 as i32; } -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_decl_then_auto_def.carbon:[[@LINE-4]]:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: fn F() -> i32; -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_decl_then_auto_def.carbon:[[@LINE+3]]:1-16: error: redeclaration of function with deduced return type [DeducedReturnTypeRedecl] +// CHECK:STDERR: fail_decl_then_auto_def.carbon:[[@LINE-2]]:1-14: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: fn F() -> auto { return 0 as i32; } @@ -53,12 +41,8 @@ fn F() -> auto { return 0 as i32; } library "[[@TEST_NAME]]"; fn F() -> auto { return 0 as i32; } -// CHECK:STDERR: fail_auto_def_then_decl.carbon:[[@LINE+7]]:1: error: redeclaration of function with deduced return type [DeducedReturnTypeRedecl] -// CHECK:STDERR: fn F() -> i32; -// CHECK:STDERR: ^~~~~~~~~~~~~~ -// CHECK:STDERR: fail_auto_def_then_decl.carbon:[[@LINE-4]]:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: fn F() -> auto { return 0 as i32; } -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_auto_def_then_decl.carbon:[[@LINE+3]]:1-14: error: redeclaration of function with deduced return type [DeducedReturnTypeRedecl] +// CHECK:STDERR: fail_auto_def_then_decl.carbon:[[@LINE-2]]:1-16: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: fn F() -> i32; @@ -66,12 +50,8 @@ fn F() -> i32; library "[[@TEST_NAME]]"; fn F() -> auto { return 0 as i32; } -// CHECK:STDERR: fail_redefinition.carbon:[[@LINE+7]]:1: error: redeclaration of function with deduced return type [DeducedReturnTypeRedecl] -// CHECK:STDERR: fn F() -> auto { return 0 as i32; } -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_redefinition.carbon:[[@LINE-4]]:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: fn F() -> auto { return 0 as i32; } -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_redefinition.carbon:[[@LINE+3]]:1-16: error: redeclaration of function with deduced return type [DeducedReturnTypeRedecl] +// CHECK:STDERR: fail_redefinition.carbon:[[@LINE-2]]:1-16: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: fn F() -> auto { return 0 as i32; } @@ -79,41 +59,29 @@ fn F() -> auto { return 0 as i32; } library "[[@TEST_NAME]]"; class C { - // CHECK:STDERR: fail_member_out_of_line.carbon:[[@LINE+4]]:10: error: forward declaration of function with deduced return type [DeducedReturnTypeNotDefinition] - // CHECK:STDERR: fn F() -> auto; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_member_out_of_line.carbon:[[@LINE+2]]:10-16: error: forward declaration of function with deduced return type [DeducedReturnTypeNotDefinition] // CHECK:STDERR: fn F() -> auto; } -// CHECK:STDERR: fail_member_out_of_line.carbon:[[@LINE+7]]:1: error: redeclaration of function with deduced return type [DeducedReturnTypeRedecl] -// CHECK:STDERR: fn C.F() -> auto { return 0 as i32; } -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_member_out_of_line.carbon:[[@LINE-6]]:3: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: fn F() -> auto; -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_member_out_of_line.carbon:[[@LINE+3]]:1-18: error: redeclaration of function with deduced return type [DeducedReturnTypeRedecl] +// CHECK:STDERR: fail_member_out_of_line.carbon:[[@LINE-4]]:3-17: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: fn C.F() -> auto { return 0 as i32; } // --- fail_builtin.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_builtin.carbon:[[@LINE+8]]:26: error: builtin function with deduced return type [DeducedReturnTypeNotAllowed] -// CHECK:STDERR: fn F(n: Core.IntLiteral) -> auto = "int.make_type_signed"; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_builtin.carbon:[[@LINE+4]]:26-32: error: builtin function with deduced return type [DeducedReturnTypeNotAllowed] // CHECK:STDERR: -// CHECK:STDERR: fail_builtin.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.make_type_signed" [InvalidBuiltinSignature] -// CHECK:STDERR: fn F(n: Core.IntLiteral) -> auto = "int.make_type_signed"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_builtin.carbon:[[@LINE+2]]:1-34: error: invalid signature for builtin function "int.make_type_signed" [InvalidBuiltinSignature] // CHECK:STDERR: fn F(n: Core.IntLiteral) -> auto = "int.make_type_signed"; // --- fail_extern.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_extern.carbon:[[@LINE+4]]:15: error: `extern` function with deduced return type [DeducedReturnTypeNotAllowed] -// CHECK:STDERR: extern fn F() -> auto { return 0 as i32; } -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_extern.carbon:[[@LINE+2]]:15-21: error: `extern` function with deduced return type [DeducedReturnTypeNotAllowed] // CHECK:STDERR: extern fn F() -> auto { return 0 as i32; } @@ -125,17 +93,11 @@ fn F() -> auto { return 0 as i32; } // --- fail_api_def.impl.carbon impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_api_def.impl.carbon:[[@LINE+12]]:1: error: redeclaration of function with deduced return type [DeducedReturnTypeRedecl] -// CHECK:STDERR: fn F() -> i32; -// CHECK:STDERR: ^~~~~~~~~~~~~~ -// CHECK:STDERR: fail_api_def.impl.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: api_def.carbon:3:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: fn F() -> auto { return 0 as i32; } -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_api_def.impl.carbon:[[@LINE+6]]:1-14: error: redeclaration of function with deduced return type [DeducedReturnTypeRedecl] +// CHECK:STDERR: imported from: fail_api_def.impl.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: api_def.carbon:3:1-16: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: -// CHECK:STDERR: fail_api_def.impl.carbon:[[@LINE+4]]:1: error: no definition found for declaration in impl file [MissingDefinitionInImpl] -// CHECK:STDERR: fn F() -> i32; -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_api_def.impl.carbon:[[@LINE+2]]:1-14: error: no definition found for declaration in impl file [MissingDefinitionInImpl] // CHECK:STDERR: fn F() -> i32; @@ -147,12 +109,8 @@ fn F() -> i32; // --- fail_api_decl.impl.carbon impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_api_decl.impl.carbon:[[@LINE+8]]:1: error: redeclaration of function with deduced return type [DeducedReturnTypeRedecl] -// CHECK:STDERR: fn F() -> auto { return 0 as i32; } -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_api_decl.impl.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: api_decl.carbon:3:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: fn F() -> i32; -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_api_decl.impl.carbon:[[@LINE+4]]:1-16: error: redeclaration of function with deduced return type [DeducedReturnTypeRedecl] +// CHECK:STDERR: imported from: fail_api_decl.impl.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: api_decl.carbon:3:1-14: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: fn F() -> auto { return 0 as i32; } diff --git a/toolchain/check/testdata/function/deduced_return/fail_return.carbon b/toolchain/check/testdata/function/deduced_return/fail_return.carbon index ed23409f2756..0ab997bc441c 100644 --- a/toolchain/check/testdata/function/deduced_return/fail_return.carbon +++ b/toolchain/check/testdata/function/deduced_return/fail_return.carbon @@ -17,12 +17,8 @@ fn F(b: bool) -> auto { if (b) { return 1 as i32; } - // CHECK:STDERR: fail_mismatch.carbon:[[@LINE+7]]:10: error: deduced return type `bool` does not match return type deduced earlier [DeducedReturnTypeMismatch] - // CHECK:STDERR: return true; - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_mismatch.carbon:[[@LINE-5]]:12: note: return type previously deduced as `i32` here [DeducedReturnTypeMismatchPrevious] - // CHECK:STDERR: return 1 as i32; - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_mismatch.carbon:[[@LINE+3]]:10-13: error: deduced return type `bool` does not match return type deduced earlier [DeducedReturnTypeMismatch] + // CHECK:STDERR: fail_mismatch.carbon:[[@LINE-3]]:12-19: note: return type previously deduced as `i32` here [DeducedReturnTypeMismatchPrevious] // CHECK:STDERR: return true; } @@ -35,12 +31,8 @@ fn F(b: bool) -> auto { return 1 as i32; } // TODO: This should work once we use CommonType in return type deduction. - // CHECK:STDERR: fail_todo_mismatch_int_vs_int_literal.carbon:[[@LINE+7]]:10: error: deduced return type `Core.IntLiteral` does not match return type deduced earlier [DeducedReturnTypeMismatch] - // CHECK:STDERR: return 0; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_todo_mismatch_int_vs_int_literal.carbon:[[@LINE-6]]:12: note: return type previously deduced as `i32` here [DeducedReturnTypeMismatchPrevious] - // CHECK:STDERR: return 1 as i32; - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_todo_mismatch_int_vs_int_literal.carbon:[[@LINE+3]]:10: error: deduced return type `Core.IntLiteral` does not match return type deduced earlier [DeducedReturnTypeMismatch] + // CHECK:STDERR: fail_todo_mismatch_int_vs_int_literal.carbon:[[@LINE-4]]:12-19: note: return type previously deduced as `i32` here [DeducedReturnTypeMismatchPrevious] // CHECK:STDERR: return 0; } @@ -51,9 +43,7 @@ library "[[@TEST_NAME]]"; // The erroneous `return` doesn't affect the deduced return type. fn F(b: bool) -> auto { if (b) { - // CHECK:STDERR: fail_error_return_ignored.carbon:[[@LINE+4]]:12: error: name `Undeclared` not found [NameNotFound] - // CHECK:STDERR: return Undeclared; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_error_return_ignored.carbon:[[@LINE+2]]:12-21: error: name `Undeclared` not found [NameNotFound] // CHECK:STDERR: return Undeclared; } @@ -69,12 +59,8 @@ library "[[@TEST_NAME]]"; fn F(b: bool) -> auto { if (b) { - // CHECK:STDERR: fail_return_no_value.carbon:[[@LINE+7]]:5: error: missing return value [ReturnStatementMissingExpr] - // CHECK:STDERR: return; - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_return_no_value.carbon:[[@LINE-5]]:1: note: return type of function is deduced [ReturnTypeIsDeducedNote] - // CHECK:STDERR: fn F(b: bool) -> auto { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_return_no_value.carbon:[[@LINE+3]]:5-11: error: missing return value [ReturnStatementMissingExpr] + // CHECK:STDERR: fail_return_no_value.carbon:[[@LINE-3]]:1-23: note: return type of function is deduced [ReturnTypeIsDeducedNote] // CHECK:STDERR: return; } @@ -85,12 +71,8 @@ fn F(b: bool) -> auto { library "[[@TEST_NAME]]"; fn F() -> auto { - // CHECK:STDERR: fail_return_no_value_only.carbon:[[@LINE+7]]:3: error: missing return value [ReturnStatementMissingExpr] - // CHECK:STDERR: return; - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_return_no_value_only.carbon:[[@LINE-4]]:1: note: return type of function is deduced [ReturnTypeIsDeducedNote] - // CHECK:STDERR: fn F() -> auto { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_return_no_value_only.carbon:[[@LINE+3]]:3-9: error: missing return value [ReturnStatementMissingExpr] + // CHECK:STDERR: fail_return_no_value_only.carbon:[[@LINE-2]]:1-16: note: return type of function is deduced [ReturnTypeIsDeducedNote] // CHECK:STDERR: return; } @@ -102,18 +84,14 @@ fn F(b: bool) -> auto { if (b) { return 1 as i32; } -// CHECK:STDERR: fail_reachable_end.carbon:[[@LINE+4]]:1: error: missing `return` at end of function with declared return type [MissingReturnStatement] -// CHECK:STDERR: } -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_reachable_end.carbon:[[@LINE+2]]:1: error: missing `return` at end of function with declared return type [MissingReturnStatement] // CHECK:STDERR: } // --- fail_no_return.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_no_return.carbon:[[@LINE+4]]:1: error: no `return` in function with deduced return type [DeducedReturnTypeWithoutReturn] -// CHECK:STDERR: fn F() -> auto {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_no_return.carbon:[[@LINE+2]]:1-16: error: no `return` in function with deduced return type [DeducedReturnTypeWithoutReturn] // CHECK:STDERR: fn F() -> auto {} @@ -121,9 +99,7 @@ fn F() -> auto {} library "[[@TEST_NAME]]"; fn F() -> auto { - // CHECK:STDERR: fail_return_var_no_returned_var.carbon:[[@LINE+4]]:3: error: `return var;` with no `returned var` in scope [ReturnVarWithNoReturnedVar] - // CHECK:STDERR: return var; - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_return_var_no_returned_var.carbon:[[@LINE+2]]:3-13: error: `return var;` with no `returned var` in scope [ReturnVarWithNoReturnedVar] // CHECK:STDERR: return var; } @@ -136,12 +112,8 @@ class C; fn Make() -> C*; fn F() -> auto { - // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+7]]:10: error: function returns incomplete type `C` [IncompleteTypeInFunctionReturnType] - // CHECK:STDERR: return *Make(); - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_incomplete.carbon:[[@LINE-8]]:1: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: class C; - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+3]]:10-16: error: function returns incomplete type `C` [IncompleteTypeInFunctionReturnType] + // CHECK:STDERR: fail_incomplete.carbon:[[@LINE-6]]:1-8: note: class was forward declared here [ClassForwardDeclaredHere] // CHECK:STDERR: return *Make(); } diff --git a/toolchain/check/testdata/function/deduced_return/generic.carbon b/toolchain/check/testdata/function/deduced_return/generic.carbon index b9a1714c315b..4baac6c6749b 100644 --- a/toolchain/check/testdata/function/deduced_return/generic.carbon +++ b/toolchain/check/testdata/function/deduced_return/generic.carbon @@ -22,9 +22,7 @@ library "[[@TEST_NAME]]"; fn F[T: Core.Copy](x: T) -> auto { return x; } -// CHECK:STDERR: fail_todo_call_generic.carbon:[[@LINE+4]]:24: error: semantics TODO: `call to generic function with deduced return type` [SemanticsTodo] -// CHECK:STDERR: fn G() -> i32 { return F(0 as i32); } -// CHECK:STDERR: ^~~~~~~~~~~ +// CHECK:STDERR: fail_todo_call_generic.carbon:[[@LINE+2]]:24-34: error: semantics TODO: `call to generic function with deduced return type` [SemanticsTodo] // CHECK:STDERR: fn G() -> i32 { return F(0 as i32); } diff --git a/toolchain/check/testdata/function/deduced_return/returned_var.carbon b/toolchain/check/testdata/function/deduced_return/returned_var.carbon index 009bc00e0d6c..30bf27e9a844 100644 --- a/toolchain/check/testdata/function/deduced_return/returned_var.carbon +++ b/toolchain/check/testdata/function/deduced_return/returned_var.carbon @@ -79,17 +79,11 @@ library "[[@TEST_NAME]]"; fn F(b: bool) -> auto { if (b) { - // CHECK:STDERR: fail_return_before_returned_var.carbon:[[@LINE+6]]:5: error: cannot implicitly convert expression of type `bool` to `i32` [ConversionFailure] - // CHECK:STDERR: return true; - // CHECK:STDERR: ^~~~~~~~~~~~ - // CHECK:STDERR: fail_return_before_returned_var.carbon:[[@LINE+3]]:5: note: type `bool` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return true; - // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_return_before_returned_var.carbon:[[@LINE+2]]:5-16: error: cannot implicitly convert expression of type `bool` to `i32` [ConversionFailure] + // CHECK:STDERR: fail_return_before_returned_var.carbon:[[@LINE+1]]:5-16: note: type `bool` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] return true; } - // CHECK:STDERR: fail_return_before_returned_var.carbon:[[@LINE+4]]:19: note: return type deduced as `i32` [ReturnTypeDeducedAs] - // CHECK:STDERR: returned var r: i32 = 0; - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_return_before_returned_var.carbon:[[@LINE+2]]:19-21: note: return type deduced as `i32` [ReturnTypeDeducedAs] // CHECK:STDERR: returned var r: i32 = 0; return var; @@ -103,12 +97,8 @@ fn F(b: bool) -> auto { returned var r: i32 = 0; return var; } - // CHECK:STDERR: fail_returned_var_mismatch.carbon:[[@LINE+7]]:19: error: type `bool` of `returned var` does not match return type of enclosing function [ReturnedVarWrongType] - // CHECK:STDERR: returned var s: bool = true; - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_returned_var_mismatch.carbon:[[@LINE-6]]:21: note: return type of function is `i32` [ReturnTypeHereNote] - // CHECK:STDERR: returned var r: i32 = 0; - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_returned_var_mismatch.carbon:[[@LINE+3]]:19-22: error: type `bool` of `returned var` does not match return type of enclosing function [ReturnedVarWrongType] + // CHECK:STDERR: fail_returned_var_mismatch.carbon:[[@LINE-4]]:21-23: note: return type of function is `i32` [ReturnTypeHereNote] // CHECK:STDERR: returned var s: bool = true; return var; diff --git a/toolchain/check/testdata/function/deduced_return/use_before_deduced.carbon b/toolchain/check/testdata/function/deduced_return/use_before_deduced.carbon index 31afb0876cca..03a3d1106637 100644 --- a/toolchain/check/testdata/function/deduced_return/use_before_deduced.carbon +++ b/toolchain/check/testdata/function/deduced_return/use_before_deduced.carbon @@ -15,12 +15,8 @@ library "[[@TEST_NAME]]"; fn F(b: bool) -> auto { if (b) { - // CHECK:STDERR: fail_recursion.carbon:[[@LINE+7]]:12: error: call to `F` before its return type is deduced [CallBeforeReturnTypeDeduced] - // CHECK:STDERR: return F(false); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_recursion.carbon:[[@LINE-5]]:1: note: return type of `F` is deduced from its definition [ReturnTypeDeducedFromDefinition] - // CHECK:STDERR: fn F(b: bool) -> auto { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_recursion.carbon:[[@LINE+3]]:12-19: error: call to `F` before its return type is deduced [CallBeforeReturnTypeDeduced] + // CHECK:STDERR: fail_recursion.carbon:[[@LINE-3]]:1-23: note: return type of `F` is deduced from its definition [ReturnTypeDeducedFromDefinition] // CHECK:STDERR: return F(false); } @@ -32,13 +28,9 @@ library "[[@TEST_NAME]]"; class C { // The body of `F` is checked after the body of `G`. - // CHECK:STDERR: fail_member_order.carbon:[[@LINE+3]]:26: error: call to `F` before its return type is deduced [CallBeforeReturnTypeDeduced] - // CHECK:STDERR: fn G() -> i32 { return F(); } - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_member_order.carbon:[[@LINE+1]]:26-28: error: call to `F` before its return type is deduced [CallBeforeReturnTypeDeduced] fn G() -> i32 { return F(); } - // CHECK:STDERR: fail_member_order.carbon:[[@LINE+4]]:3: note: return type of `F` is deduced from its definition [ReturnTypeDeducedFromDefinition] - // CHECK:STDERR: fn F() -> auto { return 0 as i32; } - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_member_order.carbon:[[@LINE+2]]:3-18: note: return type of `F` is deduced from its definition [ReturnTypeDeducedFromDefinition] // CHECK:STDERR: fn F() -> auto { return 0 as i32; } } diff --git a/toolchain/check/testdata/function/definition/basics.carbon b/toolchain/check/testdata/function/definition/basics.carbon index b3bdbe8058b4..0d297711ce5b 100644 --- a/toolchain/check/testdata/function/definition/basics.carbon +++ b/toolchain/check/testdata/function/definition/basics.carbon @@ -17,12 +17,8 @@ class C; -// CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE+7]]:13: error: parameter has incomplete type `C` in function definition [IncompleteTypeInFunctionParam] -// CHECK:STDERR: fn F(unused n: C) {} -// CHECK:STDERR: ^~~~ -// CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE-5]]:1: note: class was forward declared here [ClassForwardDeclaredHere] -// CHECK:STDERR: class C; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE+3]]:13-16: error: parameter has incomplete type `C` in function definition [IncompleteTypeInFunctionParam] +// CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE-3]]:1-8: note: class was forward declared here [ClassForwardDeclaredHere] // CHECK:STDERR: fn F(unused n: C) {} diff --git a/toolchain/check/testdata/function/definition/default_values.carbon b/toolchain/check/testdata/function/definition/default_values.carbon index eb2ea0037416..6636d81e2c5a 100644 --- a/toolchain/check/testdata/function/definition/default_values.carbon +++ b/toolchain/check/testdata/function/definition/default_values.carbon @@ -14,12 +14,8 @@ library "[[@TEST_NAME]]"; fn F(x: i32 = 0, y: i32 = 10); -// CHECK:STDERR: fail_defaults_different_values_redecl.carbon:[[@LINE+7]]:25: error: redeclaration differs at parameter 2 [RedeclParamDiffers] -// CHECK:STDERR: fn F(unused x: i32 = 0, unused y: i32 = 22) { } -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_defaults_different_values_redecl.carbon:[[@LINE-4]]:18: note: previous declaration's corresponding parameter here [RedeclParamPrevious] -// CHECK:STDERR: fn F(x: i32 = 0, y: i32 = 10); -// CHECK:STDERR: ^~~~~~~~~~~ +// CHECK:STDERR: fail_defaults_different_values_redecl.carbon:[[@LINE+3]]:25-42: error: redeclaration differs at parameter 2 [RedeclParamDiffers] +// CHECK:STDERR: fail_defaults_different_values_redecl.carbon:[[@LINE-2]]:18-28: note: previous declaration's corresponding parameter here [RedeclParamPrevious] // CHECK:STDERR: fn F(unused x: i32 = 0, unused y: i32 = 22) { } @@ -31,13 +27,9 @@ fn F(x: i32 = 0, y: i32 = 1, z: i32 = 2); // --- fail_imported_default_presence_mismatch.impl.carbon impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_imported_default_presence_mismatch.impl.carbon:[[@LINE+8]]:13: error: redeclaration differs at parameter 1 [RedeclParamDiffers] -// CHECK:STDERR: fn F(unused x: i32, unused y: i32 = 1, unused z: i32 = 2) { } -// CHECK:STDERR: ^~~~~~ -// CHECK:STDERR: fail_imported_default_presence_mismatch.impl.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: imported_default_presence_mismatch.carbon:3:6: note: previous declaration's corresponding parameter here [RedeclParamPrevious] -// CHECK:STDERR: fn F(x: i32 = 0, y: i32 = 1, z: i32 = 2); -// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: fail_imported_default_presence_mismatch.impl.carbon:[[@LINE+4]]:13-18: error: redeclaration differs at parameter 1 [RedeclParamDiffers] +// CHECK:STDERR: imported from: fail_imported_default_presence_mismatch.impl.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: imported_default_presence_mismatch.carbon:3:6-15: note: previous declaration's corresponding parameter here [RedeclParamPrevious] // CHECK:STDERR: fn F(unused x: i32, unused y: i32 = 1, unused z: i32 = 2) { } @@ -49,13 +41,9 @@ fn F(x: i32 = 0, y: i32 = 10); // --- fail_imported_defaults_different_values.impl.carbon impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_imported_defaults_different_values.impl.carbon:[[@LINE+8]]:25: error: redeclaration differs at parameter 2 [RedeclParamDiffers] -// CHECK:STDERR: fn F(unused x: i32 = 0, unused y: i32 = 22) { } -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_imported_defaults_different_values.impl.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: imported_defaults_different_values.carbon:3:18: note: previous declaration's corresponding parameter here [RedeclParamPrevious] -// CHECK:STDERR: fn F(x: i32 = 0, y: i32 = 10); -// CHECK:STDERR: ^~~~~~~~~~~ +// CHECK:STDERR: fail_imported_defaults_different_values.impl.carbon:[[@LINE+4]]:25-42: error: redeclaration differs at parameter 2 [RedeclParamDiffers] +// CHECK:STDERR: imported from: fail_imported_defaults_different_values.impl.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: imported_defaults_different_values.carbon:3:18-28: note: previous declaration's corresponding parameter here [RedeclParamPrevious] // CHECK:STDERR: fn F(unused x: i32 = 0, unused y: i32 = 22) { } diff --git a/toolchain/check/testdata/function/definition/extern.carbon b/toolchain/check/testdata/function/definition/extern.carbon index e034d2ef04ef..c7f88ba16b22 100644 --- a/toolchain/check/testdata/function/definition/extern.carbon +++ b/toolchain/check/testdata/function/definition/extern.carbon @@ -42,12 +42,8 @@ extern fn F() {} library "[[@TEST_NAME]]"; extern fn F(); -// CHECK:STDERR: fail_def_extern_mismatch.carbon:[[@LINE+7]]:1: error: redeclarations of `fn F` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: fn F() {} -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_def_extern_mismatch.carbon:[[@LINE-4]]:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: extern fn F(); -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_def_extern_mismatch.carbon:[[@LINE+3]]:1-8: error: redeclarations of `fn F` must match use of `extern` [RedeclExternMismatch] +// CHECK:STDERR: fail_def_extern_mismatch.carbon:[[@LINE-2]]:1-14: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: fn F() {} @@ -56,12 +52,8 @@ fn F() {} library "[[@TEST_NAME]]"; fn F(); -// CHECK:STDERR: fail_def_extern_mismatch_reverse.carbon:[[@LINE+7]]:1: error: redeclarations of `fn F` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: extern fn F() {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_def_extern_mismatch_reverse.carbon:[[@LINE-4]]:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: fn F(); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_def_extern_mismatch_reverse.carbon:[[@LINE+3]]:1-15: error: redeclarations of `fn F` must match use of `extern` [RedeclExternMismatch] +// CHECK:STDERR: fail_def_extern_mismatch_reverse.carbon:[[@LINE-2]]:1-7: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: extern fn F() {} @@ -70,20 +62,12 @@ extern fn F() {} library "[[@TEST_NAME]]"; extern fn F(); -// CHECK:STDERR: fail_extern_diag_suppressed.carbon:[[@LINE+7]]:1: error: redeclaration of `fn F` is redundant [RedeclRedundant] -// CHECK:STDERR: fn F(); -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_extern_diag_suppressed.carbon:[[@LINE-4]]:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: extern fn F(); -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_extern_diag_suppressed.carbon:[[@LINE+3]]:1-7: error: redeclaration of `fn F` is redundant [RedeclRedundant] +// CHECK:STDERR: fail_extern_diag_suppressed.carbon:[[@LINE-2]]:1-14: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: fn F(); -// CHECK:STDERR: fail_extern_diag_suppressed.carbon:[[@LINE+7]]:1: error: redeclarations of `fn F` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: fn F() {} -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_extern_diag_suppressed.carbon:[[@LINE-12]]:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: extern fn F(); -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_extern_diag_suppressed.carbon:[[@LINE+3]]:1-8: error: redeclarations of `fn F` must match use of `extern` [RedeclExternMismatch] +// CHECK:STDERR: fail_extern_diag_suppressed.carbon:[[@LINE-6]]:1-14: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: fn F() {} @@ -92,12 +76,8 @@ fn F() {} library "[[@TEST_NAME]]"; fn F() {} -// CHECK:STDERR: fail_extern_decl_after_def.carbon:[[@LINE+7]]:1: error: redeclaration of `fn F` is redundant [RedeclRedundant] -// CHECK:STDERR: extern fn F(); -// CHECK:STDERR: ^~~~~~~~~~~~~~ -// CHECK:STDERR: fail_extern_decl_after_def.carbon:[[@LINE-4]]:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: fn F() {} -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_extern_decl_after_def.carbon:[[@LINE+3]]:1-14: error: redeclaration of `fn F` is redundant [RedeclRedundant] +// CHECK:STDERR: fail_extern_decl_after_def.carbon:[[@LINE-2]]:1-8: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: extern fn F(); @@ -109,9 +89,7 @@ library "[[@TEST_NAME]]"; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_in_impl.impl.carbon:[[@LINE+4]]:1: error: `extern` entities must have a declaration in the API file [ExternRequiresDeclInApiFile] -// CHECK:STDERR: extern fn F() {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_in_impl.impl.carbon:[[@LINE+2]]:1-15: error: `extern` entities must have a declaration in the API file [ExternRequiresDeclInApiFile] // CHECK:STDERR: extern fn F() {} @@ -208,7 +186,7 @@ extern fn F() {} // CHECK:STDOUT: .F = %F.decl.loc4 // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl.loc4: %F.type = fn_decl @F [concrete = constants.%F] {} {} -// CHECK:STDOUT: %F.decl.loc12: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: %F.decl.loc8: %F.type = fn_decl @F [concrete = constants.%F] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: extern fn @F() { @@ -229,7 +207,7 @@ extern fn F() {} // CHECK:STDOUT: .F = %F.decl.loc4 // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl.loc4: %F.type = fn_decl @F [concrete = constants.%F] {} {} -// CHECK:STDOUT: %F.decl.loc12: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: %F.decl.loc8: %F.type = fn_decl @F [concrete = constants.%F] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -250,8 +228,8 @@ extern fn F() {} // CHECK:STDOUT: .F = %F.decl.loc4 // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl.loc4: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: %F.decl.loc8: %F.type = fn_decl @F [concrete = constants.%F] {} {} // CHECK:STDOUT: %F.decl.loc12: %F.type = fn_decl @F [concrete = constants.%F] {} {} -// CHECK:STDOUT: %F.decl.loc20: %F.type = fn_decl @F [concrete = constants.%F] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: extern fn @F() { @@ -272,7 +250,7 @@ extern fn F() {} // CHECK:STDOUT: .F = %F.decl.loc4 // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl.loc4: %F.type = fn_decl @F [concrete = constants.%F] {} {} -// CHECK:STDOUT: %F.decl.loc12: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: %F.decl.loc8: %F.type = fn_decl @F [concrete = constants.%F] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { diff --git a/toolchain/check/testdata/function/definition/extern_library.carbon b/toolchain/check/testdata/function/definition/extern_library.carbon index 8b14f063d3b4..152e9f7130b0 100644 --- a/toolchain/check/testdata/function/definition/extern_library.carbon +++ b/toolchain/check/testdata/function/definition/extern_library.carbon @@ -58,13 +58,9 @@ extern fn F(); impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_two_file_impl_mismatch.impl.carbon:[[@LINE+8]]:1: error: redeclarations of `fn F` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: fn F() {} -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_two_file_impl_mismatch.impl.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: two_file_impl_mismatch.carbon:4:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: extern fn F(); -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_two_file_impl_mismatch.impl.carbon:[[@LINE+4]]:1-8: error: redeclarations of `fn F` must match use of `extern` [RedeclExternMismatch] +// CHECK:STDERR: imported from: fail_two_file_impl_mismatch.impl.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: two_file_impl_mismatch.carbon:4:1-14: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: fn F() {} @@ -82,10 +78,8 @@ impl library "no_decl_extern"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_no_decl.carbon:[[@LINE+5]]:1: in import [InImport] -// CHECK:STDERR: no_decl_extern.carbon:4:1: error: owning declaration required for non-owning declaration [MissingOwningDeclarationInApi] -// CHECK:STDERR: extern library "no_decl" fn F(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: imported from: fail_no_decl.carbon:[[@LINE+3]]:1 [InImport] +// CHECK:STDERR: no_decl_extern.carbon:4:1-32: error: owning declaration required for non-owning declaration [MissingOwningDeclarationInApi] // CHECK:STDERR: import library "no_decl_extern"; @@ -99,10 +93,8 @@ extern library "indirect_two_file" fn F(); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_indirect_two_file.carbon:[[@LINE+5]]:1: in import [InImport] -// CHECK:STDERR: indirect_two_file_extern.carbon:4:1: error: owning declaration required for non-owning declaration [MissingOwningDeclarationInApi] -// CHECK:STDERR: extern library "indirect_two_file" fn F(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: imported from: fail_indirect_two_file.carbon:[[@LINE+3]]:1 [InImport] +// CHECK:STDERR: indirect_two_file_extern.carbon:4:1-42: error: owning declaration required for non-owning declaration [MissingOwningDeclarationInApi] // CHECK:STDERR: import library "indirect_two_file_extern"; @@ -110,9 +102,7 @@ import library "indirect_two_file_extern"; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_indirect_two_file.impl.carbon:[[@LINE+4]]:1: error: `extern` entities must have a declaration in the API file [ExternRequiresDeclInApiFile] -// CHECK:STDERR: extern fn F() {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_indirect_two_file.impl.carbon:[[@LINE+2]]:1-15: error: `extern` entities must have a declaration in the API file [ExternRequiresDeclInApiFile] // CHECK:STDERR: extern fn F() {} @@ -132,9 +122,7 @@ impl library "[[@TEST_NAME]]"; import library "in_impl_extern"; -// CHECK:STDERR: fail_in_impl.impl.carbon:[[@LINE+4]]:1: error: `extern` entities must have a declaration in the API file [ExternRequiresDeclInApiFile] -// CHECK:STDERR: extern fn F() {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_in_impl.impl.carbon:[[@LINE+2]]:1-15: error: `extern` entities must have a declaration in the API file [ExternRequiresDeclInApiFile] // CHECK:STDERR: extern fn F() {} diff --git a/toolchain/check/testdata/function/definition/fail_decl_param_mismatch.carbon b/toolchain/check/testdata/function/definition/fail_decl_param_mismatch.carbon index e01d2aeecda7..be06e065b3e3 100644 --- a/toolchain/check/testdata/function/definition/fail_decl_param_mismatch.carbon +++ b/toolchain/check/testdata/function/definition/fail_decl_param_mismatch.carbon @@ -13,59 +13,37 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/definition/fail_decl_param_mismatch.carbon fn F(); -// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+7]]:1: error: redeclaration differs because of parameter count of 1 [RedeclParamCountDiffers] -// CHECK:STDERR: fn F(unused x: ()) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE-4]]:1: note: previously declared with parameter count of 0 [RedeclParamCountPrevious] -// CHECK:STDERR: fn F(); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+3]]:1-20: error: redeclaration differs because of parameter count of 1 [RedeclParamCountDiffers] +// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE-2]]:1-7: note: previously declared with parameter count of 0 [RedeclParamCountPrevious] // CHECK:STDERR: fn F(unused x: ()) {} fn G(x: ()); -// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+7]]:1: error: redeclaration differs because of parameter count of 0 [RedeclParamCountDiffers] -// CHECK:STDERR: fn G() {} -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE-4]]:1: note: previously declared with parameter count of 1 [RedeclParamCountPrevious] -// CHECK:STDERR: fn G(x: ()); -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+3]]:1-8: error: redeclaration differs because of parameter count of 0 [RedeclParamCountDiffers] +// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE-2]]:1-12: note: previously declared with parameter count of 1 [RedeclParamCountPrevious] // CHECK:STDERR: fn G() {} fn H(x: ()); -// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+4]]:16: error: `Core.Bool` implicitly referenced here, but package `Core` not found [CoreNotFound] -// CHECK:STDERR: fn H(unused x: bool) {} -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+2]]:16-19: error: `Core.Bool` implicitly referenced here, but package `Core` not found [CoreNotFound] // CHECK:STDERR: fn H(unused x: bool) {} fn I(); -// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+7]]:1: error: function redeclaration differs because return type is `()` [FunctionRedeclReturnTypeDiffers] -// CHECK:STDERR: fn I() -> () { return (); } -// CHECK:STDERR: ^~~~~~~~~~~~~~ -// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE-4]]:1: note: previously declared with no return type [FunctionRedeclReturnTypePreviousNoReturn] -// CHECK:STDERR: fn I(); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+3]]:1-14: error: function redeclaration differs because return type is `()` [FunctionRedeclReturnTypeDiffers] +// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE-2]]:1-7: note: previously declared with no return type [FunctionRedeclReturnTypePreviousNoReturn] // CHECK:STDERR: fn I() -> () { return (); } fn J() -> (); -// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+7]]:1: error: function redeclaration differs because no return type is provided [FunctionRedeclReturnTypeDiffersNoReturn] -// CHECK:STDERR: fn J() {} -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE-4]]:1: note: previously declared with return type `()` [FunctionRedeclReturnTypePrevious] -// CHECK:STDERR: fn J() -> (); -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+3]]:1-8: error: function redeclaration differs because no return type is provided [FunctionRedeclReturnTypeDiffersNoReturn] +// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE-2]]:1-13: note: previously declared with return type `()` [FunctionRedeclReturnTypePrevious] // CHECK:STDERR: fn J() {} fn K() -> (); -// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+7]]:1: error: function redeclaration differs because return type is `{}` [FunctionRedeclReturnTypeDiffers] -// CHECK:STDERR: fn K() -> {} { return {}; } -// CHECK:STDERR: ^~~~~~~~~~~~~~ -// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE-4]]:1: note: previously declared with return type `()` [FunctionRedeclReturnTypePrevious] -// CHECK:STDERR: fn K() -> (); -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+3]]:1-14: error: function redeclaration differs because return type is `{}` [FunctionRedeclReturnTypeDiffers] +// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE-2]]:1-13: note: previously declared with return type `()` [FunctionRedeclReturnTypePrevious] // CHECK:STDERR: fn K() -> {} { return {}; } @@ -80,29 +58,29 @@ fn K() -> {} { return {}; } // CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete] // CHECK:STDOUT: %x.param_patt: %pattern_type.cb1 = value_param_pattern [concrete] // CHECK:STDOUT: %x.patt.2180a6.1: %pattern_type.cb1 = wrapper_binding_pattern x, %x.param_patt [concrete] -// CHECK:STDOUT: %F.type.eb3ec9.2: type = fn_type @F.loc23 [concrete] +// CHECK:STDOUT: %F.type.eb3ec9.2: type = fn_type @F.loc19 [concrete] // CHECK:STDOUT: %F.7088cc.2: %F.type.eb3ec9.2 = struct_value () [concrete] // CHECK:STDOUT: %x.patt.2180a6.2: %pattern_type.cb1 = wrapper_binding_pattern x, %x.param_patt [concrete] -// CHECK:STDOUT: %G.type.f42045.1: type = fn_type @G.loc25 [concrete] +// CHECK:STDOUT: %G.type.f42045.1: type = fn_type @G.loc21 [concrete] // CHECK:STDOUT: %G.4228ed.1: %G.type.f42045.1 = struct_value () [concrete] -// CHECK:STDOUT: %G.type.f42045.2: type = fn_type @G.loc33 [concrete] +// CHECK:STDOUT: %G.type.f42045.2: type = fn_type @G.loc25 [concrete] // CHECK:STDOUT: %G.4228ed.2: %G.type.f42045.2 = struct_value () [concrete] -// CHECK:STDOUT: %H.type.c0bf33.1: type = fn_type @H.loc35 [concrete] +// CHECK:STDOUT: %H.type.c0bf33.1: type = fn_type @H.loc27 [concrete] // CHECK:STDOUT: %H.aacb46.1: %H.type.c0bf33.1 = struct_value () [concrete] -// CHECK:STDOUT: %H.type.c0bf33.2: type = fn_type @H.loc40 [concrete] +// CHECK:STDOUT: %H.type.c0bf33.2: type = fn_type @H.loc30 [concrete] // CHECK:STDOUT: %H.aacb46.2: %H.type.c0bf33.2 = struct_value () [concrete] -// CHECK:STDOUT: %I.type.4c8936.1: type = fn_type @I.loc42 [concrete] +// CHECK:STDOUT: %I.type.4c8936.1: type = fn_type @I.loc32 [concrete] // CHECK:STDOUT: %I.8a67f5.1: %I.type.4c8936.1 = struct_value () [concrete] // CHECK:STDOUT: %.262: Core.Form = init_form %empty_tuple.type [concrete] // CHECK:STDOUT: %return.param_patt.900: %pattern_type.cb1 = out_param_pattern [concrete] // CHECK:STDOUT: %return.patt.427: %pattern_type.cb1 = return_slot_pattern %return.param_patt.900, %empty_tuple.type [concrete] -// CHECK:STDOUT: %I.type.4c8936.2: type = fn_type @I.loc50 [concrete] +// CHECK:STDOUT: %I.type.4c8936.2: type = fn_type @I.loc36 [concrete] // CHECK:STDOUT: %I.8a67f5.2: %I.type.4c8936.2 = struct_value () [concrete] -// CHECK:STDOUT: %J.type.6304f1.1: type = fn_type @J.loc52 [concrete] +// CHECK:STDOUT: %J.type.6304f1.1: type = fn_type @J.loc38 [concrete] // CHECK:STDOUT: %J.64b370.1: %J.type.6304f1.1 = struct_value () [concrete] -// CHECK:STDOUT: %J.type.6304f1.2: type = fn_type @J.loc60 [concrete] +// CHECK:STDOUT: %J.type.6304f1.2: type = fn_type @J.loc42 [concrete] // CHECK:STDOUT: %J.64b370.2: %J.type.6304f1.2 = struct_value () [concrete] -// CHECK:STDOUT: %K.type.b73f4f.1: type = fn_type @K.loc62 [concrete] +// CHECK:STDOUT: %K.type.b73f4f.1: type = fn_type @K.loc44 [concrete] // CHECK:STDOUT: %K.4fd1e7.1: %K.type.b73f4f.1 = struct_value () [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete] @@ -110,101 +88,101 @@ fn K() -> {} { return {}; } // CHECK:STDOUT: %pattern_type.a96: type = pattern_type %empty_struct_type [concrete] // CHECK:STDOUT: %return.param_patt.296: %pattern_type.a96 = out_param_pattern [concrete] // CHECK:STDOUT: %return.patt.c45: %pattern_type.a96 = return_slot_pattern %return.param_patt.296, %empty_struct_type [concrete] -// CHECK:STDOUT: %K.type.b73f4f.2: type = fn_type @K.loc70 [concrete] +// CHECK:STDOUT: %K.type.b73f4f.2: type = fn_type @K.loc48 [concrete] // CHECK:STDOUT: %K.4fd1e7.2: %K.type.b73f4f.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { // CHECK:STDOUT: .F = %F.decl.loc15 -// CHECK:STDOUT: .G = %G.decl.loc25 -// CHECK:STDOUT: .H = %H.decl.loc35 -// CHECK:STDOUT: .I = %I.decl.loc42 -// CHECK:STDOUT: .J = %J.decl.loc52 -// CHECK:STDOUT: .K = %K.decl.loc62 +// CHECK:STDOUT: .G = %G.decl.loc21 +// CHECK:STDOUT: .H = %H.decl.loc27 +// CHECK:STDOUT: .I = %I.decl.loc32 +// CHECK:STDOUT: .J = %J.decl.loc38 +// CHECK:STDOUT: .K = %K.decl.loc44 // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl.loc15: %F.type.eb3ec9.1 = fn_decl @F.loc15 [concrete = constants.%F.7088cc.1] {} {} -// CHECK:STDOUT: %F.decl.loc23: %F.type.eb3ec9.2 = fn_decl @F.loc23 [concrete = constants.%F.7088cc.2] { +// CHECK:STDOUT: %F.decl.loc19: %F.type.eb3ec9.2 = fn_decl @F.loc19 [concrete = constants.%F.7088cc.2] { // CHECK:STDOUT: %x.param_patt: %pattern_type.cb1 = value_param_pattern [concrete = constants.%x.param_patt] // CHECK:STDOUT: %x.patt: %pattern_type.cb1 = wrapper_binding_pattern x, %x.param_patt [concrete = constants.%x.patt.2180a6.1] // CHECK:STDOUT: } { // CHECK:STDOUT: %x.param: %empty_tuple.type = value_param call_param0 -// CHECK:STDOUT: %.loc23_17.1: type = splice_block %.loc23_17.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc23_17.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc23_17.3: type = converted %.loc23_17.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc19_17.1: type = splice_block %.loc19_17.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc19_17.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc19_17.3: type = converted %.loc19_17.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %x: %empty_tuple.type = wrapper_binding x, %x.param // CHECK:STDOUT: } -// CHECK:STDOUT: %G.decl.loc25: %G.type.f42045.1 = fn_decl @G.loc25 [concrete = constants.%G.4228ed.1] { +// CHECK:STDOUT: %G.decl.loc21: %G.type.f42045.1 = fn_decl @G.loc21 [concrete = constants.%G.4228ed.1] { // CHECK:STDOUT: %x.param_patt: %pattern_type.cb1 = value_param_pattern [concrete = constants.%x.param_patt] // CHECK:STDOUT: %x.patt: %pattern_type.cb1 = wrapper_binding_pattern x, %x.param_patt [concrete = constants.%x.patt.2180a6.2] // CHECK:STDOUT: } { // CHECK:STDOUT: %x.param: %empty_tuple.type = value_param call_param0 -// CHECK:STDOUT: %.loc25_10.1: type = splice_block %.loc25_10.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc25_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc25_10.3: type = converted %.loc25_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc21_10.1: type = splice_block %.loc21_10.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc21_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc21_10.3: type = converted %.loc21_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %x: %empty_tuple.type = wrapper_binding x, %x.param // CHECK:STDOUT: } -// CHECK:STDOUT: %G.decl.loc33: %G.type.f42045.2 = fn_decl @G.loc33 [concrete = constants.%G.4228ed.2] {} {} -// CHECK:STDOUT: %H.decl.loc35: %H.type.c0bf33.1 = fn_decl @H.loc35 [concrete = constants.%H.aacb46.1] { +// CHECK:STDOUT: %G.decl.loc25: %G.type.f42045.2 = fn_decl @G.loc25 [concrete = constants.%G.4228ed.2] {} {} +// CHECK:STDOUT: %H.decl.loc27: %H.type.c0bf33.1 = fn_decl @H.loc27 [concrete = constants.%H.aacb46.1] { // CHECK:STDOUT: %x.param_patt: %pattern_type.cb1 = value_param_pattern [concrete = constants.%x.param_patt] // CHECK:STDOUT: %x.patt: %pattern_type.cb1 = wrapper_binding_pattern x, %x.param_patt [concrete = constants.%x.patt.2180a6.2] // CHECK:STDOUT: } { // CHECK:STDOUT: %x.param: %empty_tuple.type = value_param call_param0 -// CHECK:STDOUT: %.loc35_10.1: type = splice_block %.loc35_10.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc35_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc35_10.3: type = converted %.loc35_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc27_10.1: type = splice_block %.loc27_10.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc27_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc27_10.3: type = converted %.loc27_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %x: %empty_tuple.type = wrapper_binding x, %x.param // CHECK:STDOUT: } -// CHECK:STDOUT: %H.decl.loc40: %H.type.c0bf33.2 = fn_decl @H.loc40 [concrete = constants.%H.aacb46.2] { +// CHECK:STDOUT: %H.decl.loc30: %H.type.c0bf33.2 = fn_decl @H.loc30 [concrete = constants.%H.aacb46.2] { // CHECK:STDOUT: %x.param_patt: = value_param_pattern [concrete = ] // CHECK:STDOUT: %x.patt: = wrapper_binding_pattern x, %x.param_patt [concrete = ] // CHECK:STDOUT: } { // CHECK:STDOUT: %x.param: = value_param call_param0 -// CHECK:STDOUT: %.loc40: type = type_literal [concrete = ] +// CHECK:STDOUT: %.loc30: type = type_literal [concrete = ] // CHECK:STDOUT: %x: = wrapper_binding x, [concrete = ] // CHECK:STDOUT: } -// CHECK:STDOUT: %I.decl.loc42: %I.type.4c8936.1 = fn_decl @I.loc42 [concrete = constants.%I.8a67f5.1] {} {} -// CHECK:STDOUT: %I.decl.loc50: %I.type.4c8936.2 = fn_decl @I.loc50 [concrete = constants.%I.8a67f5.2] { +// CHECK:STDOUT: %I.decl.loc32: %I.type.4c8936.1 = fn_decl @I.loc32 [concrete = constants.%I.8a67f5.1] {} {} +// CHECK:STDOUT: %I.decl.loc36: %I.type.4c8936.2 = fn_decl @I.loc36 [concrete = constants.%I.8a67f5.2] { // CHECK:STDOUT: %return.param_patt: %pattern_type.cb1 = out_param_pattern [concrete = constants.%return.param_patt.900] -// CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern %return.param_patt, %.loc50_12.2 [concrete = constants.%return.patt.427] +// CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern %return.param_patt, %.loc36_12.2 [concrete = constants.%return.patt.427] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc50_12.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc50_12.2: type = converted %.loc50_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc50_12.3: Core.Form = init_form %.loc50_12.2 [concrete = constants.%.262] +// CHECK:STDOUT: %.loc36_12.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc36_12.2: type = converted %.loc36_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc36_12.3: Core.Form = init_form %.loc36_12.2 [concrete = constants.%.262] // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0 // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %J.decl.loc52: %J.type.6304f1.1 = fn_decl @J.loc52 [concrete = constants.%J.64b370.1] { +// CHECK:STDOUT: %J.decl.loc38: %J.type.6304f1.1 = fn_decl @J.loc38 [concrete = constants.%J.64b370.1] { // CHECK:STDOUT: %return.param_patt: %pattern_type.cb1 = out_param_pattern [concrete = constants.%return.param_patt.900] -// CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern %return.param_patt, %.loc52_12.2 [concrete = constants.%return.patt.427] +// CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern %return.param_patt, %.loc38_12.2 [concrete = constants.%return.patt.427] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc52_12.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc52_12.2: type = converted %.loc52_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc52_12.3: Core.Form = init_form %.loc52_12.2 [concrete = constants.%.262] +// CHECK:STDOUT: %.loc38_12.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc38_12.2: type = converted %.loc38_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc38_12.3: Core.Form = init_form %.loc38_12.2 [concrete = constants.%.262] // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0 // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %J.decl.loc60: %J.type.6304f1.2 = fn_decl @J.loc60 [concrete = constants.%J.64b370.2] {} {} -// CHECK:STDOUT: %K.decl.loc62: %K.type.b73f4f.1 = fn_decl @K.loc62 [concrete = constants.%K.4fd1e7.1] { +// CHECK:STDOUT: %J.decl.loc42: %J.type.6304f1.2 = fn_decl @J.loc42 [concrete = constants.%J.64b370.2] {} {} +// CHECK:STDOUT: %K.decl.loc44: %K.type.b73f4f.1 = fn_decl @K.loc44 [concrete = constants.%K.4fd1e7.1] { // CHECK:STDOUT: %return.param_patt: %pattern_type.cb1 = out_param_pattern [concrete = constants.%return.param_patt.900] -// CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern %return.param_patt, %.loc62_12.2 [concrete = constants.%return.patt.427] +// CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern %return.param_patt, %.loc44_12.2 [concrete = constants.%return.patt.427] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc62_12.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc62_12.2: type = converted %.loc62_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc62_12.3: Core.Form = init_form %.loc62_12.2 [concrete = constants.%.262] +// CHECK:STDOUT: %.loc44_12.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc44_12.2: type = converted %.loc44_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc44_12.3: Core.Form = init_form %.loc44_12.2 [concrete = constants.%.262] // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0 // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %K.decl.loc70: %K.type.b73f4f.2 = fn_decl @K.loc70 [concrete = constants.%K.4fd1e7.2] { +// CHECK:STDOUT: %K.decl.loc48: %K.type.b73f4f.2 = fn_decl @K.loc48 [concrete = constants.%K.4fd1e7.2] { // CHECK:STDOUT: %return.param_patt: %pattern_type.a96 = out_param_pattern [concrete = constants.%return.param_patt.296] -// CHECK:STDOUT: %return.patt: %pattern_type.a96 = return_slot_pattern %return.param_patt, %.loc70_12.2 [concrete = constants.%return.patt.c45] +// CHECK:STDOUT: %return.patt: %pattern_type.a96 = return_slot_pattern %return.param_patt, %.loc48_12.2 [concrete = constants.%return.patt.c45] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc70_12.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc70_12.2: type = converted %.loc70_12.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %.loc70_12.3: Core.Form = init_form %.loc70_12.2 [concrete = constants.%.469] +// CHECK:STDOUT: %.loc48_12.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc48_12.2: type = converted %.loc48_12.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc48_12.3: Core.Form = init_form %.loc48_12.2 [concrete = constants.%.469] // CHECK:STDOUT: %return.param: ref %empty_struct_type = out_param call_param0 // CHECK:STDOUT: %return: ref %empty_struct_type = return_slot %return.param // CHECK:STDOUT: } @@ -212,49 +190,49 @@ fn K() -> {} { return {}; } // CHECK:STDOUT: // CHECK:STDOUT: fn @F.loc15(); // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.loc23(%x.param: %empty_tuple.type) { +// CHECK:STDOUT: fn @F.loc19(%x.param: %empty_tuple.type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @G.loc25(%x.param: %empty_tuple.type); +// CHECK:STDOUT: fn @G.loc21(%x.param: %empty_tuple.type); // CHECK:STDOUT: -// CHECK:STDOUT: fn @G.loc33() { +// CHECK:STDOUT: fn @G.loc25() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @H.loc35(%x.param: %empty_tuple.type); +// CHECK:STDOUT: fn @H.loc27(%x.param: %empty_tuple.type); // CHECK:STDOUT: -// CHECK:STDOUT: fn @H.loc40(%x.param: ) { +// CHECK:STDOUT: fn @H.loc30(%x.param: ) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @I.loc42(); +// CHECK:STDOUT: fn @I.loc32(); // CHECK:STDOUT: -// CHECK:STDOUT: fn @I.loc50() -> out %return.param: %empty_tuple.type { +// CHECK:STDOUT: fn @I.loc36() -> out %return.param: %empty_tuple.type { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc50_24.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc50_24.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc50_25: init %empty_tuple.type = converted %.loc50_24.1, %.loc50_24.2 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: return %.loc50_25 +// CHECK:STDOUT: %.loc36_24.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc36_24.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc36_25: init %empty_tuple.type = converted %.loc36_24.1, %.loc36_24.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: return %.loc36_25 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @J.loc52() -> out %return.param: %empty_tuple.type; +// CHECK:STDOUT: fn @J.loc38() -> out %return.param: %empty_tuple.type; // CHECK:STDOUT: -// CHECK:STDOUT: fn @J.loc60() { +// CHECK:STDOUT: fn @J.loc42() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @K.loc62() -> out %return.param: %empty_tuple.type; +// CHECK:STDOUT: fn @K.loc44() -> out %return.param: %empty_tuple.type; // CHECK:STDOUT: -// CHECK:STDOUT: fn @K.loc70() -> out %return.param: %empty_struct_type { +// CHECK:STDOUT: fn @K.loc48() -> out %return.param: %empty_struct_type { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc70_24.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc70_24.2: init %empty_struct_type = struct_init () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc70_25: init %empty_struct_type = converted %.loc70_24.1, %.loc70_24.2 [concrete = constants.%empty_struct] -// CHECK:STDOUT: return %.loc70_25 +// CHECK:STDOUT: %.loc48_24.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc48_24.2: init %empty_struct_type = struct_init () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc48_25: init %empty_struct_type = converted %.loc48_24.1, %.loc48_24.2 [concrete = constants.%empty_struct] +// CHECK:STDOUT: return %.loc48_25 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/definition/fail_local_decl.carbon b/toolchain/check/testdata/function/definition/fail_local_decl.carbon index 7240736e5c77..edffe22c88b4 100644 --- a/toolchain/check/testdata/function/definition/fail_local_decl.carbon +++ b/toolchain/check/testdata/function/definition/fail_local_decl.carbon @@ -15,19 +15,13 @@ library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: fail_virtual.carbon:[[@LINE+4]]:3: error: `default` not allowed; requires interface scope [ModifierRequiresInterface] - // CHECK:STDERR: default fn F(); - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_virtual.carbon:[[@LINE+2]]:3-9: error: `default` not allowed; requires interface scope [ModifierRequiresInterface] // CHECK:STDERR: default fn F(); - // CHECK:STDERR: fail_virtual.carbon:[[@LINE+4]]:3: error: `override` not allowed; requires class scope [ModifierRequiresClass] - // CHECK:STDERR: override fn G(); - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_virtual.carbon:[[@LINE+2]]:3-10: error: `override` not allowed; requires class scope [ModifierRequiresClass] // CHECK:STDERR: override fn G(); - // CHECK:STDERR: fail_virtual.carbon:[[@LINE+4]]:3: error: `virtual` not allowed; requires class scope [ModifierRequiresClass] - // CHECK:STDERR: virtual fn H(); - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_virtual.carbon:[[@LINE+2]]:3-9: error: `virtual` not allowed; requires class scope [ModifierRequiresClass] // CHECK:STDERR: virtual fn H(); } @@ -37,14 +31,10 @@ fn F() { library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: fail_access.carbon:[[@LINE+4]]:3: error: `private` not allowed; requires class or file scope [ModifierPrivateNotAllowed] - // CHECK:STDERR: private var unused v: {} = {}; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_access.carbon:[[@LINE+2]]:3-9: error: `private` not allowed; requires class or file scope [ModifierPrivateNotAllowed] // CHECK:STDERR: private var unused v: {} = {}; - // CHECK:STDERR: fail_access.carbon:[[@LINE+4]]:3: error: `protected` not allowed; requires class scope [ModifierProtectedNotAllowed] - // CHECK:STDERR: protected var unused w: {} = {}; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_access.carbon:[[@LINE+2]]:3-11: error: `protected` not allowed; requires class scope [ModifierProtectedNotAllowed] // CHECK:STDERR: protected var unused w: {} = {}; } diff --git a/toolchain/check/testdata/function/definition/fail_redef.carbon b/toolchain/check/testdata/function/definition/fail_redef.carbon index 9d45e24f0a38..b246805fb300 100644 --- a/toolchain/check/testdata/function/definition/fail_redef.carbon +++ b/toolchain/check/testdata/function/definition/fail_redef.carbon @@ -13,12 +13,8 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/definition/fail_redef.carbon fn F() {} -// CHECK:STDERR: fail_redef.carbon:[[@LINE+7]]:1: error: redefinition of `fn F` [RedeclRedef] -// CHECK:STDERR: fn F() {} -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_redef.carbon:[[@LINE-4]]:1: note: previously defined here [RedeclPrevDef] -// CHECK:STDERR: fn F() {} -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_redef.carbon:[[@LINE+3]]:1-8: error: redefinition of `fn F` [RedeclRedef] +// CHECK:STDERR: fail_redef.carbon:[[@LINE-2]]:1-8: note: previously defined here [RedeclPrevDef] // CHECK:STDERR: fn F() {} @@ -28,7 +24,7 @@ fn F() {} // CHECK:STDOUT: type: type = facet_type [concrete] // CHECK:STDOUT: %F.type.eb3ec9.1: type = fn_type @F.loc15 [concrete] // CHECK:STDOUT: %F.7088cc.1: %F.type.eb3ec9.1 = struct_value () [concrete] -// CHECK:STDOUT: %F.type.eb3ec9.2: type = fn_type @F.loc23 [concrete] +// CHECK:STDOUT: %F.type.eb3ec9.2: type = fn_type @F.loc19 [concrete] // CHECK:STDOUT: %F.7088cc.2: %F.type.eb3ec9.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -37,7 +33,7 @@ fn F() {} // CHECK:STDOUT: .F = %F.decl.loc15 // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl.loc15: %F.type.eb3ec9.1 = fn_decl @F.loc15 [concrete = constants.%F.7088cc.1] {} {} -// CHECK:STDOUT: %F.decl.loc23: %F.type.eb3ec9.2 = fn_decl @F.loc23 [concrete = constants.%F.7088cc.2] {} {} +// CHECK:STDOUT: %F.decl.loc19: %F.type.eb3ec9.2 = fn_decl @F.loc19 [concrete = constants.%F.7088cc.2] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F.loc15() { @@ -45,7 +41,7 @@ fn F() {} // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.loc23() { +// CHECK:STDOUT: fn @F.loc19() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/definition/implicit_import.carbon b/toolchain/check/testdata/function/definition/implicit_import.carbon index ec38e3051571..00136ed0549f 100644 --- a/toolchain/check/testdata/function/definition/implicit_import.carbon +++ b/toolchain/check/testdata/function/definition/implicit_import.carbon @@ -34,13 +34,9 @@ extern fn A(); impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_extern_api.impl.carbon:[[@LINE+8]]:1: error: redeclarations of `fn A` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: fn A() {} -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_extern_api.impl.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: extern_api.carbon:4:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: extern fn A(); -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_extern_api.impl.carbon:[[@LINE+4]]:1-8: error: redeclarations of `fn A` must match use of `extern` [RedeclExternMismatch] +// CHECK:STDERR: imported from: fail_extern_api.impl.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: extern_api.carbon:4:1-14: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: fn A() {} @@ -54,13 +50,9 @@ fn A(); impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_extern_impl.impl.carbon:[[@LINE+8]]:1: error: redeclarations of `fn A` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: extern fn A() {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_extern_impl.impl.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: extern_impl.carbon:4:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: fn A(); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_extern_impl.impl.carbon:[[@LINE+4]]:1-15: error: redeclarations of `fn A` must match use of `extern` [RedeclExternMismatch] +// CHECK:STDERR: imported from: fail_extern_impl.impl.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: extern_impl.carbon:4:1-7: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: extern fn A() {} @@ -74,13 +66,9 @@ fn A() {} impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_redecl_after_def.impl.carbon:[[@LINE+8]]:1: error: redeclaration of `fn A` is redundant [RedeclRedundant] -// CHECK:STDERR: fn A(); -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_redecl_after_def.impl.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: redecl_after_def.carbon:4:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: fn A() {} -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_redecl_after_def.impl.carbon:[[@LINE+4]]:1-7: error: redeclaration of `fn A` is redundant [RedeclRedundant] +// CHECK:STDERR: imported from: fail_redecl_after_def.impl.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: redecl_after_def.carbon:4:1-8: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: fn A(); @@ -94,13 +82,9 @@ fn A() {} impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_redef_after_def.impl.carbon:[[@LINE+8]]:1: error: redefinition of `fn A` [RedeclRedef] -// CHECK:STDERR: fn A() {} -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_redef_after_def.impl.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: redef_after_def.carbon:4:1: note: previously defined here [RedeclPrevDef] -// CHECK:STDERR: fn A() {} -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_redef_after_def.impl.carbon:[[@LINE+4]]:1-8: error: redefinition of `fn A` [RedeclRedef] +// CHECK:STDERR: imported from: fail_redef_after_def.impl.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: redef_after_def.carbon:4:1-8: note: previously defined here [RedeclPrevDef] // CHECK:STDERR: fn A() {} @@ -115,13 +99,9 @@ alias B = A; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_def_alias.impl.carbon:[[@LINE+8]]:4: error: duplicate name `B` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: fn B() {} -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_def_alias.impl.carbon:[[@LINE-5]]:1: in import [InImport] +// CHECK:STDERR: fail_def_alias.impl.carbon:[[@LINE+4]]:4: error: duplicate name `B` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_def_alias.impl.carbon:[[@LINE-3]]:1 [InImport] // CHECK:STDERR: def_alias.carbon:5:7: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: alias B = A; -// CHECK:STDERR: ^ // CHECK:STDERR: fn B() {} @@ -307,7 +287,7 @@ fn B() {} // CHECK:STDOUT: type: type = facet_type [concrete] // CHECK:STDOUT: %A.type.9f4a6d.1: type = fn_type @A.1 [concrete] // CHECK:STDOUT: %A.921eb9.1: %A.type.9f4a6d.1 = struct_value () [concrete] -// CHECK:STDOUT: %A.type.9f4a6d.2: type = fn_type @A.loc12 [concrete] +// CHECK:STDOUT: %A.type.9f4a6d.2: type = fn_type @A.loc8 [concrete] // CHECK:STDOUT: %A.921eb9.2: %A.type.9f4a6d.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -321,12 +301,12 @@ fn B() {} // CHECK:STDOUT: } // CHECK:STDOUT: %default.import.loc2_31.1 = import // CHECK:STDOUT: %default.import.loc2_31.2 = import -// CHECK:STDOUT: %A.decl: %A.type.9f4a6d.2 = fn_decl @A.loc12 [concrete = constants.%A.921eb9.2] {} {} +// CHECK:STDOUT: %A.decl: %A.type.9f4a6d.2 = fn_decl @A.loc8 [concrete = constants.%A.921eb9.2] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A.1 [from "redef_after_def.carbon"]; // CHECK:STDOUT: -// CHECK:STDOUT: fn @A.loc12() { +// CHECK:STDOUT: fn @A.loc8() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/definition/import.carbon b/toolchain/check/testdata/function/definition/import.carbon index 22ecdab89d14..55dcb2119aa7 100644 --- a/toolchain/check/testdata/function/definition/import.carbon +++ b/toolchain/check/testdata/function/definition/import.carbon @@ -51,22 +51,14 @@ library "[[@TEST_NAME]]"; import library "fns"; -// CHECK:STDERR: fail_def_ownership.carbon:[[@LINE+8]]:1: error: redeclaration of `fn A` is redundant [RedeclRedundant] -// CHECK:STDERR: fn A() {}; -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_def_ownership.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: fns.carbon:4:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: fn A() {} -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_def_ownership.carbon:[[@LINE+4]]:1-8: error: redeclaration of `fn A` is redundant [RedeclRedundant] +// CHECK:STDERR: imported from: fail_def_ownership.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: fns.carbon:4:1-8: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: fn A() {}; -// CHECK:STDERR: fail_def_ownership.carbon:[[@LINE+8]]:1: error: redeclaration of `fn B` is redundant [RedeclRedundant] -// CHECK:STDERR: fn B(b: i32) -> i32; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_def_ownership.carbon:[[@LINE-14]]:1: in import [InImport] -// CHECK:STDERR: fns.carbon:5:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: fn B(b: i32) -> i32 { return b; } -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_def_ownership.carbon:[[@LINE+4]]:1-20: error: redeclaration of `fn B` is redundant [RedeclRedundant] +// CHECK:STDERR: imported from: fail_def_ownership.carbon:[[@LINE-8]]:1 [InImport] +// CHECK:STDERR: fns.carbon:5:1-21: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: fn B(b: i32) -> i32; @@ -76,23 +68,15 @@ library "[[@TEST_NAME]]"; import library "extern"; -// CHECK:STDERR: fail_redecl_then_def.carbon:[[@LINE+8]]:1: error: redeclarations of `fn A` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: fn A(); -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_redecl_then_def.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: extern.carbon:4:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: extern fn A(); -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_redecl_then_def.carbon:[[@LINE+4]]:1-7: error: redeclarations of `fn A` must match use of `extern` [RedeclExternMismatch] +// CHECK:STDERR: imported from: fail_redecl_then_def.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: extern.carbon:4:1-14: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: fn A(); -// CHECK:STDERR: fail_redecl_then_def.carbon:[[@LINE+8]]:1: error: redeclarations of `fn A` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: fn A() {} -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_redecl_then_def.carbon:[[@LINE-15]]:1: in import [InImport] -// CHECK:STDERR: extern.carbon:4:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: extern fn A(); -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_redecl_then_def.carbon:[[@LINE+4]]:1-8: error: redeclarations of `fn A` must match use of `extern` [RedeclExternMismatch] +// CHECK:STDERR: imported from: fail_redecl_then_def.carbon:[[@LINE-9]]:1 [InImport] +// CHECK:STDERR: extern.carbon:4:1-14: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: fn A() {} @@ -102,13 +86,9 @@ library "[[@TEST_NAME]]"; import library "fns"; -// CHECK:STDERR: fail_mix_extern_decl.carbon:[[@LINE+8]]:1: error: redeclarations of `fn D` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: extern fn D(); -// CHECK:STDERR: ^~~~~~~~~~~~~~ -// CHECK:STDERR: fail_mix_extern_decl.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: fns.carbon:7:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: fn D(); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_mix_extern_decl.carbon:[[@LINE+4]]:1-14: error: redeclarations of `fn D` must match use of `extern` [RedeclExternMismatch] +// CHECK:STDERR: imported from: fail_mix_extern_decl.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: fns.carbon:7:1-7: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: extern fn D(); @@ -433,7 +413,7 @@ fn D() {} // CHECK:STDOUT: type: type = facet_type [concrete] // CHECK:STDOUT: %A.type.9f4a6d.1: type = fn_type @A.1 [concrete] // CHECK:STDOUT: %A.921eb9.1: %A.type.9f4a6d.1 = struct_value () [concrete] -// CHECK:STDOUT: %A.type.9f4a6d.2: type = fn_type @A.loc14 [concrete] +// CHECK:STDOUT: %A.type.9f4a6d.2: type = fn_type @A.loc10 [concrete] // CHECK:STDOUT: %A.921eb9.2: %A.type.9f4a6d.2 = struct_value () [concrete] // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] // CHECK:STDOUT: %Int.type: type = parameterized_class_name_type @Int [concrete] @@ -466,12 +446,12 @@ fn D() {} // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: %A.decl: %A.type.9f4a6d.2 = fn_decl @A.loc14 [concrete = constants.%A.921eb9.2] {} {} +// CHECK:STDOUT: %A.decl: %A.type.9f4a6d.2 = fn_decl @A.loc10 [concrete = constants.%A.921eb9.2] {} {} // CHECK:STDOUT: %B.decl: %B.type = fn_decl @B [concrete = constants.%B] {} { -// CHECK:STDOUT: %i32.loc23_17: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc23: Core.Form = init_form %i32.loc23_17 [concrete = constants.%.0b3] +// CHECK:STDOUT: %i32.loc15_17: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc15: Core.Form = init_form %i32.loc15_17 [concrete = constants.%.0b3] // CHECK:STDOUT: %b.param: %i32 = value_param call_param0 -// CHECK:STDOUT: %i32.loc23_9: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc15_9: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %b: %i32 = wrapper_binding b, %b.param // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param1 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param @@ -480,7 +460,7 @@ fn D() {} // CHECK:STDOUT: // CHECK:STDOUT: fn @A.1 [from "fns.carbon"]; // CHECK:STDOUT: -// CHECK:STDOUT: fn @A.loc14() { +// CHECK:STDOUT: fn @A.loc10() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -504,13 +484,13 @@ fn D() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .A = %A.decl.loc14 +// CHECK:STDOUT: .A = %A.decl.loc10 // CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: %A.decl.loc14: %A.type = fn_decl @A [concrete = constants.%A] {} {} -// CHECK:STDOUT: %A.decl.loc24: %A.type = fn_decl @A [concrete = constants.%A] {} {} +// CHECK:STDOUT: %A.decl.loc10: %A.type = fn_decl @A [concrete = constants.%A] {} {} +// CHECK:STDOUT: %A.decl.loc16: %A.type = fn_decl @A [concrete = constants.%A] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: extern fn @A() [from "extern.carbon"] { @@ -541,13 +521,13 @@ fn D() {} // CHECK:STDOUT: .A = imports.%Main.A // CHECK:STDOUT: .B = imports.%Main.B // CHECK:STDOUT: .C = imports.%Main.C -// CHECK:STDOUT: .D = %D.decl.loc14 +// CHECK:STDOUT: .D = %D.decl.loc10 // CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: %D.decl.loc14: %D.type = fn_decl @D [concrete = constants.%D] {} {} -// CHECK:STDOUT: %D.decl.loc16: %D.type = fn_decl @D [concrete = constants.%D] {} {} +// CHECK:STDOUT: %D.decl.loc10: %D.type = fn_decl @D [concrete = constants.%D] {} {} +// CHECK:STDOUT: %D.decl.loc12: %D.type = fn_decl @D [concrete = constants.%D] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @D() [from "fns.carbon"] { diff --git a/toolchain/check/testdata/function/definition/import_access.carbon b/toolchain/check/testdata/function/definition/import_access.carbon index 70bb0083207c..e4413ad11357 100644 --- a/toolchain/check/testdata/function/definition/import_access.carbon +++ b/toolchain/check/testdata/function/definition/import_access.carbon @@ -52,9 +52,7 @@ package Test library "[[@TEST_NAME]]"; import library "def"; -// CHECK:STDERR: fail_local_def.carbon:[[@LINE+4]]:13: error: name `Def` not found [NameNotFound] -// CHECK:STDERR: var f: () = Def(); -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_local_def.carbon:[[@LINE+2]]:13-15: error: name `Def` not found [NameNotFound] // CHECK:STDERR: var f: () = Def(); @@ -64,9 +62,7 @@ package Other library "[[@TEST_NAME]]"; import Test library "def"; -// CHECK:STDERR: fail_other_def.carbon:[[@LINE+4]]:13: error: member name `Def` not found in `Test` [MemberNameNotFoundInInstScope] -// CHECK:STDERR: var f: () = Test.Def(); -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_other_def.carbon:[[@LINE+2]]:13-20: error: member name `Def` not found in `Test` [MemberNameNotFoundInInstScope] // CHECK:STDERR: var f: () = Test.Def(); @@ -82,9 +78,7 @@ package Test library "[[@TEST_NAME]]"; import library "forward_with_def"; -// CHECK:STDERR: fail_local_forward_with_def.carbon:[[@LINE+4]]:13: error: name `ForwardWithDef` not found [NameNotFound] -// CHECK:STDERR: var f: () = ForwardWithDef(); -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_local_forward_with_def.carbon:[[@LINE+2]]:13-26: error: name `ForwardWithDef` not found [NameNotFound] // CHECK:STDERR: var f: () = ForwardWithDef(); @@ -94,9 +88,7 @@ package Other library "[[@TEST_NAME]]"; import Test library "forward_with_def"; -// CHECK:STDERR: fail_other_forward_with_def.carbon:[[@LINE+4]]:13: error: member name `ForwardWithDef` not found in `Test` [MemberNameNotFoundInInstScope] -// CHECK:STDERR: var f: () = Test.ForwardWithDef(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_other_forward_with_def.carbon:[[@LINE+2]]:13-31: error: member name `ForwardWithDef` not found in `Test` [MemberNameNotFoundInInstScope] // CHECK:STDERR: var f: () = Test.ForwardWithDef(); @@ -114,9 +106,7 @@ package Test library "[[@TEST_NAME]]"; import library "forward"; -// CHECK:STDERR: fail_local_forward.carbon:[[@LINE+4]]:13: error: name `Forward` not found [NameNotFound] -// CHECK:STDERR: var f: () = Forward(); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_local_forward.carbon:[[@LINE+2]]:13-19: error: name `Forward` not found [NameNotFound] // CHECK:STDERR: var f: () = Forward(); @@ -126,9 +116,7 @@ package Other library "[[@TEST_NAME]]"; import Test library "forward"; -// CHECK:STDERR: fail_other_forward.carbon:[[@LINE+4]]:13: error: member name `Forward` not found in `Test` [MemberNameNotFoundInInstScope] -// CHECK:STDERR: var f: () = Test.Forward(); -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_other_forward.carbon:[[@LINE+2]]:13-24: error: member name `Forward` not found in `Test` [MemberNameNotFoundInInstScope] // CHECK:STDERR: var f: () = Test.Forward(); @@ -262,9 +250,9 @@ private fn Redecl() {} // CHECK:STDOUT: } // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %f.var: ref %empty_tuple.type = var_storage %f.var_patt [concrete] -// CHECK:STDOUT: %.loc10_9.1: type = splice_block %.loc10_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc10_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc10_9.3: type = converted %.loc10_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc8_9.1: type = splice_block %.loc8_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc8_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_9.3: type = converted %.loc8_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %f: ref %empty_tuple.type = wrapper_binding f, %f.var [concrete = %f.var] // CHECK:STDOUT: name_binding_decl { @@ -305,9 +293,9 @@ private fn Redecl() {} // CHECK:STDOUT: } // CHECK:STDOUT: %Test.import = import Test // CHECK:STDOUT: %f.var: ref %empty_tuple.type = var_storage %f.var_patt [concrete] -// CHECK:STDOUT: %.loc10_9.1: type = splice_block %.loc10_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc10_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc10_9.3: type = converted %.loc10_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc8_9.1: type = splice_block %.loc8_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc8_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_9.3: type = converted %.loc8_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %f: ref %empty_tuple.type = wrapper_binding f, %f.var [concrete = %f.var] // CHECK:STDOUT: name_binding_decl { @@ -388,9 +376,9 @@ private fn Redecl() {} // CHECK:STDOUT: } // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %f.var: ref %empty_tuple.type = var_storage %f.var_patt [concrete] -// CHECK:STDOUT: %.loc10_9.1: type = splice_block %.loc10_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc10_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc10_9.3: type = converted %.loc10_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc8_9.1: type = splice_block %.loc8_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc8_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_9.3: type = converted %.loc8_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %f: ref %empty_tuple.type = wrapper_binding f, %f.var [concrete = %f.var] // CHECK:STDOUT: name_binding_decl { @@ -431,9 +419,9 @@ private fn Redecl() {} // CHECK:STDOUT: } // CHECK:STDOUT: %Test.import = import Test // CHECK:STDOUT: %f.var: ref %empty_tuple.type = var_storage %f.var_patt [concrete] -// CHECK:STDOUT: %.loc10_9.1: type = splice_block %.loc10_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc10_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc10_9.3: type = converted %.loc10_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc8_9.1: type = splice_block %.loc8_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc8_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_9.3: type = converted %.loc8_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %f: ref %empty_tuple.type = wrapper_binding f, %f.var [concrete = %f.var] // CHECK:STDOUT: name_binding_decl { @@ -518,9 +506,9 @@ private fn Redecl() {} // CHECK:STDOUT: } // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %f.var: ref %empty_tuple.type = var_storage %f.var_patt [concrete] -// CHECK:STDOUT: %.loc10_9.1: type = splice_block %.loc10_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc10_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc10_9.3: type = converted %.loc10_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc8_9.1: type = splice_block %.loc8_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc8_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_9.3: type = converted %.loc8_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %f: ref %empty_tuple.type = wrapper_binding f, %f.var [concrete = %f.var] // CHECK:STDOUT: name_binding_decl { @@ -561,9 +549,9 @@ private fn Redecl() {} // CHECK:STDOUT: } // CHECK:STDOUT: %Test.import = import Test // CHECK:STDOUT: %f.var: ref %empty_tuple.type = var_storage %f.var_patt [concrete] -// CHECK:STDOUT: %.loc10_9.1: type = splice_block %.loc10_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc10_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc10_9.3: type = converted %.loc10_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc8_9.1: type = splice_block %.loc8_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc8_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_9.3: type = converted %.loc8_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %f: ref %empty_tuple.type = wrapper_binding f, %f.var [concrete = %f.var] // CHECK:STDOUT: name_binding_decl { diff --git a/toolchain/check/testdata/function/definition/syntactic_merge.carbon b/toolchain/check/testdata/function/definition/syntactic_merge.carbon index ba70295c8e69..e3c05c68cff9 100644 --- a/toolchain/check/testdata/function/definition/syntactic_merge.carbon +++ b/toolchain/check/testdata/function/definition/syntactic_merge.carbon @@ -41,12 +41,8 @@ library "[[@TEST_NAME]]"; class C {} fn Foo(a: C); -// CHECK:STDERR: fail_parens.carbon:[[@LINE+7]]:18: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: fn Foo(unused a: (C)) {} -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_parens.carbon:[[@LINE-4]]:11: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] -// CHECK:STDERR: fn Foo(a: C); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_parens.carbon:[[@LINE+3]]:18: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] +// CHECK:STDERR: fail_parens.carbon:[[@LINE-2]]:11: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] // CHECK:STDERR: fn Foo(unused a: (C)) {} @@ -56,22 +52,14 @@ library "[[@TEST_NAME]]"; class C {} -// CHECK:STDERR: fail_only_implicit_params.carbon:[[@LINE+8]]:8: error: implicit parameters of functions must be constant [ImplictParamMustBeConstant] -// CHECK:STDERR: fn Foo[runtime a: C]; -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_only_implicit_params.carbon:[[@LINE+4]]:8-19: error: implicit parameters of functions must be constant [ImplictParamMustBeConstant] // CHECK:STDERR: -// CHECK:STDERR: fail_only_implicit_params.carbon:[[@LINE+4]]:1: error: semantics TODO: `function with positional parameters` [SemanticsTodo] -// CHECK:STDERR: fn Foo[runtime a: C]; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_only_implicit_params.carbon:[[@LINE+2]]:1-21: error: semantics TODO: `function with positional parameters` [SemanticsTodo] // CHECK:STDERR: fn Foo[runtime a: C]; -// CHECK:STDERR: fail_only_implicit_params.carbon:[[@LINE+8]]:8: error: implicit parameters of functions must be constant [ImplictParamMustBeConstant] -// CHECK:STDERR: fn Foo[runtime a: (C)] {} -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_only_implicit_params.carbon:[[@LINE+4]]:8-21: error: implicit parameters of functions must be constant [ImplictParamMustBeConstant] // CHECK:STDERR: -// CHECK:STDERR: fail_only_implicit_params.carbon:[[@LINE+4]]:1: error: semantics TODO: `function with positional parameters` [SemanticsTodo] -// CHECK:STDERR: fn Foo[runtime a: (C)] {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_only_implicit_params.carbon:[[@LINE+2]]:1-24: error: semantics TODO: `function with positional parameters` [SemanticsTodo] // CHECK:STDERR: fn Foo[runtime a: (C)] {} @@ -82,12 +70,8 @@ library "[[@TEST_NAME]]"; class C {} fn Foo(_: C); -// CHECK:STDERR: fail_raw_identifier.carbon:[[@LINE+7]]:11: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: fn Foo(_: r#C) {} -// CHECK:STDERR: ^~~ -// CHECK:STDERR: fail_raw_identifier.carbon:[[@LINE-4]]:11: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] -// CHECK:STDERR: fn Foo(_: C); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_raw_identifier.carbon:[[@LINE+3]]:11-13: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] +// CHECK:STDERR: fail_raw_identifier.carbon:[[@LINE-2]]:11: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] // CHECK:STDERR: fn Foo(_: r#C) {} @@ -116,12 +100,8 @@ class C {} alias D = C; fn Foo(a: C); -// CHECK:STDERR: fail_name_mismatch.carbon:[[@LINE+7]]:15: error: redeclaration differs at parameter 1 [RedeclParamDiffers] -// CHECK:STDERR: fn Foo(unused b: D) {} -// CHECK:STDERR: ^~~~ -// CHECK:STDERR: fail_name_mismatch.carbon:[[@LINE-4]]:8: note: previous declaration's corresponding parameter here [RedeclParamPrevious] -// CHECK:STDERR: fn Foo(a: C); -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_name_mismatch.carbon:[[@LINE+3]]:15-18: error: redeclaration differs at parameter 1 [RedeclParamDiffers] +// CHECK:STDERR: fail_name_mismatch.carbon:[[@LINE-2]]:8-11: note: previous declaration's corresponding parameter here [RedeclParamPrevious] // CHECK:STDERR: fn Foo(unused b: D) {} @@ -133,12 +113,8 @@ class C {} alias D = C; fn Foo(a: C); -// CHECK:STDERR: fail_alias.carbon:[[@LINE+7]]:18: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: fn Foo(unused a: D) {} -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_alias.carbon:[[@LINE-4]]:11: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] -// CHECK:STDERR: fn Foo(a: C); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_alias.carbon:[[@LINE+3]]:18: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] +// CHECK:STDERR: fail_alias.carbon:[[@LINE-2]]:11: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] // CHECK:STDERR: fn Foo(unused a: D) {} @@ -150,12 +126,8 @@ class C {} alias D = C; fn Foo[a: C](); -// CHECK:STDERR: fail_deduced_alias.carbon:[[@LINE+7]]:18: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: fn Foo[unused a: D]() {} -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_deduced_alias.carbon:[[@LINE-4]]:11: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] -// CHECK:STDERR: fn Foo[a: C](); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_deduced_alias.carbon:[[@LINE+3]]:18: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] +// CHECK:STDERR: fail_deduced_alias.carbon:[[@LINE-2]]:11: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] // CHECK:STDERR: fn Foo[unused a: D]() {} @@ -192,16 +164,10 @@ library "[[@TEST_NAME]]"; class C {} fn Foo(a: const C); -// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE+11]]:18: warning: `const` applied repeatedly to the same type has no additional effect [RepeatedConst] -// CHECK:STDERR: fn Foo(unused a: const (const C)) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE+5]]:18-32: warning: `const` applied repeatedly to the same type has no additional effect [RepeatedConst] // CHECK:STDERR: -// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE+7]]:24: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: fn Foo(unused a: const (const C)) {} -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE-8]]:17: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] -// CHECK:STDERR: fn Foo(a: const C); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE+3]]:24: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] +// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE-4]]:17: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] // CHECK:STDERR: fn Foo(unused a: const (const C)) {} @@ -346,7 +312,7 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: %a.patt: %pattern_type = wrapper_binding_pattern a, %a.param_patt [concrete] // CHECK:STDOUT: %Foo.type.11c674.1: type = fn_type @Foo.loc6 [concrete] // CHECK:STDOUT: %Foo.12ccef.1: %Foo.type.11c674.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.11c674.2: type = fn_type @Foo.loc14 [concrete] +// CHECK:STDOUT: %Foo.type.11c674.2: type = fn_type @Foo.loc10 [concrete] // CHECK:STDOUT: %Foo.12ccef.2: %Foo.type.11c674.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -364,7 +330,7 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %a: %C = wrapper_binding a, %a.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc14: %Foo.type.11c674.2 = fn_decl @Foo.loc14 [concrete = constants.%Foo.12ccef.2] { +// CHECK:STDOUT: %Foo.decl.loc10: %Foo.type.11c674.2 = fn_decl @Foo.loc10 [concrete = constants.%Foo.12ccef.2] { // CHECK:STDOUT: %a.param_patt: %pattern_type = value_param_pattern [concrete = constants.%a.param_patt] // CHECK:STDOUT: %a.patt: %pattern_type = wrapper_binding_pattern a, %a.param_patt [concrete = constants.%a.patt] // CHECK:STDOUT: } { @@ -384,7 +350,7 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo.loc6(%a.param: %C); // CHECK:STDOUT: -// CHECK:STDOUT: fn @Foo.loc14(%a.param: %C) { +// CHECK:STDOUT: fn @Foo.loc10(%a.param: %C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -396,20 +362,20 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: %C: type = class_type @C [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: %Foo.type.11c674.1: type = fn_type @Foo.loc14 [concrete] +// CHECK:STDOUT: %Foo.type.11c674.1: type = fn_type @Foo.loc10 [concrete] // CHECK:STDOUT: %Foo.12ccef.1: %Foo.type.11c674.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.11c674.2: type = fn_type @Foo.loc23 [concrete] +// CHECK:STDOUT: %Foo.type.11c674.2: type = fn_type @Foo.loc15 [concrete] // CHECK:STDOUT: %Foo.12ccef.2: %Foo.type.11c674.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .Foo = %Foo.decl.loc14 +// CHECK:STDOUT: .Foo = %Foo.decl.loc10 // CHECK:STDOUT: } // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {} -// CHECK:STDOUT: %Foo.decl.loc14: %Foo.type.11c674.1 = fn_decl @Foo.loc14 [concrete = constants.%Foo.12ccef.1] {} {} -// CHECK:STDOUT: %Foo.decl.loc23: %Foo.type.11c674.2 = fn_decl @Foo.loc23 [concrete = constants.%Foo.12ccef.2] {} {} +// CHECK:STDOUT: %Foo.decl.loc10: %Foo.type.11c674.1 = fn_decl @Foo.loc10 [concrete = constants.%Foo.12ccef.1] {} {} +// CHECK:STDOUT: %Foo.decl.loc15: %Foo.type.11c674.2 = fn_decl @Foo.loc15 [concrete = constants.%Foo.12ccef.2] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { @@ -420,9 +386,9 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Foo.loc14(); +// CHECK:STDOUT: fn @Foo.loc10(); // CHECK:STDOUT: -// CHECK:STDOUT: fn @Foo.loc23() { +// CHECK:STDOUT: fn @Foo.loc15() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -439,7 +405,7 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: %_.patt: %pattern_type = wrapper_binding_pattern _, %_.param_patt [concrete] // CHECK:STDOUT: %Foo.type.11c674.1: type = fn_type @Foo.loc6 [concrete] // CHECK:STDOUT: %Foo.12ccef.1: %Foo.type.11c674.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.11c674.2: type = fn_type @Foo.loc14 [concrete] +// CHECK:STDOUT: %Foo.type.11c674.2: type = fn_type @Foo.loc10 [concrete] // CHECK:STDOUT: %Foo.12ccef.2: %Foo.type.11c674.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -457,7 +423,7 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %_: %C = wrapper_binding _, %_.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc14: %Foo.type.11c674.2 = fn_decl @Foo.loc14 [concrete = constants.%Foo.12ccef.2] { +// CHECK:STDOUT: %Foo.decl.loc10: %Foo.type.11c674.2 = fn_decl @Foo.loc10 [concrete = constants.%Foo.12ccef.2] { // CHECK:STDOUT: %_.param_patt: %pattern_type = value_param_pattern [concrete = constants.%_.param_patt] // CHECK:STDOUT: %_.patt: %pattern_type = wrapper_binding_pattern _, %_.param_patt [concrete = constants.%_.patt] // CHECK:STDOUT: } { @@ -477,7 +443,7 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo.loc6(%_.param: %C); // CHECK:STDOUT: -// CHECK:STDOUT: fn @Foo.loc14(%_.param: %C) { +// CHECK:STDOUT: fn @Foo.loc10(%_.param: %C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -620,7 +586,7 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: %Foo.12ccef.1: %Foo.type.11c674.1 = struct_value () [concrete] // CHECK:STDOUT: %b.param_patt: %pattern_type = value_param_pattern [concrete] // CHECK:STDOUT: %b.patt: %pattern_type = wrapper_binding_pattern b, %b.param_patt [concrete] -// CHECK:STDOUT: %Foo.type.11c674.2: type = fn_type @Foo.loc15 [concrete] +// CHECK:STDOUT: %Foo.type.11c674.2: type = fn_type @Foo.loc11 [concrete] // CHECK:STDOUT: %Foo.12ccef.2: %Foo.type.11c674.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -641,7 +607,7 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %a: %C = wrapper_binding a, %a.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc15: %Foo.type.11c674.2 = fn_decl @Foo.loc15 [concrete = constants.%Foo.12ccef.2] { +// CHECK:STDOUT: %Foo.decl.loc11: %Foo.type.11c674.2 = fn_decl @Foo.loc11 [concrete = constants.%Foo.12ccef.2] { // CHECK:STDOUT: %b.param_patt: %pattern_type = value_param_pattern [concrete = constants.%b.param_patt] // CHECK:STDOUT: %b.patt: %pattern_type = wrapper_binding_pattern b, %b.param_patt [concrete = constants.%b.patt] // CHECK:STDOUT: } { @@ -661,7 +627,7 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo.loc7(%a.param: %C); // CHECK:STDOUT: -// CHECK:STDOUT: fn @Foo.loc15(%b.param: %C) { +// CHECK:STDOUT: fn @Foo.loc11(%b.param: %C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -678,7 +644,7 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: %a.patt: %pattern_type = wrapper_binding_pattern a, %a.param_patt [concrete] // CHECK:STDOUT: %Foo.type.11c674.1: type = fn_type @Foo.loc7 [concrete] // CHECK:STDOUT: %Foo.12ccef.1: %Foo.type.11c674.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.11c674.2: type = fn_type @Foo.loc15 [concrete] +// CHECK:STDOUT: %Foo.type.11c674.2: type = fn_type @Foo.loc11 [concrete] // CHECK:STDOUT: %Foo.12ccef.2: %Foo.type.11c674.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -699,7 +665,7 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %a: %C = wrapper_binding a, %a.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc15: %Foo.type.11c674.2 = fn_decl @Foo.loc15 [concrete = constants.%Foo.12ccef.2] { +// CHECK:STDOUT: %Foo.decl.loc11: %Foo.type.11c674.2 = fn_decl @Foo.loc11 [concrete = constants.%Foo.12ccef.2] { // CHECK:STDOUT: %a.param_patt: %pattern_type = value_param_pattern [concrete = constants.%a.param_patt] // CHECK:STDOUT: %a.patt: %pattern_type = wrapper_binding_pattern a, %a.param_patt [concrete = constants.%a.patt] // CHECK:STDOUT: } { @@ -719,7 +685,7 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo.loc7(%a.param: %C); // CHECK:STDOUT: -// CHECK:STDOUT: fn @Foo.loc15(%a.param: %C) { +// CHECK:STDOUT: fn @Foo.loc11(%a.param: %C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -738,7 +704,7 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: %Foo.type.11c674.1: type = fn_type @Foo.loc7 [concrete] // CHECK:STDOUT: %Foo.12ccef.1: %Foo.type.11c674.1 = struct_value () [concrete] // CHECK:STDOUT: %a.1bf9e8.2: %C = symbolic_binding a, 0 [symbolic] -// CHECK:STDOUT: %Foo.type.11c674.2: type = fn_type @Foo.loc15 [concrete] +// CHECK:STDOUT: %Foo.type.11c674.2: type = fn_type @Foo.loc11 [concrete] // CHECK:STDOUT: %Foo.12ccef.2: %Foo.type.11c674.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -760,14 +726,14 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: } // CHECK:STDOUT: %a.loc7_9.2: %C = symbolic_binding a, 0 [symbolic = %a.loc7_9.1 (constants.%a.1bf9e8.1)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc15: %Foo.type.11c674.2 = fn_decl @Foo.loc15 [concrete = constants.%Foo.12ccef.2] { -// CHECK:STDOUT: %a.patt.loc15_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc15_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %Foo.decl.loc11: %Foo.type.11c674.2 = fn_decl @Foo.loc11 [concrete = constants.%Foo.12ccef.2] { +// CHECK:STDOUT: %a.patt.loc11_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc11_16.2 (constants.%a.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc15: type = splice_block %D.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc11: type = splice_block %D.ref [concrete = constants.%C] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D [concrete = constants.%C] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.loc15_16.3: %C = symbolic_binding a, 0 [symbolic = %a.loc15_16.2 (constants.%a.1bf9e8.2)] +// CHECK:STDOUT: %a.loc11_16.3: %C = symbolic_binding a, 0 [symbolic = %a.loc11_16.2 (constants.%a.1bf9e8.2)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -786,10 +752,10 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: fn(); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Foo.loc15(%a.loc15_16.3: %C) { -// CHECK:STDOUT: %a.patt.loc15_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc15_16.2 (constants.%a.patt)] -// CHECK:STDOUT: %a.loc15_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc15_16.1 (constants.%a.1bf9e8.1)] -// CHECK:STDOUT: %a.loc15_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc15_16.2 (constants.%a.1bf9e8.2)] +// CHECK:STDOUT: generic fn @Foo.loc11(%a.loc11_16.3: %C) { +// CHECK:STDOUT: %a.patt.loc11_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc11_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %a.loc11_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc11_16.1 (constants.%a.1bf9e8.1)] +// CHECK:STDOUT: %a.loc11_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc11_16.2 (constants.%a.1bf9e8.2)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -804,10 +770,10 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: %a.loc7_9.1 => constants.%a.1bf9e8.1 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Foo.loc15(constants.%a.1bf9e8.2) { -// CHECK:STDOUT: %a.patt.loc15_16.2 => constants.%a.patt -// CHECK:STDOUT: %a.loc15_16.1 => constants.%a.1bf9e8.2 -// CHECK:STDOUT: %a.loc15_16.2 => constants.%a.1bf9e8.2 +// CHECK:STDOUT: specific @Foo.loc11(constants.%a.1bf9e8.2) { +// CHECK:STDOUT: %a.patt.loc11_16.2 => constants.%a.patt +// CHECK:STDOUT: %a.loc11_16.1 => constants.%a.1bf9e8.2 +// CHECK:STDOUT: %a.loc11_16.2 => constants.%a.1bf9e8.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- todo_fail_alias_in_return.carbon @@ -977,7 +943,7 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: %a.patt: %pattern_type = wrapper_binding_pattern a, %a.param_patt [concrete] // CHECK:STDOUT: %Foo.type.11c674.1: type = fn_type @Foo.loc6 [concrete] // CHECK:STDOUT: %Foo.12ccef.1: %Foo.type.11c674.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.11c674.2: type = fn_type @Foo.loc18 [concrete] +// CHECK:STDOUT: %Foo.type.11c674.2: type = fn_type @Foo.loc12 [concrete] // CHECK:STDOUT: %Foo.12ccef.2: %Foo.type.11c674.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -998,15 +964,15 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: } // CHECK:STDOUT: %a: %const = wrapper_binding a, %a.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc18: %Foo.type.11c674.2 = fn_decl @Foo.loc18 [concrete = constants.%Foo.12ccef.2] { +// CHECK:STDOUT: %Foo.decl.loc12: %Foo.type.11c674.2 = fn_decl @Foo.loc12 [concrete = constants.%Foo.12ccef.2] { // CHECK:STDOUT: %a.param_patt: %pattern_type = value_param_pattern [concrete = constants.%a.param_patt] // CHECK:STDOUT: %a.patt: %pattern_type = wrapper_binding_pattern a, %a.param_patt [concrete = constants.%a.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %a.param: %const = value_param call_param0 -// CHECK:STDOUT: %.loc18: type = splice_block %const.loc18_18 [concrete = constants.%const] { +// CHECK:STDOUT: %.loc12: type = splice_block %const.loc12_18 [concrete = constants.%const] { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %const.loc18_25: type = const_type %C.ref [concrete = constants.%const] -// CHECK:STDOUT: %const.loc18_18: type = const_type %const.loc18_25 [concrete = constants.%const] +// CHECK:STDOUT: %const.loc12_25: type = const_type %C.ref [concrete = constants.%const] +// CHECK:STDOUT: %const.loc12_18: type = const_type %const.loc12_25 [concrete = constants.%const] // CHECK:STDOUT: } // CHECK:STDOUT: %a: %const = wrapper_binding a, %a.param // CHECK:STDOUT: } @@ -1022,7 +988,7 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo.loc6(%a.param: %const); // CHECK:STDOUT: -// CHECK:STDOUT: fn @Foo.loc18(%a.param: %const) { +// CHECK:STDOUT: fn @Foo.loc12(%a.param: %const) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/generic/deduce.carbon b/toolchain/check/testdata/function/generic/deduce.carbon index 254364c97789..6c84722a1eec 100644 --- a/toolchain/check/testdata/function/generic/deduce.carbon +++ b/toolchain/check/testdata/function/generic/deduce.carbon @@ -37,12 +37,8 @@ fn CallExplicitGenericParamConst(generic T: type) { } fn CallExplicitGenericParamNonConst(T: type) { - // CHECK:STDERR: fail_deduce_explicit_non_constant.carbon:[[@LINE+7]]:3: error: argument for generic parameter is not a compile-time constant [CompTimeArgumentNotConstant] - // CHECK:STDERR: ExplicitGenericParam(T); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_deduce_explicit_non_constant.carbon:[[@LINE-10]]:33: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn ExplicitGenericParam(generic T: type) -> T* { return ExplicitGenericParam(T); } - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_deduce_explicit_non_constant.carbon:[[@LINE+3]]:3-25: error: argument for generic parameter is not a compile-time constant [CompTimeArgumentNotConstant] + // CHECK:STDERR: fail_deduce_explicit_non_constant.carbon:[[@LINE-8]]:33-39: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: ExplicitGenericParam(T); } @@ -98,12 +94,8 @@ library "[[@TEST_NAME]]"; fn BigStructParam[T: type](unused x: {.c: T, .d: i32, .e: i32}) {} fn CallBigStructParam() { - // CHECK:STDERR: fail_deduce_bigger_struct.carbon:[[@LINE+7]]:3: error: cannot deduce value for generic parameter `T` [DeductionIncomplete] - // CHECK:STDERR: BigStructParam({.c = 3, .d = 4}); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_deduce_bigger_struct.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn BigStructParam[T: type](unused x: {.c: T, .d: i32, .e: i32}) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_deduce_bigger_struct.carbon:[[@LINE+3]]:3-34: error: cannot deduce value for generic parameter `T` [DeductionIncomplete] + // CHECK:STDERR: fail_deduce_bigger_struct.carbon:[[@LINE-4]]:1-65: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: BigStructParam({.c = 3, .d = 4}); } @@ -115,12 +107,8 @@ library "[[@TEST_NAME]]"; fn SmallStructParam[T: type](unused x: {.f: T, .g: i32}) {} fn CallSmallStructParam() { - // CHECK:STDERR: fail_deduce_smaller_struct.carbon:[[@LINE+7]]:3: error: cannot deduce value for generic parameter `T` [DeductionIncomplete] - // CHECK:STDERR: SmallStructParam({.f = 5, .g = 6, .h = 7}); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_deduce_smaller_struct.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn SmallStructParam[T: type](unused x: {.f: T, .g: i32}) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_deduce_smaller_struct.carbon:[[@LINE+3]]:3-44: error: cannot deduce value for generic parameter `T` [DeductionIncomplete] + // CHECK:STDERR: fail_deduce_smaller_struct.carbon:[[@LINE-4]]:1-58: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: SmallStructParam({.f = 5, .g = 6, .h = 7}); } @@ -132,12 +120,8 @@ library "[[@TEST_NAME]]"; fn WrongNameStructParam[T: type](unused x: {.i: T, .different: i32}) {} fn CallWrongNameStructParam() { - // CHECK:STDERR: fail_deduce_struct_wrong_name.carbon:[[@LINE+7]]:3: error: cannot deduce value for generic parameter `T` [DeductionIncomplete] - // CHECK:STDERR: WrongNameStructParam({.i = 8, .j = 9}); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_deduce_struct_wrong_name.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn WrongNameStructParam[T: type](unused x: {.i: T, .different: i32}) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_deduce_struct_wrong_name.carbon:[[@LINE+3]]:3-40: error: cannot deduce value for generic parameter `T` [DeductionIncomplete] + // CHECK:STDERR: fail_deduce_struct_wrong_name.carbon:[[@LINE-4]]:1-70: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: WrongNameStructParam({.i = 8, .j = 9}); } @@ -149,12 +133,8 @@ library "[[@TEST_NAME]]"; fn WrongOrderStructParam[T: type](unused x: {.first: T, .second: i32}) {} fn CallWrongOrderStructParam() { - // CHECK:STDERR: fail_todo_deduce_struct_wrong_order.carbon:[[@LINE+7]]:3: error: cannot deduce value for generic parameter `T` [DeductionIncomplete] - // CHECK:STDERR: WrongOrderStructParam({.second = 11, .first = 10}); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_deduce_struct_wrong_order.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn WrongOrderStructParam[T: type](unused x: {.first: T, .second: i32}) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_deduce_struct_wrong_order.carbon:[[@LINE+3]]:3-52: error: cannot deduce value for generic parameter `T` [DeductionIncomplete] + // CHECK:STDERR: fail_todo_deduce_struct_wrong_order.carbon:[[@LINE-4]]:1-72: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: WrongOrderStructParam({.second = 11, .first = 10}); } @@ -168,12 +148,8 @@ library "[[@TEST_NAME]]"; fn ImplicitNotDeducible[T: type, U: type](x: T) -> U; fn CallImplicitNotDeducible() { - // CHECK:STDERR: fail_deduce_incomplete.carbon:[[@LINE+7]]:3: error: cannot deduce value for generic parameter `U` [DeductionIncomplete] - // CHECK:STDERR: ImplicitNotDeducible(42); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_deduce_incomplete.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn ImplicitNotDeducible[T: type, U: type](x: T) -> U; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_deduce_incomplete.carbon:[[@LINE+3]]:3-26: error: cannot deduce value for generic parameter `U` [DeductionIncomplete] + // CHECK:STDERR: fail_deduce_incomplete.carbon:[[@LINE-4]]:1-53: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: ImplicitNotDeducible(42); } @@ -185,12 +161,8 @@ library "[[@TEST_NAME]]"; fn ImplicitNotDeducible[T: type](x: T, y: T) -> T; fn CallImplicitNotDeducible() { - // CHECK:STDERR: fail_deduce_inconsistent.carbon:[[@LINE+7]]:3: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent] - // CHECK:STDERR: ImplicitNotDeducible(42, {.x = 12}); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_deduce_inconsistent.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn ImplicitNotDeducible[T: type](x: T, y: T) -> T; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_deduce_inconsistent.carbon:[[@LINE+3]]:3-37: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent] + // CHECK:STDERR: fail_deduce_inconsistent.carbon:[[@LINE-4]]:1-50: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: ImplicitNotDeducible(42, {.x = 12}); } @@ -1383,7 +1355,7 @@ fn F() { // CHECK:STDOUT: %BigStructParam.ref: %BigStructParam.type = name_ref BigStructParam, file.%BigStructParam.decl [concrete = constants.%BigStructParam] // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3] // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4] -// CHECK:STDOUT: %.loc14: %struct_type.c.d = struct_literal (%int_3, %int_4) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc10: %struct_type.c.d = struct_literal (%int_3, %int_4) [concrete = constants.%struct] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1484,7 +1456,7 @@ fn F() { // CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [concrete = constants.%int_5] // CHECK:STDOUT: %int_6: Core.IntLiteral = int_value 6 [concrete = constants.%int_6] // CHECK:STDOUT: %int_7: Core.IntLiteral = int_value 7 [concrete = constants.%int_7] -// CHECK:STDOUT: %.loc14: %struct_type.f.g.h = struct_literal (%int_5, %int_6, %int_7) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc10: %struct_type.f.g.h = struct_literal (%int_5, %int_6, %int_7) [concrete = constants.%struct] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1583,7 +1555,7 @@ fn F() { // CHECK:STDOUT: %WrongNameStructParam.ref: %WrongNameStructParam.type = name_ref WrongNameStructParam, file.%WrongNameStructParam.decl [concrete = constants.%WrongNameStructParam] // CHECK:STDOUT: %int_8: Core.IntLiteral = int_value 8 [concrete = constants.%int_8] // CHECK:STDOUT: %int_9: Core.IntLiteral = int_value 9 [concrete = constants.%int_9] -// CHECK:STDOUT: %.loc14: %struct_type.i.j = struct_literal (%int_8, %int_9) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc10: %struct_type.i.j = struct_literal (%int_8, %int_9) [concrete = constants.%struct] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1682,7 +1654,7 @@ fn F() { // CHECK:STDOUT: %WrongOrderStructParam.ref: %WrongOrderStructParam.type = name_ref WrongOrderStructParam, file.%WrongOrderStructParam.decl [concrete = constants.%WrongOrderStructParam] // CHECK:STDOUT: %int_11: Core.IntLiteral = int_value 11 [concrete = constants.%int_11] // CHECK:STDOUT: %int_10: Core.IntLiteral = int_value 10 [concrete = constants.%int_10] -// CHECK:STDOUT: %.loc14: %struct_type.second.first = struct_literal (%int_11, %int_10) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc10: %struct_type.second.first = struct_literal (%int_11, %int_10) [concrete = constants.%struct] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1887,7 +1859,7 @@ fn F() { // CHECK:STDOUT: %ImplicitNotDeducible.ref: %ImplicitNotDeducible.type = name_ref ImplicitNotDeducible, file.%ImplicitNotDeducible.decl [concrete = constants.%ImplicitNotDeducible] // CHECK:STDOUT: %int_42: Core.IntLiteral = int_value 42 [concrete = constants.%int_42] // CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [concrete = constants.%int_12] -// CHECK:STDOUT: %.loc14: %struct_type.x = struct_literal (%int_12) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc10: %struct_type.x = struct_literal (%int_12) [concrete = constants.%struct] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/generic/fail_deduce_imported_function.carbon b/toolchain/check/testdata/function/generic/fail_deduce_imported_function.carbon index 3e0b7f352174..5e735ef5df74 100644 --- a/toolchain/check/testdata/function/generic/fail_deduce_imported_function.carbon +++ b/toolchain/check/testdata/function/generic/fail_deduce_imported_function.carbon @@ -25,22 +25,14 @@ import Lib; fn A[T: Lib.Z](unused x: {.a: T}) {} fn B() { - // CHECK:STDERR: fail_deduce_imported_function.carbon:[[@LINE+7]]:3: error: cannot deduce value for generic parameter `T` [DeductionIncomplete] - // CHECK:STDERR: A({.b = {}}); - // CHECK:STDERR: ^~~~~~~~~~~~ - // CHECK:STDERR: fail_deduce_imported_function.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn A[T: Lib.Z](unused x: {.a: T}) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_deduce_imported_function.carbon:[[@LINE+3]]:3-14: error: cannot deduce value for generic parameter `T` [DeductionIncomplete] + // CHECK:STDERR: fail_deduce_imported_function.carbon:[[@LINE-4]]:1-35: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: A({.b = {}}); - // CHECK:STDERR: fail_deduce_imported_function.carbon:[[@LINE+8]]:3: error: cannot deduce value for generic parameter `T` [DeductionIncomplete] - // CHECK:STDERR: Lib.A({.b = {}}); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_deduce_imported_function.carbon:[[@LINE-17]]:1: in import [InImport] - // CHECK:STDERR: lib.carbon:4:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn A[T: Z](unused x: {.a: T}) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_deduce_imported_function.carbon:[[@LINE+4]]:3-18: error: cannot deduce value for generic parameter `T` [DeductionIncomplete] + // CHECK:STDERR: imported from: fail_deduce_imported_function.carbon:[[@LINE-11]]:1 [InImport] + // CHECK:STDERR: lib.carbon:4:1-31: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: Lib.A({.b = {}}); } @@ -232,13 +224,13 @@ fn B() { // CHECK:STDOUT: // CHECK:STDOUT: fn @B() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref.loc14: %A.type.9f4 = name_ref A, file.%A.decl [concrete = constants.%A.921] -// CHECK:STDOUT: %.loc14_12: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc14_13: %struct_type.b = struct_literal (%.loc14_12) [concrete = constants.%struct] +// CHECK:STDOUT: %A.ref.loc10: %A.type.9f4 = name_ref A, file.%A.decl [concrete = constants.%A.921] +// CHECK:STDOUT: %.loc10_12: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc10_13: %struct_type.b = struct_literal (%.loc10_12) [concrete = constants.%struct] // CHECK:STDOUT: %Lib.ref: = name_ref Lib, imports.%Lib [concrete = imports.%Lib] -// CHECK:STDOUT: %A.ref.loc24: %A.type.42a = name_ref A, imports.%Lib.A [concrete = constants.%A.b9a] -// CHECK:STDOUT: %.loc24_16: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc24_17: %struct_type.b = struct_literal (%.loc24_16) [concrete = constants.%struct] +// CHECK:STDOUT: %A.ref.loc16: %A.type.42a = name_ref A, imports.%Lib.A [concrete = constants.%A.b9a] +// CHECK:STDOUT: %.loc16_16: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc16_17: %struct_type.b = struct_literal (%.loc16_16) [concrete = constants.%struct] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: 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 60c7774f9dee..f451857053f8 100644 --- a/toolchain/check/testdata/function/generic/fail_type_param_mismatch.carbon +++ b/toolchain/check/testdata/function/generic/fail_type_param_mismatch.carbon @@ -12,12 +12,8 @@ fn F(generic T: type, generic U: type) { var p: T*; - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let unused n: U = *p; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_type_param_mismatch.carbon:[[@LINE+3]]:21-22: error: cannot implicitly convert expression of type `T` to `U` [ConversionFailure] + // CHECK:STDERR: fail_type_param_mismatch.carbon:[[@LINE+2]]:21-22: note: type `T` does not implement interface `Core.ImplicitAs(U)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused n: U = *p; } diff --git a/toolchain/check/testdata/function/generic/redeclare.carbon b/toolchain/check/testdata/function/generic/redeclare.carbon index 697ff9e27f29..40bcb052b660 100644 --- a/toolchain/check/testdata/function/generic/redeclare.carbon +++ b/toolchain/check/testdata/function/generic/redeclare.carbon @@ -28,20 +28,12 @@ library "[[@TEST_NAME]]"; fn F(generic T: type, generic U: type) -> T*; -// CHECK:STDERR: fail_different_return_type.carbon:[[@LINE+7]]:1: error: function redeclaration differs because return type is `U*` [FunctionRedeclReturnTypeDiffers] -// CHECK:STDERR: fn F(generic T: type, generic U: type) -> U* { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_different_return_type.carbon:[[@LINE-5]]:1: note: previously declared with return type `T*` [FunctionRedeclReturnTypePrevious] -// CHECK:STDERR: fn F(generic T: type, generic U: type) -> T*; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_different_return_type.carbon:[[@LINE+3]]:1-46: error: function redeclaration differs because return type is `U*` [FunctionRedeclReturnTypeDiffers] +// CHECK:STDERR: fail_different_return_type.carbon:[[@LINE-3]]:1-45: note: previously declared with return type `T*` [FunctionRedeclReturnTypePrevious] // CHECK:STDERR: fn F(generic T: type, generic U: type) -> U* { - // CHECK:STDERR: fail_different_return_type.carbon:[[@LINE+7]]:10: error: 1 argument passed to function expecting 2 arguments [CallArgCountMismatch] - // CHECK:STDERR: return F(T); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_different_return_type.carbon:[[@LINE-13]]:1: note: calling function declared here [InCallToEntity] - // CHECK:STDERR: fn F(generic T: type, generic U: type) -> T*; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_different_return_type.carbon:[[@LINE+3]]:10-13: error: 1 argument passed to function expecting 2 arguments [CallArgCountMismatch] + // CHECK:STDERR: fail_different_return_type.carbon:[[@LINE-7]]:1-45: note: calling function declared here [InCallToEntity] // CHECK:STDERR: return F(T); } @@ -52,20 +44,12 @@ library "[[@TEST_NAME]]"; fn F(generic T: type, generic U: type) -> T*; -// CHECK:STDERR: fail_reorder.carbon:[[@LINE+7]]:21: error: redeclaration differs at parameter 1 [RedeclParamDiffers] -// CHECK:STDERR: fn F(unused generic U: type, generic T: type) -> T* { -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_reorder.carbon:[[@LINE-5]]:14: note: previous declaration's corresponding parameter here [RedeclParamPrevious] -// CHECK:STDERR: fn F(generic T: type, generic U: type) -> T*; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_reorder.carbon:[[@LINE+3]]:21-27: error: redeclaration differs at parameter 1 [RedeclParamDiffers] +// CHECK:STDERR: fail_reorder.carbon:[[@LINE-3]]:14-20: note: previous declaration's corresponding parameter here [RedeclParamPrevious] // CHECK:STDERR: fn F(unused generic U: type, generic T: type) -> T* { - // CHECK:STDERR: fail_reorder.carbon:[[@LINE+7]]:10: error: 1 argument passed to function expecting 2 arguments [CallArgCountMismatch] - // CHECK:STDERR: return F(T); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_reorder.carbon:[[@LINE-13]]:1: note: calling function declared here [InCallToEntity] - // CHECK:STDERR: fn F(generic T: type, generic U: type) -> T*; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_reorder.carbon:[[@LINE+3]]:10-13: error: 1 argument passed to function expecting 2 arguments [CallArgCountMismatch] + // CHECK:STDERR: fail_reorder.carbon:[[@LINE-7]]:1-45: note: calling function declared here [InCallToEntity] // CHECK:STDERR: return F(T); } @@ -76,20 +60,12 @@ library "[[@TEST_NAME]]"; fn F(generic T: type, generic U: type) -> T*; -// CHECK:STDERR: fail_rename.carbon:[[@LINE+7]]:14: error: redeclaration differs at parameter 1 [RedeclParamDiffers] -// CHECK:STDERR: fn F(generic U: type, generic T: type) -> U* { -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_rename.carbon:[[@LINE-5]]:14: note: previous declaration's corresponding parameter here [RedeclParamPrevious] -// CHECK:STDERR: fn F(generic T: type, generic U: type) -> T*; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_rename.carbon:[[@LINE+3]]:14-20: error: redeclaration differs at parameter 1 [RedeclParamDiffers] +// CHECK:STDERR: fail_rename.carbon:[[@LINE-3]]:14-20: note: previous declaration's corresponding parameter here [RedeclParamPrevious] // CHECK:STDERR: fn F(generic U: type, generic T: type) -> U* { - // CHECK:STDERR: fail_rename.carbon:[[@LINE+7]]:10: error: 1 argument passed to function expecting 2 arguments [CallArgCountMismatch] - // CHECK:STDERR: return F(T); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_rename.carbon:[[@LINE-13]]:1: note: calling function declared here [InCallToEntity] - // CHECK:STDERR: fn F(generic T: type, generic U: type) -> T*; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_rename.carbon:[[@LINE+3]]:10-13: error: 1 argument passed to function expecting 2 arguments [CallArgCountMismatch] + // CHECK:STDERR: fail_rename.carbon:[[@LINE-7]]:1-45: note: calling function declared here [InCallToEntity] // CHECK:STDERR: return F(T); } @@ -219,7 +195,7 @@ fn F(generic U: type, generic T: type) -> U* { // CHECK:STDOUT: %pattern_type.423: type = pattern_type %ptr.18e [symbolic] // CHECK:STDOUT: %return.param_patt.534: %pattern_type.423 = out_param_pattern [symbolic] // CHECK:STDOUT: %return.patt.669: %pattern_type.423 = return_slot_pattern %return.param_patt.534, %ptr.18e [symbolic] -// CHECK:STDOUT: %F.type.eb3ec9.2: type = fn_type @F.loc13 [concrete] +// CHECK:STDOUT: %F.type.eb3ec9.2: type = fn_type @F.loc9 [concrete] // CHECK:STDOUT: %F.7088cc.2: %F.type.eb3ec9.2 = struct_value () [concrete] // CHECK:STDOUT: %require_complete: = require_complete_type %ptr.18e [symbolic] // CHECK:STDOUT: } @@ -259,27 +235,27 @@ fn F(generic U: type, generic T: type) -> U* { // CHECK:STDOUT: %return.param: ref @F.loc4.%ptr.loc4_44.1 (%ptr.e8f) = out_param call_param0 // CHECK:STDOUT: %return: ref @F.loc4.%ptr.loc4_44.1 (%ptr.e8f) = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %F.decl.loc13: %F.type.eb3ec9.2 = fn_decl @F.loc13 [concrete = constants.%F.7088cc.2] { -// CHECK:STDOUT: %T.patt.loc13_15.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc13_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %U.patt.loc13_32.1: %pattern_type.9a5 = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc13_32.2 (constants.%U.patt)] -// CHECK:STDOUT: %return.param_patt.loc13_44.1: @F.loc13.%pattern_type (%pattern_type.423) = out_param_pattern [symbolic = %return.param_patt.loc13_44.2 (constants.%return.param_patt.534)] -// CHECK:STDOUT: %return.patt.loc13_40.1: @F.loc13.%pattern_type (%pattern_type.423) = return_slot_pattern %return.param_patt.loc13_44.1, %ptr.loc13_44.2 [symbolic = %return.patt.loc13_40.2 (constants.%return.patt.669)] +// CHECK:STDOUT: %F.decl.loc9: %F.type.eb3ec9.2 = fn_decl @F.loc9 [concrete = constants.%F.7088cc.2] { +// CHECK:STDOUT: %T.patt.loc9_15.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %U.patt.loc9_32.1: %pattern_type.9a5 = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc9_32.2 (constants.%U.patt)] +// CHECK:STDOUT: %return.param_patt.loc9_44.1: @F.loc9.%pattern_type (%pattern_type.423) = out_param_pattern [symbolic = %return.param_patt.loc9_44.2 (constants.%return.param_patt.534)] +// CHECK:STDOUT: %return.patt.loc9_40.1: @F.loc9.%pattern_type (%pattern_type.423) = return_slot_pattern %return.param_patt.loc9_44.1, %ptr.loc9_44.2 [symbolic = %return.patt.loc9_40.2 (constants.%return.patt.669)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %U.ref: type = name_ref U, %U.loc13_32.2 [symbolic = %U.loc13_32.1 (constants.%U)] -// CHECK:STDOUT: %ptr.loc13_44.2: type = ptr_type %U.ref [symbolic = %ptr.loc13_44.1 (constants.%ptr.18e)] -// CHECK:STDOUT: %.loc13_44.2: Core.Form = init_form %ptr.loc13_44.2 [symbolic = %.loc13_44.1 (constants.%.6d8)] -// CHECK:STDOUT: %.loc13_17.1: type = splice_block %.loc13_17.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc13_15: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc13_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %U.ref: type = name_ref U, %U.loc9_32.2 [symbolic = %U.loc9_32.1 (constants.%U)] +// CHECK:STDOUT: %ptr.loc9_44.2: type = ptr_type %U.ref [symbolic = %ptr.loc9_44.1 (constants.%ptr.18e)] +// CHECK:STDOUT: %.loc9_44.2: Core.Form = init_form %ptr.loc9_44.2 [symbolic = %.loc9_44.1 (constants.%.6d8)] +// CHECK:STDOUT: %.loc9_17.1: type = splice_block %.loc9_17.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc9_15: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc9_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc13_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc13_15.1 (constants.%T)] -// CHECK:STDOUT: %.loc13_34.1: type = splice_block %.loc13_34.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc13_32: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc13_34.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %T.loc9_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc9_15.1 (constants.%T)] +// CHECK:STDOUT: %.loc9_34.1: type = splice_block %.loc9_34.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc9_32: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc9_34.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %U.loc13_32.2: type = symbolic_binding U, 1 [symbolic = %U.loc13_32.1 (constants.%U)] -// CHECK:STDOUT: %return.param: ref @F.loc13.%ptr.loc13_44.1 (%ptr.18e) = out_param call_param0 -// CHECK:STDOUT: %return: ref @F.loc13.%ptr.loc13_44.1 (%ptr.18e) = return_slot %return.param +// CHECK:STDOUT: %U.loc9_32.2: type = symbolic_binding U, 1 [symbolic = %U.loc9_32.1 (constants.%U)] +// CHECK:STDOUT: %return.param: ref @F.loc9.%ptr.loc9_44.1 (%ptr.18e) = out_param call_param0 +// CHECK:STDOUT: %return: ref @F.loc9.%ptr.loc9_44.1 (%ptr.18e) = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -297,24 +273,24 @@ fn F(generic U: type, generic T: type) -> U* { // CHECK:STDOUT: fn() -> out %return.param: @F.loc4.%ptr.loc4_44.1 (%ptr.e8f); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F.loc13(%T.loc13_15.2: type, %U.loc13_32.2: type) { -// CHECK:STDOUT: %T.patt.loc13_15.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc13_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc13_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc13_15.1 (constants.%T)] -// CHECK:STDOUT: %U.patt.loc13_32.2: %pattern_type.9a5 = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc13_32.2 (constants.%U.patt)] -// CHECK:STDOUT: %U.loc13_32.1: type = symbolic_binding U, 1 [symbolic = %U.loc13_32.1 (constants.%U)] -// CHECK:STDOUT: %ptr.loc13_44.1: type = ptr_type %U.loc13_32.1 [symbolic = %ptr.loc13_44.1 (constants.%ptr.18e)] -// CHECK:STDOUT: %.loc13_44.1: Core.Form = init_form %ptr.loc13_44.1 [symbolic = %.loc13_44.1 (constants.%.6d8)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr.loc13_44.1 [symbolic = %pattern_type (constants.%pattern_type.423)] -// CHECK:STDOUT: %return.param_patt.loc13_44.2: @F.loc13.%pattern_type (%pattern_type.423) = out_param_pattern [symbolic = %return.param_patt.loc13_44.2 (constants.%return.param_patt.534)] -// CHECK:STDOUT: %return.patt.loc13_40.2: @F.loc13.%pattern_type (%pattern_type.423) = return_slot_pattern %return.param_patt.loc13_44.2, %ptr.loc13_44.1 [symbolic = %return.patt.loc13_40.2 (constants.%return.patt.669)] +// CHECK:STDOUT: generic fn @F.loc9(%T.loc9_15.2: type, %U.loc9_32.2: type) { +// CHECK:STDOUT: %T.patt.loc9_15.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc9_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc9_15.1 (constants.%T)] +// CHECK:STDOUT: %U.patt.loc9_32.2: %pattern_type.9a5 = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc9_32.2 (constants.%U.patt)] +// CHECK:STDOUT: %U.loc9_32.1: type = symbolic_binding U, 1 [symbolic = %U.loc9_32.1 (constants.%U)] +// CHECK:STDOUT: %ptr.loc9_44.1: type = ptr_type %U.loc9_32.1 [symbolic = %ptr.loc9_44.1 (constants.%ptr.18e)] +// CHECK:STDOUT: %.loc9_44.1: Core.Form = init_form %ptr.loc9_44.1 [symbolic = %.loc9_44.1 (constants.%.6d8)] +// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr.loc9_44.1 [symbolic = %pattern_type (constants.%pattern_type.423)] +// CHECK:STDOUT: %return.param_patt.loc9_44.2: @F.loc9.%pattern_type (%pattern_type.423) = out_param_pattern [symbolic = %return.param_patt.loc9_44.2 (constants.%return.param_patt.534)] +// CHECK:STDOUT: %return.patt.loc9_40.2: @F.loc9.%pattern_type (%pattern_type.423) = return_slot_pattern %return.param_patt.loc9_44.2, %ptr.loc9_44.1 [symbolic = %return.patt.loc9_40.2 (constants.%return.patt.669)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %ptr.loc13_44.1 [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type %ptr.loc9_44.1 [symbolic = %require_complete (constants.%require_complete)] // CHECK:STDOUT: -// CHECK:STDOUT: fn() -> out %return.param: @F.loc13.%ptr.loc13_44.1 (%ptr.18e) { +// CHECK:STDOUT: fn() -> out %return.param: @F.loc9.%ptr.loc9_44.1 (%ptr.18e) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type.eb3ec9.1 = name_ref F, file.%F.decl.loc4 [concrete = constants.%F.7088cc.1] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc13_15.2 [symbolic = %T.loc13_15.1 (constants.%T)] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc9_15.2 [symbolic = %T.loc9_15.1 (constants.%T)] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -331,16 +307,16 @@ fn F(generic U: type, generic T: type) -> U* { // CHECK:STDOUT: %return.patt.loc4_40.2 => constants.%return.patt.d67 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.loc13(constants.%T, constants.%U) { -// CHECK:STDOUT: %T.patt.loc13_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc13_15.1 => constants.%T -// CHECK:STDOUT: %U.patt.loc13_32.2 => constants.%U.patt -// CHECK:STDOUT: %U.loc13_32.1 => constants.%U -// CHECK:STDOUT: %ptr.loc13_44.1 => constants.%ptr.18e -// CHECK:STDOUT: %.loc13_44.1 => constants.%.6d8 +// CHECK:STDOUT: specific @F.loc9(constants.%T, constants.%U) { +// CHECK:STDOUT: %T.patt.loc9_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc9_15.1 => constants.%T +// CHECK:STDOUT: %U.patt.loc9_32.2 => constants.%U.patt +// CHECK:STDOUT: %U.loc9_32.1 => constants.%U +// CHECK:STDOUT: %ptr.loc9_44.1 => constants.%ptr.18e +// CHECK:STDOUT: %.loc9_44.1 => constants.%.6d8 // CHECK:STDOUT: %pattern_type => constants.%pattern_type.423 -// CHECK:STDOUT: %return.param_patt.loc13_44.2 => constants.%return.param_patt.534 -// CHECK:STDOUT: %return.patt.loc13_40.2 => constants.%return.patt.669 +// CHECK:STDOUT: %return.param_patt.loc9_44.2 => constants.%return.param_patt.534 +// CHECK:STDOUT: %return.patt.loc9_40.2 => constants.%return.patt.669 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_reorder.carbon @@ -369,7 +345,7 @@ fn F(generic U: type, generic T: type) -> U* { // CHECK:STDOUT: %pattern_type.423: type = pattern_type %ptr.18e [symbolic] // CHECK:STDOUT: %return.param_patt.534: %pattern_type.423 = out_param_pattern [symbolic] // CHECK:STDOUT: %return.patt.669: %pattern_type.423 = return_slot_pattern %return.param_patt.534, %ptr.18e [symbolic] -// CHECK:STDOUT: %F.type.eb3ec9.2: type = fn_type @F.loc13 [concrete] +// CHECK:STDOUT: %F.type.eb3ec9.2: type = fn_type @F.loc9 [concrete] // CHECK:STDOUT: %F.7088cc.2: %F.type.eb3ec9.2 = struct_value () [concrete] // CHECK:STDOUT: %require_complete: = require_complete_type %ptr.18e [symbolic] // CHECK:STDOUT: } @@ -409,27 +385,27 @@ fn F(generic U: type, generic T: type) -> U* { // CHECK:STDOUT: %return.param: ref @F.loc4.%ptr.loc4_44.1 (%ptr.e8f) = out_param call_param0 // CHECK:STDOUT: %return: ref @F.loc4.%ptr.loc4_44.1 (%ptr.e8f) = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %F.decl.loc13: %F.type.eb3ec9.2 = fn_decl @F.loc13 [concrete = constants.%F.7088cc.2] { -// CHECK:STDOUT: %U.patt.loc13_22.1: %pattern_type.9a5 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc13_22.2 (constants.%U.patt.3a0)] -// CHECK:STDOUT: %T.patt.loc13_39.1: %pattern_type.9a5 = symbolic_binding_pattern T, 1 [symbolic = %T.patt.loc13_39.2 (constants.%T.patt.cb8)] -// CHECK:STDOUT: %return.param_patt.loc13_51.1: @F.loc13.%pattern_type (%pattern_type.423) = out_param_pattern [symbolic = %return.param_patt.loc13_51.2 (constants.%return.param_patt.534)] -// CHECK:STDOUT: %return.patt.loc13_47.1: @F.loc13.%pattern_type (%pattern_type.423) = return_slot_pattern %return.param_patt.loc13_51.1, %ptr.loc13_51.2 [symbolic = %return.patt.loc13_47.2 (constants.%return.patt.669)] +// CHECK:STDOUT: %F.decl.loc9: %F.type.eb3ec9.2 = fn_decl @F.loc9 [concrete = constants.%F.7088cc.2] { +// CHECK:STDOUT: %U.patt.loc9_22.1: %pattern_type.9a5 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc9_22.2 (constants.%U.patt.3a0)] +// CHECK:STDOUT: %T.patt.loc9_39.1: %pattern_type.9a5 = symbolic_binding_pattern T, 1 [symbolic = %T.patt.loc9_39.2 (constants.%T.patt.cb8)] +// CHECK:STDOUT: %return.param_patt.loc9_51.1: @F.loc9.%pattern_type (%pattern_type.423) = out_param_pattern [symbolic = %return.param_patt.loc9_51.2 (constants.%return.param_patt.534)] +// CHECK:STDOUT: %return.patt.loc9_47.1: @F.loc9.%pattern_type (%pattern_type.423) = return_slot_pattern %return.param_patt.loc9_51.1, %ptr.loc9_51.2 [symbolic = %return.patt.loc9_47.2 (constants.%return.patt.669)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %T.ref.loc13: type = name_ref T, %T.loc13_39.2 [symbolic = %T.loc13_39.1 (constants.%T.091)] -// CHECK:STDOUT: %ptr.loc13_51.2: type = ptr_type %T.ref.loc13 [symbolic = %ptr.loc13_51.1 (constants.%ptr.18e)] -// CHECK:STDOUT: %.loc13_51.2: Core.Form = init_form %ptr.loc13_51.2 [symbolic = %.loc13_51.1 (constants.%.6d8)] -// CHECK:STDOUT: %.loc13_24.1: type = splice_block %.loc13_24.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc13_22: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc13_24.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %T.ref.loc9: type = name_ref T, %T.loc9_39.2 [symbolic = %T.loc9_39.1 (constants.%T.091)] +// CHECK:STDOUT: %ptr.loc9_51.2: type = ptr_type %T.ref.loc9 [symbolic = %ptr.loc9_51.1 (constants.%ptr.18e)] +// CHECK:STDOUT: %.loc9_51.2: Core.Form = init_form %ptr.loc9_51.2 [symbolic = %.loc9_51.1 (constants.%.6d8)] +// CHECK:STDOUT: %.loc9_24.1: type = splice_block %.loc9_24.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc9_22: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc9_24.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %U.loc13_22.2: type = symbolic_binding U, 0 [symbolic = %U.loc13_22.1 (constants.%U.67d)] -// CHECK:STDOUT: %.loc13_41.1: type = splice_block %.loc13_41.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc13_39: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc13_41.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %U.loc9_22.2: type = symbolic_binding U, 0 [symbolic = %U.loc9_22.1 (constants.%U.67d)] +// CHECK:STDOUT: %.loc9_41.1: type = splice_block %.loc9_41.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc9_39: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc9_41.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc13_39.2: type = symbolic_binding T, 1 [symbolic = %T.loc13_39.1 (constants.%T.091)] -// CHECK:STDOUT: %return.param: ref @F.loc13.%ptr.loc13_51.1 (%ptr.18e) = out_param call_param0 -// CHECK:STDOUT: %return: ref @F.loc13.%ptr.loc13_51.1 (%ptr.18e) = return_slot %return.param +// CHECK:STDOUT: %T.loc9_39.2: type = symbolic_binding T, 1 [symbolic = %T.loc9_39.1 (constants.%T.091)] +// CHECK:STDOUT: %return.param: ref @F.loc9.%ptr.loc9_51.1 (%ptr.18e) = out_param call_param0 +// CHECK:STDOUT: %return: ref @F.loc9.%ptr.loc9_51.1 (%ptr.18e) = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -447,24 +423,24 @@ fn F(generic U: type, generic T: type) -> U* { // CHECK:STDOUT: fn() -> out %return.param: @F.loc4.%ptr.loc4_44.1 (%ptr.e8f); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F.loc13(%U.loc13_22.2: type, %T.loc13_39.2: type) { -// CHECK:STDOUT: %U.patt.loc13_22.2: %pattern_type.9a5 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc13_22.2 (constants.%U.patt.3a0)] -// CHECK:STDOUT: %U.loc13_22.1: type = symbolic_binding U, 0 [symbolic = %U.loc13_22.1 (constants.%U.67d)] -// CHECK:STDOUT: %T.patt.loc13_39.2: %pattern_type.9a5 = symbolic_binding_pattern T, 1 [symbolic = %T.patt.loc13_39.2 (constants.%T.patt.cb8)] -// CHECK:STDOUT: %T.loc13_39.1: type = symbolic_binding T, 1 [symbolic = %T.loc13_39.1 (constants.%T.091)] -// CHECK:STDOUT: %ptr.loc13_51.1: type = ptr_type %T.loc13_39.1 [symbolic = %ptr.loc13_51.1 (constants.%ptr.18e)] -// CHECK:STDOUT: %.loc13_51.1: Core.Form = init_form %ptr.loc13_51.1 [symbolic = %.loc13_51.1 (constants.%.6d8)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr.loc13_51.1 [symbolic = %pattern_type (constants.%pattern_type.423)] -// CHECK:STDOUT: %return.param_patt.loc13_51.2: @F.loc13.%pattern_type (%pattern_type.423) = out_param_pattern [symbolic = %return.param_patt.loc13_51.2 (constants.%return.param_patt.534)] -// CHECK:STDOUT: %return.patt.loc13_47.2: @F.loc13.%pattern_type (%pattern_type.423) = return_slot_pattern %return.param_patt.loc13_51.2, %ptr.loc13_51.1 [symbolic = %return.patt.loc13_47.2 (constants.%return.patt.669)] +// CHECK:STDOUT: generic fn @F.loc9(%U.loc9_22.2: type, %T.loc9_39.2: type) { +// CHECK:STDOUT: %U.patt.loc9_22.2: %pattern_type.9a5 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc9_22.2 (constants.%U.patt.3a0)] +// CHECK:STDOUT: %U.loc9_22.1: type = symbolic_binding U, 0 [symbolic = %U.loc9_22.1 (constants.%U.67d)] +// CHECK:STDOUT: %T.patt.loc9_39.2: %pattern_type.9a5 = symbolic_binding_pattern T, 1 [symbolic = %T.patt.loc9_39.2 (constants.%T.patt.cb8)] +// CHECK:STDOUT: %T.loc9_39.1: type = symbolic_binding T, 1 [symbolic = %T.loc9_39.1 (constants.%T.091)] +// CHECK:STDOUT: %ptr.loc9_51.1: type = ptr_type %T.loc9_39.1 [symbolic = %ptr.loc9_51.1 (constants.%ptr.18e)] +// CHECK:STDOUT: %.loc9_51.1: Core.Form = init_form %ptr.loc9_51.1 [symbolic = %.loc9_51.1 (constants.%.6d8)] +// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr.loc9_51.1 [symbolic = %pattern_type (constants.%pattern_type.423)] +// CHECK:STDOUT: %return.param_patt.loc9_51.2: @F.loc9.%pattern_type (%pattern_type.423) = out_param_pattern [symbolic = %return.param_patt.loc9_51.2 (constants.%return.param_patt.534)] +// CHECK:STDOUT: %return.patt.loc9_47.2: @F.loc9.%pattern_type (%pattern_type.423) = return_slot_pattern %return.param_patt.loc9_51.2, %ptr.loc9_51.1 [symbolic = %return.patt.loc9_47.2 (constants.%return.patt.669)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %ptr.loc13_51.1 [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type %ptr.loc9_51.1 [symbolic = %require_complete (constants.%require_complete)] // CHECK:STDOUT: -// CHECK:STDOUT: fn() -> out %return.param: @F.loc13.%ptr.loc13_51.1 (%ptr.18e) { +// CHECK:STDOUT: fn() -> out %return.param: @F.loc9.%ptr.loc9_51.1 (%ptr.18e) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type.eb3ec9.1 = name_ref F, file.%F.decl.loc4 [concrete = constants.%F.7088cc.1] -// CHECK:STDOUT: %T.ref.loc21: type = name_ref T, %T.loc13_39.2 [symbolic = %T.loc13_39.1 (constants.%T.091)] +// CHECK:STDOUT: %T.ref.loc13: type = name_ref T, %T.loc9_39.2 [symbolic = %T.loc9_39.1 (constants.%T.091)] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -481,16 +457,16 @@ fn F(generic U: type, generic T: type) -> U* { // CHECK:STDOUT: %return.patt.loc4_40.2 => constants.%return.patt.d67 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.loc13(constants.%U.67d, constants.%T.091) { -// CHECK:STDOUT: %U.patt.loc13_22.2 => constants.%U.patt.3a0 -// CHECK:STDOUT: %U.loc13_22.1 => constants.%U.67d -// CHECK:STDOUT: %T.patt.loc13_39.2 => constants.%T.patt.cb8 -// CHECK:STDOUT: %T.loc13_39.1 => constants.%T.091 -// CHECK:STDOUT: %ptr.loc13_51.1 => constants.%ptr.18e -// CHECK:STDOUT: %.loc13_51.1 => constants.%.6d8 +// CHECK:STDOUT: specific @F.loc9(constants.%U.67d, constants.%T.091) { +// CHECK:STDOUT: %U.patt.loc9_22.2 => constants.%U.patt.3a0 +// CHECK:STDOUT: %U.loc9_22.1 => constants.%U.67d +// CHECK:STDOUT: %T.patt.loc9_39.2 => constants.%T.patt.cb8 +// CHECK:STDOUT: %T.loc9_39.1 => constants.%T.091 +// CHECK:STDOUT: %ptr.loc9_51.1 => constants.%ptr.18e +// CHECK:STDOUT: %.loc9_51.1 => constants.%.6d8 // CHECK:STDOUT: %pattern_type => constants.%pattern_type.423 -// CHECK:STDOUT: %return.param_patt.loc13_51.2 => constants.%return.param_patt.534 -// CHECK:STDOUT: %return.patt.loc13_47.2 => constants.%return.patt.669 +// CHECK:STDOUT: %return.param_patt.loc9_51.2 => constants.%return.param_patt.534 +// CHECK:STDOUT: %return.patt.loc9_47.2 => constants.%return.patt.669 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_rename.carbon @@ -519,7 +495,7 @@ fn F(generic U: type, generic T: type) -> U* { // CHECK:STDOUT: %pattern_type.4f4b84.2: type = pattern_type %ptr.e8f8f9.2 [symbolic] // CHECK:STDOUT: %return.param_patt.27f587.2: %pattern_type.4f4b84.2 = out_param_pattern [symbolic] // CHECK:STDOUT: %return.patt.d67681.2: %pattern_type.4f4b84.2 = return_slot_pattern %return.param_patt.27f587.2, %ptr.e8f8f9.2 [symbolic] -// CHECK:STDOUT: %F.type.eb3ec9.2: type = fn_type @F.loc13 [concrete] +// CHECK:STDOUT: %F.type.eb3ec9.2: type = fn_type @F.loc9 [concrete] // CHECK:STDOUT: %F.7088cc.2: %F.type.eb3ec9.2 = struct_value () [concrete] // CHECK:STDOUT: %require_complete: = require_complete_type %ptr.e8f8f9.2 [symbolic] // CHECK:STDOUT: } @@ -559,27 +535,27 @@ fn F(generic U: type, generic T: type) -> U* { // CHECK:STDOUT: %return.param: ref @F.loc4.%ptr.loc4_44.1 (%ptr.e8f8f9.1) = out_param call_param0 // CHECK:STDOUT: %return: ref @F.loc4.%ptr.loc4_44.1 (%ptr.e8f8f9.1) = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %F.decl.loc13: %F.type.eb3ec9.2 = fn_decl @F.loc13 [concrete = constants.%F.7088cc.2] { -// CHECK:STDOUT: %U.patt.loc13_15.1: %pattern_type.9a5 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc13_15.2 (constants.%U.patt.3a0)] -// CHECK:STDOUT: %T.patt.loc13_32.1: %pattern_type.9a5 = symbolic_binding_pattern T, 1 [symbolic = %T.patt.loc13_32.2 (constants.%T.patt.cb8)] -// CHECK:STDOUT: %return.param_patt.loc13_44.1: @F.loc13.%pattern_type (%pattern_type.4f4b84.2) = out_param_pattern [symbolic = %return.param_patt.loc13_44.2 (constants.%return.param_patt.27f587.2)] -// CHECK:STDOUT: %return.patt.loc13_40.1: @F.loc13.%pattern_type (%pattern_type.4f4b84.2) = return_slot_pattern %return.param_patt.loc13_44.1, %ptr.loc13_44.2 [symbolic = %return.patt.loc13_40.2 (constants.%return.patt.d67681.2)] +// CHECK:STDOUT: %F.decl.loc9: %F.type.eb3ec9.2 = fn_decl @F.loc9 [concrete = constants.%F.7088cc.2] { +// CHECK:STDOUT: %U.patt.loc9_15.1: %pattern_type.9a5 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc9_15.2 (constants.%U.patt.3a0)] +// CHECK:STDOUT: %T.patt.loc9_32.1: %pattern_type.9a5 = symbolic_binding_pattern T, 1 [symbolic = %T.patt.loc9_32.2 (constants.%T.patt.cb8)] +// CHECK:STDOUT: %return.param_patt.loc9_44.1: @F.loc9.%pattern_type (%pattern_type.4f4b84.2) = out_param_pattern [symbolic = %return.param_patt.loc9_44.2 (constants.%return.param_patt.27f587.2)] +// CHECK:STDOUT: %return.patt.loc9_40.1: @F.loc9.%pattern_type (%pattern_type.4f4b84.2) = return_slot_pattern %return.param_patt.loc9_44.1, %ptr.loc9_44.2 [symbolic = %return.patt.loc9_40.2 (constants.%return.patt.d67681.2)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %U.ref: type = name_ref U, %U.loc13_15.2 [symbolic = %U.loc13_15.1 (constants.%U.67d)] -// CHECK:STDOUT: %ptr.loc13_44.2: type = ptr_type %U.ref [symbolic = %ptr.loc13_44.1 (constants.%ptr.e8f8f9.2)] -// CHECK:STDOUT: %.loc13_44.2: Core.Form = init_form %ptr.loc13_44.2 [symbolic = %.loc13_44.1 (constants.%.cb6cb9.2)] -// CHECK:STDOUT: %.loc13_17.1: type = splice_block %.loc13_17.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc13_15: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc13_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %U.ref: type = name_ref U, %U.loc9_15.2 [symbolic = %U.loc9_15.1 (constants.%U.67d)] +// CHECK:STDOUT: %ptr.loc9_44.2: type = ptr_type %U.ref [symbolic = %ptr.loc9_44.1 (constants.%ptr.e8f8f9.2)] +// CHECK:STDOUT: %.loc9_44.2: Core.Form = init_form %ptr.loc9_44.2 [symbolic = %.loc9_44.1 (constants.%.cb6cb9.2)] +// CHECK:STDOUT: %.loc9_17.1: type = splice_block %.loc9_17.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc9_15: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc9_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %U.loc13_15.2: type = symbolic_binding U, 0 [symbolic = %U.loc13_15.1 (constants.%U.67d)] -// CHECK:STDOUT: %.loc13_34.1: type = splice_block %.loc13_34.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc13_32: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc13_34.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %U.loc9_15.2: type = symbolic_binding U, 0 [symbolic = %U.loc9_15.1 (constants.%U.67d)] +// CHECK:STDOUT: %.loc9_34.1: type = splice_block %.loc9_34.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc9_32: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc9_34.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc13_32.2: type = symbolic_binding T, 1 [symbolic = %T.loc13_32.1 (constants.%T.091)] -// CHECK:STDOUT: %return.param: ref @F.loc13.%ptr.loc13_44.1 (%ptr.e8f8f9.2) = out_param call_param0 -// CHECK:STDOUT: %return: ref @F.loc13.%ptr.loc13_44.1 (%ptr.e8f8f9.2) = return_slot %return.param +// CHECK:STDOUT: %T.loc9_32.2: type = symbolic_binding T, 1 [symbolic = %T.loc9_32.1 (constants.%T.091)] +// CHECK:STDOUT: %return.param: ref @F.loc9.%ptr.loc9_44.1 (%ptr.e8f8f9.2) = out_param call_param0 +// CHECK:STDOUT: %return: ref @F.loc9.%ptr.loc9_44.1 (%ptr.e8f8f9.2) = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -597,24 +573,24 @@ fn F(generic U: type, generic T: type) -> U* { // CHECK:STDOUT: fn() -> out %return.param: @F.loc4.%ptr.loc4_44.1 (%ptr.e8f8f9.1); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F.loc13(%U.loc13_15.2: type, %T.loc13_32.2: type) { -// CHECK:STDOUT: %U.patt.loc13_15.2: %pattern_type.9a5 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc13_15.2 (constants.%U.patt.3a0)] -// CHECK:STDOUT: %U.loc13_15.1: type = symbolic_binding U, 0 [symbolic = %U.loc13_15.1 (constants.%U.67d)] -// CHECK:STDOUT: %T.patt.loc13_32.2: %pattern_type.9a5 = symbolic_binding_pattern T, 1 [symbolic = %T.patt.loc13_32.2 (constants.%T.patt.cb8)] -// CHECK:STDOUT: %T.loc13_32.1: type = symbolic_binding T, 1 [symbolic = %T.loc13_32.1 (constants.%T.091)] -// CHECK:STDOUT: %ptr.loc13_44.1: type = ptr_type %U.loc13_15.1 [symbolic = %ptr.loc13_44.1 (constants.%ptr.e8f8f9.2)] -// CHECK:STDOUT: %.loc13_44.1: Core.Form = init_form %ptr.loc13_44.1 [symbolic = %.loc13_44.1 (constants.%.cb6cb9.2)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr.loc13_44.1 [symbolic = %pattern_type (constants.%pattern_type.4f4b84.2)] -// CHECK:STDOUT: %return.param_patt.loc13_44.2: @F.loc13.%pattern_type (%pattern_type.4f4b84.2) = out_param_pattern [symbolic = %return.param_patt.loc13_44.2 (constants.%return.param_patt.27f587.2)] -// CHECK:STDOUT: %return.patt.loc13_40.2: @F.loc13.%pattern_type (%pattern_type.4f4b84.2) = return_slot_pattern %return.param_patt.loc13_44.2, %ptr.loc13_44.1 [symbolic = %return.patt.loc13_40.2 (constants.%return.patt.d67681.2)] +// CHECK:STDOUT: generic fn @F.loc9(%U.loc9_15.2: type, %T.loc9_32.2: type) { +// CHECK:STDOUT: %U.patt.loc9_15.2: %pattern_type.9a5 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc9_15.2 (constants.%U.patt.3a0)] +// CHECK:STDOUT: %U.loc9_15.1: type = symbolic_binding U, 0 [symbolic = %U.loc9_15.1 (constants.%U.67d)] +// CHECK:STDOUT: %T.patt.loc9_32.2: %pattern_type.9a5 = symbolic_binding_pattern T, 1 [symbolic = %T.patt.loc9_32.2 (constants.%T.patt.cb8)] +// CHECK:STDOUT: %T.loc9_32.1: type = symbolic_binding T, 1 [symbolic = %T.loc9_32.1 (constants.%T.091)] +// CHECK:STDOUT: %ptr.loc9_44.1: type = ptr_type %U.loc9_15.1 [symbolic = %ptr.loc9_44.1 (constants.%ptr.e8f8f9.2)] +// CHECK:STDOUT: %.loc9_44.1: Core.Form = init_form %ptr.loc9_44.1 [symbolic = %.loc9_44.1 (constants.%.cb6cb9.2)] +// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr.loc9_44.1 [symbolic = %pattern_type (constants.%pattern_type.4f4b84.2)] +// CHECK:STDOUT: %return.param_patt.loc9_44.2: @F.loc9.%pattern_type (%pattern_type.4f4b84.2) = out_param_pattern [symbolic = %return.param_patt.loc9_44.2 (constants.%return.param_patt.27f587.2)] +// CHECK:STDOUT: %return.patt.loc9_40.2: @F.loc9.%pattern_type (%pattern_type.4f4b84.2) = return_slot_pattern %return.param_patt.loc9_44.2, %ptr.loc9_44.1 [symbolic = %return.patt.loc9_40.2 (constants.%return.patt.d67681.2)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %ptr.loc13_44.1 [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type %ptr.loc9_44.1 [symbolic = %require_complete (constants.%require_complete)] // CHECK:STDOUT: -// CHECK:STDOUT: fn() -> out %return.param: @F.loc13.%ptr.loc13_44.1 (%ptr.e8f8f9.2) { +// CHECK:STDOUT: fn() -> out %return.param: @F.loc9.%ptr.loc9_44.1 (%ptr.e8f8f9.2) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type.eb3ec9.1 = name_ref F, file.%F.decl.loc4 [concrete = constants.%F.7088cc.1] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc13_32.2 [symbolic = %T.loc13_32.1 (constants.%T.091)] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc9_32.2 [symbolic = %T.loc9_32.1 (constants.%T.091)] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -631,15 +607,15 @@ fn F(generic U: type, generic T: type) -> U* { // CHECK:STDOUT: %return.patt.loc4_40.2 => constants.%return.patt.d67681.1 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.loc13(constants.%U.67d, constants.%T.091) { -// CHECK:STDOUT: %U.patt.loc13_15.2 => constants.%U.patt.3a0 -// CHECK:STDOUT: %U.loc13_15.1 => constants.%U.67d -// CHECK:STDOUT: %T.patt.loc13_32.2 => constants.%T.patt.cb8 -// CHECK:STDOUT: %T.loc13_32.1 => constants.%T.091 -// CHECK:STDOUT: %ptr.loc13_44.1 => constants.%ptr.e8f8f9.2 -// CHECK:STDOUT: %.loc13_44.1 => constants.%.cb6cb9.2 +// CHECK:STDOUT: specific @F.loc9(constants.%U.67d, constants.%T.091) { +// CHECK:STDOUT: %U.patt.loc9_15.2 => constants.%U.patt.3a0 +// CHECK:STDOUT: %U.loc9_15.1 => constants.%U.67d +// CHECK:STDOUT: %T.patt.loc9_32.2 => constants.%T.patt.cb8 +// CHECK:STDOUT: %T.loc9_32.1 => constants.%T.091 +// CHECK:STDOUT: %ptr.loc9_44.1 => constants.%ptr.e8f8f9.2 +// CHECK:STDOUT: %.loc9_44.1 => constants.%.cb6cb9.2 // CHECK:STDOUT: %pattern_type => constants.%pattern_type.4f4b84.2 -// CHECK:STDOUT: %return.param_patt.loc13_44.2 => constants.%return.param_patt.27f587.2 -// CHECK:STDOUT: %return.patt.loc13_40.2 => constants.%return.patt.d67681.2 +// CHECK:STDOUT: %return.param_patt.loc9_44.2 => constants.%return.param_patt.27f587.2 +// CHECK:STDOUT: %return.patt.loc9_40.2 => constants.%return.patt.d67681.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/generic/resolve_used.carbon b/toolchain/check/testdata/function/generic/resolve_used.carbon index 3cf26d044961..cd61e5445ca3 100644 --- a/toolchain/check/testdata/function/generic/resolve_used.carbon +++ b/toolchain/check/testdata/function/generic/resolve_used.carbon @@ -25,15 +25,9 @@ fn ErrorIfNIsZero(generic N: Core.IntLiteral) { } fn CallNegative() { - // 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: fail_todo_call_monomorphization_error.carbon:[[@LINE+4]]:3-16: error: unable to monomorphize specific `ErrorIfNIsZero(0)` [ResolvingSpecificHere] + // CHECK:STDERR: fail_todo_call_monomorphization_error.carbon:[[@LINE-5]]:17-27: note: `Core.Int(N)` evaluates to incomplete type `i0` [IncompleteTypeInMonomorphization] + // CHECK:STDERR: min_prelude/parts/int.carbon:11:9-18: note: integer type width of 0 is not positive [IntWidthNotPositive] // CHECK:STDERR: ErrorIfNIsZero(0); } diff --git a/toolchain/check/testdata/function/generic/undefined.carbon b/toolchain/check/testdata/function/generic/undefined.carbon index 38212e6a5c80..6124e5840e5d 100644 --- a/toolchain/check/testdata/function/generic/undefined.carbon +++ b/toolchain/check/testdata/function/generic/undefined.carbon @@ -39,12 +39,8 @@ library "[[@TEST_NAME]]"; fn Undefined[T: type](x: T); fn CallUndefined() { - // CHECK:STDERR: fail_call_undefined.carbon:[[@LINE+7]]:3: error: use of undefined generic function [MissingGenericFunctionDefinition] - // CHECK:STDERR: Undefined(0 as i32); - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_call_undefined.carbon:[[@LINE-6]]:1: note: generic function declared here [MissingGenericFunctionDefinitionHere] - // CHECK:STDERR: fn Undefined[T: type](x: T); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_call_undefined.carbon:[[@LINE+3]]:3-11: error: use of undefined generic function [MissingGenericFunctionDefinition] + // CHECK:STDERR: fail_call_undefined.carbon:[[@LINE-4]]:1-28: note: generic function declared here [MissingGenericFunctionDefinitionHere] // CHECK:STDERR: Undefined(0 as i32); } diff --git a/toolchain/check/testdata/generic/complete_type.carbon b/toolchain/check/testdata/generic/complete_type.carbon index d873042b4cd2..7c411b3d8a78 100644 --- a/toolchain/check/testdata/generic/complete_type.carbon +++ b/toolchain/check/testdata/generic/complete_type.carbon @@ -22,22 +22,12 @@ class A(T: type) { var v: T; } -// 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: fail_incomplete_in_class.carbon:[[@LINE+7]]:13-19: error: parameter has incomplete type `A(B)` in function definition [IncompleteTypeInFunctionParam] +// CHECK:STDERR: fail_incomplete_in_class.carbon:[[@LINE-4]]:10: note: `T` evaluates to incomplete type `B` [IncompleteTypeInMonomorphization] +// CHECK:STDERR: fail_incomplete_in_class.carbon:[[@LINE-8]]:1-8: note: class was forward declared here [ClassForwardDeclaredHere] // 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)) {} -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_incomplete_in_class.carbon:[[@LINE-19]]:1: note: class was forward declared here [ClassForwardDeclaredHere] -// CHECK:STDERR: class B; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_incomplete_in_class.carbon:[[@LINE+3]]:13-19: error: parameter has incomplete type `A(B)` in function definition [IncompleteTypeInFunctionParam] +// CHECK:STDERR: fail_incomplete_in_class.carbon:[[@LINE-11]]:1-8: note: class was forward declared here [ClassForwardDeclaredHere] // CHECK:STDERR: fn F(unused x: A(B)) {} @@ -68,15 +58,9 @@ fn F(generic T: type, p: T*) { let _: T = *p; } -// CHECK:STDERR: fail_incomplete_in_function_at_eof.carbon:[[@LINE+10]]:15: error: unable to monomorphize specific `F(B)` [ResolvingSpecificHere] -// CHECK:STDERR: fn G(p: B*) { F(B, p); } -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_incomplete_in_function_at_eof.carbon:[[@LINE-6]]:10: note: `T` evaluates to incomplete type `B` [IncompleteTypeInMonomorphization] -// CHECK:STDERR: let _: T = *p; -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_incomplete_in_function_at_eof.carbon:[[@LINE-12]]:1: note: class was forward declared here [ClassForwardDeclaredHere] -// CHECK:STDERR: class B; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_incomplete_in_function_at_eof.carbon:[[@LINE+4]]:15: error: unable to monomorphize specific `F(B)` [ResolvingSpecificHere] +// CHECK:STDERR: fail_incomplete_in_function_at_eof.carbon:[[@LINE-4]]:10: note: `T` evaluates to incomplete type `B` [IncompleteTypeInMonomorphization] +// CHECK:STDERR: fail_incomplete_in_function_at_eof.carbon:[[@LINE-8]]:1-8: note: class was forward declared here [ClassForwardDeclaredHere] // CHECK:STDERR: fn G(p: B*) { F(B, p); } @@ -139,14 +123,14 @@ fn G(p: B*) { F(B, p); } // CHECK:STDOUT: %x.patt: %pattern_type.709 = wrapper_binding_pattern x, %x.param_patt [concrete = constants.%x.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %x.param: %A.7d2 = value_param call_param0 -// CHECK:STDOUT: %.loc27: type = splice_block %A [concrete = constants.%A.7d2] { +// CHECK:STDOUT: %.loc17: type = splice_block %A [concrete = constants.%A.7d2] { // CHECK:STDOUT: %A.ref: %A.type = name_ref A, file.%A.decl [concrete = constants.%A.generic] // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl.loc4 [concrete = constants.%B] // CHECK:STDOUT: %A: type = class_type @A, @A(constants.%B) [concrete = constants.%A.7d2] // CHECK:STDOUT: } // CHECK:STDOUT: %x: %A.7d2 = wrapper_binding x, %x.param // CHECK:STDOUT: } -// CHECK:STDOUT: %B.decl.loc29: type = class_decl @B [concrete = constants.%B] {} {} +// CHECK:STDOUT: %B.decl.loc19: type = class_decl @B [concrete = constants.%B] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { @@ -410,9 +394,9 @@ fn G(p: B*) { F(B, p); } // CHECK:STDOUT: %p.patt: %pattern_type.3c8 = wrapper_binding_pattern p, %p.param_patt [concrete = constants.%p.patt.8dd] // CHECK:STDOUT: } { // CHECK:STDOUT: %p.param: %ptr.432 = value_param call_param0 -// CHECK:STDOUT: %.loc20: type = splice_block %ptr [concrete = constants.%ptr.432] { -// CHECK:STDOUT: %B.ref.loc20_9: type = name_ref B, file.%B.decl [concrete = constants.%B] -// CHECK:STDOUT: %ptr: type = ptr_type %B.ref.loc20_9 [concrete = constants.%ptr.432] +// CHECK:STDOUT: %.loc14: type = splice_block %ptr [concrete = constants.%ptr.432] { +// CHECK:STDOUT: %B.ref.loc14_9: type = name_ref B, file.%B.decl [concrete = constants.%B] +// CHECK:STDOUT: %ptr: type = ptr_type %B.ref.loc14_9 [concrete = constants.%ptr.432] // CHECK:STDOUT: } // CHECK:STDOUT: %p: %ptr.432 = wrapper_binding p, %p.param // CHECK:STDOUT: } @@ -451,7 +435,7 @@ fn G(p: B*) { F(B, p); } // CHECK:STDOUT: fn @G(%p.param: %ptr.432) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] -// CHECK:STDOUT: %B.ref.loc20_17: type = name_ref B, file.%B.decl [concrete = constants.%B] +// CHECK:STDOUT: %B.ref.loc14_17: type = name_ref B, file.%B.decl [concrete = constants.%B] // CHECK:STDOUT: %p.ref: %ptr.432 = name_ref p, %p // CHECK:STDOUT: %F.specific_fn: = specific_function %F.ref, @F(constants.%B) [concrete = constants.%F.specific_fn] // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn(%p.ref) diff --git a/toolchain/check/testdata/generic/dot_self_symbolic_type.carbon b/toolchain/check/testdata/generic/dot_self_symbolic_type.carbon index cfb08a99f061..b5ad8ce11c51 100644 --- a/toolchain/check/testdata/generic/dot_self_symbolic_type.carbon +++ b/toolchain/check/testdata/generic/dot_self_symbolic_type.carbon @@ -28,12 +28,8 @@ class C(CC: type) { class D(DD: type) { fn G(generic T: type) { //@dump-sem-ir-begin - // CHECK:STDERR: fail_dot_self_symbolic_type.carbon:[[@LINE+7]]:5: error: cannot convert type `T` into type implementing `A(DD) where .(A(DD).X) = DD` [ConversionFailureTypeToFacet] - // CHECK:STDERR: C(DD).F(T); - // CHECK:STDERR: ^~~~~~~~~~ - // CHECK:STDERR: fail_dot_self_symbolic_type.carbon:[[@LINE-10]]:3: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn F(unused generic T: A(CC) where .X = CC) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_dot_self_symbolic_type.carbon:[[@LINE+3]]:5-14: error: cannot convert type `T` into type implementing `A(DD) where .(A(DD).X) = DD` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_dot_self_symbolic_type.carbon:[[@LINE-8]]:3-47: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: C(DD).F(T); //@dump-sem-ir-end @@ -222,19 +218,19 @@ fn H(generic T: type) { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %DD: type = symbolic_binding DD, 0 [symbolic = %DD (constants.%DD)] -// CHECK:STDOUT: %C.loc25_9.2: type = class_type @C, @C(%DD) [symbolic = %C.loc25_9.2 (constants.%C.04ad3b.2)] -// CHECK:STDOUT: %require_complete: = require_complete_type %C.loc25_9.2 [symbolic = %require_complete (constants.%require_complete.095)] +// CHECK:STDOUT: %C.loc21_9.2: type = class_type @C, @C(%DD) [symbolic = %C.loc21_9.2 (constants.%C.04ad3b.2)] +// CHECK:STDOUT: %require_complete: = require_complete_type %C.loc21_9.2 [symbolic = %require_complete (constants.%require_complete.095)] // CHECK:STDOUT: %C.F.type: type = fn_type @C.F, @C(%DD) [symbolic = %C.F.type (constants.%C.F.type.8772f5.2)] // CHECK:STDOUT: %C.F: @D.G.%C.F.type (%C.F.type.8772f5.2) = struct_value () [symbolic = %C.F (constants.%C.F.889ece.2)] // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [concrete = constants.%C.generic] -// CHECK:STDOUT: %.loc25_7: type = specific_constant @D.%DD.loc15_11.2, @D(constants.%DD) [symbolic = %DD (constants.%DD)] -// CHECK:STDOUT: %DD.ref: type = name_ref DD, %.loc25_7 [symbolic = %DD (constants.%DD)] -// CHECK:STDOUT: %C.loc25_9.1: type = class_type @C, @C(constants.%DD) [symbolic = %C.loc25_9.2 (constants.%C.04ad3b.2)] -// CHECK:STDOUT: %.loc25_10: @D.G.%C.F.type (%C.F.type.8772f5.2) = specific_constant @C.%C.F.decl, @C(constants.%DD) [symbolic = %C.F (constants.%C.F.889ece.2)] -// CHECK:STDOUT: %F.ref: @D.G.%C.F.type (%C.F.type.8772f5.2) = name_ref F, %.loc25_10 [symbolic = %C.F (constants.%C.F.889ece.2)] +// CHECK:STDOUT: %.loc21_7: type = specific_constant @D.%DD.loc15_11.2, @D(constants.%DD) [symbolic = %DD (constants.%DD)] +// CHECK:STDOUT: %DD.ref: type = name_ref DD, %.loc21_7 [symbolic = %DD (constants.%DD)] +// CHECK:STDOUT: %C.loc21_9.1: type = class_type @C, @C(constants.%DD) [symbolic = %C.loc21_9.2 (constants.%C.04ad3b.2)] +// CHECK:STDOUT: %.loc21_10: @D.G.%C.F.type (%C.F.type.8772f5.2) = specific_constant @C.%C.F.decl, @C(constants.%DD) [symbolic = %C.F (constants.%C.F.889ece.2)] +// CHECK:STDOUT: %F.ref: @D.G.%C.F.type (%C.F.type.8772f5.2) = name_ref F, %.loc21_10 [symbolic = %C.F (constants.%C.F.889ece.2)] // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc16_17.2 [symbolic = %T.loc16_17.1 (constants.%T.091)] // CHECK:STDOUT: // CHECK:STDOUT: } @@ -306,7 +302,7 @@ fn H(generic T: type) { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %DD => constants.%empty_struct_type -// CHECK:STDOUT: %C.loc25_9.2 => constants.%C.664 +// CHECK:STDOUT: %C.loc21_9.2 => constants.%C.664 // CHECK:STDOUT: %require_complete => constants.%complete_type // CHECK:STDOUT: %C.F.type => constants.%C.F.type.157 // CHECK:STDOUT: %C.F => constants.%C.F.0b5 diff --git a/toolchain/check/testdata/generic/extend_type_completion.carbon b/toolchain/check/testdata/generic/extend_type_completion.carbon index 0dce9a30dd78..1ffe752a90b5 100644 --- a/toolchain/check/testdata/generic/extend_type_completion.carbon +++ b/toolchain/check/testdata/generic/extend_type_completion.carbon @@ -38,12 +38,8 @@ class C(N: i32) { } // 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+7]]:13: error: parameter has incomplete type `C(-1)` in function definition [IncompleteTypeInFunctionParam] -// CHECK:STDERR: fn F(unused 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: fail_class_extend_impl_does_need_complete_interface.carbon:[[@LINE+3]]:13-20: error: parameter has incomplete type `C(-1)` in function definition [IncompleteTypeInFunctionParam] +// CHECK:STDERR: fail_class_extend_impl_does_need_complete_interface.carbon:[[@LINE-5]]:18-33: note: array bound of -1 is negative [ArrayBoundNegative] // CHECK:STDERR: fn F(unused v: C(-1)) {} @@ -81,15 +77,9 @@ 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+10]]:13: error: parameter has incomplete type `I(-1)` in function definition [IncompleteTypeInFunctionParam] -// CHECK:STDERR: fn F(unused v: I(-1)) {} -// 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: fail_interface_extend_require_impls_does_need_complete_interface.carbon:[[@LINE+4]]:13-20: error: parameter has incomplete type `I(-1)` in function definition [IncompleteTypeInFunctionParam] +// CHECK:STDERR: fail_interface_extend_require_impls_does_need_complete_interface.carbon:[[@LINE-10]]:24-27: note: `J(N)` evaluates to incomplete type `J(-1)` [IncompleteTypeInMonomorphization] +// CHECK:STDERR: fail_interface_extend_require_impls_does_need_complete_interface.carbon:[[@LINE-14]]:24-39: note: array bound of -1 is negative [ArrayBoundNegative] // CHECK:STDERR: fn F(unused v: I(-1)) {} @@ -122,15 +112,9 @@ constraint I(N: i32) { } // 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+10]]:13: error: parameter has incomplete type `I(-1)` in function definition [IncompleteTypeInFunctionParam] -// CHECK:STDERR: fn F(unused v: I(-1)) {} -// 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: fail_constraint_extend_require_impls_does_need_complete_interface.carbon:[[@LINE+4]]:13-20: error: parameter has incomplete type `I(-1)` in function definition [IncompleteTypeInFunctionParam] +// CHECK:STDERR: fail_constraint_extend_require_impls_does_need_complete_interface.carbon:[[@LINE-5]]:24-27: note: `J(N)` evaluates to incomplete type `J(-1)` [IncompleteTypeInMonomorphization] +// CHECK:STDERR: fail_constraint_extend_require_impls_does_need_complete_interface.carbon:[[@LINE-9]]:24-39: note: array bound of -1 is negative [ArrayBoundNegative] // CHECK:STDERR: fn F(unused v: I(-1)) {} diff --git a/toolchain/check/testdata/generic/fail_generic_copy.carbon b/toolchain/check/testdata/generic/fail_generic_copy.carbon index c74cfd48a8fb..7de98dc59bb6 100644 --- a/toolchain/check/testdata/generic/fail_generic_copy.carbon +++ b/toolchain/check/testdata/generic/fail_generic_copy.carbon @@ -15,12 +15,8 @@ library "[[@TEST_NAME]]"; 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` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return x; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_return.carbon:[[@LINE+3]]:10: error: cannot copy value of type `T` [CopyOfUncopyableType] + // CHECK:STDERR: fail_return.carbon:[[@LINE+2]]:10: note: type `T` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return x; } @@ -30,12 +26,8 @@ fn F[T: type](x: T) -> T { library "[[@TEST_NAME]]"; 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` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var unused y: T = x; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_var.carbon:[[@LINE+3]]:21: error: cannot copy value of type `T` [CopyOfUncopyableType] + // CHECK:STDERR: fail_var.carbon:[[@LINE+2]]:21: note: type `T` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused y: T = x; } diff --git a/toolchain/check/testdata/generic/identify_specific_facet_type.carbon b/toolchain/check/testdata/generic/identify_specific_facet_type.carbon index f0f29c294d3e..c851d6e88b09 100644 --- a/toolchain/check/testdata/generic/identify_specific_facet_type.carbon +++ b/toolchain/check/testdata/generic/identify_specific_facet_type.carbon @@ -27,12 +27,8 @@ constraint J(N: i32) { require impls L(N); } -// 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: fail_error_in_identifying_require_facet_type.carbon:[[@LINE-9]]:30: note: 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]]:1-18: error: facet type `J(-1)` cannot be identified in `impl as` [ImplOfUnidentifiedFacetType] +// CHECK:STDERR: fail_error_in_identifying_require_facet_type.carbon:[[@LINE-7]]:30: note: array bound of -1 is negative [ArrayBoundNegative] // CHECK:STDERR: impl {} as J(-1) {} @@ -50,12 +46,8 @@ constraint J(N: i32) { extend require impls K(Array(i32, N)); } -// 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-6]]:24: note: array bound of -1 is negative [ArrayBoundNegative] -// CHECK:STDERR: extend require impls K(Array(i32, N)); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_error_in_identifying_extend_require_facet_type.carbon:[[@LINE+3]]:1-18: error: facet type `J(-1)` cannot be identified in `impl as` [ImplOfUnidentifiedFacetType] +// CHECK:STDERR: fail_error_in_identifying_extend_require_facet_type.carbon:[[@LINE-4]]:24-39: note: array bound of -1 is negative [ArrayBoundNegative] // CHECK:STDERR: impl {} as J(-1) {} @@ -87,18 +79,10 @@ constraint S(N: Core.IntLiteral) { fn F(generic N: Core.IntLiteral, generic _: S(N) where .Z2 impls Y) {} fn G(generic T: Y) { - // CHECK:STDERR: fail_monomorphization_during_period_self_substitution.carbon:[[@LINE+13]]:3: error: facet type `S(-1) where .(CanFailToMonomorphize(-1).Z2) impls Y` can not be identified [ImplLookupInUnidentifiedFacetType] - // CHECK:STDERR: F(-1, T); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_monomorphization_during_period_self_substitution.carbon:[[@LINE-18]]:24: note: `CanFailToMonomorphize(N)` evaluates to incomplete type `CanFailToMonomorphize(-1)` [IncompleteTypeInMonomorphization] - // CHECK:STDERR: extend require impls CanFailToMonomorphize(N); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_monomorphization_during_period_self_substitution.carbon:[[@LINE-26]]:21: note: array bound of -1 is negative [ArrayBoundNegative] - // CHECK:STDERR: let Z1: Array((), N); - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_monomorphization_during_period_self_substitution.carbon:[[@LINE-12]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn F(generic N: Core.IntLiteral, generic _: S(N) where .Z2 impls Y) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_monomorphization_during_period_self_substitution.carbon:[[@LINE+5]]:3-10: error: facet type `S(-1) where .(CanFailToMonomorphize(-1).Z2) impls Y` can not be identified [ImplLookupInUnidentifiedFacetType] + // CHECK:STDERR: fail_monomorphization_during_period_self_substitution.carbon:[[@LINE-16]]:24-47: note: `CanFailToMonomorphize(N)` evaluates to incomplete type `CanFailToMonomorphize(-1)` [IncompleteTypeInMonomorphization] + // CHECK:STDERR: fail_monomorphization_during_period_self_substitution.carbon:[[@LINE-22]]:21: note: array bound of -1 is negative [ArrayBoundNegative] + // CHECK:STDERR: fail_monomorphization_during_period_self_substitution.carbon:[[@LINE-6]]:1-69: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: F(-1, T); }; @@ -121,15 +105,9 @@ constraint S(N: Core.IntLiteral) { fn F(generic N: Core.IntLiteral, generic _: S(N)) {} fn G(generic T: Z) { - // CHECK:STDERR: fail_monomorphization_identify_in_call.carbon:[[@LINE+10]]:3: error: facet type `S(-1)` can not be identified [ImplLookupInUnidentifiedFacetType] - // CHECK:STDERR: F(-1, T); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_monomorphization_identify_in_call.carbon:[[@LINE-9]]:24: note: array bound of -1 is negative [ArrayBoundNegative] - // CHECK:STDERR: extend require impls Z where .Z1 = Array((), N); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_monomorphization_identify_in_call.carbon:[[@LINE-9]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn F(generic N: Core.IntLiteral, generic _: S(N)) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_monomorphization_identify_in_call.carbon:[[@LINE+4]]:3-10: error: facet type `S(-1)` can not be identified [ImplLookupInUnidentifiedFacetType] + // CHECK:STDERR: fail_monomorphization_identify_in_call.carbon:[[@LINE-7]]:24-49: note: array bound of -1 is negative [ArrayBoundNegative] + // CHECK:STDERR: fail_monomorphization_identify_in_call.carbon:[[@LINE-5]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: F(-1, T); }; @@ -152,15 +130,9 @@ constraint S(N: Core.IntLiteral) { fn F(generic N: Core.IntLiteral, generic _: S(N) where .Z1 = Array((), N)) {} fn G(generic T: Z) { - // CHECK:STDERR: fail_monomorphization_during_deduction_in_call.carbon:[[@LINE+10]]:3: error: constructed invalid specific for `S(N) where .(Z.Z1) = ` from argument [SubstitutingGenericParamType] - // CHECK:STDERR: F(-1, T); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_monomorphization_during_deduction_in_call.carbon:[[@LINE-6]]:42: note: array bound of -1 is negative [ArrayBoundNegative] - // CHECK:STDERR: fn F(generic N: Core.IntLiteral, generic _: S(N) where .Z1 = Array((), N)) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_monomorphization_during_deduction_in_call.carbon:[[@LINE-9]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn F(generic N: Core.IntLiteral, generic _: S(N) where .Z1 = Array((), N)) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_monomorphization_during_deduction_in_call.carbon:[[@LINE+4]]:3-10: error: constructed invalid specific for `S(N) where .(Z.Z1) = ` from argument [SubstitutingGenericParamType] + // CHECK:STDERR: fail_monomorphization_during_deduction_in_call.carbon:[[@LINE-4]]:42-73: note: array bound of -1 is negative [ArrayBoundNegative] + // CHECK:STDERR: fail_monomorphization_during_deduction_in_call.carbon:[[@LINE-5]]:1-76: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: F(-1, T); }; diff --git a/toolchain/check/testdata/generic/import.carbon b/toolchain/check/testdata/generic/import.carbon index 98a7730d9777..23d40e8892f5 100644 --- a/toolchain/check/testdata/generic/import.carbon +++ b/toolchain/check/testdata/generic/import.carbon @@ -34,11 +34,9 @@ class Middle(T: type) { // Consequently, this test can be removed if this TODO is resolved and there are // no other ways of triggering an error while importing a valid generic. -// CHECK:STDERR: fail_use.carbon:[[@LINE+6]]:1: in import [InImport] -// CHECK:STDERR: middle.carbon:3:10: in file included here [InCppInclude] +// CHECK:STDERR: imported from: fail_use.carbon:[[@LINE+4]]:1 [InImport] +// CHECK:STDERR: included from: middle.carbon:3:10 [InCppInclude] // CHECK:STDERR: ./leaf.h:2:7: error: semantics TODO: `indirect import of C++ declaration with no direct Cpp import` [SemanticsTodo] -// CHECK:STDERR: class Leaf {}; -// CHECK:STDERR: ^ // CHECK:STDERR: import library "lib"; diff --git a/toolchain/check/testdata/generic/local.carbon b/toolchain/check/testdata/generic/local.carbon index 87d61760fd8a..3b4e586b3944 100644 --- a/toolchain/check/testdata/generic/local.carbon +++ b/toolchain/check/testdata/generic/local.carbon @@ -29,12 +29,8 @@ library "[[@TEST_NAME]]"; fn F() { // TODO: Decide on what behavior we want here. We don't reject the corresponding case outside of a function. - // CHECK:STDERR: fail_param_shadows_class.carbon:[[@LINE+7]]:9: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] - // CHECK:STDERR: class C(C: type) { - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_param_shadows_class.carbon:[[@LINE+4]]:11: note: name is previously declared here [NameDeclPrevious] - // CHECK:STDERR: class C(C: type) { - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_param_shadows_class.carbon:[[@LINE+3]]:9: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] + // CHECK:STDERR: fail_param_shadows_class.carbon:[[@LINE+2]]:11-17: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: class C(C: type) { } @@ -355,9 +351,9 @@ class C(C: type) { // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @C(%C.loc13_12.2: type) { -// CHECK:STDOUT: %C.patt.loc13_12.2: %pattern_type = symbolic_binding_pattern C, 0 [symbolic = %C.patt.loc13_12.2 (constants.%C.patt)] -// CHECK:STDOUT: %C.loc13_12.1: type = symbolic_binding C, 0 [symbolic = %C.loc13_12.1 (constants.%C.67d)] +// CHECK:STDOUT: generic class @C(%C.loc9_12.2: type) { +// CHECK:STDOUT: %C.patt.loc9_12.2: %pattern_type = symbolic_binding_pattern C, 0 [symbolic = %C.patt.loc9_12.2 (constants.%C.patt)] +// CHECK:STDOUT: %C.loc9_12.1: type = symbolic_binding C, 0 [symbolic = %C.loc9_12.1 (constants.%C.67d)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -373,20 +369,20 @@ class C(C: type) { // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.decl: %C.type = class_decl @C [concrete = constants.%C.generic] { -// CHECK:STDOUT: %C.patt.loc13_12.1: %pattern_type = symbolic_binding_pattern C, 0 [symbolic = %C.patt.loc13_12.2 (constants.%C.patt)] +// CHECK:STDOUT: %C.patt.loc9_12.1: %pattern_type = symbolic_binding_pattern C, 0 [symbolic = %C.patt.loc9_12.2 (constants.%C.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc13_14.1: type = splice_block %.loc13_14.2 [concrete = type] { +// CHECK:STDOUT: %.loc9_14.1: type = splice_block %.loc9_14.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc13_14.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc9_14.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %C.loc13_12.2: type = symbolic_binding C, 0 [symbolic = %C.loc13_12.1 (constants.%C.67d)] +// CHECK:STDOUT: %C.loc9_12.2: type = symbolic_binding C, 0 [symbolic = %C.loc9_12.1 (constants.%C.67d)] // CHECK:STDOUT: } // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @C(constants.%C.67d) { -// CHECK:STDOUT: %C.patt.loc13_12.2 => constants.%C.patt -// CHECK:STDOUT: %C.loc13_12.1 => constants.%C.67d +// CHECK:STDOUT: %C.patt.loc9_12.2 => constants.%C.patt +// CHECK:STDOUT: %C.loc9_12.1 => constants.%C.67d // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- nonlocal_param_shadows_class.carbon diff --git a/toolchain/check/testdata/generic/template/argument.carbon b/toolchain/check/testdata/generic/template/argument.carbon index 90806e22160f..0e4cab7486f6 100644 --- a/toolchain/check/testdata/generic/template/argument.carbon +++ b/toolchain/check/testdata/generic/template/argument.carbon @@ -74,12 +74,8 @@ let T: type = Y; fn F(template T: type, unused y: T) {} fn H(y: Y) { - // CHECK:STDERR: fail_non_constant_type_argument.carbon:[[@LINE+7]]:3: error: argument for generic parameter is not a compile-time constant [CompTimeArgumentNotConstant] - // CHECK:STDERR: F(T, y); - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_non_constant_type_argument.carbon:[[@LINE-6]]:6: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(template T: type, unused y: T) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_non_constant_type_argument.carbon:[[@LINE+3]]:3-9: error: argument for generic parameter is not a compile-time constant [CompTimeArgumentNotConstant] + // CHECK:STDERR: fail_non_constant_type_argument.carbon:[[@LINE-4]]:6-21: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: F(T, y); } @@ -92,12 +88,8 @@ class Y {} fn F(unused template X: Y) {} fn H(y: Y) { - // CHECK:STDERR: fail_non_constant_nontype_argument.carbon:[[@LINE+7]]:3: error: argument for generic parameter is not a compile-time constant [CompTimeArgumentNotConstant] - // CHECK:STDERR: F(y); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_non_constant_nontype_argument.carbon:[[@LINE-6]]:13: note: initializing generic parameter `X` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(unused template X: Y) {} - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_non_constant_nontype_argument.carbon:[[@LINE+3]]:3-6: error: argument for generic parameter is not a compile-time constant [CompTimeArgumentNotConstant] + // CHECK:STDERR: fail_non_constant_nontype_argument.carbon:[[@LINE-4]]:13-25: note: initializing generic parameter `X` declared here [InitializingGenericParam] // CHECK:STDERR: F(y); } diff --git a/toolchain/check/testdata/generic/template/call.carbon b/toolchain/check/testdata/generic/template/call.carbon index 70ed8a5f834f..3adf5c64fe2a 100644 --- a/toolchain/check/testdata/generic/template/call.carbon +++ b/toolchain/check/testdata/generic/template/call.carbon @@ -20,12 +20,8 @@ fn F[template G: type](H: G, x: X) { } fn TakeX(unused x: X) {} -// CHECK:STDERR: fail_todo_dependent_call_nonconst_arg.carbon:[[@LINE+7]]:21: error: unable to monomorphize specific `F()` [ResolvingSpecificHere] -// CHECK:STDERR: fn GoodCall(x: X) { F(TakeX, x); } -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_todo_dependent_call_nonconst_arg.carbon:[[@LINE-7]]:3: note: value of type `` is not callable [CallToNonCallable] -// CHECK:STDERR: H(x); -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_todo_dependent_call_nonconst_arg.carbon:[[@LINE+3]]:21: error: unable to monomorphize specific `F()` [ResolvingSpecificHere] +// CHECK:STDERR: fail_todo_dependent_call_nonconst_arg.carbon:[[@LINE-5]]:3-6: note: value of type `` is not callable [CallToNonCallable] // CHECK:STDERR: fn GoodCall(x: X) { F(TakeX, x); } @@ -40,11 +36,7 @@ fn F[template G: type](H: G, x: X) { fn TakeY(unused y: Y) {} // TODO: should fail, but not because of UseOfNonExprAsValue -// CHECK:STDERR: fail_dependent_call_nonconst_arg_wrong_type.carbon:[[@LINE+7]]:20: error: unable to monomorphize specific `F()` [ResolvingSpecificHere] -// CHECK:STDERR: fn BadCall(x: X) { F(TakeY, x); } -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_dependent_call_nonconst_arg_wrong_type.carbon:[[@LINE-8]]:3: note: value of type `` is not callable [CallToNonCallable] -// CHECK:STDERR: H(x); -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_dependent_call_nonconst_arg_wrong_type.carbon:[[@LINE+3]]:20: error: unable to monomorphize specific `F()` [ResolvingSpecificHere] +// CHECK:STDERR: fail_dependent_call_nonconst_arg_wrong_type.carbon:[[@LINE-6]]:3-6: note: value of type `` is not callable [CallToNonCallable] // CHECK:STDERR: fn BadCall(x: X) { F(TakeY, x); } diff --git a/toolchain/check/testdata/generic/template/convert.carbon b/toolchain/check/testdata/generic/template/convert.carbon index e793c5a43200..cfbdd98a0b4b 100644 --- a/toolchain/check/testdata/generic/template/convert.carbon +++ b/toolchain/check/testdata/generic/template/convert.carbon @@ -48,15 +48,9 @@ fn F[template T: type](x: T) -> i32 { class D {} fn Test(d: D) -> i32 { - // 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: fail_cannot_convert.carbon:[[@LINE+4]]:10: error: unable to monomorphize specific `F(D)` [ResolvingSpecificHere] + // CHECK:STDERR: fail_cannot_convert.carbon:[[@LINE-8]]:16: note: cannot implicitly convert expression of type `D` to `i32` [ConversionFailure] + // CHECK:STDERR: fail_cannot_convert.carbon:[[@LINE-9]]:16: note: type `D` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return F(d); } @@ -184,15 +178,9 @@ fn AsI32[template T: type](x: T) -> i32 { class D {} fn Test(d: D) { - // CHECK:STDERR: fail_cannot_as.carbon:[[@LINE+10]]:16: error: unable to monomorphize specific `AsI32(D)` [ResolvingSpecificHere] - // CHECK:STDERR: let _: i32 = AsI32(d); - // CHECK:STDERR: ^~~~~ - // CHECK:STDERR: fail_cannot_as.carbon:[[@LINE-9]]:10: note: cannot convert expression of type `D` to `i32` with `as` [ConversionFailure] - // CHECK:STDERR: return x as i32; - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_cannot_as.carbon:[[@LINE-12]]:10: note: type `D` does not implement interface `Core.As(i32)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return x as i32; - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_cannot_as.carbon:[[@LINE+4]]:16-20: error: unable to monomorphize specific `AsI32(D)` [ResolvingSpecificHere] + // CHECK:STDERR: fail_cannot_as.carbon:[[@LINE-7]]:10-17: note: cannot convert expression of type `D` to `i32` with `as` [ConversionFailure] + // CHECK:STDERR: fail_cannot_as.carbon:[[@LINE-8]]:10-17: note: type `D` does not implement interface `Core.As(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: i32 = AsI32(d); } @@ -233,15 +221,9 @@ fn AsType[template T: type](x: T, template U: type) { class D {} fn Test(d: D) { - // CHECK:STDERR: fail_cannot_as_type.carbon:[[@LINE+10]]:3: error: unable to monomorphize specific `AsType(D, i32)` [ResolvingSpecificHere] - // CHECK:STDERR: AsType(d, i32); - // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_cannot_as_type.carbon:[[@LINE-9]]:14: note: cannot convert expression of type `D` to `i32` with `as` [ConversionFailure] - // CHECK:STDERR: let _: U = x as U; - // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_cannot_as_type.carbon:[[@LINE-12]]:14: note: type `D` does not implement interface `Core.As(i32)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let _: U = x as U; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_cannot_as_type.carbon:[[@LINE+4]]:3-8: error: unable to monomorphize specific `AsType(D, i32)` [ResolvingSpecificHere] + // CHECK:STDERR: fail_cannot_as_type.carbon:[[@LINE-7]]:14-19: note: cannot convert expression of type `D` to `i32` with `as` [ConversionFailure] + // CHECK:STDERR: fail_cannot_as_type.carbon:[[@LINE-8]]:14-19: note: type `D` does not implement interface `Core.As(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: AsType(d, i32); } diff --git a/toolchain/check/testdata/generic/template/member_access.carbon b/toolchain/check/testdata/generic/template/member_access.carbon index fad749f45c50..38c9d567b250 100644 --- a/toolchain/check/testdata/generic/template/member_access.carbon +++ b/toolchain/check/testdata/generic/template/member_access.carbon @@ -47,12 +47,8 @@ class D { } fn Test(d: D) { - // 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: fail_no_such_member.carbon:[[@LINE+3]]:3: error: unable to monomorphize specific `F(D)` [ResolvingSpecificHere] + // CHECK:STDERR: fail_no_such_member.carbon:[[@LINE-10]]:16-18: note: member name `n` not found in `D` [MemberNameNotFoundInInstScope] // CHECK:STDERR: F(d); } @@ -72,15 +68,9 @@ class E { } fn Test(e: E) { - // 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: fail_member_wrong_type.carbon:[[@LINE+4]]:3: error: unable to monomorphize specific `F(E)` [ResolvingSpecificHere] + // CHECK:STDERR: fail_member_wrong_type.carbon:[[@LINE-11]]:16-18: note: cannot implicitly convert expression of type `F` to `i32` [ConversionFailure] + // CHECK:STDERR: fail_member_wrong_type.carbon:[[@LINE-12]]:16-18: note: type `F` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: F(e); } diff --git a/toolchain/check/testdata/generic/template/member_out_of_line.carbon b/toolchain/check/testdata/generic/template/member_out_of_line.carbon index 9c96b4c4812d..4a6612536560 100644 --- a/toolchain/check/testdata/generic/template/member_out_of_line.carbon +++ b/toolchain/check/testdata/generic/template/member_out_of_line.carbon @@ -21,23 +21,15 @@ class Class(template T: type) { var n: T; } -// CHECK:STDERR: fail_todo_basic.carbon:[[@LINE+7]]:30: error: type `>>` of parameter 1 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] -// CHECK:STDERR: fn Class(template T: type).F(n: T.U) -> T.U { -// CHECK:STDERR: ^~~~~~ -// CHECK:STDERR: fail_todo_basic.carbon:[[@LINE-8]]:8: note: previous declaration's corresponding parameter here [RedeclParamPrevious] -// CHECK:STDERR: fn F(n: T) -> T; -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_todo_basic.carbon:[[@LINE+3]]:30-35: error: type `>>` of parameter 1 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] +// CHECK:STDERR: fail_todo_basic.carbon:[[@LINE-6]]:8-11: note: previous declaration's corresponding parameter here [RedeclParamPrevious] // CHECK:STDERR: fn Class(template T: type).F(n: T.U) -> T.U { return n; } -// CHECK:STDERR: fail_todo_basic.carbon:[[@LINE+7]]:1: error: function redeclaration differs because return type is `>` [FunctionRedeclReturnTypeDiffers] -// CHECK:STDERR: fn Class(template T: type).G(self) -> T.U { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_todo_basic.carbon:[[@LINE-18]]:3: note: previously declared with return type `T` [FunctionRedeclReturnTypePrevious] -// CHECK:STDERR: fn G(self) -> T; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_basic.carbon:[[@LINE+3]]:1-43: error: function redeclaration differs because return type is `>` [FunctionRedeclReturnTypeDiffers] +// CHECK:STDERR: fail_todo_basic.carbon:[[@LINE-12]]:3-18: note: previously declared with return type `T` [FunctionRedeclReturnTypePrevious] // CHECK:STDERR: fn Class(template T: type).G(self) -> T.U { return self.n; @@ -72,15 +64,15 @@ fn Class(template T: type).G(self) -> T.U { // CHECK:STDOUT: %Class.elem: type = unbound_element_type %Class, %T [template] // CHECK:STDOUT: %struct_type.n: type = struct_type {.n: %T} [template] // CHECK:STDOUT: %complete_type: = complete_type_witness %struct_type.n [template] -// CHECK:STDOUT: %.eff391.1: type = type_of_inst @Class.F.loc18.%.loc18_34.1 [template] -// CHECK:STDOUT: %.b66113.1: %.eff391.1 = splice_inst @Class.F.loc18.%.loc18_34.1 [template] -// CHECK:STDOUT: %.5372ba.1: type = splice_inst @Class.F.loc18.%.loc18_34.4 [template] +// CHECK:STDOUT: %.eff391.1: type = type_of_inst @Class.F.loc14.%.loc14_34.1 [template] +// CHECK:STDOUT: %.b66113.1: %.eff391.1 = splice_inst @Class.F.loc14.%.loc14_34.1 [template] +// CHECK:STDOUT: %.5372ba.1: type = splice_inst @Class.F.loc14.%.loc14_34.4 [template] // CHECK:STDOUT: %pattern_type.fcb8f3.1: type = pattern_type %.5372ba.1 [template] // CHECK:STDOUT: %n.param_patt.110b44.1: %pattern_type.fcb8f3.1 = value_param_pattern [template] // CHECK:STDOUT: %n.patt.9e3e22.1: %pattern_type.fcb8f3.1 = wrapper_binding_pattern n, %n.param_patt.110b44.1 [template] -// CHECK:STDOUT: %.eff391.2: type = type_of_inst @Class.F.loc18.%.loc18_42.1 [template] -// CHECK:STDOUT: %.b66113.2: %.eff391.2 = splice_inst @Class.F.loc18.%.loc18_42.1 [template] -// CHECK:STDOUT: %.5372ba.2: type = splice_inst @Class.F.loc18.%.loc18_42.4 [template] +// CHECK:STDOUT: %.eff391.2: type = type_of_inst @Class.F.loc14.%.loc14_42.1 [template] +// CHECK:STDOUT: %.b66113.2: %.eff391.2 = splice_inst @Class.F.loc14.%.loc14_42.1 [template] +// CHECK:STDOUT: %.5372ba.2: type = splice_inst @Class.F.loc14.%.loc14_42.4 [template] // CHECK:STDOUT: %.cd79f1.1: Core.Form = init_form %.5372ba.2 [template] // CHECK:STDOUT: %pattern_type.fcb8f3.2: type = pattern_type %.5372ba.2 [template] // CHECK:STDOUT: %return.param_patt.2e9ac5.1: %pattern_type.fcb8f3.2 = out_param_pattern [template] @@ -96,26 +88,26 @@ fn Class(template T: type).G(self) -> T.U { // CHECK:STDOUT: %.cd79f1.2: Core.Form = init_form %.5372ba.3 [template] // CHECK:STDOUT: %return.param_patt.2e9ac5.2: %pattern_type.fcb8f3.3 = out_param_pattern [template] // CHECK:STDOUT: %return.patt.7fc6a1.2: %pattern_type.fcb8f3.3 = return_slot_pattern %return.param_patt.2e9ac5.2, %.5372ba.3 [template] -// CHECK:STDOUT: %Class.F.type.30a249.2: type = fn_type @Class.F.loc18, @Class(%T) [template] +// CHECK:STDOUT: %Class.F.type.30a249.2: type = fn_type @Class.F.loc14, @Class(%T) [template] // CHECK:STDOUT: %Class.F.4883b3.2: %Class.F.type.30a249.2 = struct_value () [template] // CHECK:STDOUT: %require_complete.cb0614.1: = require_complete_type %.5372ba.1 [template] // CHECK:STDOUT: %require_complete.cb0614.2: = require_complete_type %.5372ba.2 [template] // CHECK:STDOUT: %tuple.type: type = tuple_type () [concrete] -// CHECK:STDOUT: %.5d6323.1: %.5372ba.2 = splice_inst @Class.F.loc18.%tuple.elem0 [template] -// CHECK:STDOUT: %.eff391.4: type = type_of_inst @Class.G.loc29.%.loc29_40.1 [template] -// CHECK:STDOUT: %.b66113.4: %.eff391.4 = splice_inst @Class.G.loc29.%.loc29_40.1 [template] -// CHECK:STDOUT: %.5372ba.4: type = splice_inst @Class.G.loc29.%.loc29_40.4 [template] +// CHECK:STDOUT: %.5d6323.1: %.5372ba.2 = splice_inst @Class.F.loc14.%tuple.elem0 [template] +// CHECK:STDOUT: %.eff391.4: type = type_of_inst @Class.G.loc21.%.loc21_40.1 [template] +// CHECK:STDOUT: %.b66113.4: %.eff391.4 = splice_inst @Class.G.loc21.%.loc21_40.1 [template] +// CHECK:STDOUT: %.5372ba.4: type = splice_inst @Class.G.loc21.%.loc21_40.4 [template] // CHECK:STDOUT: %.cd79f1.3: Core.Form = init_form %.5372ba.4 [template] // CHECK:STDOUT: %pattern_type.fcb8f3.4: type = pattern_type %.5372ba.4 [template] // CHECK:STDOUT: %return.param_patt.2e9ac5.3: %pattern_type.fcb8f3.4 = out_param_pattern [template] // CHECK:STDOUT: %return.patt.7fc6a1.3: %pattern_type.fcb8f3.4 = return_slot_pattern %return.param_patt.2e9ac5.3, %.5372ba.4 [template] -// CHECK:STDOUT: %Class.G.type.f7c942.2: type = fn_type @Class.G.loc29, @Class(%T) [template] +// CHECK:STDOUT: %Class.G.type.f7c942.2: type = fn_type @Class.G.loc21, @Class(%T) [template] // CHECK:STDOUT: %Class.G.05f5b3.2: %Class.G.type.f7c942.2 = struct_value () [template] // CHECK:STDOUT: %require_complete.ac0: = require_complete_type %Class [template] // CHECK:STDOUT: %require_complete.cb0614.3: = require_complete_type %.5372ba.4 [template] -// CHECK:STDOUT: %.237: type = type_of_inst @Class.G.loc29.%.loc30_14.3 [template] -// CHECK:STDOUT: %.f96: %.237 = splice_inst @Class.G.loc29.%.loc30_14.3 [template] -// CHECK:STDOUT: %.5d6323.2: %.5372ba.4 = splice_inst @Class.G.loc29.%tuple.elem0 [template] +// CHECK:STDOUT: %.237: type = type_of_inst @Class.G.loc21.%.loc22_14.3 [template] +// CHECK:STDOUT: %.f96: %.237 = splice_inst @Class.G.loc21.%.loc22_14.3 [template] +// CHECK:STDOUT: %.5d6323.2: %.5372ba.4 = splice_inst @Class.G.loc21.%tuple.elem0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -128,60 +120,60 @@ fn Class(template T: type).G(self) -> T.U { // CHECK:STDOUT: } // CHECK:STDOUT: %T.loc5_23.2: type = symbolic_binding T, 0, template [template = %T.loc5_23.1 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Class.F.decl: %Class.F.type.30a249.2 = fn_decl @Class.F.loc18 [template = constants.%Class.F.4883b3.2] { -// CHECK:STDOUT: %n.param_patt.loc18_31.1: @Class.F.loc18.%pattern_type.loc18_31 (%pattern_type.fcb8f3.1) = value_param_pattern [template = %n.param_patt.loc18_31.2 (constants.%n.param_patt.110b44.1)] -// CHECK:STDOUT: %n.patt.loc18_31.1: @Class.F.loc18.%pattern_type.loc18_31 (%pattern_type.fcb8f3.1) = wrapper_binding_pattern n, %n.param_patt.loc18_31.1 [template = %n.patt.loc18_31.2 (constants.%n.patt.9e3e22.1)] -// CHECK:STDOUT: %return.param_patt.loc18_42.1: @Class.F.loc18.%pattern_type.loc18_42 (%pattern_type.fcb8f3.2) = out_param_pattern [template = %return.param_patt.loc18_42.2 (constants.%return.param_patt.2e9ac5.1)] -// CHECK:STDOUT: %return.patt.loc18_38.1: @Class.F.loc18.%pattern_type.loc18_42 (%pattern_type.fcb8f3.2) = return_slot_pattern %return.param_patt.loc18_42.1, %.loc18_42.9 [template = %return.patt.loc18_38.2 (constants.%return.patt.7fc6a1.1)] +// CHECK:STDOUT: %Class.F.decl: %Class.F.type.30a249.2 = fn_decl @Class.F.loc14 [template = constants.%Class.F.4883b3.2] { +// CHECK:STDOUT: %n.param_patt.loc14_31.1: @Class.F.loc14.%pattern_type.loc14_31 (%pattern_type.fcb8f3.1) = value_param_pattern [template = %n.param_patt.loc14_31.2 (constants.%n.param_patt.110b44.1)] +// CHECK:STDOUT: %n.patt.loc14_31.1: @Class.F.loc14.%pattern_type.loc14_31 (%pattern_type.fcb8f3.1) = wrapper_binding_pattern n, %n.param_patt.loc14_31.1 [template = %n.patt.loc14_31.2 (constants.%n.patt.9e3e22.1)] +// CHECK:STDOUT: %return.param_patt.loc14_42.1: @Class.F.loc14.%pattern_type.loc14_42 (%pattern_type.fcb8f3.2) = out_param_pattern [template = %return.param_patt.loc14_42.2 (constants.%return.param_patt.2e9ac5.1)] +// CHECK:STDOUT: %return.patt.loc14_38.1: @Class.F.loc14.%pattern_type.loc14_42 (%pattern_type.fcb8f3.2) = return_slot_pattern %return.param_patt.loc14_42.1, %.loc14_42.9 [template = %return.patt.loc14_38.2 (constants.%return.patt.7fc6a1.1)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc18_22.1: type = splice_block %.loc18_22.2 [concrete = type] { +// CHECK:STDOUT: %.loc14_22.1: type = splice_block %.loc14_22.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc18_22.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc14_22.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc18_20: type = symbolic_binding T, 0, template [template = @Class.%T.loc5_23.1 (constants.%T)] -// CHECK:STDOUT: %.loc18_41: type = specific_constant %T.loc18_20, @Class(constants.%T) [template = %T.loc18_33 (constants.%T)] -// CHECK:STDOUT: %T.ref.loc18_41: type = name_ref T, %.loc18_41 [template = %T.loc18_33 (constants.%T)] -// CHECK:STDOUT: %.loc18_42.7: type = type_of_inst %.loc18_42.1 [template = %.loc18_42.2 (constants.%.eff391.2)] -// CHECK:STDOUT: %.loc18_42.8: @Class.F.loc18.%.loc18_42.2 (%.eff391.2) = splice_inst %.loc18_42.1 [template = %.loc18_42.3 (constants.%.b66113.2)] -// CHECK:STDOUT: %.loc18_42.9: type = splice_inst %.loc18_42.4 [template = %.loc18_42.5 (constants.%.5372ba.2)] -// CHECK:STDOUT: %.loc18_42.10: Core.Form = init_form %.loc18_42.9 [template = %.loc18_42.6 (constants.%.cd79f1.1)] -// CHECK:STDOUT: %n.param: @Class.F.loc18.%.loc18_34.5 (%.5372ba.1) = value_param call_param0 -// CHECK:STDOUT: %.loc18_34.6: type = splice_block %.loc18_34.9 [template = %.loc18_34.5 (constants.%.5372ba.1)] { -// CHECK:STDOUT: %.loc18_33: type = specific_constant %T.loc18_20, @Class(constants.%T) [template = %T.loc18_33 (constants.%T)] -// CHECK:STDOUT: %T.ref.loc18_33: type = name_ref T, %.loc18_33 [template = %T.loc18_33 (constants.%T)] -// CHECK:STDOUT: %.loc18_34.7: type = type_of_inst %.loc18_34.1 [template = %.loc18_34.2 (constants.%.eff391.1)] -// CHECK:STDOUT: %.loc18_34.8: @Class.F.loc18.%.loc18_34.2 (%.eff391.1) = splice_inst %.loc18_34.1 [template = %.loc18_34.3 (constants.%.b66113.1)] -// CHECK:STDOUT: %.loc18_34.9: type = splice_inst %.loc18_34.4 [template = %.loc18_34.5 (constants.%.5372ba.1)] +// CHECK:STDOUT: %T.loc14_20: type = symbolic_binding T, 0, template [template = @Class.%T.loc5_23.1 (constants.%T)] +// CHECK:STDOUT: %.loc14_41: type = specific_constant %T.loc14_20, @Class(constants.%T) [template = %T.loc14_33 (constants.%T)] +// CHECK:STDOUT: %T.ref.loc14_41: type = name_ref T, %.loc14_41 [template = %T.loc14_33 (constants.%T)] +// CHECK:STDOUT: %.loc14_42.7: type = type_of_inst %.loc14_42.1 [template = %.loc14_42.2 (constants.%.eff391.2)] +// CHECK:STDOUT: %.loc14_42.8: @Class.F.loc14.%.loc14_42.2 (%.eff391.2) = splice_inst %.loc14_42.1 [template = %.loc14_42.3 (constants.%.b66113.2)] +// CHECK:STDOUT: %.loc14_42.9: type = splice_inst %.loc14_42.4 [template = %.loc14_42.5 (constants.%.5372ba.2)] +// CHECK:STDOUT: %.loc14_42.10: Core.Form = init_form %.loc14_42.9 [template = %.loc14_42.6 (constants.%.cd79f1.1)] +// CHECK:STDOUT: %n.param: @Class.F.loc14.%.loc14_34.5 (%.5372ba.1) = value_param call_param0 +// CHECK:STDOUT: %.loc14_34.6: type = splice_block %.loc14_34.9 [template = %.loc14_34.5 (constants.%.5372ba.1)] { +// CHECK:STDOUT: %.loc14_33: type = specific_constant %T.loc14_20, @Class(constants.%T) [template = %T.loc14_33 (constants.%T)] +// CHECK:STDOUT: %T.ref.loc14_33: type = name_ref T, %.loc14_33 [template = %T.loc14_33 (constants.%T)] +// CHECK:STDOUT: %.loc14_34.7: type = type_of_inst %.loc14_34.1 [template = %.loc14_34.2 (constants.%.eff391.1)] +// CHECK:STDOUT: %.loc14_34.8: @Class.F.loc14.%.loc14_34.2 (%.eff391.1) = splice_inst %.loc14_34.1 [template = %.loc14_34.3 (constants.%.b66113.1)] +// CHECK:STDOUT: %.loc14_34.9: type = splice_inst %.loc14_34.4 [template = %.loc14_34.5 (constants.%.5372ba.1)] // CHECK:STDOUT: } -// CHECK:STDOUT: %n: @Class.F.loc18.%.loc18_34.5 (%.5372ba.1) = wrapper_binding n, %n.param -// CHECK:STDOUT: %return.param: ref @Class.F.loc18.%.loc18_42.5 (%.5372ba.2) = out_param call_param1 -// CHECK:STDOUT: %return: ref @Class.F.loc18.%.loc18_42.5 (%.5372ba.2) = return_slot %return.param +// CHECK:STDOUT: %n: @Class.F.loc14.%.loc14_34.5 (%.5372ba.1) = wrapper_binding n, %n.param +// CHECK:STDOUT: %return.param: ref @Class.F.loc14.%.loc14_42.5 (%.5372ba.2) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Class.F.loc14.%.loc14_42.5 (%.5372ba.2) = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Class.G.decl: %Class.G.type.f7c942.2 = fn_decl @Class.G.loc29 [template = constants.%Class.G.05f5b3.2] { -// CHECK:STDOUT: %self.param_patt.loc29_30.1: @Class.G.loc29.%pattern_type.loc29_30 (%pattern_type.28f) = value_param_pattern [template = %self.param_patt.loc29_30.2 (constants.%self.param_patt)] -// CHECK:STDOUT: %self.patt.loc29_30.1: @Class.G.loc29.%pattern_type.loc29_30 (%pattern_type.28f) = wrapper_binding_pattern self, %self.param_patt.loc29_30.1 [template = %self.patt.loc29_30.2 (constants.%self.patt)] -// CHECK:STDOUT: %return.param_patt.loc29_40.1: @Class.G.loc29.%pattern_type.loc29_40 (%pattern_type.fcb8f3.4) = out_param_pattern [template = %return.param_patt.loc29_40.2 (constants.%return.param_patt.2e9ac5.3)] -// CHECK:STDOUT: %return.patt.loc29_36.1: @Class.G.loc29.%pattern_type.loc29_40 (%pattern_type.fcb8f3.4) = return_slot_pattern %return.param_patt.loc29_40.1, %.loc29_40.9 [template = %return.patt.loc29_36.2 (constants.%return.patt.7fc6a1.3)] +// CHECK:STDOUT: %Class.G.decl: %Class.G.type.f7c942.2 = fn_decl @Class.G.loc21 [template = constants.%Class.G.05f5b3.2] { +// CHECK:STDOUT: %self.param_patt.loc21_30.1: @Class.G.loc21.%pattern_type.loc21_30 (%pattern_type.28f) = value_param_pattern [template = %self.param_patt.loc21_30.2 (constants.%self.param_patt)] +// CHECK:STDOUT: %self.patt.loc21_30.1: @Class.G.loc21.%pattern_type.loc21_30 (%pattern_type.28f) = wrapper_binding_pattern self, %self.param_patt.loc21_30.1 [template = %self.patt.loc21_30.2 (constants.%self.patt)] +// CHECK:STDOUT: %return.param_patt.loc21_40.1: @Class.G.loc21.%pattern_type.loc21_40 (%pattern_type.fcb8f3.4) = out_param_pattern [template = %return.param_patt.loc21_40.2 (constants.%return.param_patt.2e9ac5.3)] +// CHECK:STDOUT: %return.patt.loc21_36.1: @Class.G.loc21.%pattern_type.loc21_40 (%pattern_type.fcb8f3.4) = return_slot_pattern %return.param_patt.loc21_40.1, %.loc21_40.9 [template = %return.patt.loc21_36.2 (constants.%return.patt.7fc6a1.3)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc29_22.1: type = splice_block %.loc29_22.2 [concrete = type] { +// CHECK:STDOUT: %.loc21_22.1: type = splice_block %.loc21_22.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc29_22.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc21_22.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc29_20: type = symbolic_binding T, 0, template [template = @Class.%T.loc5_23.1 (constants.%T)] -// CHECK:STDOUT: %.loc29_39: type = specific_constant %T.loc29_20, @Class(constants.%T) [template = %T.loc29_30 (constants.%T)] -// CHECK:STDOUT: %T.ref: type = name_ref T, %.loc29_39 [template = %T.loc29_30 (constants.%T)] -// CHECK:STDOUT: %.loc29_40.7: type = type_of_inst %.loc29_40.1 [template = %.loc29_40.2 (constants.%.eff391.4)] -// CHECK:STDOUT: %.loc29_40.8: @Class.G.loc29.%.loc29_40.2 (%.eff391.4) = splice_inst %.loc29_40.1 [template = %.loc29_40.3 (constants.%.b66113.4)] -// CHECK:STDOUT: %.loc29_40.9: type = splice_inst %.loc29_40.4 [template = %.loc29_40.5 (constants.%.5372ba.4)] -// CHECK:STDOUT: %.loc29_40.10: Core.Form = init_form %.loc29_40.9 [template = %.loc29_40.6 (constants.%.cd79f1.3)] -// CHECK:STDOUT: %self.param: @Class.G.loc29.%Class (%Class) = value_param call_param0 -// CHECK:STDOUT: %.loc29_30.1: type = splice_block %Self.ref [template = %Class (constants.%Class)] { -// CHECK:STDOUT: %.loc29_30.2: type = specific_constant constants.%Class, @Class(constants.%T) [template = %Class (constants.%Class)] -// CHECK:STDOUT: %Self.ref: type = name_ref Self, %.loc29_30.2 [template = %Class (constants.%Class)] +// CHECK:STDOUT: %T.loc21_20: type = symbolic_binding T, 0, template [template = @Class.%T.loc5_23.1 (constants.%T)] +// CHECK:STDOUT: %.loc21_39: type = specific_constant %T.loc21_20, @Class(constants.%T) [template = %T.loc21_30 (constants.%T)] +// CHECK:STDOUT: %T.ref: type = name_ref T, %.loc21_39 [template = %T.loc21_30 (constants.%T)] +// CHECK:STDOUT: %.loc21_40.7: type = type_of_inst %.loc21_40.1 [template = %.loc21_40.2 (constants.%.eff391.4)] +// CHECK:STDOUT: %.loc21_40.8: @Class.G.loc21.%.loc21_40.2 (%.eff391.4) = splice_inst %.loc21_40.1 [template = %.loc21_40.3 (constants.%.b66113.4)] +// CHECK:STDOUT: %.loc21_40.9: type = splice_inst %.loc21_40.4 [template = %.loc21_40.5 (constants.%.5372ba.4)] +// CHECK:STDOUT: %.loc21_40.10: Core.Form = init_form %.loc21_40.9 [template = %.loc21_40.6 (constants.%.cd79f1.3)] +// CHECK:STDOUT: %self.param: @Class.G.loc21.%Class (%Class) = value_param call_param0 +// CHECK:STDOUT: %.loc21_30.1: type = splice_block %Self.ref [template = %Class (constants.%Class)] { +// CHECK:STDOUT: %.loc21_30.2: type = specific_constant constants.%Class, @Class(constants.%T) [template = %Class (constants.%Class)] +// CHECK:STDOUT: %Self.ref: type = name_ref Self, %.loc21_30.2 [template = %Class (constants.%Class)] // CHECK:STDOUT: } -// CHECK:STDOUT: %self: @Class.G.loc29.%Class (%Class) = wrapper_binding self, %self.param -// CHECK:STDOUT: %return.param: ref @Class.G.loc29.%.loc29_40.5 (%.5372ba.4) = out_param call_param1 -// CHECK:STDOUT: %return: ref @Class.G.loc29.%.loc29_40.5 (%.5372ba.4) = return_slot %return.param +// CHECK:STDOUT: %self: @Class.G.loc21.%Class (%Class) = wrapper_binding self, %self.param +// CHECK:STDOUT: %return.param: ref @Class.G.loc21.%.loc21_40.5 (%.5372ba.4) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Class.G.loc21.%.loc21_40.5 (%.5372ba.4) = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -278,74 +270,74 @@ fn Class(template T: type).G(self) -> T.U { // CHECK:STDOUT: fn(%self.param: @Class.G.loc7.%Class (%Class)) -> out %return.param: @Class.G.loc7.%T (%T); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Class.F.loc18(%T.loc18_20: type) { -// CHECK:STDOUT: %T.loc18_33: type = symbolic_binding T, 0, template [template = %T.loc18_33 (constants.%T)] -// CHECK:STDOUT: %.loc18_34.1: = access_member_action %T.ref.loc18_33, U [template] -// CHECK:STDOUT: %.loc18_34.2: type = type_of_inst %.loc18_34.1 [template = %.loc18_34.2 (constants.%.eff391.1)] -// CHECK:STDOUT: %.loc18_34.3: @Class.F.loc18.%.loc18_34.2 (%.eff391.1) = splice_inst %.loc18_34.1 [template = %.loc18_34.3 (constants.%.b66113.1)] -// CHECK:STDOUT: %.loc18_34.4: = convert_to_value_action %.loc18_34.8, type [template] -// CHECK:STDOUT: %.loc18_34.5: type = splice_inst %.loc18_34.4 [template = %.loc18_34.5 (constants.%.5372ba.1)] -// CHECK:STDOUT: %pattern_type.loc18_31: type = pattern_type %.loc18_34.5 [template = %pattern_type.loc18_31 (constants.%pattern_type.fcb8f3.1)] -// CHECK:STDOUT: %n.param_patt.loc18_31.2: @Class.F.loc18.%pattern_type.loc18_31 (%pattern_type.fcb8f3.1) = value_param_pattern [template = %n.param_patt.loc18_31.2 (constants.%n.param_patt.110b44.1)] -// CHECK:STDOUT: %n.patt.loc18_31.2: @Class.F.loc18.%pattern_type.loc18_31 (%pattern_type.fcb8f3.1) = wrapper_binding_pattern n, %n.param_patt.loc18_31.2 [template = %n.patt.loc18_31.2 (constants.%n.patt.9e3e22.1)] -// CHECK:STDOUT: %.loc18_42.1: = access_member_action %T.ref.loc18_41, U [template] -// CHECK:STDOUT: %.loc18_42.2: type = type_of_inst %.loc18_42.1 [template = %.loc18_42.2 (constants.%.eff391.2)] -// CHECK:STDOUT: %.loc18_42.3: @Class.F.loc18.%.loc18_42.2 (%.eff391.2) = splice_inst %.loc18_42.1 [template = %.loc18_42.3 (constants.%.b66113.2)] -// CHECK:STDOUT: %.loc18_42.4: = convert_to_value_action %.loc18_42.8, type [template] -// CHECK:STDOUT: %.loc18_42.5: type = splice_inst %.loc18_42.4 [template = %.loc18_42.5 (constants.%.5372ba.2)] -// CHECK:STDOUT: %.loc18_42.6: Core.Form = init_form %.loc18_42.5 [template = %.loc18_42.6 (constants.%.cd79f1.1)] -// CHECK:STDOUT: %pattern_type.loc18_42: type = pattern_type %.loc18_42.5 [template = %pattern_type.loc18_42 (constants.%pattern_type.fcb8f3.2)] -// CHECK:STDOUT: %return.param_patt.loc18_42.2: @Class.F.loc18.%pattern_type.loc18_42 (%pattern_type.fcb8f3.2) = out_param_pattern [template = %return.param_patt.loc18_42.2 (constants.%return.param_patt.2e9ac5.1)] -// CHECK:STDOUT: %return.patt.loc18_38.2: @Class.F.loc18.%pattern_type.loc18_42 (%pattern_type.fcb8f3.2) = return_slot_pattern %return.param_patt.loc18_42.2, %.loc18_42.5 [template = %return.patt.loc18_38.2 (constants.%return.patt.7fc6a1.1)] +// CHECK:STDOUT: generic fn @Class.F.loc14(%T.loc14_20: type) { +// CHECK:STDOUT: %T.loc14_33: type = symbolic_binding T, 0, template [template = %T.loc14_33 (constants.%T)] +// CHECK:STDOUT: %.loc14_34.1: = access_member_action %T.ref.loc14_33, U [template] +// CHECK:STDOUT: %.loc14_34.2: type = type_of_inst %.loc14_34.1 [template = %.loc14_34.2 (constants.%.eff391.1)] +// CHECK:STDOUT: %.loc14_34.3: @Class.F.loc14.%.loc14_34.2 (%.eff391.1) = splice_inst %.loc14_34.1 [template = %.loc14_34.3 (constants.%.b66113.1)] +// CHECK:STDOUT: %.loc14_34.4: = convert_to_value_action %.loc14_34.8, type [template] +// CHECK:STDOUT: %.loc14_34.5: type = splice_inst %.loc14_34.4 [template = %.loc14_34.5 (constants.%.5372ba.1)] +// CHECK:STDOUT: %pattern_type.loc14_31: type = pattern_type %.loc14_34.5 [template = %pattern_type.loc14_31 (constants.%pattern_type.fcb8f3.1)] +// CHECK:STDOUT: %n.param_patt.loc14_31.2: @Class.F.loc14.%pattern_type.loc14_31 (%pattern_type.fcb8f3.1) = value_param_pattern [template = %n.param_patt.loc14_31.2 (constants.%n.param_patt.110b44.1)] +// CHECK:STDOUT: %n.patt.loc14_31.2: @Class.F.loc14.%pattern_type.loc14_31 (%pattern_type.fcb8f3.1) = wrapper_binding_pattern n, %n.param_patt.loc14_31.2 [template = %n.patt.loc14_31.2 (constants.%n.patt.9e3e22.1)] +// CHECK:STDOUT: %.loc14_42.1: = access_member_action %T.ref.loc14_41, U [template] +// CHECK:STDOUT: %.loc14_42.2: type = type_of_inst %.loc14_42.1 [template = %.loc14_42.2 (constants.%.eff391.2)] +// CHECK:STDOUT: %.loc14_42.3: @Class.F.loc14.%.loc14_42.2 (%.eff391.2) = splice_inst %.loc14_42.1 [template = %.loc14_42.3 (constants.%.b66113.2)] +// CHECK:STDOUT: %.loc14_42.4: = convert_to_value_action %.loc14_42.8, type [template] +// CHECK:STDOUT: %.loc14_42.5: type = splice_inst %.loc14_42.4 [template = %.loc14_42.5 (constants.%.5372ba.2)] +// CHECK:STDOUT: %.loc14_42.6: Core.Form = init_form %.loc14_42.5 [template = %.loc14_42.6 (constants.%.cd79f1.1)] +// CHECK:STDOUT: %pattern_type.loc14_42: type = pattern_type %.loc14_42.5 [template = %pattern_type.loc14_42 (constants.%pattern_type.fcb8f3.2)] +// CHECK:STDOUT: %return.param_patt.loc14_42.2: @Class.F.loc14.%pattern_type.loc14_42 (%pattern_type.fcb8f3.2) = out_param_pattern [template = %return.param_patt.loc14_42.2 (constants.%return.param_patt.2e9ac5.1)] +// CHECK:STDOUT: %return.patt.loc14_38.2: @Class.F.loc14.%pattern_type.loc14_42 (%pattern_type.fcb8f3.2) = return_slot_pattern %return.param_patt.loc14_42.2, %.loc14_42.5 [template = %return.patt.loc14_38.2 (constants.%return.patt.7fc6a1.1)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete.loc18_31: = require_complete_type %.loc18_34.5 [template = %require_complete.loc18_31 (constants.%require_complete.cb0614.1)] -// CHECK:STDOUT: %require_complete.loc18_38: = require_complete_type %.loc18_42.5 [template = %require_complete.loc18_38 (constants.%require_complete.cb0614.2)] -// CHECK:STDOUT: %.loc19_11.2: %tuple.type = initialize_action %n.ref, %.loc18_42.5, %return.param, none, false [template] -// CHECK:STDOUT: %tuple.elem0: = tuple_access %.loc19_11.2, element0 [template] -// CHECK:STDOUT: %.loc19_11.3: @Class.F.loc18.%.loc18_42.5 (%.5372ba.2) = splice_inst %tuple.elem0 [template = %.loc19_11.3 (constants.%.5d6323.1)] +// CHECK:STDOUT: %require_complete.loc14_31: = require_complete_type %.loc14_34.5 [template = %require_complete.loc14_31 (constants.%require_complete.cb0614.1)] +// CHECK:STDOUT: %require_complete.loc14_38: = require_complete_type %.loc14_42.5 [template = %require_complete.loc14_38 (constants.%require_complete.cb0614.2)] +// CHECK:STDOUT: %.loc15_11.2: %tuple.type = initialize_action %n.ref, %.loc14_42.5, %return.param, none, false [template] +// CHECK:STDOUT: %tuple.elem0: = tuple_access %.loc15_11.2, element0 [template] +// CHECK:STDOUT: %.loc15_11.3: @Class.F.loc14.%.loc14_42.5 (%.5372ba.2) = splice_inst %tuple.elem0 [template = %.loc15_11.3 (constants.%.5d6323.1)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%n.param: @Class.F.loc18.%.loc18_34.5 (%.5372ba.1)) -> out %return.param: @Class.F.loc18.%.loc18_42.5 (%.5372ba.2) { +// CHECK:STDOUT: fn(%n.param: @Class.F.loc14.%.loc14_34.5 (%.5372ba.1)) -> out %return.param: @Class.F.loc14.%.loc14_42.5 (%.5372ba.2) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %n.ref: @Class.F.loc18.%.loc18_34.5 (%.5372ba.1) = name_ref n, %n -// CHECK:STDOUT: %.loc19_11.1: @Class.F.loc18.%.loc18_42.5 (%.5372ba.2) = splice_inst %tuple.elem0 [template = %.loc19_11.3 (constants.%.5d6323.1)] -// CHECK:STDOUT: return %.loc19_11.1 to %return.param +// CHECK:STDOUT: %n.ref: @Class.F.loc14.%.loc14_34.5 (%.5372ba.1) = name_ref n, %n +// CHECK:STDOUT: %.loc15_11.1: @Class.F.loc14.%.loc14_42.5 (%.5372ba.2) = splice_inst %tuple.elem0 [template = %.loc15_11.3 (constants.%.5d6323.1)] +// CHECK:STDOUT: return %.loc15_11.1 to %return.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Class.G.loc29(%T.loc29_20: type) { -// CHECK:STDOUT: %T.loc29_30: type = symbolic_binding T, 0, template [template = %T.loc29_30 (constants.%T)] -// CHECK:STDOUT: %Class: type = class_type @Class, @Class(%T.loc29_30) [template = %Class (constants.%Class)] -// CHECK:STDOUT: %pattern_type.loc29_30: type = pattern_type %Class [template = %pattern_type.loc29_30 (constants.%pattern_type.28f)] -// CHECK:STDOUT: %self.param_patt.loc29_30.2: @Class.G.loc29.%pattern_type.loc29_30 (%pattern_type.28f) = value_param_pattern [template = %self.param_patt.loc29_30.2 (constants.%self.param_patt)] -// CHECK:STDOUT: %self.patt.loc29_30.2: @Class.G.loc29.%pattern_type.loc29_30 (%pattern_type.28f) = wrapper_binding_pattern self, %self.param_patt.loc29_30.2 [template = %self.patt.loc29_30.2 (constants.%self.patt)] -// CHECK:STDOUT: %.loc29_40.1: = access_member_action %T.ref, U [template] -// CHECK:STDOUT: %.loc29_40.2: type = type_of_inst %.loc29_40.1 [template = %.loc29_40.2 (constants.%.eff391.4)] -// CHECK:STDOUT: %.loc29_40.3: @Class.G.loc29.%.loc29_40.2 (%.eff391.4) = splice_inst %.loc29_40.1 [template = %.loc29_40.3 (constants.%.b66113.4)] -// CHECK:STDOUT: %.loc29_40.4: = convert_to_value_action %.loc29_40.8, type [template] -// CHECK:STDOUT: %.loc29_40.5: type = splice_inst %.loc29_40.4 [template = %.loc29_40.5 (constants.%.5372ba.4)] -// CHECK:STDOUT: %.loc29_40.6: Core.Form = init_form %.loc29_40.5 [template = %.loc29_40.6 (constants.%.cd79f1.3)] -// CHECK:STDOUT: %pattern_type.loc29_40: type = pattern_type %.loc29_40.5 [template = %pattern_type.loc29_40 (constants.%pattern_type.fcb8f3.4)] -// CHECK:STDOUT: %return.param_patt.loc29_40.2: @Class.G.loc29.%pattern_type.loc29_40 (%pattern_type.fcb8f3.4) = out_param_pattern [template = %return.param_patt.loc29_40.2 (constants.%return.param_patt.2e9ac5.3)] -// CHECK:STDOUT: %return.patt.loc29_36.2: @Class.G.loc29.%pattern_type.loc29_40 (%pattern_type.fcb8f3.4) = return_slot_pattern %return.param_patt.loc29_40.2, %.loc29_40.5 [template = %return.patt.loc29_36.2 (constants.%return.patt.7fc6a1.3)] +// CHECK:STDOUT: generic fn @Class.G.loc21(%T.loc21_20: type) { +// CHECK:STDOUT: %T.loc21_30: type = symbolic_binding T, 0, template [template = %T.loc21_30 (constants.%T)] +// CHECK:STDOUT: %Class: type = class_type @Class, @Class(%T.loc21_30) [template = %Class (constants.%Class)] +// CHECK:STDOUT: %pattern_type.loc21_30: type = pattern_type %Class [template = %pattern_type.loc21_30 (constants.%pattern_type.28f)] +// CHECK:STDOUT: %self.param_patt.loc21_30.2: @Class.G.loc21.%pattern_type.loc21_30 (%pattern_type.28f) = value_param_pattern [template = %self.param_patt.loc21_30.2 (constants.%self.param_patt)] +// CHECK:STDOUT: %self.patt.loc21_30.2: @Class.G.loc21.%pattern_type.loc21_30 (%pattern_type.28f) = wrapper_binding_pattern self, %self.param_patt.loc21_30.2 [template = %self.patt.loc21_30.2 (constants.%self.patt)] +// CHECK:STDOUT: %.loc21_40.1: = access_member_action %T.ref, U [template] +// CHECK:STDOUT: %.loc21_40.2: type = type_of_inst %.loc21_40.1 [template = %.loc21_40.2 (constants.%.eff391.4)] +// CHECK:STDOUT: %.loc21_40.3: @Class.G.loc21.%.loc21_40.2 (%.eff391.4) = splice_inst %.loc21_40.1 [template = %.loc21_40.3 (constants.%.b66113.4)] +// CHECK:STDOUT: %.loc21_40.4: = convert_to_value_action %.loc21_40.8, type [template] +// CHECK:STDOUT: %.loc21_40.5: type = splice_inst %.loc21_40.4 [template = %.loc21_40.5 (constants.%.5372ba.4)] +// CHECK:STDOUT: %.loc21_40.6: Core.Form = init_form %.loc21_40.5 [template = %.loc21_40.6 (constants.%.cd79f1.3)] +// CHECK:STDOUT: %pattern_type.loc21_40: type = pattern_type %.loc21_40.5 [template = %pattern_type.loc21_40 (constants.%pattern_type.fcb8f3.4)] +// CHECK:STDOUT: %return.param_patt.loc21_40.2: @Class.G.loc21.%pattern_type.loc21_40 (%pattern_type.fcb8f3.4) = out_param_pattern [template = %return.param_patt.loc21_40.2 (constants.%return.param_patt.2e9ac5.3)] +// CHECK:STDOUT: %return.patt.loc21_36.2: @Class.G.loc21.%pattern_type.loc21_40 (%pattern_type.fcb8f3.4) = return_slot_pattern %return.param_patt.loc21_40.2, %.loc21_40.5 [template = %return.patt.loc21_36.2 (constants.%return.patt.7fc6a1.3)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete.loc29_30: = require_complete_type %Class [template = %require_complete.loc29_30 (constants.%require_complete.ac0)] -// CHECK:STDOUT: %require_complete.loc29_36: = require_complete_type %.loc29_40.5 [template = %require_complete.loc29_36 (constants.%require_complete.cb0614.3)] -// CHECK:STDOUT: %.loc30_14.3: = access_member_action %self.ref, n [template] -// CHECK:STDOUT: %.loc30_14.4: type = type_of_inst %.loc30_14.3 [template = %.loc30_14.4 (constants.%.237)] -// CHECK:STDOUT: %.loc30_14.5: @Class.G.loc29.%.loc30_14.4 (%.237) = splice_inst %.loc30_14.3 [template = %.loc30_14.5 (constants.%.f96)] -// CHECK:STDOUT: %.loc30_16.2: %tuple.type = initialize_action %.loc30_14.2, %.loc29_40.5, %return.param, none, false [template] -// CHECK:STDOUT: %tuple.elem0: = tuple_access %.loc30_16.2, element0 [template] -// CHECK:STDOUT: %.loc30_16.3: @Class.G.loc29.%.loc29_40.5 (%.5372ba.4) = splice_inst %tuple.elem0 [template = %.loc30_16.3 (constants.%.5d6323.2)] +// CHECK:STDOUT: %require_complete.loc21_30: = require_complete_type %Class [template = %require_complete.loc21_30 (constants.%require_complete.ac0)] +// CHECK:STDOUT: %require_complete.loc21_36: = require_complete_type %.loc21_40.5 [template = %require_complete.loc21_36 (constants.%require_complete.cb0614.3)] +// CHECK:STDOUT: %.loc22_14.3: = access_member_action %self.ref, n [template] +// CHECK:STDOUT: %.loc22_14.4: type = type_of_inst %.loc22_14.3 [template = %.loc22_14.4 (constants.%.237)] +// CHECK:STDOUT: %.loc22_14.5: @Class.G.loc21.%.loc22_14.4 (%.237) = splice_inst %.loc22_14.3 [template = %.loc22_14.5 (constants.%.f96)] +// CHECK:STDOUT: %.loc22_16.2: %tuple.type = initialize_action %.loc22_14.2, %.loc21_40.5, %return.param, none, false [template] +// CHECK:STDOUT: %tuple.elem0: = tuple_access %.loc22_16.2, element0 [template] +// CHECK:STDOUT: %.loc22_16.3: @Class.G.loc21.%.loc21_40.5 (%.5372ba.4) = splice_inst %tuple.elem0 [template = %.loc22_16.3 (constants.%.5d6323.2)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%self.param: @Class.G.loc29.%Class (%Class)) -> out %return.param: @Class.G.loc29.%.loc29_40.5 (%.5372ba.4) { +// CHECK:STDOUT: fn(%self.param: @Class.G.loc21.%Class (%Class)) -> out %return.param: @Class.G.loc21.%.loc21_40.5 (%.5372ba.4) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %self.ref: @Class.G.loc29.%Class (%Class) = name_ref self, %self -// CHECK:STDOUT: %.loc30_14.1: type = type_of_inst %.loc30_14.3 [template = %.loc30_14.4 (constants.%.237)] -// CHECK:STDOUT: %.loc30_14.2: @Class.G.loc29.%.loc30_14.4 (%.237) = splice_inst %.loc30_14.3 [template = %.loc30_14.5 (constants.%.f96)] -// CHECK:STDOUT: %.loc30_16.1: @Class.G.loc29.%.loc29_40.5 (%.5372ba.4) = splice_inst %tuple.elem0 [template = %.loc30_16.3 (constants.%.5d6323.2)] -// CHECK:STDOUT: return %.loc30_16.1 to %return.param +// CHECK:STDOUT: %self.ref: @Class.G.loc21.%Class (%Class) = name_ref self, %self +// CHECK:STDOUT: %.loc22_14.1: type = type_of_inst %.loc22_14.3 [template = %.loc22_14.4 (constants.%.237)] +// CHECK:STDOUT: %.loc22_14.2: @Class.G.loc21.%.loc22_14.4 (%.237) = splice_inst %.loc22_14.3 [template = %.loc22_14.5 (constants.%.f96)] +// CHECK:STDOUT: %.loc22_16.1: @Class.G.loc21.%.loc21_40.5 (%.5372ba.4) = splice_inst %tuple.elem0 [template = %.loc22_16.3 (constants.%.5d6323.2)] +// CHECK:STDOUT: return %.loc22_16.1 to %return.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -387,41 +379,41 @@ fn Class(template T: type).G(self) -> T.U { // CHECK:STDOUT: %return.patt.loc7_14.2 => constants.%return.patt.b39 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Class.F.loc18(constants.%T) { -// CHECK:STDOUT: %T.loc18_33 => constants.%T -// CHECK:STDOUT: %.loc18_34.1 => constants.%.9af -// CHECK:STDOUT: %.loc18_34.2 => constants.%.eff391.3 -// CHECK:STDOUT: %.loc18_34.3 => constants.%.b66113.3 -// CHECK:STDOUT: %.loc18_34.4 => constants.%.c8c -// CHECK:STDOUT: %.loc18_34.5 => constants.%.5372ba.3 -// CHECK:STDOUT: %pattern_type.loc18_31 => constants.%pattern_type.fcb8f3.3 -// CHECK:STDOUT: %n.param_patt.loc18_31.2 => constants.%n.param_patt.110b44.2 -// CHECK:STDOUT: %n.patt.loc18_31.2 => constants.%n.patt.9e3e22.2 -// CHECK:STDOUT: %.loc18_42.1 => constants.%.9af -// CHECK:STDOUT: %.loc18_42.2 => constants.%.eff391.3 -// CHECK:STDOUT: %.loc18_42.3 => constants.%.b66113.3 -// CHECK:STDOUT: %.loc18_42.4 => constants.%.c8c -// CHECK:STDOUT: %.loc18_42.5 => constants.%.5372ba.3 -// CHECK:STDOUT: %.loc18_42.6 => constants.%.cd79f1.2 -// CHECK:STDOUT: %pattern_type.loc18_42 => constants.%pattern_type.fcb8f3.3 -// CHECK:STDOUT: %return.param_patt.loc18_42.2 => constants.%return.param_patt.2e9ac5.2 -// CHECK:STDOUT: %return.patt.loc18_38.2 => constants.%return.patt.7fc6a1.2 +// CHECK:STDOUT: specific @Class.F.loc14(constants.%T) { +// CHECK:STDOUT: %T.loc14_33 => constants.%T +// CHECK:STDOUT: %.loc14_34.1 => constants.%.9af +// CHECK:STDOUT: %.loc14_34.2 => constants.%.eff391.3 +// CHECK:STDOUT: %.loc14_34.3 => constants.%.b66113.3 +// CHECK:STDOUT: %.loc14_34.4 => constants.%.c8c +// CHECK:STDOUT: %.loc14_34.5 => constants.%.5372ba.3 +// CHECK:STDOUT: %pattern_type.loc14_31 => constants.%pattern_type.fcb8f3.3 +// CHECK:STDOUT: %n.param_patt.loc14_31.2 => constants.%n.param_patt.110b44.2 +// CHECK:STDOUT: %n.patt.loc14_31.2 => constants.%n.patt.9e3e22.2 +// CHECK:STDOUT: %.loc14_42.1 => constants.%.9af +// CHECK:STDOUT: %.loc14_42.2 => constants.%.eff391.3 +// CHECK:STDOUT: %.loc14_42.3 => constants.%.b66113.3 +// CHECK:STDOUT: %.loc14_42.4 => constants.%.c8c +// CHECK:STDOUT: %.loc14_42.5 => constants.%.5372ba.3 +// CHECK:STDOUT: %.loc14_42.6 => constants.%.cd79f1.2 +// CHECK:STDOUT: %pattern_type.loc14_42 => constants.%pattern_type.fcb8f3.3 +// CHECK:STDOUT: %return.param_patt.loc14_42.2 => constants.%return.param_patt.2e9ac5.2 +// CHECK:STDOUT: %return.patt.loc14_38.2 => constants.%return.patt.7fc6a1.2 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Class.G.loc29(constants.%T) { -// CHECK:STDOUT: %T.loc29_30 => constants.%T +// CHECK:STDOUT: specific @Class.G.loc21(constants.%T) { +// CHECK:STDOUT: %T.loc21_30 => constants.%T // CHECK:STDOUT: %Class => constants.%Class -// CHECK:STDOUT: %pattern_type.loc29_30 => constants.%pattern_type.28f -// CHECK:STDOUT: %self.param_patt.loc29_30.2 => constants.%self.param_patt -// CHECK:STDOUT: %self.patt.loc29_30.2 => constants.%self.patt -// CHECK:STDOUT: %.loc29_40.1 => constants.%.9af -// CHECK:STDOUT: %.loc29_40.2 => constants.%.eff391.3 -// CHECK:STDOUT: %.loc29_40.3 => constants.%.b66113.3 -// CHECK:STDOUT: %.loc29_40.4 => constants.%.c8c -// CHECK:STDOUT: %.loc29_40.5 => constants.%.5372ba.3 -// CHECK:STDOUT: %.loc29_40.6 => constants.%.cd79f1.2 -// CHECK:STDOUT: %pattern_type.loc29_40 => constants.%pattern_type.fcb8f3.3 -// CHECK:STDOUT: %return.param_patt.loc29_40.2 => constants.%return.param_patt.2e9ac5.2 -// CHECK:STDOUT: %return.patt.loc29_36.2 => constants.%return.patt.7fc6a1.2 +// CHECK:STDOUT: %pattern_type.loc21_30 => constants.%pattern_type.28f +// CHECK:STDOUT: %self.param_patt.loc21_30.2 => constants.%self.param_patt +// CHECK:STDOUT: %self.patt.loc21_30.2 => constants.%self.patt +// CHECK:STDOUT: %.loc21_40.1 => constants.%.9af +// CHECK:STDOUT: %.loc21_40.2 => constants.%.eff391.3 +// CHECK:STDOUT: %.loc21_40.3 => constants.%.b66113.3 +// CHECK:STDOUT: %.loc21_40.4 => constants.%.c8c +// CHECK:STDOUT: %.loc21_40.5 => constants.%.5372ba.3 +// CHECK:STDOUT: %.loc21_40.6 => constants.%.cd79f1.2 +// CHECK:STDOUT: %pattern_type.loc21_40 => constants.%pattern_type.fcb8f3.3 +// CHECK:STDOUT: %return.param_patt.loc21_40.2 => constants.%return.param_patt.2e9ac5.2 +// CHECK:STDOUT: %return.patt.loc21_36.2 => constants.%return.patt.7fc6a1.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/generic/template/unimplemented.carbon b/toolchain/check/testdata/generic/template/unimplemented.carbon index 0ccdf99436d2..5b24f581de07 100644 --- a/toolchain/check/testdata/generic/template/unimplemented.carbon +++ b/toolchain/check/testdata/generic/template/unimplemented.carbon @@ -19,9 +19,7 @@ library "[[@TEST_NAME]]"; // Check that we get a reasonable diagnostic for an unimplemented operation on a // template dependent expression. fn F[template T: type](x: T) { - // CHECK:STDERR: fail_todo_unimplemented_operator.carbon:[[@LINE+4]]:3: error: cannot dereference operand of non-pointer type `` [DerefOfNonPointer] - // CHECK:STDERR: *x.n; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_todo_unimplemented_operator.carbon:[[@LINE+2]]:3: error: cannot dereference operand of non-pointer type `` [DerefOfNonPointer] // CHECK:STDERR: *x.n; } @@ -38,9 +36,7 @@ class C { // template dependent value where the type is concrete but determined through // the template dependent value. fn F(template c: C) { - // CHECK:STDERR: fail_todo_unimplemented_value.carbon:[[@LINE+4]]:3: error: cannot dereference operand of non-pointer type `` [DerefOfNonPointer] - // CHECK:STDERR: *c.n; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_todo_unimplemented_value.carbon:[[@LINE+2]]:3: error: cannot dereference operand of non-pointer type `` [DerefOfNonPointer] // CHECK:STDERR: *c.n; } @@ -59,10 +55,10 @@ fn F(template c: C) { // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] // CHECK:STDOUT: %require_complete.944: = require_complete_type %T [template] -// CHECK:STDOUT: %.237: type = type_of_inst @F.%.loc11_5.4 [template] -// CHECK:STDOUT: %.f96: %.237 = splice_inst @F.%.loc11_5.4 [template] +// CHECK:STDOUT: %.237: type = type_of_inst @F.%.loc9_5.4 [template] +// CHECK:STDOUT: %.f96: %.237 = splice_inst @F.%.loc9_5.4 [template] // CHECK:STDOUT: %require_complete.b43: = require_complete_type %.237 [template] -// CHECK:STDOUT: %.fb1: %.237 = splice_inst @F.%.loc11_5.7 [template] +// CHECK:STDOUT: %.fb1: %.237 = splice_inst @F.%.loc9_5.7 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -103,20 +99,20 @@ fn F(template c: C) { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete.loc6: = require_complete_type %T.loc6_16.1 [template = %require_complete.loc6 (constants.%require_complete.944)] -// CHECK:STDOUT: %.loc11_5.4: = access_member_action %x.ref, n [template] -// CHECK:STDOUT: %.loc11_5.5: type = type_of_inst %.loc11_5.4 [template = %.loc11_5.5 (constants.%.237)] -// CHECK:STDOUT: %.loc11_5.6: @F.%.loc11_5.5 (%.237) = splice_inst %.loc11_5.4 [template = %.loc11_5.6 (constants.%.f96)] -// CHECK:STDOUT: %require_complete.loc11: = require_complete_type %.loc11_5.5 [template = %require_complete.loc11 (constants.%require_complete.b43)] -// CHECK:STDOUT: %.loc11_5.7: = convert_to_category_action %.loc11_5.2, element1 [template] -// CHECK:STDOUT: %.loc11_5.8: @F.%.loc11_5.5 (%.237) = splice_inst %.loc11_5.7 [template = %.loc11_5.8 (constants.%.fb1)] +// CHECK:STDOUT: %.loc9_5.4: = access_member_action %x.ref, n [template] +// CHECK:STDOUT: %.loc9_5.5: type = type_of_inst %.loc9_5.4 [template = %.loc9_5.5 (constants.%.237)] +// CHECK:STDOUT: %.loc9_5.6: @F.%.loc9_5.5 (%.237) = splice_inst %.loc9_5.4 [template = %.loc9_5.6 (constants.%.f96)] +// CHECK:STDOUT: %require_complete.loc9: = require_complete_type %.loc9_5.5 [template = %require_complete.loc9 (constants.%require_complete.b43)] +// CHECK:STDOUT: %.loc9_5.7: = convert_to_category_action %.loc9_5.2, element1 [template] +// CHECK:STDOUT: %.loc9_5.8: @F.%.loc9_5.5 (%.237) = splice_inst %.loc9_5.7 [template = %.loc9_5.8 (constants.%.fb1)] // CHECK:STDOUT: // CHECK:STDOUT: fn(%x.param: @F.%T.loc6_16.1 (%T)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %x.ref: @F.%T.loc6_16.1 (%T) = name_ref x, %x -// CHECK:STDOUT: %.loc11_5.1: type = type_of_inst %.loc11_5.4 [template = %.loc11_5.5 (constants.%.237)] -// CHECK:STDOUT: %.loc11_5.2: @F.%.loc11_5.5 (%.237) = splice_inst %.loc11_5.4 [template = %.loc11_5.6 (constants.%.f96)] -// CHECK:STDOUT: %.loc11_5.3: @F.%.loc11_5.5 (%.237) = splice_inst %.loc11_5.7 [template = %.loc11_5.8 (constants.%.fb1)] -// CHECK:STDOUT: %.loc11_3: ref = deref %.loc11_5.3 [concrete = ] +// CHECK:STDOUT: %.loc9_5.1: type = type_of_inst %.loc9_5.4 [template = %.loc9_5.5 (constants.%.237)] +// CHECK:STDOUT: %.loc9_5.2: @F.%.loc9_5.5 (%.237) = splice_inst %.loc9_5.4 [template = %.loc9_5.6 (constants.%.f96)] +// CHECK:STDOUT: %.loc9_5.3: @F.%.loc9_5.5 (%.237) = splice_inst %.loc9_5.7 [template = %.loc9_5.8 (constants.%.fb1)] +// CHECK:STDOUT: %.loc9_3: ref = deref %.loc9_5.3 [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -147,10 +143,10 @@ fn F(template c: C) { // CHECK:STDOUT: %c: %C = symbolic_binding c, 0, template [template] // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] -// CHECK:STDOUT: %.237: type = type_of_inst @F.%.loc16_5.4 [template] -// CHECK:STDOUT: %.f96: %.237 = splice_inst @F.%.loc16_5.4 [template] +// CHECK:STDOUT: %.237: type = type_of_inst @F.%.loc14_5.4 [template] +// CHECK:STDOUT: %.f96: %.237 = splice_inst @F.%.loc14_5.4 [template] // CHECK:STDOUT: %require_complete.b43: = require_complete_type %.237 [template] -// CHECK:STDOUT: %.fb1: %.237 = splice_inst @F.%.loc16_5.7 [template] +// CHECK:STDOUT: %.fb1: %.237 = splice_inst @F.%.loc14_5.7 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -198,20 +194,20 @@ fn F(template c: C) { // CHECK:STDOUT: %c.loc11_16.1: %C = symbolic_binding c, 0, template [template = %c.loc11_16.1 (constants.%c)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %.loc16_5.4: = access_member_action %c.ref, n [template] -// CHECK:STDOUT: %.loc16_5.5: type = type_of_inst %.loc16_5.4 [template = %.loc16_5.5 (constants.%.237)] -// CHECK:STDOUT: %.loc16_5.6: @F.%.loc16_5.5 (%.237) = splice_inst %.loc16_5.4 [template = %.loc16_5.6 (constants.%.f96)] -// CHECK:STDOUT: %require_complete: = require_complete_type %.loc16_5.5 [template = %require_complete (constants.%require_complete.b43)] -// CHECK:STDOUT: %.loc16_5.7: = convert_to_category_action %.loc16_5.2, element1 [template] -// CHECK:STDOUT: %.loc16_5.8: @F.%.loc16_5.5 (%.237) = splice_inst %.loc16_5.7 [template = %.loc16_5.8 (constants.%.fb1)] +// CHECK:STDOUT: %.loc14_5.4: = access_member_action %c.ref, n [template] +// CHECK:STDOUT: %.loc14_5.5: type = type_of_inst %.loc14_5.4 [template = %.loc14_5.5 (constants.%.237)] +// CHECK:STDOUT: %.loc14_5.6: @F.%.loc14_5.5 (%.237) = splice_inst %.loc14_5.4 [template = %.loc14_5.6 (constants.%.f96)] +// CHECK:STDOUT: %require_complete: = require_complete_type %.loc14_5.5 [template = %require_complete (constants.%require_complete.b43)] +// CHECK:STDOUT: %.loc14_5.7: = convert_to_category_action %.loc14_5.2, element1 [template] +// CHECK:STDOUT: %.loc14_5.8: @F.%.loc14_5.5 (%.237) = splice_inst %.loc14_5.7 [template = %.loc14_5.8 (constants.%.fb1)] // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %c.ref: %C = name_ref c, %c.loc11_16.2 [template = %c.loc11_16.1 (constants.%c)] -// CHECK:STDOUT: %.loc16_5.1: type = type_of_inst %.loc16_5.4 [template = %.loc16_5.5 (constants.%.237)] -// CHECK:STDOUT: %.loc16_5.2: @F.%.loc16_5.5 (%.237) = splice_inst %.loc16_5.4 [template = %.loc16_5.6 (constants.%.f96)] -// CHECK:STDOUT: %.loc16_5.3: @F.%.loc16_5.5 (%.237) = splice_inst %.loc16_5.7 [template = %.loc16_5.8 (constants.%.fb1)] -// CHECK:STDOUT: %.loc16_3: ref = deref %.loc16_5.3 [concrete = ] +// CHECK:STDOUT: %.loc14_5.1: type = type_of_inst %.loc14_5.4 [template = %.loc14_5.5 (constants.%.237)] +// CHECK:STDOUT: %.loc14_5.2: @F.%.loc14_5.5 (%.237) = splice_inst %.loc14_5.4 [template = %.loc14_5.6 (constants.%.f96)] +// CHECK:STDOUT: %.loc14_5.3: @F.%.loc14_5.5 (%.237) = splice_inst %.loc14_5.7 [template = %.loc14_5.8 (constants.%.fb1)] +// CHECK:STDOUT: %.loc14_3: ref = deref %.loc14_5.3 [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/if/basics.carbon b/toolchain/check/testdata/if/basics.carbon index 4e8536a5dd2d..7e84e20c4550 100644 --- a/toolchain/check/testdata/if/basics.carbon +++ b/toolchain/check/testdata/if/basics.carbon @@ -65,9 +65,7 @@ fn If1(b: bool) -> bool { return false; } else { } -// CHECK:STDERR: fail_reachable_fallthrough.carbon:[[@LINE+4]]:1: error: missing `return` at end of function with declared return type [MissingReturnStatement] -// CHECK:STDERR: } -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_reachable_fallthrough.carbon:[[@LINE+2]]:1: error: missing `return` at end of function with declared return type [MissingReturnStatement] // CHECK:STDERR: } @@ -76,9 +74,7 @@ fn If2(b: bool) -> bool { } else { return true; } -// CHECK:STDERR: fail_reachable_fallthrough.carbon:[[@LINE+4]]:1: error: missing `return` at end of function with declared return type [MissingReturnStatement] -// CHECK:STDERR: } -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_reachable_fallthrough.carbon:[[@LINE+2]]:1: error: missing `return` at end of function with declared return type [MissingReturnStatement] // CHECK:STDERR: } @@ -86,9 +82,7 @@ fn If3(b: bool) -> bool { if (b) { return false; } -// CHECK:STDERR: fail_reachable_fallthrough.carbon:[[@LINE+4]]:1: error: missing `return` at end of function with declared return type [MissingReturnStatement] -// CHECK:STDERR: } -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_reachable_fallthrough.carbon:[[@LINE+2]]:1: error: missing `return` at end of function with declared return type [MissingReturnStatement] // CHECK:STDERR: } @@ -100,9 +94,7 @@ fn VarScope(b: bool) -> bool { var n: bool = true; return n; } - // CHECK:STDERR: fail_scope.carbon:[[@LINE+4]]:10: error: name `n` not found [NameNotFound] - // CHECK:STDERR: return n; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_scope.carbon:[[@LINE+2]]:10: error: name `n` not found [NameNotFound] // CHECK:STDERR: return n; } diff --git a/toolchain/check/testdata/if_expr/fail_not_in_function.carbon b/toolchain/check/testdata/if_expr/fail_not_in_function.carbon index 639a1e88e881..5a00b86d58a0 100644 --- a/toolchain/check/testdata/if_expr/fail_not_in_function.carbon +++ b/toolchain/check/testdata/if_expr/fail_not_in_function.carbon @@ -16,17 +16,11 @@ library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_basic.carbon:[[@LINE+12]]:14: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] -// CHECK:STDERR: let x: i32 = if true then 1 else 0; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_basic.carbon:[[@LINE+6]]:14-20: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] // CHECK:STDERR: -// CHECK:STDERR: fail_basic.carbon:[[@LINE+8]]:22: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] -// CHECK:STDERR: let x: i32 = if true then 1 else 0; -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_basic.carbon:[[@LINE+4]]:22-27: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] // CHECK:STDERR: -// CHECK:STDERR: fail_basic.carbon:[[@LINE+4]]:14: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] -// CHECK:STDERR: let x: i32 = if true then 1 else 0; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_basic.carbon:[[@LINE+2]]:14-34: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] // CHECK:STDERR: let x: i32 = if true then 1 else 0; @@ -34,9 +28,7 @@ let x: i32 = if true then 1 else 0; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_types.carbon:[[@LINE+4]]:8: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] -// CHECK:STDERR: var y: if true then i32 else f64; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_types.carbon:[[@LINE+2]]:8-32: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] // CHECK:STDERR: var y: if true then i32 else f64; @@ -44,9 +36,7 @@ var y: if true then i32 else f64; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_in_param.carbon:[[@LINE+4]]:9: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] -// CHECK:STDERR: fn F(a: if true then i32 else f64); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_in_param.carbon:[[@LINE+2]]:9-33: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] // CHECK:STDERR: fn F(a: if true then i32 else f64); @@ -55,9 +45,7 @@ fn F(a: if true then i32 else f64); library "[[@TEST_NAME]]"; class C { - // CHECK:STDERR: fail_class.carbon:[[@LINE+4]]:10: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] - // CHECK:STDERR: var n: if true then i32 else f64; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_class.carbon:[[@LINE+2]]:10-34: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] // CHECK:STDERR: var n: if true then i32 else f64; } @@ -70,9 +58,7 @@ base class C(T: type) {} fn F() { class B { - // CHECK:STDERR: fail_nested_class.carbon:[[@LINE+4]]:20: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] - // CHECK:STDERR: extend base: C(if true then i32 else i32); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_nested_class.carbon:[[@LINE+2]]:20-44: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] // CHECK:STDERR: extend base: C(if true then i32 else i32); } diff --git a/toolchain/check/testdata/if_expr/fail_partial_constant.carbon b/toolchain/check/testdata/if_expr/fail_partial_constant.carbon index 6ee830c60b8b..5f9b7b087360 100644 --- a/toolchain/check/testdata/if_expr/fail_partial_constant.carbon +++ b/toolchain/check/testdata/if_expr/fail_partial_constant.carbon @@ -20,9 +20,7 @@ fn ConditionIsNonConstant(b: bool) { // We choose to not accept this even if both arms evaluate to the same // constant value, because it notionally involves evaluating a non-constant // condition. - // CHECK:STDERR: fail_non_constant_condition.carbon:[[@LINE+4]]:17: error: cannot evaluate type expression [TypeExprEvaluationFailure] - // CHECK:STDERR: var unused v: if b then i32 else i32 = 1; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_non_constant_condition.carbon:[[@LINE+2]]:17-38: error: cannot evaluate type expression [TypeExprEvaluationFailure] // CHECK:STDERR: var unused v: if b then i32 else i32 = 1; } @@ -32,14 +30,10 @@ fn ConditionIsNonConstant(b: bool) { package NonConstantResult; fn ChosenBranchIsNonConstant(t: type) { - // CHECK:STDERR: fail_non_constant_result.carbon:[[@LINE+4]]:17: error: cannot evaluate type expression [TypeExprEvaluationFailure] - // CHECK:STDERR: var unused v: if true then t else i32 = 1; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_non_constant_result.carbon:[[@LINE+2]]:17-39: error: cannot evaluate type expression [TypeExprEvaluationFailure] // CHECK:STDERR: var unused v: if true then t else i32 = 1; - // CHECK:STDERR: fail_non_constant_result.carbon:[[@LINE+4]]:17: error: cannot evaluate type expression [TypeExprEvaluationFailure] - // CHECK:STDERR: var unused w: if false then i32 else t = 1; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_non_constant_result.carbon:[[@LINE+2]]:17-40: error: cannot evaluate type expression [TypeExprEvaluationFailure] // CHECK:STDERR: var unused w: if false then i32 else t = 1; } @@ -95,25 +89,25 @@ fn ChosenBranchIsNonConstant(t: type) { // CHECK:STDOUT: %v.var: ref = var_storage %v.var_patt [concrete = ] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] // CHECK:STDOUT: assign %v.var, -// CHECK:STDOUT: br !.loc12_20 +// CHECK:STDOUT: br !.loc10_20 // CHECK:STDOUT: -// CHECK:STDOUT: !.loc12_20: +// CHECK:STDOUT: !.loc10_20: // CHECK:STDOUT: %b.ref: bool = name_ref b, %b // CHECK:STDOUT: if %b.ref br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: -// CHECK:STDOUT: %i32.loc12_27: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: br !if.expr.result(%i32.loc12_27) +// CHECK:STDOUT: %i32.loc10_27: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: br !if.expr.result(%i32.loc10_27) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else: -// CHECK:STDOUT: %i32.loc12_36: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: br !if.expr.result(%i32.loc12_36) +// CHECK:STDOUT: %i32.loc10_36: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: br !if.expr.result(%i32.loc10_36) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result: -// CHECK:STDOUT: %.loc12: type = block_arg !if.expr.result -// CHECK:STDOUT: br !.loc12_15 +// CHECK:STDOUT: %.loc10: type = block_arg !if.expr.result +// CHECK:STDOUT: br !.loc10_15 // CHECK:STDOUT: -// CHECK:STDOUT: !.loc12_15: +// CHECK:STDOUT: !.loc10_15: // CHECK:STDOUT: %v: = wrapper_binding v, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %v.patt: = ref_binding_pattern v [concrete = ] @@ -171,54 +165,54 @@ fn ChosenBranchIsNonConstant(t: type) { // CHECK:STDOUT: fn @ChosenBranchIsNonConstant(%t.param: type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %v.var: ref = var_storage %v.var_patt [concrete = ] -// CHECK:STDOUT: %int_1.loc9: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %int_1.loc7: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] // CHECK:STDOUT: assign %v.var, -// CHECK:STDOUT: br !.loc9_20 +// CHECK:STDOUT: br !.loc7_20 // CHECK:STDOUT: -// CHECK:STDOUT: !.loc9_20: +// CHECK:STDOUT: !.loc7_20: // CHECK:STDOUT: %true: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: if %true br !if.expr.then.loc9 else br !if.expr.else.loc9 +// CHECK:STDOUT: if %true br !if.expr.then.loc7 else br !if.expr.else.loc7 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc9: -// CHECK:STDOUT: %t.ref.loc9: type = name_ref t, %t -// CHECK:STDOUT: br !if.expr.result.loc9(%t.ref.loc9) +// CHECK:STDOUT: !if.expr.then.loc7: +// CHECK:STDOUT: %t.ref.loc7: type = name_ref t, %t +// CHECK:STDOUT: br !if.expr.result.loc7(%t.ref.loc7) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc9: -// CHECK:STDOUT: %i32.loc9: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: br !if.expr.result.loc9(%i32.loc9) +// CHECK:STDOUT: !if.expr.else.loc7: +// CHECK:STDOUT: %i32.loc7: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: br !if.expr.result.loc7(%i32.loc7) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc9: -// CHECK:STDOUT: %.loc9: type = block_arg !if.expr.result.loc9 -// CHECK:STDOUT: br !.loc9_15 +// CHECK:STDOUT: !if.expr.result.loc7: +// CHECK:STDOUT: %.loc7: type = block_arg !if.expr.result.loc7 +// CHECK:STDOUT: br !.loc7_15 // CHECK:STDOUT: -// CHECK:STDOUT: !.loc9_15: +// CHECK:STDOUT: !.loc7_15: // CHECK:STDOUT: %v: = wrapper_binding v, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %v.patt: = ref_binding_pattern v [concrete = ] // CHECK:STDOUT: %v.var_patt: = var_pattern %v.patt [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %w.var: ref = var_storage %w.var_patt [concrete = ] -// CHECK:STDOUT: %int_1.loc14: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %int_1.loc10: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] // CHECK:STDOUT: assign %w.var, -// CHECK:STDOUT: br !.loc14_20 +// CHECK:STDOUT: br !.loc10_20 // CHECK:STDOUT: -// CHECK:STDOUT: !.loc14_20: +// CHECK:STDOUT: !.loc10_20: // CHECK:STDOUT: %false: bool = bool_literal false [concrete = constants.%false] -// CHECK:STDOUT: if %false br !if.expr.then.loc14 else br !if.expr.else.loc14 +// CHECK:STDOUT: if %false br !if.expr.then.loc10 else br !if.expr.else.loc10 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc14: -// CHECK:STDOUT: %i32.loc14: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: br !if.expr.result.loc14(%i32.loc14) +// CHECK:STDOUT: !if.expr.then.loc10: +// CHECK:STDOUT: %i32.loc10: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: br !if.expr.result.loc10(%i32.loc10) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc14: -// CHECK:STDOUT: %t.ref.loc14: type = name_ref t, %t -// CHECK:STDOUT: br !if.expr.result.loc14(%t.ref.loc14) +// CHECK:STDOUT: !if.expr.else.loc10: +// CHECK:STDOUT: %t.ref.loc10: type = name_ref t, %t +// CHECK:STDOUT: br !if.expr.result.loc10(%t.ref.loc10) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc14: -// CHECK:STDOUT: %.loc14: type = block_arg !if.expr.result.loc14 -// CHECK:STDOUT: br !.loc14_15 +// CHECK:STDOUT: !if.expr.result.loc10: +// CHECK:STDOUT: %.loc10: type = block_arg !if.expr.result.loc10 +// CHECK:STDOUT: br !.loc10_15 // CHECK:STDOUT: -// CHECK:STDOUT: !.loc14_15: +// CHECK:STDOUT: !.loc10_15: // CHECK:STDOUT: %w: = wrapper_binding w, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %w.patt: = ref_binding_pattern w [concrete = ] diff --git a/toolchain/check/testdata/impl/access.carbon b/toolchain/check/testdata/impl/access.carbon index f83c6da9be15..ad269b4533a9 100644 --- a/toolchain/check/testdata/impl/access.carbon +++ b/toolchain/check/testdata/impl/access.carbon @@ -49,12 +49,8 @@ class A { impl B as I { fn Get(self: B) -> i32 { - // CHECK:STDERR: fail_impl_in_other_class1.carbon:[[@LINE+7]]:20: error: cannot access private member `m` of type `B` [ClassInvalidMemberAccess] - // CHECK:STDERR: return self.m; - // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_impl_in_other_class1.carbon:[[@LINE-11]]:17: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: private var m: i32; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_impl_in_other_class1.carbon:[[@LINE+3]]:20-25: error: cannot access private member `m` of type `B` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_impl_in_other_class1.carbon:[[@LINE-9]]:17-22: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: return self.m; } @@ -74,12 +70,8 @@ class A { impl as K(B) { fn Get(t: B) -> i32 { - // CHECK:STDERR: fail_impl_in_other_class2.carbon:[[@LINE+7]]:20: error: cannot access private member `m` of type `B` [ClassInvalidMemberAccess] - // CHECK:STDERR: return t.m; - // CHECK:STDERR: ^~~ - // CHECK:STDERR: fail_impl_in_other_class2.carbon:[[@LINE-11]]:17: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: private var m: i32; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_impl_in_other_class2.carbon:[[@LINE+3]]:20-22: error: cannot access private member `m` of type `B` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_impl_in_other_class2.carbon:[[@LINE-9]]:17-22: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: return t.m; } @@ -96,12 +88,8 @@ class A { impl A as J { fn Get(self: Self) -> i32 { - // CHECK:STDERR: fail_impl_outside_class1.carbon:[[@LINE+7]]:16: error: cannot access private member `n` of type `A` [ClassInvalidMemberAccess] - // CHECK:STDERR: return self.n; - // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_impl_outside_class1.carbon:[[@LINE-8]]:17: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: private var n: i32; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_impl_outside_class1.carbon:[[@LINE+3]]:16-21: error: cannot access private member `n` of type `A` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_impl_outside_class1.carbon:[[@LINE-6]]:17-22: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: return self.n; } @@ -117,12 +105,8 @@ class B { impl B as J { fn Get(self: B) -> i32 { - // CHECK:STDERR: fail_impl_outside_class2.carbon:[[@LINE+7]]:16: error: cannot access private member `m` of type `B` [ClassInvalidMemberAccess] - // CHECK:STDERR: return self.m; - // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_impl_outside_class2.carbon:[[@LINE-8]]:17: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: private var m: i32; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_impl_outside_class2.carbon:[[@LINE+3]]:16-21: error: cannot access private member `m` of type `B` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_impl_outside_class2.carbon:[[@LINE-6]]:17-22: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: return self.m; } diff --git a/toolchain/check/testdata/impl/assoc_const_self.carbon b/toolchain/check/testdata/impl/assoc_const_self.carbon index 9ac9d811b760..44d577379f70 100644 --- a/toolchain/check/testdata/impl/assoc_const_self.carbon +++ b/toolchain/check/testdata/impl/assoc_const_self.carbon @@ -32,12 +32,8 @@ interface I { let V: Self; } -// 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({})` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: impl {} as I where .V = 0 {} -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_assoc_const_mismatch.carbon:[[@LINE+3]]:12-25: error: cannot implicitly convert expression of type `Core.IntLiteral` to `{}` [ConversionFailure] +// CHECK:STDERR: fail_assoc_const_mismatch.carbon:[[@LINE+2]]:12-25: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs({})` [MissingImplInMemberAccessInContext] // CHECK:STDERR: impl {} as I where .V = 0 {} @@ -55,9 +51,7 @@ impl () as Core.ImplicitAs(C) { fn Convert(unused self: ()) -> C { return {}; } } -// CHECK:STDERR: fail_assoc_const_not_constant_after_conversion.carbon:[[@LINE+4]]:11: error: associated constant V given value `()` that is not constant after conversion to `C` [AssociatedConstantNotConstantAfterConversion] -// CHECK:STDERR: impl C as I where .V = () {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_assoc_const_not_constant_after_conversion.carbon:[[@LINE+2]]:11-25: error: associated constant V given value `()` that is not constant after conversion to `C` [AssociatedConstantNotConstantAfterConversion] // CHECK:STDERR: impl C as I where .V = () {} @@ -72,12 +66,8 @@ interface I(N: Core.IntLiteral) { let V: Array(Self, N); } -// 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]]:16: note: array bound of -1 is negative [ArrayBoundNegative] -// CHECK:STDERR: let V: Array(Self, N); -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_monomorphization_failure.carbon:[[@LINE+3]]:24-25: error: member access into facet of incomplete type `I(-1)` [IncompleteTypeInMemberAccessOfFacet] +// CHECK:STDERR: fail_monomorphization_failure.carbon:[[@LINE-4]]:16-19: note: array bound of -1 is negative [ArrayBoundNegative] // CHECK:STDERR: impl {} as I(-1) where .V = () {} @@ -93,12 +83,8 @@ fn F(generic T: I where {} impls Core.ImplicitAs(.Self) and .V = {}); fn CallF() { // TODO: This call should eventually work. - // CHECK:STDERR: fail_todo_constrained_fn.carbon:[[@LINE+7]]:3: error: cannot convert type `{}` into type implementing `I where {} impls Core.ImplicitAs(.Self) and .(I.V) = {}` [ConversionFailureTypeToFacet] - // CHECK:STDERR: F({}); - // CHECK:STDERR: ^~~~~ - // CHECK:STDERR: fail_todo_constrained_fn.carbon:[[@LINE-7]]:14: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(generic T: I where {} impls Core.ImplicitAs(.Self) and .V = {}); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_constrained_fn.carbon:[[@LINE+3]]:3-7: error: cannot convert type `{}` into type implementing `I where {} impls Core.ImplicitAs(.Self) and .(I.V) = {}` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_todo_constrained_fn.carbon:[[@LINE-5]]:14-67: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: F({}); } @@ -344,26 +330,26 @@ fn CallF() { // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {} // CHECK:STDOUT: impl_decl @empty_struct_type.as.I.impl [concrete] {} { -// 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: %.loc11_7.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc11_7.2: type = converted %.loc11_7.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: %.Self.frozen: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc15_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc11_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %V.ref: %I.assoc_type = name_ref V, @V.%assoc0 [concrete = constants.%assoc0.660] -// CHECK:STDOUT: %impl.elem0.loc15_20.1: %.Self.frozen.as_type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.4da] +// CHECK:STDOUT: %impl.elem0.loc11_20.1: %.Self.frozen.as_type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.4da] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] -// CHECK:STDOUT: %rewrite.loc15_23.1 = requirement_rewrite %impl.elem0.loc15_20.1, %int_0 [concrete] -// CHECK:STDOUT: %impl.elem0.loc15_20.2: %.Self.as_type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.ca3] -// CHECK:STDOUT: %rewrite.loc15_23.2 = requirement_rewrite %impl.elem0.loc15_20.2, %int_0 [concrete] -// CHECK:STDOUT: %.loc15_14.1: type = where_expr [concrete = constants.%I_where.type.8e4] { +// CHECK:STDOUT: %rewrite.loc11_23.1 = requirement_rewrite %impl.elem0.loc11_20.1, %int_0 [concrete] +// CHECK:STDOUT: %impl.elem0.loc11_20.2: %.Self.as_type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.ca3] +// CHECK:STDOUT: %rewrite.loc11_23.2 = requirement_rewrite %impl.elem0.loc11_20.2, %int_0 [concrete] +// CHECK:STDOUT: %.loc11_14.1: type = where_expr [concrete = constants.%I_where.type.8e4] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %rewrite.loc15_23.2 = requirement_rewrite %impl.elem0.loc15_20.2, %int_0 [concrete] +// CHECK:STDOUT: %rewrite.loc11_23.2 = requirement_rewrite %impl.elem0.loc11_20.2, %int_0 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc15: = impl_self_witness @empty_struct_type.as.I.impl.%.loc15_7.2, @I [concrete = constants.%.aaf] +// CHECK:STDOUT: %.loc11: = impl_self_witness @empty_struct_type.as.I.impl.%.loc11_7.2, @I [concrete = constants.%.aaf] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { @@ -383,10 +369,10 @@ fn CallF() { // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_struct_type.as.I.impl: %.loc15_7.2 as %I.ref { +// CHECK:STDOUT: impl @empty_struct_type.as.I.impl: %.loc11_7.2 as %I.ref { // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%impl_witness_assoc_constant), @empty_struct_type.as.I.impl [concrete] // CHECK:STDOUT: %I.impl_witness: = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness] -// CHECK:STDOUT: %.loc15_14.2: %empty_struct_type = converted constants.%int_0, [concrete = ] +// CHECK:STDOUT: %.loc11_14.2: %empty_struct_type = converted constants.%int_0, [concrete = ] // CHECK:STDOUT: %impl_witness_assoc_constant: = impl_witness_assoc_constant [concrete = ] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -500,21 +486,21 @@ fn CallF() { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc18_19: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc16_19: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %V.ref: %I.assoc_type = name_ref V, @V.%assoc0 [concrete = constants.%assoc0.660] -// CHECK:STDOUT: %impl.elem0.loc18_19.1: %.Self.frozen.as_type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.4da] -// CHECK:STDOUT: %.loc18_25.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %impl.elem0.loc16_19.1: %.Self.frozen.as_type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.4da] +// CHECK:STDOUT: %.loc16_25.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc18_25.2: %empty_tuple.type = converted %.loc18_25.1, %empty_tuple [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %rewrite.loc18_22.1 = requirement_rewrite %impl.elem0.loc18_19.1, %.loc18_25.2 [concrete] -// CHECK:STDOUT: %impl.elem0.loc18_19.2: %.Self.as_type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.ca3] -// CHECK:STDOUT: %rewrite.loc18_22.2 = requirement_rewrite %impl.elem0.loc18_19.2, %.loc18_25.2 [concrete] -// CHECK:STDOUT: %.loc18_13.1: type = where_expr [concrete = constants.%I_where.type.d5e] { +// CHECK:STDOUT: %.loc16_25.2: %empty_tuple.type = converted %.loc16_25.1, %empty_tuple [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %rewrite.loc16_22.1 = requirement_rewrite %impl.elem0.loc16_19.1, %.loc16_25.2 [concrete] +// CHECK:STDOUT: %impl.elem0.loc16_19.2: %.Self.as_type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.ca3] +// CHECK:STDOUT: %rewrite.loc16_22.2 = requirement_rewrite %impl.elem0.loc16_19.2, %.loc16_25.2 [concrete] +// CHECK:STDOUT: %.loc16_13.1: type = where_expr [concrete = constants.%I_where.type.d5e] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %rewrite.loc18_22.2 = requirement_rewrite %impl.elem0.loc18_19.2, %.loc18_25.2 [concrete] +// CHECK:STDOUT: %rewrite.loc16_22.2 = requirement_rewrite %impl.elem0.loc16_19.2, %.loc16_25.2 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc18: = impl_self_witness @C.as.I.impl.%C.ref, @I [concrete = constants.%.b7f] +// CHECK:STDOUT: %.loc16: = impl_self_witness @C.as.I.impl.%C.ref, @I [concrete = constants.%.b7f] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { @@ -565,13 +551,13 @@ fn CallF() { // CHECK:STDOUT: impl @C.as.I.impl: %C.ref as %I.ref { // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%impl_witness_assoc_constant), @C.as.I.impl [concrete] // CHECK:STDOUT: %I.impl_witness: = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness] -// CHECK:STDOUT: %impl.elem0.loc18_13: %.cf4 = impl_witness_access constants.%ImplicitAs.impl_witness, element0 [concrete = constants.%empty_tuple.type.as.ImplicitAs.impl.Convert] -// CHECK:STDOUT: %bound_method: = bound_method constants.%empty_tuple, %impl.elem0.loc18_13 [concrete = constants.%empty_tuple.type.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %.loc18_13.2: ref %C = temporary_storage -// CHECK:STDOUT: %empty_tuple.type.as.ImplicitAs.impl.Convert.call: init %C to %.loc18_13.2 = call %bound_method(constants.%empty_tuple) -// CHECK:STDOUT: %.loc18_13.3: init %C = converted constants.%empty_tuple, %empty_tuple.type.as.ImplicitAs.impl.Convert.call -// CHECK:STDOUT: %.loc18_13.4: ref %C = temporary %.loc18_13.2, %.loc18_13.3 -// CHECK:STDOUT: %.loc18_13.5: %C = acquire_value %.loc18_13.4 +// CHECK:STDOUT: %impl.elem0.loc16_13: %.cf4 = impl_witness_access constants.%ImplicitAs.impl_witness, element0 [concrete = constants.%empty_tuple.type.as.ImplicitAs.impl.Convert] +// CHECK:STDOUT: %bound_method: = bound_method constants.%empty_tuple, %impl.elem0.loc16_13 [concrete = constants.%empty_tuple.type.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %.loc16_13.2: ref %C = temporary_storage +// CHECK:STDOUT: %empty_tuple.type.as.ImplicitAs.impl.Convert.call: init %C to %.loc16_13.2 = call %bound_method(constants.%empty_tuple) +// CHECK:STDOUT: %.loc16_13.3: init %C = converted constants.%empty_tuple, %empty_tuple.type.as.ImplicitAs.impl.Convert.call +// CHECK:STDOUT: %.loc16_13.4: ref %C = temporary %.loc16_13.2, %.loc16_13.3 +// CHECK:STDOUT: %.loc16_13.5: %C = acquire_value %.loc16_13.4 // CHECK:STDOUT: %impl_witness_assoc_constant: = impl_witness_assoc_constant [concrete = ] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -721,25 +707,25 @@ fn CallF() { // CHECK:STDOUT: %N.loc7_14.2: Core.IntLiteral = symbolic_binding N, 0 [symbolic = %N.loc7_14.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: %.loc14_7.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc14_7.2: type = converted %.loc14_7.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %I.ref: %I.type.335 = 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: %.2ac = 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: %.loc14_16.1: Core.IntLiteral = value_of_initializer %Core.IntLiteral.as.Negate.impl.Op.call [concrete = constants.%int_-1] +// CHECK:STDOUT: %.loc14_16.2: Core.IntLiteral = converted %Core.IntLiteral.as.Negate.impl.Op.call, %.loc14_16.1 [concrete = constants.%int_-1] // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(constants.%int_-1)> [concrete = constants.%I.type.8c1] // CHECK:STDOUT: %.Self.frozen: %I.type.8c1 = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen.1af] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.type [concrete] // CHECK:STDOUT: %.Self.ref: %I.type.8c1 = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen.1af] // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc18_24: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc14_24: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.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: %.loc14_30: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] // CHECK:STDOUT: %rewrite = requirement_rewrite %V.ref, [concrete] -// CHECK:STDOUT: %.loc18_18: type = where_expr [concrete = ] { +// CHECK:STDOUT: %.loc14_18: type = where_expr [concrete = ] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.type [concrete] // CHECK:STDOUT: %rewrite = requirement_rewrite %V.ref, [concrete] // CHECK:STDOUT: } @@ -776,7 +762,7 @@ fn CallF() { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_struct_type.as..impl: %.loc18_7.2 as { +// CHECK:STDOUT: impl @empty_struct_type.as..impl: %.loc14_7.2 as { // CHECK:STDOUT: !members: // CHECK:STDOUT: extend // CHECK:STDOUT: witness = @@ -931,7 +917,7 @@ fn CallF() { // CHECK:STDOUT: fn @CallF() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] -// CHECK:STDOUT: %.loc19: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc15: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/basic.carbon b/toolchain/check/testdata/impl/basic.carbon index ee1c171bf5c2..3ce0ec49528b 100644 --- a/toolchain/check/testdata/impl/basic.carbon +++ b/toolchain/check/testdata/impl/basic.carbon @@ -37,9 +37,7 @@ interface I { class C {} // This produces an invalid impl. -// CHECK:STDERR: fail_invalid_impl.carbon:[[@LINE+4]]:6: error: name `Unknown` not found [NameNotFound] -// CHECK:STDERR: impl Unknown as I { -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_invalid_impl.carbon:[[@LINE+2]]:6-12: error: name `Unknown` not found [NameNotFound] // CHECK:STDERR: impl Unknown as I { fn Op(unused self) {} @@ -53,9 +51,7 @@ import library "invalid_impl"; fn F() { // This impl doesn't exist, but it still tests that we can ignore the // `impl Unknown as I` on import. - // CHECK:STDERR: fail_import_invalid_impl.carbon:[[@LINE+4]]:3: error: cannot access member of interface `I` in type `type` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: C.(I.Op)(); - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_import_invalid_impl.carbon:[[@LINE+2]]:3-10: error: cannot access member of interface `I` in type `type` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: C.(I.Op)(); } @@ -68,45 +64,27 @@ interface I {} class C(T: type) {} -// CHECK:STDERR: fail_conflicting_bad_impls.carbon:[[@LINE+4]]:12: error: name `invalid` not found [NameNotFound] -// CHECK:STDERR: final impl invalid as I {} -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_conflicting_bad_impls.carbon:[[@LINE+2]]:12-18: error: name `invalid` not found [NameNotFound] // CHECK:STDERR: final impl invalid as I {} -// CHECK:STDERR: fail_conflicting_bad_impls.carbon:[[@LINE+11]]:12: error: name `invalid` not found [NameNotFound] -// CHECK:STDERR: final impl invalid as I {} -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_conflicting_bad_impls.carbon:[[@LINE+5]]:12-18: error: name `invalid` not found [NameNotFound] // CHECK:STDERR: -// CHECK:STDERR: fail_conflicting_bad_impls.carbon:[[@LINE+7]]:1: error: redefinition of `impl as I` [ImplRedefinition] -// CHECK:STDERR: final impl invalid as I {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_conflicting_bad_impls.carbon:[[@LINE-8]]:1: note: previous definition was here [ImplPreviousDefinition] -// CHECK:STDERR: final impl invalid as I {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_conflicting_bad_impls.carbon:[[@LINE+3]]:1-25: error: redefinition of `impl as I` [ImplRedefinition] +// CHECK:STDERR: fail_conflicting_bad_impls.carbon:[[@LINE-4]]:1-25: note: previous definition was here [ImplPreviousDefinition] // CHECK:STDERR: final impl invalid as I {} -// CHECK:STDERR: fail_conflicting_bad_impls.carbon:[[@LINE+4]]:12: error: name `alsoinvalid` not found [NameNotFound] -// CHECK:STDERR: final impl alsoinvalid as I {} -// CHECK:STDERR: ^~~~~~~~~~~ +// CHECK:STDERR: fail_conflicting_bad_impls.carbon:[[@LINE+2]]:12-22: error: name `alsoinvalid` not found [NameNotFound] // CHECK:STDERR: final impl alsoinvalid as I {} -// CHECK:STDERR: fail_conflicting_bad_impls.carbon:[[@LINE+4]]:14: error: name `invalid` not found [NameNotFound] -// CHECK:STDERR: final impl C(invalid) as I {} -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_conflicting_bad_impls.carbon:[[@LINE+2]]:14-20: error: name `invalid` not found [NameNotFound] // CHECK:STDERR: final impl C(invalid) as I {} -// CHECK:STDERR: fail_conflicting_bad_impls.carbon:[[@LINE+11]]:14: error: name `invalid` not found [NameNotFound] -// CHECK:STDERR: final impl C(invalid) as I {} -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_conflicting_bad_impls.carbon:[[@LINE+5]]:14-20: error: name `invalid` not found [NameNotFound] // CHECK:STDERR: -// CHECK:STDERR: fail_conflicting_bad_impls.carbon:[[@LINE+7]]:1: error: redefinition of `impl as I` [ImplRedefinition] -// CHECK:STDERR: final impl C(invalid) as I {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_conflicting_bad_impls.carbon:[[@LINE-8]]:1: note: previous definition was here [ImplPreviousDefinition] -// CHECK:STDERR: final impl C(invalid) as I {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_conflicting_bad_impls.carbon:[[@LINE+3]]:1-28: error: redefinition of `impl as I` [ImplRedefinition] +// CHECK:STDERR: fail_conflicting_bad_impls.carbon:[[@LINE-4]]:1-28: note: previous definition was here [ImplPreviousDefinition] // CHECK:STDERR: final impl C(invalid) as I {} diff --git a/toolchain/check/testdata/impl/compound.carbon b/toolchain/check/testdata/impl/compound.carbon index 6acebcd74a2c..63c3b6aaebc7 100644 --- a/toolchain/check/testdata/impl/compound.carbon +++ b/toolchain/check/testdata/impl/compound.carbon @@ -48,12 +48,8 @@ impl {.b: ()} as NonInstance2 { } 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: n.(NonInstance2.F2)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_non-instance.carbon:[[@LINE+3]]:3-21: error: cannot implicitly convert non-type value of type `{.b: ()}` into type implementing `NonInstance2` [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: fail_non-instance.carbon:[[@LINE+2]]:3-21: note: type `{.b: ()}` does not implement interface `Core.ImplicitAs(NonInstance2)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: n.(NonInstance2.F2)(); } @@ -72,12 +68,8 @@ impl {.c: ()} as NonInstance3 { } 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: p->(NonInstance3.F3)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_non-instance_indirect.carbon:[[@LINE+3]]:3-22: error: cannot implicitly convert non-type value of type `{.c: ()}` into type implementing `NonInstance3` [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: fail_non-instance_indirect.carbon:[[@LINE+2]]:3-22: note: type `{.c: ()}` does not implement interface `Core.ImplicitAs(NonInstance3)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: p->(NonInstance3.F3)(); } @@ -113,9 +105,7 @@ impl {.e: ()} as Instance2 { } fn InstanceCallFail() { - // CHECK:STDERR: fail_instance.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Instance2` in type `type` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: {.e: ()}.(Instance2.G2)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_instance.carbon:[[@LINE+2]]:3-25: error: cannot access member of interface `Instance2` in type `type` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: {.e: ()}.(Instance2.G2)(); } @@ -510,7 +500,7 @@ fn InstanceCallFail() { // CHECK:STDOUT: %n.ref: %struct_type.b = name_ref n, %n // CHECK:STDOUT: %NonInstance2.ref: type = name_ref NonInstance2, file.%NonInstance2.decl [concrete = constants.%NonInstance2.type] // CHECK:STDOUT: %F2.ref: %NonInstance2.assoc_type = name_ref F2, @NonInstance2.WithSelf.%assoc0 [concrete = constants.%assoc0.d17] -// CHECK:STDOUT: %.loc21: %NonInstance2.type = converted %n.ref, [concrete = ] +// CHECK:STDOUT: %.loc17: %NonInstance2.type = converted %n.ref, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -747,8 +737,8 @@ fn InstanceCallFail() { // CHECK:STDOUT: %p.ref: %ptr = name_ref p, %p // CHECK:STDOUT: %NonInstance3.ref: type = name_ref NonInstance3, file.%NonInstance3.decl [concrete = constants.%NonInstance3.type] // CHECK:STDOUT: %F3.ref: %NonInstance3.assoc_type = name_ref F3, @NonInstance3.WithSelf.%assoc0 [concrete = constants.%assoc0.4a8] -// CHECK:STDOUT: %.loc21_4.1: ref %struct_type.c = deref %p.ref -// CHECK:STDOUT: %.loc21_4.2: %NonInstance3.type = converted %.loc21_4.1, [concrete = ] +// CHECK:STDOUT: %.loc17_4.1: ref %struct_type.c = deref %p.ref +// CHECK:STDOUT: %.loc17_4.2: %NonInstance3.type = converted %.loc17_4.1, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1136,8 +1126,8 @@ fn InstanceCallFail() { // CHECK:STDOUT: // CHECK:STDOUT: fn @InstanceCallFail() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc16_9.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc16_9.2: type = converted %.loc16_9.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc14_9.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc14_9.2: type = converted %.loc14_9.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %struct_type.e: type = struct_type {.e: %empty_tuple.type} [concrete = constants.%struct_type.e] // CHECK:STDOUT: %Instance2.ref: type = name_ref Instance2, file.%Instance2.decl [concrete = constants.%Instance2.type] // CHECK:STDOUT: %G2.ref: %Instance2.assoc_type = name_ref G2, @Instance2.WithSelf.%assoc0 [concrete = constants.%assoc0] diff --git a/toolchain/check/testdata/impl/custom_witness/destroy.carbon b/toolchain/check/testdata/impl/custom_witness/destroy.carbon index 19c76a2d2896..eeb8ce468a75 100644 --- a/toolchain/check/testdata/impl/custom_witness/destroy.carbon +++ b/toolchain/check/testdata/impl/custom_witness/destroy.carbon @@ -71,9 +71,7 @@ class C(T: type); fn F() { // This looks for a Destroy witness for an incomplete class type. - // CHECK:STDERR: fail_destroy_incomplete_class.carbon:[[@LINE+4]]:3: error: cannot convert type `C({})` into type implementing `Core.Destroy` [ConversionFailureTypeToFacet] - // CHECK:STDERR: C({}) as Core.Destroy; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_destroy_incomplete_class.carbon:[[@LINE+2]]:3-23: error: cannot convert type `C({})` into type implementing `Core.Destroy` [ConversionFailureTypeToFacet] // CHECK:STDERR: C({}) as Core.Destroy; } diff --git a/toolchain/check/testdata/impl/custom_witness/float_fits_in.carbon b/toolchain/check/testdata/impl/custom_witness/float_fits_in.carbon index 9376ae787582..5e32d33bc652 100644 --- a/toolchain/check/testdata/impl/custom_witness/float_fits_in.carbon +++ b/toolchain/check/testdata/impl/custom_witness/float_fits_in.carbon @@ -42,20 +42,12 @@ library "[[@TEST_NAME]]"; import Core; fn CheckFail() { - // CHECK:STDERR: fail_narrowing.carbon:[[@LINE+7]]:3: error: cannot convert type `f64` into type implementing `Core.FloatFitsIn(f32)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Core.CheckFitsIn(1.0 as f64, 2.0 as f32); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: core.carbon:6:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn CheckFitsIn[U: type, T: FloatFitsIn(U)](unused t: T, unused u: U) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_narrowing.carbon:[[@LINE+3]]:3-42: error: cannot convert type `f64` into type implementing `Core.FloatFitsIn(f32)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: core.carbon:6:1-70: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: Core.CheckFitsIn(1.0 as f64, 2.0 as f32); - // CHECK:STDERR: fail_narrowing.carbon:[[@LINE+7]]:3: error: cannot convert type `f32` into type implementing `Core.FloatFitsIn(f16)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Core.CheckFitsIn(1.0 as f32, 2.0 as f16); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: core.carbon:6:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn CheckFitsIn[U: type, T: FloatFitsIn(U)](unused t: T, unused u: U) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_narrowing.carbon:[[@LINE+3]]:3-42: error: cannot convert type `f32` into type implementing `Core.FloatFitsIn(f16)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: core.carbon:6:1-70: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: Core.CheckFitsIn(1.0 as f32, 2.0 as f16); } diff --git a/toolchain/check/testdata/impl/custom_witness/int_fits_in.carbon b/toolchain/check/testdata/impl/custom_witness/int_fits_in.carbon index 1aa0e2328b95..6997efacbea6 100644 --- a/toolchain/check/testdata/impl/custom_witness/int_fits_in.carbon +++ b/toolchain/check/testdata/impl/custom_witness/int_fits_in.carbon @@ -42,36 +42,20 @@ library "[[@TEST_NAME]]"; import Core; fn CheckFail() { - // CHECK:STDERR: fail_narrowing.carbon:[[@LINE+7]]:3: error: cannot convert type `i64` into type implementing `Core.IntFitsIn(i32)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Core.CheckFitsIn(1 as i64, 2 as i32); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: core.carbon:6:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn CheckFitsIn[U: type, T: IntFitsIn(U)](unused t: T, unused u: U) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_narrowing.carbon:[[@LINE+3]]:3-38: error: cannot convert type `i64` into type implementing `Core.IntFitsIn(i32)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: core.carbon:6:1-68: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: Core.CheckFitsIn(1 as i64, 2 as i32); - // CHECK:STDERR: fail_narrowing.carbon:[[@LINE+7]]:3: error: cannot convert type `i64` into type implementing `Core.IntFitsIn(u32)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Core.CheckFitsIn(1 as i64, 2 as u32); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: core.carbon:6:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn CheckFitsIn[U: type, T: IntFitsIn(U)](unused t: T, unused u: U) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_narrowing.carbon:[[@LINE+3]]:3-38: error: cannot convert type `i64` into type implementing `Core.IntFitsIn(u32)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: core.carbon:6:1-68: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: Core.CheckFitsIn(1 as i64, 2 as u32); - // CHECK:STDERR: fail_narrowing.carbon:[[@LINE+7]]:3: error: cannot convert type `u64` into type implementing `Core.IntFitsIn(i32)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Core.CheckFitsIn(1 as u64, 2 as i32); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: core.carbon:6:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn CheckFitsIn[U: type, T: IntFitsIn(U)](unused t: T, unused u: U) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_narrowing.carbon:[[@LINE+3]]:3-38: error: cannot convert type `u64` into type implementing `Core.IntFitsIn(i32)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: core.carbon:6:1-68: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: Core.CheckFitsIn(1 as u64, 2 as i32); - // CHECK:STDERR: fail_narrowing.carbon:[[@LINE+7]]:3: error: cannot convert type `u64` into type implementing `Core.IntFitsIn(u32)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Core.CheckFitsIn(1 as u64, 2 as u32); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: core.carbon:6:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn CheckFitsIn[U: type, T: IntFitsIn(U)](unused t: T, unused u: U) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_narrowing.carbon:[[@LINE+3]]:3-38: error: cannot convert type `u64` into type implementing `Core.IntFitsIn(u32)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: core.carbon:6:1-68: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: Core.CheckFitsIn(1 as u64, 2 as u32); } @@ -83,20 +67,12 @@ library "[[@TEST_NAME]]"; import Core; fn CheckFail() { - // CHECK:STDERR: fail_same_size_sign_change.carbon:[[@LINE+7]]:3: error: cannot convert type `u32` into type implementing `Core.IntFitsIn(i32)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Core.CheckFitsIn(1 as u32, 2 as i32); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: core.carbon:6:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn CheckFitsIn[U: type, T: IntFitsIn(U)](unused t: T, unused u: U) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_same_size_sign_change.carbon:[[@LINE+3]]:3-38: error: cannot convert type `u32` into type implementing `Core.IntFitsIn(i32)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: core.carbon:6:1-68: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: Core.CheckFitsIn(1 as u32, 2 as i32); - // CHECK:STDERR: fail_same_size_sign_change.carbon:[[@LINE+7]]:3: error: cannot convert type `i32` into type implementing `Core.IntFitsIn(u32)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Core.CheckFitsIn(1 as i32, 2 as u32); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: core.carbon:6:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn CheckFitsIn[U: type, T: IntFitsIn(U)](unused t: T, unused u: U) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_same_size_sign_change.carbon:[[@LINE+3]]:3-38: error: cannot convert type `i32` into type implementing `Core.IntFitsIn(u32)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: core.carbon:6:1-68: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: Core.CheckFitsIn(1 as i32, 2 as u32); } @@ -108,12 +84,8 @@ library "[[@TEST_NAME]]"; import Core; fn CheckFail() { - // CHECK:STDERR: fail_signed_to_wider_unsigned.carbon:[[@LINE+7]]:3: error: cannot convert type `i32` into type implementing `Core.IntFitsIn(u32)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Core.CheckFitsIn(1 as i32, 2 as u32); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: core.carbon:6:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn CheckFitsIn[U: type, T: IntFitsIn(U)](unused t: T, unused u: U) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_signed_to_wider_unsigned.carbon:[[@LINE+3]]:3-38: error: cannot convert type `i32` into type implementing `Core.IntFitsIn(u32)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: core.carbon:6:1-68: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: Core.CheckFitsIn(1 as i32, 2 as u32); } diff --git a/toolchain/check/testdata/impl/error_recovery.carbon b/toolchain/check/testdata/impl/error_recovery.carbon index 7e4784aab14d..5a719b1e3b9b 100644 --- a/toolchain/check/testdata/impl/error_recovery.carbon +++ b/toolchain/check/testdata/impl/error_recovery.carbon @@ -17,9 +17,7 @@ class C {} interface I {} //@dump-sem-ir-begin -// CHECK:STDERR: fail_runtime_generic_param.carbon:[[@LINE+4]]:14: error: parameters of generic types must be constant [GenericParamMustBeConstant] -// CHECK:STDERR: impl forall [runtime T: type] C as I {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_runtime_generic_param.carbon:[[@LINE+2]]:14-28: error: parameters of generic types must be constant [GenericParamMustBeConstant] // CHECK:STDERR: impl forall [runtime T: type] C as I {} //@dump-sem-ir-end @@ -28,9 +26,7 @@ impl forall [runtime T: type] C as I {} library "[[@TEST_NAME]]"; interface Z {} -// CHECK:STDERR: fail_nonfinal_lookup_impl_witness_error_in_import.carbon:[[@LINE+4]]:1: error: impl declared but not defined [ImplMissingDefinition] -// CHECK:STDERR: impl forall [T: type] T as Z; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_nonfinal_lookup_impl_witness_error_in_import.carbon:[[@LINE+2]]:1-29: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl forall [T: type] T as Z; @@ -60,9 +56,7 @@ fn H() { library "[[@TEST_NAME]]"; interface Z {} -// CHECK:STDERR: fail_nonfinal_lookup_impl_witness_error.carbon:[[@LINE+4]]:1: error: impl declared but not defined [ImplMissingDefinition] -// CHECK:STDERR: impl forall [T: type] T as Z; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_nonfinal_lookup_impl_witness_error.carbon:[[@LINE+2]]:1-29: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl forall [T: type] T as Z; @@ -89,9 +83,7 @@ fn H() { library "[[@TEST_NAME]]"; interface Z {} -// CHECK:STDERR: fail_final_lookup_impl_witness_error.carbon:[[@LINE+4]]:1: error: impl declared but not defined [ImplMissingDefinition] -// CHECK:STDERR: impl forall [T: type] T as Z; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_final_lookup_impl_witness_error.carbon:[[@LINE+2]]:1-29: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl forall [T: type] T as Z; @@ -118,17 +110,11 @@ class C {}; //@dump-sem-ir-begin impl C as I { // This leaves the impl with a placeholder instruction in the witness table. - // CHECK:STDERR: fail_invalid_fn_syntax_in_impl.carbon:[[@LINE+12]]:9: error: name `x` not found [NameNotFound] - // CHECK:STDERR: fn Op[x self: C]() {} - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_invalid_fn_syntax_in_impl.carbon:[[@LINE+6]]:9: error: name `x` not found [NameNotFound] // CHECK:STDERR: - // CHECK:STDERR: fail_invalid_fn_syntax_in_impl.carbon:[[@LINE+8]]:11: error: expected `,` or `]` [UnexpectedTokenAfterListElement] - // CHECK:STDERR: fn Op[x self: C]() {} - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_invalid_fn_syntax_in_impl.carbon:[[@LINE+4]]:11-14: error: expected `,` or `]` [UnexpectedTokenAfterListElement] // CHECK:STDERR: - // CHECK:STDERR: fail_invalid_fn_syntax_in_impl.carbon:[[@LINE+4]]:8: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] - // CHECK:STDERR: fn Op[x self: C]() {} - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_invalid_fn_syntax_in_impl.carbon:[[@LINE+2]]:8-18: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: fn Op[x self: C]() {} } @@ -149,7 +135,7 @@ impl C as I { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc11: = impl_self_witness @C.as.I.impl.%C.ref, @I [concrete = constants.%.b7f] +// CHECK:STDOUT: %.loc9: = impl_self_witness @C.as.I.impl.%C.ref, @I [concrete = constants.%.b7f] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @C.as.I.impl: %C.ref as %I.ref { @@ -183,41 +169,41 @@ impl C as I { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] { -// CHECK:STDOUT: %T.patt.loc13_15.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc13_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc11_15.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_15.2 (constants.%T.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc13_17.1: type = splice_block %.loc13_17.2 [concrete = type] { +// CHECK:STDOUT: %.loc11_17.1: type = splice_block %.loc11_17.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc13_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc11_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc13_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc13_15.1 (constants.%T)] +// CHECK:STDOUT: %T.loc11_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc11_15.1 (constants.%T)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @G(%T.loc13_15.2: type) { -// CHECK:STDOUT: %T.patt.loc13_15.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc13_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc13_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc13_15.1 (constants.%T)] +// CHECK:STDOUT: generic fn @G(%T.loc11_15.2: type) { +// CHECK:STDOUT: %T.patt.loc11_15.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc11_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc11_15.1 (constants.%T)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %.loc19_6.2: require_specific_def_type = require_specific_def @T.as.Z.impl(%T.loc13_15.1) [symbolic = %.loc19_6.2 (constants.%.2f2)] -// CHECK:STDOUT: %Z.lookup_impl_witness: = lookup_impl_witness %T.loc13_15.1, @Z [symbolic = %Z.lookup_impl_witness (constants.%Z.lookup_impl_witness)] -// CHECK:STDOUT: %Z.facet.loc19_6.2: %Z.type = facet_value %T.loc13_15.1, (%Z.lookup_impl_witness) [symbolic = %Z.facet.loc19_6.2 (constants.%Z.facet)] -// CHECK:STDOUT: %F.specific_fn.loc19_3.2: = specific_function constants.%F, @F(%Z.facet.loc19_6.2) [symbolic = %F.specific_fn.loc19_3.2 (constants.%F.specific_fn)] +// CHECK:STDOUT: %.loc17_6.2: require_specific_def_type = require_specific_def @T.as.Z.impl(%T.loc11_15.1) [symbolic = %.loc17_6.2 (constants.%.2f2)] +// CHECK:STDOUT: %Z.lookup_impl_witness: = lookup_impl_witness %T.loc11_15.1, @Z [symbolic = %Z.lookup_impl_witness (constants.%Z.lookup_impl_witness)] +// CHECK:STDOUT: %Z.facet.loc17_6.2: %Z.type = facet_value %T.loc11_15.1, (%Z.lookup_impl_witness) [symbolic = %Z.facet.loc17_6.2 (constants.%Z.facet)] +// CHECK:STDOUT: %F.specific_fn.loc17_3.2: = specific_function constants.%F, @F(%Z.facet.loc17_6.2) [symbolic = %F.specific_fn.loc17_3.2 (constants.%F.specific_fn)] // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc13_15.2 [symbolic = %T.loc13_15.1 (constants.%T)] -// CHECK:STDOUT: %Z.facet.loc19_6.1: %Z.type = facet_value %T.ref, (constants.%Z.lookup_impl_witness) [symbolic = %Z.facet.loc19_6.2 (constants.%Z.facet)] -// CHECK:STDOUT: %.loc19_6.1: %Z.type = converted %T.ref, %Z.facet.loc19_6.1 [symbolic = %Z.facet.loc19_6.2 (constants.%Z.facet)] -// CHECK:STDOUT: %F.specific_fn.loc19_3.1: = specific_function %F.ref, @F(constants.%Z.facet) [symbolic = %F.specific_fn.loc19_3.2 (constants.%F.specific_fn)] -// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn.loc19_3.1() +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc11_15.2 [symbolic = %T.loc11_15.1 (constants.%T)] +// CHECK:STDOUT: %Z.facet.loc17_6.1: %Z.type = facet_value %T.ref, (constants.%Z.lookup_impl_witness) [symbolic = %Z.facet.loc17_6.2 (constants.%Z.facet)] +// CHECK:STDOUT: %.loc17_6.1: %Z.type = converted %T.ref, %Z.facet.loc17_6.1 [symbolic = %Z.facet.loc17_6.2 (constants.%Z.facet)] +// CHECK:STDOUT: %F.specific_fn.loc17_3.1: = specific_function %F.ref, @F(constants.%Z.facet) [symbolic = %F.specific_fn.loc17_3.2 (constants.%F.specific_fn)] +// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn.loc17_3.1() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @G(constants.%T) { -// CHECK:STDOUT: %T.patt.loc13_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc13_15.1 => constants.%T +// CHECK:STDOUT: %T.patt.loc11_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc11_15.1 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_nonfinal_lookup_impl_witness_error.carbon @@ -243,52 +229,52 @@ impl C as I { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] { -// CHECK:STDOUT: %T.patt.loc13_15.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc13_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc11_15.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_15.2 (constants.%T.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc13_17.1: type = splice_block %.loc13_17.2 [concrete = type] { +// CHECK:STDOUT: %.loc11_17.1: type = splice_block %.loc11_17.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc13_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc11_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc13_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc13_15.1 (constants.%T)] +// CHECK:STDOUT: %T.loc11_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc11_15.1 (constants.%T)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @G(%T.loc13_15.2: type) { -// CHECK:STDOUT: %T.patt.loc13_15.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc13_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc13_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc13_15.1 (constants.%T)] +// CHECK:STDOUT: generic fn @G(%T.loc11_15.2: type) { +// CHECK:STDOUT: %T.patt.loc11_15.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc11_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc11_15.1 (constants.%T)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %.loc19_6.2: require_specific_def_type = require_specific_def @T.as.Z.impl(%T.loc13_15.1) [symbolic = %.loc19_6.2 (constants.%.2f2)] -// CHECK:STDOUT: %Z.lookup_impl_witness: = lookup_impl_witness %T.loc13_15.1, @Z [symbolic = %Z.lookup_impl_witness (constants.%Z.lookup_impl_witness)] -// CHECK:STDOUT: %Z.facet.loc19_6.2: %Z.type = facet_value %T.loc13_15.1, (%Z.lookup_impl_witness) [symbolic = %Z.facet.loc19_6.2 (constants.%Z.facet)] -// CHECK:STDOUT: %F.specific_fn.loc19_3.2: = specific_function constants.%F, @F(%Z.facet.loc19_6.2) [symbolic = %F.specific_fn.loc19_3.2 (constants.%F.specific_fn)] +// CHECK:STDOUT: %.loc17_6.2: require_specific_def_type = require_specific_def @T.as.Z.impl(%T.loc11_15.1) [symbolic = %.loc17_6.2 (constants.%.2f2)] +// CHECK:STDOUT: %Z.lookup_impl_witness: = lookup_impl_witness %T.loc11_15.1, @Z [symbolic = %Z.lookup_impl_witness (constants.%Z.lookup_impl_witness)] +// CHECK:STDOUT: %Z.facet.loc17_6.2: %Z.type = facet_value %T.loc11_15.1, (%Z.lookup_impl_witness) [symbolic = %Z.facet.loc17_6.2 (constants.%Z.facet)] +// CHECK:STDOUT: %F.specific_fn.loc17_3.2: = specific_function constants.%F, @F(%Z.facet.loc17_6.2) [symbolic = %F.specific_fn.loc17_3.2 (constants.%F.specific_fn)] // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc13_15.2 [symbolic = %T.loc13_15.1 (constants.%T)] -// CHECK:STDOUT: %Z.facet.loc19_6.1: %Z.type = facet_value %T.ref, (constants.%Z.lookup_impl_witness) [symbolic = %Z.facet.loc19_6.2 (constants.%Z.facet)] -// CHECK:STDOUT: %.loc19_6.1: %Z.type = converted %T.ref, %Z.facet.loc19_6.1 [symbolic = %Z.facet.loc19_6.2 (constants.%Z.facet)] -// CHECK:STDOUT: %F.specific_fn.loc19_3.1: = specific_function %F.ref, @F(constants.%Z.facet) [symbolic = %F.specific_fn.loc19_3.2 (constants.%F.specific_fn)] -// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn.loc19_3.1() +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc11_15.2 [symbolic = %T.loc11_15.1 (constants.%T)] +// CHECK:STDOUT: %Z.facet.loc17_6.1: %Z.type = facet_value %T.ref, (constants.%Z.lookup_impl_witness) [symbolic = %Z.facet.loc17_6.2 (constants.%Z.facet)] +// CHECK:STDOUT: %.loc17_6.1: %Z.type = converted %T.ref, %Z.facet.loc17_6.1 [symbolic = %Z.facet.loc17_6.2 (constants.%Z.facet)] +// CHECK:STDOUT: %F.specific_fn.loc17_3.1: = specific_function %F.ref, @F(constants.%Z.facet) [symbolic = %F.specific_fn.loc17_3.2 (constants.%F.specific_fn)] +// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn.loc17_3.1() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @G(constants.%T) { -// CHECK:STDOUT: %T.patt.loc13_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc13_15.1 => constants.%T +// CHECK:STDOUT: %T.patt.loc11_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc11_15.1 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @G(constants.%empty_tuple.type) { -// CHECK:STDOUT: %T.patt.loc13_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc13_15.1 => constants.%empty_tuple.type +// CHECK:STDOUT: %T.patt.loc11_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc11_15.1 => constants.%empty_tuple.type // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %.loc19_6.2 => constants.%.ba2 +// CHECK:STDOUT: %.loc17_6.2 => constants.%.ba2 // CHECK:STDOUT: %Z.lookup_impl_witness => -// CHECK:STDOUT: %Z.facet.loc19_6.2 => -// CHECK:STDOUT: %F.specific_fn.loc19_3.2 => +// CHECK:STDOUT: %Z.facet.loc17_6.2 => +// CHECK:STDOUT: %F.specific_fn.loc17_3.2 => // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_final_lookup_impl_witness_error.carbon @@ -308,9 +294,9 @@ impl C as I { // CHECK:STDOUT: fn @G() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] -// CHECK:STDOUT: %.loc18_6: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc16_6: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] // CHECK:STDOUT: %Z.facet: %Z.type = facet_value constants.%empty_tuple.type, (constants.%Z.impl_witness.47a) [concrete = constants.%Z.facet] -// CHECK:STDOUT: %.loc18_7: %Z.type = converted %.loc18_6, %Z.facet [concrete = constants.%Z.facet] +// CHECK:STDOUT: %.loc16_7: %Z.type = converted %.loc16_6, %Z.facet [concrete = constants.%Z.facet] // CHECK:STDOUT: %F.specific_fn: = specific_function %F.ref, @F(constants.%Z.facet) [concrete = constants.%F.specific_fn] // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn() // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/eval_musteval.carbon b/toolchain/check/testdata/impl/eval_musteval.carbon index 500118dbdd00..85c1ce049b59 100644 --- a/toolchain/check/testdata/impl/eval_musteval.carbon +++ b/toolchain/check/testdata/impl/eval_musteval.carbon @@ -77,19 +77,13 @@ impl A as MustEval { } fn Call() { - // CHECK:STDERR: fail_impl_runtime_eval.carbon:[[@LINE+4]]:17: error: cannot evaluate type expression [TypeExprEvaluationFailure] - // CHECK:STDERR: let unused t: ({} as A).(Runtime.F)() = {} as A; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_impl_runtime_eval.carbon:[[@LINE+2]]:17-39: error: cannot evaluate type expression [TypeExprEvaluationFailure] // CHECK:STDERR: let unused t: ({} as A).(Runtime.F)() = {} as A; - // CHECK:STDERR: fail_impl_runtime_eval.carbon:[[@LINE+4]]:17: error: cannot evaluate type expression [TypeExprEvaluationFailure] - // CHECK:STDERR: let unused u: ({} as A).(Eval.F)() = {} as A; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_impl_runtime_eval.carbon:[[@LINE+2]]:17-36: error: cannot evaluate type expression [TypeExprEvaluationFailure] // CHECK:STDERR: let unused u: ({} as A).(Eval.F)() = {} as A; - // CHECK:STDERR: fail_impl_runtime_eval.carbon:[[@LINE+4]]:17: error: cannot evaluate type expression [TypeExprEvaluationFailure] - // CHECK:STDERR: let unused v: ({} as A).(MustEval.F)() = {} as A; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_impl_runtime_eval.carbon:[[@LINE+2]]:17-40: error: cannot evaluate type expression [TypeExprEvaluationFailure] // CHECK:STDERR: let unused v: ({} as A).(MustEval.F)() = {} as A; } @@ -142,9 +136,7 @@ impl B as Runtime { fn Call() { // TODO: Should we allow calling this at compile time? This is allowed if we // don't generate a thunk. - // CHECK:STDERR: fail_todo_impl_eval_from_runtime_thunk.carbon:[[@LINE+4]]:17: error: cannot evaluate type expression [TypeExprEvaluationFailure] - // CHECK:STDERR: let unused t: ({} as B).(Runtime.F)() = {} as B; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_impl_eval_from_runtime_thunk.carbon:[[@LINE+2]]:17-39: error: cannot evaluate type expression [TypeExprEvaluationFailure] // CHECK:STDERR: let unused t: ({} as B).(Runtime.F)() = {} as B; } @@ -158,31 +150,19 @@ import library "interface"; class B { adapt {}; } impl B as Runtime { - // CHECK:STDERR: fail_impl_musteval.carbon:[[@LINE+11]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: musteval fn F(unused self) -> type { return B; } - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_musteval.carbon:[[@LINE+8]]:3: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] - // CHECK:STDERR: musteval fn F(unused self) -> type { return B; } - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_musteval.carbon:[[@LINE-11]]:1: in import [InImport] - // CHECK:STDERR: interface.carbon:5:3: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: fn F(self) -> type; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_impl_musteval.carbon:[[@LINE+5]]:3-38: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: fail_impl_musteval.carbon:[[@LINE+4]]:3-38: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: imported from: fail_impl_musteval.carbon:[[@LINE-7]]:1 [InImport] + // CHECK:STDERR: interface.carbon:5:3-21: note: while building thunk to match the signature of this function [ThunkSignature] // CHECK:STDERR: musteval fn F(unused self) -> type { return B; } } impl B as Eval { - // CHECK:STDERR: fail_impl_musteval.carbon:[[@LINE+11]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: musteval fn F(unused self) -> type { return B; } - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_musteval.carbon:[[@LINE+8]]:3: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] - // CHECK:STDERR: musteval fn F(unused self) -> type { return B; } - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_musteval.carbon:[[@LINE-26]]:1: in import [InImport] - // CHECK:STDERR: interface.carbon:9:3: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: eval fn F(self) -> type; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_impl_musteval.carbon:[[@LINE+5]]:3-38: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: fail_impl_musteval.carbon:[[@LINE+4]]:3-38: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: imported from: fail_impl_musteval.carbon:[[@LINE-16]]:1 [InImport] + // CHECK:STDERR: interface.carbon:9:3-26: note: while building thunk to match the signature of this function [ThunkSignature] // CHECK:STDERR: musteval fn F(unused self) -> type { return B; } } @@ -217,16 +197,10 @@ impl B as Core.ImplicitAs(BView) { } impl B as MustEval { - // CHECK:STDERR: fail_todo_impl_musteval_from_musteval_thunk.carbon:[[@LINE+11]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: musteval fn F(unused self: BView) -> type { return B; } - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_impl_musteval_from_musteval_thunk.carbon:[[@LINE+8]]:3: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] - // CHECK:STDERR: musteval fn F(unused self: BView) -> type { return B; } - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_impl_musteval_from_musteval_thunk.carbon:[[@LINE-16]]:1: in import [InImport] - // CHECK:STDERR: interface.carbon:13:3: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: musteval fn F(self) -> type; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_impl_musteval_from_musteval_thunk.carbon:[[@LINE+5]]:3-45: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: fail_todo_impl_musteval_from_musteval_thunk.carbon:[[@LINE+4]]:3-45: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: imported from: fail_todo_impl_musteval_from_musteval_thunk.carbon:[[@LINE-12]]:1 [InImport] + // CHECK:STDERR: interface.carbon:13:3-30: note: while building thunk to match the signature of this function [ThunkSignature] // CHECK:STDERR: musteval fn F(unused self: BView) -> type { return B; } } diff --git a/toolchain/check/testdata/impl/extend_final.carbon b/toolchain/check/testdata/impl/extend_final.carbon index ac083bd38e77..8f7ce62fc31c 100644 --- a/toolchain/check/testdata/impl/extend_final.carbon +++ b/toolchain/check/testdata/impl/extend_final.carbon @@ -31,12 +31,8 @@ library "[[@TEST_NAME]]"; interface Z {} class C { - // CHECK:STDERR: fail_final_extend_impl.carbon:[[@LINE+7]]:9: error: `extend` must appear before `final` [ModifierMustAppearBefore] - // CHECK:STDERR: final extend impl as Z {} - // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_final_extend_impl.carbon:[[@LINE+4]]:3: note: `final` previously appeared here [ModifierPrevious] - // CHECK:STDERR: final extend impl as Z {} - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_final_extend_impl.carbon:[[@LINE+3]]:9-14: error: `extend` must appear before `final` [ModifierMustAppearBefore] + // CHECK:STDERR: fail_final_extend_impl.carbon:[[@LINE+2]]:3-7: note: `final` previously appeared here [ModifierPrevious] // CHECK:STDERR: final extend impl as Z {} } @@ -48,8 +44,6 @@ interface Z {} class C {} -// CHECK:STDERR: fail_final_extend_impl_outside_class.carbon:[[@LINE+4]]:1: error: `extend impl` can only be used in an interface or class [ExtendImplOutsideClass] -// CHECK:STDERR: extend final impl C as Z {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_final_extend_impl_outside_class.carbon:[[@LINE+2]]:1-26: error: `extend impl` can only be used in an interface or class [ExtendImplOutsideClass] // CHECK:STDERR: extend final impl C as Z {} diff --git a/toolchain/check/testdata/impl/extend_impl.carbon b/toolchain/check/testdata/impl/extend_impl.carbon index cee4d6635c23..1e673bc2d9d5 100644 --- a/toolchain/check/testdata/impl/extend_impl.carbon +++ b/toolchain/check/testdata/impl/extend_impl.carbon @@ -38,9 +38,7 @@ library "[[@TEST_NAME]]"; interface I {} class C { - // CHECK:STDERR: fail_extend_impl_nonexistent.carbon:[[@LINE+4]]:15: error: name `nonexistent` not found [NameNotFound] - // CHECK:STDERR: extend impl nonexistent as I {} - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_extend_impl_nonexistent.carbon:[[@LINE+2]]:15-25: error: name `nonexistent` not found [NameNotFound] // CHECK:STDERR: extend impl nonexistent as I {} @@ -59,17 +57,13 @@ library "[[@TEST_NAME]]"; interface I {} class C { - // CHECK:STDERR: fail_impl_nonexistent.carbon:[[@LINE+4]]:8: error: name `nonexistent` not found [NameNotFound] - // CHECK:STDERR: impl nonexistent as I {} - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_impl_nonexistent.carbon:[[@LINE+2]]:8-18: error: name `nonexistent` not found [NameNotFound] // CHECK:STDERR: impl nonexistent as I {} fn F() { // The name lookup error still happens, since the `require` is not `extend`. - // CHECK:STDERR: fail_impl_nonexistent.carbon:[[@LINE+4]]:5: error: member name `A` not found in `C` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: Self.A; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_impl_nonexistent.carbon:[[@LINE+2]]:5-10: error: member name `A` not found in `C` [MemberNameNotFoundInInstScope] // CHECK:STDERR: Self.A; } @@ -82,9 +76,7 @@ library "[[@TEST_NAME]]"; interface I {} class C { - // CHECK:STDERR: fail_extend_impl_nonexistent_pointer.carbon:[[@LINE+4]]:15: error: name `nonexistent` not found [NameNotFound] - // CHECK:STDERR: extend impl nonexistent* as I {} - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_extend_impl_nonexistent_pointer.carbon:[[@LINE+2]]:15-25: error: name `nonexistent` not found [NameNotFound] // CHECK:STDERR: extend impl nonexistent* as I {} @@ -101,9 +93,7 @@ class C { library "[[@TEST_NAME]]"; interface I {} -// CHECK:STDERR: fail_extend_impl_nonexistent_outside_class.carbon:[[@LINE+4]]:13: error: name `nonexistent` not found [NameNotFound] -// CHECK:STDERR: extend impl nonexistent* as I {} -// CHECK:STDERR: ^~~~~~~~~~~ +// CHECK:STDERR: fail_extend_impl_nonexistent_outside_class.carbon:[[@LINE+2]]:13-23: error: name `nonexistent` not found [NameNotFound] // CHECK:STDERR: extend impl nonexistent* as I {} diff --git a/toolchain/check/testdata/impl/fail_alias.carbon b/toolchain/check/testdata/impl/fail_alias.carbon index 47fe3eb6232d..dd3aa122ba2f 100644 --- a/toolchain/check/testdata/impl/fail_alias.carbon +++ b/toolchain/check/testdata/impl/fail_alias.carbon @@ -20,12 +20,8 @@ alias AC = C; impl AC as AI {} -// CHECK:STDERR: fail_alias.carbon:[[@LINE+7]]:1: error: redefinition of `impl AC as AI` [ImplRedefinition] -// CHECK:STDERR: impl AC as AI {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_alias.carbon:[[@LINE-5]]:1: note: previous definition was here [ImplPreviousDefinition] -// CHECK:STDERR: impl AC as AI {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_alias.carbon:[[@LINE+3]]:1-15: error: redefinition of `impl AC as AI` [ImplRedefinition] +// CHECK:STDERR: fail_alias.carbon:[[@LINE-3]]:1-15: note: previous definition was here [ImplPreviousDefinition] // CHECK:STDERR: impl AC as AI {} @@ -65,7 +61,7 @@ impl AC as AI {} // CHECK:STDOUT: %AC.ref: type = name_ref AC, file.%AC [concrete = constants.%C] // CHECK:STDOUT: %AI.ref: type = name_ref AI, file.%AI [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc30: = impl_self_witness @C.as.I.impl.e103db.2.%AC.ref, @I [concrete = constants.%.b7f] +// CHECK:STDOUT: %.loc26: = impl_self_witness @C.as.I.impl.e103db.2.%AC.ref, @I [concrete = constants.%.b7f] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { diff --git a/toolchain/check/testdata/impl/fail_call_invalid.carbon b/toolchain/check/testdata/impl/fail_call_invalid.carbon index 6d67d6c79e5b..da930a2f5075 100644 --- a/toolchain/check/testdata/impl/fail_call_invalid.carbon +++ b/toolchain/check/testdata/impl/fail_call_invalid.carbon @@ -17,9 +17,7 @@ interface Simple { } impl i32 as Simple { - // CHECK:STDERR: fail_call_invalid.carbon:[[@LINE+4]]:14: error: name `Undeclared` not found [NameNotFound] - // CHECK:STDERR: fn G(self: Undeclared); - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_call_invalid.carbon:[[@LINE+2]]:14-23: error: name `Undeclared` not found [NameNotFound] // CHECK:STDERR: fn G(self: Undeclared); } @@ -50,7 +48,7 @@ fn InstanceCall(n: i32) { // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] // CHECK:STDOUT: %.b0e: = impl_self_witness %i32, @Simple [concrete] // CHECK:STDOUT: %Simple.impl_witness: = impl_witness @i32.as.Simple.impl.%Simple.impl_witness_table [concrete] -// CHECK:STDOUT: %i32.as.Simple.impl.G.type.321a2c.1: type = fn_type @i32.as.Simple.impl.G.loc24_25.1 [concrete] +// CHECK:STDOUT: %i32.as.Simple.impl.G.type.321a2c.1: type = fn_type @i32.as.Simple.impl.G.loc22_25.1 [concrete] // CHECK:STDOUT: %i32.as.Simple.impl.G.d407b2.1: %i32.as.Simple.impl.G.type.321a2c.1 = struct_value () [concrete] // CHECK:STDOUT: %Simple.facet: %Simple.type = facet_value %i32, (%Simple.impl_witness) [concrete] // CHECK:STDOUT: %Simple.WithSelf.G.type.34c: type = fn_type @Simple.WithSelf.G, @Simple.WithSelf(%Simple.facet) [concrete] @@ -58,7 +56,7 @@ fn InstanceCall(n: i32) { // CHECK:STDOUT: %pattern_type.d94: type = pattern_type %i32 [concrete] // CHECK:STDOUT: %self.param_patt.f52: %pattern_type.d94 = value_param_pattern [concrete] // CHECK:STDOUT: %self.patt.835: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt.f52 [concrete] -// CHECK:STDOUT: %i32.as.Simple.impl.G.type.321a2c.2: type = fn_type @i32.as.Simple.impl.G.loc24_25.2 [concrete] +// CHECK:STDOUT: %i32.as.Simple.impl.G.type.321a2c.2: type = fn_type @i32.as.Simple.impl.G.loc22_25.2 [concrete] // CHECK:STDOUT: %i32.as.Simple.impl.G.d407b2.2: %i32.as.Simple.impl.G.type.321a2c.2 = struct_value () [concrete] // CHECK:STDOUT: %n.param_patt: %pattern_type.d94 = value_param_pattern [concrete] // CHECK:STDOUT: %n.patt: %pattern_type.d94 = wrapper_binding_pattern n, %n.param_patt [concrete] @@ -129,7 +127,7 @@ fn InstanceCall(n: i32) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @i32.as.Simple.impl: %i32 as %Simple.ref { -// CHECK:STDOUT: %i32.as.Simple.impl.G.decl.loc24_25.1: %i32.as.Simple.impl.G.type.321a2c.1 = fn_decl @i32.as.Simple.impl.G.loc24_25.1 [concrete = constants.%i32.as.Simple.impl.G.d407b2.1] { +// CHECK:STDOUT: %i32.as.Simple.impl.G.decl.loc22_25.1: %i32.as.Simple.impl.G.type.321a2c.1 = fn_decl @i32.as.Simple.impl.G.loc22_25.1 [concrete = constants.%i32.as.Simple.impl.G.d407b2.1] { // CHECK:STDOUT: %self.param_patt: = value_param_pattern [concrete = ] // CHECK:STDOUT: %self.patt: = wrapper_binding_pattern self, %self.param_patt [concrete = ] // CHECK:STDOUT: } { @@ -137,19 +135,19 @@ fn InstanceCall(n: i32) { // CHECK:STDOUT: %Undeclared.ref: = name_ref Undeclared, [concrete = ] // CHECK:STDOUT: %self: = wrapper_binding self, [concrete = ] // CHECK:STDOUT: } -// CHECK:STDOUT: %i32.as.Simple.impl.G.decl.loc24_25.2: %i32.as.Simple.impl.G.type.321a2c.2 = fn_decl @i32.as.Simple.impl.G.loc24_25.2 [concrete = constants.%i32.as.Simple.impl.G.d407b2.2] { +// CHECK:STDOUT: %i32.as.Simple.impl.G.decl.loc22_25.2: %i32.as.Simple.impl.G.type.321a2c.2 = fn_decl @i32.as.Simple.impl.G.loc22_25.2 [concrete = constants.%i32.as.Simple.impl.G.d407b2.2] { // CHECK:STDOUT: %.1: %pattern_type.d94 = specific_constant constants.%self.param_patt.f52, @Simple.WithSelf.G(constants.%Simple.facet) [concrete = constants.%self.param_patt.f52] // CHECK:STDOUT: %self.patt: %pattern_type.d94 = wrapper_binding_pattern self, %.1 [concrete = constants.%self.patt.835] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: %i32 = value_param call_param0 // CHECK:STDOUT: %self: %i32 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Simple.impl_witness_table = impl_witness_table (%i32.as.Simple.impl.G.decl.loc24_25.2), @i32.as.Simple.impl [concrete] +// CHECK:STDOUT: %Simple.impl_witness_table = impl_witness_table (%i32.as.Simple.impl.G.decl.loc22_25.2), @i32.as.Simple.impl [concrete] // CHECK:STDOUT: %Simple.impl_witness: = impl_witness %Simple.impl_witness_table [concrete = constants.%Simple.impl_witness] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Undeclared = -// CHECK:STDOUT: .G = %i32.as.Simple.impl.G.decl.loc24_25.1 +// CHECK:STDOUT: .G = %i32.as.Simple.impl.G.decl.loc22_25.1 // CHECK:STDOUT: extend %Simple.ref // CHECK:STDOUT: witness = %Simple.impl_witness // CHECK:STDOUT: } @@ -164,11 +162,11 @@ fn InstanceCall(n: i32) { // CHECK:STDOUT: fn(%self.param: @Simple.WithSelf.G.%Self.as_type.loc16_8.1 (%Self.as_type)); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @i32.as.Simple.impl.G.loc24_25.1(%self.param: ); +// CHECK:STDOUT: fn @i32.as.Simple.impl.G.loc22_25.1(%self.param: ); // CHECK:STDOUT: -// CHECK:STDOUT: fn @i32.as.Simple.impl.G.loc24_25.2(%self.param: %i32) [thunk @i32.as.Simple.impl.%i32.as.Simple.impl.G.decl.loc24_25.1 for @Simple.WithSelf.%Simple.WithSelf.G.decl, @Simple.WithSelf.G(constants.%Simple.facet)] { +// CHECK:STDOUT: fn @i32.as.Simple.impl.G.loc22_25.2(%self.param: %i32) [thunk @i32.as.Simple.impl.%i32.as.Simple.impl.G.decl.loc22_25.1 for @Simple.WithSelf.%Simple.WithSelf.G.decl, @Simple.WithSelf.G(constants.%Simple.facet)] { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %G.ref: %i32.as.Simple.impl.G.type.321a2c.1 = name_ref G, @i32.as.Simple.impl.%i32.as.Simple.impl.G.decl.loc24_25.1 [concrete = constants.%i32.as.Simple.impl.G.d407b2.1] +// CHECK:STDOUT: %G.ref: %i32.as.Simple.impl.G.type.321a2c.1 = name_ref G, @i32.as.Simple.impl.%i32.as.Simple.impl.G.decl.loc22_25.1 [concrete = constants.%i32.as.Simple.impl.G.d407b2.1] // CHECK:STDOUT: %i32.as.Simple.impl.G.bound: = bound_method %self.param, %G.ref // CHECK:STDOUT: %i32.as.Simple.impl.G.call: init %empty_tuple.type = call %i32.as.Simple.impl.G.bound() // CHECK:STDOUT: return @@ -178,11 +176,11 @@ fn InstanceCall(n: i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %n.ref: %i32 = name_ref n, %n // CHECK:STDOUT: %Simple.ref: type = name_ref Simple, file.%Simple.decl [concrete = constants.%Simple.type] -// CHECK:STDOUT: %G.ref.loc28_12: %Simple.assoc_type = name_ref G, @Simple.WithSelf.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %G.ref.loc26_12: %Simple.assoc_type = name_ref G, @Simple.WithSelf.%assoc0 [concrete = constants.%assoc0] // CHECK:STDOUT: %impl.elem0: %.20e = impl_witness_access constants.%Simple.impl_witness, element0 [concrete = constants.%i32.as.Simple.impl.G.d407b2.2] // CHECK:STDOUT: %bound_method: = bound_method %n.ref, %impl.elem0 -// CHECK:STDOUT: %G.ref.loc28_16: %i32.as.Simple.impl.G.type.321a2c.1 = name_ref G, @i32.as.Simple.impl.%i32.as.Simple.impl.G.decl.loc24_25.1 [concrete = constants.%i32.as.Simple.impl.G.d407b2.1] -// CHECK:STDOUT: %i32.as.Simple.impl.G.bound: = bound_method %n.ref, %G.ref.loc28_16 +// CHECK:STDOUT: %G.ref.loc26_16: %i32.as.Simple.impl.G.type.321a2c.1 = name_ref G, @i32.as.Simple.impl.%i32.as.Simple.impl.G.decl.loc22_25.1 [concrete = constants.%i32.as.Simple.impl.G.d407b2.1] +// CHECK:STDOUT: %i32.as.Simple.impl.G.bound: = bound_method %n.ref, %G.ref.loc26_16 // CHECK:STDOUT: %i32.as.Simple.impl.G.call: init %empty_tuple.type = call %i32.as.Simple.impl.G.bound() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/impl/fail_extend_impl_forall.carbon b/toolchain/check/testdata/impl/fail_extend_impl_forall.carbon index 0199edd5da8b..9043bdd381a8 100644 --- a/toolchain/check/testdata/impl/fail_extend_impl_forall.carbon +++ b/toolchain/check/testdata/impl/fail_extend_impl_forall.carbon @@ -17,9 +17,7 @@ interface GenericInterface(T: type) { } class C { - // CHECK:STDERR: fail_extend_impl_forall.carbon:[[@LINE+4]]:3: error: cannot `extend` a parameterized `impl` [ExtendImplForall] - // CHECK:STDERR: extend impl forall [T: type] as GenericInterface(T) { - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_extend_impl_forall.carbon:[[@LINE+2]]:3-8: error: cannot `extend` a parameterized `impl` [ExtendImplForall] // CHECK:STDERR: extend impl forall [T: type] as GenericInterface(T) { fn F(unused x: T) {} @@ -109,55 +107,55 @@ class C { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @C.as.GenericInterface.impl(%T.loc24_24.2: type) { -// CHECK:STDOUT: %T.patt.loc24_24.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc24_24.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc24_24.1: type = symbolic_binding T, 0 [symbolic = %T.loc24_24.1 (constants.%T)] -// CHECK:STDOUT: %GenericInterface.type.loc24_53.1: type = facet_type <@GenericInterface, @GenericInterface(%T.loc24_24.1)> [symbolic = %GenericInterface.type.loc24_53.1 (constants.%GenericInterface.type.076)] -// CHECK:STDOUT: %.loc24_55: = impl_self_witness constants.%C, @GenericInterface, @GenericInterface(%T.loc24_24.1) [symbolic = %.loc24_55 (constants.%.c61)] -// CHECK:STDOUT: %GenericInterface.impl_witness.loc24_55.2: = impl_witness %GenericInterface.impl_witness_table, @C.as.GenericInterface.impl(%T.loc24_24.1) [symbolic = %GenericInterface.impl_witness.loc24_55.2 (constants.%GenericInterface.impl_witness)] +// CHECK:STDOUT: generic impl @C.as.GenericInterface.impl(%T.loc22_24.2: type) { +// CHECK:STDOUT: %T.patt.loc22_24.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc22_24.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc22_24.1: type = symbolic_binding T, 0 [symbolic = %T.loc22_24.1 (constants.%T)] +// CHECK:STDOUT: %GenericInterface.type.loc22_53.1: type = facet_type <@GenericInterface, @GenericInterface(%T.loc22_24.1)> [symbolic = %GenericInterface.type.loc22_53.1 (constants.%GenericInterface.type.076)] +// CHECK:STDOUT: %.loc22_55: = impl_self_witness constants.%C, @GenericInterface, @GenericInterface(%T.loc22_24.1) [symbolic = %.loc22_55 (constants.%.c61)] +// CHECK:STDOUT: %GenericInterface.impl_witness.loc22_55.2: = impl_witness %GenericInterface.impl_witness_table, @C.as.GenericInterface.impl(%T.loc22_24.1) [symbolic = %GenericInterface.impl_witness.loc22_55.2 (constants.%GenericInterface.impl_witness)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %C.as.GenericInterface.impl.F.type: type = fn_type @C.as.GenericInterface.impl.F, @C.as.GenericInterface.impl(%T.loc24_24.1) [symbolic = %C.as.GenericInterface.impl.F.type (constants.%C.as.GenericInterface.impl.F.type)] +// CHECK:STDOUT: %C.as.GenericInterface.impl.F.type: type = fn_type @C.as.GenericInterface.impl.F, @C.as.GenericInterface.impl(%T.loc22_24.1) [symbolic = %C.as.GenericInterface.impl.F.type (constants.%C.as.GenericInterface.impl.F.type)] // CHECK:STDOUT: %C.as.GenericInterface.impl.F: @C.as.GenericInterface.impl.%C.as.GenericInterface.impl.F.type (%C.as.GenericInterface.impl.F.type) = struct_value () [symbolic = %C.as.GenericInterface.impl.F (constants.%C.as.GenericInterface.impl.F)] // CHECK:STDOUT: -// CHECK:STDOUT: impl: %Self.ref as %GenericInterface.type.loc24_53.2 { +// CHECK:STDOUT: impl: %Self.ref as %GenericInterface.type.loc22_53.2 { // CHECK:STDOUT: %C.as.GenericInterface.impl.F.decl: @C.as.GenericInterface.impl.%C.as.GenericInterface.impl.F.type (%C.as.GenericInterface.impl.F.type) = fn_decl @C.as.GenericInterface.impl.F [symbolic = @C.as.GenericInterface.impl.%C.as.GenericInterface.impl.F (constants.%C.as.GenericInterface.impl.F)] { -// CHECK:STDOUT: %x.param_patt.loc25_18.1: @C.as.GenericInterface.impl.F.%pattern_type (%pattern_type.51d) = value_param_pattern [symbolic = %x.param_patt.loc25_18.2 (constants.%x.param_patt)] -// CHECK:STDOUT: %x.patt.loc25_18.1: @C.as.GenericInterface.impl.F.%pattern_type (%pattern_type.51d) = wrapper_binding_pattern x, %x.param_patt.loc25_18.1 [symbolic = %x.patt.loc25_18.2 (constants.%x.patt)] +// CHECK:STDOUT: %x.param_patt.loc23_18.1: @C.as.GenericInterface.impl.F.%pattern_type (%pattern_type.51d) = value_param_pattern [symbolic = %x.param_patt.loc23_18.2 (constants.%x.param_patt)] +// CHECK:STDOUT: %x.patt.loc23_18.1: @C.as.GenericInterface.impl.F.%pattern_type (%pattern_type.51d) = wrapper_binding_pattern x, %x.param_patt.loc23_18.1 [symbolic = %x.patt.loc23_18.2 (constants.%x.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %x.param: @C.as.GenericInterface.impl.F.%T (%T) = value_param call_param0 -// CHECK:STDOUT: %.loc25_20.1: type = splice_block %T.ref [symbolic = %T (constants.%T)] { -// CHECK:STDOUT: %.loc25_20.2: type = specific_constant @C.as.GenericInterface.impl.%T.loc24_24.2, @C.as.GenericInterface.impl(constants.%T) [symbolic = %T (constants.%T)] -// CHECK:STDOUT: %T.ref: type = name_ref T, %.loc25_20.2 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %.loc23_20.1: type = splice_block %T.ref [symbolic = %T (constants.%T)] { +// CHECK:STDOUT: %.loc23_20.2: type = specific_constant @C.as.GenericInterface.impl.%T.loc22_24.2, @C.as.GenericInterface.impl(constants.%T) [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %T.ref: type = name_ref T, %.loc23_20.2 [symbolic = %T (constants.%T)] // CHECK:STDOUT: } // CHECK:STDOUT: %x: @C.as.GenericInterface.impl.F.%T (%T) = wrapper_binding x, %x.param // CHECK:STDOUT: } // CHECK:STDOUT: %GenericInterface.impl_witness_table = impl_witness_table (), @C.as.GenericInterface.impl [concrete] -// CHECK:STDOUT: %GenericInterface.impl_witness.loc24_55.1: = impl_witness %GenericInterface.impl_witness_table, @C.as.GenericInterface.impl(constants.%T) [symbolic = %GenericInterface.impl_witness.loc24_55.2 (constants.%GenericInterface.impl_witness)] +// CHECK:STDOUT: %GenericInterface.impl_witness.loc22_55.1: = impl_witness %GenericInterface.impl_witness_table, @C.as.GenericInterface.impl(constants.%T) [symbolic = %GenericInterface.impl_witness.loc22_55.2 (constants.%GenericInterface.impl_witness)] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .T = // CHECK:STDOUT: .F = %C.as.GenericInterface.impl.F.decl -// CHECK:STDOUT: extend %GenericInterface.type.loc24_53.2 +// CHECK:STDOUT: extend %GenericInterface.type.loc22_53.2 // CHECK:STDOUT: witness = // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { // CHECK:STDOUT: impl_decl @C.as.GenericInterface.impl [concrete] { -// CHECK:STDOUT: %T.patt.loc24_24.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc24_24.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc22_24.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc22_24.2 (constants.%T.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [concrete = constants.%C] // CHECK:STDOUT: %GenericInterface.ref: %GenericInterface.type.26e = name_ref GenericInterface, file.%GenericInterface.decl [concrete = constants.%GenericInterface.generic] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc24_24.2 [symbolic = %T.loc24_24.1 (constants.%T)] -// CHECK:STDOUT: %GenericInterface.type.loc24_53.2: type = facet_type <@GenericInterface, @GenericInterface(constants.%T)> [symbolic = %GenericInterface.type.loc24_53.1 (constants.%GenericInterface.type.076)] -// CHECK:STDOUT: %.loc24_26.1: type = splice_block %.loc24_26.2 [concrete = type] { +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc22_24.2 [symbolic = %T.loc22_24.1 (constants.%T)] +// CHECK:STDOUT: %GenericInterface.type.loc22_53.2: type = facet_type <@GenericInterface, @GenericInterface(constants.%T)> [symbolic = %GenericInterface.type.loc22_53.1 (constants.%GenericInterface.type.076)] +// CHECK:STDOUT: %.loc22_26.1: type = splice_block %.loc22_26.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc24_26.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc22_26.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc24_24.2: type = symbolic_binding T, 0 [symbolic = %T.loc24_24.1 (constants.%T)] +// CHECK:STDOUT: %T.loc22_24.2: type = symbolic_binding T, 0 [symbolic = %T.loc22_24.1 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc24: = impl_self_witness @C.as.GenericInterface.impl.%Self.ref, @GenericInterface, @GenericInterface(constants.%T) [symbolic = @C.as.GenericInterface.impl.%.loc24_55 (constants.%.c61)] +// CHECK:STDOUT: %.loc22: = impl_self_witness @C.as.GenericInterface.impl.%Self.ref, @GenericInterface, @GenericInterface(constants.%T) [symbolic = @C.as.GenericInterface.impl.%.loc22_55 (constants.%.c61)] // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: @@ -176,11 +174,11 @@ class C { // CHECK:STDOUT: fn(%x.param: @GenericInterface.WithSelf.F.%T (%T)); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @C.as.GenericInterface.impl.F(@C.as.GenericInterface.impl.%T.loc24_24.2: type) { +// CHECK:STDOUT: generic fn @C.as.GenericInterface.impl.F(@C.as.GenericInterface.impl.%T.loc22_24.2: type) { // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic = %T (constants.%T)] // CHECK:STDOUT: %pattern_type: type = pattern_type %T [symbolic = %pattern_type (constants.%pattern_type.51d)] -// CHECK:STDOUT: %x.param_patt.loc25_18.2: @C.as.GenericInterface.impl.F.%pattern_type (%pattern_type.51d) = value_param_pattern [symbolic = %x.param_patt.loc25_18.2 (constants.%x.param_patt)] -// CHECK:STDOUT: %x.patt.loc25_18.2: @C.as.GenericInterface.impl.F.%pattern_type (%pattern_type.51d) = wrapper_binding_pattern x, %x.param_patt.loc25_18.2 [symbolic = %x.patt.loc25_18.2 (constants.%x.patt)] +// CHECK:STDOUT: %x.param_patt.loc23_18.2: @C.as.GenericInterface.impl.F.%pattern_type (%pattern_type.51d) = value_param_pattern [symbolic = %x.param_patt.loc23_18.2 (constants.%x.param_patt)] +// CHECK:STDOUT: %x.patt.loc23_18.2: @C.as.GenericInterface.impl.F.%pattern_type (%pattern_type.51d) = wrapper_binding_pattern x, %x.param_patt.loc23_18.2 [symbolic = %x.patt.loc23_18.2 (constants.%x.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete: = require_complete_type %T [symbolic = %require_complete (constants.%require_complete)] @@ -215,11 +213,11 @@ class C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @C.as.GenericInterface.impl(constants.%T) { -// CHECK:STDOUT: %T.patt.loc24_24.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc24_24.1 => constants.%T -// CHECK:STDOUT: %GenericInterface.type.loc24_53.1 => constants.%GenericInterface.type.076 -// CHECK:STDOUT: %.loc24_55 => constants.%.c61 -// CHECK:STDOUT: %GenericInterface.impl_witness.loc24_55.2 => constants.%GenericInterface.impl_witness +// CHECK:STDOUT: %T.patt.loc22_24.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc22_24.1 => constants.%T +// CHECK:STDOUT: %GenericInterface.type.loc22_53.1 => constants.%GenericInterface.type.076 +// CHECK:STDOUT: %.loc22_55 => constants.%.c61 +// CHECK:STDOUT: %GenericInterface.impl_witness.loc22_55.2 => constants.%GenericInterface.impl_witness // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %C.as.GenericInterface.impl.F.type => constants.%C.as.GenericInterface.impl.F.type @@ -229,7 +227,7 @@ class C { // CHECK:STDOUT: specific @C.as.GenericInterface.impl.F(constants.%T) { // CHECK:STDOUT: %T => constants.%T // CHECK:STDOUT: %pattern_type => constants.%pattern_type.51d -// CHECK:STDOUT: %x.param_patt.loc25_18.2 => constants.%x.param_patt -// CHECK:STDOUT: %x.patt.loc25_18.2 => constants.%x.patt +// CHECK:STDOUT: %x.param_patt.loc23_18.2 => constants.%x.param_patt +// CHECK:STDOUT: %x.patt.loc23_18.2 => constants.%x.patt // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_extend_impl_scope.carbon b/toolchain/check/testdata/impl/fail_extend_impl_scope.carbon index b98991869dc7..01352c93ed69 100644 --- a/toolchain/check/testdata/impl/fail_extend_impl_scope.carbon +++ b/toolchain/check/testdata/impl/fail_extend_impl_scope.carbon @@ -17,9 +17,7 @@ library "[[@TEST_NAME]]"; interface I {} -// CHECK:STDERR: fail_extend_impl_file_scope.carbon:[[@LINE+4]]:1: error: `extend impl` can only be used in an interface or class [ExtendImplOutsideClass] -// CHECK:STDERR: extend impl () as I {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_extend_impl_file_scope.carbon:[[@LINE+2]]:1-21: error: `extend impl` can only be used in an interface or class [ExtendImplOutsideClass] // CHECK:STDERR: extend impl () as I {} @@ -29,9 +27,7 @@ library "[[@TEST_NAME]]"; interface J {} fn F() { - // CHECK:STDERR: fail_extend_impl_function_scope.carbon:[[@LINE+4]]:3: error: `extend impl` can only be used in an interface or class [ExtendImplOutsideClass] - // CHECK:STDERR: extend impl {} as J {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_extend_impl_function_scope.carbon:[[@LINE+2]]:3-23: error: `extend impl` can only be used in an interface or class [ExtendImplOutsideClass] // CHECK:STDERR: extend impl {} as J {} } @@ -42,9 +38,7 @@ library "[[@TEST_NAME]]"; interface Z { fn Zero(); - // CHECK:STDERR: fail_extend_impl_self_interface.carbon:[[@LINE+4]]:15: error: `impl as` can only be used in a class [ImplAsOutsideClass] - // CHECK:STDERR: extend impl as Z { - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_extend_impl_self_interface.carbon:[[@LINE+2]]:15-16: error: `impl as` can only be used in a class [ImplAsOutsideClass] // CHECK:STDERR: extend impl as Z { fn Zero() {} @@ -91,11 +85,11 @@ fn F() { // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {} // CHECK:STDOUT: impl_decl @empty_tuple.type.as.I.impl [concrete] {} { -// CHECK:STDOUT: %.loc9_14.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc9_14.2: type = converted %.loc9_14.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc7_14.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc7_14.2: type = converted %.loc7_14.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc9: = impl_self_witness @empty_tuple.type.as.I.impl.%.loc9_14.2, @I [concrete = constants.%.2ef] +// CHECK:STDOUT: %.loc7: = impl_self_witness @empty_tuple.type.as.I.impl.%.loc7_14.2, @I [concrete = constants.%.2ef] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { @@ -109,7 +103,7 @@ fn F() { // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_tuple.type.as.I.impl: %.loc9_14.2 as %I.ref { +// CHECK:STDOUT: impl @empty_tuple.type.as.I.impl: %.loc7_14.2 as %I.ref { // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (), @empty_tuple.type.as.I.impl [concrete] // CHECK:STDOUT: %I.impl_witness: = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness] // CHECK:STDOUT: @@ -163,7 +157,7 @@ fn F() { // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_struct_type.as.J.impl: %.loc10_16.2 as %J.ref { +// CHECK:STDOUT: impl @empty_struct_type.as.J.impl: %.loc8_16.2 as %J.ref { // CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (), @empty_struct_type.as.J.impl [concrete] // CHECK:STDOUT: %J.impl_witness: = impl_witness %J.impl_witness_table [concrete = constants.%J.impl_witness] // CHECK:STDOUT: @@ -175,11 +169,11 @@ fn F() { // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: impl_decl @empty_struct_type.as.J.impl [concrete] {} { -// CHECK:STDOUT: %.loc10_16.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc10_16.2: type = converted %.loc10_16.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc8_16.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc8_16.2: type = converted %.loc8_16.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10: = impl_self_witness @empty_struct_type.as.J.impl.%.loc10_16.2, @J [concrete = constants.%.948] +// CHECK:STDOUT: %.loc8: = impl_self_witness @empty_struct_type.as.J.impl.%.loc8_16.2, @J [concrete = constants.%.948] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -220,18 +214,18 @@ fn F() { // CHECK:STDOUT: %pattern_type.a96: type = pattern_type %empty_struct_type [concrete] // CHECK:STDOUT: %self.param_patt.52f: %pattern_type.a96 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.4b1: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt.52f [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc25_7.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc23_7.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc25_7.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc23_7.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.1: %Destroy.WithSelf.Op.type.ef016f.1 = struct_value () [concrete] // CHECK:STDOUT: %pattern_type.9d8: type = pattern_type %Point [concrete] // CHECK:STDOUT: %self.param_patt.e02: %pattern_type.9d8 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.8c1: %pattern_type.9d8 = wrapper_binding_pattern self, %self.param_patt.e02 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc25_7.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc23_7.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc25_7.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc23_7.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.2: %Destroy.WithSelf.Op.type.ef016f.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc25_7.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc23_7.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.2: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2 = struct_value () [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.e6b, %Destroy.WithSelf.SelfDestruct.db3fdb.2 [concrete] // CHECK:STDOUT: } @@ -246,28 +240,28 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc25_7.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc23_7.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.a96 = ref_param_pattern [concrete = constants.%self.param_patt.52f] // CHECK:STDOUT: %self.patt: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.4b1] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %empty_struct_type = ref_param call_param0 // CHECK:STDOUT: %self: ref %empty_struct_type = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc25_7.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc23_7.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.a96 = ref_param_pattern [concrete = constants.%self.param_patt.52f] // CHECK:STDOUT: %self.patt: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.4b1] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %empty_struct_type = ref_param call_param0 // CHECK:STDOUT: %self: ref %empty_struct_type = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc25_7.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc23_7.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.9d8 = ref_param_pattern [concrete = constants.%self.param_patt.e02] // CHECK:STDOUT: %self.patt: %pattern_type.9d8 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.8c1] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %Point = ref_param call_param0 // CHECK:STDOUT: %self: ref %Point = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc25_7.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc23_7.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.9d8 = ref_param_pattern [concrete = constants.%self.param_patt.e02] // CHECK:STDOUT: %self.patt: %pattern_type.9d8 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.8c1] // CHECK:STDOUT: } { @@ -299,7 +293,7 @@ fn F() { // CHECK:STDOUT: impl_decl @.as.Z.impl [concrete] {} { // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10: = impl_self_witness , @Z [concrete = ] +// CHECK:STDOUT: %.loc8: = impl_self_witness , @Z [concrete = ] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self @@ -343,7 +337,7 @@ fn F() { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Point [concrete = constants.%Point] // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc16: = impl_self_witness @Point.as.Z.impl.%Self.ref, @Z [concrete = constants.%.354] +// CHECK:STDOUT: %.loc14: = impl_self_witness @Point.as.Z.impl.%Self.ref, @Z [concrete = constants.%.354] // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: @@ -374,12 +368,12 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc25_5.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc23_5.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: %Point.ref: type = name_ref Point, file.%Point.decl [concrete = constants.%Point] -// CHECK:STDOUT: %.loc25_5.2: ref %Point = temporary_storage -// CHECK:STDOUT: %.loc25_5.3: init %Point to %.loc25_5.2 = class_init () [concrete = constants.%Point.val] -// CHECK:STDOUT: %.loc25_7.1: init %Point = converted %.loc25_5.1, %.loc25_5.3 [concrete = constants.%Point.val] -// CHECK:STDOUT: %.loc25_7.2: ref %Point = temporary %.loc25_5.2, %.loc25_7.1 [concrete = constants.%.e6b] +// CHECK:STDOUT: %.loc23_5.2: ref %Point = temporary_storage +// CHECK:STDOUT: %.loc23_5.3: init %Point to %.loc23_5.2 = class_init () [concrete = constants.%Point.val] +// CHECK:STDOUT: %.loc23_7.1: init %Point = converted %.loc23_5.1, %.loc23_5.3 [concrete = constants.%Point.val] +// CHECK:STDOUT: %.loc23_7.2: ref %Point = temporary %.loc23_5.2, %.loc23_7.1 [concrete = constants.%.e6b] // CHECK:STDOUT: %Zero.ref: %Z.assoc_type = name_ref Zero, @Z.WithSelf.%assoc0 [concrete = constants.%assoc0] // CHECK:STDOUT: %impl.elem0: %.075 = impl_witness_access constants.%Z.impl_witness, element0 [concrete = constants.%Point.as.Z.impl.Zero] // CHECK:STDOUT: %Point.as.Z.impl.Zero.call: init %empty_tuple.type = call %impl.elem0() @@ -387,22 +381,22 @@ fn F() { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc25_7.1(%self.param: ref %empty_struct_type) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc23_7.1(%self.param: ref %empty_struct_type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc25_7.1(%self.param: ref %empty_struct_type) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc23_7.1(%self.param: ref %empty_struct_type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc25_7.1(%self.param: ref %empty_struct_type) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc23_7.1(%self.param: ref %empty_struct_type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.1(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.1(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc25_7.2(%self.param: ref %Point) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc23_7.2(%self.param: ref %Point) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc25_7.2(%self.param: ref %Point) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc23_7.2(%self.param: ref %Point) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc25_7.2(%self.param: ref %Point) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc23_7.2(%self.param: ref %Point) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.2(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.2(%self.param) diff --git a/toolchain/check/testdata/impl/fail_extend_impl_type_as.carbon b/toolchain/check/testdata/impl/fail_extend_impl_type_as.carbon index 35dd13e93c0d..76282ecd3e9d 100644 --- a/toolchain/check/testdata/impl/fail_extend_impl_type_as.carbon +++ b/toolchain/check/testdata/impl/fail_extend_impl_type_as.carbon @@ -15,35 +15,23 @@ interface I {} class C { - // CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE+4]]:3: error: cannot `extend` an `impl` with an explicit self type [ExtendImplSelfAs] - // CHECK:STDERR: extend impl i32 as I {} - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE+2]]:3-8: error: cannot `extend` an `impl` with an explicit self type [ExtendImplSelfAs] // CHECK:STDERR: extend impl i32 as I {} } class D { - // CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE+7]]:3: error: cannot `extend` an `impl` with an explicit self type [ExtendImplSelfAs] - // CHECK:STDERR: extend impl D as I; - // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE+4]]:15: note: remove the explicit `Self` type here [ExtendImplSelfAsDefault] - // CHECK:STDERR: extend impl D as I; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE+3]]:3-8: error: cannot `extend` an `impl` with an explicit self type [ExtendImplSelfAs] + // CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE+2]]:15: note: remove the explicit `Self` type here [ExtendImplSelfAsDefault] // CHECK:STDERR: extend impl D as I; } class E { - // CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE+11]]:3: error: cannot `extend` an `impl` with an explicit self type [ExtendImplSelfAs] - // CHECK:STDERR: extend impl Self as I {} - // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE+8]]:15: note: remove the explicit `Self` type here [ExtendImplSelfAsDefault] - // CHECK:STDERR: extend impl Self as I {} - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE+5]]:3-8: error: cannot `extend` an `impl` with an explicit self type [ExtendImplSelfAs] + // CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE+4]]:15-18: note: remove the explicit `Self` type here [ExtendImplSelfAsDefault] // CHECK:STDERR: - // CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE-11]]:3: error: impl declared but not defined [ImplMissingDefinition] - // CHECK:STDERR: extend impl D as I; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE-7]]:3-21: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: extend impl Self as I {} } @@ -126,7 +114,7 @@ class E { // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc22: = impl_self_witness , @I [concrete = ] +// CHECK:STDOUT: %.loc20: = impl_self_witness , @I [concrete = ] // 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: @@ -141,7 +129,7 @@ class E { // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [concrete = constants.%D] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc33: = impl_self_witness @D.as.I.impl.%D.ref, @I [concrete = constants.%.393] +// CHECK:STDOUT: %.loc27: = impl_self_witness @D.as.I.impl.%D.ref, @I [concrete = constants.%.393] // 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: @@ -157,7 +145,7 @@ class E { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%E [concrete = constants.%E] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc48: = impl_self_witness @E.as.I.impl.%Self.ref, @I [concrete = constants.%.e0d] +// CHECK:STDOUT: %.loc36: = impl_self_witness @E.as.I.impl.%Self.ref, @I [concrete = constants.%.e0d] // 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: diff --git a/toolchain/check/testdata/impl/fail_extend_non_interface.carbon b/toolchain/check/testdata/impl/fail_extend_non_interface.carbon index 182680d24035..1055512479cd 100644 --- a/toolchain/check/testdata/impl/fail_extend_non_interface.carbon +++ b/toolchain/check/testdata/impl/fail_extend_non_interface.carbon @@ -13,9 +13,7 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/fail_extend_non_interface.carbon class C { - // CHECK:STDERR: fail_extend_non_interface.carbon:[[@LINE+4]]:3: error: impl as non-facet type `i32` [ImplAsNonFacetType] - // CHECK:STDERR: extend impl as i32; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_extend_non_interface.carbon:[[@LINE+2]]:3-21: error: impl as non-facet type `i32` [ImplAsNonFacetType] // CHECK:STDERR: extend impl as i32; } diff --git a/toolchain/check/testdata/impl/fail_extend_partially_defined_interface.carbon b/toolchain/check/testdata/impl/fail_extend_partially_defined_interface.carbon index 18f07dc40d29..784cfa0a5a20 100644 --- a/toolchain/check/testdata/impl/fail_extend_partially_defined_interface.carbon +++ b/toolchain/check/testdata/impl/fail_extend_partially_defined_interface.carbon @@ -14,12 +14,8 @@ interface I { class C { - // CHECK:STDERR: fail_extend_partially_defined_interface.carbon:[[@LINE+7]]:5: error: `extend impl as` incomplete facet type `I` [ExtendImplAsIncomplete] - // CHECK:STDERR: extend impl as I; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_extend_partially_defined_interface.carbon:[[@LINE-5]]:1: note: interface is currently being defined [InterfaceIncompleteWithinDefinition] - // CHECK:STDERR: interface I { - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_extend_partially_defined_interface.carbon:[[@LINE+3]]:5-21: error: `extend impl as` incomplete facet type `I` [ExtendImplAsIncomplete] + // CHECK:STDERR: fail_extend_partially_defined_interface.carbon:[[@LINE-3]]:1-13: note: interface is currently being defined [InterfaceIncompleteWithinDefinition] // CHECK:STDERR: extend impl as I; } @@ -65,8 +61,8 @@ interface I { // CHECK:STDOUT: generic impl @C.as.I.impl(@I.%Self: %I.type) { // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self)] // CHECK:STDOUT: %C: type = class_type @C, @C(%Self) [symbolic = %C (constants.%C)] -// CHECK:STDOUT: %.loc24: = impl_self_witness %C, @I [symbolic = %.loc24 (constants.%.af5)] -// CHECK:STDOUT: %I.impl_witness.loc24_21.2: = impl_witness %I.impl_witness_table, @C.as.I.impl(%Self) [symbolic = %I.impl_witness.loc24_21.2 (constants.%I.impl_witness)] +// CHECK:STDOUT: %.loc20: = impl_self_witness %C, @I [symbolic = %.loc20 (constants.%.af5)] +// CHECK:STDOUT: %I.impl_witness.loc20_21.2: = impl_witness %I.impl_witness_table, @C.as.I.impl(%Self) [symbolic = %I.impl_witness.loc20_21.2 (constants.%I.impl_witness)] // CHECK:STDOUT: // CHECK:STDOUT: impl: %Self.ref as %I.ref; // CHECK:STDOUT: } @@ -79,7 +75,7 @@ interface I { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [symbolic = %C (constants.%C)] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc24: = impl_self_witness @C.as.I.impl.%Self.ref, @I [symbolic = @C.as.I.impl.%.loc24 (constants.%.af5)] +// CHECK:STDOUT: %.loc20: = impl_self_witness @C.as.I.impl.%Self.ref, @I [symbolic = @C.as.I.impl.%.loc20 (constants.%.af5)] // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: @@ -97,7 +93,7 @@ interface I { // CHECK:STDOUT: specific @C.as.I.impl(constants.%Self) { // CHECK:STDOUT: %Self => constants.%Self // CHECK:STDOUT: %C => constants.%C -// CHECK:STDOUT: %.loc24 => constants.%.af5 -// CHECK:STDOUT: %I.impl_witness.loc24_21.2 => constants.%I.impl_witness +// CHECK:STDOUT: %.loc20 => constants.%.af5 +// CHECK:STDOUT: %I.impl_witness.loc20_21.2 => constants.%I.impl_witness // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_extend_undefined_interface.carbon b/toolchain/check/testdata/impl/fail_extend_undefined_interface.carbon index 233c97c76f30..ad91f0cad5b7 100644 --- a/toolchain/check/testdata/impl/fail_extend_undefined_interface.carbon +++ b/toolchain/check/testdata/impl/fail_extend_undefined_interface.carbon @@ -15,12 +15,8 @@ interface I; class C { - // CHECK:STDERR: fail_extend_undefined_interface.carbon:[[@LINE+7]]:3: error: `extend impl as` incomplete facet type `I` [ExtendImplAsIncomplete] - // CHECK:STDERR: extend impl as I; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_extend_undefined_interface.carbon:[[@LINE-6]]:1: note: interface was forward declared here [InterfaceForwardDeclaredHere] - // CHECK:STDERR: interface I; - // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_extend_undefined_interface.carbon:[[@LINE+3]]:3-19: error: `extend impl as` incomplete facet type `I` [ExtendImplAsIncomplete] + // CHECK:STDERR: fail_extend_undefined_interface.carbon:[[@LINE-4]]:1-12: note: interface was forward declared here [InterfaceForwardDeclaredHere] // CHECK:STDERR: extend impl as I; } @@ -59,7 +55,7 @@ fn F(c: C) { // CHECK:STDOUT: %c.patt: %pattern_type = wrapper_binding_pattern c, %c.param_patt [concrete = constants.%c.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %c.param: %C = value_param call_param0 -// CHECK:STDOUT: %C.ref.loc28: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %C.ref.loc24: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %c: %C = wrapper_binding c, %c.param // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -73,7 +69,7 @@ fn F(c: C) { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [concrete = constants.%C] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc25: = impl_self_witness @C.as.I.impl.%Self.ref, @I [concrete = constants.%.b7f] +// CHECK:STDOUT: %.loc21: = impl_self_witness @C.as.I.impl.%Self.ref, @I [concrete = constants.%.b7f] // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: @@ -86,10 +82,10 @@ fn F(c: C) { // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%c.param: %C) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %C.ref.loc29: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %F.ref.loc29: = name_ref F, [concrete = ] +// CHECK:STDOUT: %C.ref.loc25: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %F.ref.loc25: = name_ref F, [concrete = ] // CHECK:STDOUT: %c.ref: %C = name_ref c, %c -// CHECK:STDOUT: %F.ref.loc30: = name_ref F, [concrete = ] +// CHECK:STDOUT: %F.ref.loc26: = name_ref F, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_impl_as_scope.carbon b/toolchain/check/testdata/impl/fail_impl_as_scope.carbon index b5e23bb52f60..1bfeb95b688f 100644 --- a/toolchain/check/testdata/impl/fail_impl_as_scope.carbon +++ b/toolchain/check/testdata/impl/fail_impl_as_scope.carbon @@ -19,9 +19,7 @@ interface I {} fn G() {} -// CHECK:STDERR: fail_impl_as_file_scope.carbon:[[@LINE+4]]:6: error: `impl as` can only be used in a class [ImplAsOutsideClass] -// CHECK:STDERR: impl as I {} -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_impl_as_file_scope.carbon:[[@LINE+2]]:6-7: error: `impl as` can only be used in a class [ImplAsOutsideClass] // CHECK:STDERR: impl as I {} @@ -35,9 +33,7 @@ interface J {} fn G() {} fn F() { - // CHECK:STDERR: fail_impl_as_function_scope.carbon:[[@LINE+4]]:8: error: `impl as` can only be used in a class [ImplAsOutsideClass] - // CHECK:STDERR: impl as J {} - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_impl_as_function_scope.carbon:[[@LINE+2]]:8-9: error: `impl as` can only be used in a class [ImplAsOutsideClass] // CHECK:STDERR: impl as J {} G(); @@ -50,9 +46,7 @@ interface Z { fn Zero(); fn Method(self); - // CHECK:STDERR: fail_impl_as_self_interface.carbon:[[@LINE+4]]:9: error: `impl as` can only be used in a class [ImplAsOutsideClass] - // CHECK:STDERR: impl as Z { - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_impl_as_self_interface.carbon:[[@LINE+2]]:9-10: error: `impl as` can only be used in a class [ImplAsOutsideClass] // CHECK:STDERR: impl as Z { fn Zero() {} @@ -88,9 +82,7 @@ fn G() {} class X { impl as A { - // CHECK:STDERR: fail_impl_as_other_interface.carbon:[[@LINE+4]]:10: error: `impl as` can only be used in a class [ImplAsOutsideClass] - // CHECK:STDERR: impl as C {} - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_impl_as_other_interface.carbon:[[@LINE+2]]:10-11: error: `impl as` can only be used in a class [ImplAsOutsideClass] // CHECK:STDERR: impl as C {} fn B() { @@ -133,7 +125,7 @@ class X { // CHECK:STDOUT: impl_decl @.as.I.impl [concrete] {} { // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc11: = impl_self_witness , @I [concrete = ] +// CHECK:STDOUT: %.loc9: = impl_self_witness , @I [concrete = ] // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: @@ -228,7 +220,7 @@ class X { // CHECK:STDOUT: impl_decl @.as.J.impl [concrete] {} { // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc12: = impl_self_witness , @J [concrete = ] +// CHECK:STDOUT: %.loc10: = impl_self_witness , @J [concrete = ] // CHECK:STDOUT: %G.ref: %G.type = name_ref G, file.%G.decl [concrete = constants.%G] // CHECK:STDOUT: %G.call: init %empty_tuple.type = call %G.ref() // CHECK:STDOUT: return @@ -288,17 +280,17 @@ class X { // CHECK:STDOUT: %pattern_type.a96: type = pattern_type %empty_struct_type [concrete] // CHECK:STDOUT: %self.param_patt.52f: %pattern_type.a96 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.4b1: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt.52f [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc29_7.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc27_7.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc29_7.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc27_7.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.1: %Destroy.WithSelf.Op.type.ef016f.1 = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.e02: %pattern_type.9d8 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.8c1: %pattern_type.9d8 = wrapper_binding_pattern self, %self.param_patt.e02 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc29_7.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc27_7.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc29_7.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc27_7.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.2: %Destroy.WithSelf.Op.type.ef016f.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc29_7.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc27_7.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.2: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2 = struct_value () [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.e6b, %Destroy.WithSelf.SelfDestruct.db3fdb.2 [concrete] // CHECK:STDOUT: } @@ -313,28 +305,28 @@ class X { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc29_7.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc27_7.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.a96 = ref_param_pattern [concrete = constants.%self.param_patt.52f] // CHECK:STDOUT: %self.patt: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.4b1] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %empty_struct_type = ref_param call_param0 // CHECK:STDOUT: %self: ref %empty_struct_type = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc29_7.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc27_7.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.a96 = ref_param_pattern [concrete = constants.%self.param_patt.52f] // CHECK:STDOUT: %self.patt: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.4b1] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %empty_struct_type = ref_param call_param0 // CHECK:STDOUT: %self: ref %empty_struct_type = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc29_7.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc27_7.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.9d8 = ref_param_pattern [concrete = constants.%self.param_patt.e02] // CHECK:STDOUT: %self.patt: %pattern_type.9d8 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.8c1] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %Point = ref_param call_param0 // CHECK:STDOUT: %self: ref %Point = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc29_7.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc27_7.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.9d8 = ref_param_pattern [concrete = constants.%self.param_patt.e02] // CHECK:STDOUT: %self.patt: %pattern_type.9d8 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.8c1] // CHECK:STDOUT: } { @@ -379,7 +371,7 @@ class X { // CHECK:STDOUT: impl_decl @.as.Z.impl [concrete] {} { // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc11: = impl_self_witness , @Z [concrete = ] +// CHECK:STDOUT: %.loc9: = impl_self_witness , @Z [concrete = ] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self @@ -403,16 +395,16 @@ class X { // CHECK:STDOUT: impl: as %Z.ref { // CHECK:STDOUT: %.as.Z.impl.Zero.decl: @.as.Z.impl.%.as.Z.impl.Zero.type (%.as.Z.impl.Zero.type) = fn_decl @.as.Z.impl.Zero [symbolic = @.as.Z.impl.%.as.Z.impl.Zero (constants.%.as.Z.impl.Zero)] {} {} // CHECK:STDOUT: %.as.Z.impl.Method.decl: @.as.Z.impl.%.as.Z.impl.Method.type (%.as.Z.impl.Method.type) = fn_decl @.as.Z.impl.Method [symbolic = @.as.Z.impl.%.as.Z.impl.Method (constants.%.as.Z.impl.Method)] { -// CHECK:STDOUT: %self.param_patt.loc13_22.1: @.as.Z.impl.Method.%pattern_type (%pattern_type.52a) = value_param_pattern [symbolic = %self.param_patt.loc13_22.2 (constants.%self.param_patt.241)] -// CHECK:STDOUT: %self.patt.loc13_22.1: @.as.Z.impl.Method.%pattern_type (%pattern_type.52a) = wrapper_binding_pattern self, %self.param_patt.loc13_22.1 [symbolic = %self.patt.loc13_22.2 (constants.%self.patt.b15)] +// CHECK:STDOUT: %self.param_patt.loc11_22.1: @.as.Z.impl.Method.%pattern_type (%pattern_type.52a) = value_param_pattern [symbolic = %self.param_patt.loc11_22.2 (constants.%self.param_patt.241)] +// CHECK:STDOUT: %self.patt.loc11_22.1: @.as.Z.impl.Method.%pattern_type (%pattern_type.52a) = wrapper_binding_pattern self, %self.param_patt.loc11_22.1 [symbolic = %self.patt.loc11_22.2 (constants.%self.patt.b15)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: @.as.Z.impl.Method.%Self.as_type.loc13_22.1 (%Self.as_type.0cf) = value_param call_param0 -// CHECK:STDOUT: %.loc13_22.1: type = splice_block %.loc13_22.2 [symbolic = %Self.as_type.loc13_22.1 (constants.%Self.as_type.0cf)] { +// CHECK:STDOUT: %self.param: @.as.Z.impl.Method.%Self.as_type.loc11_22.1 (%Self.as_type.0cf) = value_param call_param0 +// CHECK:STDOUT: %.loc11_22.1: type = splice_block %.loc11_22.2 [symbolic = %Self.as_type.loc11_22.1 (constants.%Self.as_type.0cf)] { // CHECK:STDOUT: %Self.ref: %Z.type = name_ref Self, @Z.%Self [symbolic = %Self (constants.%Self.cb6)] -// CHECK:STDOUT: %Self.as_type.loc13_22.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc13_22.1 (constants.%Self.as_type.0cf)] -// CHECK:STDOUT: %.loc13_22.2: type = converted %Self.ref, %Self.as_type.loc13_22.2 [symbolic = %Self.as_type.loc13_22.1 (constants.%Self.as_type.0cf)] +// CHECK:STDOUT: %Self.as_type.loc11_22.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc11_22.1 (constants.%Self.as_type.0cf)] +// CHECK:STDOUT: %.loc11_22.2: type = converted %Self.ref, %Self.as_type.loc11_22.2 [symbolic = %Self.as_type.loc11_22.1 (constants.%Self.as_type.0cf)] // CHECK:STDOUT: } -// CHECK:STDOUT: %self: @.as.Z.impl.Method.%Self.as_type.loc13_22.1 (%Self.as_type.0cf) = wrapper_binding self, %self.param +// CHECK:STDOUT: %self: @.as.Z.impl.Method.%Self.as_type.loc11_22.1 (%Self.as_type.0cf) = wrapper_binding self, %self.param // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -448,7 +440,7 @@ class X { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Point [concrete = constants.%Point] // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc18: = impl_self_witness @Point.as.Z.impl.%Self.ref, @Z [concrete = constants.%.354] +// CHECK:STDOUT: %.loc16: = impl_self_witness @Point.as.Z.impl.%Self.ref, @Z [concrete = constants.%.354] // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: @@ -482,15 +474,15 @@ class X { // CHECK:STDOUT: // CHECK:STDOUT: generic fn @.as.Z.impl.Method(@Z.%Self: %Z.type) { // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.cb6)] -// CHECK:STDOUT: %Self.as_type.loc13_22.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc13_22.1 (constants.%Self.as_type.0cf)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc13_22.1 [symbolic = %pattern_type (constants.%pattern_type.52a)] -// CHECK:STDOUT: %self.param_patt.loc13_22.2: @.as.Z.impl.Method.%pattern_type (%pattern_type.52a) = value_param_pattern [symbolic = %self.param_patt.loc13_22.2 (constants.%self.param_patt.241)] -// CHECK:STDOUT: %self.patt.loc13_22.2: @.as.Z.impl.Method.%pattern_type (%pattern_type.52a) = wrapper_binding_pattern self, %self.param_patt.loc13_22.2 [symbolic = %self.patt.loc13_22.2 (constants.%self.patt.b15)] +// CHECK:STDOUT: %Self.as_type.loc11_22.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc11_22.1 (constants.%Self.as_type.0cf)] +// CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc11_22.1 [symbolic = %pattern_type (constants.%pattern_type.52a)] +// CHECK:STDOUT: %self.param_patt.loc11_22.2: @.as.Z.impl.Method.%pattern_type (%pattern_type.52a) = value_param_pattern [symbolic = %self.param_patt.loc11_22.2 (constants.%self.param_patt.241)] +// CHECK:STDOUT: %self.patt.loc11_22.2: @.as.Z.impl.Method.%pattern_type (%pattern_type.52a) = wrapper_binding_pattern self, %self.param_patt.loc11_22.2 [symbolic = %self.patt.loc11_22.2 (constants.%self.patt.b15)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %Self.as_type.loc13_22.1 [symbolic = %require_complete (constants.%require_complete.350)] +// CHECK:STDOUT: %require_complete: = require_complete_type %Self.as_type.loc11_22.1 [symbolic = %require_complete (constants.%require_complete.350)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%self.param: @.as.Z.impl.Method.%Self.as_type.loc13_22.1 (%Self.as_type.0cf)) { +// CHECK:STDOUT: fn(%self.param: @.as.Z.impl.Method.%Self.as_type.loc11_22.1 (%Self.as_type.0cf)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -508,45 +500,45 @@ class X { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Point.ref.loc28: type = name_ref Point, file.%Point.decl [concrete = constants.%Point] -// CHECK:STDOUT: %Z.ref.loc28: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] +// CHECK:STDOUT: %Point.ref.loc26: type = name_ref Point, file.%Point.decl [concrete = constants.%Point] +// CHECK:STDOUT: %Z.ref.loc26: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] // CHECK:STDOUT: %Zero.ref: %Z.assoc_type = name_ref Zero, @Z.WithSelf.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %Z.facet: %Z.type = facet_value %Point.ref.loc28, (constants.%Z.impl_witness) [concrete = constants.%Z.facet] -// CHECK:STDOUT: %.loc28: %Z.type = converted %Point.ref.loc28, %Z.facet [concrete = constants.%Z.facet] +// CHECK:STDOUT: %Z.facet: %Z.type = facet_value %Point.ref.loc26, (constants.%Z.impl_witness) [concrete = constants.%Z.facet] +// CHECK:STDOUT: %.loc26: %Z.type = converted %Point.ref.loc26, %Z.facet [concrete = constants.%Z.facet] // CHECK:STDOUT: %impl.elem0: %.075 = impl_witness_access constants.%Z.impl_witness, element0 [concrete = constants.%Point.as.Z.impl.Zero] // CHECK:STDOUT: %Point.as.Z.impl.Zero.call: init %empty_tuple.type = call %impl.elem0() -// CHECK:STDOUT: %.loc29_5.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %Point.ref.loc29: type = name_ref Point, file.%Point.decl [concrete = constants.%Point] -// CHECK:STDOUT: %.loc29_5.2: ref %Point = temporary_storage -// CHECK:STDOUT: %.loc29_5.3: init %Point to %.loc29_5.2 = class_init () [concrete = constants.%Point.val] -// CHECK:STDOUT: %.loc29_7.1: init %Point = converted %.loc29_5.1, %.loc29_5.3 [concrete = constants.%Point.val] -// CHECK:STDOUT: %Z.ref.loc29: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] +// CHECK:STDOUT: %.loc27_5.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %Point.ref.loc27: type = name_ref Point, file.%Point.decl [concrete = constants.%Point] +// CHECK:STDOUT: %.loc27_5.2: ref %Point = temporary_storage +// CHECK:STDOUT: %.loc27_5.3: init %Point to %.loc27_5.2 = class_init () [concrete = constants.%Point.val] +// CHECK:STDOUT: %.loc27_7.1: init %Point = converted %.loc27_5.1, %.loc27_5.3 [concrete = constants.%Point.val] +// CHECK:STDOUT: %Z.ref.loc27: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] // CHECK:STDOUT: %Method.ref: %Z.assoc_type = name_ref Method, @Z.WithSelf.%assoc1 [concrete = constants.%assoc1] // CHECK:STDOUT: %impl.elem1: %.18a = impl_witness_access constants.%Z.impl_witness, element1 [concrete = constants.%Point.as.Z.impl.Method] -// CHECK:STDOUT: %bound_method: = bound_method %.loc29_7.1, %impl.elem1 [concrete = constants.%Point.as.Z.impl.Method.bound] -// CHECK:STDOUT: %.loc29_7.2: ref %Point = temporary %.loc29_5.2, %.loc29_7.1 [concrete = constants.%.e6b] -// CHECK:STDOUT: %.loc29_7.3: %Point = acquire_value %.loc29_7.2 [concrete = constants.%Point.val] -// CHECK:STDOUT: %Point.as.Z.impl.Method.call: init %empty_tuple.type = call %bound_method(%.loc29_7.3) +// CHECK:STDOUT: %bound_method: = bound_method %.loc27_7.1, %impl.elem1 [concrete = constants.%Point.as.Z.impl.Method.bound] +// CHECK:STDOUT: %.loc27_7.2: ref %Point = temporary %.loc27_5.2, %.loc27_7.1 [concrete = constants.%.e6b] +// CHECK:STDOUT: %.loc27_7.3: %Point = acquire_value %.loc27_7.2 [concrete = constants.%Point.val] +// CHECK:STDOUT: %Point.as.Z.impl.Method.call: init %empty_tuple.type = call %bound_method(%.loc27_7.3) // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call constants.%Destroy.WithSelf.SelfDestruct.bound(constants.%.e6b) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc29_7.1(%self.param: ref %empty_struct_type) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc27_7.1(%self.param: ref %empty_struct_type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc29_7.1(%self.param: ref %empty_struct_type) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc27_7.1(%self.param: ref %empty_struct_type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc29_7.1(%self.param: ref %empty_struct_type) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc27_7.1(%self.param: ref %empty_struct_type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.1(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.1(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc29_7.2(%self.param: ref %Point) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc27_7.2(%self.param: ref %Point) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc29_7.2(%self.param: ref %Point) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc27_7.2(%self.param: ref %Point) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc29_7.2(%self.param: ref %Point) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc27_7.2(%self.param: ref %Point) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.2(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.2(%self.param) @@ -585,10 +577,10 @@ class X { // CHECK:STDOUT: // CHECK:STDOUT: specific @.as.Z.impl.Method(constants.%Self.cb6) { // CHECK:STDOUT: %Self => constants.%Self.cb6 -// CHECK:STDOUT: %Self.as_type.loc13_22.1 => constants.%Self.as_type.0cf +// CHECK:STDOUT: %Self.as_type.loc11_22.1 => constants.%Self.as_type.0cf // CHECK:STDOUT: %pattern_type => constants.%pattern_type.52a -// CHECK:STDOUT: %self.param_patt.loc13_22.2 => constants.%self.param_patt.241 -// CHECK:STDOUT: %self.patt.loc13_22.2 => constants.%self.patt.b15 +// CHECK:STDOUT: %self.param_patt.loc11_22.2 => constants.%self.param_patt.241 +// CHECK:STDOUT: %self.patt.loc11_22.2 => constants.%self.patt.b15 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Z.WithSelf(constants.%Z.facet) { @@ -692,7 +684,7 @@ class X { // CHECK:STDOUT: impl_decl @.as.C.impl [concrete] {} { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc17: = impl_self_witness , @C [concrete = ] +// CHECK:STDOUT: %.loc15: = impl_self_witness , @C [concrete = ] // CHECK:STDOUT: %X.as.A.impl.B.decl: %X.as.A.impl.B.type = fn_decl @X.as.A.impl.B [concrete = constants.%X.as.A.impl.B] {} {} // CHECK:STDOUT: %A.impl_witness_table = impl_witness_table (%X.as.A.impl.B.decl), @X.as.A.impl [concrete] // CHECK:STDOUT: %A.impl_witness: = impl_witness %A.impl_witness_table [concrete = constants.%A.impl_witness] diff --git a/toolchain/check/testdata/impl/fail_impl_bad_assoc_const.carbon b/toolchain/check/testdata/impl/fail_impl_bad_assoc_const.carbon index 7b5343b02dc0..917fc783f710 100644 --- a/toolchain/check/testdata/impl/fail_impl_bad_assoc_const.carbon +++ b/toolchain/check/testdata/impl/fail_impl_bad_assoc_const.carbon @@ -14,12 +14,8 @@ interface I { let T: type; } -// CHECK:STDERR: fail_impl_bad_assoc_const.carbon:[[@LINE+7]]:1: error: associated constant T not given a value in impl of interface I [ImplAssociatedConstantNeedsValue] -// CHECK:STDERR: impl () as I {} -// CHECK:STDERR: ^~~~~~~~~~~~~~ -// CHECK:STDERR: fail_impl_bad_assoc_const.carbon:[[@LINE-5]]:19: note: associated constant declared here [AssociatedConstantHere] -// CHECK:STDERR: interface I { let T: type; } -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_impl_bad_assoc_const.carbon:[[@LINE+3]]:1-14: error: associated constant T not given a value in impl of interface I [ImplAssociatedConstantNeedsValue] +// CHECK:STDERR: fail_impl_bad_assoc_const.carbon:[[@LINE-3]]:19-25: note: associated constant declared here [AssociatedConstantHere] // CHECK:STDERR: impl () as I {} @@ -44,11 +40,11 @@ impl () as I {} // CHECK:STDOUT: } // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {} // CHECK:STDOUT: impl_decl @empty_tuple.type.as.I.impl [concrete] {} { -// CHECK:STDOUT: %.loc24_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc24_7.2: type = converted %.loc24_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc20_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc20_7.2: type = converted %.loc20_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc24: = impl_self_witness @empty_tuple.type.as.I.impl.%.loc24_7.2, @I [concrete = constants.%.2ef] +// CHECK:STDOUT: %.loc20: = impl_self_witness @empty_tuple.type.as.I.impl.%.loc20_7.2, @I [concrete = constants.%.2ef] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { @@ -68,7 +64,7 @@ impl () as I {} // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_tuple.type.as.I.impl: %.loc24_7.2 as %I.ref { +// CHECK:STDOUT: impl @empty_tuple.type.as.I.impl: %.loc20_7.2 as %I.ref { // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (), @empty_tuple.type.as.I.impl [concrete] // CHECK:STDOUT: %I.impl_witness: = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness] // CHECK:STDOUT: 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 26456bcd806a..cb3a4fa5eb6b 100644 --- a/toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon +++ b/toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon @@ -15,24 +15,16 @@ interface I { fn F(); } class NoF { - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:3: error: missing implementation of F in impl of interface I [ImplMissingFunction] - // CHECK:STDERR: impl as I {} - // CHECK:STDERR: ^~~~~~~~~~~ - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-6]]:15: note: associated function F declared here [AssociatedFunctionHere] - // CHECK:STDERR: interface I { fn F(); } - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+3]]:3-13: error: missing implementation of F in impl of interface I [ImplMissingFunction] + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-4]]:15-21: note: associated function F declared here [AssociatedFunctionHere] // CHECK:STDERR: impl as I {} } class FNotFunction { impl as I { - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: error: associated function F implemented by non-function [ImplFunctionWithNonFunction] - // CHECK:STDERR: class F; - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-18]]:15: note: associated function F declared here [AssociatedFunctionHere] - // CHECK:STDERR: interface I { fn F(); } - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+3]]:5-12: error: associated function F implemented by non-function [ImplFunctionWithNonFunction] + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-12]]:15-21: note: associated function F declared here [AssociatedFunctionHere] // CHECK:STDERR: class F; } @@ -40,15 +32,9 @@ class FNotFunction { class FExtraParam { impl as I { - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+10]]:5: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] - // CHECK:STDERR: fn F(b: bool); - // CHECK:STDERR: ^~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: note: calling function declared here [InCallToEntity] - // CHECK:STDERR: fn F(b: bool); - // CHECK:STDERR: ^~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-34]]:15: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: interface I { fn F(); } - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+4]]:5-18: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+3]]:5-18: note: calling function declared here [InCallToEntity] + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-22]]:15-21: note: while building thunk to match the signature of this function [ThunkSignature] // CHECK:STDERR: fn F(b: bool); } @@ -56,15 +42,9 @@ class FExtraParam { class FExtraImplicitParam { impl as I { - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+10]]:5: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] - // CHECK:STDERR: fn F(self); - // CHECK:STDERR: ^~~~~~~~~~~ - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: note: calling function declared here [InCallToEntity] - // CHECK:STDERR: fn F(self); - // CHECK:STDERR: ^~~~~~~~~~~ - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-50]]:15: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: interface I { fn F(); } - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+4]]:5-15: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+3]]:5-15: note: calling function declared here [InCallToEntity] + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-32]]:15-21: note: while building thunk to match the signature of this function [ThunkSignature] // CHECK:STDERR: fn F(self); } @@ -73,12 +53,8 @@ class FExtraImplicitParam { // TODO: Should this be permitted? class FExtraReturnType { impl as I { - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: error: function redeclaration differs because return type is `bool` [FunctionRedeclReturnTypeDiffers] - // CHECK:STDERR: fn F() -> bool; - // CHECK:STDERR: ^~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-64]]:15: note: previously declared with no return type [FunctionRedeclReturnTypePreviousNoReturn] - // CHECK:STDERR: interface I { fn F(); } - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+3]]:5-19: error: function redeclaration differs because return type is `bool` [FunctionRedeclReturnTypeDiffers] + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-42]]:15-21: note: previously declared with no return type [FunctionRedeclReturnTypePreviousNoReturn] // CHECK:STDERR: fn F() -> bool; } @@ -88,15 +64,9 @@ interface J { fn F(self: bool, b: bool) -> bool; } class FMissingParam { impl as J { - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+10]]:5: error: 1 argument passed to function expecting 0 arguments [CallArgCountMismatch] - // CHECK:STDERR: fn F(self: bool) -> bool; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: note: calling function declared here [InCallToEntity] - // CHECK:STDERR: fn F(self: bool) -> bool; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-10]]:15: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: interface J { fn F(self: bool, b: bool) -> bool; } - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+4]]:5-29: error: 1 argument passed to function expecting 0 arguments [CallArgCountMismatch] + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+3]]:5-29: note: calling function declared here [InCallToEntity] + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-6]]:15-48: note: while building thunk to match the signature of this function [ThunkSignature] // CHECK:STDERR: fn F(self: bool) -> bool; } @@ -104,12 +74,8 @@ class FMissingParam { class FMissingImplicitParam { impl as J { - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: error: member name of type `` in compound member access is not an instance member or an interface member [CompoundMemberAccessDoesNotUseBase] - // CHECK:STDERR: fn F(b: bool) -> bool; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-23]]:15: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: interface J { fn F(self: bool, b: bool) -> bool; } - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+3]]:5-26: error: member name of type `` in compound member access is not an instance member or an interface member [CompoundMemberAccessDoesNotUseBase] + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-15]]:15-48: note: while building thunk to match the signature of this function [ThunkSignature] // CHECK:STDERR: fn F(b: bool) -> bool; } @@ -117,15 +83,9 @@ class FMissingImplicitParam { class FMissingReturnType { impl as J { - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+12]]: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+9]]: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] - // CHECK:STDERR: interface J { fn F(self: bool, b: bool) -> bool; } - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+6]]:5-30: error: cannot implicitly convert expression of type `()` to `bool` [ConversionFailure] + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+5]]:5-30: note: type `()` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-25]]:15-48: note: while building thunk to match the signature of this function [ThunkSignature] // CHECK:STDERR: // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon: error: cannot implicitly convert expression of type `bool` to `FDifferentParamType` [ConversionFailure] // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon: note: type `bool` does not implement interface `Core.ImplicitAs(FDifferentParamType)` [MissingImplInMemberAccessInContext] @@ -135,12 +95,8 @@ class FMissingReturnType { class FDifferentParamType { impl as J { - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+9]]:22: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn F(self: bool, b: Self) -> bool; - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-54]]:15: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: interface J { fn F(self: bool, b: bool) -> bool; } - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+5]]:22-28: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-36]]:15-48: note: while building thunk to match the signature of this function [ThunkSignature] // CHECK:STDERR: // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon: error: cannot implicitly convert expression of type `bool` to `FDifferentImplicitParamType` [ConversionFailure] // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon: note: type `bool` does not implement interface `Core.ImplicitAs(FDifferentImplicitParamType)` [MissingImplInMemberAccessInContext] @@ -150,12 +106,8 @@ class FDifferentParamType { class FDifferentImplicitParamType { impl as J { - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:10: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn F(self, b: bool) -> bool; - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-69]]:15: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: interface J { fn F(self: bool, b: bool) -> bool; } - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+3]]:10-13: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-47]]:15-48: note: while building thunk to match the signature of this function [ThunkSignature] // CHECK:STDERR: fn F(self, b: bool) -> bool; } @@ -164,15 +116,9 @@ class FDifferentImplicitParamType { class FDifferentReturnType { impl as J { // TODO: Include an "aka" in this diagnostic to explain that the type `Self` is `FDifferentReturnType`. - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+12]]:5: error: cannot implicitly convert expression of type `Self` to `bool` [ConversionFailure] - // CHECK:STDERR: fn F(self: bool, b: bool) -> Self; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+9]]: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-86]]:15: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: interface J { fn F(self: bool, b: bool) -> bool; } - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+6]]:5-38: error: cannot implicitly convert expression of type `Self` to `bool` [ConversionFailure] + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+5]]:5-38: note: type `FDifferentReturnType` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-58]]:15-48: note: while building thunk to match the signature of this function [ThunkSignature] // CHECK:STDERR: // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon: error: cannot implicitly convert expression of type `SelfNestedBadParam` to `i32` [ConversionFailure] // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon: note: type `SelfNestedBadParam` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] @@ -186,12 +132,8 @@ interface SelfNested { class SelfNestedBadParam { impl as SelfNested { - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:10: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn F(x: (SelfNestedBadParam*, {.x: i32, .y: i32})) -> array(SelfNestedBadParam, 4); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-8]]:3: note: while building thunk to match the signature of this function [ThunkSignature] - // 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]]:10-53: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-6]]:3-58: note: while building thunk to match the signature of this function [ThunkSignature] // CHECK:STDERR: fn F(x: (SelfNestedBadParam*, {.x: i32, .y: i32})) -> array(SelfNestedBadParam, 4); } @@ -199,15 +141,9 @@ class SelfNestedBadParam { class SelfNestedBadReturnType { impl as SelfNested { - // 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))` [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] - // CHECK:STDERR: fn F(x: (Self*, {.x: Self, .y: i32})) -> array(Self, 4); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+4]]:5-112: error: cannot implicitly convert expression of type `array(SelfNestedBadParam, 4)` to `array(SelfNestedBadReturnType, 4)` [ConversionFailure] + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+3]]:5-112: note: type `array(SelfNestedBadParam, 4)` does not implement interface `Core.ImplicitAs(array(SelfNestedBadReturnType, 4))` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-16]]:3-58: note: while building thunk to match the signature of this function [ThunkSignature] // CHECK:STDERR: fn F(x: (SelfNestedBadReturnType*, {.x: SelfNestedBadReturnType, .y: i32})) -> array(SelfNestedBadParam, 4); } @@ -246,12 +182,12 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %pattern_type.831: type = pattern_type bool [concrete] // CHECK:STDOUT: %b.param_patt.792: %pattern_type.831 = value_param_pattern [concrete] // CHECK:STDOUT: %b.patt.d80: %pattern_type.831 = wrapper_binding_pattern b, %b.param_patt.792 [concrete] -// CHECK:STDOUT: %FExtraParam.as.I.impl.F.type.ec7b0b.1: type = fn_type @FExtraParam.as.I.impl.F.loc53_18.1 [concrete] +// CHECK:STDOUT: %FExtraParam.as.I.impl.F.type.ec7b0b.1: type = fn_type @FExtraParam.as.I.impl.F.loc39_18.1 [concrete] // CHECK:STDOUT: %FExtraParam.as.I.impl.F.ef9801.1: %FExtraParam.as.I.impl.F.type.ec7b0b.1 = struct_value () [concrete] // CHECK:STDOUT: %I.facet.476: %I.type = facet_value %FExtraParam, (%I.impl_witness.0d1) [concrete] // CHECK:STDOUT: %I.WithSelf.F.type.f2e: type = fn_type @I.WithSelf.F, @I.WithSelf(%I.facet.476) [concrete] // CHECK:STDOUT: %I.WithSelf.F.91f: %I.WithSelf.F.type.f2e = struct_value () [concrete] -// CHECK:STDOUT: %FExtraParam.as.I.impl.F.type.ec7b0b.2: type = fn_type @FExtraParam.as.I.impl.F.loc53_18.2 [concrete] +// CHECK:STDOUT: %FExtraParam.as.I.impl.F.type.ec7b0b.2: type = fn_type @FExtraParam.as.I.impl.F.loc39_18.2 [concrete] // CHECK:STDOUT: %FExtraParam.as.I.impl.F.ef9801.2: %FExtraParam.as.I.impl.F.type.ec7b0b.2 = struct_value () [concrete] // CHECK:STDOUT: %FExtraImplicitParam: type = class_type @FExtraImplicitParam [concrete] // CHECK:STDOUT: %.77c: = impl_self_witness %FExtraImplicitParam, @I [concrete] @@ -259,12 +195,12 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %pattern_type.54d: type = pattern_type %FExtraImplicitParam [concrete] // CHECK:STDOUT: %self.param_patt.f41: %pattern_type.54d = value_param_pattern [concrete] // CHECK:STDOUT: %self.patt.cca: %pattern_type.54d = wrapper_binding_pattern self, %self.param_patt.f41 [concrete] -// CHECK:STDOUT: %FExtraImplicitParam.as.I.impl.F.type.54cac2.1: type = fn_type @FExtraImplicitParam.as.I.impl.F.loc69_15.1 [concrete] +// CHECK:STDOUT: %FExtraImplicitParam.as.I.impl.F.type.54cac2.1: type = fn_type @FExtraImplicitParam.as.I.impl.F.loc49_15.1 [concrete] // CHECK:STDOUT: %FExtraImplicitParam.as.I.impl.F.a42f35.1: %FExtraImplicitParam.as.I.impl.F.type.54cac2.1 = struct_value () [concrete] // CHECK:STDOUT: %I.facet.7ed: %I.type = facet_value %FExtraImplicitParam, (%I.impl_witness.989) [concrete] // CHECK:STDOUT: %I.WithSelf.F.type.0ed: type = fn_type @I.WithSelf.F, @I.WithSelf(%I.facet.7ed) [concrete] // CHECK:STDOUT: %I.WithSelf.F.ec4: %I.WithSelf.F.type.0ed = struct_value () [concrete] -// CHECK:STDOUT: %FExtraImplicitParam.as.I.impl.F.type.54cac2.2: type = fn_type @FExtraImplicitParam.as.I.impl.F.loc69_15.2 [concrete] +// CHECK:STDOUT: %FExtraImplicitParam.as.I.impl.F.type.54cac2.2: type = fn_type @FExtraImplicitParam.as.I.impl.F.loc49_15.2 [concrete] // CHECK:STDOUT: %FExtraImplicitParam.as.I.impl.F.a42f35.2: %FExtraImplicitParam.as.I.impl.F.type.54cac2.2 = struct_value () [concrete] // CHECK:STDOUT: %FExtraReturnType: type = class_type @FExtraReturnType [concrete] // CHECK:STDOUT: %.ebd: = impl_self_witness %FExtraReturnType, @I [concrete] @@ -288,32 +224,32 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %FMissingParam: type = class_type @FMissingParam [concrete] // CHECK:STDOUT: %.599: = impl_self_witness %FMissingParam, @J [concrete] // CHECK:STDOUT: %J.impl_witness.24e: = impl_witness @FMissingParam.as.J.impl.%J.impl_witness_table [concrete] -// CHECK:STDOUT: %FMissingParam.as.J.impl.F.type.aad6ec.1: type = fn_type @FMissingParam.as.J.impl.F.loc101_29.1 [concrete] +// CHECK:STDOUT: %FMissingParam.as.J.impl.F.type.aad6ec.1: type = fn_type @FMissingParam.as.J.impl.F.loc71_29.1 [concrete] // CHECK:STDOUT: %FMissingParam.as.J.impl.F.dd09dc.1: %FMissingParam.as.J.impl.F.type.aad6ec.1 = struct_value () [concrete] // CHECK:STDOUT: %J.facet.2a3: %J.type = facet_value %FMissingParam, (%J.impl_witness.24e) [concrete] // CHECK:STDOUT: %J.WithSelf.F.type.38e: type = fn_type @J.WithSelf.F, @J.WithSelf(%J.facet.2a3) [concrete] // CHECK:STDOUT: %J.WithSelf.F.433: %J.WithSelf.F.type.38e = struct_value () [concrete] -// CHECK:STDOUT: %FMissingParam.as.J.impl.F.type.aad6ec.2: type = fn_type @FMissingParam.as.J.impl.F.loc101_29.2 [concrete] +// CHECK:STDOUT: %FMissingParam.as.J.impl.F.type.aad6ec.2: type = fn_type @FMissingParam.as.J.impl.F.loc71_29.2 [concrete] // CHECK:STDOUT: %FMissingParam.as.J.impl.F.dd09dc.2: %FMissingParam.as.J.impl.F.type.aad6ec.2 = struct_value () [concrete] // CHECK:STDOUT: %FMissingImplicitParam: type = class_type @FMissingImplicitParam [concrete] // CHECK:STDOUT: %.f79: = impl_self_witness %FMissingImplicitParam, @J [concrete] // CHECK:STDOUT: %J.impl_witness.0d0: = impl_witness @FMissingImplicitParam.as.J.impl.%J.impl_witness_table [concrete] -// CHECK:STDOUT: %FMissingImplicitParam.as.J.impl.F.type.f666a8.1: type = fn_type @FMissingImplicitParam.as.J.impl.F.loc114_26.1 [concrete] +// CHECK:STDOUT: %FMissingImplicitParam.as.J.impl.F.type.f666a8.1: type = fn_type @FMissingImplicitParam.as.J.impl.F.loc80_26.1 [concrete] // CHECK:STDOUT: %FMissingImplicitParam.as.J.impl.F.620ed1.1: %FMissingImplicitParam.as.J.impl.F.type.f666a8.1 = struct_value () [concrete] // CHECK:STDOUT: %J.facet.ba1: %J.type = facet_value %FMissingImplicitParam, (%J.impl_witness.0d0) [concrete] // CHECK:STDOUT: %J.WithSelf.F.type.5df: type = fn_type @J.WithSelf.F, @J.WithSelf(%J.facet.ba1) [concrete] // CHECK:STDOUT: %J.WithSelf.F.44b: %J.WithSelf.F.type.5df = struct_value () [concrete] -// CHECK:STDOUT: %FMissingImplicitParam.as.J.impl.F.type.f666a8.2: type = fn_type @FMissingImplicitParam.as.J.impl.F.loc114_26.2 [concrete] +// CHECK:STDOUT: %FMissingImplicitParam.as.J.impl.F.type.f666a8.2: type = fn_type @FMissingImplicitParam.as.J.impl.F.loc80_26.2 [concrete] // CHECK:STDOUT: %FMissingImplicitParam.as.J.impl.F.620ed1.2: %FMissingImplicitParam.as.J.impl.F.type.f666a8.2 = struct_value () [concrete] // CHECK:STDOUT: %FMissingReturnType: type = class_type @FMissingReturnType [concrete] // CHECK:STDOUT: %.199: = impl_self_witness %FMissingReturnType, @J [concrete] // CHECK:STDOUT: %J.impl_witness.50a: = impl_witness @FMissingReturnType.as.J.impl.%J.impl_witness_table [concrete] -// CHECK:STDOUT: %FMissingReturnType.as.J.impl.F.type.9cd56a.1: type = fn_type @FMissingReturnType.as.J.impl.F.loc132_30.1 [concrete] +// CHECK:STDOUT: %FMissingReturnType.as.J.impl.F.type.9cd56a.1: type = fn_type @FMissingReturnType.as.J.impl.F.loc92_30.1 [concrete] // CHECK:STDOUT: %FMissingReturnType.as.J.impl.F.6975be.1: %FMissingReturnType.as.J.impl.F.type.9cd56a.1 = struct_value () [concrete] // CHECK:STDOUT: %J.facet.b68: %J.type = facet_value %FMissingReturnType, (%J.impl_witness.50a) [concrete] // CHECK:STDOUT: %J.WithSelf.F.type.628: type = fn_type @J.WithSelf.F, @J.WithSelf(%J.facet.b68) [concrete] // CHECK:STDOUT: %J.WithSelf.F.70e: %J.WithSelf.F.type.628 = struct_value () [concrete] -// CHECK:STDOUT: %FMissingReturnType.as.J.impl.F.type.9cd56a.2: type = fn_type @FMissingReturnType.as.J.impl.F.loc132_30.2 [concrete] +// CHECK:STDOUT: %FMissingReturnType.as.J.impl.F.type.9cd56a.2: type = fn_type @FMissingReturnType.as.J.impl.F.loc92_30.2 [concrete] // CHECK:STDOUT: %FMissingReturnType.as.J.impl.F.6975be.2: %FMissingReturnType.as.J.impl.F.type.9cd56a.2 = struct_value () [concrete] // CHECK:STDOUT: %ImplicitAs.type.0ff: type = generic_interface_type @ImplicitAs [concrete] // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.0ff = struct_value () [concrete] @@ -330,12 +266,12 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %pattern_type.5d3: type = pattern_type %FDifferentParamType [concrete] // CHECK:STDOUT: %b.param_patt.0a8: %pattern_type.5d3 = value_param_pattern [concrete] // CHECK:STDOUT: %b.patt.f7e: %pattern_type.5d3 = wrapper_binding_pattern b, %b.param_patt.0a8 [concrete] -// CHECK:STDOUT: %FDifferentParamType.as.J.impl.F.type.4a2e9b.1: type = fn_type @FDifferentParamType.as.J.impl.F.loc147_38.1 [concrete] +// CHECK:STDOUT: %FDifferentParamType.as.J.impl.F.type.4a2e9b.1: type = fn_type @FDifferentParamType.as.J.impl.F.loc103_38.1 [concrete] // CHECK:STDOUT: %FDifferentParamType.as.J.impl.F.28602a.1: %FDifferentParamType.as.J.impl.F.type.4a2e9b.1 = struct_value () [concrete] // CHECK:STDOUT: %J.facet.73e: %J.type = facet_value %FDifferentParamType, (%J.impl_witness.9e2) [concrete] // CHECK:STDOUT: %J.WithSelf.F.type.fec: type = fn_type @J.WithSelf.F, @J.WithSelf(%J.facet.73e) [concrete] // CHECK:STDOUT: %J.WithSelf.F.236: %J.WithSelf.F.type.fec = struct_value () [concrete] -// CHECK:STDOUT: %FDifferentParamType.as.J.impl.F.type.4a2e9b.2: type = fn_type @FDifferentParamType.as.J.impl.F.loc147_38.2 [concrete] +// CHECK:STDOUT: %FDifferentParamType.as.J.impl.F.type.4a2e9b.2: type = fn_type @FDifferentParamType.as.J.impl.F.loc103_38.2 [concrete] // CHECK:STDOUT: %FDifferentParamType.as.J.impl.F.28602a.2: %FDifferentParamType.as.J.impl.F.type.4a2e9b.2 = struct_value () [concrete] // CHECK:STDOUT: %ImplicitAs.type.85e: type = facet_type <@ImplicitAs, @ImplicitAs(%FDifferentParamType)> [concrete] // CHECK:STDOUT: %ImplicitAs.assoc_type.a99: type = assoc_entity_type @ImplicitAs, @ImplicitAs(%FDifferentParamType) [concrete] @@ -346,12 +282,12 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %pattern_type.1bc: type = pattern_type %FDifferentImplicitParamType [concrete] // CHECK:STDOUT: %self.param_patt.ea6: %pattern_type.1bc = value_param_pattern [concrete] // CHECK:STDOUT: %self.patt.85b: %pattern_type.1bc = wrapper_binding_pattern self, %self.param_patt.ea6 [concrete] -// CHECK:STDOUT: %FDifferentImplicitParamType.as.J.impl.F.type.6ef8a6.1: type = fn_type @FDifferentImplicitParamType.as.J.impl.F.loc160_32.1 [concrete] +// CHECK:STDOUT: %FDifferentImplicitParamType.as.J.impl.F.type.6ef8a6.1: type = fn_type @FDifferentImplicitParamType.as.J.impl.F.loc112_32.1 [concrete] // CHECK:STDOUT: %FDifferentImplicitParamType.as.J.impl.F.792c78.1: %FDifferentImplicitParamType.as.J.impl.F.type.6ef8a6.1 = struct_value () [concrete] // CHECK:STDOUT: %J.facet.00a: %J.type = facet_value %FDifferentImplicitParamType, (%J.impl_witness.d1a) [concrete] // CHECK:STDOUT: %J.WithSelf.F.type.fa8: type = fn_type @J.WithSelf.F, @J.WithSelf(%J.facet.00a) [concrete] // CHECK:STDOUT: %J.WithSelf.F.a0b: %J.WithSelf.F.type.fa8 = struct_value () [concrete] -// CHECK:STDOUT: %FDifferentImplicitParamType.as.J.impl.F.type.6ef8a6.2: type = fn_type @FDifferentImplicitParamType.as.J.impl.F.loc160_32.2 [concrete] +// CHECK:STDOUT: %FDifferentImplicitParamType.as.J.impl.F.type.6ef8a6.2: type = fn_type @FDifferentImplicitParamType.as.J.impl.F.loc112_32.2 [concrete] // CHECK:STDOUT: %FDifferentImplicitParamType.as.J.impl.F.792c78.2: %FDifferentImplicitParamType.as.J.impl.F.type.6ef8a6.2 = struct_value () [concrete] // CHECK:STDOUT: %ImplicitAs.type.444: type = facet_type <@ImplicitAs, @ImplicitAs(%FDifferentImplicitParamType)> [concrete] // CHECK:STDOUT: %ImplicitAs.assoc_type.884: type = assoc_entity_type @ImplicitAs, @ImplicitAs(%FDifferentImplicitParamType) [concrete] @@ -363,12 +299,12 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %pattern_type.b9f: type = pattern_type %FDifferentReturnType [concrete] // CHECK:STDOUT: %return.param_patt.f37: %pattern_type.b9f = out_param_pattern [concrete] // CHECK:STDOUT: %return.patt.e4f: %pattern_type.b9f = return_slot_pattern %return.param_patt.f37, %FDifferentReturnType [concrete] -// CHECK:STDOUT: %FDifferentReturnType.as.J.impl.F.type.ff55f4.1: type = fn_type @FDifferentReturnType.as.J.impl.F.loc179_38.1 [concrete] +// CHECK:STDOUT: %FDifferentReturnType.as.J.impl.F.type.ff55f4.1: type = fn_type @FDifferentReturnType.as.J.impl.F.loc125_38.1 [concrete] // CHECK:STDOUT: %FDifferentReturnType.as.J.impl.F.9725a5.1: %FDifferentReturnType.as.J.impl.F.type.ff55f4.1 = struct_value () [concrete] // CHECK:STDOUT: %J.facet.6a7: %J.type = facet_value %FDifferentReturnType, (%J.impl_witness.6a4) [concrete] // CHECK:STDOUT: %J.WithSelf.F.type.b41: type = fn_type @J.WithSelf.F, @J.WithSelf(%J.facet.6a7) [concrete] // CHECK:STDOUT: %J.WithSelf.F.982: %J.WithSelf.F.type.b41 = struct_value () [concrete] -// CHECK:STDOUT: %FDifferentReturnType.as.J.impl.F.type.ff55f4.2: type = fn_type @FDifferentReturnType.as.J.impl.F.loc179_38.2 [concrete] +// CHECK:STDOUT: %FDifferentReturnType.as.J.impl.F.type.ff55f4.2: type = fn_type @FDifferentReturnType.as.J.impl.F.loc125_38.2 [concrete] // CHECK:STDOUT: %FDifferentReturnType.as.J.impl.F.9725a5.2: %FDifferentReturnType.as.J.impl.F.type.ff55f4.2 = struct_value () [concrete] // CHECK:STDOUT: %SelfNested.type: type = facet_type <@SelfNested> [concrete] // CHECK:STDOUT: %Self.e81: %SelfNested.type = symbolic_binding Self, 0 [symbolic] @@ -412,7 +348,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %pattern_type.ec1: type = pattern_type %Array.870 [concrete] // CHECK:STDOUT: %return.param_patt.8ed: %pattern_type.ec1 = out_param_pattern [concrete] // CHECK:STDOUT: %return.patt.21a: %pattern_type.ec1 = return_slot_pattern %return.param_patt.8ed, %Array.870 [concrete] -// CHECK:STDOUT: %SelfNestedBadParam.as.SelfNested.impl.F.type.4325e7.1: type = fn_type @SelfNestedBadParam.as.SelfNested.impl.F.loc196_87.1 [concrete] +// CHECK:STDOUT: %SelfNestedBadParam.as.SelfNested.impl.F.type.4325e7.1: type = fn_type @SelfNestedBadParam.as.SelfNested.impl.F.loc138_87.1 [concrete] // CHECK:STDOUT: %SelfNestedBadParam.as.SelfNested.impl.F.5fd896.1: %SelfNestedBadParam.as.SelfNested.impl.F.type.4325e7.1 = struct_value () [concrete] // CHECK:STDOUT: %SelfNested.facet.d0d: %SelfNested.type = facet_value %SelfNestedBadParam, (%SelfNested.impl_witness.09d) [concrete] // CHECK:STDOUT: %SelfNested.WithSelf.F.type.49e: type = fn_type @SelfNested.WithSelf.F, @SelfNested.WithSelf(%SelfNested.facet.d0d) [concrete] @@ -423,7 +359,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %pattern_type.1ec: type = pattern_type %tuple.type.5e1 [concrete] // CHECK:STDOUT: %x.param_patt.255: %pattern_type.1ec = value_param_pattern [concrete] // CHECK:STDOUT: %x.patt.79a: %pattern_type.1ec = wrapper_binding_pattern x, %x.param_patt.255 [concrete] -// CHECK:STDOUT: %SelfNestedBadParam.as.SelfNested.impl.F.type.4325e7.2: type = fn_type @SelfNestedBadParam.as.SelfNested.impl.F.loc196_87.2 [concrete] +// CHECK:STDOUT: %SelfNestedBadParam.as.SelfNested.impl.F.type.4325e7.2: type = fn_type @SelfNestedBadParam.as.SelfNested.impl.F.loc138_87.2 [concrete] // CHECK:STDOUT: %SelfNestedBadParam.as.SelfNested.impl.F.5fd896.2: %SelfNestedBadParam.as.SelfNested.impl.F.type.4325e7.2 = struct_value () [concrete] // CHECK:STDOUT: %ImplicitAs.type.6b0: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete] // CHECK:STDOUT: %ImplicitAs.assoc_type.4ac: type = assoc_entity_type @ImplicitAs, @ImplicitAs(%i32) [concrete] @@ -438,7 +374,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %pattern_type.7fc: type = pattern_type %tuple.type.dce [concrete] // CHECK:STDOUT: %x.param_patt.04c: %pattern_type.7fc = value_param_pattern [concrete] // CHECK:STDOUT: %x.patt.10a: %pattern_type.7fc = wrapper_binding_pattern x, %x.param_patt.04c [concrete] -// CHECK:STDOUT: %SelfNestedBadReturnType.as.SelfNested.impl.F.type.1cbabe.1: type = fn_type @SelfNestedBadReturnType.as.SelfNested.impl.F.loc212_112.1 [concrete] +// CHECK:STDOUT: %SelfNestedBadReturnType.as.SelfNested.impl.F.type.1cbabe.1: type = fn_type @SelfNestedBadReturnType.as.SelfNested.impl.F.loc148_112.1 [concrete] // CHECK:STDOUT: %SelfNestedBadReturnType.as.SelfNested.impl.F.5a7d54.1: %SelfNestedBadReturnType.as.SelfNested.impl.F.type.1cbabe.1 = struct_value () [concrete] // CHECK:STDOUT: %SelfNested.facet.e71: %SelfNested.type = facet_value %SelfNestedBadReturnType, (%SelfNested.impl_witness.849) [concrete] // CHECK:STDOUT: %SelfNested.WithSelf.F.type.369: type = fn_type @SelfNested.WithSelf.F, @SelfNested.WithSelf(%SelfNested.facet.e71) [concrete] @@ -448,7 +384,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %pattern_type.5b0: type = pattern_type %Array.ce4 [concrete] // CHECK:STDOUT: %return.param_patt.c20: %pattern_type.5b0 = out_param_pattern [concrete] // CHECK:STDOUT: %return.patt.02d: %pattern_type.5b0 = return_slot_pattern %return.param_patt.c20, %Array.ce4 [concrete] -// CHECK:STDOUT: %SelfNestedBadReturnType.as.SelfNested.impl.F.type.1cbabe.2: type = fn_type @SelfNestedBadReturnType.as.SelfNested.impl.F.loc212_112.2 [concrete] +// CHECK:STDOUT: %SelfNestedBadReturnType.as.SelfNested.impl.F.type.1cbabe.2: type = fn_type @SelfNestedBadReturnType.as.SelfNested.impl.F.loc148_112.2 [concrete] // CHECK:STDOUT: %SelfNestedBadReturnType.as.SelfNested.impl.F.5a7d54.2: %SelfNestedBadReturnType.as.SelfNested.impl.F.type.1cbabe.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -536,15 +472,15 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %b.param_patt: %pattern_type.831 = value_param_pattern [concrete = constants.%b.param_patt.792] // CHECK:STDOUT: %b.patt: %pattern_type.831 = wrapper_binding_pattern b, %b.param_patt [concrete = constants.%b.patt.d80] // CHECK:STDOUT: %return.param_patt: %pattern_type.831 = out_param_pattern [concrete = constants.%return.param_patt.5a1] -// CHECK:STDOUT: %return.patt: %pattern_type.831 = return_slot_pattern %return.param_patt, %.loc87_44.1 [concrete = constants.%return.patt.c0c] +// CHECK:STDOUT: %return.patt: %pattern_type.831 = return_slot_pattern %return.param_patt, %.loc63_44.1 [concrete = constants.%return.patt.c0c] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc87_44.1: type = type_literal bool [concrete = bool] -// CHECK:STDOUT: %.loc87_44.2: Core.Form = init_form %.loc87_44.1 [concrete = constants.%.f34] +// CHECK:STDOUT: %.loc63_44.1: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc63_44.2: Core.Form = init_form %.loc63_44.1 [concrete = constants.%.f34] // CHECK:STDOUT: %self.param: bool = value_param call_param0 -// CHECK:STDOUT: %.loc87_26: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc63_26: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %self: bool = wrapper_binding self, %self.param // CHECK:STDOUT: %b.param: bool = value_param call_param1 -// CHECK:STDOUT: %.loc87_35: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc63_35: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %b: bool = wrapper_binding b, %b.param // CHECK:STDOUT: %return.param: ref bool = out_param call_param2 // CHECK:STDOUT: %return: ref bool = return_slot %return.param @@ -565,34 +501,34 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: // CHECK:STDOUT: !with Self: // CHECK:STDOUT: %SelfNested.WithSelf.F.decl: @SelfNested.WithSelf.%SelfNested.WithSelf.F.type (%SelfNested.WithSelf.F.type.3a1) = fn_decl @SelfNested.WithSelf.F [symbolic = @SelfNested.WithSelf.%SelfNested.WithSelf.F (constants.%SelfNested.WithSelf.F.796)] { -// CHECK:STDOUT: %x.param_patt.loc184_9.1: @SelfNested.WithSelf.F.%pattern_type.loc184_9 (%pattern_type.871) = value_param_pattern [symbolic = %x.param_patt.loc184_9.2 (constants.%x.param_patt.8f6)] -// CHECK:STDOUT: %x.patt.loc184_9.1: @SelfNested.WithSelf.F.%pattern_type.loc184_9 (%pattern_type.871) = wrapper_binding_pattern x, %x.param_patt.loc184_9.1 [symbolic = %x.patt.loc184_9.2 (constants.%x.patt.48b)] -// CHECK:STDOUT: %return.param_patt.loc184_57.1: @SelfNested.WithSelf.F.%pattern_type.loc184_57 (%pattern_type.4a4) = out_param_pattern [symbolic = %return.param_patt.loc184_57.2 (constants.%return.param_patt.36b)] -// CHECK:STDOUT: %return.patt.loc184_41.1: @SelfNested.WithSelf.F.%pattern_type.loc184_57 (%pattern_type.4a4) = return_slot_pattern %return.param_patt.loc184_57.1, %Array.loc184_57.2 [symbolic = %return.patt.loc184_41.2 (constants.%return.patt.7a8)] +// CHECK:STDOUT: %x.param_patt.loc130_9.1: @SelfNested.WithSelf.F.%pattern_type.loc130_9 (%pattern_type.871) = value_param_pattern [symbolic = %x.param_patt.loc130_9.2 (constants.%x.param_patt.8f6)] +// CHECK:STDOUT: %x.patt.loc130_9.1: @SelfNested.WithSelf.F.%pattern_type.loc130_9 (%pattern_type.871) = wrapper_binding_pattern x, %x.param_patt.loc130_9.1 [symbolic = %x.patt.loc130_9.2 (constants.%x.patt.48b)] +// CHECK:STDOUT: %return.param_patt.loc130_57.1: @SelfNested.WithSelf.F.%pattern_type.loc130_57 (%pattern_type.4a4) = out_param_pattern [symbolic = %return.param_patt.loc130_57.2 (constants.%return.param_patt.36b)] +// CHECK:STDOUT: %return.patt.loc130_41.1: @SelfNested.WithSelf.F.%pattern_type.loc130_57 (%pattern_type.4a4) = return_slot_pattern %return.param_patt.loc130_57.1, %Array.loc130_57.2 [symbolic = %return.patt.loc130_41.2 (constants.%return.patt.7a8)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %Self.ref.loc184_50: %SelfNested.type = name_ref Self, @SelfNested.%Self [symbolic = %Self (constants.%Self.e81)] +// CHECK:STDOUT: %Self.ref.loc130_50: %SelfNested.type = name_ref Self, @SelfNested.%Self [symbolic = %Self (constants.%Self.e81)] // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4] -// CHECK:STDOUT: %Self.as_type.loc184_50: type = facet_access_type %Self.ref.loc184_50 [symbolic = %Self.as_type.loc184_16.1 (constants.%Self.as_type.8ab)] -// CHECK:STDOUT: %.loc184_50: type = converted %Self.ref.loc184_50, %Self.as_type.loc184_50 [symbolic = %Self.as_type.loc184_16.1 (constants.%Self.as_type.8ab)] -// CHECK:STDOUT: %Array.loc184_57.2: type = class_type @Array, @Array(constants.%Self.as_type.8ab, constants.%int_4) [symbolic = %Array.loc184_57.1 (constants.%Array.d32)] -// CHECK:STDOUT: %.loc184_57.2: Core.Form = init_form %Array.loc184_57.2 [symbolic = %.loc184_57.1 (constants.%.ec2)] +// CHECK:STDOUT: %Self.as_type.loc130_50: type = facet_access_type %Self.ref.loc130_50 [symbolic = %Self.as_type.loc130_16.1 (constants.%Self.as_type.8ab)] +// CHECK:STDOUT: %.loc130_50: type = converted %Self.ref.loc130_50, %Self.as_type.loc130_50 [symbolic = %Self.as_type.loc130_16.1 (constants.%Self.as_type.8ab)] +// CHECK:STDOUT: %Array.loc130_57.2: type = class_type @Array, @Array(constants.%Self.as_type.8ab, constants.%int_4) [symbolic = %Array.loc130_57.1 (constants.%Array.d32)] +// CHECK:STDOUT: %.loc130_57.2: Core.Form = init_form %Array.loc130_57.2 [symbolic = %.loc130_57.1 (constants.%.ec2)] // CHECK:STDOUT: %x.param: @SelfNested.WithSelf.F.%tuple.type (%tuple.type.684) = value_param call_param0 -// CHECK:STDOUT: %.loc184_38.1: type = splice_block %.loc184_38.3 [symbolic = %tuple.type (constants.%tuple.type.684)] { -// CHECK:STDOUT: %Self.ref.loc184_12: %SelfNested.type = name_ref Self, @SelfNested.%Self [symbolic = %Self (constants.%Self.e81)] -// CHECK:STDOUT: %Self.as_type.loc184_16.2: type = facet_access_type %Self.ref.loc184_12 [symbolic = %Self.as_type.loc184_16.1 (constants.%Self.as_type.8ab)] -// CHECK:STDOUT: %.loc184_16: type = converted %Self.ref.loc184_12, %Self.as_type.loc184_16.2 [symbolic = %Self.as_type.loc184_16.1 (constants.%Self.as_type.8ab)] -// CHECK:STDOUT: %ptr.loc184_16.2: type = ptr_type %.loc184_16 [symbolic = %ptr.loc184_16.1 (constants.%ptr.a16)] -// CHECK:STDOUT: %Self.ref.loc184_24: %SelfNested.type = name_ref Self, @SelfNested.%Self [symbolic = %Self (constants.%Self.e81)] -// CHECK:STDOUT: %Self.as_type.loc184_24: type = facet_access_type %Self.ref.loc184_24 [symbolic = %Self.as_type.loc184_16.1 (constants.%Self.as_type.8ab)] -// CHECK:STDOUT: %.loc184_24: type = converted %Self.ref.loc184_24, %Self.as_type.loc184_24 [symbolic = %Self.as_type.loc184_16.1 (constants.%Self.as_type.8ab)] +// CHECK:STDOUT: %.loc130_38.1: type = splice_block %.loc130_38.3 [symbolic = %tuple.type (constants.%tuple.type.684)] { +// CHECK:STDOUT: %Self.ref.loc130_12: %SelfNested.type = name_ref Self, @SelfNested.%Self [symbolic = %Self (constants.%Self.e81)] +// CHECK:STDOUT: %Self.as_type.loc130_16.2: type = facet_access_type %Self.ref.loc130_12 [symbolic = %Self.as_type.loc130_16.1 (constants.%Self.as_type.8ab)] +// CHECK:STDOUT: %.loc130_16: type = converted %Self.ref.loc130_12, %Self.as_type.loc130_16.2 [symbolic = %Self.as_type.loc130_16.1 (constants.%Self.as_type.8ab)] +// CHECK:STDOUT: %ptr.loc130_16.2: type = ptr_type %.loc130_16 [symbolic = %ptr.loc130_16.1 (constants.%ptr.a16)] +// CHECK:STDOUT: %Self.ref.loc130_24: %SelfNested.type = name_ref Self, @SelfNested.%Self [symbolic = %Self (constants.%Self.e81)] +// CHECK:STDOUT: %Self.as_type.loc130_24: type = facet_access_type %Self.ref.loc130_24 [symbolic = %Self.as_type.loc130_16.1 (constants.%Self.as_type.8ab)] +// CHECK:STDOUT: %.loc130_24: type = converted %Self.ref.loc130_24, %Self.as_type.loc130_24 [symbolic = %Self.as_type.loc130_16.1 (constants.%Self.as_type.8ab)] // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %struct_type.x.y.loc184_37.2: type = struct_type {.x: @SelfNested.WithSelf.F.%Self.as_type.loc184_16.1 (%Self.as_type.8ab), .y: %i32} [symbolic = %struct_type.x.y.loc184_37.1 (constants.%struct_type.x.y.34d)] -// CHECK:STDOUT: %.loc184_38.2: %tuple.type.693 = tuple_literal (%ptr.loc184_16.2, %struct_type.x.y.loc184_37.2) [symbolic = %tuple (constants.%tuple.ea4)] -// CHECK:STDOUT: %.loc184_38.3: type = converted %.loc184_38.2, constants.%tuple.type.684 [symbolic = %tuple.type (constants.%tuple.type.684)] +// CHECK:STDOUT: %struct_type.x.y.loc130_37.2: type = struct_type {.x: @SelfNested.WithSelf.F.%Self.as_type.loc130_16.1 (%Self.as_type.8ab), .y: %i32} [symbolic = %struct_type.x.y.loc130_37.1 (constants.%struct_type.x.y.34d)] +// CHECK:STDOUT: %.loc130_38.2: %tuple.type.693 = tuple_literal (%ptr.loc130_16.2, %struct_type.x.y.loc130_37.2) [symbolic = %tuple (constants.%tuple.ea4)] +// CHECK:STDOUT: %.loc130_38.3: type = converted %.loc130_38.2, constants.%tuple.type.684 [symbolic = %tuple.type (constants.%tuple.type.684)] // CHECK:STDOUT: } // CHECK:STDOUT: %x: @SelfNested.WithSelf.F.%tuple.type (%tuple.type.684) = wrapper_binding x, %x.param -// CHECK:STDOUT: %return.param: ref @SelfNested.WithSelf.F.%Array.loc184_57.1 (%Array.d32) = out_param call_param1 -// CHECK:STDOUT: %return: ref @SelfNested.WithSelf.F.%Array.loc184_57.1 (%Array.d32) = return_slot %return.param +// CHECK:STDOUT: %return.param: ref @SelfNested.WithSelf.F.%Array.loc130_57.1 (%Array.d32) = out_param call_param1 +// CHECK:STDOUT: %return: ref @SelfNested.WithSelf.F.%Array.loc130_57.1 (%Array.d32) = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %assoc0: %SelfNested.assoc_type = assoc_entity element0, %SelfNested.WithSelf.F.decl [concrete = constants.%assoc0.5a5] // CHECK:STDOUT: @@ -628,26 +564,26 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @FExtraParam.as.I.impl: %Self.ref as %I.ref { -// CHECK:STDOUT: %FExtraParam.as.I.impl.F.decl.loc53_18.1: %FExtraParam.as.I.impl.F.type.ec7b0b.1 = fn_decl @FExtraParam.as.I.impl.F.loc53_18.1 [concrete = constants.%FExtraParam.as.I.impl.F.ef9801.1] { +// CHECK:STDOUT: %FExtraParam.as.I.impl.F.decl.loc39_18.1: %FExtraParam.as.I.impl.F.type.ec7b0b.1 = fn_decl @FExtraParam.as.I.impl.F.loc39_18.1 [concrete = constants.%FExtraParam.as.I.impl.F.ef9801.1] { // CHECK:STDOUT: %b.param_patt: %pattern_type.831 = value_param_pattern [concrete = constants.%b.param_patt.792] // CHECK:STDOUT: %b.patt: %pattern_type.831 = wrapper_binding_pattern b, %b.param_patt [concrete = constants.%b.patt.d80] // CHECK:STDOUT: } { // CHECK:STDOUT: %b.param: bool = value_param call_param0 -// CHECK:STDOUT: %.loc53: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc39: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %b: bool = wrapper_binding b, %b.param // CHECK:STDOUT: } -// CHECK:STDOUT: %FExtraParam.as.I.impl.F.decl.loc53_18.2: %FExtraParam.as.I.impl.F.type.ec7b0b.2 = fn_decl @FExtraParam.as.I.impl.F.loc53_18.2 [concrete = constants.%FExtraParam.as.I.impl.F.ef9801.2] {} {} -// CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%FExtraParam.as.I.impl.F.decl.loc53_18.2), @FExtraParam.as.I.impl [concrete] +// CHECK:STDOUT: %FExtraParam.as.I.impl.F.decl.loc39_18.2: %FExtraParam.as.I.impl.F.type.ec7b0b.2 = fn_decl @FExtraParam.as.I.impl.F.loc39_18.2 [concrete = constants.%FExtraParam.as.I.impl.F.ef9801.2] {} {} +// CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%FExtraParam.as.I.impl.F.decl.loc39_18.2), @FExtraParam.as.I.impl [concrete] // CHECK:STDOUT: %I.impl_witness: = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness.0d1] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %FExtraParam.as.I.impl.F.decl.loc53_18.1 +// CHECK:STDOUT: .F = %FExtraParam.as.I.impl.F.decl.loc39_18.1 // CHECK:STDOUT: extend %I.ref // CHECK:STDOUT: witness = %I.impl_witness // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @FExtraImplicitParam.as.I.impl: %Self.ref as %I.ref { -// CHECK:STDOUT: %FExtraImplicitParam.as.I.impl.F.decl.loc69_15.1: %FExtraImplicitParam.as.I.impl.F.type.54cac2.1 = fn_decl @FExtraImplicitParam.as.I.impl.F.loc69_15.1 [concrete = constants.%FExtraImplicitParam.as.I.impl.F.a42f35.1] { +// CHECK:STDOUT: %FExtraImplicitParam.as.I.impl.F.decl.loc49_15.1: %FExtraImplicitParam.as.I.impl.F.type.54cac2.1 = fn_decl @FExtraImplicitParam.as.I.impl.F.loc49_15.1 [concrete = constants.%FExtraImplicitParam.as.I.impl.F.a42f35.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.54d = value_param_pattern [concrete = constants.%self.param_patt.f41] // CHECK:STDOUT: %self.patt: %pattern_type.54d = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.cca] // CHECK:STDOUT: } { @@ -655,12 +591,12 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FExtraImplicitParam [concrete = constants.%FExtraImplicitParam] // CHECK:STDOUT: %self: %FExtraImplicitParam = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %FExtraImplicitParam.as.I.impl.F.decl.loc69_15.2: %FExtraImplicitParam.as.I.impl.F.type.54cac2.2 = fn_decl @FExtraImplicitParam.as.I.impl.F.loc69_15.2 [concrete = constants.%FExtraImplicitParam.as.I.impl.F.a42f35.2] {} {} -// CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%FExtraImplicitParam.as.I.impl.F.decl.loc69_15.2), @FExtraImplicitParam.as.I.impl [concrete] +// CHECK:STDOUT: %FExtraImplicitParam.as.I.impl.F.decl.loc49_15.2: %FExtraImplicitParam.as.I.impl.F.type.54cac2.2 = fn_decl @FExtraImplicitParam.as.I.impl.F.loc49_15.2 [concrete = constants.%FExtraImplicitParam.as.I.impl.F.a42f35.2] {} {} +// CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%FExtraImplicitParam.as.I.impl.F.decl.loc49_15.2), @FExtraImplicitParam.as.I.impl [concrete] // CHECK:STDOUT: %I.impl_witness: = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness.989] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %FExtraImplicitParam.as.I.impl.F.decl.loc69_15.1 +// CHECK:STDOUT: .F = %FExtraImplicitParam.as.I.impl.F.decl.loc49_15.1 // CHECK:STDOUT: extend %I.ref // CHECK:STDOUT: witness = %I.impl_witness // CHECK:STDOUT: } @@ -668,10 +604,10 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: impl @FExtraReturnType.as.I.impl: %Self.ref as %I.ref { // CHECK:STDOUT: %FExtraReturnType.as.I.impl.F.decl: %FExtraReturnType.as.I.impl.F.type = fn_decl @FExtraReturnType.as.I.impl.F [concrete = constants.%FExtraReturnType.as.I.impl.F] { // CHECK:STDOUT: %return.param_patt: %pattern_type.831 = out_param_pattern [concrete = constants.%return.param_patt.5a1] -// CHECK:STDOUT: %return.patt: %pattern_type.831 = return_slot_pattern %return.param_patt, %.loc83_15.1 [concrete = constants.%return.patt.c0c] +// CHECK:STDOUT: %return.patt: %pattern_type.831 = return_slot_pattern %return.param_patt, %.loc59_15.1 [concrete = constants.%return.patt.c0c] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc83_15.1: type = type_literal bool [concrete = bool] -// CHECK:STDOUT: %.loc83_15.2: Core.Form = init_form %.loc83_15.1 [concrete = constants.%.f34] +// CHECK:STDOUT: %.loc59_15.1: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc59_15.2: Core.Form = init_form %.loc59_15.1 [concrete = constants.%.f34] // CHECK:STDOUT: %return.param: ref bool = out_param call_param0 // CHECK:STDOUT: %return: ref bool = return_slot %return.param // CHECK:STDOUT: } @@ -685,23 +621,23 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @FMissingParam.as.J.impl: %Self.ref as %J.ref { -// CHECK:STDOUT: %FMissingParam.as.J.impl.F.decl.loc101_29.1: %FMissingParam.as.J.impl.F.type.aad6ec.1 = fn_decl @FMissingParam.as.J.impl.F.loc101_29.1 [concrete = constants.%FMissingParam.as.J.impl.F.dd09dc.1] { +// CHECK:STDOUT: %FMissingParam.as.J.impl.F.decl.loc71_29.1: %FMissingParam.as.J.impl.F.type.aad6ec.1 = fn_decl @FMissingParam.as.J.impl.F.loc71_29.1 [concrete = constants.%FMissingParam.as.J.impl.F.dd09dc.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.831 = value_param_pattern [concrete = constants.%self.param_patt.210] // CHECK:STDOUT: %self.patt: %pattern_type.831 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.3a9] // CHECK:STDOUT: %return.param_patt: %pattern_type.831 = out_param_pattern [concrete = constants.%return.param_patt.5a1] -// CHECK:STDOUT: %return.patt: %pattern_type.831 = return_slot_pattern %return.param_patt, %.loc101_25.1 [concrete = constants.%return.patt.c0c] +// CHECK:STDOUT: %return.patt: %pattern_type.831 = return_slot_pattern %return.param_patt, %.loc71_25.1 [concrete = constants.%return.patt.c0c] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc101_25.1: type = type_literal bool [concrete = bool] -// CHECK:STDOUT: %.loc101_25.2: Core.Form = init_form %.loc101_25.1 [concrete = constants.%.f34] +// CHECK:STDOUT: %.loc71_25.1: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc71_25.2: Core.Form = init_form %.loc71_25.1 [concrete = constants.%.f34] // CHECK:STDOUT: %self.param: bool = value_param call_param0 -// CHECK:STDOUT: %.loc101_16: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc71_16: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %self: bool = wrapper_binding self, %self.param // CHECK:STDOUT: %return.param: ref bool = out_param call_param1 // CHECK:STDOUT: %return: ref bool = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc87_44.1: type = specific_constant @J.WithSelf.F.%.loc87_44.1, @J.WithSelf.F(constants.%J.facet.2a3) [concrete = bool] -// CHECK:STDOUT: %.loc87_44.2: Core.Form = specific_constant @J.WithSelf.F.%.loc87_44.2, @J.WithSelf.F(constants.%J.facet.2a3) [concrete = constants.%.f34] -// CHECK:STDOUT: %FMissingParam.as.J.impl.F.decl.loc101_29.2: %FMissingParam.as.J.impl.F.type.aad6ec.2 = fn_decl @FMissingParam.as.J.impl.F.loc101_29.2 [concrete = constants.%FMissingParam.as.J.impl.F.dd09dc.2] { +// CHECK:STDOUT: %.loc63_44.1: type = specific_constant @J.WithSelf.F.%.loc63_44.1, @J.WithSelf.F(constants.%J.facet.2a3) [concrete = bool] +// CHECK:STDOUT: %.loc63_44.2: Core.Form = specific_constant @J.WithSelf.F.%.loc63_44.2, @J.WithSelf.F(constants.%J.facet.2a3) [concrete = constants.%.f34] +// CHECK:STDOUT: %FMissingParam.as.J.impl.F.decl.loc71_29.2: %FMissingParam.as.J.impl.F.type.aad6ec.2 = fn_decl @FMissingParam.as.J.impl.F.loc71_29.2 [concrete = constants.%FMissingParam.as.J.impl.F.dd09dc.2] { // CHECK:STDOUT: %.1: %pattern_type.831 = specific_constant constants.%self.param_patt.210, @J.WithSelf.F(constants.%J.facet.2a3) [concrete = constants.%self.param_patt.210] // CHECK:STDOUT: %self.patt: %pattern_type.831 = wrapper_binding_pattern self, %.1 [concrete = constants.%self.patt.3a9] // CHECK:STDOUT: %.2: %pattern_type.831 = specific_constant constants.%b.param_patt.792, @J.WithSelf.F(constants.%J.facet.2a3) [concrete = constants.%b.param_patt.792] @@ -715,33 +651,33 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %return.param: ref bool = out_param call_param2 // CHECK:STDOUT: %return: ref bool = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (%FMissingParam.as.J.impl.F.decl.loc101_29.2), @FMissingParam.as.J.impl [concrete] +// CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (%FMissingParam.as.J.impl.F.decl.loc71_29.2), @FMissingParam.as.J.impl [concrete] // CHECK:STDOUT: %J.impl_witness: = impl_witness %J.impl_witness_table [concrete = constants.%J.impl_witness.24e] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %FMissingParam.as.J.impl.F.decl.loc101_29.1 +// CHECK:STDOUT: .F = %FMissingParam.as.J.impl.F.decl.loc71_29.1 // CHECK:STDOUT: extend %J.ref // CHECK:STDOUT: witness = %J.impl_witness // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @FMissingImplicitParam.as.J.impl: %Self.ref as %J.ref { -// CHECK:STDOUT: %FMissingImplicitParam.as.J.impl.F.decl.loc114_26.1: %FMissingImplicitParam.as.J.impl.F.type.f666a8.1 = fn_decl @FMissingImplicitParam.as.J.impl.F.loc114_26.1 [concrete = constants.%FMissingImplicitParam.as.J.impl.F.620ed1.1] { +// CHECK:STDOUT: %FMissingImplicitParam.as.J.impl.F.decl.loc80_26.1: %FMissingImplicitParam.as.J.impl.F.type.f666a8.1 = fn_decl @FMissingImplicitParam.as.J.impl.F.loc80_26.1 [concrete = constants.%FMissingImplicitParam.as.J.impl.F.620ed1.1] { // CHECK:STDOUT: %b.param_patt: %pattern_type.831 = value_param_pattern [concrete = constants.%b.param_patt.792] // CHECK:STDOUT: %b.patt: %pattern_type.831 = wrapper_binding_pattern b, %b.param_patt [concrete = constants.%b.patt.d80] // CHECK:STDOUT: %return.param_patt: %pattern_type.831 = out_param_pattern [concrete = constants.%return.param_patt.5a1] -// CHECK:STDOUT: %return.patt: %pattern_type.831 = return_slot_pattern %return.param_patt, %.loc114_22.1 [concrete = constants.%return.patt.c0c] +// CHECK:STDOUT: %return.patt: %pattern_type.831 = return_slot_pattern %return.param_patt, %.loc80_22.1 [concrete = constants.%return.patt.c0c] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc114_22.1: type = type_literal bool [concrete = bool] -// CHECK:STDOUT: %.loc114_22.2: Core.Form = init_form %.loc114_22.1 [concrete = constants.%.f34] +// CHECK:STDOUT: %.loc80_22.1: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc80_22.2: Core.Form = init_form %.loc80_22.1 [concrete = constants.%.f34] // CHECK:STDOUT: %b.param: bool = value_param call_param0 -// CHECK:STDOUT: %.loc114_13: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc80_13: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %b: bool = wrapper_binding b, %b.param // CHECK:STDOUT: %return.param: ref bool = out_param call_param1 // CHECK:STDOUT: %return: ref bool = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc87_44.1: type = specific_constant @J.WithSelf.F.%.loc87_44.1, @J.WithSelf.F(constants.%J.facet.ba1) [concrete = bool] -// CHECK:STDOUT: %.loc87_44.2: Core.Form = specific_constant @J.WithSelf.F.%.loc87_44.2, @J.WithSelf.F(constants.%J.facet.ba1) [concrete = constants.%.f34] -// CHECK:STDOUT: %FMissingImplicitParam.as.J.impl.F.decl.loc114_26.2: %FMissingImplicitParam.as.J.impl.F.type.f666a8.2 = fn_decl @FMissingImplicitParam.as.J.impl.F.loc114_26.2 [concrete = constants.%FMissingImplicitParam.as.J.impl.F.620ed1.2] { +// CHECK:STDOUT: %.loc63_44.1: type = specific_constant @J.WithSelf.F.%.loc63_44.1, @J.WithSelf.F(constants.%J.facet.ba1) [concrete = bool] +// CHECK:STDOUT: %.loc63_44.2: Core.Form = specific_constant @J.WithSelf.F.%.loc63_44.2, @J.WithSelf.F(constants.%J.facet.ba1) [concrete = constants.%.f34] +// CHECK:STDOUT: %FMissingImplicitParam.as.J.impl.F.decl.loc80_26.2: %FMissingImplicitParam.as.J.impl.F.type.f666a8.2 = fn_decl @FMissingImplicitParam.as.J.impl.F.loc80_26.2 [concrete = constants.%FMissingImplicitParam.as.J.impl.F.620ed1.2] { // CHECK:STDOUT: %.1: %pattern_type.831 = specific_constant constants.%self.param_patt.210, @J.WithSelf.F(constants.%J.facet.ba1) [concrete = constants.%self.param_patt.210] // CHECK:STDOUT: %self.patt: %pattern_type.831 = wrapper_binding_pattern self, %.1 [concrete = constants.%self.patt.3a9] // CHECK:STDOUT: %.2: %pattern_type.831 = specific_constant constants.%b.param_patt.792, @J.WithSelf.F(constants.%J.facet.ba1) [concrete = constants.%b.param_patt.792] @@ -755,32 +691,32 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %return.param: ref bool = out_param call_param2 // CHECK:STDOUT: %return: ref bool = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (%FMissingImplicitParam.as.J.impl.F.decl.loc114_26.2), @FMissingImplicitParam.as.J.impl [concrete] +// CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (%FMissingImplicitParam.as.J.impl.F.decl.loc80_26.2), @FMissingImplicitParam.as.J.impl [concrete] // CHECK:STDOUT: %J.impl_witness: = impl_witness %J.impl_witness_table [concrete = constants.%J.impl_witness.0d0] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %FMissingImplicitParam.as.J.impl.F.decl.loc114_26.1 +// CHECK:STDOUT: .F = %FMissingImplicitParam.as.J.impl.F.decl.loc80_26.1 // CHECK:STDOUT: extend %J.ref // CHECK:STDOUT: witness = %J.impl_witness // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @FMissingReturnType.as.J.impl: %Self.ref as %J.ref { -// CHECK:STDOUT: %FMissingReturnType.as.J.impl.F.decl.loc132_30.1: %FMissingReturnType.as.J.impl.F.type.9cd56a.1 = fn_decl @FMissingReturnType.as.J.impl.F.loc132_30.1 [concrete = constants.%FMissingReturnType.as.J.impl.F.6975be.1] { +// CHECK:STDOUT: %FMissingReturnType.as.J.impl.F.decl.loc92_30.1: %FMissingReturnType.as.J.impl.F.type.9cd56a.1 = fn_decl @FMissingReturnType.as.J.impl.F.loc92_30.1 [concrete = constants.%FMissingReturnType.as.J.impl.F.6975be.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.831 = value_param_pattern [concrete = constants.%self.param_patt.210] // CHECK:STDOUT: %self.patt: %pattern_type.831 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.3a9] // CHECK:STDOUT: %b.param_patt: %pattern_type.831 = value_param_pattern [concrete = constants.%b.param_patt.792] // CHECK:STDOUT: %b.patt: %pattern_type.831 = wrapper_binding_pattern b, %b.param_patt [concrete = constants.%b.patt.d80] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: bool = value_param call_param0 -// CHECK:STDOUT: %.loc132_16: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc92_16: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %self: bool = wrapper_binding self, %self.param // CHECK:STDOUT: %b.param: bool = value_param call_param1 -// CHECK:STDOUT: %.loc132_25: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc92_25: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %b: bool = wrapper_binding b, %b.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc87_44.1: type = specific_constant @J.WithSelf.F.%.loc87_44.1, @J.WithSelf.F(constants.%J.facet.b68) [concrete = bool] -// CHECK:STDOUT: %.loc87_44.2: Core.Form = specific_constant @J.WithSelf.F.%.loc87_44.2, @J.WithSelf.F(constants.%J.facet.b68) [concrete = constants.%.f34] -// CHECK:STDOUT: %FMissingReturnType.as.J.impl.F.decl.loc132_30.2: %FMissingReturnType.as.J.impl.F.type.9cd56a.2 = fn_decl @FMissingReturnType.as.J.impl.F.loc132_30.2 [concrete = constants.%FMissingReturnType.as.J.impl.F.6975be.2] { +// CHECK:STDOUT: %.loc63_44.1: type = specific_constant @J.WithSelf.F.%.loc63_44.1, @J.WithSelf.F(constants.%J.facet.b68) [concrete = bool] +// CHECK:STDOUT: %.loc63_44.2: Core.Form = specific_constant @J.WithSelf.F.%.loc63_44.2, @J.WithSelf.F(constants.%J.facet.b68) [concrete = constants.%.f34] +// CHECK:STDOUT: %FMissingReturnType.as.J.impl.F.decl.loc92_30.2: %FMissingReturnType.as.J.impl.F.type.9cd56a.2 = fn_decl @FMissingReturnType.as.J.impl.F.loc92_30.2 [concrete = constants.%FMissingReturnType.as.J.impl.F.6975be.2] { // CHECK:STDOUT: %.1: %pattern_type.831 = specific_constant constants.%self.param_patt.210, @J.WithSelf.F(constants.%J.facet.b68) [concrete = constants.%self.param_patt.210] // CHECK:STDOUT: %self.patt: %pattern_type.831 = wrapper_binding_pattern self, %.1 [concrete = constants.%self.patt.3a9] // CHECK:STDOUT: %.2: %pattern_type.831 = specific_constant constants.%b.param_patt.792, @J.WithSelf.F(constants.%J.facet.b68) [concrete = constants.%b.param_patt.792] @@ -794,28 +730,28 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %return.param: ref bool = out_param call_param2 // CHECK:STDOUT: %return: ref bool = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (%FMissingReturnType.as.J.impl.F.decl.loc132_30.2), @FMissingReturnType.as.J.impl [concrete] +// CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (%FMissingReturnType.as.J.impl.F.decl.loc92_30.2), @FMissingReturnType.as.J.impl [concrete] // CHECK:STDOUT: %J.impl_witness: = impl_witness %J.impl_witness_table [concrete = constants.%J.impl_witness.50a] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %FMissingReturnType.as.J.impl.F.decl.loc132_30.1 +// CHECK:STDOUT: .F = %FMissingReturnType.as.J.impl.F.decl.loc92_30.1 // CHECK:STDOUT: extend %J.ref // CHECK:STDOUT: witness = %J.impl_witness // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @FDifferentParamType.as.J.impl: %Self.ref as %J.ref { -// CHECK:STDOUT: %FDifferentParamType.as.J.impl.F.decl.loc147_38.1: %FDifferentParamType.as.J.impl.F.type.4a2e9b.1 = fn_decl @FDifferentParamType.as.J.impl.F.loc147_38.1 [concrete = constants.%FDifferentParamType.as.J.impl.F.28602a.1] { +// CHECK:STDOUT: %FDifferentParamType.as.J.impl.F.decl.loc103_38.1: %FDifferentParamType.as.J.impl.F.type.4a2e9b.1 = fn_decl @FDifferentParamType.as.J.impl.F.loc103_38.1 [concrete = constants.%FDifferentParamType.as.J.impl.F.28602a.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.831 = value_param_pattern [concrete = constants.%self.param_patt.210] // CHECK:STDOUT: %self.patt: %pattern_type.831 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.3a9] // CHECK:STDOUT: %b.param_patt: %pattern_type.5d3 = value_param_pattern [concrete = constants.%b.param_patt.0a8] // CHECK:STDOUT: %b.patt: %pattern_type.5d3 = wrapper_binding_pattern b, %b.param_patt [concrete = constants.%b.patt.f7e] // CHECK:STDOUT: %return.param_patt: %pattern_type.831 = out_param_pattern [concrete = constants.%return.param_patt.5a1] -// CHECK:STDOUT: %return.patt: %pattern_type.831 = return_slot_pattern %return.param_patt, %.loc147_34.1 [concrete = constants.%return.patt.c0c] +// CHECK:STDOUT: %return.patt: %pattern_type.831 = return_slot_pattern %return.param_patt, %.loc103_34.1 [concrete = constants.%return.patt.c0c] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc147_34.1: type = type_literal bool [concrete = bool] -// CHECK:STDOUT: %.loc147_34.2: Core.Form = init_form %.loc147_34.1 [concrete = constants.%.f34] +// CHECK:STDOUT: %.loc103_34.1: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc103_34.2: Core.Form = init_form %.loc103_34.1 [concrete = constants.%.f34] // CHECK:STDOUT: %self.param: bool = value_param call_param0 -// CHECK:STDOUT: %.loc147_16: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc103_16: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %self: bool = wrapper_binding self, %self.param // CHECK:STDOUT: %b.param: %FDifferentParamType = value_param call_param1 // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FDifferentParamType [concrete = constants.%FDifferentParamType] @@ -823,9 +759,9 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %return.param: ref bool = out_param call_param2 // CHECK:STDOUT: %return: ref bool = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc87_44.1: type = specific_constant @J.WithSelf.F.%.loc87_44.1, @J.WithSelf.F(constants.%J.facet.73e) [concrete = bool] -// CHECK:STDOUT: %.loc87_44.2: Core.Form = specific_constant @J.WithSelf.F.%.loc87_44.2, @J.WithSelf.F(constants.%J.facet.73e) [concrete = constants.%.f34] -// CHECK:STDOUT: %FDifferentParamType.as.J.impl.F.decl.loc147_38.2: %FDifferentParamType.as.J.impl.F.type.4a2e9b.2 = fn_decl @FDifferentParamType.as.J.impl.F.loc147_38.2 [concrete = constants.%FDifferentParamType.as.J.impl.F.28602a.2] { +// CHECK:STDOUT: %.loc63_44.1: type = specific_constant @J.WithSelf.F.%.loc63_44.1, @J.WithSelf.F(constants.%J.facet.73e) [concrete = bool] +// CHECK:STDOUT: %.loc63_44.2: Core.Form = specific_constant @J.WithSelf.F.%.loc63_44.2, @J.WithSelf.F(constants.%J.facet.73e) [concrete = constants.%.f34] +// CHECK:STDOUT: %FDifferentParamType.as.J.impl.F.decl.loc103_38.2: %FDifferentParamType.as.J.impl.F.type.4a2e9b.2 = fn_decl @FDifferentParamType.as.J.impl.F.loc103_38.2 [concrete = constants.%FDifferentParamType.as.J.impl.F.28602a.2] { // CHECK:STDOUT: %.1: %pattern_type.831 = specific_constant constants.%self.param_patt.210, @J.WithSelf.F(constants.%J.facet.73e) [concrete = constants.%self.param_patt.210] // CHECK:STDOUT: %self.patt: %pattern_type.831 = wrapper_binding_pattern self, %.1 [concrete = constants.%self.patt.3a9] // CHECK:STDOUT: %.2: %pattern_type.831 = specific_constant constants.%b.param_patt.792, @J.WithSelf.F(constants.%J.facet.73e) [concrete = constants.%b.param_patt.792] @@ -839,38 +775,38 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %return.param: ref bool = out_param call_param2 // CHECK:STDOUT: %return: ref bool = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (%FDifferentParamType.as.J.impl.F.decl.loc147_38.2), @FDifferentParamType.as.J.impl [concrete] +// CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (%FDifferentParamType.as.J.impl.F.decl.loc103_38.2), @FDifferentParamType.as.J.impl [concrete] // CHECK:STDOUT: %J.impl_witness: = impl_witness %J.impl_witness_table [concrete = constants.%J.impl_witness.9e2] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %FDifferentParamType.as.J.impl.F.decl.loc147_38.1 +// CHECK:STDOUT: .F = %FDifferentParamType.as.J.impl.F.decl.loc103_38.1 // CHECK:STDOUT: extend %J.ref // CHECK:STDOUT: witness = %J.impl_witness // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @FDifferentImplicitParamType.as.J.impl: %Self.ref as %J.ref { -// CHECK:STDOUT: %FDifferentImplicitParamType.as.J.impl.F.decl.loc160_32.1: %FDifferentImplicitParamType.as.J.impl.F.type.6ef8a6.1 = fn_decl @FDifferentImplicitParamType.as.J.impl.F.loc160_32.1 [concrete = constants.%FDifferentImplicitParamType.as.J.impl.F.792c78.1] { +// CHECK:STDOUT: %FDifferentImplicitParamType.as.J.impl.F.decl.loc112_32.1: %FDifferentImplicitParamType.as.J.impl.F.type.6ef8a6.1 = fn_decl @FDifferentImplicitParamType.as.J.impl.F.loc112_32.1 [concrete = constants.%FDifferentImplicitParamType.as.J.impl.F.792c78.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.1bc = value_param_pattern [concrete = constants.%self.param_patt.ea6] // CHECK:STDOUT: %self.patt: %pattern_type.1bc = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.85b] // CHECK:STDOUT: %b.param_patt: %pattern_type.831 = value_param_pattern [concrete = constants.%b.param_patt.792] // CHECK:STDOUT: %b.patt: %pattern_type.831 = wrapper_binding_pattern b, %b.param_patt [concrete = constants.%b.patt.d80] // CHECK:STDOUT: %return.param_patt: %pattern_type.831 = out_param_pattern [concrete = constants.%return.param_patt.5a1] -// CHECK:STDOUT: %return.patt: %pattern_type.831 = return_slot_pattern %return.param_patt, %.loc160_28.1 [concrete = constants.%return.patt.c0c] +// CHECK:STDOUT: %return.patt: %pattern_type.831 = return_slot_pattern %return.param_patt, %.loc112_28.1 [concrete = constants.%return.patt.c0c] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc160_28.1: type = type_literal bool [concrete = bool] -// CHECK:STDOUT: %.loc160_28.2: Core.Form = init_form %.loc160_28.1 [concrete = constants.%.f34] +// CHECK:STDOUT: %.loc112_28.1: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc112_28.2: Core.Form = init_form %.loc112_28.1 [concrete = constants.%.f34] // CHECK:STDOUT: %self.param: %FDifferentImplicitParamType = value_param call_param0 // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FDifferentImplicitParamType [concrete = constants.%FDifferentImplicitParamType] // CHECK:STDOUT: %self: %FDifferentImplicitParamType = wrapper_binding self, %self.param // CHECK:STDOUT: %b.param: bool = value_param call_param1 -// CHECK:STDOUT: %.loc160_19: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc112_19: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %b: bool = wrapper_binding b, %b.param // CHECK:STDOUT: %return.param: ref bool = out_param call_param2 // CHECK:STDOUT: %return: ref bool = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc87_44.1: type = specific_constant @J.WithSelf.F.%.loc87_44.1, @J.WithSelf.F(constants.%J.facet.00a) [concrete = bool] -// CHECK:STDOUT: %.loc87_44.2: Core.Form = specific_constant @J.WithSelf.F.%.loc87_44.2, @J.WithSelf.F(constants.%J.facet.00a) [concrete = constants.%.f34] -// CHECK:STDOUT: %FDifferentImplicitParamType.as.J.impl.F.decl.loc160_32.2: %FDifferentImplicitParamType.as.J.impl.F.type.6ef8a6.2 = fn_decl @FDifferentImplicitParamType.as.J.impl.F.loc160_32.2 [concrete = constants.%FDifferentImplicitParamType.as.J.impl.F.792c78.2] { +// CHECK:STDOUT: %.loc63_44.1: type = specific_constant @J.WithSelf.F.%.loc63_44.1, @J.WithSelf.F(constants.%J.facet.00a) [concrete = bool] +// CHECK:STDOUT: %.loc63_44.2: Core.Form = specific_constant @J.WithSelf.F.%.loc63_44.2, @J.WithSelf.F(constants.%J.facet.00a) [concrete = constants.%.f34] +// CHECK:STDOUT: %FDifferentImplicitParamType.as.J.impl.F.decl.loc112_32.2: %FDifferentImplicitParamType.as.J.impl.F.type.6ef8a6.2 = fn_decl @FDifferentImplicitParamType.as.J.impl.F.loc112_32.2 [concrete = constants.%FDifferentImplicitParamType.as.J.impl.F.792c78.2] { // CHECK:STDOUT: %.1: %pattern_type.831 = specific_constant constants.%self.param_patt.210, @J.WithSelf.F(constants.%J.facet.00a) [concrete = constants.%self.param_patt.210] // CHECK:STDOUT: %self.patt: %pattern_type.831 = wrapper_binding_pattern self, %.1 [concrete = constants.%self.patt.3a9] // CHECK:STDOUT: %.2: %pattern_type.831 = specific_constant constants.%b.param_patt.792, @J.WithSelf.F(constants.%J.facet.00a) [concrete = constants.%b.param_patt.792] @@ -884,17 +820,17 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %return.param: ref bool = out_param call_param2 // CHECK:STDOUT: %return: ref bool = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (%FDifferentImplicitParamType.as.J.impl.F.decl.loc160_32.2), @FDifferentImplicitParamType.as.J.impl [concrete] +// CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (%FDifferentImplicitParamType.as.J.impl.F.decl.loc112_32.2), @FDifferentImplicitParamType.as.J.impl [concrete] // CHECK:STDOUT: %J.impl_witness: = impl_witness %J.impl_witness_table [concrete = constants.%J.impl_witness.d1a] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %FDifferentImplicitParamType.as.J.impl.F.decl.loc160_32.1 +// CHECK:STDOUT: .F = %FDifferentImplicitParamType.as.J.impl.F.decl.loc112_32.1 // CHECK:STDOUT: extend %J.ref // CHECK:STDOUT: witness = %J.impl_witness // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @FDifferentReturnType.as.J.impl: %Self.ref as %J.ref { -// CHECK:STDOUT: %FDifferentReturnType.as.J.impl.F.decl.loc179_38.1: %FDifferentReturnType.as.J.impl.F.type.ff55f4.1 = fn_decl @FDifferentReturnType.as.J.impl.F.loc179_38.1 [concrete = constants.%FDifferentReturnType.as.J.impl.F.9725a5.1] { +// CHECK:STDOUT: %FDifferentReturnType.as.J.impl.F.decl.loc125_38.1: %FDifferentReturnType.as.J.impl.F.type.ff55f4.1 = fn_decl @FDifferentReturnType.as.J.impl.F.loc125_38.1 [concrete = constants.%FDifferentReturnType.as.J.impl.F.9725a5.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.831 = value_param_pattern [concrete = constants.%self.param_patt.210] // CHECK:STDOUT: %self.patt: %pattern_type.831 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.3a9] // CHECK:STDOUT: %b.param_patt: %pattern_type.831 = value_param_pattern [concrete = constants.%b.param_patt.792] @@ -903,19 +839,19 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %return.patt: %pattern_type.b9f = return_slot_pattern %return.param_patt, %Self.ref [concrete = constants.%return.patt.e4f] // CHECK:STDOUT: } { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FDifferentReturnType [concrete = constants.%FDifferentReturnType] -// CHECK:STDOUT: %.loc179_34: Core.Form = init_form %Self.ref [concrete = constants.%.1f5] +// CHECK:STDOUT: %.loc125_34: Core.Form = init_form %Self.ref [concrete = constants.%.1f5] // CHECK:STDOUT: %self.param: bool = value_param call_param0 -// CHECK:STDOUT: %.loc179_16: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc125_16: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %self: bool = wrapper_binding self, %self.param // CHECK:STDOUT: %b.param: bool = value_param call_param1 -// CHECK:STDOUT: %.loc179_25: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc125_25: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %b: bool = wrapper_binding b, %b.param // CHECK:STDOUT: %return.param: ref %FDifferentReturnType = out_param call_param2 // CHECK:STDOUT: %return: ref %FDifferentReturnType = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc87_44.1: type = specific_constant @J.WithSelf.F.%.loc87_44.1, @J.WithSelf.F(constants.%J.facet.6a7) [concrete = bool] -// CHECK:STDOUT: %.loc87_44.2: Core.Form = specific_constant @J.WithSelf.F.%.loc87_44.2, @J.WithSelf.F(constants.%J.facet.6a7) [concrete = constants.%.f34] -// CHECK:STDOUT: %FDifferentReturnType.as.J.impl.F.decl.loc179_38.2: %FDifferentReturnType.as.J.impl.F.type.ff55f4.2 = fn_decl @FDifferentReturnType.as.J.impl.F.loc179_38.2 [concrete = constants.%FDifferentReturnType.as.J.impl.F.9725a5.2] { +// CHECK:STDOUT: %.loc63_44.1: type = specific_constant @J.WithSelf.F.%.loc63_44.1, @J.WithSelf.F(constants.%J.facet.6a7) [concrete = bool] +// CHECK:STDOUT: %.loc63_44.2: Core.Form = specific_constant @J.WithSelf.F.%.loc63_44.2, @J.WithSelf.F(constants.%J.facet.6a7) [concrete = constants.%.f34] +// CHECK:STDOUT: %FDifferentReturnType.as.J.impl.F.decl.loc125_38.2: %FDifferentReturnType.as.J.impl.F.type.ff55f4.2 = fn_decl @FDifferentReturnType.as.J.impl.F.loc125_38.2 [concrete = constants.%FDifferentReturnType.as.J.impl.F.9725a5.2] { // CHECK:STDOUT: %.1: %pattern_type.831 = specific_constant constants.%self.param_patt.210, @J.WithSelf.F(constants.%J.facet.6a7) [concrete = constants.%self.param_patt.210] // CHECK:STDOUT: %self.patt: %pattern_type.831 = wrapper_binding_pattern self, %.1 [concrete = constants.%self.patt.3a9] // CHECK:STDOUT: %.2: %pattern_type.831 = specific_constant constants.%b.param_patt.792, @J.WithSelf.F(constants.%J.facet.6a7) [concrete = constants.%b.param_patt.792] @@ -929,43 +865,43 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %return.param: ref bool = out_param call_param2 // CHECK:STDOUT: %return: ref bool = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (%FDifferentReturnType.as.J.impl.F.decl.loc179_38.2), @FDifferentReturnType.as.J.impl [concrete] +// CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (%FDifferentReturnType.as.J.impl.F.decl.loc125_38.2), @FDifferentReturnType.as.J.impl [concrete] // CHECK:STDOUT: %J.impl_witness: = impl_witness %J.impl_witness_table [concrete = constants.%J.impl_witness.6a4] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %FDifferentReturnType.as.J.impl.F.decl.loc179_38.1 +// CHECK:STDOUT: .F = %FDifferentReturnType.as.J.impl.F.decl.loc125_38.1 // CHECK:STDOUT: extend %J.ref // CHECK:STDOUT: witness = %J.impl_witness // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @SelfNestedBadParam.as.SelfNested.impl: %Self.ref as %SelfNested.ref { -// CHECK:STDOUT: %SelfNestedBadParam.as.SelfNested.impl.F.decl.loc196_87.1: %SelfNestedBadParam.as.SelfNested.impl.F.type.4325e7.1 = fn_decl @SelfNestedBadParam.as.SelfNested.impl.F.loc196_87.1 [concrete = constants.%SelfNestedBadParam.as.SelfNested.impl.F.5fd896.1] { +// CHECK:STDOUT: %SelfNestedBadParam.as.SelfNested.impl.F.decl.loc138_87.1: %SelfNestedBadParam.as.SelfNested.impl.F.type.4325e7.1 = fn_decl @SelfNestedBadParam.as.SelfNested.impl.F.loc138_87.1 [concrete = constants.%SelfNestedBadParam.as.SelfNested.impl.F.5fd896.1] { // CHECK:STDOUT: %x.param_patt: %pattern_type.f03 = value_param_pattern [concrete = constants.%x.param_patt.95a] // CHECK:STDOUT: %x.patt: %pattern_type.f03 = wrapper_binding_pattern x, %x.param_patt [concrete = constants.%x.patt.23c] // CHECK:STDOUT: %return.param_patt: %pattern_type.ec1 = out_param_pattern [concrete = constants.%return.param_patt.8ed] // CHECK:STDOUT: %return.patt: %pattern_type.ec1 = return_slot_pattern %return.param_patt, %Array [concrete = constants.%return.patt.21a] // CHECK:STDOUT: } { -// CHECK:STDOUT: %SelfNestedBadParam.ref.loc196_65: type = name_ref SelfNestedBadParam, file.%SelfNestedBadParam.decl [concrete = constants.%SelfNestedBadParam] +// CHECK:STDOUT: %SelfNestedBadParam.ref.loc138_65: type = name_ref SelfNestedBadParam, file.%SelfNestedBadParam.decl [concrete = constants.%SelfNestedBadParam] // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4] // CHECK:STDOUT: %Array: type = class_type @Array, @Array(constants.%SelfNestedBadParam, constants.%int_4) [concrete = constants.%Array.870] -// CHECK:STDOUT: %.loc196_86: Core.Form = init_form %Array [concrete = constants.%.a71] +// CHECK:STDOUT: %.loc138_86: Core.Form = init_form %Array [concrete = constants.%.a71] // CHECK:STDOUT: %x.param: %tuple.type.f65 = value_param call_param0 -// CHECK:STDOUT: %.loc196_53.1: type = splice_block %.loc196_53.3 [concrete = constants.%tuple.type.f65] { -// CHECK:STDOUT: %SelfNestedBadParam.ref.loc196_14: type = name_ref SelfNestedBadParam, file.%SelfNestedBadParam.decl [concrete = constants.%SelfNestedBadParam] -// CHECK:STDOUT: %ptr: type = ptr_type %SelfNestedBadParam.ref.loc196_14 [concrete = constants.%ptr.52e] -// CHECK:STDOUT: %i32.loc196_40: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %i32.loc196_49: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc138_53.1: type = splice_block %.loc138_53.3 [concrete = constants.%tuple.type.f65] { +// CHECK:STDOUT: %SelfNestedBadParam.ref.loc138_14: type = name_ref SelfNestedBadParam, file.%SelfNestedBadParam.decl [concrete = constants.%SelfNestedBadParam] +// CHECK:STDOUT: %ptr: type = ptr_type %SelfNestedBadParam.ref.loc138_14 [concrete = constants.%ptr.52e] +// CHECK:STDOUT: %i32.loc138_40: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc138_49: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.x.y: type = struct_type {.x: %i32, .y: %i32} [concrete = constants.%struct_type.x.y.d8c] -// CHECK:STDOUT: %.loc196_53.2: %tuple.type.693 = tuple_literal (%ptr, %struct_type.x.y) [concrete = constants.%tuple.60a] -// CHECK:STDOUT: %.loc196_53.3: type = converted %.loc196_53.2, constants.%tuple.type.f65 [concrete = constants.%tuple.type.f65] +// CHECK:STDOUT: %.loc138_53.2: %tuple.type.693 = tuple_literal (%ptr, %struct_type.x.y) [concrete = constants.%tuple.60a] +// CHECK:STDOUT: %.loc138_53.3: type = converted %.loc138_53.2, constants.%tuple.type.f65 [concrete = constants.%tuple.type.f65] // CHECK:STDOUT: } // CHECK:STDOUT: %x: %tuple.type.f65 = wrapper_binding x, %x.param // CHECK:STDOUT: %return.param: ref %Array.870 = out_param call_param1 // CHECK:STDOUT: %return: ref %Array.870 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc184_57.1: type = specific_constant @SelfNested.WithSelf.F.%Array.loc184_57.2, @SelfNested.WithSelf.F(constants.%SelfNested.facet.d0d) [concrete = constants.%Array.870] -// CHECK:STDOUT: %.loc184_57.2: Core.Form = specific_constant @SelfNested.WithSelf.F.%.loc184_57.2, @SelfNested.WithSelf.F(constants.%SelfNested.facet.d0d) [concrete = constants.%.a71] -// CHECK:STDOUT: %SelfNestedBadParam.as.SelfNested.impl.F.decl.loc196_87.2: %SelfNestedBadParam.as.SelfNested.impl.F.type.4325e7.2 = fn_decl @SelfNestedBadParam.as.SelfNested.impl.F.loc196_87.2 [concrete = constants.%SelfNestedBadParam.as.SelfNested.impl.F.5fd896.2] { +// CHECK:STDOUT: %.loc130_57.1: type = specific_constant @SelfNested.WithSelf.F.%Array.loc130_57.2, @SelfNested.WithSelf.F(constants.%SelfNested.facet.d0d) [concrete = constants.%Array.870] +// CHECK:STDOUT: %.loc130_57.2: Core.Form = specific_constant @SelfNested.WithSelf.F.%.loc130_57.2, @SelfNested.WithSelf.F(constants.%SelfNested.facet.d0d) [concrete = constants.%.a71] +// CHECK:STDOUT: %SelfNestedBadParam.as.SelfNested.impl.F.decl.loc138_87.2: %SelfNestedBadParam.as.SelfNested.impl.F.type.4325e7.2 = fn_decl @SelfNestedBadParam.as.SelfNested.impl.F.loc138_87.2 [concrete = constants.%SelfNestedBadParam.as.SelfNested.impl.F.5fd896.2] { // CHECK:STDOUT: %.1: %pattern_type.1ec = specific_constant constants.%x.param_patt.255, @SelfNested.WithSelf.F(constants.%SelfNested.facet.d0d) [concrete = constants.%x.param_patt.255] // CHECK:STDOUT: %x.patt: %pattern_type.1ec = wrapper_binding_pattern x, %.1 [concrete = constants.%x.patt.79a] // CHECK:STDOUT: %.2: %pattern_type.ec1 = specific_constant constants.%return.patt.21a, @SelfNested.WithSelf.F(constants.%SelfNested.facet.d0d) [concrete = constants.%return.patt.21a] @@ -975,18 +911,18 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %return.param: ref %Array.870 = out_param call_param1 // CHECK:STDOUT: %return: ref %Array.870 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %SelfNested.impl_witness_table = impl_witness_table (%SelfNestedBadParam.as.SelfNested.impl.F.decl.loc196_87.2), @SelfNestedBadParam.as.SelfNested.impl [concrete] +// CHECK:STDOUT: %SelfNested.impl_witness_table = impl_witness_table (%SelfNestedBadParam.as.SelfNested.impl.F.decl.loc138_87.2), @SelfNestedBadParam.as.SelfNested.impl [concrete] // CHECK:STDOUT: %SelfNested.impl_witness: = impl_witness %SelfNested.impl_witness_table [concrete = constants.%SelfNested.impl_witness.09d] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .SelfNestedBadParam = -// CHECK:STDOUT: .F = %SelfNestedBadParam.as.SelfNested.impl.F.decl.loc196_87.1 +// CHECK:STDOUT: .F = %SelfNestedBadParam.as.SelfNested.impl.F.decl.loc138_87.1 // CHECK:STDOUT: extend %SelfNested.ref // CHECK:STDOUT: witness = %SelfNested.impl_witness // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @SelfNestedBadReturnType.as.SelfNested.impl: %Self.ref as %SelfNested.ref { -// CHECK:STDOUT: %SelfNestedBadReturnType.as.SelfNested.impl.F.decl.loc212_112.1: %SelfNestedBadReturnType.as.SelfNested.impl.F.type.1cbabe.1 = fn_decl @SelfNestedBadReturnType.as.SelfNested.impl.F.loc212_112.1 [concrete = constants.%SelfNestedBadReturnType.as.SelfNested.impl.F.5a7d54.1] { +// CHECK:STDOUT: %SelfNestedBadReturnType.as.SelfNested.impl.F.decl.loc148_112.1: %SelfNestedBadReturnType.as.SelfNested.impl.F.type.1cbabe.1 = fn_decl @SelfNestedBadReturnType.as.SelfNested.impl.F.loc148_112.1 [concrete = constants.%SelfNestedBadReturnType.as.SelfNested.impl.F.5a7d54.1] { // CHECK:STDOUT: %x.param_patt: %pattern_type.7fc = value_param_pattern [concrete = constants.%x.param_patt.04c] // CHECK:STDOUT: %x.patt: %pattern_type.7fc = wrapper_binding_pattern x, %x.param_patt [concrete = constants.%x.patt.10a] // CHECK:STDOUT: %return.param_patt: %pattern_type.ec1 = out_param_pattern [concrete = constants.%return.param_patt.8ed] @@ -995,24 +931,24 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %SelfNestedBadParam.ref: type = name_ref SelfNestedBadParam, file.%SelfNestedBadParam.decl [concrete = constants.%SelfNestedBadParam] // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4] // CHECK:STDOUT: %Array: type = class_type @Array, @Array(constants.%SelfNestedBadParam, constants.%int_4) [concrete = constants.%Array.870] -// CHECK:STDOUT: %.loc212_111: Core.Form = init_form %Array [concrete = constants.%.a71] +// CHECK:STDOUT: %.loc148_111: Core.Form = init_form %Array [concrete = constants.%.a71] // CHECK:STDOUT: %x.param: %tuple.type.dce = value_param call_param0 -// CHECK:STDOUT: %.loc212_78.1: type = splice_block %.loc212_78.3 [concrete = constants.%tuple.type.dce] { -// CHECK:STDOUT: %SelfNestedBadReturnType.ref.loc212_14: type = name_ref SelfNestedBadReturnType, file.%SelfNestedBadReturnType.decl [concrete = constants.%SelfNestedBadReturnType] -// CHECK:STDOUT: %ptr: type = ptr_type %SelfNestedBadReturnType.ref.loc212_14 [concrete = constants.%ptr.f55] -// CHECK:STDOUT: %SelfNestedBadReturnType.ref.loc212_45: type = name_ref SelfNestedBadReturnType, file.%SelfNestedBadReturnType.decl [concrete = constants.%SelfNestedBadReturnType] +// CHECK:STDOUT: %.loc148_78.1: type = splice_block %.loc148_78.3 [concrete = constants.%tuple.type.dce] { +// CHECK:STDOUT: %SelfNestedBadReturnType.ref.loc148_14: type = name_ref SelfNestedBadReturnType, file.%SelfNestedBadReturnType.decl [concrete = constants.%SelfNestedBadReturnType] +// CHECK:STDOUT: %ptr: type = ptr_type %SelfNestedBadReturnType.ref.loc148_14 [concrete = constants.%ptr.f55] +// CHECK:STDOUT: %SelfNestedBadReturnType.ref.loc148_45: type = name_ref SelfNestedBadReturnType, file.%SelfNestedBadReturnType.decl [concrete = constants.%SelfNestedBadReturnType] // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.x.y: type = struct_type {.x: %SelfNestedBadReturnType, .y: %i32} [concrete = constants.%struct_type.x.y.03e] -// CHECK:STDOUT: %.loc212_78.2: %tuple.type.693 = tuple_literal (%ptr, %struct_type.x.y) [concrete = constants.%tuple.ef1] -// CHECK:STDOUT: %.loc212_78.3: type = converted %.loc212_78.2, constants.%tuple.type.dce [concrete = constants.%tuple.type.dce] +// CHECK:STDOUT: %.loc148_78.2: %tuple.type.693 = tuple_literal (%ptr, %struct_type.x.y) [concrete = constants.%tuple.ef1] +// CHECK:STDOUT: %.loc148_78.3: type = converted %.loc148_78.2, constants.%tuple.type.dce [concrete = constants.%tuple.type.dce] // CHECK:STDOUT: } // CHECK:STDOUT: %x: %tuple.type.dce = wrapper_binding x, %x.param // CHECK:STDOUT: %return.param: ref %Array.870 = out_param call_param1 // CHECK:STDOUT: %return: ref %Array.870 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc184_57.1: type = specific_constant @SelfNested.WithSelf.F.%Array.loc184_57.2, @SelfNested.WithSelf.F(constants.%SelfNested.facet.e71) [concrete = constants.%Array.ce4] -// CHECK:STDOUT: %.loc184_57.2: Core.Form = specific_constant @SelfNested.WithSelf.F.%.loc184_57.2, @SelfNested.WithSelf.F(constants.%SelfNested.facet.e71) [concrete = constants.%.069] -// CHECK:STDOUT: %SelfNestedBadReturnType.as.SelfNested.impl.F.decl.loc212_112.2: %SelfNestedBadReturnType.as.SelfNested.impl.F.type.1cbabe.2 = fn_decl @SelfNestedBadReturnType.as.SelfNested.impl.F.loc212_112.2 [concrete = constants.%SelfNestedBadReturnType.as.SelfNested.impl.F.5a7d54.2] { +// CHECK:STDOUT: %.loc130_57.1: type = specific_constant @SelfNested.WithSelf.F.%Array.loc130_57.2, @SelfNested.WithSelf.F(constants.%SelfNested.facet.e71) [concrete = constants.%Array.ce4] +// CHECK:STDOUT: %.loc130_57.2: Core.Form = specific_constant @SelfNested.WithSelf.F.%.loc130_57.2, @SelfNested.WithSelf.F(constants.%SelfNested.facet.e71) [concrete = constants.%.069] +// CHECK:STDOUT: %SelfNestedBadReturnType.as.SelfNested.impl.F.decl.loc148_112.2: %SelfNestedBadReturnType.as.SelfNested.impl.F.type.1cbabe.2 = fn_decl @SelfNestedBadReturnType.as.SelfNested.impl.F.loc148_112.2 [concrete = constants.%SelfNestedBadReturnType.as.SelfNested.impl.F.5a7d54.2] { // CHECK:STDOUT: %.1: %pattern_type.7fc = specific_constant constants.%x.param_patt.04c, @SelfNested.WithSelf.F(constants.%SelfNested.facet.e71) [concrete = constants.%x.param_patt.04c] // CHECK:STDOUT: %x.patt: %pattern_type.7fc = wrapper_binding_pattern x, %.1 [concrete = constants.%x.patt.10a] // CHECK:STDOUT: %.2: %pattern_type.5b0 = specific_constant constants.%return.patt.02d, @SelfNested.WithSelf.F(constants.%SelfNested.facet.e71) [concrete = constants.%return.patt.02d] @@ -1022,13 +958,13 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %return.param: ref %Array.ce4 = out_param call_param1 // CHECK:STDOUT: %return: ref %Array.ce4 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %SelfNested.impl_witness_table = impl_witness_table (%SelfNestedBadReturnType.as.SelfNested.impl.F.decl.loc212_112.2), @SelfNestedBadReturnType.as.SelfNested.impl [concrete] +// CHECK:STDOUT: %SelfNested.impl_witness_table = impl_witness_table (%SelfNestedBadReturnType.as.SelfNested.impl.F.decl.loc148_112.2), @SelfNestedBadReturnType.as.SelfNested.impl [concrete] // CHECK:STDOUT: %SelfNested.impl_witness: = impl_witness %SelfNested.impl_witness_table [concrete = constants.%SelfNested.impl_witness.849] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .SelfNestedBadReturnType = // CHECK:STDOUT: .SelfNestedBadParam = -// CHECK:STDOUT: .F = %SelfNestedBadReturnType.as.SelfNested.impl.F.decl.loc212_112.1 +// CHECK:STDOUT: .F = %SelfNestedBadReturnType.as.SelfNested.impl.F.decl.loc148_112.1 // CHECK:STDOUT: extend %SelfNested.ref // CHECK:STDOUT: witness = %SelfNested.impl_witness // CHECK:STDOUT: } @@ -1038,7 +974,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%NoF [concrete = constants.%NoF] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc25: = impl_self_witness @NoF.as.I.impl.%Self.ref, @I [concrete = constants.%.6c7] +// CHECK:STDOUT: %.loc21: = impl_self_witness @NoF.as.I.impl.%Self.ref, @I [concrete = constants.%.6c7] // 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: @@ -1052,7 +988,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FNotFunction [concrete = constants.%FNotFunction] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc29: = impl_self_witness @FNotFunction.as.I.impl.%Self.ref, @I [concrete = constants.%.d4c] +// CHECK:STDOUT: %.loc25: = impl_self_witness @FNotFunction.as.I.impl.%Self.ref, @I [concrete = constants.%.d4c] // 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: @@ -1068,7 +1004,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FExtraParam [concrete = constants.%FExtraParam] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc42: = impl_self_witness @FExtraParam.as.I.impl.%Self.ref, @I [concrete = constants.%.44b] +// CHECK:STDOUT: %.loc34: = impl_self_witness @FExtraParam.as.I.impl.%Self.ref, @I [concrete = constants.%.44b] // 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: @@ -1082,7 +1018,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FExtraImplicitParam [concrete = constants.%FExtraImplicitParam] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc58: = impl_self_witness @FExtraImplicitParam.as.I.impl.%Self.ref, @I [concrete = constants.%.77c] +// CHECK:STDOUT: %.loc44: = impl_self_witness @FExtraImplicitParam.as.I.impl.%Self.ref, @I [concrete = constants.%.77c] // 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: @@ -1096,7 +1032,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FExtraReturnType [concrete = constants.%FExtraReturnType] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc75: = impl_self_witness @FExtraReturnType.as.I.impl.%Self.ref, @I [concrete = constants.%.ebd] +// CHECK:STDOUT: %.loc55: = impl_self_witness @FExtraReturnType.as.I.impl.%Self.ref, @I [concrete = constants.%.ebd] // 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: @@ -1110,7 +1046,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FMissingParam [concrete = constants.%FMissingParam] // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc90: = impl_self_witness @FMissingParam.as.J.impl.%Self.ref, @J [concrete = constants.%.599] +// CHECK:STDOUT: %.loc66: = impl_self_witness @FMissingParam.as.J.impl.%Self.ref, @J [concrete = constants.%.599] // 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: @@ -1124,7 +1060,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FMissingImplicitParam [concrete = constants.%FMissingImplicitParam] // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc106: = impl_self_witness @FMissingImplicitParam.as.J.impl.%Self.ref, @J [concrete = constants.%.f79] +// CHECK:STDOUT: %.loc76: = impl_self_witness @FMissingImplicitParam.as.J.impl.%Self.ref, @J [concrete = constants.%.f79] // 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: @@ -1138,7 +1074,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FMissingReturnType [concrete = constants.%FMissingReturnType] // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc119: = impl_self_witness @FMissingReturnType.as.J.impl.%Self.ref, @J [concrete = constants.%.199] +// CHECK:STDOUT: %.loc85: = impl_self_witness @FMissingReturnType.as.J.impl.%Self.ref, @J [concrete = constants.%.199] // 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: @@ -1152,7 +1088,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FDifferentParamType [concrete = constants.%FDifferentParamType] // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc137: = impl_self_witness @FDifferentParamType.as.J.impl.%Self.ref, @J [concrete = constants.%.593] +// CHECK:STDOUT: %.loc97: = impl_self_witness @FDifferentParamType.as.J.impl.%Self.ref, @J [concrete = constants.%.593] // 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: @@ -1166,7 +1102,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FDifferentImplicitParamType [concrete = constants.%FDifferentImplicitParamType] // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc152: = impl_self_witness @FDifferentImplicitParamType.as.J.impl.%Self.ref, @J [concrete = constants.%.46c] +// CHECK:STDOUT: %.loc108: = impl_self_witness @FDifferentImplicitParamType.as.J.impl.%Self.ref, @J [concrete = constants.%.46c] // 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: @@ -1180,7 +1116,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FDifferentReturnType [concrete = constants.%FDifferentReturnType] // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc165: = impl_self_witness @FDifferentReturnType.as.J.impl.%Self.ref, @J [concrete = constants.%.ce7] +// CHECK:STDOUT: %.loc117: = impl_self_witness @FDifferentReturnType.as.J.impl.%Self.ref, @J [concrete = constants.%.ce7] // 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: @@ -1194,7 +1130,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%SelfNestedBadParam [concrete = constants.%SelfNestedBadParam] // CHECK:STDOUT: %SelfNested.ref: type = name_ref SelfNested, file.%SelfNested.decl [concrete = constants.%SelfNested.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc188: = impl_self_witness @SelfNestedBadParam.as.SelfNested.impl.%Self.ref, @SelfNested [concrete = constants.%.83b] +// CHECK:STDOUT: %.loc134: = impl_self_witness @SelfNestedBadParam.as.SelfNested.impl.%Self.ref, @SelfNested [concrete = constants.%.83b] // 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: @@ -1209,7 +1145,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%SelfNestedBadReturnType [concrete = constants.%SelfNestedBadReturnType] // CHECK:STDOUT: %SelfNested.ref: type = name_ref SelfNested, file.%SelfNested.decl [concrete = constants.%SelfNested.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc201: = impl_self_witness @SelfNestedBadReturnType.as.SelfNested.impl.%Self.ref, @SelfNested [concrete = constants.%.020] +// CHECK:STDOUT: %.loc143: = impl_self_witness @SelfNestedBadReturnType.as.SelfNested.impl.%Self.ref, @SelfNested [concrete = constants.%.020] // 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: @@ -1224,19 +1160,19 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: fn(); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @FExtraParam.as.I.impl.F.loc53_18.1(%b.param: bool); +// CHECK:STDOUT: fn @FExtraParam.as.I.impl.F.loc39_18.1(%b.param: bool); // CHECK:STDOUT: -// CHECK:STDOUT: fn @FExtraParam.as.I.impl.F.loc53_18.2() [thunk @FExtraParam.as.I.impl.%FExtraParam.as.I.impl.F.decl.loc53_18.1 for @I.WithSelf.%I.WithSelf.F.decl, @I.WithSelf.F(constants.%I.facet.476)] { +// CHECK:STDOUT: fn @FExtraParam.as.I.impl.F.loc39_18.2() [thunk @FExtraParam.as.I.impl.%FExtraParam.as.I.impl.F.decl.loc39_18.1 for @I.WithSelf.%I.WithSelf.F.decl, @I.WithSelf.F(constants.%I.facet.476)] { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: %FExtraParam.as.I.impl.F.type.ec7b0b.1 = name_ref F, @FExtraParam.as.I.impl.%FExtraParam.as.I.impl.F.decl.loc53_18.1 [concrete = constants.%FExtraParam.as.I.impl.F.ef9801.1] +// CHECK:STDOUT: %F.ref: %FExtraParam.as.I.impl.F.type.ec7b0b.1 = name_ref F, @FExtraParam.as.I.impl.%FExtraParam.as.I.impl.F.decl.loc39_18.1 [concrete = constants.%FExtraParam.as.I.impl.F.ef9801.1] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @FExtraImplicitParam.as.I.impl.F.loc69_15.1(%self.param: %FExtraImplicitParam); +// CHECK:STDOUT: fn @FExtraImplicitParam.as.I.impl.F.loc49_15.1(%self.param: %FExtraImplicitParam); // CHECK:STDOUT: -// CHECK:STDOUT: fn @FExtraImplicitParam.as.I.impl.F.loc69_15.2() [thunk @FExtraImplicitParam.as.I.impl.%FExtraImplicitParam.as.I.impl.F.decl.loc69_15.1 for @I.WithSelf.%I.WithSelf.F.decl, @I.WithSelf.F(constants.%I.facet.7ed)] { +// CHECK:STDOUT: fn @FExtraImplicitParam.as.I.impl.F.loc49_15.2() [thunk @FExtraImplicitParam.as.I.impl.%FExtraImplicitParam.as.I.impl.F.decl.loc49_15.1 for @I.WithSelf.%I.WithSelf.F.decl, @I.WithSelf.F(constants.%I.facet.7ed)] { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: %FExtraImplicitParam.as.I.impl.F.type.54cac2.1 = name_ref F, @FExtraImplicitParam.as.I.impl.%FExtraImplicitParam.as.I.impl.F.decl.loc69_15.1 [concrete = constants.%FExtraImplicitParam.as.I.impl.F.a42f35.1] +// CHECK:STDOUT: %F.ref: %FExtraImplicitParam.as.I.impl.F.type.54cac2.1 = name_ref F, @FExtraImplicitParam.as.I.impl.%FExtraImplicitParam.as.I.impl.F.decl.loc49_15.1 [concrete = constants.%FExtraImplicitParam.as.I.impl.F.a42f35.1] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1246,40 +1182,40 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: fn(%self.param: bool, %b.param: bool) -> out %return.param: bool; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @FMissingParam.as.J.impl.F.loc101_29.1(%self.param: bool) -> out %return.param: bool; +// CHECK:STDOUT: fn @FMissingParam.as.J.impl.F.loc71_29.1(%self.param: bool) -> out %return.param: bool; // CHECK:STDOUT: -// CHECK:STDOUT: fn @FMissingParam.as.J.impl.F.loc101_29.2(%self.param: bool, %b.param: bool) -> out %return.param: bool [thunk @FMissingParam.as.J.impl.%FMissingParam.as.J.impl.F.decl.loc101_29.1 for @J.WithSelf.%J.WithSelf.F.decl, @J.WithSelf.F(constants.%J.facet.2a3)] { +// CHECK:STDOUT: fn @FMissingParam.as.J.impl.F.loc71_29.2(%self.param: bool, %b.param: bool) -> out %return.param: bool [thunk @FMissingParam.as.J.impl.%FMissingParam.as.J.impl.F.decl.loc71_29.1 for @J.WithSelf.%J.WithSelf.F.decl, @J.WithSelf.F(constants.%J.facet.2a3)] { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: %FMissingParam.as.J.impl.F.type.aad6ec.1 = name_ref F, @FMissingParam.as.J.impl.%FMissingParam.as.J.impl.F.decl.loc101_29.1 [concrete = constants.%FMissingParam.as.J.impl.F.dd09dc.1] +// CHECK:STDOUT: %F.ref: %FMissingParam.as.J.impl.F.type.aad6ec.1 = name_ref F, @FMissingParam.as.J.impl.%FMissingParam.as.J.impl.F.decl.loc71_29.1 [concrete = constants.%FMissingParam.as.J.impl.F.dd09dc.1] // CHECK:STDOUT: %FMissingParam.as.J.impl.F.bound: = bound_method %self.param, %F.ref // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @FMissingImplicitParam.as.J.impl.F.loc114_26.1(%b.param: bool) -> out %return.param: bool; +// CHECK:STDOUT: fn @FMissingImplicitParam.as.J.impl.F.loc80_26.1(%b.param: bool) -> out %return.param: bool; // CHECK:STDOUT: -// CHECK:STDOUT: fn @FMissingImplicitParam.as.J.impl.F.loc114_26.2(%self.param: bool, %b.param: bool) -> out %return.param: bool [thunk @FMissingImplicitParam.as.J.impl.%FMissingImplicitParam.as.J.impl.F.decl.loc114_26.1 for @J.WithSelf.%J.WithSelf.F.decl, @J.WithSelf.F(constants.%J.facet.ba1)] { +// CHECK:STDOUT: fn @FMissingImplicitParam.as.J.impl.F.loc80_26.2(%self.param: bool, %b.param: bool) -> out %return.param: bool [thunk @FMissingImplicitParam.as.J.impl.%FMissingImplicitParam.as.J.impl.F.decl.loc80_26.1 for @J.WithSelf.%J.WithSelf.F.decl, @J.WithSelf.F(constants.%J.facet.ba1)] { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: %FMissingImplicitParam.as.J.impl.F.type.f666a8.1 = name_ref F, @FMissingImplicitParam.as.J.impl.%FMissingImplicitParam.as.J.impl.F.decl.loc114_26.1 [concrete = constants.%FMissingImplicitParam.as.J.impl.F.620ed1.1] +// CHECK:STDOUT: %F.ref: %FMissingImplicitParam.as.J.impl.F.type.f666a8.1 = name_ref F, @FMissingImplicitParam.as.J.impl.%FMissingImplicitParam.as.J.impl.F.decl.loc80_26.1 [concrete = constants.%FMissingImplicitParam.as.J.impl.F.620ed1.1] // CHECK:STDOUT: %FMissingImplicitParam.as.J.impl.F.call: init bool = call %F.ref(%b.param) // CHECK:STDOUT: return %FMissingImplicitParam.as.J.impl.F.call // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @FMissingReturnType.as.J.impl.F.loc132_30.1(%self.param: bool, %b.param: bool); +// CHECK:STDOUT: fn @FMissingReturnType.as.J.impl.F.loc92_30.1(%self.param: bool, %b.param: bool); // CHECK:STDOUT: -// CHECK:STDOUT: fn @FMissingReturnType.as.J.impl.F.loc132_30.2(%self.param: bool, %b.param: bool) -> out %return.param: bool [thunk @FMissingReturnType.as.J.impl.%FMissingReturnType.as.J.impl.F.decl.loc132_30.1 for @J.WithSelf.%J.WithSelf.F.decl, @J.WithSelf.F(constants.%J.facet.b68)] { +// CHECK:STDOUT: fn @FMissingReturnType.as.J.impl.F.loc92_30.2(%self.param: bool, %b.param: bool) -> out %return.param: bool [thunk @FMissingReturnType.as.J.impl.%FMissingReturnType.as.J.impl.F.decl.loc92_30.1 for @J.WithSelf.%J.WithSelf.F.decl, @J.WithSelf.F(constants.%J.facet.b68)] { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: %FMissingReturnType.as.J.impl.F.type.9cd56a.1 = name_ref F, @FMissingReturnType.as.J.impl.%FMissingReturnType.as.J.impl.F.decl.loc132_30.1 [concrete = constants.%FMissingReturnType.as.J.impl.F.6975be.1] +// CHECK:STDOUT: %F.ref: %FMissingReturnType.as.J.impl.F.type.9cd56a.1 = name_ref F, @FMissingReturnType.as.J.impl.%FMissingReturnType.as.J.impl.F.decl.loc92_30.1 [concrete = constants.%FMissingReturnType.as.J.impl.F.6975be.1] // CHECK:STDOUT: %FMissingReturnType.as.J.impl.F.bound: = bound_method %self.param, %F.ref // CHECK:STDOUT: %FMissingReturnType.as.J.impl.F.call: init %empty_tuple.type = call %FMissingReturnType.as.J.impl.F.bound(%self.param, %b.param) -// CHECK:STDOUT: %.loc132: bool = converted %FMissingReturnType.as.J.impl.F.call, [concrete = ] +// CHECK:STDOUT: %.loc92: bool = converted %FMissingReturnType.as.J.impl.F.call, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @FDifferentParamType.as.J.impl.F.loc147_38.1(%self.param: bool, %b.param: %FDifferentParamType) -> out %return.param: bool; +// CHECK:STDOUT: fn @FDifferentParamType.as.J.impl.F.loc103_38.1(%self.param: bool, %b.param: %FDifferentParamType) -> out %return.param: bool; // CHECK:STDOUT: -// CHECK:STDOUT: fn @FDifferentParamType.as.J.impl.F.loc147_38.2(%self.param: bool, %b.param: bool) -> out %return.param: bool [thunk @FDifferentParamType.as.J.impl.%FDifferentParamType.as.J.impl.F.decl.loc147_38.1 for @J.WithSelf.%J.WithSelf.F.decl, @J.WithSelf.F(constants.%J.facet.73e)] { +// CHECK:STDOUT: fn @FDifferentParamType.as.J.impl.F.loc103_38.2(%self.param: bool, %b.param: bool) -> out %return.param: bool [thunk @FDifferentParamType.as.J.impl.%FDifferentParamType.as.J.impl.F.decl.loc103_38.1 for @J.WithSelf.%J.WithSelf.F.decl, @J.WithSelf.F(constants.%J.facet.73e)] { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: %FDifferentParamType.as.J.impl.F.type.4a2e9b.1 = name_ref F, @FDifferentParamType.as.J.impl.%FDifferentParamType.as.J.impl.F.decl.loc147_38.1 [concrete = constants.%FDifferentParamType.as.J.impl.F.28602a.1] +// CHECK:STDOUT: %F.ref: %FDifferentParamType.as.J.impl.F.type.4a2e9b.1 = name_ref F, @FDifferentParamType.as.J.impl.%FDifferentParamType.as.J.impl.F.decl.loc103_38.1 [concrete = constants.%FDifferentParamType.as.J.impl.F.28602a.1] // CHECK:STDOUT: %FDifferentParamType.as.J.impl.F.bound: = bound_method %self.param, %F.ref // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%FDifferentParamType)> [concrete = constants.%ImplicitAs.type.85e] // CHECK:STDOUT: %.4: %ImplicitAs.assoc_type.a99 = specific_constant imports.%Core.import_ref.383, @ImplicitAs.WithSelf(constants.%FDifferentParamType, constants.%Self.862) [concrete = constants.%assoc0.8f3] @@ -1289,11 +1225,11 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: return %FDifferentParamType.as.J.impl.F.call // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @FDifferentImplicitParamType.as.J.impl.F.loc160_32.1(%self.param: %FDifferentImplicitParamType, %b.param: bool) -> out %return.param: bool; +// CHECK:STDOUT: fn @FDifferentImplicitParamType.as.J.impl.F.loc112_32.1(%self.param: %FDifferentImplicitParamType, %b.param: bool) -> out %return.param: bool; // CHECK:STDOUT: -// CHECK:STDOUT: fn @FDifferentImplicitParamType.as.J.impl.F.loc160_32.2(%self.param: bool, %b.param: bool) -> out %return.param: bool [thunk @FDifferentImplicitParamType.as.J.impl.%FDifferentImplicitParamType.as.J.impl.F.decl.loc160_32.1 for @J.WithSelf.%J.WithSelf.F.decl, @J.WithSelf.F(constants.%J.facet.00a)] { +// CHECK:STDOUT: fn @FDifferentImplicitParamType.as.J.impl.F.loc112_32.2(%self.param: bool, %b.param: bool) -> out %return.param: bool [thunk @FDifferentImplicitParamType.as.J.impl.%FDifferentImplicitParamType.as.J.impl.F.decl.loc112_32.1 for @J.WithSelf.%J.WithSelf.F.decl, @J.WithSelf.F(constants.%J.facet.00a)] { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: %FDifferentImplicitParamType.as.J.impl.F.type.6ef8a6.1 = name_ref F, @FDifferentImplicitParamType.as.J.impl.%FDifferentImplicitParamType.as.J.impl.F.decl.loc160_32.1 [concrete = constants.%FDifferentImplicitParamType.as.J.impl.F.792c78.1] +// CHECK:STDOUT: %F.ref: %FDifferentImplicitParamType.as.J.impl.F.type.6ef8a6.1 = name_ref F, @FDifferentImplicitParamType.as.J.impl.%FDifferentImplicitParamType.as.J.impl.F.decl.loc112_32.1 [concrete = constants.%FDifferentImplicitParamType.as.J.impl.F.792c78.1] // CHECK:STDOUT: %FDifferentImplicitParamType.as.J.impl.F.bound: = bound_method %self.param, %F.ref // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%FDifferentImplicitParamType)> [concrete = constants.%ImplicitAs.type.444] // CHECK:STDOUT: %.4: %ImplicitAs.assoc_type.884 = specific_constant imports.%Core.import_ref.383, @ImplicitAs.WithSelf(constants.%FDifferentImplicitParamType, constants.%Self.862) [concrete = constants.%assoc0.cb0] @@ -1303,42 +1239,42 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: return %FDifferentImplicitParamType.as.J.impl.F.call // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @FDifferentReturnType.as.J.impl.F.loc179_38.1(%self.param: bool, %b.param: bool) -> out %return.param: %FDifferentReturnType; +// CHECK:STDOUT: fn @FDifferentReturnType.as.J.impl.F.loc125_38.1(%self.param: bool, %b.param: bool) -> out %return.param: %FDifferentReturnType; // CHECK:STDOUT: -// CHECK:STDOUT: fn @FDifferentReturnType.as.J.impl.F.loc179_38.2(%self.param: bool, %b.param: bool) -> out %return.param: bool [thunk @FDifferentReturnType.as.J.impl.%FDifferentReturnType.as.J.impl.F.decl.loc179_38.1 for @J.WithSelf.%J.WithSelf.F.decl, @J.WithSelf.F(constants.%J.facet.6a7)] { +// CHECK:STDOUT: fn @FDifferentReturnType.as.J.impl.F.loc125_38.2(%self.param: bool, %b.param: bool) -> out %return.param: bool [thunk @FDifferentReturnType.as.J.impl.%FDifferentReturnType.as.J.impl.F.decl.loc125_38.1 for @J.WithSelf.%J.WithSelf.F.decl, @J.WithSelf.F(constants.%J.facet.6a7)] { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: %FDifferentReturnType.as.J.impl.F.type.ff55f4.1 = name_ref F, @FDifferentReturnType.as.J.impl.%FDifferentReturnType.as.J.impl.F.decl.loc179_38.1 [concrete = constants.%FDifferentReturnType.as.J.impl.F.9725a5.1] +// CHECK:STDOUT: %F.ref: %FDifferentReturnType.as.J.impl.F.type.ff55f4.1 = name_ref F, @FDifferentReturnType.as.J.impl.%FDifferentReturnType.as.J.impl.F.decl.loc125_38.1 [concrete = constants.%FDifferentReturnType.as.J.impl.F.9725a5.1] // CHECK:STDOUT: %FDifferentReturnType.as.J.impl.F.bound: = bound_method %self.param, %F.ref -// CHECK:STDOUT: %.loc179_38.1: ref %FDifferentReturnType = temporary_storage -// CHECK:STDOUT: %FDifferentReturnType.as.J.impl.F.call: init %FDifferentReturnType to %.loc179_38.1 = call %FDifferentReturnType.as.J.impl.F.bound(%self.param, %b.param) -// CHECK:STDOUT: %.loc179_38.2: bool = converted %FDifferentReturnType.as.J.impl.F.call, [concrete = ] +// CHECK:STDOUT: %.loc125_38.1: ref %FDifferentReturnType = temporary_storage +// CHECK:STDOUT: %FDifferentReturnType.as.J.impl.F.call: init %FDifferentReturnType to %.loc125_38.1 = call %FDifferentReturnType.as.J.impl.F.bound(%self.param, %b.param) +// CHECK:STDOUT: %.loc125_38.2: bool = converted %FDifferentReturnType.as.J.impl.F.call, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @SelfNested.WithSelf.F(@SelfNested.%Self: %SelfNested.type) { // CHECK:STDOUT: %Self: %SelfNested.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.e81)] -// CHECK:STDOUT: %Self.as_type.loc184_16.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc184_16.1 (constants.%Self.as_type.8ab)] -// CHECK:STDOUT: %ptr.loc184_16.1: type = ptr_type %Self.as_type.loc184_16.1 [symbolic = %ptr.loc184_16.1 (constants.%ptr.a16)] -// CHECK:STDOUT: %struct_type.x.y.loc184_37.1: type = struct_type {.x: @SelfNested.WithSelf.F.%Self.as_type.loc184_16.1 (%Self.as_type.8ab), .y: %i32} [symbolic = %struct_type.x.y.loc184_37.1 (constants.%struct_type.x.y.34d)] -// CHECK:STDOUT: %tuple: %tuple.type.693 = tuple_value (%ptr.loc184_16.1, %struct_type.x.y.loc184_37.1) [symbolic = %tuple (constants.%tuple.ea4)] -// CHECK:STDOUT: %tuple.type: type = tuple_type (%ptr.loc184_16.1, %struct_type.x.y.loc184_37.1) [symbolic = %tuple.type (constants.%tuple.type.684)] -// CHECK:STDOUT: %pattern_type.loc184_9: type = pattern_type %tuple.type [symbolic = %pattern_type.loc184_9 (constants.%pattern_type.871)] -// CHECK:STDOUT: %x.param_patt.loc184_9.2: @SelfNested.WithSelf.F.%pattern_type.loc184_9 (%pattern_type.871) = value_param_pattern [symbolic = %x.param_patt.loc184_9.2 (constants.%x.param_patt.8f6)] -// CHECK:STDOUT: %x.patt.loc184_9.2: @SelfNested.WithSelf.F.%pattern_type.loc184_9 (%pattern_type.871) = wrapper_binding_pattern x, %x.param_patt.loc184_9.2 [symbolic = %x.patt.loc184_9.2 (constants.%x.patt.48b)] -// CHECK:STDOUT: %Array.loc184_57.1: type = class_type @Array, @Array(%Self.as_type.loc184_16.1, constants.%int_4) [symbolic = %Array.loc184_57.1 (constants.%Array.d32)] -// CHECK:STDOUT: %.loc184_57.1: Core.Form = init_form %Array.loc184_57.1 [symbolic = %.loc184_57.1 (constants.%.ec2)] -// CHECK:STDOUT: %pattern_type.loc184_57: type = pattern_type %Array.loc184_57.1 [symbolic = %pattern_type.loc184_57 (constants.%pattern_type.4a4)] -// CHECK:STDOUT: %return.param_patt.loc184_57.2: @SelfNested.WithSelf.F.%pattern_type.loc184_57 (%pattern_type.4a4) = out_param_pattern [symbolic = %return.param_patt.loc184_57.2 (constants.%return.param_patt.36b)] -// CHECK:STDOUT: %return.patt.loc184_41.2: @SelfNested.WithSelf.F.%pattern_type.loc184_57 (%pattern_type.4a4) = return_slot_pattern %return.param_patt.loc184_57.2, %Array.loc184_57.1 [symbolic = %return.patt.loc184_41.2 (constants.%return.patt.7a8)] +// CHECK:STDOUT: %Self.as_type.loc130_16.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc130_16.1 (constants.%Self.as_type.8ab)] +// CHECK:STDOUT: %ptr.loc130_16.1: type = ptr_type %Self.as_type.loc130_16.1 [symbolic = %ptr.loc130_16.1 (constants.%ptr.a16)] +// CHECK:STDOUT: %struct_type.x.y.loc130_37.1: type = struct_type {.x: @SelfNested.WithSelf.F.%Self.as_type.loc130_16.1 (%Self.as_type.8ab), .y: %i32} [symbolic = %struct_type.x.y.loc130_37.1 (constants.%struct_type.x.y.34d)] +// CHECK:STDOUT: %tuple: %tuple.type.693 = tuple_value (%ptr.loc130_16.1, %struct_type.x.y.loc130_37.1) [symbolic = %tuple (constants.%tuple.ea4)] +// CHECK:STDOUT: %tuple.type: type = tuple_type (%ptr.loc130_16.1, %struct_type.x.y.loc130_37.1) [symbolic = %tuple.type (constants.%tuple.type.684)] +// CHECK:STDOUT: %pattern_type.loc130_9: type = pattern_type %tuple.type [symbolic = %pattern_type.loc130_9 (constants.%pattern_type.871)] +// CHECK:STDOUT: %x.param_patt.loc130_9.2: @SelfNested.WithSelf.F.%pattern_type.loc130_9 (%pattern_type.871) = value_param_pattern [symbolic = %x.param_patt.loc130_9.2 (constants.%x.param_patt.8f6)] +// CHECK:STDOUT: %x.patt.loc130_9.2: @SelfNested.WithSelf.F.%pattern_type.loc130_9 (%pattern_type.871) = wrapper_binding_pattern x, %x.param_patt.loc130_9.2 [symbolic = %x.patt.loc130_9.2 (constants.%x.patt.48b)] +// CHECK:STDOUT: %Array.loc130_57.1: type = class_type @Array, @Array(%Self.as_type.loc130_16.1, constants.%int_4) [symbolic = %Array.loc130_57.1 (constants.%Array.d32)] +// CHECK:STDOUT: %.loc130_57.1: Core.Form = init_form %Array.loc130_57.1 [symbolic = %.loc130_57.1 (constants.%.ec2)] +// CHECK:STDOUT: %pattern_type.loc130_57: type = pattern_type %Array.loc130_57.1 [symbolic = %pattern_type.loc130_57 (constants.%pattern_type.4a4)] +// CHECK:STDOUT: %return.param_patt.loc130_57.2: @SelfNested.WithSelf.F.%pattern_type.loc130_57 (%pattern_type.4a4) = out_param_pattern [symbolic = %return.param_patt.loc130_57.2 (constants.%return.param_patt.36b)] +// CHECK:STDOUT: %return.patt.loc130_41.2: @SelfNested.WithSelf.F.%pattern_type.loc130_57 (%pattern_type.4a4) = return_slot_pattern %return.param_patt.loc130_57.2, %Array.loc130_57.1 [symbolic = %return.patt.loc130_41.2 (constants.%return.patt.7a8)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%x.param: @SelfNested.WithSelf.F.%tuple.type (%tuple.type.684)) -> out %return.param: @SelfNested.WithSelf.F.%Array.loc184_57.1 (%Array.d32); +// CHECK:STDOUT: fn(%x.param: @SelfNested.WithSelf.F.%tuple.type (%tuple.type.684)) -> out %return.param: @SelfNested.WithSelf.F.%Array.loc130_57.1 (%Array.d32); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SelfNestedBadParam.as.SelfNested.impl.F.loc196_87.1(%x.param: %tuple.type.f65) -> out %return.param: %Array.870; +// CHECK:STDOUT: fn @SelfNestedBadParam.as.SelfNested.impl.F.loc138_87.1(%x.param: %tuple.type.f65) -> out %return.param: %Array.870; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SelfNestedBadParam.as.SelfNested.impl.F.loc196_87.2(%x.param: %tuple.type.5e1) -> out %return.param: %Array.870 [thunk @SelfNestedBadParam.as.SelfNested.impl.%SelfNestedBadParam.as.SelfNested.impl.F.decl.loc196_87.1 for @SelfNested.WithSelf.%SelfNested.WithSelf.F.decl, @SelfNested.WithSelf.F(constants.%SelfNested.facet.d0d)] { +// CHECK:STDOUT: fn @SelfNestedBadParam.as.SelfNested.impl.F.loc138_87.2(%x.param: %tuple.type.5e1) -> out %return.param: %Array.870 [thunk @SelfNestedBadParam.as.SelfNested.impl.%SelfNestedBadParam.as.SelfNested.impl.F.decl.loc138_87.1 for @SelfNested.WithSelf.%SelfNested.WithSelf.F.decl, @SelfNested.WithSelf.F(constants.%SelfNested.facet.d0d)] { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: %SelfNestedBadParam.as.SelfNested.impl.F.type.4325e7.1 = name_ref F, @SelfNestedBadParam.as.SelfNested.impl.%SelfNestedBadParam.as.SelfNested.impl.F.decl.loc196_87.1 [concrete = constants.%SelfNestedBadParam.as.SelfNested.impl.F.5fd896.1] +// CHECK:STDOUT: %F.ref: %SelfNestedBadParam.as.SelfNested.impl.F.type.4325e7.1 = name_ref F, @SelfNestedBadParam.as.SelfNested.impl.%SelfNestedBadParam.as.SelfNested.impl.F.decl.loc138_87.1 [concrete = constants.%SelfNestedBadParam.as.SelfNested.impl.F.5fd896.1] // CHECK:STDOUT: %.3: ref %Array.870 = splice_block %return.param {} // CHECK:STDOUT: %tuple.elem0: %ptr.52e = tuple_access %x.param, element0 // CHECK:STDOUT: %tuple.elem1: %struct_type.x.y.25d = tuple_access %x.param, element1 @@ -1351,14 +1287,14 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: return %SelfNestedBadParam.as.SelfNested.impl.F.call to %return.param // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SelfNestedBadReturnType.as.SelfNested.impl.F.loc212_112.1(%x.param: %tuple.type.dce) -> out %return.param: %Array.870; +// CHECK:STDOUT: fn @SelfNestedBadReturnType.as.SelfNested.impl.F.loc148_112.1(%x.param: %tuple.type.dce) -> out %return.param: %Array.870; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SelfNestedBadReturnType.as.SelfNested.impl.F.loc212_112.2(%x.param: %tuple.type.dce) -> out %return.param: %Array.ce4 [thunk @SelfNestedBadReturnType.as.SelfNested.impl.%SelfNestedBadReturnType.as.SelfNested.impl.F.decl.loc212_112.1 for @SelfNested.WithSelf.%SelfNested.WithSelf.F.decl, @SelfNested.WithSelf.F(constants.%SelfNested.facet.e71)] { +// CHECK:STDOUT: fn @SelfNestedBadReturnType.as.SelfNested.impl.F.loc148_112.2(%x.param: %tuple.type.dce) -> out %return.param: %Array.ce4 [thunk @SelfNestedBadReturnType.as.SelfNested.impl.%SelfNestedBadReturnType.as.SelfNested.impl.F.decl.loc148_112.1 for @SelfNested.WithSelf.%SelfNested.WithSelf.F.decl, @SelfNested.WithSelf.F(constants.%SelfNested.facet.e71)] { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: %SelfNestedBadReturnType.as.SelfNested.impl.F.type.1cbabe.1 = name_ref F, @SelfNestedBadReturnType.as.SelfNested.impl.%SelfNestedBadReturnType.as.SelfNested.impl.F.decl.loc212_112.1 [concrete = constants.%SelfNestedBadReturnType.as.SelfNested.impl.F.5a7d54.1] -// CHECK:STDOUT: %.loc212_112.1: ref %Array.870 = temporary_storage -// CHECK:STDOUT: %SelfNestedBadReturnType.as.SelfNested.impl.F.call: init %Array.870 to %.loc212_112.1 = call %F.ref(%x.param) -// CHECK:STDOUT: %.loc212_112.2: %Array.ce4 = converted %SelfNestedBadReturnType.as.SelfNested.impl.F.call, [concrete = ] +// CHECK:STDOUT: %F.ref: %SelfNestedBadReturnType.as.SelfNested.impl.F.type.1cbabe.1 = name_ref F, @SelfNestedBadReturnType.as.SelfNested.impl.%SelfNestedBadReturnType.as.SelfNested.impl.F.decl.loc148_112.1 [concrete = constants.%SelfNestedBadReturnType.as.SelfNested.impl.F.5a7d54.1] +// CHECK:STDOUT: %.loc148_112.1: ref %Array.870 = temporary_storage +// CHECK:STDOUT: %SelfNestedBadReturnType.as.SelfNested.impl.F.call: init %Array.870 to %.loc148_112.1 = call %F.ref(%x.param) +// CHECK:STDOUT: %.loc148_112.2: %Array.ce4 = converted %SelfNestedBadReturnType.as.SelfNested.impl.F.call, [concrete = ] // CHECK:STDOUT: return to %return.param // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1484,19 +1420,19 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: // CHECK:STDOUT: specific @SelfNested.WithSelf.F(constants.%Self.e81) { // CHECK:STDOUT: %Self => constants.%Self.e81 -// CHECK:STDOUT: %Self.as_type.loc184_16.1 => constants.%Self.as_type.8ab -// CHECK:STDOUT: %ptr.loc184_16.1 => constants.%ptr.a16 -// CHECK:STDOUT: %struct_type.x.y.loc184_37.1 => constants.%struct_type.x.y.34d +// CHECK:STDOUT: %Self.as_type.loc130_16.1 => constants.%Self.as_type.8ab +// CHECK:STDOUT: %ptr.loc130_16.1 => constants.%ptr.a16 +// CHECK:STDOUT: %struct_type.x.y.loc130_37.1 => constants.%struct_type.x.y.34d // CHECK:STDOUT: %tuple => constants.%tuple.ea4 // CHECK:STDOUT: %tuple.type => constants.%tuple.type.684 -// CHECK:STDOUT: %pattern_type.loc184_9 => constants.%pattern_type.871 -// CHECK:STDOUT: %x.param_patt.loc184_9.2 => constants.%x.param_patt.8f6 -// CHECK:STDOUT: %x.patt.loc184_9.2 => constants.%x.patt.48b -// CHECK:STDOUT: %Array.loc184_57.1 => constants.%Array.d32 -// CHECK:STDOUT: %.loc184_57.1 => constants.%.ec2 -// CHECK:STDOUT: %pattern_type.loc184_57 => constants.%pattern_type.4a4 -// CHECK:STDOUT: %return.param_patt.loc184_57.2 => constants.%return.param_patt.36b -// CHECK:STDOUT: %return.patt.loc184_41.2 => constants.%return.patt.7a8 +// CHECK:STDOUT: %pattern_type.loc130_9 => constants.%pattern_type.871 +// CHECK:STDOUT: %x.param_patt.loc130_9.2 => constants.%x.param_patt.8f6 +// CHECK:STDOUT: %x.patt.loc130_9.2 => constants.%x.patt.48b +// CHECK:STDOUT: %Array.loc130_57.1 => constants.%Array.d32 +// CHECK:STDOUT: %.loc130_57.1 => constants.%.ec2 +// CHECK:STDOUT: %pattern_type.loc130_57 => constants.%pattern_type.4a4 +// CHECK:STDOUT: %return.param_patt.loc130_57.2 => constants.%return.param_patt.36b +// CHECK:STDOUT: %return.patt.loc130_41.2 => constants.%return.patt.7a8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @SelfNested.WithSelf(constants.%SelfNested.facet.d0d) { @@ -1508,19 +1444,19 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: // CHECK:STDOUT: specific @SelfNested.WithSelf.F(constants.%SelfNested.facet.d0d) { // CHECK:STDOUT: %Self => constants.%SelfNested.facet.d0d -// CHECK:STDOUT: %Self.as_type.loc184_16.1 => constants.%SelfNestedBadParam -// CHECK:STDOUT: %ptr.loc184_16.1 => constants.%ptr.52e -// CHECK:STDOUT: %struct_type.x.y.loc184_37.1 => constants.%struct_type.x.y.25d +// CHECK:STDOUT: %Self.as_type.loc130_16.1 => constants.%SelfNestedBadParam +// CHECK:STDOUT: %ptr.loc130_16.1 => constants.%ptr.52e +// CHECK:STDOUT: %struct_type.x.y.loc130_37.1 => constants.%struct_type.x.y.25d // CHECK:STDOUT: %tuple => constants.%tuple.17a // CHECK:STDOUT: %tuple.type => constants.%tuple.type.5e1 -// CHECK:STDOUT: %pattern_type.loc184_9 => constants.%pattern_type.1ec -// CHECK:STDOUT: %x.param_patt.loc184_9.2 => constants.%x.param_patt.255 -// CHECK:STDOUT: %x.patt.loc184_9.2 => constants.%x.patt.79a -// CHECK:STDOUT: %Array.loc184_57.1 => constants.%Array.870 -// CHECK:STDOUT: %.loc184_57.1 => constants.%.a71 -// CHECK:STDOUT: %pattern_type.loc184_57 => constants.%pattern_type.ec1 -// CHECK:STDOUT: %return.param_patt.loc184_57.2 => constants.%return.param_patt.8ed -// CHECK:STDOUT: %return.patt.loc184_41.2 => constants.%return.patt.21a +// CHECK:STDOUT: %pattern_type.loc130_9 => constants.%pattern_type.1ec +// CHECK:STDOUT: %x.param_patt.loc130_9.2 => constants.%x.param_patt.255 +// CHECK:STDOUT: %x.patt.loc130_9.2 => constants.%x.patt.79a +// CHECK:STDOUT: %Array.loc130_57.1 => constants.%Array.870 +// CHECK:STDOUT: %.loc130_57.1 => constants.%.a71 +// CHECK:STDOUT: %pattern_type.loc130_57 => constants.%pattern_type.ec1 +// CHECK:STDOUT: %return.param_patt.loc130_57.2 => constants.%return.param_patt.8ed +// CHECK:STDOUT: %return.patt.loc130_41.2 => constants.%return.patt.21a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @SelfNested.WithSelf(constants.%SelfNested.facet.e71) { @@ -1532,18 +1468,18 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: // CHECK:STDOUT: specific @SelfNested.WithSelf.F(constants.%SelfNested.facet.e71) { // CHECK:STDOUT: %Self => constants.%SelfNested.facet.e71 -// CHECK:STDOUT: %Self.as_type.loc184_16.1 => constants.%SelfNestedBadReturnType -// CHECK:STDOUT: %ptr.loc184_16.1 => constants.%ptr.f55 -// CHECK:STDOUT: %struct_type.x.y.loc184_37.1 => constants.%struct_type.x.y.03e +// CHECK:STDOUT: %Self.as_type.loc130_16.1 => constants.%SelfNestedBadReturnType +// CHECK:STDOUT: %ptr.loc130_16.1 => constants.%ptr.f55 +// CHECK:STDOUT: %struct_type.x.y.loc130_37.1 => constants.%struct_type.x.y.03e // CHECK:STDOUT: %tuple => constants.%tuple.ef1 // CHECK:STDOUT: %tuple.type => constants.%tuple.type.dce -// CHECK:STDOUT: %pattern_type.loc184_9 => constants.%pattern_type.7fc -// CHECK:STDOUT: %x.param_patt.loc184_9.2 => constants.%x.param_patt.04c -// CHECK:STDOUT: %x.patt.loc184_9.2 => constants.%x.patt.10a -// CHECK:STDOUT: %Array.loc184_57.1 => constants.%Array.ce4 -// CHECK:STDOUT: %.loc184_57.1 => constants.%.069 -// CHECK:STDOUT: %pattern_type.loc184_57 => constants.%pattern_type.5b0 -// CHECK:STDOUT: %return.param_patt.loc184_57.2 => constants.%return.param_patt.c20 -// CHECK:STDOUT: %return.patt.loc184_41.2 => constants.%return.patt.02d +// CHECK:STDOUT: %pattern_type.loc130_9 => constants.%pattern_type.7fc +// CHECK:STDOUT: %x.param_patt.loc130_9.2 => constants.%x.param_patt.04c +// CHECK:STDOUT: %x.patt.loc130_9.2 => constants.%x.patt.10a +// CHECK:STDOUT: %Array.loc130_57.1 => constants.%Array.ce4 +// CHECK:STDOUT: %.loc130_57.1 => constants.%.069 +// CHECK:STDOUT: %pattern_type.loc130_57 => constants.%pattern_type.5b0 +// CHECK:STDOUT: %return.param_patt.loc130_57.2 => constants.%return.param_patt.c20 +// CHECK:STDOUT: %return.patt.loc130_41.2 => constants.%return.patt.02d // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_impl_bad_interface.carbon b/toolchain/check/testdata/impl/fail_impl_bad_interface.carbon index 0203c815dd84..15625dd60fd4 100644 --- a/toolchain/check/testdata/impl/fail_impl_bad_interface.carbon +++ b/toolchain/check/testdata/impl/fail_impl_bad_interface.carbon @@ -16,12 +16,8 @@ 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)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: impl i32 as false {} -// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: fail_impl_as_false.carbon:[[@LINE+3]]:13-17: error: cannot implicitly convert non-type value of type `bool` to `type` [ConversionFailureNonTypeToFacet] +// CHECK:STDERR: fail_impl_as_false.carbon:[[@LINE+2]]:13-17: note: type `bool` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: impl i32 as false {} @@ -29,9 +25,7 @@ impl i32 as false {} library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_impl_as_type.carbon:[[@LINE+4]]:1: error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] -// CHECK:STDERR: impl bool as type {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_impl_as_type.carbon:[[@LINE+2]]:1-19: error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] // CHECK:STDERR: impl bool as type {} @@ -39,9 +33,7 @@ impl bool as type {} library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_impl_as_type_where.carbon:[[@LINE+4]]:1: error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] -// CHECK:STDERR: impl f64 as type where .Self impls type {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_impl_as_type_where.carbon:[[@LINE+2]]:1-41: error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] // CHECK:STDERR: impl f64 as type where .Self impls type {} @@ -51,9 +43,7 @@ library "[[@TEST_NAME]]"; interface I {} -// CHECK:STDERR: fail_impl_as_type_where_impls_interface.carbon:[[@LINE+4]]:1: error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] -// CHECK:STDERR: impl {.a: bool} as type where .Self impls I {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_impl_as_type_where_impls_interface.carbon:[[@LINE+2]]:1-45: error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] // CHECK:STDERR: impl {.a: bool} as type where .Self impls I {} @@ -86,7 +76,7 @@ impl {.a: bool} as type where .Self impls I {} // CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %.loc11: type = converted @i32.as..impl.%false, [concrete = ] +// CHECK:STDOUT: %.loc7: type = converted @i32.as..impl.%false, [concrete = ] // CHECK:STDOUT: impl_decl @i32.as..impl [concrete] {} { // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %false: bool = bool_literal false [concrete = constants.%false] @@ -120,12 +110,12 @@ impl {.a: bool} as type where .Self impls I {} // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: impl_decl @bool.as..impl [concrete] {} { -// CHECK:STDOUT: %.loc8_6: type = type_literal bool [concrete = bool] -// CHECK:STDOUT: %.loc8_14: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc6_6: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc6_14: type = type_literal type [concrete = type] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @bool.as..impl: %.loc8_6 as { +// CHECK:STDOUT: impl @bool.as..impl: %.loc6_6 as { // CHECK:STDOUT: !members: // CHECK:STDOUT: extend // CHECK:STDOUT: witness = @@ -159,18 +149,18 @@ impl {.a: bool} as type where .Self impls I {} // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: impl_decl @f64.as..impl [concrete] {} { // CHECK:STDOUT: %f64: type = type_literal constants.%f64 [concrete = constants.%f64] -// CHECK:STDOUT: %.loc8_13: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc6_13: type = type_literal type [concrete = type] // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc8_13 [concrete] -// CHECK:STDOUT: %.Self.ref.loc8_24.1: type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc8_36: type = type_literal type [concrete = type] -// CHECK:STDOUT: %impls.loc8_30.1 = requirement_impls %.Self.ref.loc8_24.1, %.loc8_36 [concrete] +// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc6_13 [concrete] +// CHECK:STDOUT: %.Self.ref.loc6_24.1: type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc6_36: type = type_literal type [concrete = type] +// CHECK:STDOUT: %impls.loc6_30.1 = requirement_impls %.Self.ref.loc6_24.1, %.loc6_36 [concrete] // CHECK:STDOUT: %.Self: type = symbolic_binding .Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %.Self.ref.loc8_24.2: type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %impls.loc8_30.2 = requirement_impls %.Self.ref.loc8_24.2, %.loc8_36 [concrete] -// CHECK:STDOUT: %.loc8_18: type = where_expr [concrete = type] { -// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc8_13 [concrete] -// CHECK:STDOUT: %impls.loc8_30.2 = requirement_impls %.Self.ref.loc8_24.2, %.loc8_36 [concrete] +// CHECK:STDOUT: %.Self.ref.loc6_24.2: type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] +// CHECK:STDOUT: %impls.loc6_30.2 = requirement_impls %.Self.ref.loc6_24.2, %.loc6_36 [concrete] +// CHECK:STDOUT: %.loc6_18: type = where_expr [concrete = type] { +// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc6_13 [concrete] +// CHECK:STDOUT: %impls.loc6_30.2 = requirement_impls %.Self.ref.loc6_24.2, %.loc6_36 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -210,20 +200,20 @@ impl {.a: bool} as type where .Self impls I {} // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {} // CHECK:STDOUT: impl_decl @struct_type.a.as..impl [concrete] {} { -// CHECK:STDOUT: %.loc10_11: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc8_11: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: bool} [concrete = constants.%struct_type.a] -// CHECK:STDOUT: %.loc10_20: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc8_20: type = type_literal type [concrete = type] // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc10_20 [concrete] -// CHECK:STDOUT: %.Self.ref.loc10_31.1: type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc8_20 [concrete] +// CHECK:STDOUT: %.Self.ref.loc8_31.1: type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] -// CHECK:STDOUT: %impls.loc10_37.1 = requirement_impls %.Self.ref.loc10_31.1, %I.ref [concrete] +// CHECK:STDOUT: %impls.loc8_37.1 = requirement_impls %.Self.ref.loc8_31.1, %I.ref [concrete] // CHECK:STDOUT: %.Self: type = symbolic_binding .Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %.Self.ref.loc10_31.2: type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %impls.loc10_37.2 = requirement_impls %.Self.ref.loc10_31.2, %I.ref [concrete] -// CHECK:STDOUT: %.loc10_25: type = where_expr [concrete = constants.%type_where] { -// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc10_20 [concrete] -// CHECK:STDOUT: %impls.loc10_37.2 = requirement_impls %.Self.ref.loc10_31.2, %I.ref [concrete] +// CHECK:STDOUT: %.Self.ref.loc8_31.2: type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] +// CHECK:STDOUT: %impls.loc8_37.2 = requirement_impls %.Self.ref.loc8_31.2, %I.ref [concrete] +// CHECK:STDOUT: %.loc8_25: type = where_expr [concrete = constants.%type_where] { +// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc8_20 [concrete] +// CHECK:STDOUT: %impls.loc8_37.2 = requirement_impls %.Self.ref.loc8_31.2, %I.ref [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/impl/fail_impl_bad_type.carbon b/toolchain/check/testdata/impl/fail_impl_bad_type.carbon index 59dbafac398b..9d4795cd31a9 100644 --- a/toolchain/check/testdata/impl/fail_impl_bad_type.carbon +++ b/toolchain/check/testdata/impl/fail_impl_bad_type.carbon @@ -14,12 +14,8 @@ 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)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: impl true as I {} -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_impl_bad_type.carbon:[[@LINE+3]]:6-9: error: cannot implicitly convert non-type value of type `bool` to `type` [ConversionFailureNonTypeToFacet] +// CHECK:STDERR: fail_impl_bad_type.carbon:[[@LINE+2]]:6-9: note: type `bool` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: impl true as I {} @@ -52,10 +48,10 @@ impl true as I {} // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {} // CHECK:STDOUT: impl_decl @.as.I.impl [concrete] {} { // CHECK:STDOUT: %true: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: %.loc24: type = converted %true, [concrete = ] +// CHECK:STDOUT: %.loc20: type = converted %true, [concrete = ] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc24: = impl_self_witness , @I [concrete = ] +// CHECK:STDOUT: %.loc20: = impl_self_witness , @I [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { diff --git a/toolchain/check/testdata/impl/fail_redefinition.carbon b/toolchain/check/testdata/impl/fail_redefinition.carbon index 41b0a059ac4f..3c7f0341ade9 100644 --- a/toolchain/check/testdata/impl/fail_redefinition.carbon +++ b/toolchain/check/testdata/impl/fail_redefinition.carbon @@ -16,12 +16,8 @@ interface I {} impl i32 as I {} -// CHECK:STDERR: fail_redefinition.carbon:[[@LINE+7]]:1: error: redefinition of `impl i32 as I` [ImplRedefinition] -// CHECK:STDERR: impl i32 as I {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_redefinition.carbon:[[@LINE-5]]:1: note: previous definition was here [ImplPreviousDefinition] -// CHECK:STDERR: impl i32 as I {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_redefinition.carbon:[[@LINE+3]]:1-15: error: redefinition of `impl i32 as I` [ImplRedefinition] +// CHECK:STDERR: fail_redefinition.carbon:[[@LINE-3]]:1-15: note: previous definition was here [ImplPreviousDefinition] // CHECK:STDERR: impl i32 as I {} @@ -65,7 +61,7 @@ impl i32 as I {} // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc26: = impl_self_witness @i32.as.I.impl.3f9847.2.%i32, @I [concrete = constants.%.c43] +// CHECK:STDOUT: %.loc22: = impl_self_witness @i32.as.I.impl.3f9847.2.%i32, @I [concrete = constants.%.c43] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { diff --git a/toolchain/check/testdata/impl/fail_self_type_mismatch.carbon b/toolchain/check/testdata/impl/fail_self_type_mismatch.carbon index a6048da5bacc..0988eaf4c117 100644 --- a/toolchain/check/testdata/impl/fail_self_type_mismatch.carbon +++ b/toolchain/check/testdata/impl/fail_self_type_mismatch.carbon @@ -29,12 +29,8 @@ impl bool as I { } impl i32 as I { - // CHECK:STDERR: fail_self_type_mismatch.carbon:[[@LINE+7]]:8: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn F(c: C(i32)); - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_self_type_mismatch.carbon:[[@LINE-14]]:3: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: fn F(c: C(Self)); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_self_type_mismatch.carbon:[[@LINE+3]]:8-16: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: fail_self_type_mismatch.carbon:[[@LINE-12]]:3-19: note: while building thunk to match the signature of this function [ThunkSignature] // CHECK:STDERR: fn F(c: C(i32)); } @@ -90,7 +86,7 @@ impl i32 as I { // CHECK:STDOUT: %pattern_type.256: type = pattern_type %C.fef [concrete] // CHECK:STDOUT: %c.param_patt.ab3: %pattern_type.256 = value_param_pattern [concrete] // CHECK:STDOUT: %c.patt.e1b: %pattern_type.256 = wrapper_binding_pattern c, %c.param_patt.ab3 [concrete] -// CHECK:STDOUT: %i32.as.I.impl.F.type.48cdab.1: type = fn_type @i32.as.I.impl.F.loc39_18.1 [concrete] +// CHECK:STDOUT: %i32.as.I.impl.F.type.48cdab.1: type = fn_type @i32.as.I.impl.F.loc35_18.1 [concrete] // CHECK:STDOUT: %i32.as.I.impl.F.bd5be1.1: %i32.as.I.impl.F.type.48cdab.1 = struct_value () [concrete] // CHECK:STDOUT: %I.facet.01e: %I.type = facet_value %i32, (%I.impl_witness.f53) [concrete] // CHECK:STDOUT: %I.WithSelf.F.type.091: type = fn_type @I.WithSelf.F, @I.WithSelf(%I.facet.01e) [concrete] @@ -99,7 +95,7 @@ impl i32 as I { // CHECK:STDOUT: %pattern_type.e36: type = pattern_type %C.186 [concrete] // CHECK:STDOUT: %c.param_patt.21f: %pattern_type.e36 = value_param_pattern [concrete] // CHECK:STDOUT: %c.patt.147: %pattern_type.e36 = wrapper_binding_pattern c, %c.param_patt.21f [concrete] -// CHECK:STDOUT: %i32.as.I.impl.F.type.48cdab.2: type = fn_type @i32.as.I.impl.F.loc39_18.2 [concrete] +// CHECK:STDOUT: %i32.as.I.impl.F.type.48cdab.2: type = fn_type @i32.as.I.impl.F.loc35_18.2 [concrete] // CHECK:STDOUT: %i32.as.I.impl.F.bd5be1.2: %i32.as.I.impl.F.type.48cdab.2 = struct_value () [concrete] // CHECK:STDOUT: %ImplicitAs.type.0ff: type = generic_interface_type @ImplicitAs [concrete] // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.0ff = struct_value () [concrete] @@ -224,31 +220,31 @@ impl i32 as I { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @i32.as.I.impl: %i32 as %I.ref { -// CHECK:STDOUT: %i32.as.I.impl.F.decl.loc39_18.1: %i32.as.I.impl.F.type.48cdab.1 = fn_decl @i32.as.I.impl.F.loc39_18.1 [concrete = constants.%i32.as.I.impl.F.bd5be1.1] { +// CHECK:STDOUT: %i32.as.I.impl.F.decl.loc35_18.1: %i32.as.I.impl.F.type.48cdab.1 = fn_decl @i32.as.I.impl.F.loc35_18.1 [concrete = constants.%i32.as.I.impl.F.bd5be1.1] { // CHECK:STDOUT: %c.param_patt: %pattern_type.256 = value_param_pattern [concrete = constants.%c.param_patt.ab3] // CHECK:STDOUT: %c.patt: %pattern_type.256 = wrapper_binding_pattern c, %c.param_patt [concrete = constants.%c.patt.e1b] // CHECK:STDOUT: } { // CHECK:STDOUT: %c.param: %C.fef = value_param call_param0 -// CHECK:STDOUT: %.loc39: type = splice_block %C [concrete = constants.%C.fef] { +// CHECK:STDOUT: %.loc35: type = splice_block %C [concrete = constants.%C.fef] { // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [concrete = constants.%C.generic] // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %C: type = class_type @C, @C(type, constants.%i32) [concrete = constants.%C.fef] // CHECK:STDOUT: } // CHECK:STDOUT: %c: %C.fef = wrapper_binding c, %c.param // CHECK:STDOUT: } -// CHECK:STDOUT: %i32.as.I.impl.F.decl.loc39_18.2: %i32.as.I.impl.F.type.48cdab.2 = fn_decl @i32.as.I.impl.F.loc39_18.2 [concrete = constants.%i32.as.I.impl.F.bd5be1.2] { +// CHECK:STDOUT: %i32.as.I.impl.F.decl.loc35_18.2: %i32.as.I.impl.F.type.48cdab.2 = fn_decl @i32.as.I.impl.F.loc35_18.2 [concrete = constants.%i32.as.I.impl.F.bd5be1.2] { // CHECK:STDOUT: %.1: %pattern_type.e36 = specific_constant constants.%c.param_patt.21f, @I.WithSelf.F(constants.%I.facet.01e) [concrete = constants.%c.param_patt.21f] // CHECK:STDOUT: %c.patt: %pattern_type.e36 = wrapper_binding_pattern c, %.1 [concrete = constants.%c.patt.147] // CHECK:STDOUT: } { // CHECK:STDOUT: %c.param: %C.186 = value_param call_param0 // CHECK:STDOUT: %c: %C.186 = wrapper_binding c, %c.param // CHECK:STDOUT: } -// CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%i32.as.I.impl.F.decl.loc39_18.2), @i32.as.I.impl [concrete] +// CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%i32.as.I.impl.F.decl.loc35_18.2), @i32.as.I.impl [concrete] // CHECK:STDOUT: %I.impl_witness: = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness.f53] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .C = -// CHECK:STDOUT: .F = %i32.as.I.impl.F.decl.loc39_18.1 +// CHECK:STDOUT: .F = %i32.as.I.impl.F.decl.loc35_18.1 // CHECK:STDOUT: extend %I.ref // CHECK:STDOUT: witness = %I.impl_witness // CHECK:STDOUT: } @@ -283,11 +279,11 @@ impl i32 as I { // CHECK:STDOUT: // CHECK:STDOUT: fn @bool.as.I.impl.F(%c.param: %C.820); // CHECK:STDOUT: -// CHECK:STDOUT: fn @i32.as.I.impl.F.loc39_18.1(%c.param: %C.fef); +// CHECK:STDOUT: fn @i32.as.I.impl.F.loc35_18.1(%c.param: %C.fef); // CHECK:STDOUT: -// CHECK:STDOUT: fn @i32.as.I.impl.F.loc39_18.2(%c.param: %C.186) [thunk @i32.as.I.impl.%i32.as.I.impl.F.decl.loc39_18.1 for @I.WithSelf.%I.WithSelf.F.decl, @I.WithSelf.F(constants.%I.facet.01e)] { +// CHECK:STDOUT: fn @i32.as.I.impl.F.loc35_18.2(%c.param: %C.186) [thunk @i32.as.I.impl.%i32.as.I.impl.F.decl.loc35_18.1 for @I.WithSelf.%I.WithSelf.F.decl, @I.WithSelf.F(constants.%I.facet.01e)] { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: %i32.as.I.impl.F.type.48cdab.1 = name_ref F, @i32.as.I.impl.%i32.as.I.impl.F.decl.loc39_18.1 [concrete = constants.%i32.as.I.impl.F.bd5be1.1] +// CHECK:STDOUT: %F.ref: %i32.as.I.impl.F.type.48cdab.1 = name_ref F, @i32.as.I.impl.%i32.as.I.impl.F.decl.loc35_18.1 [concrete = constants.%i32.as.I.impl.F.bd5be1.1] // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%C.fef)> [concrete = constants.%ImplicitAs.type.0f2] // CHECK:STDOUT: %.2: %ImplicitAs.assoc_type.529 = specific_constant imports.%Core.import_ref.383, @ImplicitAs.WithSelf(constants.%C.fef, constants.%Self.862) [concrete = constants.%assoc0.8cb] // CHECK:STDOUT: %Convert.ref: %ImplicitAs.assoc_type.529 = name_ref Convert, %.2 [concrete = constants.%assoc0.8cb] diff --git a/toolchain/check/testdata/impl/forward_decls.carbon b/toolchain/check/testdata/impl/forward_decls.carbon index 75bb05e450fa..242029b68c8b 100644 --- a/toolchain/check/testdata/impl/forward_decls.carbon +++ b/toolchain/check/testdata/impl/forward_decls.carbon @@ -88,18 +88,12 @@ interface I { class C {} impl C as I; -// CHECK:STDERR: fail_unset_associated_const.carbon:[[@LINE+4]]:8: error: accessing member from impl before it has a defined value [ImplAccessMemberBeforeSet] -// CHECK:STDERR: let x: (C as I).T = (); -// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: fail_unset_associated_const.carbon:[[@LINE+2]]:8-17: error: accessing member from impl before it has a defined value [ImplAccessMemberBeforeSet] // CHECK:STDERR: let x: (C as I).T = (); -// CHECK:STDERR: fail_unset_associated_const.carbon:[[@LINE+7]]:1: error: associated constant T not given a value in impl of interface I [ImplAssociatedConstantNeedsValue] -// CHECK:STDERR: impl C as I {} -// CHECK:STDERR: ^~~~~~~~~~~~~ -// CHECK:STDERR: fail_unset_associated_const.carbon:[[@LINE-14]]:7: note: associated constant declared here [AssociatedConstantHere] -// CHECK:STDERR: let T: type; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_unset_associated_const.carbon:[[@LINE+3]]:1-13: error: associated constant T not given a value in impl of interface I [ImplAssociatedConstantNeedsValue] +// CHECK:STDERR: fail_unset_associated_const.carbon:[[@LINE-10]]:7-13: note: associated constant declared here [AssociatedConstantHere] // CHECK:STDERR: impl C as I {} @@ -109,20 +103,14 @@ library "[[@TEST_NAME]]"; interface I; class C; class D {} -// CHECK:STDERR: fail_associated_const_before_interface_definition.carbon:[[@LINE+7]]:19: error: member access into facet of incomplete type `I` [IncompleteTypeInMemberAccessOfFacet] -// CHECK:STDERR: impl D as I where .T = C; -// CHECK:STDERR: ^~ -// CHECK:STDERR: fail_associated_const_before_interface_definition.carbon:[[@LINE-6]]:1: note: interface was forward declared here [InterfaceForwardDeclaredHere] -// CHECK:STDERR: interface I; -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_associated_const_before_interface_definition.carbon:[[@LINE+3]]:19-20: error: member access into facet of incomplete type `I` [IncompleteTypeInMemberAccessOfFacet] +// CHECK:STDERR: fail_associated_const_before_interface_definition.carbon:[[@LINE-4]]:1-12: note: interface was forward declared here [InterfaceForwardDeclaredHere] // CHECK:STDERR: impl D as I where .T = C; interface I {} class C {} -// CHECK:STDERR: fail_associated_const_before_interface_definition.carbon:[[@LINE+4]]:19: error: member name `T` not found in `I` [MemberNameNotFoundInSpecificScope] -// CHECK:STDERR: impl D as I where .T = C {} -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_associated_const_before_interface_definition.carbon:[[@LINE+2]]:19-20: error: member name `T` not found in `I` [MemberNameNotFoundInSpecificScope] // CHECK:STDERR: impl D as I where .T = C {} @@ -161,9 +149,7 @@ library "[[@TEST_NAME]]"; interface I; interface J; -// CHECK:STDERR: fail_todo_two_interfaces.carbon:[[@LINE+4]]:1: error: impl as 2 interfaces, expected 1 [ImplOfNotOneInterface] -// CHECK:STDERR: impl {} as I & J; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_two_interfaces.carbon:[[@LINE+2]]:1-17: error: impl as 2 interfaces, expected 1 [ImplOfNotOneInterface] // CHECK:STDERR: impl {} as I & J; @@ -181,12 +167,8 @@ class C {} impl C as I where .T = (); -// CHECK:STDERR: fail_never_assigned_associated_const.carbon:[[@LINE+7]]:1: error: associated constant U not given a value in impl of interface I [ImplAssociatedConstantNeedsValue] -// CHECK:STDERR: impl C as I where .T = () {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_never_assigned_associated_const.carbon:[[@LINE-9]]:7: note: associated constant declared here [AssociatedConstantHere] -// CHECK:STDERR: let U: type; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_never_assigned_associated_const.carbon:[[@LINE+3]]:1-27: error: associated constant U not given a value in impl of interface I [ImplAssociatedConstantNeedsValue] +// CHECK:STDERR: fail_never_assigned_associated_const.carbon:[[@LINE-7]]:7-13: note: associated constant declared here [AssociatedConstantHere] // CHECK:STDERR: impl C as I where .T = () {} @@ -978,13 +960,13 @@ impl C as Y {} // CHECK:STDOUT: %I.ref.loc7: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } // CHECK:STDOUT: %.loc7: = impl_self_witness @C.as.I.impl.%C.ref.loc7, @I [concrete = constants.%.b7f] -// CHECK:STDOUT: %.loc13_16.1: type = splice_block %impl.elem0 [concrete = ] { +// CHECK:STDOUT: %.loc11_16.1: type = splice_block %impl.elem0 [concrete = ] { // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [concrete = constants.%C] // CHECK:STDOUT: %I.ref: type = name_ref I, %I.decl [concrete = constants.%I.type] // CHECK:STDOUT: %I.facet: %I.type = facet_value %C.ref, (constants.%I.impl_witness) [concrete = constants.%I.facet] -// CHECK:STDOUT: %.loc13_11: %I.type = converted %C.ref, %I.facet [concrete = constants.%I.facet] -// CHECK:STDOUT: %as_type: type = facet_access_type %.loc13_11 [concrete = constants.%C] -// CHECK:STDOUT: %.loc13_16.2: type = converted %.loc13_11, %as_type [concrete = constants.%C] +// CHECK:STDOUT: %.loc11_11: %I.type = converted %C.ref, %I.facet [concrete = constants.%I.facet] +// CHECK:STDOUT: %as_type: type = facet_access_type %.loc11_11 [concrete = constants.%C] +// CHECK:STDOUT: %.loc11_16.2: type = converted %.loc11_11, %as_type [concrete = constants.%C] // CHECK:STDOUT: %T.ref: %I.assoc_type = name_ref T, @T.%assoc0 [concrete = constants.%assoc0] // CHECK:STDOUT: %impl.elem0: type = impl_witness_access constants.%I.impl_witness, element0 [concrete = ] // CHECK:STDOUT: } @@ -993,10 +975,10 @@ impl C as Y {} // CHECK:STDOUT: %x.patt: = value_binding_pattern x [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @C.as.I.impl [concrete] {} { -// CHECK:STDOUT: %C.ref.loc22: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %I.ref.loc22: type = name_ref I, file.%I.decl [concrete = constants.%I.type] +// CHECK:STDOUT: %C.ref.loc16: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %I.ref.loc16: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc22: = impl_self_witness @C.as.I.impl.%C.ref.loc22, @I [concrete = constants.%.b7f] +// CHECK:STDOUT: %.loc16: = impl_self_witness @C.as.I.impl.%C.ref.loc16, @I [concrete = constants.%.b7f] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { @@ -1035,7 +1017,7 @@ impl C as Y {} // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc13: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc11: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1080,37 +1062,37 @@ impl C as Y {} // CHECK:STDOUT: %C.decl.loc4: type = class_decl @C [concrete = constants.%C] {} {} // CHECK:STDOUT: %D.decl: type = class_decl @D [concrete = constants.%D] {} {} // CHECK:STDOUT: impl_decl @D.as..impl [concrete] {} { -// CHECK:STDOUT: %D.ref.loc13: type = name_ref D, file.%D.decl [concrete = constants.%D] -// CHECK:STDOUT: %I.ref.loc13: type = name_ref I, file.%I.decl.loc3 [concrete = constants.%I.type] -// CHECK:STDOUT: %.Self.frozen.loc13: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %base_facet_type.loc13 = requirement_base_facet_type %I.ref.loc13 [concrete] -// CHECK:STDOUT: %.Self.ref.loc13: %I.type = name_ref .Self, %.Self.frozen.loc13 [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc13: type = facet_access_type %.Self.ref.loc13 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc13_19: type = converted %.Self.ref.loc13, %.Self.as_type.loc13 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %T.ref.loc13: = name_ref T, [concrete = ] -// CHECK:STDOUT: %C.ref.loc13: type = name_ref C, file.%C.decl.loc4 [concrete = constants.%C] -// CHECK:STDOUT: %rewrite.loc13 = requirement_rewrite %T.ref.loc13, [concrete] -// CHECK:STDOUT: %.loc13_13: type = where_expr [concrete = ] { -// CHECK:STDOUT: %base_facet_type.loc13 = requirement_base_facet_type %I.ref.loc13 [concrete] -// CHECK:STDOUT: %rewrite.loc13 = requirement_rewrite %T.ref.loc13, [concrete] +// CHECK:STDOUT: %D.ref.loc9: type = name_ref D, file.%D.decl [concrete = constants.%D] +// CHECK:STDOUT: %I.ref.loc9: type = name_ref I, file.%I.decl.loc3 [concrete = constants.%I.type] +// CHECK:STDOUT: %.Self.frozen.loc9: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %base_facet_type.loc9 = requirement_base_facet_type %I.ref.loc9 [concrete] +// CHECK:STDOUT: %.Self.ref.loc9: %I.type = name_ref .Self, %.Self.frozen.loc9 [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc9: type = facet_access_type %.Self.ref.loc9 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc9_19: type = converted %.Self.ref.loc9, %.Self.as_type.loc9 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %T.ref.loc9: = name_ref T, [concrete = ] +// CHECK:STDOUT: %C.ref.loc9: type = name_ref C, file.%C.decl.loc4 [concrete = constants.%C] +// CHECK:STDOUT: %rewrite.loc9 = requirement_rewrite %T.ref.loc9, [concrete] +// CHECK:STDOUT: %.loc9_13: type = where_expr [concrete = ] { +// CHECK:STDOUT: %base_facet_type.loc9 = requirement_base_facet_type %I.ref.loc9 [concrete] +// CHECK:STDOUT: %rewrite.loc9 = requirement_rewrite %T.ref.loc9, [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } -// CHECK:STDOUT: %I.decl.loc15: type = interface_decl @I [concrete = constants.%I.type] {} {} -// CHECK:STDOUT: %C.decl.loc16: type = class_decl @C [concrete = constants.%C] {} {} +// CHECK:STDOUT: %I.decl.loc11: type = interface_decl @I [concrete = constants.%I.type] {} {} +// CHECK:STDOUT: %C.decl.loc12: type = class_decl @C [concrete = constants.%C] {} {} // CHECK:STDOUT: impl_decl @D.as..impl [concrete] {} { -// CHECK:STDOUT: %D.ref.loc21: type = name_ref D, file.%D.decl [concrete = constants.%D] -// CHECK:STDOUT: %I.ref.loc21: type = name_ref I, file.%I.decl.loc3 [concrete = constants.%I.type] -// CHECK:STDOUT: %.Self.frozen.loc21: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %base_facet_type.loc21 = requirement_base_facet_type %I.ref.loc21 [concrete] -// CHECK:STDOUT: %.Self.ref.loc21: %I.type = name_ref .Self, %.Self.frozen.loc21 [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc21: type = facet_access_type %.Self.ref.loc21 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc21_19: type = converted %.Self.ref.loc21, %.Self.as_type.loc21 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %T.ref.loc21: = name_ref T, [concrete = ] -// CHECK:STDOUT: %C.ref.loc21: type = name_ref C, file.%C.decl.loc4 [concrete = constants.%C] -// CHECK:STDOUT: %rewrite.loc21 = requirement_rewrite %T.ref.loc21, [concrete] -// CHECK:STDOUT: %.loc21_13: type = where_expr [concrete = ] { -// CHECK:STDOUT: %base_facet_type.loc21 = requirement_base_facet_type %I.ref.loc21 [concrete] -// CHECK:STDOUT: %rewrite.loc21 = requirement_rewrite %T.ref.loc21, [concrete] +// CHECK:STDOUT: %D.ref.loc15: type = name_ref D, file.%D.decl [concrete = constants.%D] +// CHECK:STDOUT: %I.ref.loc15: type = name_ref I, file.%I.decl.loc3 [concrete = constants.%I.type] +// CHECK:STDOUT: %.Self.frozen.loc15: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %base_facet_type.loc15 = requirement_base_facet_type %I.ref.loc15 [concrete] +// CHECK:STDOUT: %.Self.ref.loc15: %I.type = name_ref .Self, %.Self.frozen.loc15 [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc15: type = facet_access_type %.Self.ref.loc15 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc15_19: type = converted %.Self.ref.loc15, %.Self.as_type.loc15 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %T.ref.loc15: = name_ref T, [concrete = ] +// CHECK:STDOUT: %C.ref.loc15: type = name_ref C, file.%C.decl.loc4 [concrete = constants.%C] +// CHECK:STDOUT: %rewrite.loc15 = requirement_rewrite %T.ref.loc15, [concrete] +// CHECK:STDOUT: %.loc15_13: type = where_expr [concrete = ] { +// CHECK:STDOUT: %base_facet_type.loc15 = requirement_base_facet_type %I.ref.loc15 [concrete] +// CHECK:STDOUT: %rewrite.loc15 = requirement_rewrite %T.ref.loc15, [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -1127,7 +1109,7 @@ impl C as Y {} // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @D.as..impl: %D.ref.loc13 as { +// CHECK:STDOUT: impl @D.as..impl: %D.ref.loc9 as { // CHECK:STDOUT: !members: // CHECK:STDOUT: extend // CHECK:STDOUT: witness = @@ -1571,19 +1553,19 @@ impl C as Y {} // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %I.decl.loc3: type = interface_decl @I [concrete = constants.%I.type] {} {} // CHECK:STDOUT: %J.decl.loc4: type = interface_decl @J [concrete = constants.%J.type] {} {} -// CHECK:STDOUT: %.loc10_14.1: type = value_of_initializer @empty_struct_type.as..impl.%type.as.BitAndWith.impl.Op.call [concrete = constants.%facet_type] -// CHECK:STDOUT: %.loc10_14.2: type = converted @empty_struct_type.as..impl.%type.as.BitAndWith.impl.Op.call, %.loc10_14.1 [concrete = constants.%facet_type] +// CHECK:STDOUT: %.loc8_14.1: type = value_of_initializer @empty_struct_type.as..impl.%type.as.BitAndWith.impl.Op.call [concrete = constants.%facet_type] +// CHECK:STDOUT: %.loc8_14.2: type = converted @empty_struct_type.as..impl.%type.as.BitAndWith.impl.Op.call, %.loc8_14.1 [concrete = constants.%facet_type] // CHECK:STDOUT: impl_decl @empty_struct_type.as..impl [concrete] {} { -// CHECK:STDOUT: %.loc10_7.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc10_7.2: type = converted %.loc10_7.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc8_7.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc8_7.2: type = converted %.loc8_7.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl.loc3 [concrete = constants.%I.type] // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl.loc4 [concrete = constants.%J.type] // CHECK:STDOUT: %impl.elem0: %.b4e = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op] // CHECK:STDOUT: %bound_method: = bound_method %I.ref, %impl.elem0 [concrete = constants.%type.as.BitAndWith.impl.Op.bound] // CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call: init type = call %bound_method(%I.ref, %J.ref) [concrete = constants.%facet_type] // CHECK:STDOUT: } -// CHECK:STDOUT: %I.decl.loc12: type = interface_decl @I [concrete = constants.%I.type] {} {} -// CHECK:STDOUT: %J.decl.loc13: type = interface_decl @J [concrete = constants.%J.type] {} {} +// CHECK:STDOUT: %I.decl.loc10: type = interface_decl @I [concrete = constants.%I.type] {} {} +// CHECK:STDOUT: %J.decl.loc11: type = interface_decl @J [concrete = constants.%J.type] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { @@ -1608,7 +1590,7 @@ impl C as Y {} // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_struct_type.as..impl: %.loc10_7.2 as ; +// CHECK:STDOUT: impl @empty_struct_type.as..impl: %.loc8_7.2 as ; // CHECK:STDOUT: // CHECK:STDOUT: specific @I.WithSelf(constants.%Self.37e) {} // CHECK:STDOUT: @@ -1679,26 +1661,26 @@ impl C as Y {} // CHECK:STDOUT: } // CHECK:STDOUT: %.loc9: = impl_self_witness @C.as.I.impl.%C.ref.loc9, @I [concrete = constants.%.b7f] // CHECK:STDOUT: impl_decl @C.as.I.impl [concrete] {} { -// CHECK:STDOUT: %C.ref.loc18: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %I.ref.loc18: type = name_ref I, file.%I.decl [concrete = constants.%I.type] -// CHECK:STDOUT: %.Self.frozen.loc18: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %base_facet_type.loc18 = requirement_base_facet_type %I.ref.loc18 [concrete] -// CHECK:STDOUT: %.Self.ref.loc18: %I.type = name_ref .Self, %.Self.frozen.loc18 [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc18: type = facet_access_type %.Self.ref.loc18 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc18_19: type = converted %.Self.ref.loc18, %.Self.as_type.loc18 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %T.ref.loc18: %I.assoc_type = name_ref T, @T.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc18_19.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] -// CHECK:STDOUT: %.loc18_25.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc18_25.2: type = converted %.loc18_25.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %rewrite.loc18_22.1 = requirement_rewrite %impl.elem0.loc18_19.1, %.loc18_25.2 [concrete] -// CHECK:STDOUT: %impl.elem0.loc18_19.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] -// CHECK:STDOUT: %rewrite.loc18_22.2 = requirement_rewrite %impl.elem0.loc18_19.2, %.loc18_25.2 [concrete] -// CHECK:STDOUT: %.loc18_13: type = where_expr [concrete = constants.%I_where.type.d99] { -// CHECK:STDOUT: %base_facet_type.loc18 = requirement_base_facet_type %I.ref.loc18 [concrete] -// CHECK:STDOUT: %rewrite.loc18_22.2 = requirement_rewrite %impl.elem0.loc18_19.2, %.loc18_25.2 [concrete] +// CHECK:STDOUT: %C.ref.loc14: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %I.ref.loc14: type = name_ref I, file.%I.decl [concrete = constants.%I.type] +// CHECK:STDOUT: %.Self.frozen.loc14: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %base_facet_type.loc14 = requirement_base_facet_type %I.ref.loc14 [concrete] +// CHECK:STDOUT: %.Self.ref.loc14: %I.type = name_ref .Self, %.Self.frozen.loc14 [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc14: type = facet_access_type %.Self.ref.loc14 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc14_19: type = converted %.Self.ref.loc14, %.Self.as_type.loc14 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %T.ref.loc14: %I.assoc_type = name_ref T, @T.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc14_19.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] +// CHECK:STDOUT: %.loc14_25.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc14_25.2: type = converted %.loc14_25.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %rewrite.loc14_22.1 = requirement_rewrite %impl.elem0.loc14_19.1, %.loc14_25.2 [concrete] +// CHECK:STDOUT: %impl.elem0.loc14_19.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] +// CHECK:STDOUT: %rewrite.loc14_22.2 = requirement_rewrite %impl.elem0.loc14_19.2, %.loc14_25.2 [concrete] +// CHECK:STDOUT: %.loc14_13: type = where_expr [concrete = constants.%I_where.type.d99] { +// CHECK:STDOUT: %base_facet_type.loc14 = requirement_base_facet_type %I.ref.loc14 [concrete] +// CHECK:STDOUT: %rewrite.loc14_22.2 = requirement_rewrite %impl.elem0.loc14_19.2, %.loc14_25.2 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc18: = impl_self_witness @C.as.I.impl.%C.ref.loc18, @I [concrete = constants.%.b7f] +// CHECK:STDOUT: %.loc14: = impl_self_witness @C.as.I.impl.%C.ref.loc14, @I [concrete = constants.%.b7f] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { diff --git a/toolchain/check/testdata/impl/generic_redeclaration.carbon b/toolchain/check/testdata/impl/generic_redeclaration.carbon index bd4db2f84427..387f9ab610d6 100644 --- a/toolchain/check/testdata/impl/generic_redeclaration.carbon +++ b/toolchain/check/testdata/impl/generic_redeclaration.carbon @@ -45,12 +45,8 @@ interface I {} interface J {} impl forall [T: I] T as J {} -// CHECK:STDERR: fail_same_self_and_interface_redefined.carbon:[[@LINE+7]]:1: error: redefinition of `impl T as J` [ImplRedefinition] -// CHECK:STDERR: impl forall [T: I] T as J {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_same_self_and_interface_redefined.carbon:[[@LINE-4]]:1: note: previous definition was here [ImplPreviousDefinition] -// CHECK:STDERR: impl forall [T: I] T as J {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_same_self_and_interface_redefined.carbon:[[@LINE+3]]:1-27: error: redefinition of `impl T as J` [ImplRedefinition] +// CHECK:STDERR: fail_same_self_and_interface_redefined.carbon:[[@LINE-2]]:1-27: note: previous definition was here [ImplPreviousDefinition] // CHECK:STDERR: impl forall [T: I] T as J {} @@ -64,12 +60,8 @@ interface I {} // Since the spelling is different, it's not caught as a redefinition, but it // is diagnosed as an overlapping impl without using a `match_first` block. impl C as I {} -// CHECK:STDERR: fail_same_type_different_spelling.carbon:[[@LINE+7]]:1: error: found non-final `impl` with the same type structure as another non-final `impl` [ImplNonFinalSameTypeStructure] -// CHECK:STDERR: impl (C, C).0 as I {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_same_type_different_spelling.carbon:[[@LINE-4]]:1: note: other `impl` here [ImplNonFinalSameTypeStructureNote] -// CHECK:STDERR: impl C as I {} -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_same_type_different_spelling.carbon:[[@LINE+3]]:1-20: error: found non-final `impl` with the same type structure as another non-final `impl` [ImplNonFinalSameTypeStructure] +// CHECK:STDERR: fail_same_type_different_spelling.carbon:[[@LINE-2]]:1-13: note: other `impl` here [ImplNonFinalSameTypeStructureNote] // CHECK:STDERR: impl (C, C).0 as I {} @@ -81,12 +73,8 @@ impl forall [T: type] T as I { fn A() {} } -// CHECK:STDERR: fail_redefinition_generic_regions.carbon:[[@LINE+7]]:1: error: redefinition of `impl T as I` [ImplRedefinition] -// CHECK:STDERR: impl forall [T: type] T as I { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_redefinition_generic_regions.carbon:[[@LINE-7]]:1: note: previous definition was here [ImplPreviousDefinition] -// CHECK:STDERR: impl forall [T: type] T as I { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_redefinition_generic_regions.carbon:[[@LINE+3]]:1-30: error: redefinition of `impl T as I` [ImplRedefinition] +// CHECK:STDERR: fail_redefinition_generic_regions.carbon:[[@LINE-5]]:1-30: note: previous definition was here [ImplPreviousDefinition] // CHECK:STDERR: impl forall [T: type] T as I { // Although not referenced, B has the same generic region index of A, and @@ -524,19 +512,19 @@ impl forall [T: type] T as I { // CHECK:STDOUT: } // CHECK:STDOUT: %.loc7: = impl_self_witness @T.as_type.as.J.impl.377648.1.%.loc7_20, @J [symbolic = @T.as_type.as.J.impl.377648.1.%.loc7_27 (constants.%.d10)] // CHECK:STDOUT: impl_decl @T.as_type.as.J.impl.377648.2 [concrete] { -// CHECK:STDOUT: %T.patt.loc15_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc15_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc11_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_15.2 (constants.%T.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %T.ref: %I.type = name_ref T, %T.loc15_15.1 [symbolic = %T.loc15_15.2 (constants.%T)] -// CHECK:STDOUT: %T.as_type.loc15_20.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc15_20.2 (constants.%T.as_type)] -// CHECK:STDOUT: %.loc15_20: type = converted %T.ref, %T.as_type.loc15_20.1 [symbolic = %T.as_type.loc15_20.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.ref: %I.type = name_ref T, %T.loc11_15.1 [symbolic = %T.loc11_15.2 (constants.%T)] +// CHECK:STDOUT: %T.as_type.loc11_20.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc11_20.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc11_20: type = converted %T.ref, %T.as_type.loc11_20.1 [symbolic = %T.as_type.loc11_20.2 (constants.%T.as_type)] // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type] -// CHECK:STDOUT: %.loc15_17: type = splice_block %I.ref [concrete = constants.%I.type] { +// CHECK:STDOUT: %.loc11_17: type = splice_block %I.ref [concrete = constants.%I.type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc15_15.1: %I.type = symbolic_binding T, 0 [symbolic = %T.loc15_15.2 (constants.%T)] +// CHECK:STDOUT: %T.loc11_15.1: %I.type = symbolic_binding T, 0 [symbolic = %T.loc11_15.2 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc15: = impl_self_witness @T.as_type.as.J.impl.377648.2.%.loc15_20, @J [symbolic = @T.as_type.as.J.impl.377648.2.%.loc15_27 (constants.%.d10)] +// CHECK:STDOUT: %.loc11: = impl_self_witness @T.as_type.as.J.impl.377648.2.%.loc11_20, @J [symbolic = @T.as_type.as.J.impl.377648.2.%.loc11_27 (constants.%.d10)] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { @@ -580,15 +568,15 @@ impl forall [T: type] T as I { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @T.as_type.as.J.impl.377648.2(%T.loc15_15.1: %I.type) { -// CHECK:STDOUT: %T.patt.loc15_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc15_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc15_15.2: %I.type = symbolic_binding T, 0 [symbolic = %T.loc15_15.2 (constants.%T)] -// CHECK:STDOUT: %T.as_type.loc15_20.2: type = facet_access_type %T.loc15_15.2 [symbolic = %T.as_type.loc15_20.2 (constants.%T.as_type)] -// CHECK:STDOUT: %.loc15_27: = impl_self_witness %T.loc15_15.2, @J [symbolic = %.loc15_27 (constants.%.d10)] +// CHECK:STDOUT: generic impl @T.as_type.as.J.impl.377648.2(%T.loc11_15.1: %I.type) { +// CHECK:STDOUT: %T.patt.loc11_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc11_15.2: %I.type = symbolic_binding T, 0 [symbolic = %T.loc11_15.2 (constants.%T)] +// CHECK:STDOUT: %T.as_type.loc11_20.2: type = facet_access_type %T.loc11_15.2 [symbolic = %T.as_type.loc11_20.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc11_27: = impl_self_witness %T.loc11_15.2, @J [symbolic = %.loc11_27 (constants.%.d10)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: impl: %.loc15_20 as %J.ref { +// CHECK:STDOUT: impl: %.loc11_20 as %J.ref { // CHECK:STDOUT: !members: // CHECK:STDOUT: extend %J.ref // CHECK:STDOUT: witness = @@ -614,10 +602,10 @@ impl forall [T: type] T as I { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @T.as_type.as.J.impl.377648.2(constants.%T) { -// CHECK:STDOUT: %T.patt.loc15_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc15_15.2 => constants.%T -// CHECK:STDOUT: %T.as_type.loc15_20.2 => constants.%T.as_type -// CHECK:STDOUT: %.loc15_27 => constants.%.d10 +// CHECK:STDOUT: %T.patt.loc11_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc11_15.2 => constants.%T +// CHECK:STDOUT: %T.as_type.loc11_20.2 => constants.%T.as_type +// CHECK:STDOUT: %.loc11_27 => constants.%.d10 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_same_type_different_spelling.carbon @@ -659,16 +647,16 @@ impl forall [T: type] T as I { // CHECK:STDOUT: } // CHECK:STDOUT: %.loc9: = impl_self_witness @C.as.I.impl.e103db.1.%C.ref, @I [concrete = constants.%.b7f] // CHECK:STDOUT: impl_decl @C.as.I.impl.e103db.2 [concrete] {} { -// CHECK:STDOUT: %C.ref.loc17_7: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %C.ref.loc17_10: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc17_11.1: %tuple.type = tuple_literal (%C.ref.loc17_7, %C.ref.loc17_10) [concrete = constants.%tuple] +// CHECK:STDOUT: %C.ref.loc13_7: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %C.ref.loc13_10: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %.loc13_11.1: %tuple.type = tuple_literal (%C.ref.loc13_7, %C.ref.loc13_10) [concrete = constants.%tuple] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] -// CHECK:STDOUT: %tuple: %tuple.type = tuple_value (%C.ref.loc17_7, %C.ref.loc17_10) [concrete = constants.%tuple] -// CHECK:STDOUT: %.loc17_11.2: %tuple.type = converted %.loc17_11.1, %tuple [concrete = constants.%tuple] -// CHECK:STDOUT: %tuple.elem0: type = tuple_access %.loc17_11.2, element0 [concrete = constants.%C] +// CHECK:STDOUT: %tuple: %tuple.type = tuple_value (%C.ref.loc13_7, %C.ref.loc13_10) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc13_11.2: %tuple.type = converted %.loc13_11.1, %tuple [concrete = constants.%tuple] +// CHECK:STDOUT: %tuple.elem0: type = tuple_access %.loc13_11.2, element0 [concrete = constants.%C] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc17: = impl_self_witness @C.as.I.impl.e103db.2.%tuple.elem0, @I [concrete = constants.%.b7f] +// CHECK:STDOUT: %.loc13: = impl_self_witness @C.as.I.impl.e103db.2.%tuple.elem0, @I [concrete = constants.%.b7f] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { @@ -771,17 +759,17 @@ impl forall [T: type] T as I { // CHECK:STDOUT: } // CHECK:STDOUT: %.loc4: = impl_self_witness @T.as.I.impl.812d8b.1.%T.ref, @I [symbolic = @T.as.I.impl.812d8b.1.%.loc4_30 (constants.%.917)] // CHECK:STDOUT: impl_decl @T.as.I.impl.812d8b.2 [concrete] { -// CHECK:STDOUT: %T.patt.loc15_15.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc15_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc11_15.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_15.2 (constants.%T.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc15_15.2 [symbolic = %T.loc15_15.1 (constants.%T)] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc11_15.2 [symbolic = %T.loc11_15.1 (constants.%T)] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] -// CHECK:STDOUT: %.loc15_17.1: type = splice_block %.loc15_17.2 [concrete = type] { +// CHECK:STDOUT: %.loc11_17.1: type = splice_block %.loc11_17.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc15_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc11_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc15_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc15_15.1 (constants.%T)] +// CHECK:STDOUT: %T.loc11_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc11_15.1 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc15: = impl_self_witness @T.as.I.impl.812d8b.2.%T.ref, @I [symbolic = @T.as.I.impl.812d8b.2.%.loc15_30 (constants.%.917)] +// CHECK:STDOUT: %.loc11: = impl_self_witness @T.as.I.impl.812d8b.2.%T.ref, @I [symbolic = @T.as.I.impl.812d8b.2.%.loc11_30 (constants.%.917)] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { @@ -817,38 +805,38 @@ impl forall [T: type] T as I { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @T.as.I.impl.812d8b.2(%T.loc15_15.2: type) { -// CHECK:STDOUT: %T.patt.loc15_15.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc15_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc15_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc15_15.1 (constants.%T)] -// CHECK:STDOUT: %.loc15_30: = impl_self_witness %T.loc15_15.1, @I [symbolic = %.loc15_30 (constants.%.917)] +// CHECK:STDOUT: generic impl @T.as.I.impl.812d8b.2(%T.loc11_15.2: type) { +// CHECK:STDOUT: %T.patt.loc11_15.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc11_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc11_15.1 (constants.%T)] +// CHECK:STDOUT: %.loc11_30: = impl_self_witness %T.loc11_15.1, @I [symbolic = %.loc11_30 (constants.%.917)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %T.as.I.impl.B.type: type = fn_type @T.as.I.impl.B, @T.as.I.impl.812d8b.2(%T.loc15_15.1) [symbolic = %T.as.I.impl.B.type (constants.%T.as.I.impl.B.type)] +// CHECK:STDOUT: %T.as.I.impl.B.type: type = fn_type @T.as.I.impl.B, @T.as.I.impl.812d8b.2(%T.loc11_15.1) [symbolic = %T.as.I.impl.B.type (constants.%T.as.I.impl.B.type)] // CHECK:STDOUT: %T.as.I.impl.B: @T.as.I.impl.812d8b.2.%T.as.I.impl.B.type (%T.as.I.impl.B.type) = struct_value () [symbolic = %T.as.I.impl.B (constants.%T.as.I.impl.B)] -// CHECK:STDOUT: %T.as.I.impl.C.type: type = fn_type @T.as.I.impl.C, @T.as.I.impl.812d8b.2(%T.loc15_15.1) [symbolic = %T.as.I.impl.C.type (constants.%T.as.I.impl.C.type)] +// CHECK:STDOUT: %T.as.I.impl.C.type: type = fn_type @T.as.I.impl.C, @T.as.I.impl.812d8b.2(%T.loc11_15.1) [symbolic = %T.as.I.impl.C.type (constants.%T.as.I.impl.C.type)] // CHECK:STDOUT: %T.as.I.impl.C: @T.as.I.impl.812d8b.2.%T.as.I.impl.C.type (%T.as.I.impl.C.type) = struct_value () [symbolic = %T.as.I.impl.C (constants.%T.as.I.impl.C)] -// CHECK:STDOUT: %T.as.I.impl.D.type: type = fn_type @T.as.I.impl.D, @T.as.I.impl.812d8b.2(%T.loc15_15.1) [symbolic = %T.as.I.impl.D.type (constants.%T.as.I.impl.D.type)] +// CHECK:STDOUT: %T.as.I.impl.D.type: type = fn_type @T.as.I.impl.D, @T.as.I.impl.812d8b.2(%T.loc11_15.1) [symbolic = %T.as.I.impl.D.type (constants.%T.as.I.impl.D.type)] // CHECK:STDOUT: %T.as.I.impl.D: @T.as.I.impl.812d8b.2.%T.as.I.impl.D.type (%T.as.I.impl.D.type) = struct_value () [symbolic = %T.as.I.impl.D (constants.%T.as.I.impl.D)] // CHECK:STDOUT: // CHECK:STDOUT: impl: %T.ref as %I.ref { // CHECK:STDOUT: %T.as.I.impl.B.decl: @T.as.I.impl.812d8b.2.%T.as.I.impl.B.type (%T.as.I.impl.B.type) = fn_decl @T.as.I.impl.B [symbolic = @T.as.I.impl.812d8b.2.%T.as.I.impl.B (constants.%T.as.I.impl.B)] {} {} // CHECK:STDOUT: %T.as.I.impl.C.decl: @T.as.I.impl.812d8b.2.%T.as.I.impl.C.type (%T.as.I.impl.C.type) = fn_decl @T.as.I.impl.C [symbolic = @T.as.I.impl.812d8b.2.%T.as.I.impl.C (constants.%T.as.I.impl.C)] { // CHECK:STDOUT: %return.param_patt: %pattern_type.cb1 = out_param_pattern [concrete = constants.%return.param_patt] -// CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern %return.param_patt, %.loc19_14.2 [concrete = constants.%return.patt] +// CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern %return.param_patt, %.loc15_14.2 [concrete = constants.%return.patt] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc19_14.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc19_14.2: type = converted %.loc19_14.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc19_14.3: Core.Form = init_form %.loc19_14.2 [concrete = constants.%.262] +// CHECK:STDOUT: %.loc15_14.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc15_14.2: type = converted %.loc15_14.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc15_14.3: Core.Form = init_form %.loc15_14.2 [concrete = constants.%.262] // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0 // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %T.as.I.impl.D.decl: @T.as.I.impl.812d8b.2.%T.as.I.impl.D.type (%T.as.I.impl.D.type) = fn_decl @T.as.I.impl.D [symbolic = @T.as.I.impl.812d8b.2.%T.as.I.impl.D (constants.%T.as.I.impl.D)] { // CHECK:STDOUT: %return.param_patt: %pattern_type.cb1 = out_param_pattern [concrete = constants.%return.param_patt] -// CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern %return.param_patt, %.loc20_14.2 [concrete = constants.%return.patt] +// CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern %return.param_patt, %.loc16_14.2 [concrete = constants.%return.patt] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc20_14.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc20_14.2: type = converted %.loc20_14.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc20_14.3: Core.Form = init_form %.loc20_14.2 [concrete = constants.%.262] +// CHECK:STDOUT: %.loc16_14.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc16_14.2: type = converted %.loc16_14.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc16_14.3: Core.Form = init_form %.loc16_14.2 [concrete = constants.%.262] // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0 // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param // CHECK:STDOUT: } @@ -871,7 +859,7 @@ impl forall [T: type] T as I { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @T.as.I.impl.B(@T.as.I.impl.812d8b.2.%T.loc15_15.2: type) { +// CHECK:STDOUT: generic fn @T.as.I.impl.B(@T.as.I.impl.812d8b.2.%T.loc11_15.2: type) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: // CHECK:STDOUT: fn() { @@ -880,31 +868,31 @@ impl forall [T: type] T as I { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @T.as.I.impl.C(@T.as.I.impl.812d8b.2.%T.loc15_15.2: type) { +// CHECK:STDOUT: generic fn @T.as.I.impl.C(@T.as.I.impl.812d8b.2.%T.loc11_15.2: type) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: // CHECK:STDOUT: fn() -> out %return.param: %empty_tuple.type { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc19_26.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc19_26.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc19_27: init %empty_tuple.type = converted %.loc19_26.1, %.loc19_26.2 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: return %.loc19_27 +// CHECK:STDOUT: %.loc15_26.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc15_26.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc15_27: init %empty_tuple.type = converted %.loc15_26.1, %.loc15_26.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: return %.loc15_27 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @T.as.I.impl.D(@T.as.I.impl.812d8b.2.%T.loc15_15.2: type) { +// CHECK:STDOUT: generic fn @T.as.I.impl.D(@T.as.I.impl.812d8b.2.%T.loc11_15.2: type) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic = %T (constants.%T)] // CHECK:STDOUT: %T.as.I.impl.C.type: type = fn_type @T.as.I.impl.C, @T.as.I.impl.812d8b.2(%T) [symbolic = %T.as.I.impl.C.type (constants.%T.as.I.impl.C.type)] // CHECK:STDOUT: %T.as.I.impl.C: @T.as.I.impl.D.%T.as.I.impl.C.type (%T.as.I.impl.C.type) = struct_value () [symbolic = %T.as.I.impl.C (constants.%T.as.I.impl.C)] -// CHECK:STDOUT: %T.as.I.impl.C.specific_fn.loc21_12.2: = specific_function %T.as.I.impl.C, @T.as.I.impl.C(%T) [symbolic = %T.as.I.impl.C.specific_fn.loc21_12.2 (constants.%T.as.I.impl.C.specific_fn)] +// CHECK:STDOUT: %T.as.I.impl.C.specific_fn.loc17_12.2: = specific_function %T.as.I.impl.C, @T.as.I.impl.C(%T) [symbolic = %T.as.I.impl.C.specific_fn.loc17_12.2 (constants.%T.as.I.impl.C.specific_fn)] // CHECK:STDOUT: // CHECK:STDOUT: fn() -> out %return.param: %empty_tuple.type { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc21: @T.as.I.impl.D.%T.as.I.impl.C.type (%T.as.I.impl.C.type) = specific_constant @T.as.I.impl.812d8b.2.%T.as.I.impl.C.decl, @T.as.I.impl.812d8b.2(constants.%T) [symbolic = %T.as.I.impl.C (constants.%T.as.I.impl.C)] -// CHECK:STDOUT: %C.ref: @T.as.I.impl.D.%T.as.I.impl.C.type (%T.as.I.impl.C.type) = name_ref C, %.loc21 [symbolic = %T.as.I.impl.C (constants.%T.as.I.impl.C)] -// CHECK:STDOUT: %T.as.I.impl.C.specific_fn.loc21_12.1: = specific_function %C.ref, @T.as.I.impl.C(constants.%T) [symbolic = %T.as.I.impl.C.specific_fn.loc21_12.2 (constants.%T.as.I.impl.C.specific_fn)] -// CHECK:STDOUT: %T.as.I.impl.C.call: init %empty_tuple.type = call %T.as.I.impl.C.specific_fn.loc21_12.1() +// CHECK:STDOUT: %.loc17: @T.as.I.impl.D.%T.as.I.impl.C.type (%T.as.I.impl.C.type) = specific_constant @T.as.I.impl.812d8b.2.%T.as.I.impl.C.decl, @T.as.I.impl.812d8b.2(constants.%T) [symbolic = %T.as.I.impl.C (constants.%T.as.I.impl.C)] +// CHECK:STDOUT: %C.ref: @T.as.I.impl.D.%T.as.I.impl.C.type (%T.as.I.impl.C.type) = name_ref C, %.loc17 [symbolic = %T.as.I.impl.C (constants.%T.as.I.impl.C)] +// CHECK:STDOUT: %T.as.I.impl.C.specific_fn.loc17_12.1: = specific_function %C.ref, @T.as.I.impl.C(constants.%T) [symbolic = %T.as.I.impl.C.specific_fn.loc17_12.2 (constants.%T.as.I.impl.C.specific_fn)] +// CHECK:STDOUT: %T.as.I.impl.C.call: init %empty_tuple.type = call %T.as.I.impl.C.specific_fn.loc17_12.1() // CHECK:STDOUT: return %T.as.I.impl.C.call // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -931,9 +919,9 @@ impl forall [T: type] T as I { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @T.as.I.impl.812d8b.2(constants.%T) { -// CHECK:STDOUT: %T.patt.loc15_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc15_15.1 => constants.%T -// CHECK:STDOUT: %.loc15_30 => constants.%.917 +// CHECK:STDOUT: %T.patt.loc11_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc11_15.1 => constants.%T +// CHECK:STDOUT: %.loc11_30 => constants.%.917 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %T.as.I.impl.B.type => constants.%T.as.I.impl.B.type diff --git a/toolchain/check/testdata/impl/impl_as_named_constraint.carbon b/toolchain/check/testdata/impl/impl_as_named_constraint.carbon index 9003d545e64b..6cf33a912fca 100644 --- a/toolchain/check/testdata/impl/impl_as_named_constraint.carbon +++ b/toolchain/check/testdata/impl/impl_as_named_constraint.carbon @@ -15,9 +15,7 @@ library "[[@TEST_NAME]]"; constraint A {} -// CHECK:STDERR: fail_empty_constraint.carbon:[[@LINE+4]]:1: error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] -// CHECK:STDERR: impl () as A {} -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_empty_constraint.carbon:[[@LINE+2]]:1-14: error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] // CHECK:STDERR: impl () as A {} @@ -31,9 +29,7 @@ constraint B { extend require impls A2; } -// CHECK:STDERR: fail_too_many_interfaces_in_constraint.carbon:[[@LINE+4]]:1: error: impl as 2 interfaces, expected 1 [ImplOfNotOneInterface] -// CHECK:STDERR: impl () as B {} -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_many_interfaces_in_constraint.carbon:[[@LINE+2]]:1-14: error: impl as 2 interfaces, expected 1 [ImplOfNotOneInterface] // CHECK:STDERR: impl () as B {} @@ -55,9 +51,7 @@ constraint B { require impls A; } -// CHECK:STDERR: fail_one_impls_interface_in_constraint.carbon:[[@LINE+4]]:1: error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] -// CHECK:STDERR: impl () as B {} -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_one_impls_interface_in_constraint.carbon:[[@LINE+2]]:1-14: error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] // CHECK:STDERR: impl () as B {} @@ -86,9 +80,7 @@ constraint C { require impls B; } -// CHECK:STDERR: fail_nested_constraints_not_extend_outer.carbon:[[@LINE+4]]:1: error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] -// CHECK:STDERR: impl () as C {} -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_nested_constraints_not_extend_outer.carbon:[[@LINE+2]]:1-14: error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] // CHECK:STDERR: impl () as C {} @@ -104,9 +96,7 @@ constraint C { extend require impls B; } -// CHECK:STDERR: fail_nested_constraints_not_extend_inner.carbon:[[@LINE+4]]:1: error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] -// CHECK:STDERR: impl () as C {} -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_nested_constraints_not_extend_inner.carbon:[[@LINE+2]]:1-14: error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] // CHECK:STDERR: impl () as C {} @@ -122,9 +112,7 @@ constraint C { require impls B; } -// CHECK:STDERR: fail_nested_constraints_not_extend_both.carbon:[[@LINE+4]]:1: error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] -// CHECK:STDERR: impl () as C {} -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_nested_constraints_not_extend_both.carbon:[[@LINE+2]]:1-14: error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] // CHECK:STDERR: impl () as C {} @@ -140,12 +128,8 @@ constraint B(X: type, Y: type) { // This should impl () as A({}). impl () as B((), {}) {} -// CHECK:STDERR: fail_duplicate_through_generic_constraint.carbon:[[@LINE+7]]:1: error: found non-final `impl` with the same type structure as another non-final `impl` [ImplNonFinalSameTypeStructure] -// CHECK:STDERR: impl () as A({}) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_duplicate_through_generic_constraint.carbon:[[@LINE-5]]:1: note: other `impl` here [ImplNonFinalSameTypeStructureNote] -// CHECK:STDERR: impl () as B((), {}) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_duplicate_through_generic_constraint.carbon:[[@LINE+3]]:1-18: error: found non-final `impl` with the same type structure as another non-final `impl` [ImplNonFinalSameTypeStructure] +// CHECK:STDERR: fail_duplicate_through_generic_constraint.carbon:[[@LINE-3]]:1-22: note: other `impl` here [ImplNonFinalSameTypeStructureNote] // CHECK:STDERR: impl () as A({}) {} @@ -158,9 +142,7 @@ interface A(T: type) {} // the constraint. //@dump-sem-ir-begin // -// CHECK:STDERR: fail_error_self_in_require.carbon:[[@LINE+4]]:17: error: name `Undefined` not found [NameNotFound] -// CHECK:STDERR: constraint B(X: Undefined) { -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_error_self_in_require.carbon:[[@LINE+2]]:17-25: error: name `Undefined` not found [NameNotFound] // CHECK:STDERR: constraint B(X: Undefined) { extend require impls A(X); @@ -282,16 +264,10 @@ class C; // the first one. Once rewrites can be done in the impl defn body, these errors // won't always have the same location (with the location being the decl) // though. -// CHECK:STDERR: fail_impl_as_constraint_missing_rewrite.carbon:[[@LINE+11]]:1: error: accessing member from impl before it has a defined value [ImplAccessMemberBeforeSet] -// CHECK:STDERR: impl C as N {} -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_impl_as_constraint_missing_rewrite.carbon:[[@LINE+5]]:1-13: error: accessing member from impl before it has a defined value [ImplAccessMemberBeforeSet] // CHECK:STDERR: -// CHECK:STDERR: fail_impl_as_constraint_missing_rewrite.carbon:[[@LINE+7]]:1: error: associated constant I1 not given a value in impl of interface I [ImplAssociatedConstantNeedsValue] -// CHECK:STDERR: impl C as N {} -// CHECK:STDERR: ^~~~~~~~~~~~~ -// CHECK:STDERR: fail_impl_as_constraint_missing_rewrite.carbon:[[@LINE-20]]:7: note: associated constant declared here [AssociatedConstantHere] -// CHECK:STDERR: let I1: type; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_impl_as_constraint_missing_rewrite.carbon:[[@LINE+3]]:1-13: error: associated constant I1 not given a value in impl of interface I [ImplAssociatedConstantNeedsValue] +// CHECK:STDERR: fail_impl_as_constraint_missing_rewrite.carbon:[[@LINE-16]]:7-14: note: associated constant declared here [AssociatedConstantHere] // CHECK:STDERR: impl C as N {} @@ -309,9 +285,7 @@ constraint Y { } // Y does not have any extend require on `Self`. -// CHECK:STDERR: fail_no_require_self.carbon:[[@LINE+4]]:1: error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] -// CHECK:STDERR: impl () as Y {} -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_no_require_self.carbon:[[@LINE+2]]:1-14: error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] // CHECK:STDERR: impl () as Y {} diff --git a/toolchain/check/testdata/impl/impl_assoc_const.carbon b/toolchain/check/testdata/impl/impl_assoc_const.carbon index 7960c7bb0978..168c92dfd40e 100644 --- a/toolchain/check/testdata/impl/impl_assoc_const.carbon +++ b/toolchain/check/testdata/impl/impl_assoc_const.carbon @@ -37,9 +37,7 @@ library "[[@TEST_NAME]]"; interface I3 { let T3: type; } -// CHECK:STDERR: fail_redecl_adds_rewrites.carbon:[[@LINE+4]]:1: error: impl declared but not defined [ImplMissingDefinition] -// CHECK:STDERR: impl () as I3; -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_redecl_adds_rewrites.carbon:[[@LINE+2]]:1-14: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl () as I3; impl () as I3 where .T3 = {} {} @@ -49,9 +47,7 @@ library "[[@TEST_NAME]]"; interface J { let U: type; } -// CHECK:STDERR: fail_mismatch.carbon:[[@LINE+4]]:1: error: impl declared but not defined [ImplMissingDefinition] -// CHECK:STDERR: impl () as J where .U = {}; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_mismatch.carbon:[[@LINE+2]]:1-27: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl () as J where .U = {}; impl () as J where .U = () {} @@ -65,23 +61,15 @@ interface I4 { let T6: type; } -// CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+8]]:27: error: name `BAD1` not found [NameNotFound] -// CHECK:STDERR: impl () as I4 where .T4 = BAD1 and .T5 = {.a: {}} and .T6 = BAD2; -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+4]]:27-30: error: name `BAD1` not found [NameNotFound] // CHECK:STDERR: -// CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+4]]:61: error: name `BAD2` not found [NameNotFound] -// CHECK:STDERR: impl () as I4 where .T4 = BAD1 and .T5 = {.a: {}} and .T6 = BAD2; -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+2]]:61-64: error: name `BAD2` not found [NameNotFound] // CHECK:STDERR: impl () as I4 where .T4 = BAD1 and .T5 = {.a: {}} and .T6 = BAD2; -// CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+8]]:46: error: name `BAD3` not found [NameNotFound] -// CHECK:STDERR: impl () as I4 where .T4 = {.b: {}} and .T5 = BAD3 and .T6 = BAD4 {} -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+4]]:46-49: error: name `BAD3` not found [NameNotFound] // CHECK:STDERR: -// CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+4]]:61: error: name `BAD4` not found [NameNotFound] -// CHECK:STDERR: impl () as I4 where .T4 = {.b: {}} and .T5 = BAD3 and .T6 = BAD4 {} -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+2]]:61-64: error: name `BAD4` not found [NameNotFound] // CHECK:STDERR: impl () as I4 where .T4 = {.b: {}} and .T5 = BAD3 and .T6 = BAD4 {} @@ -91,16 +79,10 @@ library "[[@TEST_NAME]]"; interface K { let V: type; } impl () as K where .V = {}; -// CHECK:STDERR: fail_missing_on_definition.carbon:[[@LINE+11]]:1: error: associated constant V not given a value in impl of interface K [ImplAssociatedConstantNeedsValue] -// CHECK:STDERR: impl () as K {} -// CHECK:STDERR: ^~~~~~~~~~~~~~ -// CHECK:STDERR: fail_missing_on_definition.carbon:[[@LINE-6]]:19: note: associated constant declared here [AssociatedConstantHere] -// CHECK:STDERR: interface K { let V: type; } -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_missing_on_definition.carbon:[[@LINE+5]]:1-14: error: associated constant V not given a value in impl of interface K [ImplAssociatedConstantNeedsValue] +// CHECK:STDERR: fail_missing_on_definition.carbon:[[@LINE-4]]:19-25: note: associated constant declared here [AssociatedConstantHere] // CHECK:STDERR: -// CHECK:STDERR: fail_missing_on_definition.carbon:[[@LINE-8]]:1: error: impl declared but not defined [ImplMissingDefinition] -// CHECK:STDERR: impl () as K where .V = {}; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_missing_on_definition.carbon:[[@LINE-4]]:1-27: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl () as K {} @@ -109,9 +91,7 @@ library "[[@TEST_NAME]]"; interface L { let W: type; } -// CHECK:STDERR: fail_two_different.carbon:[[@LINE+4]]:12: error: associated constant `.(L.W)` given two different values `{}` and `()` [AssociatedConstantWithDifferentValues] -// CHECK:STDERR: impl () as L where .W = {} and .W = () {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_two_different.carbon:[[@LINE+2]]:12-38: error: associated constant `.(L.W)` given two different values `{}` and `()` [AssociatedConstantWithDifferentValues] // CHECK:STDERR: impl () as L where .W = {} and .W = () {} @@ -120,9 +100,7 @@ library "[[@TEST_NAME]]"; interface L2 { let W2: type; let X2: type; } -// CHECK:STDERR: fail_two_different_first_associated.carbon:[[@LINE+4]]:12: error: associated constant `.(L2.W2)` given two different values `()` and `.(L2.X2)` [AssociatedConstantWithDifferentValues] -// CHECK:STDERR: impl () as L2 where .W2 = .X2 and .W2 = () {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_two_different_first_associated.carbon:[[@LINE+2]]:12-42: error: associated constant `.(L2.W2)` given two different values `()` and `.(L2.X2)` [AssociatedConstantWithDifferentValues] // CHECK:STDERR: impl () as L2 where .W2 = .X2 and .W2 = () {} @@ -131,9 +109,7 @@ library "[[@TEST_NAME]]"; interface L2 { let W2: type; let X2: type; } -// CHECK:STDERR: fail_two_different_second_associated.carbon:[[@LINE+4]]:12: error: associated constant `.(L2.W2)` given two different values `()` and `.(L2.X2)` [AssociatedConstantWithDifferentValues] -// CHECK:STDERR: impl () as L2 where .W2 = () and .W2 = .X2 {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_two_different_second_associated.carbon:[[@LINE+2]]:12-42: error: associated constant `.(L2.W2)` given two different values `()` and `.(L2.X2)` [AssociatedConstantWithDifferentValues] // CHECK:STDERR: impl () as L2 where .W2 = () and .W2 = .X2 {} @@ -142,9 +118,7 @@ library "[[@TEST_NAME]]"; interface L2 { let W2: type; } -// CHECK:STDERR: fail_two_different_first_bad.carbon:[[@LINE+4]]:27: error: name `BAD5` not found [NameNotFound] -// CHECK:STDERR: impl () as L2 where .W2 = BAD5 and .W2 = () {} -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_two_different_first_bad.carbon:[[@LINE+2]]:27-30: error: name `BAD5` not found [NameNotFound] // CHECK:STDERR: impl () as L2 where .W2 = BAD5 and .W2 = () {} @@ -153,9 +127,7 @@ library "[[@TEST_NAME]]"; interface L3 { let W3: type; } -// CHECK:STDERR: fail_two_different_second_bad.carbon:[[@LINE+4]]:40: error: name `BAD6` not found [NameNotFound] -// CHECK:STDERR: impl () as L3 where .W3 = {} and .W3 = BAD6 {} -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_two_different_second_bad.carbon:[[@LINE+2]]:40-43: error: name `BAD6` not found [NameNotFound] // CHECK:STDERR: impl () as L3 where .W3 = {} and .W3 = BAD6 {} @@ -164,13 +136,9 @@ library "[[@TEST_NAME]]"; interface L4 { let W4: type; } -// CHECK:STDERR: fail_two_different_both_bad.carbon:[[@LINE+8]]:27: error: name `BAD7` not found [NameNotFound] -// CHECK:STDERR: impl () as L4 where .W4 = BAD7 and .W4 = BAD8 {} -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_two_different_both_bad.carbon:[[@LINE+4]]:27-30: error: name `BAD7` not found [NameNotFound] // CHECK:STDERR: -// CHECK:STDERR: fail_two_different_both_bad.carbon:[[@LINE+4]]:42: error: name `BAD8` not found [NameNotFound] -// CHECK:STDERR: impl () as L4 where .W4 = BAD7 and .W4 = BAD8 {} -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_two_different_both_bad.carbon:[[@LINE+2]]:42-45: error: name `BAD8` not found [NameNotFound] // CHECK:STDERR: impl () as L4 where .W4 = BAD7 and .W4 = BAD8 {} @@ -183,9 +151,7 @@ interface L { let W: type; } // are all errors, and they get deduped). // //@dump-sem-ir-begin -// CHECK:STDERR: fail_many_different.carbon:[[@LINE+4]]:12: error: associated constant `.(L.W)` given two different values `((), (), ())` and `({}, (), ())` [AssociatedConstantWithDifferentValues] -// CHECK:STDERR: impl () as L where .W = ((), (), ()) and .W = ({}, (), ()) and .W = ({}, {}, ()) and .W = ({}, (), {}) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_many_different.carbon:[[@LINE+2]]:12-102: error: associated constant `.(L.W)` given two different values `((), (), ())` and `({}, (), ())` [AssociatedConstantWithDifferentValues] // CHECK:STDERR: impl () as L where .W = ((), (), ()) and .W = ({}, (), ()) and .W = ({}, {}, ()) and .W = ({}, (), {}) {} //@dump-sem-ir-end @@ -218,9 +184,7 @@ library "[[@TEST_NAME]]"; interface M { let X: type; } -// CHECK:STDERR: fail_repeated_and_different.carbon:[[@LINE+4]]:12: error: associated constant `.(M.X)` given two different values `{}` and `()` [AssociatedConstantWithDifferentValues] -// CHECK:STDERR: impl () as M where .X = {} and .X = () and .X = {} {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_repeated_and_different.carbon:[[@LINE+2]]:12-50: error: associated constant `.(M.X)` given two different values `{}` and `()` [AssociatedConstantWithDifferentValues] // CHECK:STDERR: impl () as M where .X = {} and .X = () and .X = {} {} @@ -231,18 +195,14 @@ interface M { let X: type; } // This fails because it resolves to `.X = .X` which is cyclical. // -// CHECK:STDERR: fail_cycle_single.carbon:[[@LINE+4]]:12: error: found cycle in facet type constraint for `.(M.X)` [FacetTypeConstraintCycle] -// CHECK:STDERR: impl () as M where .X = .X {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_cycle_single.carbon:[[@LINE+2]]:12-26: error: found cycle in facet type constraint for `.(M.X)` [FacetTypeConstraintCycle] // CHECK:STDERR: impl () as M where .X = .X {} // Even though `.X = ()` is specified, the rewrites are resolved left to right // and a cycle `.X = .X` is found first. // -// CHECK:STDERR: fail_cycle_single.carbon:[[@LINE+4]]:12: error: found cycle in facet type constraint for `.(M.X)` [FacetTypeConstraintCycle] -// CHECK:STDERR: impl () as M where .X = .X and .X = () {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_cycle_single.carbon:[[@LINE+2]]:12-38: error: found cycle in facet type constraint for `.(M.X)` [FacetTypeConstraintCycle] // CHECK:STDERR: impl () as M where .X = .X and .X = () {} @@ -255,9 +215,7 @@ interface M { let X: type; let Y: type; let Z: type; } // The value of .X and .Y becomes but .Z is still valid. // //@dump-sem-ir-begin -// CHECK:STDERR: fail_cycle.carbon:[[@LINE+4]]:12: error: found cycle in facet type constraint for `.(M.Y)` [FacetTypeConstraintCycle] -// CHECK:STDERR: impl () as M where .X = .Y and .Y = .X and .Z = () {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_cycle.carbon:[[@LINE+2]]:12-50: error: found cycle in facet type constraint for `.(M.Y)` [FacetTypeConstraintCycle] // CHECK:STDERR: impl () as M where .X = .Y and .Y = .X and .Z = () {} //@dump-sem-ir-end @@ -277,17 +235,11 @@ interface J { // now it's failing due to compound member access in a rewrite constraint not // working. // -// CHECK:STDERR: fail_todo_cycle_between_interfaces.carbon:[[@LINE+12]]:45: error: expected identifier or `Self` after `.` [ExpectedIdentifierOrSelfAfterPeriod] -// CHECK:STDERR: impl () as I where .Self impls J and .X1 = .(J.X3) and .X2 = .X1 and .(J.X3) = .X2 {} -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_todo_cycle_between_interfaces.carbon:[[@LINE+6]]:45: error: expected identifier or `Self` after `.` [ExpectedIdentifierOrSelfAfterPeriod] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_cycle_between_interfaces.carbon:[[@LINE+8]]:45: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] -// CHECK:STDERR: impl () as I where .Self impls J and .X1 = .(J.X3) and .X2 = .X1 and .(J.X3) = .X2 {} -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_todo_cycle_between_interfaces.carbon:[[@LINE+4]]:45: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_cycle_between_interfaces.carbon:[[@LINE+4]]:71: error: expected identifier or `Self` after `.` [ExpectedIdentifierOrSelfAfterPeriod] -// CHECK:STDERR: impl () as I where .Self impls J and .X1 = .(J.X3) and .X2 = .X1 and .(J.X3) = .X2 {} -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_todo_cycle_between_interfaces.carbon:[[@LINE+2]]:71: error: expected identifier or `Self` after `.` [ExpectedIdentifierOrSelfAfterPeriod] // CHECK:STDERR: impl () as I where .Self impls J and .X1 = .(J.X3) and .X2 = .X1 and .(J.X3) = .X2 {} @@ -316,9 +268,7 @@ interface N { let Y: {.a: type}; } -// CHECK:STDERR: fail_non-type_different.carbon:[[@LINE+4]]:12: error: associated constant `.(N.Y)` given two different values `{.a = {}}` and `{.a = ()}` [AssociatedConstantWithDifferentValues] -// CHECK:STDERR: impl () as N where .Y = {.a = {}} and .Y = {.a = ()} {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_non-type_different.carbon:[[@LINE+2]]:12-52: error: associated constant `.(N.Y)` given two different values `{.a = {}}` and `{.a = ()}` [AssociatedConstantWithDifferentValues] // CHECK:STDERR: impl () as N where .Y = {.a = {}} and .Y = {.a = ()} {} @@ -329,9 +279,7 @@ interface IF { fn F(); } class CD { } -// CHECK:STDERR: fail_where_rewrite_function.carbon:[[@LINE+4]]:12: error: rewrite specified for associated function F [RewriteForAssociatedFunction] -// CHECK:STDERR: impl CD as IF where .F = 0 { -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_where_rewrite_function.carbon:[[@LINE+2]]:12-26: error: rewrite specified for associated function F [RewriteForAssociatedFunction] // CHECK:STDERR: impl CD as IF where .F = 0 { fn F() {} @@ -361,9 +309,7 @@ impl C as Y {} // decl (where we know .Self is C). See: // https://discord.com/channels/655572317891461132/941071822756143115/1400953094015160370 // -// CHECK:STDERR: fail_todo_period_self_impl_lookup.carbon:[[@LINE+4]]:25: error: cannot convert type `.Self` that implements `Z` into type implementing `Y` [ConversionFailureFacetToFacet] -// CHECK:STDERR: impl C as Z where .Z1 = .Self {} -// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: fail_todo_period_self_impl_lookup.carbon:[[@LINE+2]]:25-29: error: cannot convert type `.Self` that implements `Z` into type implementing `Y` [ConversionFailureFacetToFacet] // CHECK:STDERR: impl C as Z where .Z1 = .Self {} @@ -382,9 +328,7 @@ impl C as Z where .Z1 = C {} // Implied constraint: .Self impls Y. Should be verified against the type of the // facet value replacing T when calling F. // -// CHECK:STDERR: fail_todo_period_self_compared_with_concrete_self.carbon:[[@LINE+4]]:38: error: cannot convert type `.Self` that implements `Z` into type implementing `Y` [ConversionFailureFacetToFacet] -// CHECK:STDERR: fn F(unused generic T: Z where .Z1 = .Self) {} -// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: fail_todo_period_self_compared_with_concrete_self.carbon:[[@LINE+2]]:38-42: error: cannot convert type `.Self` that implements `Z` into type implementing `Y` [ConversionFailureFacetToFacet] // CHECK:STDERR: fn F(unused generic T: Z where .Z1 = .Self) {} fn G() { @@ -393,9 +337,7 @@ fn G() { // Implied constraint: .Self impls Y. Should be verified against the type of // the facet value of C when casting. // - // CHECK:STDERR: fail_todo_period_self_compared_with_concrete_self.carbon:[[@LINE+4]]:23: error: cannot convert type `.Self` that implements `Z` into type implementing `Y` [ConversionFailureFacetToFacet] - // CHECK:STDERR: C as (Z where .Z1 = .Self); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_todo_period_self_compared_with_concrete_self.carbon:[[@LINE+2]]:23-27: error: cannot convert type `.Self` that implements `Z` into type implementing `Y` [ConversionFailureFacetToFacet] // CHECK:STDERR: C as (Z where .Z1 = .Self); } @@ -453,92 +395,92 @@ fn G() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: impl_decl @empty_tuple.type.as..impl [concrete] {} { -// CHECK:STDOUT: %.loc13_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc13_7.2: type = converted %.loc13_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc11_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc11_7.2: type = converted %.loc11_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %L.ref: type = name_ref L, file.%L.decl [concrete = constants.%L.type] // CHECK:STDOUT: %.Self.frozen: %L.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %L.ref [concrete] -// CHECK:STDOUT: %.Self.ref.loc13_20: %L.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc13_20: type = facet_access_type %.Self.ref.loc13_20 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc13_20: type = converted %.Self.ref.loc13_20, %.Self.as_type.loc13_20 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %W.ref.loc13_20: %L.assoc_type = name_ref W, @W.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc13_20.1: type = impl_witness_access constants.%.63f, element0 [symbolic_self = constants.%impl.elem0.2e9] -// CHECK:STDOUT: %.loc13_27: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc13_31: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc13_35: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc13_36.1: %tuple.type.2d5 = tuple_literal (%.loc13_27, %.loc13_31, %.loc13_35) [concrete = constants.%tuple.7e4] -// CHECK:STDOUT: %.loc13_36.2: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc13_36.3: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc13_36.4: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc13_36.5: type = converted %.loc13_36.1, constants.%tuple.type.2d5 [concrete = constants.%tuple.type.2d5] -// CHECK:STDOUT: %rewrite.loc13_23.1 = requirement_rewrite %impl.elem0.loc13_20.1, %.loc13_36.5 [concrete] -// CHECK:STDOUT: %.Self.ref.loc13_42: %L.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc13_42: type = facet_access_type %.Self.ref.loc13_42 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc13_42: type = converted %.Self.ref.loc13_42, %.Self.as_type.loc13_42 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %W.ref.loc13_42: %L.assoc_type = name_ref W, @W.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc13_42.1: type = impl_witness_access constants.%.63f, element0 [symbolic_self = constants.%impl.elem0.2e9] -// CHECK:STDOUT: %impl.elem0.subst.loc13_42.1: type = impl_witness_access_substituted %impl.elem0.loc13_42.1, %.loc13_36.5 [concrete = constants.%tuple.type.2d5] -// CHECK:STDOUT: %.loc13_49: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc13_53: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc13_57: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc13_58.1: %tuple.type.e5a = tuple_literal (%.loc13_49, %.loc13_53, %.loc13_57) [concrete = constants.%tuple.b36] -// CHECK:STDOUT: %.loc13_58.2: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %.loc13_58.3: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc13_58.4: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc13_58.5: type = converted %.loc13_58.1, constants.%tuple.type.e5a [concrete = constants.%tuple.type.e5a] -// CHECK:STDOUT: %rewrite.loc13_45.1 = requirement_rewrite %impl.elem0.subst.loc13_42.1, %.loc13_58.5 [concrete] -// CHECK:STDOUT: %.Self.ref.loc13_64: %L.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc13_64: type = facet_access_type %.Self.ref.loc13_64 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc13_64: type = converted %.Self.ref.loc13_64, %.Self.as_type.loc13_64 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %W.ref.loc13_64: %L.assoc_type = name_ref W, @W.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc13_64.1: type = impl_witness_access constants.%.63f, element0 [symbolic_self = constants.%impl.elem0.2e9] -// CHECK:STDOUT: %impl.elem0.subst.loc13_64.1: type = impl_witness_access_substituted %impl.elem0.loc13_64.1, %.loc13_36.5 [concrete = constants.%tuple.type.2d5] -// CHECK:STDOUT: %.loc13_71: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc13_75: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc13_79: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc13_80.1: %tuple.type.d7e = tuple_literal (%.loc13_71, %.loc13_75, %.loc13_79) [concrete = constants.%tuple.8ed] -// CHECK:STDOUT: %.loc13_80.2: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %.loc13_80.3: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %.loc13_80.4: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc13_80.5: type = converted %.loc13_80.1, constants.%tuple.type.d7e [concrete = constants.%tuple.type.d7e] -// CHECK:STDOUT: %rewrite.loc13_67.1 = requirement_rewrite %impl.elem0.subst.loc13_64.1, %.loc13_80.5 [concrete] -// CHECK:STDOUT: %.Self.ref.loc13_86: %L.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc13_86: type = facet_access_type %.Self.ref.loc13_86 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc13_86: type = converted %.Self.ref.loc13_86, %.Self.as_type.loc13_86 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %W.ref.loc13_86: %L.assoc_type = name_ref W, @W.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc13_86.1: type = impl_witness_access constants.%.63f, element0 [symbolic_self = constants.%impl.elem0.2e9] -// CHECK:STDOUT: %impl.elem0.subst.loc13_86.1: type = impl_witness_access_substituted %impl.elem0.loc13_86.1, %.loc13_36.5 [concrete = constants.%tuple.type.2d5] -// CHECK:STDOUT: %.loc13_93: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc13_97: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc13_101: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc13_102.1: %tuple.type.bd8 = tuple_literal (%.loc13_93, %.loc13_97, %.loc13_101) [concrete = constants.%tuple.d90] -// CHECK:STDOUT: %.loc13_102.2: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %.loc13_102.3: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc13_102.4: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %.loc13_102.5: type = converted %.loc13_102.1, constants.%tuple.type.bd8 [concrete = constants.%tuple.type.bd8] -// CHECK:STDOUT: %rewrite.loc13_89.1 = requirement_rewrite %impl.elem0.subst.loc13_86.1, %.loc13_102.5 [concrete] -// CHECK:STDOUT: %impl.elem0.loc13_20.2: type = impl_witness_access constants.%.300, element0 [symbolic_self = constants.%impl.elem0.865] -// CHECK:STDOUT: %rewrite.loc13_23.2 = requirement_rewrite %impl.elem0.loc13_20.2, %.loc13_36.5 [concrete] -// CHECK:STDOUT: %impl.elem0.loc13_42.2: type = impl_witness_access constants.%.300, element0 [symbolic_self = constants.%impl.elem0.865] -// CHECK:STDOUT: %impl.elem0.subst.loc13_42.2: type = impl_witness_access_substituted %impl.elem0.loc13_42.2, %.loc13_36.5 [concrete = constants.%tuple.type.2d5] -// CHECK:STDOUT: %rewrite.loc13_45.2 = requirement_rewrite %impl.elem0.subst.loc13_42.2, %.loc13_58.5 [concrete] -// CHECK:STDOUT: %impl.elem0.loc13_64.2: type = impl_witness_access constants.%.300, element0 [symbolic_self = constants.%impl.elem0.865] -// CHECK:STDOUT: %impl.elem0.subst.loc13_64.2: type = impl_witness_access_substituted %impl.elem0.loc13_64.2, %.loc13_36.5 [concrete = constants.%tuple.type.2d5] -// CHECK:STDOUT: %rewrite.loc13_67.2 = requirement_rewrite %impl.elem0.subst.loc13_64.2, %.loc13_80.5 [concrete] -// CHECK:STDOUT: %impl.elem0.loc13_86.2: type = impl_witness_access constants.%.300, element0 [symbolic_self = constants.%impl.elem0.865] -// CHECK:STDOUT: %impl.elem0.subst.loc13_86.2: type = impl_witness_access_substituted %impl.elem0.loc13_86.2, %.loc13_36.5 [concrete = constants.%tuple.type.2d5] -// CHECK:STDOUT: %rewrite.loc13_89.2 = requirement_rewrite %impl.elem0.subst.loc13_86.2, %.loc13_102.5 [concrete] -// CHECK:STDOUT: %.loc13_14: type = where_expr [concrete = ] { +// CHECK:STDOUT: %.Self.ref.loc11_20: %L.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc11_20: type = facet_access_type %.Self.ref.loc11_20 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc11_20: type = converted %.Self.ref.loc11_20, %.Self.as_type.loc11_20 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %W.ref.loc11_20: %L.assoc_type = name_ref W, @W.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc11_20.1: type = impl_witness_access constants.%.63f, element0 [symbolic_self = constants.%impl.elem0.2e9] +// CHECK:STDOUT: %.loc11_27: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc11_31: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc11_35: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc11_36.1: %tuple.type.2d5 = tuple_literal (%.loc11_27, %.loc11_31, %.loc11_35) [concrete = constants.%tuple.7e4] +// CHECK:STDOUT: %.loc11_36.2: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc11_36.3: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc11_36.4: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc11_36.5: type = converted %.loc11_36.1, constants.%tuple.type.2d5 [concrete = constants.%tuple.type.2d5] +// CHECK:STDOUT: %rewrite.loc11_23.1 = requirement_rewrite %impl.elem0.loc11_20.1, %.loc11_36.5 [concrete] +// CHECK:STDOUT: %.Self.ref.loc11_42: %L.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc11_42: type = facet_access_type %.Self.ref.loc11_42 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc11_42: type = converted %.Self.ref.loc11_42, %.Self.as_type.loc11_42 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %W.ref.loc11_42: %L.assoc_type = name_ref W, @W.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc11_42.1: type = impl_witness_access constants.%.63f, element0 [symbolic_self = constants.%impl.elem0.2e9] +// CHECK:STDOUT: %impl.elem0.subst.loc11_42.1: type = impl_witness_access_substituted %impl.elem0.loc11_42.1, %.loc11_36.5 [concrete = constants.%tuple.type.2d5] +// CHECK:STDOUT: %.loc11_49: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc11_53: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc11_57: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc11_58.1: %tuple.type.e5a = tuple_literal (%.loc11_49, %.loc11_53, %.loc11_57) [concrete = constants.%tuple.b36] +// CHECK:STDOUT: %.loc11_58.2: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc11_58.3: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc11_58.4: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc11_58.5: type = converted %.loc11_58.1, constants.%tuple.type.e5a [concrete = constants.%tuple.type.e5a] +// CHECK:STDOUT: %rewrite.loc11_45.1 = requirement_rewrite %impl.elem0.subst.loc11_42.1, %.loc11_58.5 [concrete] +// CHECK:STDOUT: %.Self.ref.loc11_64: %L.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc11_64: type = facet_access_type %.Self.ref.loc11_64 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc11_64: type = converted %.Self.ref.loc11_64, %.Self.as_type.loc11_64 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %W.ref.loc11_64: %L.assoc_type = name_ref W, @W.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc11_64.1: type = impl_witness_access constants.%.63f, element0 [symbolic_self = constants.%impl.elem0.2e9] +// CHECK:STDOUT: %impl.elem0.subst.loc11_64.1: type = impl_witness_access_substituted %impl.elem0.loc11_64.1, %.loc11_36.5 [concrete = constants.%tuple.type.2d5] +// CHECK:STDOUT: %.loc11_71: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc11_75: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc11_79: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc11_80.1: %tuple.type.d7e = tuple_literal (%.loc11_71, %.loc11_75, %.loc11_79) [concrete = constants.%tuple.8ed] +// CHECK:STDOUT: %.loc11_80.2: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc11_80.3: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc11_80.4: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc11_80.5: type = converted %.loc11_80.1, constants.%tuple.type.d7e [concrete = constants.%tuple.type.d7e] +// CHECK:STDOUT: %rewrite.loc11_67.1 = requirement_rewrite %impl.elem0.subst.loc11_64.1, %.loc11_80.5 [concrete] +// CHECK:STDOUT: %.Self.ref.loc11_86: %L.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc11_86: type = facet_access_type %.Self.ref.loc11_86 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc11_86: type = converted %.Self.ref.loc11_86, %.Self.as_type.loc11_86 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %W.ref.loc11_86: %L.assoc_type = name_ref W, @W.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc11_86.1: type = impl_witness_access constants.%.63f, element0 [symbolic_self = constants.%impl.elem0.2e9] +// CHECK:STDOUT: %impl.elem0.subst.loc11_86.1: type = impl_witness_access_substituted %impl.elem0.loc11_86.1, %.loc11_36.5 [concrete = constants.%tuple.type.2d5] +// CHECK:STDOUT: %.loc11_93: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc11_97: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc11_101: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc11_102.1: %tuple.type.bd8 = tuple_literal (%.loc11_93, %.loc11_97, %.loc11_101) [concrete = constants.%tuple.d90] +// CHECK:STDOUT: %.loc11_102.2: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc11_102.3: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc11_102.4: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc11_102.5: type = converted %.loc11_102.1, constants.%tuple.type.bd8 [concrete = constants.%tuple.type.bd8] +// CHECK:STDOUT: %rewrite.loc11_89.1 = requirement_rewrite %impl.elem0.subst.loc11_86.1, %.loc11_102.5 [concrete] +// CHECK:STDOUT: %impl.elem0.loc11_20.2: type = impl_witness_access constants.%.300, element0 [symbolic_self = constants.%impl.elem0.865] +// CHECK:STDOUT: %rewrite.loc11_23.2 = requirement_rewrite %impl.elem0.loc11_20.2, %.loc11_36.5 [concrete] +// CHECK:STDOUT: %impl.elem0.loc11_42.2: type = impl_witness_access constants.%.300, element0 [symbolic_self = constants.%impl.elem0.865] +// CHECK:STDOUT: %impl.elem0.subst.loc11_42.2: type = impl_witness_access_substituted %impl.elem0.loc11_42.2, %.loc11_36.5 [concrete = constants.%tuple.type.2d5] +// CHECK:STDOUT: %rewrite.loc11_45.2 = requirement_rewrite %impl.elem0.subst.loc11_42.2, %.loc11_58.5 [concrete] +// CHECK:STDOUT: %impl.elem0.loc11_64.2: type = impl_witness_access constants.%.300, element0 [symbolic_self = constants.%impl.elem0.865] +// CHECK:STDOUT: %impl.elem0.subst.loc11_64.2: type = impl_witness_access_substituted %impl.elem0.loc11_64.2, %.loc11_36.5 [concrete = constants.%tuple.type.2d5] +// CHECK:STDOUT: %rewrite.loc11_67.2 = requirement_rewrite %impl.elem0.subst.loc11_64.2, %.loc11_80.5 [concrete] +// CHECK:STDOUT: %impl.elem0.loc11_86.2: type = impl_witness_access constants.%.300, element0 [symbolic_self = constants.%impl.elem0.865] +// CHECK:STDOUT: %impl.elem0.subst.loc11_86.2: type = impl_witness_access_substituted %impl.elem0.loc11_86.2, %.loc11_36.5 [concrete = constants.%tuple.type.2d5] +// CHECK:STDOUT: %rewrite.loc11_89.2 = requirement_rewrite %impl.elem0.subst.loc11_86.2, %.loc11_102.5 [concrete] +// CHECK:STDOUT: %.loc11_14: type = where_expr [concrete = ] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %L.ref [concrete] -// CHECK:STDOUT: %rewrite.loc13_23.2 = requirement_rewrite %impl.elem0.loc13_20.2, %.loc13_36.5 [concrete] -// CHECK:STDOUT: %rewrite.loc13_45.2 = requirement_rewrite %impl.elem0.subst.loc13_42.2, %.loc13_58.5 [concrete] -// CHECK:STDOUT: %rewrite.loc13_67.2 = requirement_rewrite %impl.elem0.subst.loc13_64.2, %.loc13_80.5 [concrete] -// CHECK:STDOUT: %rewrite.loc13_89.2 = requirement_rewrite %impl.elem0.subst.loc13_86.2, %.loc13_102.5 [concrete] +// CHECK:STDOUT: %rewrite.loc11_23.2 = requirement_rewrite %impl.elem0.loc11_20.2, %.loc11_36.5 [concrete] +// CHECK:STDOUT: %rewrite.loc11_45.2 = requirement_rewrite %impl.elem0.subst.loc11_42.2, %.loc11_58.5 [concrete] +// CHECK:STDOUT: %rewrite.loc11_67.2 = requirement_rewrite %impl.elem0.subst.loc11_64.2, %.loc11_80.5 [concrete] +// CHECK:STDOUT: %rewrite.loc11_89.2 = requirement_rewrite %impl.elem0.subst.loc11_86.2, %.loc11_102.5 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_tuple.type.as..impl: %.loc13_7.2 as { +// CHECK:STDOUT: impl @empty_tuple.type.as..impl: %.loc11_7.2 as { // CHECK:STDOUT: !members: // CHECK:STDOUT: extend // CHECK:STDOUT: witness = @@ -570,62 +512,62 @@ fn G() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: impl_decl @empty_tuple.type.as..impl [concrete] {} { -// CHECK:STDOUT: %.loc13_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc13_7.2: type = converted %.loc13_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc11_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc11_7.2: type = converted %.loc11_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %M.ref: type = name_ref M, file.%M.decl [concrete = constants.%M.type] // CHECK:STDOUT: %.Self.frozen: %M.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %M.ref [concrete] -// CHECK:STDOUT: %.Self.ref.loc13_20: %M.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc13_20: type = facet_access_type %.Self.ref.loc13_20 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc13_20: type = converted %.Self.ref.loc13_20, %.Self.as_type.loc13_20 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %X.ref.loc13_20: %M.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc13_20.1: type = impl_witness_access constants.%.b7a, element0 [symbolic_self = constants.%impl.elem0.88c] -// CHECK:STDOUT: %.Self.ref.loc13_25: %M.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc13_25: type = facet_access_type %.Self.ref.loc13_25 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc13_25: type = converted %.Self.ref.loc13_25, %.Self.as_type.loc13_25 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %Y.ref.loc13_25: %M.assoc_type = name_ref Y, @Y.%assoc1 [concrete = constants.%assoc1] -// CHECK:STDOUT: %impl.elem1.loc13_25.1: type = impl_witness_access constants.%.b7a, element1 [symbolic_self = constants.%impl.elem1.17a] -// CHECK:STDOUT: %rewrite.loc13_23.1 = requirement_rewrite %impl.elem0.loc13_20.1, %impl.elem1.loc13_25.1 [concrete] -// CHECK:STDOUT: %.Self.ref.loc13_32: %M.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc13_32: type = facet_access_type %.Self.ref.loc13_32 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc13_32: type = converted %.Self.ref.loc13_32, %.Self.as_type.loc13_32 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %Y.ref.loc13_32: %M.assoc_type = name_ref Y, @Y.%assoc1 [concrete = constants.%assoc1] -// CHECK:STDOUT: %impl.elem1.loc13_32.1: type = impl_witness_access constants.%.b7a, element1 [symbolic_self = constants.%impl.elem1.17a] -// CHECK:STDOUT: %.Self.ref.loc13_37: %M.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc13_37: type = facet_access_type %.Self.ref.loc13_37 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc13_37: type = converted %.Self.ref.loc13_37, %.Self.as_type.loc13_37 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %X.ref.loc13_37: %M.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc13_37.1: type = impl_witness_access constants.%.b7a, element0 [symbolic_self = constants.%impl.elem0.88c] -// CHECK:STDOUT: %impl.elem0.subst.loc13_37.1: type = impl_witness_access_substituted %impl.elem0.loc13_37.1, %impl.elem1.loc13_25.1 [symbolic_self = constants.%impl.elem1.17a] -// CHECK:STDOUT: %rewrite.loc13_35.1 = requirement_rewrite %impl.elem1.loc13_32.1, %impl.elem0.subst.loc13_37.1 [concrete] -// CHECK:STDOUT: %.Self.ref.loc13_44: %M.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc13_44: type = facet_access_type %.Self.ref.loc13_44 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc13_44: type = converted %.Self.ref.loc13_44, %.Self.as_type.loc13_44 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.Self.ref.loc11_20: %M.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc11_20: type = facet_access_type %.Self.ref.loc11_20 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc11_20: type = converted %.Self.ref.loc11_20, %.Self.as_type.loc11_20 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %X.ref.loc11_20: %M.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc11_20.1: type = impl_witness_access constants.%.b7a, element0 [symbolic_self = constants.%impl.elem0.88c] +// CHECK:STDOUT: %.Self.ref.loc11_25: %M.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc11_25: type = facet_access_type %.Self.ref.loc11_25 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc11_25: type = converted %.Self.ref.loc11_25, %.Self.as_type.loc11_25 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %Y.ref.loc11_25: %M.assoc_type = name_ref Y, @Y.%assoc1 [concrete = constants.%assoc1] +// CHECK:STDOUT: %impl.elem1.loc11_25.1: type = impl_witness_access constants.%.b7a, element1 [symbolic_self = constants.%impl.elem1.17a] +// CHECK:STDOUT: %rewrite.loc11_23.1 = requirement_rewrite %impl.elem0.loc11_20.1, %impl.elem1.loc11_25.1 [concrete] +// CHECK:STDOUT: %.Self.ref.loc11_32: %M.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc11_32: type = facet_access_type %.Self.ref.loc11_32 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc11_32: type = converted %.Self.ref.loc11_32, %.Self.as_type.loc11_32 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %Y.ref.loc11_32: %M.assoc_type = name_ref Y, @Y.%assoc1 [concrete = constants.%assoc1] +// CHECK:STDOUT: %impl.elem1.loc11_32.1: type = impl_witness_access constants.%.b7a, element1 [symbolic_self = constants.%impl.elem1.17a] +// CHECK:STDOUT: %.Self.ref.loc11_37: %M.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc11_37: type = facet_access_type %.Self.ref.loc11_37 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc11_37: type = converted %.Self.ref.loc11_37, %.Self.as_type.loc11_37 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %X.ref.loc11_37: %M.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc11_37.1: type = impl_witness_access constants.%.b7a, element0 [symbolic_self = constants.%impl.elem0.88c] +// CHECK:STDOUT: %impl.elem0.subst.loc11_37.1: type = impl_witness_access_substituted %impl.elem0.loc11_37.1, %impl.elem1.loc11_25.1 [symbolic_self = constants.%impl.elem1.17a] +// CHECK:STDOUT: %rewrite.loc11_35.1 = requirement_rewrite %impl.elem1.loc11_32.1, %impl.elem0.subst.loc11_37.1 [concrete] +// CHECK:STDOUT: %.Self.ref.loc11_44: %M.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc11_44: type = facet_access_type %.Self.ref.loc11_44 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc11_44: type = converted %.Self.ref.loc11_44, %.Self.as_type.loc11_44 [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %Z.ref: %M.assoc_type = name_ref Z, @Z.%assoc2 [concrete = constants.%assoc2] -// CHECK:STDOUT: %impl.elem2.loc13_44.1: type = impl_witness_access constants.%.b7a, element2 [symbolic_self = constants.%impl.elem2.efd] -// CHECK:STDOUT: %.loc13_50.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc13_50.2: type = converted %.loc13_50.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %rewrite.loc13_47.1 = requirement_rewrite %impl.elem2.loc13_44.1, %.loc13_50.2 [concrete] -// CHECK:STDOUT: %impl.elem0.loc13_20.2: type = impl_witness_access constants.%.f89, element0 [symbolic_self = constants.%impl.elem0.dfb] -// CHECK:STDOUT: %impl.elem1.loc13_25.2: type = impl_witness_access constants.%.f89, element1 [symbolic_self = constants.%impl.elem1.bb0] -// CHECK:STDOUT: %rewrite.loc13_23.2 = requirement_rewrite %impl.elem0.loc13_20.2, %impl.elem1.loc13_25.2 [concrete] -// CHECK:STDOUT: %impl.elem1.loc13_32.2: type = impl_witness_access constants.%.f89, element1 [symbolic_self = constants.%impl.elem1.bb0] -// CHECK:STDOUT: %impl.elem0.loc13_37.2: type = impl_witness_access constants.%.f89, element0 [symbolic_self = constants.%impl.elem0.dfb] -// CHECK:STDOUT: %impl.elem1.loc13_25.3: type = impl_witness_access constants.%.f89, element1 [symbolic_self = constants.%impl.elem1.bb0] -// CHECK:STDOUT: %impl.elem0.subst.loc13_37.2: type = impl_witness_access_substituted %impl.elem0.loc13_37.2, %impl.elem1.loc13_25.3 [symbolic_self = constants.%impl.elem1.bb0] -// CHECK:STDOUT: %rewrite.loc13_35.2 = requirement_rewrite %impl.elem1.loc13_32.2, %impl.elem0.subst.loc13_37.2 [concrete] -// CHECK:STDOUT: %impl.elem2.loc13_44.2: type = impl_witness_access constants.%.f89, element2 [symbolic_self = constants.%impl.elem2.d85] -// CHECK:STDOUT: %rewrite.loc13_47.2 = requirement_rewrite %impl.elem2.loc13_44.2, %.loc13_50.2 [concrete] -// CHECK:STDOUT: %.loc13_14: type = where_expr [concrete = ] { +// CHECK:STDOUT: %impl.elem2.loc11_44.1: type = impl_witness_access constants.%.b7a, element2 [symbolic_self = constants.%impl.elem2.efd] +// CHECK:STDOUT: %.loc11_50.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc11_50.2: type = converted %.loc11_50.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %rewrite.loc11_47.1 = requirement_rewrite %impl.elem2.loc11_44.1, %.loc11_50.2 [concrete] +// CHECK:STDOUT: %impl.elem0.loc11_20.2: type = impl_witness_access constants.%.f89, element0 [symbolic_self = constants.%impl.elem0.dfb] +// CHECK:STDOUT: %impl.elem1.loc11_25.2: type = impl_witness_access constants.%.f89, element1 [symbolic_self = constants.%impl.elem1.bb0] +// CHECK:STDOUT: %rewrite.loc11_23.2 = requirement_rewrite %impl.elem0.loc11_20.2, %impl.elem1.loc11_25.2 [concrete] +// CHECK:STDOUT: %impl.elem1.loc11_32.2: type = impl_witness_access constants.%.f89, element1 [symbolic_self = constants.%impl.elem1.bb0] +// CHECK:STDOUT: %impl.elem0.loc11_37.2: type = impl_witness_access constants.%.f89, element0 [symbolic_self = constants.%impl.elem0.dfb] +// CHECK:STDOUT: %impl.elem1.loc11_25.3: type = impl_witness_access constants.%.f89, element1 [symbolic_self = constants.%impl.elem1.bb0] +// CHECK:STDOUT: %impl.elem0.subst.loc11_37.2: type = impl_witness_access_substituted %impl.elem0.loc11_37.2, %impl.elem1.loc11_25.3 [symbolic_self = constants.%impl.elem1.bb0] +// CHECK:STDOUT: %rewrite.loc11_35.2 = requirement_rewrite %impl.elem1.loc11_32.2, %impl.elem0.subst.loc11_37.2 [concrete] +// CHECK:STDOUT: %impl.elem2.loc11_44.2: type = impl_witness_access constants.%.f89, element2 [symbolic_self = constants.%impl.elem2.d85] +// CHECK:STDOUT: %rewrite.loc11_47.2 = requirement_rewrite %impl.elem2.loc11_44.2, %.loc11_50.2 [concrete] +// CHECK:STDOUT: %.loc11_14: type = where_expr [concrete = ] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %M.ref [concrete] -// CHECK:STDOUT: %rewrite.loc13_23.2 = requirement_rewrite %impl.elem0.loc13_20.2, %impl.elem1.loc13_25.2 [concrete] -// CHECK:STDOUT: %rewrite.loc13_35.2 = requirement_rewrite %impl.elem1.loc13_32.2, %impl.elem0.subst.loc13_37.2 [concrete] -// CHECK:STDOUT: %rewrite.loc13_47.2 = requirement_rewrite %impl.elem2.loc13_44.2, %.loc13_50.2 [concrete] +// CHECK:STDOUT: %rewrite.loc11_23.2 = requirement_rewrite %impl.elem0.loc11_20.2, %impl.elem1.loc11_25.2 [concrete] +// CHECK:STDOUT: %rewrite.loc11_35.2 = requirement_rewrite %impl.elem1.loc11_32.2, %impl.elem0.subst.loc11_37.2 [concrete] +// CHECK:STDOUT: %rewrite.loc11_47.2 = requirement_rewrite %impl.elem2.loc11_44.2, %.loc11_50.2 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_tuple.type.as..impl: %.loc13_7.2 as { +// CHECK:STDOUT: impl @empty_tuple.type.as..impl: %.loc11_7.2 as { // CHECK:STDOUT: !members: // CHECK:STDOUT: extend // CHECK:STDOUT: witness = diff --git a/toolchain/check/testdata/impl/impl_assoc_const_with_prelude.carbon b/toolchain/check/testdata/impl/impl_assoc_const_with_prelude.carbon index 91fe5b66f820..1eddb39af8f5 100644 --- a/toolchain/check/testdata/impl/impl_assoc_const_with_prelude.carbon +++ b/toolchain/check/testdata/impl/impl_assoc_const_with_prelude.carbon @@ -26,9 +26,7 @@ library "[[@TEST_NAME]]"; interface I { let X: {.a: bool, .b: (i32, i32)}; } -// CHECK:STDERR: fail_two_different_non_type.carbon:[[@LINE+4]]:12: error: associated constant `.(I.X)` given two different values `{.a = true, .b = (1, 2)}` and `{.a = false, .b = (3, 4)}` [AssociatedConstantWithDifferentValues] -// CHECK:STDERR: impl () as I where .X = {.a = true, .b = (1, 2)} and .X = {.a = false, .b = (3, 4)} {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_two_different_non_type.carbon:[[@LINE+2]]:12-83: error: associated constant `.(I.X)` given two different values `{.a = true, .b = (1, 2)}` and `{.a = false, .b = (3, 4)}` [AssociatedConstantWithDifferentValues] // CHECK:STDERR: impl () as I where .X = {.a = true, .b = (1, 2)} and .X = {.a = false, .b = (3, 4)} {} @@ -364,79 +362,79 @@ impl () as I where .X = {.a = true, .b = (1, 2)} and .X = {.a = false, .b = (3, // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {} // CHECK:STDOUT: impl_decl @empty_tuple.type.as..impl [concrete] {} { -// CHECK:STDOUT: %.loc10_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc10_7.2: type = converted %.loc10_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc8_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_7.2: type = converted %.loc8_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: %.Self.frozen: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %.Self.ref.loc10_20: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc10_20: type = facet_access_type %.Self.ref.loc10_20 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc10_20: type = converted %.Self.ref.loc10_20, %.Self.as_type.loc10_20 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %X.ref.loc10_20: %I.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0.194] -// CHECK:STDOUT: %impl.elem0.loc10_20.1: %struct_type.a.b.36f = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.84d] +// CHECK:STDOUT: %.Self.ref.loc8_20: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc8_20: type = facet_access_type %.Self.ref.loc8_20 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc8_20: type = converted %.Self.ref.loc8_20, %.Self.as_type.loc8_20 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %X.ref.loc8_20: %I.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0.194] +// CHECK:STDOUT: %impl.elem0.loc8_20.1: %struct_type.a.b.36f = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.84d] // CHECK:STDOUT: %true: bool = bool_literal true [concrete = constants.%true] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %.loc10_47.1: %tuple.type.f94 = tuple_literal (%int_1, %int_2) [concrete = constants.%tuple.ad8] -// CHECK:STDOUT: %.loc10_48.1: %struct_type.a.b.aa4 = struct_literal (%true, %.loc10_47.1) [concrete = constants.%struct.e57] -// CHECK:STDOUT: %impl.elem0.loc10_47.1: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc10_47.1: = bound_method %int_1, %impl.elem0.loc10_47.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] -// CHECK:STDOUT: %specific_fn.loc10_47.1: = specific_function %impl.elem0.loc10_47.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc10_47.2: = bound_method %int_1, %specific_fn.loc10_47.1 [concrete = constants.%bound_method.3bd] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc10_47.1: init %i32 = call %bound_method.loc10_47.2(%int_1) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc10_47.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc10_47.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc10_47.3: %i32 = converted %int_1, %.loc10_47.2 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %impl.elem0.loc10_47.2: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc10_47.3: = bound_method %int_2, %impl.elem0.loc10_47.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6] -// CHECK:STDOUT: %specific_fn.loc10_47.2: = specific_function %impl.elem0.loc10_47.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc10_47.4: = bound_method %int_2, %specific_fn.loc10_47.2 [concrete = constants.%bound_method.a55] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc10_47.2: init %i32 = call %bound_method.loc10_47.4(%int_2) [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc10_47.4: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc10_47.2 [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc10_47.5: %i32 = converted %int_2, %.loc10_47.4 [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %tuple.loc10_47: %tuple.type.35f = tuple_value (%.loc10_47.3, %.loc10_47.5) [concrete = constants.%tuple.380] -// CHECK:STDOUT: %.loc10_48.2: %tuple.type.35f = converted %.loc10_47.1, %tuple.loc10_47 [concrete = constants.%tuple.380] -// CHECK:STDOUT: %struct.loc10_48: %struct_type.a.b.36f = struct_value (%true, %.loc10_48.2) [concrete = constants.%struct.8fa] -// CHECK:STDOUT: %.loc10_48.3: %struct_type.a.b.36f = converted %.loc10_48.1, %struct.loc10_48 [concrete = constants.%struct.8fa] -// CHECK:STDOUT: %rewrite.loc10_23.1 = requirement_rewrite %impl.elem0.loc10_20.1, %.loc10_48.3 [concrete] -// CHECK:STDOUT: %.Self.ref.loc10_54: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc10_54: type = facet_access_type %.Self.ref.loc10_54 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc10_54: type = converted %.Self.ref.loc10_54, %.Self.as_type.loc10_54 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %X.ref.loc10_54: %I.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0.194] -// CHECK:STDOUT: %impl.elem0.loc10_54.1: %struct_type.a.b.36f = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.84d] -// CHECK:STDOUT: %impl.elem0.subst.loc10_54.1: %struct_type.a.b.36f = impl_witness_access_substituted %impl.elem0.loc10_54.1, %.loc10_48.3 [concrete = constants.%struct.8fa] +// CHECK:STDOUT: %.loc8_47.1: %tuple.type.f94 = tuple_literal (%int_1, %int_2) [concrete = constants.%tuple.ad8] +// CHECK:STDOUT: %.loc8_48.1: %struct_type.a.b.aa4 = struct_literal (%true, %.loc8_47.1) [concrete = constants.%struct.e57] +// CHECK:STDOUT: %impl.elem0.loc8_47.1: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc8_47.1: = bound_method %int_1, %impl.elem0.loc8_47.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] +// CHECK:STDOUT: %specific_fn.loc8_47.1: = specific_function %impl.elem0.loc8_47.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc8_47.2: = bound_method %int_1, %specific_fn.loc8_47.1 [concrete = constants.%bound_method.3bd] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc8_47.1: init %i32 = call %bound_method.loc8_47.2(%int_1) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc8_47.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc8_47.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc8_47.3: %i32 = converted %int_1, %.loc8_47.2 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %impl.elem0.loc8_47.2: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc8_47.3: = bound_method %int_2, %impl.elem0.loc8_47.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6] +// CHECK:STDOUT: %specific_fn.loc8_47.2: = specific_function %impl.elem0.loc8_47.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc8_47.4: = bound_method %int_2, %specific_fn.loc8_47.2 [concrete = constants.%bound_method.a55] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc8_47.2: init %i32 = call %bound_method.loc8_47.4(%int_2) [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc8_47.4: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc8_47.2 [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc8_47.5: %i32 = converted %int_2, %.loc8_47.4 [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %tuple.loc8_47: %tuple.type.35f = tuple_value (%.loc8_47.3, %.loc8_47.5) [concrete = constants.%tuple.380] +// CHECK:STDOUT: %.loc8_48.2: %tuple.type.35f = converted %.loc8_47.1, %tuple.loc8_47 [concrete = constants.%tuple.380] +// CHECK:STDOUT: %struct.loc8_48: %struct_type.a.b.36f = struct_value (%true, %.loc8_48.2) [concrete = constants.%struct.8fa] +// CHECK:STDOUT: %.loc8_48.3: %struct_type.a.b.36f = converted %.loc8_48.1, %struct.loc8_48 [concrete = constants.%struct.8fa] +// CHECK:STDOUT: %rewrite.loc8_23.1 = requirement_rewrite %impl.elem0.loc8_20.1, %.loc8_48.3 [concrete] +// CHECK:STDOUT: %.Self.ref.loc8_54: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc8_54: type = facet_access_type %.Self.ref.loc8_54 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc8_54: type = converted %.Self.ref.loc8_54, %.Self.as_type.loc8_54 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %X.ref.loc8_54: %I.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0.194] +// CHECK:STDOUT: %impl.elem0.loc8_54.1: %struct_type.a.b.36f = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.84d] +// CHECK:STDOUT: %impl.elem0.subst.loc8_54.1: %struct_type.a.b.36f = impl_witness_access_substituted %impl.elem0.loc8_54.1, %.loc8_48.3 [concrete = constants.%struct.8fa] // CHECK:STDOUT: %false: bool = bool_literal false [concrete = constants.%false] // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba] // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4.0c1] -// CHECK:STDOUT: %.loc10_82.1: %tuple.type.f94 = tuple_literal (%int_3, %int_4) [concrete = constants.%tuple.302] -// CHECK:STDOUT: %.loc10_83.1: %struct_type.a.b.aa4 = struct_literal (%false, %.loc10_82.1) [concrete = constants.%struct.1ec] -// CHECK:STDOUT: %impl.elem0.loc10_82.1: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc10_82.1: = bound_method %int_3, %impl.elem0.loc10_82.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.b3c] -// CHECK:STDOUT: %specific_fn.loc10_82.1: = specific_function %impl.elem0.loc10_82.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc10_82.2: = bound_method %int_3, %specific_fn.loc10_82.1 [concrete = constants.%bound_method.fb0] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc10_82.1: init %i32 = call %bound_method.loc10_82.2(%int_3) [concrete = constants.%int_3.9f3] -// CHECK:STDOUT: %.loc10_82.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc10_82.1 [concrete = constants.%int_3.9f3] -// CHECK:STDOUT: %.loc10_82.3: %i32 = converted %int_3, %.loc10_82.2 [concrete = constants.%int_3.9f3] -// CHECK:STDOUT: %impl.elem0.loc10_82.2: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc10_82.3: = bound_method %int_4, %impl.elem0.loc10_82.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.776] -// CHECK:STDOUT: %specific_fn.loc10_82.2: = specific_function %impl.elem0.loc10_82.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc10_82.4: = bound_method %int_4, %specific_fn.loc10_82.2 [concrete = constants.%bound_method.7fa] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc10_82.2: init %i32 = call %bound_method.loc10_82.4(%int_4) [concrete = constants.%int_4.6bf] -// CHECK:STDOUT: %.loc10_82.4: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc10_82.2 [concrete = constants.%int_4.6bf] -// CHECK:STDOUT: %.loc10_82.5: %i32 = converted %int_4, %.loc10_82.4 [concrete = constants.%int_4.6bf] -// CHECK:STDOUT: %tuple.loc10_82: %tuple.type.35f = tuple_value (%.loc10_82.3, %.loc10_82.5) [concrete = constants.%tuple.859] -// CHECK:STDOUT: %.loc10_83.2: %tuple.type.35f = converted %.loc10_82.1, %tuple.loc10_82 [concrete = constants.%tuple.859] -// CHECK:STDOUT: %struct.loc10_83: %struct_type.a.b.36f = struct_value (%false, %.loc10_83.2) [concrete = constants.%struct.7c4] -// CHECK:STDOUT: %.loc10_83.3: %struct_type.a.b.36f = converted %.loc10_83.1, %struct.loc10_83 [concrete = constants.%struct.7c4] -// CHECK:STDOUT: %rewrite.loc10_57.1 = requirement_rewrite %impl.elem0.subst.loc10_54.1, %.loc10_83.3 [concrete] -// CHECK:STDOUT: %impl.elem0.loc10_20.2: %struct_type.a.b.36f = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.fcf] -// CHECK:STDOUT: %rewrite.loc10_23.2 = requirement_rewrite %impl.elem0.loc10_20.2, %.loc10_48.3 [concrete] -// CHECK:STDOUT: %impl.elem0.loc10_54.2: %struct_type.a.b.36f = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.fcf] -// CHECK:STDOUT: %impl.elem0.subst.loc10_54.2: %struct_type.a.b.36f = impl_witness_access_substituted %impl.elem0.loc10_54.2, %.loc10_48.3 [concrete = constants.%struct.8fa] -// CHECK:STDOUT: %rewrite.loc10_57.2 = requirement_rewrite %impl.elem0.subst.loc10_54.2, %.loc10_83.3 [concrete] -// CHECK:STDOUT: %.loc10_14: type = where_expr [concrete = ] { +// CHECK:STDOUT: %.loc8_82.1: %tuple.type.f94 = tuple_literal (%int_3, %int_4) [concrete = constants.%tuple.302] +// CHECK:STDOUT: %.loc8_83.1: %struct_type.a.b.aa4 = struct_literal (%false, %.loc8_82.1) [concrete = constants.%struct.1ec] +// CHECK:STDOUT: %impl.elem0.loc8_82.1: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc8_82.1: = bound_method %int_3, %impl.elem0.loc8_82.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.b3c] +// CHECK:STDOUT: %specific_fn.loc8_82.1: = specific_function %impl.elem0.loc8_82.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc8_82.2: = bound_method %int_3, %specific_fn.loc8_82.1 [concrete = constants.%bound_method.fb0] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc8_82.1: init %i32 = call %bound_method.loc8_82.2(%int_3) [concrete = constants.%int_3.9f3] +// CHECK:STDOUT: %.loc8_82.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc8_82.1 [concrete = constants.%int_3.9f3] +// CHECK:STDOUT: %.loc8_82.3: %i32 = converted %int_3, %.loc8_82.2 [concrete = constants.%int_3.9f3] +// CHECK:STDOUT: %impl.elem0.loc8_82.2: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc8_82.3: = bound_method %int_4, %impl.elem0.loc8_82.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.776] +// CHECK:STDOUT: %specific_fn.loc8_82.2: = specific_function %impl.elem0.loc8_82.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc8_82.4: = bound_method %int_4, %specific_fn.loc8_82.2 [concrete = constants.%bound_method.7fa] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc8_82.2: init %i32 = call %bound_method.loc8_82.4(%int_4) [concrete = constants.%int_4.6bf] +// CHECK:STDOUT: %.loc8_82.4: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc8_82.2 [concrete = constants.%int_4.6bf] +// CHECK:STDOUT: %.loc8_82.5: %i32 = converted %int_4, %.loc8_82.4 [concrete = constants.%int_4.6bf] +// CHECK:STDOUT: %tuple.loc8_82: %tuple.type.35f = tuple_value (%.loc8_82.3, %.loc8_82.5) [concrete = constants.%tuple.859] +// CHECK:STDOUT: %.loc8_83.2: %tuple.type.35f = converted %.loc8_82.1, %tuple.loc8_82 [concrete = constants.%tuple.859] +// CHECK:STDOUT: %struct.loc8_83: %struct_type.a.b.36f = struct_value (%false, %.loc8_83.2) [concrete = constants.%struct.7c4] +// CHECK:STDOUT: %.loc8_83.3: %struct_type.a.b.36f = converted %.loc8_83.1, %struct.loc8_83 [concrete = constants.%struct.7c4] +// CHECK:STDOUT: %rewrite.loc8_57.1 = requirement_rewrite %impl.elem0.subst.loc8_54.1, %.loc8_83.3 [concrete] +// CHECK:STDOUT: %impl.elem0.loc8_20.2: %struct_type.a.b.36f = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.fcf] +// CHECK:STDOUT: %rewrite.loc8_23.2 = requirement_rewrite %impl.elem0.loc8_20.2, %.loc8_48.3 [concrete] +// CHECK:STDOUT: %impl.elem0.loc8_54.2: %struct_type.a.b.36f = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.fcf] +// CHECK:STDOUT: %impl.elem0.subst.loc8_54.2: %struct_type.a.b.36f = impl_witness_access_substituted %impl.elem0.loc8_54.2, %.loc8_48.3 [concrete = constants.%struct.8fa] +// CHECK:STDOUT: %rewrite.loc8_57.2 = requirement_rewrite %impl.elem0.subst.loc8_54.2, %.loc8_83.3 [concrete] +// CHECK:STDOUT: %.loc8_14: type = where_expr [concrete = ] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %rewrite.loc10_23.2 = requirement_rewrite %impl.elem0.loc10_20.2, %.loc10_48.3 [concrete] -// CHECK:STDOUT: %rewrite.loc10_57.2 = requirement_rewrite %impl.elem0.subst.loc10_54.2, %.loc10_83.3 [concrete] +// CHECK:STDOUT: %rewrite.loc8_23.2 = requirement_rewrite %impl.elem0.loc8_20.2, %.loc8_48.3 [concrete] +// CHECK:STDOUT: %rewrite.loc8_57.2 = requirement_rewrite %impl.elem0.subst.loc8_54.2, %.loc8_83.3 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -458,7 +456,7 @@ impl () as I where .X = {.a = true, .b = (1, 2)} and .X = {.a = false, .b = (3, // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_tuple.type.as..impl: %.loc10_7.2 as { +// CHECK:STDOUT: impl @empty_tuple.type.as..impl: %.loc8_7.2 as { // CHECK:STDOUT: !members: // CHECK:STDOUT: extend // CHECK:STDOUT: witness = diff --git a/toolchain/check/testdata/impl/impl_self_as.carbon b/toolchain/check/testdata/impl/impl_self_as.carbon index d6195cfc85e7..8d57e2f0bb28 100644 --- a/toolchain/check/testdata/impl/impl_self_as.carbon +++ b/toolchain/check/testdata/impl/impl_self_as.carbon @@ -65,116 +65,84 @@ interface J6(T6: type) {} // `impl C as` should not match `impl Self as` or `impl as`. class C3 { - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+4]]:3: error: impl declared but not defined [ImplMissingDefinition] - // CHECK:STDERR: impl C3 as I3; - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-16: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl C3 as I3; impl as I3 {} - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+4]]:3: error: impl declared but not defined [ImplMissingDefinition] - // CHECK:STDERR: impl C3 as I4; - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-16: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl C3 as I4; impl Self as I4 {} - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+4]]:3: error: impl declared but not defined [ImplMissingDefinition] - // CHECK:STDERR: impl as I5; - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-13: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl as I5; impl C3 as I5 {} - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+4]]:3: error: impl declared but not defined [ImplMissingDefinition] - // CHECK:STDERR: impl Self as I6; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-18: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl Self as I6; impl C3 as I6 {} - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+4]]:3: error: impl declared but not defined [ImplMissingDefinition] - // CHECK:STDERR: impl forall [Z3: type] C3 as J3(Z3); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-38: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl forall [Z3: type] C3 as J3(Z3); impl forall [Z3: type] as J3(Z3) {} - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+4]]:3: error: impl declared but not defined [ImplMissingDefinition] - // CHECK:STDERR: impl forall [Z4: type] C3 as J4(Z4); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-38: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl forall [Z4: type] C3 as J4(Z4); impl forall [Z4: type] Self as J4(Z4) {} - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+4]]:3: error: impl declared but not defined [ImplMissingDefinition] - // CHECK:STDERR: impl forall [Z5: type] as J5(Z5); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-35: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl forall [Z5: type] as J5(Z5); impl forall [Z5: type] C3 as J5(Z5) {} - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+4]]:3: error: impl declared but not defined [ImplMissingDefinition] - // CHECK:STDERR: impl forall [Z6: type] Self as J6(Z6); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-40: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl forall [Z6: type] Self as J6(Z6); impl forall [Z6: type] C3 as J6(Z6) {} } class C4(A: type) { - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+4]]:3: error: impl declared but not defined [ImplMissingDefinition] - // CHECK:STDERR: impl C4(A) as I3; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-19: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl C4(A) as I3; impl as I3 {} - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+4]]:3: error: impl declared but not defined [ImplMissingDefinition] - // CHECK:STDERR: impl C4(A) as I4; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-19: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl C4(A) as I4; impl Self as I4 {} - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+4]]:3: error: impl declared but not defined [ImplMissingDefinition] - // CHECK:STDERR: impl as I5; - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-13: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl as I5; impl C4(A) as I5 {} - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+4]]:3: error: impl declared but not defined [ImplMissingDefinition] - // CHECK:STDERR: impl Self as I6; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-18: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl Self as I6; impl C4(A) as I6 {} - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+4]]:3: error: impl declared but not defined [ImplMissingDefinition] - // CHECK:STDERR: impl forall [B3: type] C4(A) as J3(B3); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-41: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl forall [B3: type] C4(A) as J3(B3); impl forall [B3: type] as J3(B3) {} - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+4]]:3: error: impl declared but not defined [ImplMissingDefinition] - // CHECK:STDERR: impl forall [B4: type] C4(A) as J4(B4); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-41: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl forall [B4: type] C4(A) as J4(B4); impl forall [B4: type] Self as J4(B4) {} - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+4]]:3: error: impl declared but not defined [ImplMissingDefinition] - // CHECK:STDERR: impl forall [B5: type] as J5(B5); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-35: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl forall [B5: type] as J5(B5); impl forall [B5: type] C4(A) as J5(B5) {} - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+4]]:3: error: impl declared but not defined [ImplMissingDefinition] - // CHECK:STDERR: impl forall [B6: type] Self as J6(B6); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-40: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl forall [B6: type] Self as J6(B6); impl forall [B6: type] C4(A) as J6(B6) {} diff --git a/toolchain/check/testdata/impl/impl_thunk.carbon b/toolchain/check/testdata/impl/impl_thunk.carbon index fe13e4e3acc4..d24913fb97be 100644 --- a/toolchain/check/testdata/impl/impl_thunk.carbon +++ b/toolchain/check/testdata/impl/impl_thunk.carbon @@ -154,15 +154,9 @@ interface X { impl A as X { //@dump-sem-ir-begin - // 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` [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] - // CHECK:STDERR: fn F() -> Self; - // CHECK:STDERR: ^~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_inheritance_value_conversion_copy_return.carbon:[[@LINE+4]]:3-14: error: cannot copy value of type `A` [CopyOfUncopyableType] + // CHECK:STDERR: fail_inheritance_value_conversion_copy_return.carbon:[[@LINE+3]]:3-14: note: type `A` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: fail_inheritance_value_conversion_copy_return.carbon:[[@LINE-7]]:3-17: note: while building thunk to match the signature of this function [ThunkSignature] // CHECK:STDERR: fn F() -> B; //@dump-sem-ir-end @@ -182,12 +176,8 @@ class A {} class B {} impl A as I { - // CHECK:STDERR: fail_param_type_mismatch.carbon:[[@LINE+7]]:8: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn F(a: B); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_param_type_mismatch.carbon:[[@LINE-10]]:3: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: fn F(a: Self); - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_param_type_mismatch.carbon:[[@LINE+3]]:8-11: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: fail_param_type_mismatch.carbon:[[@LINE-8]]:3-16: note: while building thunk to match the signature of this function [ThunkSignature] // CHECK:STDERR: fn F(a: B); } @@ -204,15 +194,9 @@ class A {} class B {} 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)` [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] - // CHECK:STDERR: fn F() -> Self; - // CHECK:STDERR: ^~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_return_mismatch.carbon:[[@LINE+4]]:3-14: error: cannot implicitly convert expression of type `B` to `A` [ConversionFailure] + // CHECK:STDERR: fail_return_mismatch.carbon:[[@LINE+3]]:3-14: note: type `B` does not implement interface `Core.ImplicitAs(A)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: fail_return_mismatch.carbon:[[@LINE-9]]:3-17: note: while building thunk to match the signature of this function [ThunkSignature] // CHECK:STDERR: fn F() -> B; } @@ -248,12 +232,8 @@ interface I { impl () as I { // TODO: The proposal says to reject this. But should we really do so? - // CHECK:STDERR: fail_return_empty_tuple_mismatch.carbon:[[@LINE+7]]:3: error: function redeclaration differs because return type is `()` [FunctionRedeclReturnTypeDiffers] - // CHECK:STDERR: fn NoReturn() -> (); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_return_empty_tuple_mismatch.carbon:[[@LINE-8]]:3: note: previously declared with no return type [FunctionRedeclReturnTypePreviousNoReturn] - // CHECK:STDERR: fn NoReturn(); - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_return_empty_tuple_mismatch.carbon:[[@LINE+3]]:3-22: error: function redeclaration differs because return type is `()` [FunctionRedeclReturnTypeDiffers] + // CHECK:STDERR: fail_return_empty_tuple_mismatch.carbon:[[@LINE-6]]:3-16: note: previously declared with no return type [FunctionRedeclReturnTypePreviousNoReturn] // CHECK:STDERR: fn NoReturn() -> (); } @@ -261,12 +241,8 @@ impl () as I { class C {} impl C as I { - // CHECK:STDERR: fail_return_empty_tuple_mismatch.carbon:[[@LINE+7]]:3: error: function redeclaration differs because return type is `C` [FunctionRedeclReturnTypeDiffers] - // CHECK:STDERR: fn NoReturn() -> C; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_return_empty_tuple_mismatch.carbon:[[@LINE-21]]:3: note: previously declared with no return type [FunctionRedeclReturnTypePreviousNoReturn] - // CHECK:STDERR: fn NoReturn(); - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_return_empty_tuple_mismatch.carbon:[[@LINE+3]]:3-21: error: function redeclaration differs because return type is `C` [FunctionRedeclReturnTypeDiffers] + // CHECK:STDERR: fail_return_empty_tuple_mismatch.carbon:[[@LINE-15]]:3-16: note: previously declared with no return type [FunctionRedeclReturnTypePreviousNoReturn] // CHECK:STDERR: fn NoReturn() -> C; } @@ -280,25 +256,17 @@ interface I(T: type) { fn F(a: T); } -// CHECK:STDERR: fail_param_type_incomplete.carbon:[[@LINE+3]]:1: note: class was forward declared here [ClassForwardDeclaredHere] -// CHECK:STDERR: class B; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_param_type_incomplete.carbon:[[@LINE+1]]:1-8: note: class was forward declared here [ClassForwardDeclaredHere] class B; class C { impl as I(B) { - // CHECK:STDERR: fail_param_type_incomplete.carbon:[[@LINE+13]]:5: note: while building thunk calling this function [ThunkCallee] - // CHECK:STDERR: fn F(c: C); - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_param_type_incomplete.carbon:[[@LINE+7]]:5-15: note: while building thunk calling this function [ThunkCallee] // CHECK:STDERR: // CHECK:STDERR: fail_param_type_incomplete.carbon: error: cannot implicitly convert expression of type `B` to `C` [ConversionFailure] // CHECK:STDERR: fail_param_type_incomplete.carbon: note: type `B` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_param_type_incomplete.carbon:[[@LINE+7]]:10: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn F(c: C); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_param_type_incomplete.carbon:[[@LINE-19]]:3: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: fn F(a: T); - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_param_type_incomplete.carbon:[[@LINE+3]]:10-13: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: fail_param_type_incomplete.carbon:[[@LINE-13]]:3-13: note: while building thunk to match the signature of this function [ThunkSignature] // CHECK:STDERR: fn F(c: C); } @@ -1092,95 +1060,95 @@ impl () as I({}) { // CHECK:STDOUT: %pattern_type.e39: type = pattern_type %B [concrete] // CHECK:STDOUT: %return.param_patt.934: %pattern_type.e39 = out_param_pattern [concrete] // CHECK:STDOUT: %return.patt.911: %pattern_type.e39 = return_slot_pattern %return.param_patt.934, %B [concrete] -// CHECK:STDOUT: %A.as.X.impl.F.type.48cdab.1: type = fn_type @A.as.X.impl.F.loc23_14.1 [concrete] +// CHECK:STDOUT: %A.as.X.impl.F.type.48cdab.1: type = fn_type @A.as.X.impl.F.loc17_14.1 [concrete] // CHECK:STDOUT: %A.as.X.impl.F.bd5be1.1: %A.as.X.impl.F.type.48cdab.1 = struct_value () [concrete] // CHECK:STDOUT: %X.facet: %X.type = facet_value %A, (%X.impl_witness) [concrete] // CHECK:STDOUT: %pattern_type.9ef: type = pattern_type %A [concrete] -// CHECK:STDOUT: %A.as.X.impl.F.type.48cdab.2: type = fn_type @A.as.X.impl.F.loc23_14.2 [concrete] +// CHECK:STDOUT: %A.as.X.impl.F.type.48cdab.2: type = fn_type @A.as.X.impl.F.loc17_14.2 [concrete] // CHECK:STDOUT: %A.as.X.impl.F.bd5be1.2: %A.as.X.impl.F.type.48cdab.2 = struct_value () [concrete] // CHECK:STDOUT: %pattern_type.a96: type = pattern_type %empty_struct_type [concrete] // CHECK:STDOUT: %self.param_patt.52f: %pattern_type.a96 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.4b1: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt.52f [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc23_14.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc17_14.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc23_14.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc17_14.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.1: %Destroy.WithSelf.Op.type.ef016f.1 = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.8fb: %pattern_type.9ef = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.e64: %pattern_type.9ef = wrapper_binding_pattern self, %self.param_patt.8fb [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc23_14.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc17_14.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc23_14.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc17_14.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.2: %Destroy.WithSelf.Op.type.ef016f.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc23_14.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc17_14.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.2: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2 = struct_value () [concrete] // CHECK:STDOUT: %pattern_type.7bd: type = pattern_type %struct_type.base.cb7 [concrete] // CHECK:STDOUT: %self.param_patt.c67: %pattern_type.7bd = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.e77: %pattern_type.7bd = wrapper_binding_pattern self, %self.param_patt.c67 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc23_14.3 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc17_14.3 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc23_14.3 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc17_14.3 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.3: %Destroy.WithSelf.Op.type.ef016f.3 = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.039: %pattern_type.e39 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.535: %pattern_type.e39 = wrapper_binding_pattern self, %self.param_patt.039 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc23_14.4 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc17_14.4 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.4: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.4: type = fn_type @Destroy.WithSelf.Op.loc23_14.4 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.4: type = fn_type @Destroy.WithSelf.Op.loc17_14.4 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.4: %Destroy.WithSelf.Op.type.ef016f.4 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.4: type = fn_type @Destroy.WithSelf.SelfDestruct.loc23_14.4 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.4: type = fn_type @Destroy.WithSelf.SelfDestruct.loc17_14.4 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.4: %Destroy.WithSelf.SelfDestruct.type.fbceb5.4 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc23_14.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc17_14.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.a96 = ref_param_pattern [concrete = constants.%self.param_patt.52f] // CHECK:STDOUT: %self.patt: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.4b1] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %empty_struct_type = ref_param call_param0 // CHECK:STDOUT: %self: ref %empty_struct_type = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc23_14.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc17_14.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.a96 = ref_param_pattern [concrete = constants.%self.param_patt.52f] // CHECK:STDOUT: %self.patt: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.4b1] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %empty_struct_type = ref_param call_param0 // CHECK:STDOUT: %self: ref %empty_struct_type = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc23_14.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc17_14.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.9ef = ref_param_pattern [concrete = constants.%self.param_patt.8fb] // CHECK:STDOUT: %self.patt: %pattern_type.9ef = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.e64] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %A = ref_param call_param0 // CHECK:STDOUT: %self: ref %A = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc23_14.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc17_14.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.9ef = ref_param_pattern [concrete = constants.%self.param_patt.8fb] // CHECK:STDOUT: %self.patt: %pattern_type.9ef = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.e64] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %A = ref_param call_param0 // CHECK:STDOUT: %self: ref %A = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc23_14.3 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.3] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc17_14.3 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.3] { // CHECK:STDOUT: %self.param_patt: %pattern_type.7bd = ref_param_pattern [concrete = constants.%self.param_patt.c67] // CHECK:STDOUT: %self.patt: %pattern_type.7bd = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.e77] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %struct_type.base.cb7 = ref_param call_param0 // CHECK:STDOUT: %self: ref %struct_type.base.cb7 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.3: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc23_14.3 [concrete = constants.%Destroy.WithSelf.Op.403171.3] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.3: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc17_14.3 [concrete = constants.%Destroy.WithSelf.Op.403171.3] { // CHECK:STDOUT: %self.param_patt: %pattern_type.7bd = ref_param_pattern [concrete = constants.%self.param_patt.c67] // CHECK:STDOUT: %self.patt: %pattern_type.7bd = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.e77] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %struct_type.base.cb7 = ref_param call_param0 // CHECK:STDOUT: %self: ref %struct_type.base.cb7 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.4: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc23_14.4 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.4] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.4: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc17_14.4 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.4] { // CHECK:STDOUT: %self.param_patt: %pattern_type.e39 = ref_param_pattern [concrete = constants.%self.param_patt.039] // CHECK:STDOUT: %self.patt: %pattern_type.e39 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.535] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %B = ref_param call_param0 // CHECK:STDOUT: %self: ref %B = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.4: %Destroy.WithSelf.Op.type.ef016f.4 = fn_decl @Destroy.WithSelf.Op.loc23_14.4 [concrete = constants.%Destroy.WithSelf.Op.403171.4] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.4: %Destroy.WithSelf.Op.type.ef016f.4 = fn_decl @Destroy.WithSelf.Op.loc17_14.4 [concrete = constants.%Destroy.WithSelf.Op.403171.4] { // CHECK:STDOUT: %self.param_patt: %pattern_type.e39 = ref_param_pattern [concrete = constants.%self.param_patt.039] // CHECK:STDOUT: %self.patt: %pattern_type.e39 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.535] // CHECK:STDOUT: } { @@ -1190,17 +1158,17 @@ impl () as I({}) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @A.as.X.impl: %A.ref as %X.ref { -// CHECK:STDOUT: %A.as.X.impl.F.decl.loc23_14.1: %A.as.X.impl.F.type.48cdab.1 = fn_decl @A.as.X.impl.F.loc23_14.1 [concrete = constants.%A.as.X.impl.F.bd5be1.1] { +// CHECK:STDOUT: %A.as.X.impl.F.decl.loc17_14.1: %A.as.X.impl.F.type.48cdab.1 = fn_decl @A.as.X.impl.F.loc17_14.1 [concrete = constants.%A.as.X.impl.F.bd5be1.1] { // CHECK:STDOUT: %return.param_patt: %pattern_type.e39 = out_param_pattern [concrete = constants.%return.param_patt.934] // CHECK:STDOUT: %return.patt: %pattern_type.e39 = return_slot_pattern %return.param_patt, %B.ref [concrete = constants.%return.patt.911] // CHECK:STDOUT: } { // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B] -// CHECK:STDOUT: %.loc23: Core.Form = init_form %B.ref [concrete = constants.%.d83] +// CHECK:STDOUT: %.loc17: Core.Form = init_form %B.ref [concrete = constants.%.d83] // CHECK:STDOUT: %return.param: ref %B = out_param call_param0 // CHECK:STDOUT: %return: ref %B = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: %A.as.X.impl.F.decl.loc23_14.2: %A.as.X.impl.F.type.48cdab.2 = fn_decl @A.as.X.impl.F.loc23_14.2 [concrete = constants.%A.as.X.impl.F.bd5be1.2] { +// CHECK:STDOUT: %A.as.X.impl.F.decl.loc17_14.2: %A.as.X.impl.F.type.48cdab.2 = fn_decl @A.as.X.impl.F.loc17_14.2 [concrete = constants.%A.as.X.impl.F.bd5be1.2] { // CHECK:STDOUT: // CHECK:STDOUT: } { // CHECK:STDOUT: @@ -1209,78 +1177,78 @@ impl () as I({}) { // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .B = -// CHECK:STDOUT: .F = %A.as.X.impl.F.decl.loc23_14.1 +// CHECK:STDOUT: .F = %A.as.X.impl.F.decl.loc17_14.1 // CHECK:STDOUT: extend %X.ref // CHECK:STDOUT: witness = %X.impl_witness // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @A.as.X.impl.F.loc23_14.1() -> out %return.param: %B; +// CHECK:STDOUT: fn @A.as.X.impl.F.loc17_14.1() -> out %return.param: %B; // CHECK:STDOUT: -// CHECK:STDOUT: fn @A.as.X.impl.F.loc23_14.2() -> out %return.param: %A [thunk @A.as.X.impl.%A.as.X.impl.F.decl.loc23_14.1 for @X.WithSelf.%X.WithSelf.F.decl, @X.WithSelf.F(constants.%X.facet)] { +// CHECK:STDOUT: fn @A.as.X.impl.F.loc17_14.2() -> out %return.param: %A [thunk @A.as.X.impl.%A.as.X.impl.F.decl.loc17_14.1 for @X.WithSelf.%X.WithSelf.F.decl, @X.WithSelf.F(constants.%X.facet)] { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: %A.as.X.impl.F.type.48cdab.1 = name_ref F, @A.as.X.impl.%A.as.X.impl.F.decl.loc23_14.1 [concrete = constants.%A.as.X.impl.F.bd5be1.1] -// CHECK:STDOUT: %.loc23_14.1: ref %B = temporary_storage -// CHECK:STDOUT: %A.as.X.impl.F.call: init %B to %.loc23_14.1 = call %F.ref() -// CHECK:STDOUT: %.loc23_14.2: ref %B = temporary %.loc23_14.1, %A.as.X.impl.F.call -// CHECK:STDOUT: %.loc23_14.3: ref %A = class_element_access %.loc23_14.2, element0 -// CHECK:STDOUT: %.loc23_14.4: ref %A = converted %A.as.X.impl.F.call, %.loc23_14.3 -// CHECK:STDOUT: %.loc23_14.5: %A = acquire_value %.loc23_14.4 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc23_14.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.4 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc23_14.2) +// CHECK:STDOUT: %F.ref: %A.as.X.impl.F.type.48cdab.1 = name_ref F, @A.as.X.impl.%A.as.X.impl.F.decl.loc17_14.1 [concrete = constants.%A.as.X.impl.F.bd5be1.1] +// CHECK:STDOUT: %.loc17_14.1: ref %B = temporary_storage +// CHECK:STDOUT: %A.as.X.impl.F.call: init %B to %.loc17_14.1 = call %F.ref() +// CHECK:STDOUT: %.loc17_14.2: ref %B = temporary %.loc17_14.1, %A.as.X.impl.F.call +// CHECK:STDOUT: %.loc17_14.3: ref %A = class_element_access %.loc17_14.2, element0 +// CHECK:STDOUT: %.loc17_14.4: ref %A = converted %A.as.X.impl.F.call, %.loc17_14.3 +// CHECK:STDOUT: %.loc17_14.5: %A = acquire_value %.loc17_14.4 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc17_14.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.4 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc17_14.2) // CHECK:STDOUT: return to %return.param // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc23_14.1(%self.param: ref %empty_struct_type) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc17_14.1(%self.param: ref %empty_struct_type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc23_14.1(%self.param: ref %empty_struct_type) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc17_14.1(%self.param: ref %empty_struct_type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc23_14.1(%self.param: ref %empty_struct_type) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc17_14.1(%self.param: ref %empty_struct_type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.1(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.1(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc23_14.2(%self.param: ref %A) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc17_14.2(%self.param: ref %A) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc23_14.2(%self.param: ref %A) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc17_14.2(%self.param: ref %A) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc23_14.2(%self.param: ref %A) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc17_14.2(%self.param: ref %A) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.2(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.2(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc23_14.3(%self.param: ref %struct_type.base.cb7) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc17_14.3(%self.param: ref %struct_type.base.cb7) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc23: ref %A = struct_access %self.param, element0 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc23, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc23) +// CHECK:STDOUT: %.loc17: ref %A = struct_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc17, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc17) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc23_14.3(%self.param: ref %struct_type.base.cb7) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc17_14.3(%self.param: ref %struct_type.base.cb7) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc23_14.3(%self.param: ref %struct_type.base.cb7) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc17_14.3(%self.param: ref %struct_type.base.cb7) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.3(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.3(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc23_14.4(%self.param: ref %B) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc17_14.4(%self.param: ref %B) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %base.ref: %B.elem = name_ref base, @B.%.loc5 [concrete = @B.%.loc5] -// CHECK:STDOUT: %.loc23: ref %A = class_element_access %self.param, element0 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc23, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc23) +// CHECK:STDOUT: %.loc17: ref %A = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc17, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc17) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc23_14.4(%self.param: ref %B) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc17_14.4(%self.param: ref %B) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc23_14.4(%self.param: ref %B) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc17_14.4(%self.param: ref %B) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.4(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.4(%self.param) diff --git a/toolchain/check/testdata/impl/impl_thunk_min_prelude.carbon b/toolchain/check/testdata/impl/impl_thunk_min_prelude.carbon index d5d904e61d4a..db1d783e6fd3 100644 --- a/toolchain/check/testdata/impl/impl_thunk_min_prelude.carbon +++ b/toolchain/check/testdata/impl/impl_thunk_min_prelude.carbon @@ -51,12 +51,8 @@ interface OpWith(U: type) { } impl forall [T: type, U: Core.ImplicitAs(Wrap(T))] Wrap(T) as OpWith(U) { - // CHECK:STDERR: fail_todo_out_of_line_thunk.carbon:[[@LINE+7]]:3: error: use of undefined generic function [MissingGenericFunctionDefinition] - // CHECK:STDERR: fn Op(self, other: Self); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_out_of_line_thunk.carbon:[[@LINE+4]]:3: note: generic function declared here [MissingGenericFunctionDefinitionHere] - // CHECK:STDERR: fn Op(self, other: Self); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_out_of_line_thunk.carbon:[[@LINE+3]]:3-27: error: use of undefined generic function [MissingGenericFunctionDefinition] + // CHECK:STDERR: fail_todo_out_of_line_thunk.carbon:[[@LINE+2]]:3-27: note: generic function declared here [MissingGenericFunctionDefinitionHere] // CHECK:STDERR: fn Op(self, other: Self); } diff --git a/toolchain/check/testdata/impl/impl_where_redecl.carbon b/toolchain/check/testdata/impl/impl_where_redecl.carbon index 75b71676a95c..c693e612c8e8 100644 --- a/toolchain/check/testdata/impl/impl_where_redecl.carbon +++ b/toolchain/check/testdata/impl/impl_where_redecl.carbon @@ -18,23 +18,17 @@ library "[[@TEST_NAME]]"; interface I { let T: type; } constraint N(U: type) {} -// CHECK:STDERR: fail_match_with_associated_type.carbon:[[@LINE+4]]:1: error: impl declared but not defined [ImplMissingDefinition] -// CHECK:STDERR: impl () as I where .T = {}; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_match_with_associated_type.carbon:[[@LINE+2]]:1-27: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl () as I where .T = {}; impl () as I where .T = {} and .T impls N(.Self) {} -// CHECK:STDERR: fail_match_with_associated_type.carbon:[[@LINE+4]]:1: error: impl declared but not defined [ImplMissingDefinition] -// CHECK:STDERR: impl {} as I; -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_match_with_associated_type.carbon:[[@LINE+2]]:1-13: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl {} as I; impl {} as I where .T = {} and .T impls N(.Self) {} -// CHECK:STDERR: fail_match_with_associated_type.carbon:[[@LINE+4]]:1: error: impl declared but not defined [ImplMissingDefinition] -// CHECK:STDERR: impl ({},) as I where .T = {} and .T impls N(.Self); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_match_with_associated_type.carbon:[[@LINE+2]]:1-52: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl ({},) as I where .T = {} and .T impls N(.Self); impl ({},) as I where .T = {} {} @@ -45,16 +39,12 @@ library "[[@TEST_NAME]]"; interface J {} constraint N {} -// CHECK:STDERR: fail_match_with_empty_interface.carbon:[[@LINE+4]]:1: error: impl declared but not defined [ImplMissingDefinition] -// CHECK:STDERR: impl () as J; -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_match_with_empty_interface.carbon:[[@LINE+2]]:1-13: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl () as J; impl () as J where .Self impls type and .Self impls N {} -// CHECK:STDERR: fail_match_with_empty_interface.carbon:[[@LINE+4]]:1: error: impl declared but not defined [ImplMissingDefinition] -// CHECK:STDERR: impl {} as J where .Self impls type and .Self impls N; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_match_with_empty_interface.carbon:[[@LINE+2]]:1-54: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl {} as J where .Self impls type and .Self impls N; impl {} as J {} @@ -64,9 +54,7 @@ library "[[@TEST_NAME]]"; interface K {} -// CHECK:STDERR: fail_parens_other_nesting.carbon:[[@LINE+4]]:1: error: impl declared but not defined [ImplMissingDefinition] -// CHECK:STDERR: impl {} as (K where .Self impls type) where .Self impls type; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_parens_other_nesting.carbon:[[@LINE+2]]:1-61: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl {} as (K where .Self impls type) where .Self impls type; impl {} as (K where .Self impls type) {} @@ -76,9 +64,7 @@ library "[[@TEST_NAME]]"; interface L {} -// CHECK:STDERR: fail_other_nesting.carbon:[[@LINE+4]]:1: error: impl declared but not defined [ImplMissingDefinition] -// CHECK:STDERR: impl () as (L where .Self impls type) where .Self impls type; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_other_nesting.carbon:[[@LINE+2]]:1-61: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl () as (L where .Self impls type) where .Self impls type; impl () as L {} diff --git a/toolchain/check/testdata/impl/import_compound.carbon b/toolchain/check/testdata/impl/import_compound.carbon index 6a2d0b2c6cfd..0db6e339a4b8 100644 --- a/toolchain/check/testdata/impl/import_compound.carbon +++ b/toolchain/check/testdata/impl/import_compound.carbon @@ -46,12 +46,8 @@ library "[[@TEST_NAME]]"; import library "lib"; 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: n.(NonInstance.F)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_non-instance.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert non-type value of type `{.i: ()}` into type implementing `NonInstance` [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: fail_import_non-instance.carbon:[[@LINE+2]]:3-19: note: type `{.i: ()}` does not implement interface `Core.ImplicitAs(NonInstance)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: n.(NonInstance.F)(); } @@ -62,12 +58,8 @@ library "[[@TEST_NAME]]"; import library "lib"; 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: p->(NonInstance.F)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_non-instance_indirect.carbon:[[@LINE+3]]:3-20: error: cannot implicitly convert non-type value of type `{.i: ()}` into type implementing `NonInstance` [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: fail_import_non-instance_indirect.carbon:[[@LINE+2]]:3-20: note: type `{.i: ()}` does not implement interface `Core.ImplicitAs(NonInstance)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: p->(NonInstance.F)(); } @@ -91,9 +83,7 @@ library "[[@TEST_NAME]]"; import library "lib"; fn InstanceCallImportFail() { - // CHECK:STDERR: fail_import_instance.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Instance` in type `type` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: {.i: ()}.(Instance.G)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_instance.carbon:[[@LINE+2]]:3-23: error: cannot access member of interface `Instance` in type `type` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: {.i: ()}.(Instance.G)(); } @@ -497,7 +487,7 @@ fn InstanceCallImportFail() { // CHECK:STDOUT: %n.ref: %struct_type.i = name_ref n, %n // CHECK:STDOUT: %NonInstance.ref: type = name_ref NonInstance, imports.%Main.NonInstance [concrete = constants.%NonInstance.type] // CHECK:STDOUT: %F.ref: %NonInstance.assoc_type = name_ref F, imports.%Main.import_ref.12d [concrete = constants.%assoc0.dae] -// CHECK:STDOUT: %.loc13: %NonInstance.type = converted %n.ref, [concrete = ] +// CHECK:STDOUT: %.loc9: %NonInstance.type = converted %n.ref, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -591,8 +581,8 @@ fn InstanceCallImportFail() { // CHECK:STDOUT: %p.ref: %ptr = name_ref p, %p // CHECK:STDOUT: %NonInstance.ref: type = name_ref NonInstance, imports.%Main.NonInstance [concrete = constants.%NonInstance.type] // CHECK:STDOUT: %F.ref: %NonInstance.assoc_type = name_ref F, imports.%Main.import_ref.12d [concrete = constants.%assoc0.dae] -// CHECK:STDOUT: %.loc13_4.1: ref %struct_type.i = deref %p.ref -// CHECK:STDOUT: %.loc13_4.2: %NonInstance.type = converted %.loc13_4.1, [concrete = ] +// CHECK:STDOUT: %.loc9_4.1: ref %struct_type.i = deref %p.ref +// CHECK:STDOUT: %.loc9_4.2: %NonInstance.type = converted %.loc9_4.1, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -845,8 +835,8 @@ fn InstanceCallImportFail() { // CHECK:STDOUT: // CHECK:STDOUT: fn @InstanceCallImportFail() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_9.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc10_9.2: type = converted %.loc10_9.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc8_9.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_9.2: type = converted %.loc8_9.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %struct_type.i: type = struct_type {.i: %empty_tuple.type} [concrete = constants.%struct_type.i] // CHECK:STDOUT: %Instance.ref: type = name_ref Instance, imports.%Main.Instance [concrete = constants.%Instance.type] // CHECK:STDOUT: %G.ref: %Instance.assoc_type = name_ref G, imports.%Main.import_ref.437 [concrete = constants.%assoc0] diff --git a/toolchain/check/testdata/impl/import_generic.carbon b/toolchain/check/testdata/impl/import_generic.carbon index 21c6585bf9a6..96e5316467f5 100644 --- a/toolchain/check/testdata/impl/import_generic.carbon +++ b/toolchain/check/testdata/impl/import_generic.carbon @@ -66,38 +66,26 @@ constraint N(T: type) { impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl] -// CHECK:STDERR: impl forall [T: type] C as I(T); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE+2]]:1-32: error: redeclaration of imported impl [RedeclImportedImpl] // CHECK:STDERR: impl forall [T: type] C as I(T); -// CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl] -// CHECK:STDERR: impl forall [T: type] C as I(T) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE+2]]:1-33: error: redeclaration of imported impl [RedeclImportedImpl] // CHECK:STDERR: impl forall [T: type] C as I(T) {} -// CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl] -// CHECK:STDERR: impl forall [T: type] C as I(T*); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE+2]]:1-33: error: redeclaration of imported impl [RedeclImportedImpl] // CHECK:STDERR: impl forall [T: type] C as I(T*); -// CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl] -// CHECK:STDERR: impl forall [T: type] C as I(T*) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE+2]]:1-34: error: redeclaration of imported impl [RedeclImportedImpl] // CHECK:STDERR: impl forall [T: type] C as I(T*) {} -// CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl] -// CHECK:STDERR: impl forall [T: type] C as N(T); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE+2]]:1-32: error: redeclaration of imported impl [RedeclImportedImpl] // CHECK:STDERR: impl forall [T: type] C as N(T); -// CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl] -// CHECK:STDERR: impl forall [T: type] C as N(T*); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE+2]]:1-33: error: redeclaration of imported impl [RedeclImportedImpl] // CHECK:STDERR: impl forall [T: type] C as N(T*); @@ -133,15 +121,11 @@ constraint N(T: type) { extend require impls J(T); } -// CHECK:STDERR: fail_import_generic_decl.carbon:[[@LINE+4]]:1: error: impl declared but not defined [ImplMissingDefinition] -// CHECK:STDERR: impl forall [T: type] D as J(T); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_import_generic_decl.carbon:[[@LINE+2]]:1-32: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl forall [T: type] D as J(T); -// CHECK:STDERR: fail_import_generic_decl.carbon:[[@LINE+4]]:1: error: impl declared but not defined [ImplMissingDefinition] -// CHECK:STDERR: impl forall [T: type] D as J(T*); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_import_generic_decl.carbon:[[@LINE+2]]:1-33: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl forall [T: type] D as J(T*); @@ -149,39 +133,27 @@ impl forall [T: type] D as J(T*); impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_generic_decl.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl] -// CHECK:STDERR: impl forall [T: type] D as J(T); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_import_generic_decl.impl.carbon:[[@LINE+2]]:1-32: error: redeclaration of imported impl [RedeclImportedImpl] // CHECK:STDERR: impl forall [T: type] D as J(T); -// CHECK:STDERR: fail_import_generic_decl.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl] -// CHECK:STDERR: impl forall [T: type] D as J(T) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_import_generic_decl.impl.carbon:[[@LINE+2]]:1-33: error: redeclaration of imported impl [RedeclImportedImpl] // CHECK:STDERR: impl forall [T: type] D as J(T) {} -// CHECK:STDERR: fail_import_generic_decl.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl] -// CHECK:STDERR: impl forall [T: type] D as J(T*); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_import_generic_decl.impl.carbon:[[@LINE+2]]:1-33: error: redeclaration of imported impl [RedeclImportedImpl] // CHECK:STDERR: impl forall [T: type] D as J(T*); -// CHECK:STDERR: fail_import_generic_decl.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl] -// CHECK:STDERR: impl forall [T: type] D as J(T*) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_import_generic_decl.impl.carbon:[[@LINE+2]]:1-34: error: redeclaration of imported impl [RedeclImportedImpl] // CHECK:STDERR: impl forall [T: type] D as J(T*) {} -// CHECK:STDERR: fail_import_generic_decl.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl] -// CHECK:STDERR: impl forall [T: type] D as N(T) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_import_generic_decl.impl.carbon:[[@LINE+2]]:1-33: error: redeclaration of imported impl [RedeclImportedImpl] // CHECK:STDERR: impl forall [T: type] D as N(T) {} -// CHECK:STDERR: fail_import_generic_decl.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl] -// CHECK:STDERR: impl forall [T: type] D as N(T*) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_import_generic_decl.impl.carbon:[[@LINE+2]]:1-34: error: redeclaration of imported impl [RedeclImportedImpl] // CHECK:STDERR: impl forall [T: type] D as N(T*) {} @@ -1247,92 +1219,92 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: %default.import.loc2_30.1 = import // CHECK:STDOUT: %default.import.loc2_30.2 = import // CHECK:STDOUT: impl_decl @C.as.I.impl.4a876a.1 [concrete] { -// CHECK:STDOUT: %T.patt.loc8_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc6_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_15.2 (constants.%T.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C] // CHECK:STDOUT: %I.ref: %I.type.335 = name_ref I, imports.%Main.I [concrete = constants.%I.generic] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc8_15.1 [symbolic = %T.loc8_15.2 (constants.%T)] -// CHECK:STDOUT: %I.type.loc8_31.1: type = facet_type <@I, @I(constants.%T)> [symbolic = %I.type.loc8_31.2 (constants.%I.type.184)] -// CHECK:STDOUT: %.loc8_17.1: type = splice_block %.loc8_17.2 [concrete = type] { +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc6_15.1 [symbolic = %T.loc6_15.2 (constants.%T)] +// CHECK:STDOUT: %I.type.loc6_31.1: type = facet_type <@I, @I(constants.%T)> [symbolic = %I.type.loc6_31.2 (constants.%I.type.184)] +// CHECK:STDOUT: %.loc6_17.1: type = splice_block %.loc6_17.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc8_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc6_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc8_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc8_15.2 (constants.%T)] +// CHECK:STDOUT: %T.loc6_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc6_15.2 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8: = impl_self_witness @C.as.I.impl.4a876a.1.%C.ref, @I, @I(constants.%T) [symbolic = @C.as.I.impl.4a876a.1.%.loc8_32 (constants.%.855)] +// CHECK:STDOUT: %.loc6: = impl_self_witness @C.as.I.impl.4a876a.1.%C.ref, @I, @I(constants.%T) [symbolic = @C.as.I.impl.4a876a.1.%.loc6_32 (constants.%.855)] // CHECK:STDOUT: impl_decl @C.as.I.impl.4a876a.2 [concrete] { +// CHECK:STDOUT: %T.patt.loc10_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_15.2 (constants.%T.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C] +// CHECK:STDOUT: %I.ref: %I.type.335 = name_ref I, imports.%Main.I [concrete = constants.%I.generic] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc10_15.1 [symbolic = %T.loc10_15.2 (constants.%T)] +// CHECK:STDOUT: %I.type.loc10_31.1: type = facet_type <@I, @I(constants.%T)> [symbolic = %I.type.loc10_31.2 (constants.%I.type.184)] +// CHECK:STDOUT: %.loc10_17.1: type = splice_block %.loc10_17.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc10_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %T.loc10_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc10_15.2 (constants.%T)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %.loc10: = impl_self_witness @C.as.I.impl.4a876a.2.%C.ref, @I, @I(constants.%T) [symbolic = @C.as.I.impl.4a876a.2.%.loc10_33 (constants.%.855)] +// CHECK:STDOUT: impl_decl @C.as.I.impl.aa9e57.1 [concrete] { // CHECK:STDOUT: %T.patt.loc14_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc14_15.2 (constants.%T.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C] // CHECK:STDOUT: %I.ref: %I.type.335 = name_ref I, imports.%Main.I [concrete = constants.%I.generic] // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc14_15.1 [symbolic = %T.loc14_15.2 (constants.%T)] -// CHECK:STDOUT: %I.type.loc14_31.1: type = facet_type <@I, @I(constants.%T)> [symbolic = %I.type.loc14_31.2 (constants.%I.type.184)] +// CHECK:STDOUT: %ptr.loc14_31.1: type = ptr_type %T.ref [symbolic = %ptr.loc14_31.2 (constants.%ptr)] +// CHECK:STDOUT: %I.type.loc14_32.1: type = facet_type <@I, @I(constants.%ptr)> [symbolic = %I.type.loc14_32.2 (constants.%I.type.751)] // CHECK:STDOUT: %.loc14_17.1: type = splice_block %.loc14_17.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %.loc14_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } // CHECK:STDOUT: %T.loc14_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc14_15.2 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc14: = impl_self_witness @C.as.I.impl.4a876a.2.%C.ref, @I, @I(constants.%T) [symbolic = @C.as.I.impl.4a876a.2.%.loc14_33 (constants.%.855)] -// CHECK:STDOUT: impl_decl @C.as.I.impl.aa9e57.1 [concrete] { -// CHECK:STDOUT: %T.patt.loc20_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc20_15.2 (constants.%T.patt)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C] -// CHECK:STDOUT: %I.ref: %I.type.335 = name_ref I, imports.%Main.I [concrete = constants.%I.generic] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc20_15.1 [symbolic = %T.loc20_15.2 (constants.%T)] -// CHECK:STDOUT: %ptr.loc20_31.1: type = ptr_type %T.ref [symbolic = %ptr.loc20_31.2 (constants.%ptr)] -// CHECK:STDOUT: %I.type.loc20_32.1: type = facet_type <@I, @I(constants.%ptr)> [symbolic = %I.type.loc20_32.2 (constants.%I.type.751)] -// CHECK:STDOUT: %.loc20_17.1: type = splice_block %.loc20_17.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc20_17.2: type = type_literal type [concrete = type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc20_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc20_15.2 (constants.%T)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %.loc20: = impl_self_witness @C.as.I.impl.aa9e57.1.%C.ref, @I, @I(constants.%ptr) [symbolic = @C.as.I.impl.aa9e57.1.%.loc20_33 (constants.%.f39)] +// CHECK:STDOUT: %.loc14: = impl_self_witness @C.as.I.impl.aa9e57.1.%C.ref, @I, @I(constants.%ptr) [symbolic = @C.as.I.impl.aa9e57.1.%.loc14_33 (constants.%.f39)] // CHECK:STDOUT: impl_decl @C.as.I.impl.aa9e57.2 [concrete] { -// CHECK:STDOUT: %T.patt.loc26_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc26_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc18_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc18_15.2 (constants.%T.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C] // CHECK:STDOUT: %I.ref: %I.type.335 = name_ref I, imports.%Main.I [concrete = constants.%I.generic] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc26_15.1 [symbolic = %T.loc26_15.2 (constants.%T)] -// CHECK:STDOUT: %ptr.loc26_31.1: type = ptr_type %T.ref [symbolic = %ptr.loc26_31.2 (constants.%ptr)] -// CHECK:STDOUT: %I.type.loc26_32.1: type = facet_type <@I, @I(constants.%ptr)> [symbolic = %I.type.loc26_32.2 (constants.%I.type.751)] -// CHECK:STDOUT: %.loc26_17.1: type = splice_block %.loc26_17.2 [concrete = type] { +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc18_15.1 [symbolic = %T.loc18_15.2 (constants.%T)] +// CHECK:STDOUT: %ptr.loc18_31.1: type = ptr_type %T.ref [symbolic = %ptr.loc18_31.2 (constants.%ptr)] +// CHECK:STDOUT: %I.type.loc18_32.1: type = facet_type <@I, @I(constants.%ptr)> [symbolic = %I.type.loc18_32.2 (constants.%I.type.751)] +// CHECK:STDOUT: %.loc18_17.1: type = splice_block %.loc18_17.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc26_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc18_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc26_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc26_15.2 (constants.%T)] +// CHECK:STDOUT: %T.loc18_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc18_15.2 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc26: = impl_self_witness @C.as.I.impl.aa9e57.2.%C.ref, @I, @I(constants.%ptr) [symbolic = @C.as.I.impl.aa9e57.2.%.loc26_34 (constants.%.f39)] +// CHECK:STDOUT: %.loc18: = impl_self_witness @C.as.I.impl.aa9e57.2.%C.ref, @I, @I(constants.%ptr) [symbolic = @C.as.I.impl.aa9e57.2.%.loc18_34 (constants.%.f39)] // CHECK:STDOUT: impl_decl @C.as.I.impl.042f52.1 [concrete] { -// CHECK:STDOUT: %T.patt.loc32_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc32_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc22_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc22_15.2 (constants.%T.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C] // CHECK:STDOUT: %N.ref: %N.type.b76 = name_ref N, imports.%Main.N [concrete = constants.%empty_struct] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc32_15.1 [symbolic = %T.loc32_15.2 (constants.%T)] -// CHECK:STDOUT: %N.type.loc32_31.1: type = facet_type <@N, @N(constants.%T)> [symbolic = %N.type.loc32_31.2 (constants.%N.type.d682d6.1)] -// CHECK:STDOUT: %.loc32_17.1: type = splice_block %.loc32_17.2 [concrete = type] { +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc22_15.1 [symbolic = %T.loc22_15.2 (constants.%T)] +// CHECK:STDOUT: %N.type.loc22_31.1: type = facet_type <@N, @N(constants.%T)> [symbolic = %N.type.loc22_31.2 (constants.%N.type.d682d6.1)] +// CHECK:STDOUT: %.loc22_17.1: type = splice_block %.loc22_17.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc32_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc22_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc32_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc32_15.2 (constants.%T)] +// CHECK:STDOUT: %T.loc22_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc22_15.2 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc32: = impl_self_witness @C.as.I.impl.042f52.1.%C.ref, @I, @I(constants.%T) [symbolic = @C.as.I.impl.042f52.1.%.loc32_32 (constants.%.855)] +// CHECK:STDOUT: %.loc22: = impl_self_witness @C.as.I.impl.042f52.1.%C.ref, @I, @I(constants.%T) [symbolic = @C.as.I.impl.042f52.1.%.loc22_32 (constants.%.855)] // CHECK:STDOUT: impl_decl @C.as.I.impl.042f52.2 [concrete] { -// CHECK:STDOUT: %T.patt.loc37_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc37_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc25_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc25_15.2 (constants.%T.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C] // CHECK:STDOUT: %N.ref: %N.type.b76 = name_ref N, imports.%Main.N [concrete = constants.%empty_struct] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc37_15.1 [symbolic = %T.loc37_15.2 (constants.%T)] -// CHECK:STDOUT: %ptr.loc37_31.1: type = ptr_type %T.ref [symbolic = %ptr.loc37_31.2 (constants.%ptr)] -// CHECK:STDOUT: %N.type.loc37_32.1: type = facet_type <@N, @N(constants.%ptr)> [symbolic = %N.type.loc37_32.2 (constants.%N.type.d682d6.2)] -// CHECK:STDOUT: %.loc37_17.1: type = splice_block %.loc37_17.2 [concrete = type] { +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc25_15.1 [symbolic = %T.loc25_15.2 (constants.%T)] +// CHECK:STDOUT: %ptr.loc25_31.1: type = ptr_type %T.ref [symbolic = %ptr.loc25_31.2 (constants.%ptr)] +// CHECK:STDOUT: %N.type.loc25_32.1: type = facet_type <@N, @N(constants.%ptr)> [symbolic = %N.type.loc25_32.2 (constants.%N.type.d682d6.2)] +// CHECK:STDOUT: %.loc25_17.1: type = splice_block %.loc25_17.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc37_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc25_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc37_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc37_15.2 (constants.%T)] +// CHECK:STDOUT: %T.loc25_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc25_15.2 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc37: = impl_self_witness @C.as.I.impl.042f52.2.%C.ref, @I, @I(constants.%ptr) [symbolic = @C.as.I.impl.042f52.2.%.loc37_33 (constants.%.f39)] +// CHECK:STDOUT: %.loc25: = impl_self_witness @C.as.I.impl.042f52.2.%C.ref, @I, @I(constants.%ptr) [symbolic = @C.as.I.impl.042f52.2.%.loc25_33 (constants.%.f39)] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic interface @I(imports.%Main.import_ref.b3bc94.2: type) [from "import_generic.carbon"] { @@ -1415,73 +1387,73 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @C.as.I.impl.4a876a.1(%T.loc8_15.1: type) { -// CHECK:STDOUT: %T.patt.loc8_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc8_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc8_15.2 (constants.%T)] -// CHECK:STDOUT: %I.type.loc8_31.2: type = facet_type <@I, @I(%T.loc8_15.2)> [symbolic = %I.type.loc8_31.2 (constants.%I.type.184)] -// CHECK:STDOUT: %.loc8_32: = impl_self_witness constants.%C, @I, @I(%T.loc8_15.2) [symbolic = %.loc8_32 (constants.%.855)] +// CHECK:STDOUT: generic impl @C.as.I.impl.4a876a.1(%T.loc6_15.1: type) { +// CHECK:STDOUT: %T.patt.loc6_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc6_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc6_15.2 (constants.%T)] +// CHECK:STDOUT: %I.type.loc6_31.2: type = facet_type <@I, @I(%T.loc6_15.2)> [symbolic = %I.type.loc6_31.2 (constants.%I.type.184)] +// CHECK:STDOUT: %.loc6_32: = impl_self_witness constants.%C, @I, @I(%T.loc6_15.2) [symbolic = %.loc6_32 (constants.%.855)] // CHECK:STDOUT: -// CHECK:STDOUT: impl: %C.ref as %I.type.loc8_31.1; +// CHECK:STDOUT: impl: %C.ref as %I.type.loc6_31.1; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @C.as.I.impl.4a876a.2(%T.loc14_15.1: type) { +// CHECK:STDOUT: generic impl @C.as.I.impl.4a876a.2(%T.loc10_15.1: type) { +// CHECK:STDOUT: %T.patt.loc10_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc10_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc10_15.2 (constants.%T)] +// CHECK:STDOUT: %I.type.loc10_31.2: type = facet_type <@I, @I(%T.loc10_15.2)> [symbolic = %I.type.loc10_31.2 (constants.%I.type.184)] +// CHECK:STDOUT: %.loc10_33: = impl_self_witness constants.%C, @I, @I(%T.loc10_15.2) [symbolic = %.loc10_33 (constants.%.855)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: impl: %C.ref as %I.type.loc10_31.1 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: extend %I.type.loc10_31.1 +// CHECK:STDOUT: witness = +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @C.as.I.impl.aa9e57.1(%T.loc14_15.1: type) { // CHECK:STDOUT: %T.patt.loc14_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc14_15.2 (constants.%T.patt)] // CHECK:STDOUT: %T.loc14_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc14_15.2 (constants.%T)] -// CHECK:STDOUT: %I.type.loc14_31.2: type = facet_type <@I, @I(%T.loc14_15.2)> [symbolic = %I.type.loc14_31.2 (constants.%I.type.184)] -// CHECK:STDOUT: %.loc14_33: = impl_self_witness constants.%C, @I, @I(%T.loc14_15.2) [symbolic = %.loc14_33 (constants.%.855)] +// CHECK:STDOUT: %ptr.loc14_31.2: type = ptr_type %T.loc14_15.2 [symbolic = %ptr.loc14_31.2 (constants.%ptr)] +// CHECK:STDOUT: %I.type.loc14_32.2: type = facet_type <@I, @I(%ptr.loc14_31.2)> [symbolic = %I.type.loc14_32.2 (constants.%I.type.751)] +// CHECK:STDOUT: %.loc14_33: = impl_self_witness constants.%C, @I, @I(%ptr.loc14_31.2) [symbolic = %.loc14_33 (constants.%.f39)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: %C.ref as %I.type.loc14_32.1; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @C.as.I.impl.aa9e57.2(%T.loc18_15.1: type) { +// CHECK:STDOUT: %T.patt.loc18_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc18_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc18_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc18_15.2 (constants.%T)] +// CHECK:STDOUT: %ptr.loc18_31.2: type = ptr_type %T.loc18_15.2 [symbolic = %ptr.loc18_31.2 (constants.%ptr)] +// CHECK:STDOUT: %I.type.loc18_32.2: type = facet_type <@I, @I(%ptr.loc18_31.2)> [symbolic = %I.type.loc18_32.2 (constants.%I.type.751)] +// CHECK:STDOUT: %.loc18_34: = impl_self_witness constants.%C, @I, @I(%ptr.loc18_31.2) [symbolic = %.loc18_34 (constants.%.f39)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: impl: %C.ref as %I.type.loc14_31.1 { +// CHECK:STDOUT: impl: %C.ref as %I.type.loc18_32.1 { // CHECK:STDOUT: !members: -// CHECK:STDOUT: extend %I.type.loc14_31.1 +// CHECK:STDOUT: extend %I.type.loc18_32.1 // CHECK:STDOUT: witness = // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @C.as.I.impl.aa9e57.1(%T.loc20_15.1: type) { -// CHECK:STDOUT: %T.patt.loc20_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc20_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc20_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc20_15.2 (constants.%T)] -// CHECK:STDOUT: %ptr.loc20_31.2: type = ptr_type %T.loc20_15.2 [symbolic = %ptr.loc20_31.2 (constants.%ptr)] -// CHECK:STDOUT: %I.type.loc20_32.2: type = facet_type <@I, @I(%ptr.loc20_31.2)> [symbolic = %I.type.loc20_32.2 (constants.%I.type.751)] -// CHECK:STDOUT: %.loc20_33: = impl_self_witness constants.%C, @I, @I(%ptr.loc20_31.2) [symbolic = %.loc20_33 (constants.%.f39)] +// CHECK:STDOUT: generic impl @C.as.I.impl.042f52.1(%T.loc22_15.1: type) { +// CHECK:STDOUT: %T.patt.loc22_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc22_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc22_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc22_15.2 (constants.%T)] +// CHECK:STDOUT: %N.type.loc22_31.2: type = facet_type <@N, @N(%T.loc22_15.2)> [symbolic = %N.type.loc22_31.2 (constants.%N.type.d682d6.1)] +// CHECK:STDOUT: %.loc22_32: = impl_self_witness constants.%C, @I, @I(%T.loc22_15.2) [symbolic = %.loc22_32 (constants.%.855)] // CHECK:STDOUT: -// CHECK:STDOUT: impl: %C.ref as %I.type.loc20_32.1; +// CHECK:STDOUT: impl: %C.ref as %N.type.loc22_31.1; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @C.as.I.impl.aa9e57.2(%T.loc26_15.1: type) { -// CHECK:STDOUT: %T.patt.loc26_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc26_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc26_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc26_15.2 (constants.%T)] -// CHECK:STDOUT: %ptr.loc26_31.2: type = ptr_type %T.loc26_15.2 [symbolic = %ptr.loc26_31.2 (constants.%ptr)] -// CHECK:STDOUT: %I.type.loc26_32.2: type = facet_type <@I, @I(%ptr.loc26_31.2)> [symbolic = %I.type.loc26_32.2 (constants.%I.type.751)] -// CHECK:STDOUT: %.loc26_34: = impl_self_witness constants.%C, @I, @I(%ptr.loc26_31.2) [symbolic = %.loc26_34 (constants.%.f39)] +// CHECK:STDOUT: generic impl @C.as.I.impl.042f52.2(%T.loc25_15.1: type) { +// CHECK:STDOUT: %T.patt.loc25_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc25_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc25_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc25_15.2 (constants.%T)] +// CHECK:STDOUT: %ptr.loc25_31.2: type = ptr_type %T.loc25_15.2 [symbolic = %ptr.loc25_31.2 (constants.%ptr)] +// CHECK:STDOUT: %N.type.loc25_32.2: type = facet_type <@N, @N(%ptr.loc25_31.2)> [symbolic = %N.type.loc25_32.2 (constants.%N.type.d682d6.2)] +// CHECK:STDOUT: %.loc25_33: = impl_self_witness constants.%C, @I, @I(%ptr.loc25_31.2) [symbolic = %.loc25_33 (constants.%.f39)] // CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: -// CHECK:STDOUT: impl: %C.ref as %I.type.loc26_32.1 { -// CHECK:STDOUT: !members: -// CHECK:STDOUT: extend %I.type.loc26_32.1 -// CHECK:STDOUT: witness = -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic impl @C.as.I.impl.042f52.1(%T.loc32_15.1: type) { -// CHECK:STDOUT: %T.patt.loc32_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc32_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc32_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc32_15.2 (constants.%T)] -// CHECK:STDOUT: %N.type.loc32_31.2: type = facet_type <@N, @N(%T.loc32_15.2)> [symbolic = %N.type.loc32_31.2 (constants.%N.type.d682d6.1)] -// CHECK:STDOUT: %.loc32_32: = impl_self_witness constants.%C, @I, @I(%T.loc32_15.2) [symbolic = %.loc32_32 (constants.%.855)] -// CHECK:STDOUT: -// CHECK:STDOUT: impl: %C.ref as %N.type.loc32_31.1; -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic impl @C.as.I.impl.042f52.2(%T.loc37_15.1: type) { -// CHECK:STDOUT: %T.patt.loc37_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc37_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc37_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc37_15.2 (constants.%T)] -// CHECK:STDOUT: %ptr.loc37_31.2: type = ptr_type %T.loc37_15.2 [symbolic = %ptr.loc37_31.2 (constants.%ptr)] -// CHECK:STDOUT: %N.type.loc37_32.2: type = facet_type <@N, @N(%ptr.loc37_31.2)> [symbolic = %N.type.loc37_32.2 (constants.%N.type.d682d6.2)] -// CHECK:STDOUT: %.loc37_33: = impl_self_witness constants.%C, @I, @I(%ptr.loc37_31.2) [symbolic = %.loc37_33 (constants.%.f39)] -// CHECK:STDOUT: -// CHECK:STDOUT: impl: %C.ref as %N.type.loc37_32.1; +// CHECK:STDOUT: impl: %C.ref as %N.type.loc25_32.1; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C [from "import_generic.carbon"] { @@ -1531,33 +1503,33 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @C.as.I.impl.4a876a.1(constants.%T) { -// CHECK:STDOUT: %T.patt.loc8_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc8_15.2 => constants.%T -// CHECK:STDOUT: %I.type.loc8_31.2 => constants.%I.type.184 -// CHECK:STDOUT: %.loc8_32 => constants.%.855 +// CHECK:STDOUT: %T.patt.loc6_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc6_15.2 => constants.%T +// CHECK:STDOUT: %I.type.loc6_31.2 => constants.%I.type.184 +// CHECK:STDOUT: %.loc6_32 => constants.%.855 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @C.as.I.impl.4a876a.2(constants.%T) { -// CHECK:STDOUT: %T.patt.loc14_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc14_15.2 => constants.%T -// CHECK:STDOUT: %I.type.loc14_31.2 => constants.%I.type.184 -// CHECK:STDOUT: %.loc14_33 => constants.%.855 +// CHECK:STDOUT: %T.patt.loc10_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc10_15.2 => constants.%T +// CHECK:STDOUT: %I.type.loc10_31.2 => constants.%I.type.184 +// CHECK:STDOUT: %.loc10_33 => constants.%.855 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @C.as.I.impl.aa9e57.1(constants.%T) { -// CHECK:STDOUT: %T.patt.loc20_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc20_15.2 => constants.%T -// CHECK:STDOUT: %ptr.loc20_31.2 => constants.%ptr -// CHECK:STDOUT: %I.type.loc20_32.2 => constants.%I.type.751 -// CHECK:STDOUT: %.loc20_33 => constants.%.f39 +// CHECK:STDOUT: %T.patt.loc14_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc14_15.2 => constants.%T +// CHECK:STDOUT: %ptr.loc14_31.2 => constants.%ptr +// CHECK:STDOUT: %I.type.loc14_32.2 => constants.%I.type.751 +// CHECK:STDOUT: %.loc14_33 => constants.%.f39 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @C.as.I.impl.aa9e57.2(constants.%T) { -// CHECK:STDOUT: %T.patt.loc26_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc26_15.2 => constants.%T -// CHECK:STDOUT: %ptr.loc26_31.2 => constants.%ptr -// CHECK:STDOUT: %I.type.loc26_32.2 => constants.%I.type.751 -// CHECK:STDOUT: %.loc26_34 => constants.%.f39 +// CHECK:STDOUT: %T.patt.loc18_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc18_15.2 => constants.%T +// CHECK:STDOUT: %ptr.loc18_31.2 => constants.%ptr +// CHECK:STDOUT: %I.type.loc18_32.2 => constants.%I.type.751 +// CHECK:STDOUT: %.loc18_34 => constants.%.f39 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @N(constants.%T) { @@ -1591,10 +1563,10 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @C.as.I.impl.042f52.1(constants.%T) { -// CHECK:STDOUT: %T.patt.loc32_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc32_15.2 => constants.%T -// CHECK:STDOUT: %N.type.loc32_31.2 => constants.%N.type.d682d6.1 -// CHECK:STDOUT: %.loc32_32 => constants.%.855 +// CHECK:STDOUT: %T.patt.loc22_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc22_15.2 => constants.%T +// CHECK:STDOUT: %N.type.loc22_31.2 => constants.%N.type.d682d6.1 +// CHECK:STDOUT: %.loc22_32 => constants.%.855 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @N(constants.%ptr) { @@ -1618,11 +1590,11 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @C.as.I.impl.042f52.2(constants.%T) { -// CHECK:STDOUT: %T.patt.loc37_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc37_15.2 => constants.%T -// CHECK:STDOUT: %ptr.loc37_31.2 => constants.%ptr -// CHECK:STDOUT: %N.type.loc37_32.2 => constants.%N.type.d682d6.2 -// CHECK:STDOUT: %.loc37_33 => constants.%.f39 +// CHECK:STDOUT: %T.patt.loc25_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc25_15.2 => constants.%T +// CHECK:STDOUT: %ptr.loc25_31.2 => constants.%ptr +// CHECK:STDOUT: %N.type.loc25_32.2 => constants.%N.type.d682d6.2 +// CHECK:STDOUT: %.loc25_33 => constants.%.f39 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- import_generic_with_different_specific.carbon @@ -2210,34 +2182,34 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: %T.loc7_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc7_15.1 (constants.%T)] // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @D.as.J.impl.7ed [concrete] { -// CHECK:STDOUT: %T.patt.loc15_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc15_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc13_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc13_15.2 (constants.%T.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [concrete = constants.%D] // CHECK:STDOUT: %J.ref: %J.type.23c = name_ref J, file.%J.decl [concrete = constants.%J.generic] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc15_15.1 [symbolic = %T.loc15_15.2 (constants.%T)] -// CHECK:STDOUT: %J.type.loc15_31.1: type = facet_type <@J, @J(constants.%T)> [symbolic = %J.type.loc15_31.2 (constants.%J.type.ed5)] -// CHECK:STDOUT: %.loc15_17.1: type = splice_block %.loc15_17.2 [concrete = type] { +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc13_15.1 [symbolic = %T.loc13_15.2 (constants.%T)] +// CHECK:STDOUT: %J.type.loc13_31.1: type = facet_type <@J, @J(constants.%T)> [symbolic = %J.type.loc13_31.2 (constants.%J.type.ed5)] +// CHECK:STDOUT: %.loc13_17.1: type = splice_block %.loc13_17.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc15_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc13_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc15_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc15_15.2 (constants.%T)] +// CHECK:STDOUT: %T.loc13_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc13_15.2 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc15: = impl_self_witness @D.as.J.impl.7ed.%D.ref, @J, @J(constants.%T) [symbolic = @D.as.J.impl.7ed.%.loc15_32 (constants.%.c85)] +// CHECK:STDOUT: %.loc13: = impl_self_witness @D.as.J.impl.7ed.%D.ref, @J, @J(constants.%T) [symbolic = @D.as.J.impl.7ed.%.loc13_32 (constants.%.c85)] // CHECK:STDOUT: impl_decl @D.as.J.impl.68b [concrete] { -// CHECK:STDOUT: %T.patt.loc21_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc21_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc17_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc17_15.2 (constants.%T.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [concrete = constants.%D] // CHECK:STDOUT: %J.ref: %J.type.23c = name_ref J, file.%J.decl [concrete = constants.%J.generic] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc21_15.1 [symbolic = %T.loc21_15.2 (constants.%T)] -// CHECK:STDOUT: %ptr.loc21_31.1: type = ptr_type %T.ref [symbolic = %ptr.loc21_31.2 (constants.%ptr)] -// CHECK:STDOUT: %J.type.loc21_32.1: type = facet_type <@J, @J(constants.%ptr)> [symbolic = %J.type.loc21_32.2 (constants.%J.type.a41)] -// CHECK:STDOUT: %.loc21_17.1: type = splice_block %.loc21_17.2 [concrete = type] { +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc17_15.1 [symbolic = %T.loc17_15.2 (constants.%T)] +// CHECK:STDOUT: %ptr.loc17_31.1: type = ptr_type %T.ref [symbolic = %ptr.loc17_31.2 (constants.%ptr)] +// CHECK:STDOUT: %J.type.loc17_32.1: type = facet_type <@J, @J(constants.%ptr)> [symbolic = %J.type.loc17_32.2 (constants.%J.type.a41)] +// CHECK:STDOUT: %.loc17_17.1: type = splice_block %.loc17_17.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc21_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc17_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc21_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc21_15.2 (constants.%T)] +// CHECK:STDOUT: %T.loc17_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc17_15.2 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc21: = impl_self_witness @D.as.J.impl.68b.%D.ref, @J, @J(constants.%ptr) [symbolic = @D.as.J.impl.68b.%.loc21_33 (constants.%.d76)] +// CHECK:STDOUT: %.loc17: = impl_self_witness @D.as.J.impl.68b.%D.ref, @J, @J(constants.%ptr) [symbolic = @D.as.J.impl.68b.%.loc17_33 (constants.%.d76)] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic interface @J(%T.loc5_14.2: type) { @@ -2307,25 +2279,25 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: %J.type.loc8_27.2: type = facet_type <@J, @J(%T)> [symbolic = %J.type.loc8_27.2 (constants.%J.type.ed5)] // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @D.as.J.impl.7ed(%T.loc15_15.1: type) { -// CHECK:STDOUT: %T.patt.loc15_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc15_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc15_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc15_15.2 (constants.%T)] -// CHECK:STDOUT: %J.type.loc15_31.2: type = facet_type <@J, @J(%T.loc15_15.2)> [symbolic = %J.type.loc15_31.2 (constants.%J.type.ed5)] -// CHECK:STDOUT: %.loc15_32: = impl_self_witness constants.%D, @J, @J(%T.loc15_15.2) [symbolic = %.loc15_32 (constants.%.c85)] -// CHECK:STDOUT: %J.impl_witness.loc15_32.2: = impl_witness %J.impl_witness_table, @D.as.J.impl.7ed(%T.loc15_15.2) [symbolic = %J.impl_witness.loc15_32.2 (constants.%J.impl_witness.dfb)] +// CHECK:STDOUT: generic impl @D.as.J.impl.7ed(%T.loc13_15.1: type) { +// CHECK:STDOUT: %T.patt.loc13_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc13_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc13_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc13_15.2 (constants.%T)] +// CHECK:STDOUT: %J.type.loc13_31.2: type = facet_type <@J, @J(%T.loc13_15.2)> [symbolic = %J.type.loc13_31.2 (constants.%J.type.ed5)] +// CHECK:STDOUT: %.loc13_32: = impl_self_witness constants.%D, @J, @J(%T.loc13_15.2) [symbolic = %.loc13_32 (constants.%.c85)] +// CHECK:STDOUT: %J.impl_witness.loc13_32.2: = impl_witness %J.impl_witness_table, @D.as.J.impl.7ed(%T.loc13_15.2) [symbolic = %J.impl_witness.loc13_32.2 (constants.%J.impl_witness.dfb)] // CHECK:STDOUT: -// CHECK:STDOUT: impl: %D.ref as %J.type.loc15_31.1; +// CHECK:STDOUT: impl: %D.ref as %J.type.loc13_31.1; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @D.as.J.impl.68b(%T.loc21_15.1: type) { -// CHECK:STDOUT: %T.patt.loc21_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc21_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc21_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc21_15.2 (constants.%T)] -// CHECK:STDOUT: %ptr.loc21_31.2: type = ptr_type %T.loc21_15.2 [symbolic = %ptr.loc21_31.2 (constants.%ptr)] -// CHECK:STDOUT: %J.type.loc21_32.2: type = facet_type <@J, @J(%ptr.loc21_31.2)> [symbolic = %J.type.loc21_32.2 (constants.%J.type.a41)] -// CHECK:STDOUT: %.loc21_33: = impl_self_witness constants.%D, @J, @J(%ptr.loc21_31.2) [symbolic = %.loc21_33 (constants.%.d76)] -// CHECK:STDOUT: %J.impl_witness.loc21_33.2: = impl_witness %J.impl_witness_table, @D.as.J.impl.68b(%T.loc21_15.2) [symbolic = %J.impl_witness.loc21_33.2 (constants.%J.impl_witness.ac6)] +// CHECK:STDOUT: generic impl @D.as.J.impl.68b(%T.loc17_15.1: type) { +// CHECK:STDOUT: %T.patt.loc17_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc17_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc17_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc17_15.2 (constants.%T)] +// CHECK:STDOUT: %ptr.loc17_31.2: type = ptr_type %T.loc17_15.2 [symbolic = %ptr.loc17_31.2 (constants.%ptr)] +// CHECK:STDOUT: %J.type.loc17_32.2: type = facet_type <@J, @J(%ptr.loc17_31.2)> [symbolic = %J.type.loc17_32.2 (constants.%J.type.a41)] +// CHECK:STDOUT: %.loc17_33: = impl_self_witness constants.%D, @J, @J(%ptr.loc17_31.2) [symbolic = %.loc17_33 (constants.%.d76)] +// CHECK:STDOUT: %J.impl_witness.loc17_33.2: = impl_witness %J.impl_witness_table, @D.as.J.impl.68b(%T.loc17_15.2) [symbolic = %J.impl_witness.loc17_33.2 (constants.%J.impl_witness.ac6)] // CHECK:STDOUT: -// CHECK:STDOUT: impl: %D.ref as %J.type.loc21_32.1; +// CHECK:STDOUT: impl: %D.ref as %J.type.loc17_32.1; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @D { @@ -2365,11 +2337,11 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @D.as.J.impl.7ed(constants.%T) { -// CHECK:STDOUT: %T.patt.loc15_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc15_15.2 => constants.%T -// CHECK:STDOUT: %J.type.loc15_31.2 => constants.%J.type.ed5 -// CHECK:STDOUT: %.loc15_32 => constants.%.c85 -// CHECK:STDOUT: %J.impl_witness.loc15_32.2 => constants.%J.impl_witness.dfb +// CHECK:STDOUT: %T.patt.loc13_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc13_15.2 => constants.%T +// CHECK:STDOUT: %J.type.loc13_31.2 => constants.%J.type.ed5 +// CHECK:STDOUT: %.loc13_32 => constants.%.c85 +// CHECK:STDOUT: %J.impl_witness.loc13_32.2 => constants.%J.impl_witness.dfb // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @J(constants.%ptr) { @@ -2378,12 +2350,12 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @D.as.J.impl.68b(constants.%T) { -// CHECK:STDOUT: %T.patt.loc21_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc21_15.2 => constants.%T -// CHECK:STDOUT: %ptr.loc21_31.2 => constants.%ptr -// CHECK:STDOUT: %J.type.loc21_32.2 => constants.%J.type.a41 -// CHECK:STDOUT: %.loc21_33 => constants.%.d76 -// CHECK:STDOUT: %J.impl_witness.loc21_33.2 => constants.%J.impl_witness.ac6 +// CHECK:STDOUT: %T.patt.loc17_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc17_15.2 => constants.%T +// CHECK:STDOUT: %ptr.loc17_31.2 => constants.%ptr +// CHECK:STDOUT: %J.type.loc17_32.2 => constants.%J.type.a41 +// CHECK:STDOUT: %.loc17_33 => constants.%.d76 +// CHECK:STDOUT: %J.impl_witness.loc17_33.2 => constants.%J.impl_witness.ac6 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_import_generic_decl.impl.carbon @@ -2426,13 +2398,13 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: %Main.import_ref.8f2: = import_ref Main//import_generic_decl, loc4_10, loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Main.import_ref.54a = import_ref Main//import_generic_decl, inst{{[0-9A-F]+}} [no loc], unloaded // CHECK:STDOUT: %J.impl_witness_table.9fc = impl_witness_table (), @D.as.J.impl.0c9 [concrete] -// CHECK:STDOUT: %Main.import_ref.2e2cf0.1: type = import_ref Main//import_generic_decl, loc15_23, loaded [concrete = constants.%D] -// CHECK:STDOUT: %Main.import_ref.babd8d.1: type = import_ref Main//import_generic_decl, loc15_31, loaded [symbolic = @D.as.J.impl.0c9.%J.type (constants.%J.type.ed5)] -// CHECK:STDOUT: %Main.import_ref.b3bc94.3: type = import_ref Main//import_generic_decl, loc15_15, loaded [symbolic = @D.as.J.impl.0c9.%T (constants.%T)] +// CHECK:STDOUT: %Main.import_ref.2e2cf0.1: type = import_ref Main//import_generic_decl, loc13_23, loaded [concrete = constants.%D] +// CHECK:STDOUT: %Main.import_ref.babd8d.1: type = import_ref Main//import_generic_decl, loc13_31, loaded [symbolic = @D.as.J.impl.0c9.%J.type (constants.%J.type.ed5)] +// CHECK:STDOUT: %Main.import_ref.b3bc94.3: type = import_ref Main//import_generic_decl, loc13_15, loaded [symbolic = @D.as.J.impl.0c9.%T (constants.%T)] // CHECK:STDOUT: %J.impl_witness_table.8f0 = impl_witness_table (), @D.as.J.impl.26a [concrete] -// CHECK:STDOUT: %Main.import_ref.2e2cf0.2: type = import_ref Main//import_generic_decl, loc21_23, loaded [concrete = constants.%D] -// CHECK:STDOUT: %Main.import_ref.19d: type = import_ref Main//import_generic_decl, loc21_32, loaded [symbolic = @D.as.J.impl.26a.%J.type (constants.%J.type.a41)] -// CHECK:STDOUT: %Main.import_ref.b3bc94.4: type = import_ref Main//import_generic_decl, loc21_15, loaded [symbolic = @D.as.J.impl.26a.%T (constants.%T)] +// CHECK:STDOUT: %Main.import_ref.2e2cf0.2: type = import_ref Main//import_generic_decl, loc17_23, loaded [concrete = constants.%D] +// CHECK:STDOUT: %Main.import_ref.19d: type = import_ref Main//import_generic_decl, loc17_32, loaded [symbolic = @D.as.J.impl.26a.%J.type (constants.%J.type.a41)] +// CHECK:STDOUT: %Main.import_ref.b3bc94.4: type = import_ref Main//import_generic_decl, loc17_15, loaded [symbolic = @D.as.J.impl.26a.%T (constants.%T)] // CHECK:STDOUT: %Main.import_ref.af3 = import_ref Main//import_generic_decl, loc8_28, unloaded // CHECK:STDOUT: %Main.import_ref.849: type = import_ref Main//import_generic_decl, loc8_18, loaded [symbolic = @N.WithSelf.Self.as_type.impls.J.type.require.%Self.as_type (constants.%Self.as_type)] // CHECK:STDOUT: %Main.import_ref.babd8d.2: type = import_ref Main//import_generic_decl, loc8_27, loaded [symbolic = @N.WithSelf.Self.as_type.impls.J.type.require.%J.type (constants.%J.type.ed5)] @@ -2451,92 +2423,92 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: %default.import.loc2_35.1 = import // CHECK:STDOUT: %default.import.loc2_35.2 = import // CHECK:STDOUT: impl_decl @D.as.J.impl.7edb40.1 [concrete] { -// CHECK:STDOUT: %T.patt.loc8_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc6_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_15.2 (constants.%T.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %D.ref: type = name_ref D, imports.%Main.D [concrete = constants.%D] // CHECK:STDOUT: %J.ref: %J.type.23c = name_ref J, imports.%Main.J [concrete = constants.%J.generic] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc8_15.1 [symbolic = %T.loc8_15.2 (constants.%T)] -// CHECK:STDOUT: %J.type.loc8_31.1: type = facet_type <@J, @J(constants.%T)> [symbolic = %J.type.loc8_31.2 (constants.%J.type.ed5)] -// CHECK:STDOUT: %.loc8_17.1: type = splice_block %.loc8_17.2 [concrete = type] { +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc6_15.1 [symbolic = %T.loc6_15.2 (constants.%T)] +// CHECK:STDOUT: %J.type.loc6_31.1: type = facet_type <@J, @J(constants.%T)> [symbolic = %J.type.loc6_31.2 (constants.%J.type.ed5)] +// CHECK:STDOUT: %.loc6_17.1: type = splice_block %.loc6_17.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc8_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc6_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc8_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc8_15.2 (constants.%T)] +// CHECK:STDOUT: %T.loc6_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc6_15.2 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8: = impl_self_witness @D.as.J.impl.7edb40.1.%D.ref, @J, @J(constants.%T) [symbolic = @D.as.J.impl.7edb40.1.%.loc8_32 (constants.%.c85)] +// CHECK:STDOUT: %.loc6: = impl_self_witness @D.as.J.impl.7edb40.1.%D.ref, @J, @J(constants.%T) [symbolic = @D.as.J.impl.7edb40.1.%.loc6_32 (constants.%.c85)] // CHECK:STDOUT: impl_decl @D.as.J.impl.7edb40.2 [concrete] { +// CHECK:STDOUT: %T.patt.loc10_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_15.2 (constants.%T.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %D.ref: type = name_ref D, imports.%Main.D [concrete = constants.%D] +// CHECK:STDOUT: %J.ref: %J.type.23c = name_ref J, imports.%Main.J [concrete = constants.%J.generic] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc10_15.1 [symbolic = %T.loc10_15.2 (constants.%T)] +// CHECK:STDOUT: %J.type.loc10_31.1: type = facet_type <@J, @J(constants.%T)> [symbolic = %J.type.loc10_31.2 (constants.%J.type.ed5)] +// CHECK:STDOUT: %.loc10_17.1: type = splice_block %.loc10_17.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc10_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %T.loc10_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc10_15.2 (constants.%T)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %.loc10: = impl_self_witness @D.as.J.impl.7edb40.2.%D.ref, @J, @J(constants.%T) [symbolic = @D.as.J.impl.7edb40.2.%.loc10_33 (constants.%.c85)] +// CHECK:STDOUT: impl_decl @D.as.J.impl.68b536.1 [concrete] { // CHECK:STDOUT: %T.patt.loc14_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc14_15.2 (constants.%T.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %D.ref: type = name_ref D, imports.%Main.D [concrete = constants.%D] // CHECK:STDOUT: %J.ref: %J.type.23c = name_ref J, imports.%Main.J [concrete = constants.%J.generic] // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc14_15.1 [symbolic = %T.loc14_15.2 (constants.%T)] -// CHECK:STDOUT: %J.type.loc14_31.1: type = facet_type <@J, @J(constants.%T)> [symbolic = %J.type.loc14_31.2 (constants.%J.type.ed5)] +// CHECK:STDOUT: %ptr.loc14_31.1: type = ptr_type %T.ref [symbolic = %ptr.loc14_31.2 (constants.%ptr)] +// CHECK:STDOUT: %J.type.loc14_32.1: type = facet_type <@J, @J(constants.%ptr)> [symbolic = %J.type.loc14_32.2 (constants.%J.type.a41)] // CHECK:STDOUT: %.loc14_17.1: type = splice_block %.loc14_17.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %.loc14_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } // CHECK:STDOUT: %T.loc14_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc14_15.2 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc14: = impl_self_witness @D.as.J.impl.7edb40.2.%D.ref, @J, @J(constants.%T) [symbolic = @D.as.J.impl.7edb40.2.%.loc14_33 (constants.%.c85)] -// CHECK:STDOUT: impl_decl @D.as.J.impl.68b536.1 [concrete] { -// CHECK:STDOUT: %T.patt.loc20_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc20_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %.loc14: = impl_self_witness @D.as.J.impl.68b536.1.%D.ref, @J, @J(constants.%ptr) [symbolic = @D.as.J.impl.68b536.1.%.loc14_33 (constants.%.d76)] +// CHECK:STDOUT: impl_decl @D.as.J.impl.68b536.2 [concrete] { +// CHECK:STDOUT: %T.patt.loc18_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc18_15.2 (constants.%T.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %D.ref: type = name_ref D, imports.%Main.D [concrete = constants.%D] // CHECK:STDOUT: %J.ref: %J.type.23c = name_ref J, imports.%Main.J [concrete = constants.%J.generic] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc20_15.1 [symbolic = %T.loc20_15.2 (constants.%T)] -// CHECK:STDOUT: %ptr.loc20_31.1: type = ptr_type %T.ref [symbolic = %ptr.loc20_31.2 (constants.%ptr)] -// CHECK:STDOUT: %J.type.loc20_32.1: type = facet_type <@J, @J(constants.%ptr)> [symbolic = %J.type.loc20_32.2 (constants.%J.type.a41)] -// CHECK:STDOUT: %.loc20_17.1: type = splice_block %.loc20_17.2 [concrete = type] { +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc18_15.1 [symbolic = %T.loc18_15.2 (constants.%T)] +// CHECK:STDOUT: %ptr.loc18_31.1: type = ptr_type %T.ref [symbolic = %ptr.loc18_31.2 (constants.%ptr)] +// CHECK:STDOUT: %J.type.loc18_32.1: type = facet_type <@J, @J(constants.%ptr)> [symbolic = %J.type.loc18_32.2 (constants.%J.type.a41)] +// CHECK:STDOUT: %.loc18_17.1: type = splice_block %.loc18_17.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc20_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc18_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc20_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc20_15.2 (constants.%T)] +// CHECK:STDOUT: %T.loc18_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc18_15.2 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc20: = impl_self_witness @D.as.J.impl.68b536.1.%D.ref, @J, @J(constants.%ptr) [symbolic = @D.as.J.impl.68b536.1.%.loc20_33 (constants.%.d76)] -// CHECK:STDOUT: impl_decl @D.as.J.impl.68b536.2 [concrete] { +// CHECK:STDOUT: %.loc18: = impl_self_witness @D.as.J.impl.68b536.2.%D.ref, @J, @J(constants.%ptr) [symbolic = @D.as.J.impl.68b536.2.%.loc18_34 (constants.%.d76)] +// CHECK:STDOUT: impl_decl @D.as.J.impl.d69d6f.1 [concrete] { +// CHECK:STDOUT: %T.patt.loc22_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc22_15.2 (constants.%T.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %D.ref: type = name_ref D, imports.%Main.D [concrete = constants.%D] +// CHECK:STDOUT: %N.ref: %N.type.b76 = name_ref N, imports.%Main.N [concrete = constants.%empty_struct] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc22_15.1 [symbolic = %T.loc22_15.2 (constants.%T)] +// CHECK:STDOUT: %N.type.loc22_31.1: type = facet_type <@N, @N(constants.%T)> [symbolic = %N.type.loc22_31.2 (constants.%N.type.d682d6.1)] +// CHECK:STDOUT: %.loc22_17.1: type = splice_block %.loc22_17.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc22_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %T.loc22_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc22_15.2 (constants.%T)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %.loc22: = impl_self_witness @D.as.J.impl.d69d6f.1.%D.ref, @J, @J(constants.%T) [symbolic = @D.as.J.impl.d69d6f.1.%.loc22_33 (constants.%.c85)] +// CHECK:STDOUT: impl_decl @D.as.J.impl.d69d6f.2 [concrete] { // CHECK:STDOUT: %T.patt.loc26_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc26_15.2 (constants.%T.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %D.ref: type = name_ref D, imports.%Main.D [concrete = constants.%D] -// CHECK:STDOUT: %J.ref: %J.type.23c = name_ref J, imports.%Main.J [concrete = constants.%J.generic] +// CHECK:STDOUT: %N.ref: %N.type.b76 = name_ref N, imports.%Main.N [concrete = constants.%empty_struct] // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc26_15.1 [symbolic = %T.loc26_15.2 (constants.%T)] // CHECK:STDOUT: %ptr.loc26_31.1: type = ptr_type %T.ref [symbolic = %ptr.loc26_31.2 (constants.%ptr)] -// CHECK:STDOUT: %J.type.loc26_32.1: type = facet_type <@J, @J(constants.%ptr)> [symbolic = %J.type.loc26_32.2 (constants.%J.type.a41)] +// CHECK:STDOUT: %N.type.loc26_32.1: type = facet_type <@N, @N(constants.%ptr)> [symbolic = %N.type.loc26_32.2 (constants.%N.type.d682d6.2)] // CHECK:STDOUT: %.loc26_17.1: type = splice_block %.loc26_17.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %.loc26_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } // CHECK:STDOUT: %T.loc26_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc26_15.2 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc26: = impl_self_witness @D.as.J.impl.68b536.2.%D.ref, @J, @J(constants.%ptr) [symbolic = @D.as.J.impl.68b536.2.%.loc26_34 (constants.%.d76)] -// CHECK:STDOUT: impl_decl @D.as.J.impl.d69d6f.1 [concrete] { -// CHECK:STDOUT: %T.patt.loc32_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc32_15.2 (constants.%T.patt)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %D.ref: type = name_ref D, imports.%Main.D [concrete = constants.%D] -// CHECK:STDOUT: %N.ref: %N.type.b76 = name_ref N, imports.%Main.N [concrete = constants.%empty_struct] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc32_15.1 [symbolic = %T.loc32_15.2 (constants.%T)] -// CHECK:STDOUT: %N.type.loc32_31.1: type = facet_type <@N, @N(constants.%T)> [symbolic = %N.type.loc32_31.2 (constants.%N.type.d682d6.1)] -// CHECK:STDOUT: %.loc32_17.1: type = splice_block %.loc32_17.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc32_17.2: type = type_literal type [concrete = type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc32_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc32_15.2 (constants.%T)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %.loc32: = impl_self_witness @D.as.J.impl.d69d6f.1.%D.ref, @J, @J(constants.%T) [symbolic = @D.as.J.impl.d69d6f.1.%.loc32_33 (constants.%.c85)] -// CHECK:STDOUT: impl_decl @D.as.J.impl.d69d6f.2 [concrete] { -// CHECK:STDOUT: %T.patt.loc38_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc38_15.2 (constants.%T.patt)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %D.ref: type = name_ref D, imports.%Main.D [concrete = constants.%D] -// CHECK:STDOUT: %N.ref: %N.type.b76 = name_ref N, imports.%Main.N [concrete = constants.%empty_struct] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc38_15.1 [symbolic = %T.loc38_15.2 (constants.%T)] -// CHECK:STDOUT: %ptr.loc38_31.1: type = ptr_type %T.ref [symbolic = %ptr.loc38_31.2 (constants.%ptr)] -// CHECK:STDOUT: %N.type.loc38_32.1: type = facet_type <@N, @N(constants.%ptr)> [symbolic = %N.type.loc38_32.2 (constants.%N.type.d682d6.2)] -// CHECK:STDOUT: %.loc38_17.1: type = splice_block %.loc38_17.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc38_17.2: type = type_literal type [concrete = type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc38_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc38_15.2 (constants.%T)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %.loc38: = impl_self_witness @D.as.J.impl.d69d6f.2.%D.ref, @J, @J(constants.%ptr) [symbolic = @D.as.J.impl.d69d6f.2.%.loc38_34 (constants.%.d76)] +// CHECK:STDOUT: %.loc26: = impl_self_witness @D.as.J.impl.d69d6f.2.%D.ref, @J, @J(constants.%ptr) [symbolic = @D.as.J.impl.d69d6f.2.%.loc26_34 (constants.%.d76)] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic interface @J(imports.%Main.import_ref.b3bc94.2: type) [from "fail_import_generic_decl.carbon"] { @@ -2605,83 +2577,83 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: impl: imports.%Main.import_ref.2e2cf0.2 as imports.%Main.import_ref.19d; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @D.as.J.impl.7edb40.1(%T.loc8_15.1: type) { -// CHECK:STDOUT: %T.patt.loc8_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc8_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc8_15.2 (constants.%T)] -// CHECK:STDOUT: %J.type.loc8_31.2: type = facet_type <@J, @J(%T.loc8_15.2)> [symbolic = %J.type.loc8_31.2 (constants.%J.type.ed5)] -// CHECK:STDOUT: %.loc8_32: = impl_self_witness constants.%D, @J, @J(%T.loc8_15.2) [symbolic = %.loc8_32 (constants.%.c85)] +// CHECK:STDOUT: generic impl @D.as.J.impl.7edb40.1(%T.loc6_15.1: type) { +// CHECK:STDOUT: %T.patt.loc6_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc6_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc6_15.2 (constants.%T)] +// CHECK:STDOUT: %J.type.loc6_31.2: type = facet_type <@J, @J(%T.loc6_15.2)> [symbolic = %J.type.loc6_31.2 (constants.%J.type.ed5)] +// CHECK:STDOUT: %.loc6_32: = impl_self_witness constants.%D, @J, @J(%T.loc6_15.2) [symbolic = %.loc6_32 (constants.%.c85)] // CHECK:STDOUT: -// CHECK:STDOUT: impl: %D.ref as %J.type.loc8_31.1; +// CHECK:STDOUT: impl: %D.ref as %J.type.loc6_31.1; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @D.as.J.impl.7edb40.2(%T.loc14_15.1: type) { -// CHECK:STDOUT: %T.patt.loc14_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc14_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc14_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc14_15.2 (constants.%T)] -// CHECK:STDOUT: %J.type.loc14_31.2: type = facet_type <@J, @J(%T.loc14_15.2)> [symbolic = %J.type.loc14_31.2 (constants.%J.type.ed5)] -// CHECK:STDOUT: %.loc14_33: = impl_self_witness constants.%D, @J, @J(%T.loc14_15.2) [symbolic = %.loc14_33 (constants.%.c85)] +// CHECK:STDOUT: generic impl @D.as.J.impl.7edb40.2(%T.loc10_15.1: type) { +// CHECK:STDOUT: %T.patt.loc10_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc10_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc10_15.2 (constants.%T)] +// CHECK:STDOUT: %J.type.loc10_31.2: type = facet_type <@J, @J(%T.loc10_15.2)> [symbolic = %J.type.loc10_31.2 (constants.%J.type.ed5)] +// CHECK:STDOUT: %.loc10_33: = impl_self_witness constants.%D, @J, @J(%T.loc10_15.2) [symbolic = %.loc10_33 (constants.%.c85)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: impl: %D.ref as %J.type.loc14_31.1 { +// CHECK:STDOUT: impl: %D.ref as %J.type.loc10_31.1 { // CHECK:STDOUT: !members: -// CHECK:STDOUT: extend %J.type.loc14_31.1 +// CHECK:STDOUT: extend %J.type.loc10_31.1 // CHECK:STDOUT: witness = // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @D.as.J.impl.68b536.1(%T.loc20_15.1: type) { -// CHECK:STDOUT: %T.patt.loc20_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc20_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc20_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc20_15.2 (constants.%T)] -// CHECK:STDOUT: %ptr.loc20_31.2: type = ptr_type %T.loc20_15.2 [symbolic = %ptr.loc20_31.2 (constants.%ptr)] -// CHECK:STDOUT: %J.type.loc20_32.2: type = facet_type <@J, @J(%ptr.loc20_31.2)> [symbolic = %J.type.loc20_32.2 (constants.%J.type.a41)] -// CHECK:STDOUT: %.loc20_33: = impl_self_witness constants.%D, @J, @J(%ptr.loc20_31.2) [symbolic = %.loc20_33 (constants.%.d76)] +// CHECK:STDOUT: generic impl @D.as.J.impl.68b536.1(%T.loc14_15.1: type) { +// CHECK:STDOUT: %T.patt.loc14_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc14_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc14_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc14_15.2 (constants.%T)] +// CHECK:STDOUT: %ptr.loc14_31.2: type = ptr_type %T.loc14_15.2 [symbolic = %ptr.loc14_31.2 (constants.%ptr)] +// CHECK:STDOUT: %J.type.loc14_32.2: type = facet_type <@J, @J(%ptr.loc14_31.2)> [symbolic = %J.type.loc14_32.2 (constants.%J.type.a41)] +// CHECK:STDOUT: %.loc14_33: = impl_self_witness constants.%D, @J, @J(%ptr.loc14_31.2) [symbolic = %.loc14_33 (constants.%.d76)] // CHECK:STDOUT: -// CHECK:STDOUT: impl: %D.ref as %J.type.loc20_32.1; +// CHECK:STDOUT: impl: %D.ref as %J.type.loc14_32.1; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @D.as.J.impl.68b536.2(%T.loc26_15.1: type) { +// CHECK:STDOUT: generic impl @D.as.J.impl.68b536.2(%T.loc18_15.1: type) { +// CHECK:STDOUT: %T.patt.loc18_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc18_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc18_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc18_15.2 (constants.%T)] +// CHECK:STDOUT: %ptr.loc18_31.2: type = ptr_type %T.loc18_15.2 [symbolic = %ptr.loc18_31.2 (constants.%ptr)] +// CHECK:STDOUT: %J.type.loc18_32.2: type = facet_type <@J, @J(%ptr.loc18_31.2)> [symbolic = %J.type.loc18_32.2 (constants.%J.type.a41)] +// CHECK:STDOUT: %.loc18_34: = impl_self_witness constants.%D, @J, @J(%ptr.loc18_31.2) [symbolic = %.loc18_34 (constants.%.d76)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: impl: %D.ref as %J.type.loc18_32.1 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: extend %J.type.loc18_32.1 +// CHECK:STDOUT: witness = +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @D.as.J.impl.d69d6f.1(%T.loc22_15.1: type) { +// CHECK:STDOUT: %T.patt.loc22_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc22_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc22_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc22_15.2 (constants.%T)] +// CHECK:STDOUT: %N.type.loc22_31.2: type = facet_type <@N, @N(%T.loc22_15.2)> [symbolic = %N.type.loc22_31.2 (constants.%N.type.d682d6.1)] +// CHECK:STDOUT: %.loc22_33: = impl_self_witness constants.%D, @J, @J(%T.loc22_15.2) [symbolic = %.loc22_33 (constants.%.c85)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: impl: %D.ref as %N.type.loc22_31.1 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: extend %N.type.loc22_31.1 +// CHECK:STDOUT: witness = +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @D.as.J.impl.d69d6f.2(%T.loc26_15.1: type) { // CHECK:STDOUT: %T.patt.loc26_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc26_15.2 (constants.%T.patt)] // CHECK:STDOUT: %T.loc26_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc26_15.2 (constants.%T)] // CHECK:STDOUT: %ptr.loc26_31.2: type = ptr_type %T.loc26_15.2 [symbolic = %ptr.loc26_31.2 (constants.%ptr)] -// CHECK:STDOUT: %J.type.loc26_32.2: type = facet_type <@J, @J(%ptr.loc26_31.2)> [symbolic = %J.type.loc26_32.2 (constants.%J.type.a41)] +// CHECK:STDOUT: %N.type.loc26_32.2: type = facet_type <@N, @N(%ptr.loc26_31.2)> [symbolic = %N.type.loc26_32.2 (constants.%N.type.d682d6.2)] // CHECK:STDOUT: %.loc26_34: = impl_self_witness constants.%D, @J, @J(%ptr.loc26_31.2) [symbolic = %.loc26_34 (constants.%.d76)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: impl: %D.ref as %J.type.loc26_32.1 { +// CHECK:STDOUT: impl: %D.ref as %N.type.loc26_32.1 { // CHECK:STDOUT: !members: -// CHECK:STDOUT: extend %J.type.loc26_32.1 -// CHECK:STDOUT: witness = -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic impl @D.as.J.impl.d69d6f.1(%T.loc32_15.1: type) { -// CHECK:STDOUT: %T.patt.loc32_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc32_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc32_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc32_15.2 (constants.%T)] -// CHECK:STDOUT: %N.type.loc32_31.2: type = facet_type <@N, @N(%T.loc32_15.2)> [symbolic = %N.type.loc32_31.2 (constants.%N.type.d682d6.1)] -// CHECK:STDOUT: %.loc32_33: = impl_self_witness constants.%D, @J, @J(%T.loc32_15.2) [symbolic = %.loc32_33 (constants.%.c85)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: -// CHECK:STDOUT: impl: %D.ref as %N.type.loc32_31.1 { -// CHECK:STDOUT: !members: -// CHECK:STDOUT: extend %N.type.loc32_31.1 -// CHECK:STDOUT: witness = -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic impl @D.as.J.impl.d69d6f.2(%T.loc38_15.1: type) { -// CHECK:STDOUT: %T.patt.loc38_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc38_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc38_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc38_15.2 (constants.%T)] -// CHECK:STDOUT: %ptr.loc38_31.2: type = ptr_type %T.loc38_15.2 [symbolic = %ptr.loc38_31.2 (constants.%ptr)] -// CHECK:STDOUT: %N.type.loc38_32.2: type = facet_type <@N, @N(%ptr.loc38_31.2)> [symbolic = %N.type.loc38_32.2 (constants.%N.type.d682d6.2)] -// CHECK:STDOUT: %.loc38_34: = impl_self_witness constants.%D, @J, @J(%ptr.loc38_31.2) [symbolic = %.loc38_34 (constants.%.d76)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: -// CHECK:STDOUT: impl: %D.ref as %N.type.loc38_32.1 { -// CHECK:STDOUT: !members: -// CHECK:STDOUT: extend %N.type.loc38_32.1 +// CHECK:STDOUT: extend %N.type.loc26_32.1 // CHECK:STDOUT: witness = // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -2729,33 +2701,33 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @D.as.J.impl.7edb40.1(constants.%T) { -// CHECK:STDOUT: %T.patt.loc8_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc8_15.2 => constants.%T -// CHECK:STDOUT: %J.type.loc8_31.2 => constants.%J.type.ed5 -// CHECK:STDOUT: %.loc8_32 => constants.%.c85 +// CHECK:STDOUT: %T.patt.loc6_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc6_15.2 => constants.%T +// CHECK:STDOUT: %J.type.loc6_31.2 => constants.%J.type.ed5 +// CHECK:STDOUT: %.loc6_32 => constants.%.c85 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @D.as.J.impl.7edb40.2(constants.%T) { -// CHECK:STDOUT: %T.patt.loc14_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc14_15.2 => constants.%T -// CHECK:STDOUT: %J.type.loc14_31.2 => constants.%J.type.ed5 -// CHECK:STDOUT: %.loc14_33 => constants.%.c85 +// CHECK:STDOUT: %T.patt.loc10_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc10_15.2 => constants.%T +// CHECK:STDOUT: %J.type.loc10_31.2 => constants.%J.type.ed5 +// CHECK:STDOUT: %.loc10_33 => constants.%.c85 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @D.as.J.impl.68b536.1(constants.%T) { -// CHECK:STDOUT: %T.patt.loc20_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc20_15.2 => constants.%T -// CHECK:STDOUT: %ptr.loc20_31.2 => constants.%ptr -// CHECK:STDOUT: %J.type.loc20_32.2 => constants.%J.type.a41 -// CHECK:STDOUT: %.loc20_33 => constants.%.d76 +// CHECK:STDOUT: %T.patt.loc14_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc14_15.2 => constants.%T +// CHECK:STDOUT: %ptr.loc14_31.2 => constants.%ptr +// CHECK:STDOUT: %J.type.loc14_32.2 => constants.%J.type.a41 +// CHECK:STDOUT: %.loc14_33 => constants.%.d76 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @D.as.J.impl.68b536.2(constants.%T) { -// CHECK:STDOUT: %T.patt.loc26_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc26_15.2 => constants.%T -// CHECK:STDOUT: %ptr.loc26_31.2 => constants.%ptr -// CHECK:STDOUT: %J.type.loc26_32.2 => constants.%J.type.a41 -// CHECK:STDOUT: %.loc26_34 => constants.%.d76 +// CHECK:STDOUT: %T.patt.loc18_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc18_15.2 => constants.%T +// CHECK:STDOUT: %ptr.loc18_31.2 => constants.%ptr +// CHECK:STDOUT: %J.type.loc18_32.2 => constants.%J.type.a41 +// CHECK:STDOUT: %.loc18_34 => constants.%.d76 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @N(constants.%T) { @@ -2789,10 +2761,10 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @D.as.J.impl.d69d6f.1(constants.%T) { -// CHECK:STDOUT: %T.patt.loc32_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc32_15.2 => constants.%T -// CHECK:STDOUT: %N.type.loc32_31.2 => constants.%N.type.d682d6.1 -// CHECK:STDOUT: %.loc32_33 => constants.%.c85 +// CHECK:STDOUT: %T.patt.loc22_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc22_15.2 => constants.%T +// CHECK:STDOUT: %N.type.loc22_31.2 => constants.%N.type.d682d6.1 +// CHECK:STDOUT: %.loc22_33 => constants.%.c85 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @N(constants.%ptr) { @@ -2816,10 +2788,10 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @D.as.J.impl.d69d6f.2(constants.%T) { -// CHECK:STDOUT: %T.patt.loc38_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc38_15.2 => constants.%T -// CHECK:STDOUT: %ptr.loc38_31.2 => constants.%ptr -// CHECK:STDOUT: %N.type.loc38_32.2 => constants.%N.type.d682d6.2 -// CHECK:STDOUT: %.loc38_34 => constants.%.d76 +// CHECK:STDOUT: %T.patt.loc26_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc26_15.2 => constants.%T +// CHECK:STDOUT: %ptr.loc26_31.2 => constants.%ptr +// CHECK:STDOUT: %N.type.loc26_32.2 => constants.%N.type.d682d6.2 +// CHECK:STDOUT: %.loc26_34 => constants.%.d76 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/import_impl_with_no_interface.carbon b/toolchain/check/testdata/impl/import_impl_with_no_interface.carbon index 82982dfddcfb..285f6ae5aae6 100644 --- a/toolchain/check/testdata/impl/import_impl_with_no_interface.carbon +++ b/toolchain/check/testdata/impl/import_impl_with_no_interface.carbon @@ -13,9 +13,7 @@ // --- fail_lib.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_lib.carbon:[[@LINE+4]]:18: error: name `Undeclared` not found [NameNotFound] -// CHECK:STDERR: impl {.i: ()} as Undeclared { -// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: fail_lib.carbon:[[@LINE+2]]:18-27: error: name `Undeclared` not found [NameNotFound] // CHECK:STDERR: impl {.i: ()} as Undeclared { fn F() {} diff --git a/toolchain/check/testdata/impl/import_interface_assoc_const.carbon b/toolchain/check/testdata/impl/import_interface_assoc_const.carbon index ef8058bd14ec..c432ccc202aa 100644 --- a/toolchain/check/testdata/impl/import_interface_assoc_const.carbon +++ b/toolchain/check/testdata/impl/import_interface_assoc_const.carbon @@ -47,9 +47,7 @@ library "[[@TEST_NAME]]"; import library "interface"; class C3 { } -// CHECK:STDERR: fail_redecl_adds_rewrites.carbon:[[@LINE+4]]:1: error: impl declared but not defined [ImplMissingDefinition] -// CHECK:STDERR: impl C3 as I; -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_redecl_adds_rewrites.carbon:[[@LINE+2]]:1-13: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl C3 as I; impl C3 as I where .T = {} { } @@ -59,9 +57,7 @@ library "[[@TEST_NAME]]"; import library "interface"; class C4 { } -// CHECK:STDERR: fail_mismatch.carbon:[[@LINE+4]]:1: error: impl declared but not defined [ImplMissingDefinition] -// CHECK:STDERR: impl C4 as I where .T = {}; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_mismatch.carbon:[[@LINE+2]]:1-27: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl C4 as I where .T = {}; impl C4 as I where .T = () { } @@ -75,23 +71,15 @@ class C5 { } // This is testing that it won't complain about mismatching values if they // have errors. -// CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+8]]:27: error: name `BAD1` not found [NameNotFound] -// CHECK:STDERR: impl C5 as I3 where .T1 = BAD1 and .T2 = {.a: {}} and .T3 = BAD2; -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+4]]:27-30: error: name `BAD1` not found [NameNotFound] // CHECK:STDERR: -// CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+4]]:61: error: name `BAD2` not found [NameNotFound] -// CHECK:STDERR: impl C5 as I3 where .T1 = BAD1 and .T2 = {.a: {}} and .T3 = BAD2; -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+2]]:61-64: error: name `BAD2` not found [NameNotFound] // CHECK:STDERR: impl C5 as I3 where .T1 = BAD1 and .T2 = {.a: {}} and .T3 = BAD2; -// CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+8]]:46: error: name `BAD3` not found [NameNotFound] -// CHECK:STDERR: impl C5 as I3 where .T1 = {.b: {}} and .T2 = BAD3 and .T3 = BAD4 { } -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+4]]:46-49: error: name `BAD3` not found [NameNotFound] // CHECK:STDERR: -// CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+4]]:61: error: name `BAD4` not found [NameNotFound] -// CHECK:STDERR: impl C5 as I3 where .T1 = {.b: {}} and .T2 = BAD3 and .T3 = BAD4 { } -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+2]]:61-64: error: name `BAD4` not found [NameNotFound] // CHECK:STDERR: impl C5 as I3 where .T1 = {.b: {}} and .T2 = BAD3 and .T3 = BAD4 { } @@ -101,17 +89,11 @@ import library "interface"; class C6 { } impl C6 as I where .T = {}; -// CHECK:STDERR: fail_missing_on_definition.carbon:[[@LINE+12]]:1: error: associated constant T not given a value in impl of interface I [ImplAssociatedConstantNeedsValue] -// CHECK:STDERR: impl C6 as I { } -// CHECK:STDERR: ^~~~~~~~~~~~~~ -// CHECK:STDERR: fail_missing_on_definition.carbon:[[@LINE-7]]:1: in import [InImport] -// CHECK:STDERR: interface.carbon:3:19: note: associated constant declared here [AssociatedConstantHere] -// CHECK:STDERR: interface I { let T: type; } -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_missing_on_definition.carbon:[[@LINE+6]]:1-14: error: associated constant T not given a value in impl of interface I [ImplAssociatedConstantNeedsValue] +// CHECK:STDERR: imported from: fail_missing_on_definition.carbon:[[@LINE-5]]:1 [InImport] +// CHECK:STDERR: interface.carbon:3:19-25: note: associated constant declared here [AssociatedConstantHere] // CHECK:STDERR: -// CHECK:STDERR: fail_missing_on_definition.carbon:[[@LINE-9]]:1: error: impl declared but not defined [ImplMissingDefinition] -// CHECK:STDERR: impl C6 as I where .T = {}; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_missing_on_definition.carbon:[[@LINE-5]]:1-27: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl C6 as I { } @@ -121,9 +103,7 @@ import library "interface"; class C7 { } -// CHECK:STDERR: fail_two_different.carbon:[[@LINE+4]]:12: error: associated constant `.(I.T)` given two different values `{}` and `()` [AssociatedConstantWithDifferentValues] -// CHECK:STDERR: impl C7 as I where .T = {} and .T = () { } -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_two_different.carbon:[[@LINE+2]]:12-38: error: associated constant `.(I.T)` given two different values `{}` and `()` [AssociatedConstantWithDifferentValues] // CHECK:STDERR: impl C7 as I where .T = {} and .T = () { } @@ -133,9 +113,7 @@ import library "interface"; class C8 { } -// CHECK:STDERR: fail_two_different_first_bad.carbon:[[@LINE+4]]:25: error: name `BAD5` not found [NameNotFound] -// CHECK:STDERR: impl C8 as I where .T = BAD5 and .T = () { } -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_two_different_first_bad.carbon:[[@LINE+2]]:25-28: error: name `BAD5` not found [NameNotFound] // CHECK:STDERR: impl C8 as I where .T = BAD5 and .T = () { } @@ -145,9 +123,7 @@ import library "interface"; class C9 { } -// CHECK:STDERR: fail_two_different_second_bad.carbon:[[@LINE+4]]:37: error: name `BAD6` not found [NameNotFound] -// CHECK:STDERR: impl C9 as I where .T = {} and .T = BAD6 { } -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_two_different_second_bad.carbon:[[@LINE+2]]:37-40: error: name `BAD6` not found [NameNotFound] // CHECK:STDERR: impl C9 as I where .T = {} and .T = BAD6 { } @@ -157,13 +133,9 @@ import library "interface"; class CA { } -// CHECK:STDERR: fail_two_different_both_bad.carbon:[[@LINE+8]]:25: error: name `BAD7` not found [NameNotFound] -// CHECK:STDERR: impl CA as I where .T = BAD7 and .T = BAD8 { } -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_two_different_both_bad.carbon:[[@LINE+4]]:25-28: error: name `BAD7` not found [NameNotFound] // CHECK:STDERR: -// CHECK:STDERR: fail_two_different_both_bad.carbon:[[@LINE+4]]:39: error: name `BAD8` not found [NameNotFound] -// CHECK:STDERR: impl CA as I where .T = BAD7 and .T = BAD8 { } -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_two_different_both_bad.carbon:[[@LINE+2]]:39-42: error: name `BAD8` not found [NameNotFound] // CHECK:STDERR: impl CA as I where .T = BAD7 and .T = BAD8 { } @@ -194,9 +166,7 @@ import library "interface_with_function"; class CD { } -// CHECK:STDERR: fail_where_rewrite_function.carbon:[[@LINE+4]]:12: error: rewrite specified for associated function F [RewriteForAssociatedFunction] -// CHECK:STDERR: impl CD as IF where .F = 0 { -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_where_rewrite_function.carbon:[[@LINE+2]]:12-26: error: rewrite specified for associated function F [RewriteForAssociatedFunction] // CHECK:STDERR: impl CD as IF where .F = 0 { fn F() {} @@ -584,7 +554,7 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %C3.ref: type = name_ref C3, file.%C3.decl [concrete = constants.%C3] // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc9: = impl_self_witness @C3.as.I.impl.a518fc.1.%C3.ref, @I [concrete = constants.%.afd] +// CHECK:STDOUT: %.loc7: = impl_self_witness @C3.as.I.impl.a518fc.1.%C3.ref, @I [concrete = constants.%.afd] // CHECK:STDOUT: impl_decl @C3.as.I.impl.a518fc.2 [concrete] {} { // CHECK:STDOUT: %C3.ref: type = name_ref C3, file.%C3.decl [concrete = constants.%C3] // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] @@ -592,20 +562,20 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc10_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc8_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %T.ref: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc10_20.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] -// CHECK:STDOUT: %.loc10_26.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc10_26.2: type = converted %.loc10_26.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %rewrite.loc10_23.1 = requirement_rewrite %impl.elem0.loc10_20.1, %.loc10_26.2 [concrete] -// CHECK:STDOUT: %impl.elem0.loc10_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] -// CHECK:STDOUT: %rewrite.loc10_23.2 = requirement_rewrite %impl.elem0.loc10_20.2, %.loc10_26.2 [concrete] -// CHECK:STDOUT: %.loc10_14: type = where_expr [concrete = constants.%I_where.type.c16] { +// CHECK:STDOUT: %impl.elem0.loc8_20.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] +// CHECK:STDOUT: %.loc8_26.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc8_26.2: type = converted %.loc8_26.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %rewrite.loc8_23.1 = requirement_rewrite %impl.elem0.loc8_20.1, %.loc8_26.2 [concrete] +// CHECK:STDOUT: %impl.elem0.loc8_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] +// CHECK:STDOUT: %rewrite.loc8_23.2 = requirement_rewrite %impl.elem0.loc8_20.2, %.loc8_26.2 [concrete] +// CHECK:STDOUT: %.loc8_14: type = where_expr [concrete = constants.%I_where.type.c16] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %rewrite.loc10_23.2 = requirement_rewrite %impl.elem0.loc10_20.2, %.loc10_26.2 [concrete] +// CHECK:STDOUT: %rewrite.loc8_23.2 = requirement_rewrite %impl.elem0.loc8_20.2, %.loc8_26.2 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10: = impl_self_witness @C3.as.I.impl.a518fc.2.%C3.ref, @I [concrete = constants.%.afd] +// CHECK:STDOUT: %.loc8: = impl_self_witness @C3.as.I.impl.a518fc.2.%C3.ref, @I [concrete = constants.%.afd] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I [from "interface.carbon"] { @@ -704,20 +674,20 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc9_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc7_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %T.ref: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc9_20.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] -// CHECK:STDOUT: %.loc9_26.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc9_26.2: type = converted %.loc9_26.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %rewrite.loc9_23.1 = requirement_rewrite %impl.elem0.loc9_20.1, %.loc9_26.2 [concrete] -// CHECK:STDOUT: %impl.elem0.loc9_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] -// CHECK:STDOUT: %rewrite.loc9_23.2 = requirement_rewrite %impl.elem0.loc9_20.2, %.loc9_26.2 [concrete] -// CHECK:STDOUT: %.loc9_14: type = where_expr [concrete = constants.%I_where.type.c16] { +// CHECK:STDOUT: %impl.elem0.loc7_20.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] +// CHECK:STDOUT: %.loc7_26.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc7_26.2: type = converted %.loc7_26.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %rewrite.loc7_23.1 = requirement_rewrite %impl.elem0.loc7_20.1, %.loc7_26.2 [concrete] +// CHECK:STDOUT: %impl.elem0.loc7_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] +// CHECK:STDOUT: %rewrite.loc7_23.2 = requirement_rewrite %impl.elem0.loc7_20.2, %.loc7_26.2 [concrete] +// CHECK:STDOUT: %.loc7_14: type = where_expr [concrete = constants.%I_where.type.c16] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %rewrite.loc9_23.2 = requirement_rewrite %impl.elem0.loc9_20.2, %.loc9_26.2 [concrete] +// CHECK:STDOUT: %rewrite.loc7_23.2 = requirement_rewrite %impl.elem0.loc7_20.2, %.loc7_26.2 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc9: = impl_self_witness @C4.as.I.impl.c5f663.1.%C4.ref, @I [concrete = constants.%.911] +// CHECK:STDOUT: %.loc7: = impl_self_witness @C4.as.I.impl.c5f663.1.%C4.ref, @I [concrete = constants.%.911] // CHECK:STDOUT: impl_decl @C4.as.I.impl.c5f663.2 [concrete] {} { // CHECK:STDOUT: %C4.ref: type = name_ref C4, file.%C4.decl [concrete = constants.%C4] // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] @@ -725,20 +695,20 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc10_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc8_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %T.ref: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc10_20.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] -// CHECK:STDOUT: %.loc10_26.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc10_26.2: type = converted %.loc10_26.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %rewrite.loc10_23.1 = requirement_rewrite %impl.elem0.loc10_20.1, %.loc10_26.2 [concrete] -// CHECK:STDOUT: %impl.elem0.loc10_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] -// CHECK:STDOUT: %rewrite.loc10_23.2 = requirement_rewrite %impl.elem0.loc10_20.2, %.loc10_26.2 [concrete] -// CHECK:STDOUT: %.loc10_14: type = where_expr [concrete = constants.%I_where.type.d99] { +// CHECK:STDOUT: %impl.elem0.loc8_20.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] +// CHECK:STDOUT: %.loc8_26.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_26.2: type = converted %.loc8_26.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %rewrite.loc8_23.1 = requirement_rewrite %impl.elem0.loc8_20.1, %.loc8_26.2 [concrete] +// CHECK:STDOUT: %impl.elem0.loc8_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] +// CHECK:STDOUT: %rewrite.loc8_23.2 = requirement_rewrite %impl.elem0.loc8_20.2, %.loc8_26.2 [concrete] +// CHECK:STDOUT: %.loc8_14: type = where_expr [concrete = constants.%I_where.type.d99] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %rewrite.loc10_23.2 = requirement_rewrite %impl.elem0.loc10_20.2, %.loc10_26.2 [concrete] +// CHECK:STDOUT: %rewrite.loc8_23.2 = requirement_rewrite %impl.elem0.loc8_20.2, %.loc8_26.2 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10: = impl_self_witness @C4.as.I.impl.c5f663.2.%C4.ref, @I [concrete = constants.%.911] +// CHECK:STDOUT: %.loc8: = impl_self_witness @C4.as.I.impl.c5f663.2.%C4.ref, @I [concrete = constants.%.911] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I [from "interface.carbon"] { @@ -848,40 +818,40 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %I3.ref: type = name_ref I3, imports.%Main.I3 [concrete = constants.%I3.type] // CHECK:STDOUT: %.Self.frozen: %I3.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I3.ref [concrete] -// CHECK:STDOUT: %.Self.ref.loc17_21: %I3.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc17_21: type = facet_access_type %.Self.ref.loc17_21 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc17_21: type = converted %.Self.ref.loc17_21, %.Self.as_type.loc17_21 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.Self.ref.loc13_21: %I3.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc13_21: type = facet_access_type %.Self.ref.loc13_21 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc13_21: type = converted %.Self.ref.loc13_21, %.Self.as_type.loc13_21 [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %T1.ref: %I3.assoc_type = name_ref T1, imports.%Main.import_ref.e53 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc17_21.1: type = impl_witness_access constants.%.408, element0 [symbolic_self = constants.%impl.elem0.80b] +// CHECK:STDOUT: %impl.elem0.loc13_21.1: type = impl_witness_access constants.%.408, element0 [symbolic_self = constants.%impl.elem0.80b] // CHECK:STDOUT: %BAD1.ref: = name_ref BAD1, [concrete = ] -// CHECK:STDOUT: %rewrite.loc17_25.1 = requirement_rewrite %impl.elem0.loc17_21.1, [concrete] -// CHECK:STDOUT: %.Self.ref.loc17_36: %I3.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc17_36: type = facet_access_type %.Self.ref.loc17_36 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc17_36: type = converted %.Self.ref.loc17_36, %.Self.as_type.loc17_36 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %rewrite.loc13_25.1 = requirement_rewrite %impl.elem0.loc13_21.1, [concrete] +// CHECK:STDOUT: %.Self.ref.loc13_36: %I3.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc13_36: type = facet_access_type %.Self.ref.loc13_36 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc13_36: type = converted %.Self.ref.loc13_36, %.Self.as_type.loc13_36 [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %T2.ref: %I3.assoc_type = name_ref T2, imports.%Main.import_ref.7af [concrete = constants.%assoc1] -// CHECK:STDOUT: %impl.elem1.loc17_36.1: type = impl_witness_access constants.%.408, element1 [symbolic_self = constants.%impl.elem1.74f] -// CHECK:STDOUT: %.loc17_48.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc17_48.2: type = converted %.loc17_48.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %impl.elem1.loc13_36.1: type = impl_witness_access constants.%.408, element1 [symbolic_self = constants.%impl.elem1.74f] +// CHECK:STDOUT: %.loc13_48.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc13_48.2: type = converted %.loc13_48.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %empty_struct_type} [concrete = constants.%struct_type.a] -// CHECK:STDOUT: %rewrite.loc17_40.1 = requirement_rewrite %impl.elem1.loc17_36.1, %struct_type.a [concrete] -// CHECK:STDOUT: %.Self.ref.loc17_55: %I3.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc17_55: type = facet_access_type %.Self.ref.loc17_55 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc17_55: type = converted %.Self.ref.loc17_55, %.Self.as_type.loc17_55 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %rewrite.loc13_40.1 = requirement_rewrite %impl.elem1.loc13_36.1, %struct_type.a [concrete] +// CHECK:STDOUT: %.Self.ref.loc13_55: %I3.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc13_55: type = facet_access_type %.Self.ref.loc13_55 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc13_55: type = converted %.Self.ref.loc13_55, %.Self.as_type.loc13_55 [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %T3.ref: %I3.assoc_type = name_ref T3, imports.%Main.import_ref.c31 [concrete = constants.%assoc2] -// CHECK:STDOUT: %impl.elem2.loc17_55.1: type = impl_witness_access constants.%.408, element2 [symbolic_self = constants.%impl.elem2.926] +// CHECK:STDOUT: %impl.elem2.loc13_55.1: type = impl_witness_access constants.%.408, element2 [symbolic_self = constants.%impl.elem2.926] // CHECK:STDOUT: %BAD2.ref: = name_ref BAD2, [concrete = ] -// CHECK:STDOUT: %rewrite.loc17_59.1 = requirement_rewrite %impl.elem2.loc17_55.1, [concrete] -// CHECK:STDOUT: %impl.elem0.loc17_21.2: type = impl_witness_access constants.%.dbd, element0 [symbolic_self = constants.%impl.elem0.91b] -// CHECK:STDOUT: %rewrite.loc17_25.2 = requirement_rewrite %impl.elem0.loc17_21.2, [concrete] -// CHECK:STDOUT: %impl.elem1.loc17_36.2: type = impl_witness_access constants.%.dbd, element1 [symbolic_self = constants.%impl.elem1.4e8] -// CHECK:STDOUT: %rewrite.loc17_40.2 = requirement_rewrite %impl.elem1.loc17_36.2, %struct_type.a [concrete] -// CHECK:STDOUT: %impl.elem2.loc17_55.2: type = impl_witness_access constants.%.dbd, element2 [symbolic_self = constants.%impl.elem2.5f8] -// CHECK:STDOUT: %rewrite.loc17_59.2 = requirement_rewrite %impl.elem2.loc17_55.2, [concrete] -// CHECK:STDOUT: %.loc17_15: type = where_expr [concrete = ] { +// CHECK:STDOUT: %rewrite.loc13_59.1 = requirement_rewrite %impl.elem2.loc13_55.1, [concrete] +// CHECK:STDOUT: %impl.elem0.loc13_21.2: type = impl_witness_access constants.%.dbd, element0 [symbolic_self = constants.%impl.elem0.91b] +// CHECK:STDOUT: %rewrite.loc13_25.2 = requirement_rewrite %impl.elem0.loc13_21.2, [concrete] +// CHECK:STDOUT: %impl.elem1.loc13_36.2: type = impl_witness_access constants.%.dbd, element1 [symbolic_self = constants.%impl.elem1.4e8] +// CHECK:STDOUT: %rewrite.loc13_40.2 = requirement_rewrite %impl.elem1.loc13_36.2, %struct_type.a [concrete] +// CHECK:STDOUT: %impl.elem2.loc13_55.2: type = impl_witness_access constants.%.dbd, element2 [symbolic_self = constants.%impl.elem2.5f8] +// CHECK:STDOUT: %rewrite.loc13_59.2 = requirement_rewrite %impl.elem2.loc13_55.2, [concrete] +// CHECK:STDOUT: %.loc13_15: type = where_expr [concrete = ] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I3.ref [concrete] -// CHECK:STDOUT: %rewrite.loc17_25.2 = requirement_rewrite %impl.elem0.loc17_21.2, [concrete] -// CHECK:STDOUT: %rewrite.loc17_40.2 = requirement_rewrite %impl.elem1.loc17_36.2, %struct_type.a [concrete] -// CHECK:STDOUT: %rewrite.loc17_59.2 = requirement_rewrite %impl.elem2.loc17_55.2, [concrete] +// CHECK:STDOUT: %rewrite.loc13_25.2 = requirement_rewrite %impl.elem0.loc13_21.2, [concrete] +// CHECK:STDOUT: %rewrite.loc13_40.2 = requirement_rewrite %impl.elem1.loc13_36.2, %struct_type.a [concrete] +// CHECK:STDOUT: %rewrite.loc13_59.2 = requirement_rewrite %impl.elem2.loc13_55.2, [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @C5.as..impl.f79ae5.2 [concrete] {} { @@ -889,40 +859,40 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %I3.ref: type = name_ref I3, imports.%Main.I3 [concrete = constants.%I3.type] // CHECK:STDOUT: %.Self.frozen: %I3.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I3.ref [concrete] -// CHECK:STDOUT: %.Self.ref.loc27_21: %I3.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc27_21: type = facet_access_type %.Self.ref.loc27_21 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc27_21: type = converted %.Self.ref.loc27_21, %.Self.as_type.loc27_21 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.Self.ref.loc19_21: %I3.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc19_21: type = facet_access_type %.Self.ref.loc19_21 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc19_21: type = converted %.Self.ref.loc19_21, %.Self.as_type.loc19_21 [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %T1.ref: %I3.assoc_type = name_ref T1, imports.%Main.import_ref.e53 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc27_21.1: type = impl_witness_access constants.%.408, element0 [symbolic_self = constants.%impl.elem0.80b] -// CHECK:STDOUT: %.loc27_33.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc27_33.2: type = converted %.loc27_33.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %impl.elem0.loc19_21.1: type = impl_witness_access constants.%.408, element0 [symbolic_self = constants.%impl.elem0.80b] +// CHECK:STDOUT: %.loc19_33.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc19_33.2: type = converted %.loc19_33.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %struct_type.b: type = struct_type {.b: %empty_struct_type} [concrete = constants.%struct_type.b] -// CHECK:STDOUT: %rewrite.loc27_25.1 = requirement_rewrite %impl.elem0.loc27_21.1, %struct_type.b [concrete] -// CHECK:STDOUT: %.Self.ref.loc27_40: %I3.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc27_40: type = facet_access_type %.Self.ref.loc27_40 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc27_40: type = converted %.Self.ref.loc27_40, %.Self.as_type.loc27_40 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %rewrite.loc19_25.1 = requirement_rewrite %impl.elem0.loc19_21.1, %struct_type.b [concrete] +// CHECK:STDOUT: %.Self.ref.loc19_40: %I3.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc19_40: type = facet_access_type %.Self.ref.loc19_40 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc19_40: type = converted %.Self.ref.loc19_40, %.Self.as_type.loc19_40 [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %T2.ref: %I3.assoc_type = name_ref T2, imports.%Main.import_ref.7af [concrete = constants.%assoc1] -// CHECK:STDOUT: %impl.elem1.loc27_40.1: type = impl_witness_access constants.%.408, element1 [symbolic_self = constants.%impl.elem1.74f] +// CHECK:STDOUT: %impl.elem1.loc19_40.1: type = impl_witness_access constants.%.408, element1 [symbolic_self = constants.%impl.elem1.74f] // CHECK:STDOUT: %BAD3.ref: = name_ref BAD3, [concrete = ] -// CHECK:STDOUT: %rewrite.loc27_44.1 = requirement_rewrite %impl.elem1.loc27_40.1, [concrete] -// CHECK:STDOUT: %.Self.ref.loc27_55: %I3.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc27_55: type = facet_access_type %.Self.ref.loc27_55 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc27_55: type = converted %.Self.ref.loc27_55, %.Self.as_type.loc27_55 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %rewrite.loc19_44.1 = requirement_rewrite %impl.elem1.loc19_40.1, [concrete] +// CHECK:STDOUT: %.Self.ref.loc19_55: %I3.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc19_55: type = facet_access_type %.Self.ref.loc19_55 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc19_55: type = converted %.Self.ref.loc19_55, %.Self.as_type.loc19_55 [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %T3.ref: %I3.assoc_type = name_ref T3, imports.%Main.import_ref.c31 [concrete = constants.%assoc2] -// CHECK:STDOUT: %impl.elem2.loc27_55.1: type = impl_witness_access constants.%.408, element2 [symbolic_self = constants.%impl.elem2.926] +// CHECK:STDOUT: %impl.elem2.loc19_55.1: type = impl_witness_access constants.%.408, element2 [symbolic_self = constants.%impl.elem2.926] // CHECK:STDOUT: %BAD4.ref: = name_ref BAD4, [concrete = ] -// CHECK:STDOUT: %rewrite.loc27_59.1 = requirement_rewrite %impl.elem2.loc27_55.1, [concrete] -// CHECK:STDOUT: %impl.elem0.loc27_21.2: type = impl_witness_access constants.%.dbd, element0 [symbolic_self = constants.%impl.elem0.91b] -// CHECK:STDOUT: %rewrite.loc27_25.2 = requirement_rewrite %impl.elem0.loc27_21.2, %struct_type.b [concrete] -// CHECK:STDOUT: %impl.elem1.loc27_40.2: type = impl_witness_access constants.%.dbd, element1 [symbolic_self = constants.%impl.elem1.4e8] -// CHECK:STDOUT: %rewrite.loc27_44.2 = requirement_rewrite %impl.elem1.loc27_40.2, [concrete] -// CHECK:STDOUT: %impl.elem2.loc27_55.2: type = impl_witness_access constants.%.dbd, element2 [symbolic_self = constants.%impl.elem2.5f8] -// CHECK:STDOUT: %rewrite.loc27_59.2 = requirement_rewrite %impl.elem2.loc27_55.2, [concrete] -// CHECK:STDOUT: %.loc27_15: type = where_expr [concrete = ] { +// CHECK:STDOUT: %rewrite.loc19_59.1 = requirement_rewrite %impl.elem2.loc19_55.1, [concrete] +// CHECK:STDOUT: %impl.elem0.loc19_21.2: type = impl_witness_access constants.%.dbd, element0 [symbolic_self = constants.%impl.elem0.91b] +// CHECK:STDOUT: %rewrite.loc19_25.2 = requirement_rewrite %impl.elem0.loc19_21.2, %struct_type.b [concrete] +// CHECK:STDOUT: %impl.elem1.loc19_40.2: type = impl_witness_access constants.%.dbd, element1 [symbolic_self = constants.%impl.elem1.4e8] +// CHECK:STDOUT: %rewrite.loc19_44.2 = requirement_rewrite %impl.elem1.loc19_40.2, [concrete] +// CHECK:STDOUT: %impl.elem2.loc19_55.2: type = impl_witness_access constants.%.dbd, element2 [symbolic_self = constants.%impl.elem2.5f8] +// CHECK:STDOUT: %rewrite.loc19_59.2 = requirement_rewrite %impl.elem2.loc19_55.2, [concrete] +// CHECK:STDOUT: %.loc19_15: type = where_expr [concrete = ] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I3.ref [concrete] -// CHECK:STDOUT: %rewrite.loc27_25.2 = requirement_rewrite %impl.elem0.loc27_21.2, %struct_type.b [concrete] -// CHECK:STDOUT: %rewrite.loc27_44.2 = requirement_rewrite %impl.elem1.loc27_40.2, [concrete] -// CHECK:STDOUT: %rewrite.loc27_59.2 = requirement_rewrite %impl.elem2.loc27_55.2, [concrete] +// CHECK:STDOUT: %rewrite.loc19_25.2 = requirement_rewrite %impl.elem0.loc19_21.2, %struct_type.b [concrete] +// CHECK:STDOUT: %rewrite.loc19_44.2 = requirement_rewrite %impl.elem1.loc19_40.2, [concrete] +// CHECK:STDOUT: %rewrite.loc19_59.2 = requirement_rewrite %impl.elem2.loc19_55.2, [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -1032,7 +1002,7 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %C6.ref: type = name_ref C6, file.%C6.decl [concrete = constants.%C6] // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc18: = impl_self_witness @C6.as.I.impl.e1b87a.2.%C6.ref, @I [concrete = constants.%.7ff] +// CHECK:STDOUT: %.loc12: = impl_self_witness @C6.as.I.impl.e1b87a.2.%C6.ref, @I [concrete = constants.%.7ff] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I [from "interface.carbon"] { @@ -1123,32 +1093,32 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] // CHECK:STDOUT: %.Self.frozen: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %.Self.ref.loc10_20: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc10_20: type = facet_access_type %.Self.ref.loc10_20 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc10_20: type = converted %.Self.ref.loc10_20, %.Self.as_type.loc10_20 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %T.ref.loc10_20: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc10_20.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] -// CHECK:STDOUT: %.loc10_26.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc10_26.2: type = converted %.loc10_26.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %rewrite.loc10_23.1 = requirement_rewrite %impl.elem0.loc10_20.1, %.loc10_26.2 [concrete] -// CHECK:STDOUT: %.Self.ref.loc10_32: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc10_32: type = facet_access_type %.Self.ref.loc10_32 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc10_32: type = converted %.Self.ref.loc10_32, %.Self.as_type.loc10_32 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %T.ref.loc10_32: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc10_32.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] -// CHECK:STDOUT: %impl.elem0.subst.loc10_32.1: type = impl_witness_access_substituted %impl.elem0.loc10_32.1, %.loc10_26.2 [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %.loc10_38.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc10_38.2: type = converted %.loc10_38.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %rewrite.loc10_35.1 = requirement_rewrite %impl.elem0.subst.loc10_32.1, %.loc10_38.2 [concrete] -// CHECK:STDOUT: %impl.elem0.loc10_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] -// CHECK:STDOUT: %rewrite.loc10_23.2 = requirement_rewrite %impl.elem0.loc10_20.2, %.loc10_26.2 [concrete] -// CHECK:STDOUT: %impl.elem0.loc10_32.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] -// CHECK:STDOUT: %impl.elem0.subst.loc10_32.2: type = impl_witness_access_substituted %impl.elem0.loc10_32.2, %.loc10_26.2 [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %rewrite.loc10_35.2 = requirement_rewrite %impl.elem0.subst.loc10_32.2, %.loc10_38.2 [concrete] -// CHECK:STDOUT: %.loc10_14: type = where_expr [concrete = ] { +// CHECK:STDOUT: %.Self.ref.loc8_20: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc8_20: type = facet_access_type %.Self.ref.loc8_20 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc8_20: type = converted %.Self.ref.loc8_20, %.Self.as_type.loc8_20 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %T.ref.loc8_20: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc8_20.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] +// CHECK:STDOUT: %.loc8_26.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc8_26.2: type = converted %.loc8_26.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %rewrite.loc8_23.1 = requirement_rewrite %impl.elem0.loc8_20.1, %.loc8_26.2 [concrete] +// CHECK:STDOUT: %.Self.ref.loc8_32: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc8_32: type = facet_access_type %.Self.ref.loc8_32 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc8_32: type = converted %.Self.ref.loc8_32, %.Self.as_type.loc8_32 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %T.ref.loc8_32: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc8_32.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] +// CHECK:STDOUT: %impl.elem0.subst.loc8_32.1: type = impl_witness_access_substituted %impl.elem0.loc8_32.1, %.loc8_26.2 [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc8_38.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_38.2: type = converted %.loc8_38.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %rewrite.loc8_35.1 = requirement_rewrite %impl.elem0.subst.loc8_32.1, %.loc8_38.2 [concrete] +// CHECK:STDOUT: %impl.elem0.loc8_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] +// CHECK:STDOUT: %rewrite.loc8_23.2 = requirement_rewrite %impl.elem0.loc8_20.2, %.loc8_26.2 [concrete] +// CHECK:STDOUT: %impl.elem0.loc8_32.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] +// CHECK:STDOUT: %impl.elem0.subst.loc8_32.2: type = impl_witness_access_substituted %impl.elem0.loc8_32.2, %.loc8_26.2 [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %rewrite.loc8_35.2 = requirement_rewrite %impl.elem0.subst.loc8_32.2, %.loc8_38.2 [concrete] +// CHECK:STDOUT: %.loc8_14: type = where_expr [concrete = ] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %rewrite.loc10_23.2 = requirement_rewrite %impl.elem0.loc10_20.2, %.loc10_26.2 [concrete] -// CHECK:STDOUT: %rewrite.loc10_35.2 = requirement_rewrite %impl.elem0.subst.loc10_32.2, %.loc10_38.2 [concrete] +// CHECK:STDOUT: %rewrite.loc8_23.2 = requirement_rewrite %impl.elem0.loc8_20.2, %.loc8_26.2 [concrete] +// CHECK:STDOUT: %rewrite.loc8_35.2 = requirement_rewrite %impl.elem0.subst.loc8_32.2, %.loc8_38.2 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -1232,31 +1202,31 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] // CHECK:STDOUT: %.Self.frozen: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %.Self.ref.loc10_20: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc10_20: type = facet_access_type %.Self.ref.loc10_20 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc10_20: type = converted %.Self.ref.loc10_20, %.Self.as_type.loc10_20 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %T.ref.loc10_20: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc10_20.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] +// CHECK:STDOUT: %.Self.ref.loc8_20: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc8_20: type = facet_access_type %.Self.ref.loc8_20 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc8_20: type = converted %.Self.ref.loc8_20, %.Self.as_type.loc8_20 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %T.ref.loc8_20: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc8_20.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] // CHECK:STDOUT: %BAD5.ref: = name_ref BAD5, [concrete = ] -// CHECK:STDOUT: %rewrite.loc10_23.1 = requirement_rewrite %impl.elem0.loc10_20.1, [concrete] -// CHECK:STDOUT: %.Self.ref.loc10_34: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc10_34: type = facet_access_type %.Self.ref.loc10_34 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc10_34: type = converted %.Self.ref.loc10_34, %.Self.as_type.loc10_34 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %T.ref.loc10_34: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc10_34.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] -// CHECK:STDOUT: %impl.elem0.subst.loc10_34.1: type = impl_witness_access_substituted %impl.elem0.loc10_34.1, [concrete = ] -// CHECK:STDOUT: %.loc10_40.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc10_40.2: type = converted %.loc10_40.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %rewrite.loc10_37.1 = requirement_rewrite %impl.elem0.subst.loc10_34.1, %.loc10_40.2 [concrete] -// CHECK:STDOUT: %impl.elem0.loc10_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] -// CHECK:STDOUT: %rewrite.loc10_23.2 = requirement_rewrite %impl.elem0.loc10_20.2, [concrete] -// CHECK:STDOUT: %impl.elem0.loc10_34.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] -// CHECK:STDOUT: %impl.elem0.subst.loc10_34.2: type = impl_witness_access_substituted %impl.elem0.loc10_34.2, [concrete = ] -// CHECK:STDOUT: %rewrite.loc10_37.2 = requirement_rewrite %impl.elem0.subst.loc10_34.2, %.loc10_40.2 [concrete] -// CHECK:STDOUT: %.loc10_14: type = where_expr [concrete = ] { +// CHECK:STDOUT: %rewrite.loc8_23.1 = requirement_rewrite %impl.elem0.loc8_20.1, [concrete] +// CHECK:STDOUT: %.Self.ref.loc8_34: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc8_34: type = facet_access_type %.Self.ref.loc8_34 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc8_34: type = converted %.Self.ref.loc8_34, %.Self.as_type.loc8_34 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %T.ref.loc8_34: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc8_34.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] +// CHECK:STDOUT: %impl.elem0.subst.loc8_34.1: type = impl_witness_access_substituted %impl.elem0.loc8_34.1, [concrete = ] +// CHECK:STDOUT: %.loc8_40.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_40.2: type = converted %.loc8_40.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %rewrite.loc8_37.1 = requirement_rewrite %impl.elem0.subst.loc8_34.1, %.loc8_40.2 [concrete] +// CHECK:STDOUT: %impl.elem0.loc8_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] +// CHECK:STDOUT: %rewrite.loc8_23.2 = requirement_rewrite %impl.elem0.loc8_20.2, [concrete] +// CHECK:STDOUT: %impl.elem0.loc8_34.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] +// CHECK:STDOUT: %impl.elem0.subst.loc8_34.2: type = impl_witness_access_substituted %impl.elem0.loc8_34.2, [concrete = ] +// CHECK:STDOUT: %rewrite.loc8_37.2 = requirement_rewrite %impl.elem0.subst.loc8_34.2, %.loc8_40.2 [concrete] +// CHECK:STDOUT: %.loc8_14: type = where_expr [concrete = ] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %rewrite.loc10_23.2 = requirement_rewrite %impl.elem0.loc10_20.2, [concrete] -// CHECK:STDOUT: %rewrite.loc10_37.2 = requirement_rewrite %impl.elem0.subst.loc10_34.2, %.loc10_40.2 [concrete] +// CHECK:STDOUT: %rewrite.loc8_23.2 = requirement_rewrite %impl.elem0.loc8_20.2, [concrete] +// CHECK:STDOUT: %rewrite.loc8_37.2 = requirement_rewrite %impl.elem0.subst.loc8_34.2, %.loc8_40.2 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -1339,31 +1309,31 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] // CHECK:STDOUT: %.Self.frozen: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %.Self.ref.loc10_20: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc10_20: type = facet_access_type %.Self.ref.loc10_20 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc10_20: type = converted %.Self.ref.loc10_20, %.Self.as_type.loc10_20 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %T.ref.loc10_20: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc10_20.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] -// CHECK:STDOUT: %.loc10_26.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc10_26.2: type = converted %.loc10_26.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %rewrite.loc10_23.1 = requirement_rewrite %impl.elem0.loc10_20.1, %.loc10_26.2 [concrete] -// CHECK:STDOUT: %.Self.ref.loc10_32: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc10_32: type = facet_access_type %.Self.ref.loc10_32 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc10_32: type = converted %.Self.ref.loc10_32, %.Self.as_type.loc10_32 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %T.ref.loc10_32: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc10_32.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] -// CHECK:STDOUT: %impl.elem0.subst.loc10_32.1: type = impl_witness_access_substituted %impl.elem0.loc10_32.1, %.loc10_26.2 [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.Self.ref.loc8_20: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc8_20: type = facet_access_type %.Self.ref.loc8_20 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc8_20: type = converted %.Self.ref.loc8_20, %.Self.as_type.loc8_20 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %T.ref.loc8_20: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc8_20.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] +// CHECK:STDOUT: %.loc8_26.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc8_26.2: type = converted %.loc8_26.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %rewrite.loc8_23.1 = requirement_rewrite %impl.elem0.loc8_20.1, %.loc8_26.2 [concrete] +// CHECK:STDOUT: %.Self.ref.loc8_32: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc8_32: type = facet_access_type %.Self.ref.loc8_32 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc8_32: type = converted %.Self.ref.loc8_32, %.Self.as_type.loc8_32 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %T.ref.loc8_32: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc8_32.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] +// CHECK:STDOUT: %impl.elem0.subst.loc8_32.1: type = impl_witness_access_substituted %impl.elem0.loc8_32.1, %.loc8_26.2 [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %BAD6.ref: = name_ref BAD6, [concrete = ] -// CHECK:STDOUT: %rewrite.loc10_35.1 = requirement_rewrite %impl.elem0.subst.loc10_32.1, [concrete] -// CHECK:STDOUT: %impl.elem0.loc10_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] -// CHECK:STDOUT: %rewrite.loc10_23.2 = requirement_rewrite %impl.elem0.loc10_20.2, %.loc10_26.2 [concrete] -// CHECK:STDOUT: %impl.elem0.loc10_32.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] -// CHECK:STDOUT: %impl.elem0.subst.loc10_32.2: type = impl_witness_access_substituted %impl.elem0.loc10_32.2, %.loc10_26.2 [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %rewrite.loc10_35.2 = requirement_rewrite %impl.elem0.subst.loc10_32.2, [concrete] -// CHECK:STDOUT: %.loc10_14: type = where_expr [concrete = ] { +// CHECK:STDOUT: %rewrite.loc8_35.1 = requirement_rewrite %impl.elem0.subst.loc8_32.1, [concrete] +// CHECK:STDOUT: %impl.elem0.loc8_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] +// CHECK:STDOUT: %rewrite.loc8_23.2 = requirement_rewrite %impl.elem0.loc8_20.2, %.loc8_26.2 [concrete] +// CHECK:STDOUT: %impl.elem0.loc8_32.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] +// CHECK:STDOUT: %impl.elem0.subst.loc8_32.2: type = impl_witness_access_substituted %impl.elem0.loc8_32.2, %.loc8_26.2 [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %rewrite.loc8_35.2 = requirement_rewrite %impl.elem0.subst.loc8_32.2, [concrete] +// CHECK:STDOUT: %.loc8_14: type = where_expr [concrete = ] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %rewrite.loc10_23.2 = requirement_rewrite %impl.elem0.loc10_20.2, %.loc10_26.2 [concrete] -// CHECK:STDOUT: %rewrite.loc10_35.2 = requirement_rewrite %impl.elem0.subst.loc10_32.2, [concrete] +// CHECK:STDOUT: %rewrite.loc8_23.2 = requirement_rewrite %impl.elem0.loc8_20.2, %.loc8_26.2 [concrete] +// CHECK:STDOUT: %rewrite.loc8_35.2 = requirement_rewrite %impl.elem0.subst.loc8_32.2, [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -1446,30 +1416,30 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] // CHECK:STDOUT: %.Self.frozen: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %.Self.ref.loc14_20: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc14_20: type = facet_access_type %.Self.ref.loc14_20 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc14_20: type = converted %.Self.ref.loc14_20, %.Self.as_type.loc14_20 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %T.ref.loc14_20: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc14_20.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] +// CHECK:STDOUT: %.Self.ref.loc10_20: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc10_20: type = facet_access_type %.Self.ref.loc10_20 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc10_20: type = converted %.Self.ref.loc10_20, %.Self.as_type.loc10_20 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %T.ref.loc10_20: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc10_20.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] // CHECK:STDOUT: %BAD7.ref: = name_ref BAD7, [concrete = ] -// CHECK:STDOUT: %rewrite.loc14_23.1 = requirement_rewrite %impl.elem0.loc14_20.1, [concrete] -// CHECK:STDOUT: %.Self.ref.loc14_34: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc14_34: type = facet_access_type %.Self.ref.loc14_34 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc14_34: type = converted %.Self.ref.loc14_34, %.Self.as_type.loc14_34 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %T.ref.loc14_34: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc14_34.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] -// CHECK:STDOUT: %impl.elem0.subst.loc14_34.1: type = impl_witness_access_substituted %impl.elem0.loc14_34.1, [concrete = ] +// CHECK:STDOUT: %rewrite.loc10_23.1 = requirement_rewrite %impl.elem0.loc10_20.1, [concrete] +// CHECK:STDOUT: %.Self.ref.loc10_34: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc10_34: type = facet_access_type %.Self.ref.loc10_34 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc10_34: type = converted %.Self.ref.loc10_34, %.Self.as_type.loc10_34 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %T.ref.loc10_34: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc10_34.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] +// CHECK:STDOUT: %impl.elem0.subst.loc10_34.1: type = impl_witness_access_substituted %impl.elem0.loc10_34.1, [concrete = ] // CHECK:STDOUT: %BAD8.ref: = name_ref BAD8, [concrete = ] -// CHECK:STDOUT: %rewrite.loc14_37.1 = requirement_rewrite %impl.elem0.subst.loc14_34.1, [concrete] -// CHECK:STDOUT: %impl.elem0.loc14_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] -// CHECK:STDOUT: %rewrite.loc14_23.2 = requirement_rewrite %impl.elem0.loc14_20.2, [concrete] -// CHECK:STDOUT: %impl.elem0.loc14_34.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] -// CHECK:STDOUT: %impl.elem0.subst.loc14_34.2: type = impl_witness_access_substituted %impl.elem0.loc14_34.2, [concrete = ] -// CHECK:STDOUT: %rewrite.loc14_37.2 = requirement_rewrite %impl.elem0.subst.loc14_34.2, [concrete] -// CHECK:STDOUT: %.loc14_14: type = where_expr [concrete = ] { +// CHECK:STDOUT: %rewrite.loc10_37.1 = requirement_rewrite %impl.elem0.subst.loc10_34.1, [concrete] +// CHECK:STDOUT: %impl.elem0.loc10_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] +// CHECK:STDOUT: %rewrite.loc10_23.2 = requirement_rewrite %impl.elem0.loc10_20.2, [concrete] +// CHECK:STDOUT: %impl.elem0.loc10_34.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] +// CHECK:STDOUT: %impl.elem0.subst.loc10_34.2: type = impl_witness_access_substituted %impl.elem0.loc10_34.2, [concrete = ] +// CHECK:STDOUT: %rewrite.loc10_37.2 = requirement_rewrite %impl.elem0.subst.loc10_34.2, [concrete] +// CHECK:STDOUT: %.loc10_14: type = where_expr [concrete = ] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %rewrite.loc14_23.2 = requirement_rewrite %impl.elem0.loc14_20.2, [concrete] -// CHECK:STDOUT: %rewrite.loc14_37.2 = requirement_rewrite %impl.elem0.subst.loc14_34.2, [concrete] +// CHECK:STDOUT: %rewrite.loc10_23.2 = requirement_rewrite %impl.elem0.loc10_20.2, [concrete] +// CHECK:STDOUT: %rewrite.loc10_37.2 = requirement_rewrite %impl.elem0.subst.loc10_34.2, [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -1840,19 +1810,19 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %IF.ref [concrete] // CHECK:STDOUT: %.Self.ref: %IF.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc10_21: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc8_21: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %F.ref: %IF.assoc_type = name_ref F, imports.%Main.import_ref.ad5 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc10_21.1: %.d0c = impl_witness_access constants.%.3bb, element0 [symbolic_self = constants.%impl.elem0.fb7] +// CHECK:STDOUT: %impl.elem0.loc8_21.1: %.d0c = impl_witness_access constants.%.3bb, element0 [symbolic_self = constants.%impl.elem0.fb7] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] -// CHECK:STDOUT: %rewrite.loc10_24.1 = requirement_rewrite %impl.elem0.loc10_21.1, %int_0 [concrete] -// CHECK:STDOUT: %impl.elem0.loc10_21.2: %.e24 = impl_witness_access constants.%.1c7, element0 [symbolic_self = constants.%impl.elem0.b9d] -// CHECK:STDOUT: %rewrite.loc10_24.2 = requirement_rewrite %impl.elem0.loc10_21.2, %int_0 [concrete] -// CHECK:STDOUT: %.loc10_15: type = where_expr [concrete = constants.%IF_where.type.dd6] { +// CHECK:STDOUT: %rewrite.loc8_24.1 = requirement_rewrite %impl.elem0.loc8_21.1, %int_0 [concrete] +// CHECK:STDOUT: %impl.elem0.loc8_21.2: %.e24 = impl_witness_access constants.%.1c7, element0 [symbolic_self = constants.%impl.elem0.b9d] +// CHECK:STDOUT: %rewrite.loc8_24.2 = requirement_rewrite %impl.elem0.loc8_21.2, %int_0 [concrete] +// CHECK:STDOUT: %.loc8_15: type = where_expr [concrete = constants.%IF_where.type.dd6] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %IF.ref [concrete] -// CHECK:STDOUT: %rewrite.loc10_24.2 = requirement_rewrite %impl.elem0.loc10_21.2, %int_0 [concrete] +// CHECK:STDOUT: %rewrite.loc8_24.2 = requirement_rewrite %impl.elem0.loc8_21.2, %int_0 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10: = impl_self_witness @CD.as.IF.impl.%CD.ref, @IF [concrete = constants.%.1f4] +// CHECK:STDOUT: %.loc8: = impl_self_witness @CD.as.IF.impl.%CD.ref, @IF [concrete = constants.%.1f4] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @IF [from "interface_with_function.carbon"] { diff --git a/toolchain/check/testdata/impl/import_use_generic.carbon b/toolchain/check/testdata/impl/import_use_generic.carbon index 66639c0d8e9c..2a51a3abaf61 100644 --- a/toolchain/check/testdata/impl/import_use_generic.carbon +++ b/toolchain/check/testdata/impl/import_use_generic.carbon @@ -34,22 +34,14 @@ import library "import_generic"; var c: C({}) = {}; // We're just checking that this doesn't crash. It's not expected to compile. -// CHECK:STDERR: fail_use_in_fn_decl.carbon:[[@LINE+8]]:11: error: `Core.ImplicitAs` implicitly referenced here, but package `Core` not found [CoreNotFound] -// CHECK:STDERR: fn G() -> c.(I.F)() {} -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_use_in_fn_decl.carbon:[[@LINE+4]]:11-17: error: `Core.ImplicitAs` implicitly referenced here, but package `Core` not found [CoreNotFound] // CHECK:STDERR: -// CHECK:STDERR: fail_use_in_fn_decl.carbon:[[@LINE+4]]:22: error: missing `return` at end of function with declared return type [MissingReturnStatement] -// CHECK:STDERR: fn G() -> c.(I.F)() {} -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_use_in_fn_decl.carbon:[[@LINE+2]]:22: error: missing `return` at end of function with declared return type [MissingReturnStatement] // CHECK:STDERR: fn G() -> c.(I.F)() {} -// CHECK:STDERR: fail_use_in_fn_decl.carbon:[[@LINE+8]]:11: error: `Core.ImplicitAs` implicitly referenced here, but package `Core` not found [CoreNotFound] -// CHECK:STDERR: fn H() -> C({}).(I.F)() {} -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_use_in_fn_decl.carbon:[[@LINE+4]]:11-23: error: `Core.ImplicitAs` implicitly referenced here, but package `Core` not found [CoreNotFound] // CHECK:STDERR: -// CHECK:STDERR: fail_use_in_fn_decl.carbon:[[@LINE+4]]:26: error: missing `return` at end of function with declared return type [MissingReturnStatement] -// CHECK:STDERR: fn H() -> C({}).(I.F)() {} -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_use_in_fn_decl.carbon:[[@LINE+2]]:26: error: missing `return` at end of function with declared return type [MissingReturnStatement] // CHECK:STDERR: fn H() -> C({}).(I.F)() {} @@ -307,24 +299,24 @@ fn H() -> C({}).(I.F)() {} // CHECK:STDOUT: %c.ref: ref %C.664 = name_ref c, file.%c [concrete = file.%c.var] // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] // CHECK:STDOUT: %F.ref: %I.assoc_type = name_ref F, imports.%Main.import_ref.a45 [concrete = constants.%assoc0] -// CHECK:STDOUT: %.loc16: %I.type = converted %c.ref, [concrete = ] +// CHECK:STDOUT: %.loc12: %I.type = converted %c.ref, [concrete = ] // CHECK:STDOUT: %return: = return_slot // CHECK:STDOUT: } // CHECK:STDOUT: %H.decl: %H.type = fn_decl @H [concrete = constants.%H] { // CHECK:STDOUT: %return.patt: = return_slot_pattern , [concrete = ] // CHECK:STDOUT: } { // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%Main.C [concrete = constants.%C.generic] -// CHECK:STDOUT: %.loc25_14: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc25_15: type = converted %.loc25_14, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc17_14: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc17_15: type = converted %.loc17_14, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%empty_struct_type) [concrete = constants.%C.664] // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] // CHECK:STDOUT: %F.ref: %I.assoc_type = name_ref F, imports.%Main.import_ref.a45 [concrete = constants.%assoc0] // CHECK:STDOUT: %I.facet: %I.type = facet_value %C, (constants.%I.impl_witness.85d) [concrete = constants.%I.facet] -// CHECK:STDOUT: %.loc25_16: %I.type = converted %C, %I.facet [concrete = constants.%I.facet] +// CHECK:STDOUT: %.loc17_16: %I.type = converted %C, %I.facet [concrete = constants.%I.facet] // CHECK:STDOUT: %impl.elem0: %.250 = impl_witness_access constants.%I.impl_witness.85d, element0 [concrete = constants.%C.as.I.impl.F.bb5] // CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @C.as.I.impl.F(constants.%empty_struct_type) [concrete = constants.%C.as.I.impl.F.specific_fn] // CHECK:STDOUT: %C.as.I.impl.F.call: init %empty_tuple.type = call %specific_fn() -// CHECK:STDOUT: %.loc25_23: type = converted %C.as.I.impl.F.call, [concrete = ] +// CHECK:STDOUT: %.loc17_23: type = converted %C.as.I.impl.F.call, [concrete = ] // CHECK:STDOUT: %return: = return_slot // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/impl/incomplete.carbon b/toolchain/check/testdata/impl/incomplete.carbon index 21ea83bd7557..87f88012b5c2 100644 --- a/toolchain/check/testdata/impl/incomplete.carbon +++ b/toolchain/check/testdata/impl/incomplete.carbon @@ -20,12 +20,8 @@ interface I; // Requires I identified. impl {} as I; -// CHECK:STDERR: fail_empty_struct.carbon:[[@LINE+7]]:1: error: definition of impl as incomplete facet type `I` [ImplAsIncompleteFacetTypeDefinition] -// CHECK:STDERR: impl {} as I {} -// CHECK:STDERR: ^~~~~~~~~~~~~~ -// CHECK:STDERR: fail_empty_struct.carbon:[[@LINE-8]]:1: note: interface was forward declared here [InterfaceForwardDeclaredHere] -// CHECK:STDERR: interface I; -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_empty_struct.carbon:[[@LINE+3]]:1-14: error: definition of impl as incomplete facet type `I` [ImplAsIncompleteFacetTypeDefinition] +// CHECK:STDERR: fail_empty_struct.carbon:[[@LINE-6]]:1-12: note: interface was forward declared here [InterfaceForwardDeclaredHere] // CHECK:STDERR: impl {} as I {} @@ -36,18 +32,12 @@ interface J; class C {} // Requires I identified. -// CHECK:STDERR: fail_class.carbon:[[@LINE+4]]:11: error: name `I` not found [NameNotFound] -// CHECK:STDERR: impl C as I; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_class.carbon:[[@LINE+2]]:11: error: name `I` not found [NameNotFound] // CHECK:STDERR: impl C as I; -// CHECK:STDERR: fail_class.carbon:[[@LINE+7]]:1: error: definition of impl as incomplete facet type `J` [ImplAsIncompleteFacetTypeDefinition] -// CHECK:STDERR: impl C as J {} -// CHECK:STDERR: ^~~~~~~~~~~~~ -// CHECK:STDERR: fail_class.carbon:[[@LINE-13]]:1: note: interface was forward declared here [InterfaceForwardDeclaredHere] -// CHECK:STDERR: interface J; -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_class.carbon:[[@LINE+3]]:1-13: error: definition of impl as incomplete facet type `J` [ImplAsIncompleteFacetTypeDefinition] +// CHECK:STDERR: fail_class.carbon:[[@LINE-9]]:1-12: note: interface was forward declared here [InterfaceForwardDeclaredHere] // CHECK:STDERR: impl C as J {} @@ -57,12 +47,8 @@ library "[[@TEST_NAME]]"; interface J; class C {} -// CHECK:STDERR: fail_class_no_forward_decl.carbon:[[@LINE+7]]:1: error: definition of impl as incomplete facet type `J` [ImplAsIncompleteFacetTypeDefinition] -// CHECK:STDERR: impl C as J {} -// CHECK:STDERR: ^~~~~~~~~~~~~ -// CHECK:STDERR: fail_class_no_forward_decl.carbon:[[@LINE-6]]:1: note: interface was forward declared here [InterfaceForwardDeclaredHere] -// CHECK:STDERR: interface J; -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_class_no_forward_decl.carbon:[[@LINE+3]]:1-13: error: definition of impl as incomplete facet type `J` [ImplAsIncompleteFacetTypeDefinition] +// CHECK:STDERR: fail_class_no_forward_decl.carbon:[[@LINE-4]]:1-12: note: interface was forward declared here [InterfaceForwardDeclaredHere] // CHECK:STDERR: impl C as J {} @@ -72,21 +58,13 @@ library "[[@TEST_NAME]]"; interface J; class C {} -// CHECK:STDERR: fail_class_with_rewrite.carbon:[[@LINE+7]]:19: error: member access into facet of incomplete type `J` [IncompleteTypeInMemberAccessOfFacet] -// CHECK:STDERR: impl C as J where .X = (); -// CHECK:STDERR: ^~ -// CHECK:STDERR: fail_class_with_rewrite.carbon:[[@LINE-6]]:1: note: interface was forward declared here [InterfaceForwardDeclaredHere] -// CHECK:STDERR: interface J; -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_class_with_rewrite.carbon:[[@LINE+3]]:19-20: error: member access into facet of incomplete type `J` [IncompleteTypeInMemberAccessOfFacet] +// CHECK:STDERR: fail_class_with_rewrite.carbon:[[@LINE-4]]:1-12: note: interface was forward declared here [InterfaceForwardDeclaredHere] // CHECK:STDERR: impl C as J where .X = (); -// CHECK:STDERR: fail_class_with_rewrite.carbon:[[@LINE+7]]:19: error: member access into facet of incomplete type `J` [IncompleteTypeInMemberAccessOfFacet] -// CHECK:STDERR: impl C as J where .X = () {} -// CHECK:STDERR: ^~ -// CHECK:STDERR: fail_class_with_rewrite.carbon:[[@LINE-15]]:1: note: interface was forward declared here [InterfaceForwardDeclaredHere] -// CHECK:STDERR: interface J; -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_class_with_rewrite.carbon:[[@LINE+3]]:19-20: error: member access into facet of incomplete type `J` [IncompleteTypeInMemberAccessOfFacet] +// CHECK:STDERR: fail_class_with_rewrite.carbon:[[@LINE-9]]:1-12: note: interface was forward declared here [InterfaceForwardDeclaredHere] // CHECK:STDERR: impl C as J where .X = () {} @@ -128,9 +106,7 @@ class C {} interface I {} interface Incomplete; -// CHECK:STDERR: fail_incomplete_where_definition.carbon:[[@LINE+4]]:1: error: constraint `I where .Self impls Incomplete` being implemented requires that `C` implements `Incomplete` [IdentifiedRequireImplsNotImplemented] -// CHECK:STDERR: impl C as I where .Self impls Incomplete {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_incomplete_where_definition.carbon:[[@LINE+2]]:1-42: error: constraint `I where .Self impls Incomplete` being implemented requires that `C` implements `Incomplete` [IdentifiedRequireImplsNotImplemented] // CHECK:STDERR: impl C as I where .Self impls Incomplete {} @@ -142,17 +118,11 @@ class C {} interface I {} interface Incomplete; -// CHECK:STDERR: fail_declaration_lookup_into_incomplete.carbon:[[@LINE+4]]:1: error: constraint `I where .Self impls Incomplete` being implemented requires that `C` implements `Incomplete` [IdentifiedRequireImplsNotImplemented] -// CHECK:STDERR: impl C as I where .Self impls Incomplete { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_declaration_lookup_into_incomplete.carbon:[[@LINE+2]]:1-42: error: constraint `I where .Self impls Incomplete` being implemented requires that `C` implements `Incomplete` [IdentifiedRequireImplsNotImplemented] // CHECK:STDERR: impl C as I where .Self impls Incomplete { - // CHECK:STDERR: fail_declaration_lookup_into_incomplete.carbon:[[@LINE+7]]:19: error: member access into incomplete facet type `Incomplete` [QualifiedExprInIncompleteFacetTypeScope] - // CHECK:STDERR: fn F() -> Self.(Incomplete.T); - // CHECK:STDERR: ^~~~~~~~~~~~ - // CHECK:STDERR: fail_declaration_lookup_into_incomplete.carbon:[[@LINE-10]]:1: note: interface was forward declared here [InterfaceForwardDeclaredHere] - // CHECK:STDERR: interface Incomplete; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_declaration_lookup_into_incomplete.carbon:[[@LINE+3]]:19-30: error: member access into incomplete facet type `Incomplete` [QualifiedExprInIncompleteFacetTypeScope] + // CHECK:STDERR: fail_declaration_lookup_into_incomplete.carbon:[[@LINE-6]]:1-21: note: interface was forward declared here [InterfaceForwardDeclaredHere] // CHECK:STDERR: fn F() -> Self.(Incomplete.T); }; @@ -164,12 +134,8 @@ constraint X; class C {} // Requires X identified. -// CHECK:STDERR: fail_unidentified_constraint.carbon:[[@LINE+7]]:1: error: facet type `X` cannot be identified in `impl as` [ImplOfUnidentifiedFacetType] -// CHECK:STDERR: impl C as X; -// CHECK:STDERR: ^~~~~~~~~~~~ -// CHECK:STDERR: fail_unidentified_constraint.carbon:[[@LINE-7]]:1: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere] -// CHECK:STDERR: constraint X; -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_unidentified_constraint.carbon:[[@LINE+3]]:1-12: error: facet type `X` cannot be identified in `impl as` [ImplOfUnidentifiedFacetType] +// CHECK:STDERR: fail_unidentified_constraint.carbon:[[@LINE-5]]:1-13: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere] // CHECK:STDERR: impl C as X; @@ -197,12 +163,8 @@ library "[[@TEST_NAME]]"; constraint A; interface B { - // CHECK:STDERR: fail_incomplete_constraint.carbon:[[@LINE+7]]:17: error: facet type `A` cannot be identified in `require` declaration [RequireImplsUnidentifiedFacetType] - // CHECK:STDERR: require impls A; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_incomplete_constraint.carbon:[[@LINE-6]]:1: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere] - // CHECK:STDERR: constraint A; - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_incomplete_constraint.carbon:[[@LINE+3]]:17: error: facet type `A` cannot be identified in `require` declaration [RequireImplsUnidentifiedFacetType] + // CHECK:STDERR: fail_incomplete_constraint.carbon:[[@LINE-4]]:1-13: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere] // CHECK:STDERR: require impls A; } @@ -230,11 +192,11 @@ interface B { // CHECK:STDOUT: } // CHECK:STDOUT: %.loc6: = impl_self_witness @empty_struct_type.as.I.impl.%.loc6_7.2, @I [concrete = constants.%.aaf] // CHECK:STDOUT: impl_decl @empty_struct_type.as.I.impl [concrete] {} { -// 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.loc15: type = name_ref I, file.%I.decl [concrete = constants.%I.type] +// CHECK:STDOUT: %.loc11_7.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc11_7.2: type = converted %.loc11_7.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %I.ref.loc11: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc15: = impl_self_witness @empty_struct_type.as.I.impl.%.loc15_7.2, @I [concrete = constants.%.aaf] +// CHECK:STDOUT: %.loc11: = impl_self_witness @empty_struct_type.as.I.impl.%.loc11_7.2, @I [concrete = constants.%.aaf] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I; @@ -276,7 +238,7 @@ interface B { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc20: = impl_self_witness @C.as.J.impl.%C.ref, @J [concrete = constants.%.ffd] +// CHECK:STDOUT: %.loc14: = impl_self_witness @C.as.J.impl.%C.ref, @J [concrete = constants.%.ffd] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @J; @@ -323,7 +285,7 @@ interface B { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc13: = impl_self_witness @C.as.J.impl.%C.ref, @J [concrete = constants.%.ffd] +// CHECK:STDOUT: %.loc9: = impl_self_witness @C.as.J.impl.%C.ref, @J [concrete = constants.%.ffd] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @J; @@ -367,42 +329,42 @@ interface B { // CHECK:STDOUT: %J.decl: type = interface_decl @J [concrete = constants.%J.type] {} {} // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {} // CHECK:STDOUT: impl_decl @C.as..impl [concrete] {} { -// CHECK:STDOUT: %C.ref.loc13: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %J.ref.loc13: type = name_ref J, file.%J.decl [concrete = constants.%J.type] -// CHECK:STDOUT: %.Self.frozen.loc13: %J.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %base_facet_type.loc13 = requirement_base_facet_type %J.ref.loc13 [concrete] -// CHECK:STDOUT: %.Self.ref.loc13: %J.type = name_ref .Self, %.Self.frozen.loc13 [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc13: type = facet_access_type %.Self.ref.loc13 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc13_19: type = converted %.Self.ref.loc13, %.Self.as_type.loc13 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %X.ref.loc13: = name_ref X, [concrete = ] -// CHECK:STDOUT: %.loc13_25: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %rewrite.loc13 = requirement_rewrite %X.ref.loc13, [concrete] -// CHECK:STDOUT: %.loc13_13: type = where_expr [concrete = ] { -// CHECK:STDOUT: %base_facet_type.loc13 = requirement_base_facet_type %J.ref.loc13 [concrete] -// CHECK:STDOUT: %rewrite.loc13 = requirement_rewrite %X.ref.loc13, [concrete] +// CHECK:STDOUT: %C.ref.loc9: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %J.ref.loc9: type = name_ref J, file.%J.decl [concrete = constants.%J.type] +// CHECK:STDOUT: %.Self.frozen.loc9: %J.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %base_facet_type.loc9 = requirement_base_facet_type %J.ref.loc9 [concrete] +// CHECK:STDOUT: %.Self.ref.loc9: %J.type = name_ref .Self, %.Self.frozen.loc9 [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc9: type = facet_access_type %.Self.ref.loc9 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc9_19: type = converted %.Self.ref.loc9, %.Self.as_type.loc9 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %X.ref.loc9: = name_ref X, [concrete = ] +// CHECK:STDOUT: %.loc9_25: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %rewrite.loc9 = requirement_rewrite %X.ref.loc9, [concrete] +// CHECK:STDOUT: %.loc9_13: type = where_expr [concrete = ] { +// CHECK:STDOUT: %base_facet_type.loc9 = requirement_base_facet_type %J.ref.loc9 [concrete] +// CHECK:STDOUT: %rewrite.loc9 = requirement_rewrite %X.ref.loc9, [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @C.as..impl [concrete] {} { -// CHECK:STDOUT: %C.ref.loc22: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %J.ref.loc22: type = name_ref J, file.%J.decl [concrete = constants.%J.type] -// CHECK:STDOUT: %.Self.frozen.loc22: %J.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %base_facet_type.loc22 = requirement_base_facet_type %J.ref.loc22 [concrete] -// CHECK:STDOUT: %.Self.ref.loc22: %J.type = name_ref .Self, %.Self.frozen.loc22 [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc22: type = facet_access_type %.Self.ref.loc22 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc22_19: type = converted %.Self.ref.loc22, %.Self.as_type.loc22 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %X.ref.loc22: = name_ref X, [concrete = ] -// CHECK:STDOUT: %.loc22_25: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %rewrite.loc22 = requirement_rewrite %X.ref.loc22, [concrete] -// CHECK:STDOUT: %.loc22_13: type = where_expr [concrete = ] { -// CHECK:STDOUT: %base_facet_type.loc22 = requirement_base_facet_type %J.ref.loc22 [concrete] -// CHECK:STDOUT: %rewrite.loc22 = requirement_rewrite %X.ref.loc22, [concrete] +// CHECK:STDOUT: %C.ref.loc14: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %J.ref.loc14: type = name_ref J, file.%J.decl [concrete = constants.%J.type] +// CHECK:STDOUT: %.Self.frozen.loc14: %J.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %base_facet_type.loc14 = requirement_base_facet_type %J.ref.loc14 [concrete] +// CHECK:STDOUT: %.Self.ref.loc14: %J.type = name_ref .Self, %.Self.frozen.loc14 [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc14: type = facet_access_type %.Self.ref.loc14 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc14_19: type = converted %.Self.ref.loc14, %.Self.as_type.loc14 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %X.ref.loc14: = name_ref X, [concrete = ] +// CHECK:STDOUT: %.loc14_25: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %rewrite.loc14 = requirement_rewrite %X.ref.loc14, [concrete] +// CHECK:STDOUT: %.loc14_13: type = where_expr [concrete = ] { +// CHECK:STDOUT: %base_facet_type.loc14 = requirement_base_facet_type %J.ref.loc14 [concrete] +// CHECK:STDOUT: %rewrite.loc14 = requirement_rewrite %X.ref.loc14, [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @J; // CHECK:STDOUT: -// CHECK:STDOUT: impl @C.as..impl: %C.ref.loc13 as { +// CHECK:STDOUT: impl @C.as..impl: %C.ref.loc9 as { // CHECK:STDOUT: !members: // CHECK:STDOUT: extend // CHECK:STDOUT: witness = @@ -784,22 +746,22 @@ interface B { // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: %.Self.frozen: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %.Self.ref.loc12_19.1: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.ref.loc10_19.1: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, file.%Incomplete.decl [concrete = constants.%Incomplete.type] -// CHECK:STDOUT: %.Self.as_type.loc12_19.1: type = facet_access_type %.Self.ref.loc12_19.1 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc12_19.1: type = converted %.Self.ref.loc12_19.1, %.Self.as_type.loc12_19.1 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %impls.loc12_25.1 = requirement_impls %.loc12_19.1, %Incomplete.ref [concrete] +// CHECK:STDOUT: %.Self.as_type.loc10_19.1: type = facet_access_type %.Self.ref.loc10_19.1 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc10_19.1: type = converted %.Self.ref.loc10_19.1, %.Self.as_type.loc10_19.1 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %impls.loc10_25.1 = requirement_impls %.loc10_19.1, %Incomplete.ref [concrete] // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %.Self.ref.loc12_19.2: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %.Self.as_type.loc12_19.2: type = facet_access_type %.Self.ref.loc12_19.2 [symbolic_self = constants.%.Self.as_type] -// CHECK:STDOUT: %.loc12_19.2: type = converted %.Self.ref.loc12_19.1, %.Self.as_type.loc12_19.2 [symbolic_self = constants.%.Self.as_type] -// CHECK:STDOUT: %impls.loc12_25.2 = requirement_impls %.loc12_19.2, %Incomplete.ref [concrete] -// CHECK:STDOUT: %.loc12_13: type = where_expr [concrete = constants.%I_where.type] { +// CHECK:STDOUT: %.Self.ref.loc10_19.2: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] +// CHECK:STDOUT: %.Self.as_type.loc10_19.2: type = facet_access_type %.Self.ref.loc10_19.2 [symbolic_self = constants.%.Self.as_type] +// CHECK:STDOUT: %.loc10_19.2: type = converted %.Self.ref.loc10_19.1, %.Self.as_type.loc10_19.2 [symbolic_self = constants.%.Self.as_type] +// CHECK:STDOUT: %impls.loc10_25.2 = requirement_impls %.loc10_19.2, %Incomplete.ref [concrete] +// CHECK:STDOUT: %.loc10_13: type = where_expr [concrete = constants.%I_where.type] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %impls.loc12_25.2 = requirement_impls %.loc12_19.2, %Incomplete.ref [concrete] +// CHECK:STDOUT: %impls.loc10_25.2 = requirement_impls %.loc10_19.2, %Incomplete.ref [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc12: = impl_self_witness @C.as.I.impl.%C.ref, @I [concrete = constants.%.b7f] +// CHECK:STDOUT: %.loc10: = impl_self_witness @C.as.I.impl.%C.ref, @I [concrete = constants.%.b7f] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { @@ -871,22 +833,22 @@ interface B { // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: %.Self.frozen: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %.Self.ref.loc12_19.1: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.ref.loc10_19.1: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, file.%Incomplete.decl [concrete = constants.%Incomplete.type] -// CHECK:STDOUT: %.Self.as_type.loc12_19.1: type = facet_access_type %.Self.ref.loc12_19.1 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc12_19.1: type = converted %.Self.ref.loc12_19.1, %.Self.as_type.loc12_19.1 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %impls.loc12_25.1 = requirement_impls %.loc12_19.1, %Incomplete.ref [concrete] +// CHECK:STDOUT: %.Self.as_type.loc10_19.1: type = facet_access_type %.Self.ref.loc10_19.1 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc10_19.1: type = converted %.Self.ref.loc10_19.1, %.Self.as_type.loc10_19.1 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %impls.loc10_25.1 = requirement_impls %.loc10_19.1, %Incomplete.ref [concrete] // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %.Self.ref.loc12_19.2: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %.Self.as_type.loc12_19.2: type = facet_access_type %.Self.ref.loc12_19.2 [symbolic_self = constants.%.Self.as_type] -// CHECK:STDOUT: %.loc12_19.2: type = converted %.Self.ref.loc12_19.1, %.Self.as_type.loc12_19.2 [symbolic_self = constants.%.Self.as_type] -// CHECK:STDOUT: %impls.loc12_25.2 = requirement_impls %.loc12_19.2, %Incomplete.ref [concrete] -// CHECK:STDOUT: %.loc12_13: type = where_expr [concrete = constants.%I_where.type] { +// CHECK:STDOUT: %.Self.ref.loc10_19.2: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] +// CHECK:STDOUT: %.Self.as_type.loc10_19.2: type = facet_access_type %.Self.ref.loc10_19.2 [symbolic_self = constants.%.Self.as_type] +// CHECK:STDOUT: %.loc10_19.2: type = converted %.Self.ref.loc10_19.1, %.Self.as_type.loc10_19.2 [symbolic_self = constants.%.Self.as_type] +// CHECK:STDOUT: %impls.loc10_25.2 = requirement_impls %.loc10_19.2, %Incomplete.ref [concrete] +// CHECK:STDOUT: %.loc10_13: type = where_expr [concrete = constants.%I_where.type] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %impls.loc12_25.2 = requirement_impls %.loc12_19.2, %Incomplete.ref [concrete] +// CHECK:STDOUT: %impls.loc10_25.2 = requirement_impls %.loc10_19.2, %Incomplete.ref [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc12: = impl_self_witness @C.as.I.impl.%C.ref, @I [concrete = constants.%.b7f] +// CHECK:STDOUT: %.loc10: = impl_self_witness @C.as.I.impl.%C.ref, @I [concrete = constants.%.b7f] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { diff --git a/toolchain/check/testdata/impl/interface_args.carbon b/toolchain/check/testdata/impl/interface_args.carbon index 1690a42ede22..4cb1abbcc6e2 100644 --- a/toolchain/check/testdata/impl/interface_args.carbon +++ b/toolchain/check/testdata/impl/interface_args.carbon @@ -47,9 +47,7 @@ fn G(a: A) { a.(Action(B).Op)(); } impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_action.impl.carbon:[[@LINE+4]]:14: error: cannot access member of interface `Action(C)` in type `A` that does not implement that interface [MissingImplInMemberAccess] -// CHECK:STDERR: fn G(a: A) { a.(Action(C).Op)(); } -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_action.impl.carbon:[[@LINE+2]]:14-29: error: cannot access member of interface `Action(C)` in type `A` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: fn G(a: A) { a.(Action(C).Op)(); } @@ -92,17 +90,13 @@ import Core; class C {} fn MakeC() -> C { - // CHECK:STDERR: fail_factory.impl.carbon:[[@LINE+4]]:10: error: cannot convert type `A` into type implementing `Factory(C)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: return A.(Factory(C).Make)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_factory.impl.carbon:[[@LINE+2]]:10-28: error: cannot convert type `A` into type implementing `Factory(C)` [ConversionFailureTypeToFacet] // CHECK:STDERR: return A.(Factory(C).Make)(); } fn InstanceC(a: A) -> C { - // CHECK:STDERR: fail_factory.impl.carbon:[[@LINE+4]]:10: error: cannot access member of interface `Factory(C)` in type `A` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: return a.(Factory(C).Method)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_factory.impl.carbon:[[@LINE+2]]:10-30: error: cannot access member of interface `Factory(C)` in type `A` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: return a.(Factory(C).Method)(); } @@ -871,8 +865,8 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: %Action.ref: %Action.type.538 = name_ref Action, imports.%Main.Action [concrete = constants.%Action.generic] // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C] // CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(constants.%C)> [concrete = constants.%Action.type.d5e] -// CHECK:STDOUT: %.loc8: %Action.assoc_type.1ac = specific_constant imports.%Main.import_ref.8fb, @Action.WithSelf(constants.%C, constants.%Self.60a) [concrete = constants.%assoc0.933] -// CHECK:STDOUT: %Op.ref: %Action.assoc_type.1ac = name_ref Op, %.loc8 [concrete = constants.%assoc0.933] +// CHECK:STDOUT: %.loc6: %Action.assoc_type.1ac = specific_constant imports.%Main.import_ref.8fb, @Action.WithSelf(constants.%C, constants.%Self.60a) [concrete = constants.%assoc0.933] +// CHECK:STDOUT: %Op.ref: %Action.assoc_type.1ac = name_ref Op, %.loc6 [concrete = constants.%assoc0.933] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1668,10 +1662,10 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: %a.param_patt: %pattern_type.9ef = value_param_pattern [concrete = constants.%a.param_patt] // CHECK:STDOUT: %a.patt: %pattern_type.9ef = wrapper_binding_pattern a, %a.param_patt [concrete = constants.%a.patt] // CHECK:STDOUT: %return.param_patt: %pattern_type.98b = out_param_pattern [concrete = constants.%return.param_patt.89a] -// CHECK:STDOUT: %return.patt: %pattern_type.98b = return_slot_pattern %return.param_patt, %C.ref.loc16 [concrete = constants.%return.patt.e4a] +// CHECK:STDOUT: %return.patt: %pattern_type.98b = return_slot_pattern %return.param_patt, %C.ref.loc14 [concrete = constants.%return.patt.e4a] // CHECK:STDOUT: } { -// CHECK:STDOUT: %C.ref.loc16: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc16: Core.Form = init_form %C.ref.loc16 [concrete = constants.%.a44] +// CHECK:STDOUT: %C.ref.loc14: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %.loc14: Core.Form = init_form %C.ref.loc14 [concrete = constants.%.a44] // CHECK:STDOUT: %a.param: %A = value_param call_param0 // CHECK:STDOUT: %A.ref: type = name_ref A, imports.%Main.A [concrete = constants.%A] // CHECK:STDOUT: %a: %A = wrapper_binding a, %a.param @@ -1759,10 +1753,10 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref: type = name_ref A, imports.%Main.A [concrete = constants.%A] // CHECK:STDOUT: %Factory.ref: %Factory.type.9da = name_ref Factory, imports.%Main.Factory [concrete = constants.%Factory.generic] -// CHECK:STDOUT: %C.ref.loc13: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %C.ref.loc11: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(constants.%C)> [concrete = constants.%Factory.type.120] -// CHECK:STDOUT: %.loc13: %Factory.assoc_type.b33 = specific_constant imports.%Main.import_ref.0c4, @Factory.WithSelf(constants.%C, constants.%Self.0bb) [concrete = constants.%assoc0.593] -// CHECK:STDOUT: %Make.ref: %Factory.assoc_type.b33 = name_ref Make, %.loc13 [concrete = constants.%assoc0.593] +// CHECK:STDOUT: %.loc11: %Factory.assoc_type.b33 = specific_constant imports.%Main.import_ref.0c4, @Factory.WithSelf(constants.%C, constants.%Self.0bb) [concrete = constants.%assoc0.593] +// CHECK:STDOUT: %Make.ref: %Factory.assoc_type.b33 = name_ref Make, %.loc11 [concrete = constants.%assoc0.593] // CHECK:STDOUT: return to %return.param // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1770,10 +1764,10 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: %A = name_ref a, %a // CHECK:STDOUT: %Factory.ref: %Factory.type.9da = name_ref Factory, imports.%Main.Factory [concrete = constants.%Factory.generic] -// CHECK:STDOUT: %C.ref.loc21: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %C.ref.loc17: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(constants.%C)> [concrete = constants.%Factory.type.120] -// CHECK:STDOUT: %.loc21: %Factory.assoc_type.b33 = specific_constant imports.%Main.import_ref.998, @Factory.WithSelf(constants.%C, constants.%Self.0bb) [concrete = constants.%assoc1.4d7] -// CHECK:STDOUT: %Method.ref: %Factory.assoc_type.b33 = name_ref Method, %.loc21 [concrete = constants.%assoc1.4d7] +// CHECK:STDOUT: %.loc17: %Factory.assoc_type.b33 = specific_constant imports.%Main.import_ref.998, @Factory.WithSelf(constants.%C, constants.%Self.0bb) [concrete = constants.%assoc1.4d7] +// CHECK:STDOUT: %Method.ref: %Factory.assoc_type.b33 = name_ref Method, %.loc17 [concrete = constants.%assoc1.4d7] // CHECK:STDOUT: return to %return.param // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/lookup/access.carbon b/toolchain/check/testdata/impl/lookup/access.carbon index 9ca22165ddc7..bf5da5f18002 100644 --- a/toolchain/check/testdata/impl/lookup/access.carbon +++ b/toolchain/check/testdata/impl/lookup/access.carbon @@ -53,9 +53,7 @@ fn H(generic U: type, generic V: Z where .Z1 = C(U)) { // query's. // // TODO: This should pass. - // CHECK:STDERR: fail_todo_impl_witness_access_in_impl_type_structure.carbon:[[@LINE+4]]:3: error: cannot convert type `V` that implements `Z where .(Z.Z1) = C(U)` into type implementing `X(U)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: V as X(U); - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_todo_impl_witness_access_in_impl_type_structure.carbon:[[@LINE+2]]:3-11: error: cannot convert type `V` that implements `Z where .(Z.Z1) = C(U)` into type implementing `X(U)` [ConversionFailureFacetToFacet] // CHECK:STDERR: V as X(U); } diff --git a/toolchain/check/testdata/impl/lookup/fail_alias_impl_not_found.carbon b/toolchain/check/testdata/impl/lookup/fail_alias_impl_not_found.carbon index ded4e15ec40b..ed4cd7268e33 100644 --- a/toolchain/check/testdata/impl/lookup/fail_alias_impl_not_found.carbon +++ b/toolchain/check/testdata/impl/lookup/fail_alias_impl_not_found.carbon @@ -21,14 +21,10 @@ class C { } fn F(c: C) { - // CHECK:STDERR: fail_alias_impl_not_found.carbon:[[@LINE+4]]:3: error: cannot access member of interface `I` in type `C` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: C.F(); - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_alias_impl_not_found.carbon:[[@LINE+2]]:3-5: error: cannot access member of interface `I` in type `C` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: C.F(); - // CHECK:STDERR: fail_alias_impl_not_found.carbon:[[@LINE+4]]:3: error: cannot access member of interface `I` in type `C` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: c.F(); - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_alias_impl_not_found.carbon:[[@LINE+2]]:3-5: error: cannot access member of interface `I` in type `C` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: c.F(); } @@ -106,10 +102,10 @@ fn F(c: C) { // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%c.param: %C) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %C.ref.loc28: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %F.ref.loc28: %I.assoc_type = name_ref F, @C.%F [concrete = constants.%assoc0] +// CHECK:STDOUT: %C.ref.loc26: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %F.ref.loc26: %I.assoc_type = name_ref F, @C.%F [concrete = constants.%assoc0] // CHECK:STDOUT: %c.ref: %C = name_ref c, %c -// CHECK:STDOUT: %F.ref.loc33: %I.assoc_type = name_ref F, @C.%F [concrete = constants.%assoc0] +// CHECK:STDOUT: %F.ref.loc29: %I.assoc_type = name_ref F, @C.%F [concrete = constants.%assoc0] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/lookup/fail_function_types.carbon b/toolchain/check/testdata/impl/lookup/fail_function_types.carbon index de09352d6021..e57d4c9ffac7 100644 --- a/toolchain/check/testdata/impl/lookup/fail_function_types.carbon +++ b/toolchain/check/testdata/impl/lookup/fail_function_types.carbon @@ -22,16 +22,10 @@ impl forall [T: type] T as Z { } fn F() { - // CHECK:STDERR: fail_function_type_with_self_type.carbon:[[@LINE+11]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] - // CHECK:STDERR: &(().(Z.G)) as type; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_function_type_with_self_type.carbon:[[@LINE+5]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] // CHECK:STDERR: - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: &(().(Z.G)) as type; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_function_type_with_self_type.carbon:[[@LINE+3]]:3-21: error: cannot convert non-type value of type `*` to `type` with `as` [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: fail_function_type_with_self_type.carbon:[[@LINE+2]]:3-21: note: type `*` does not implement interface `Core.As(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: &(().(Z.G)) as type; } @@ -42,16 +36,10 @@ library "[[@TEST_NAME]]"; fn F() { // This does an impl lookup for `As` with `FunctionType` in the self type. // - // CHECK:STDERR: fail_function_type.carbon:[[@LINE+11]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] - // CHECK:STDERR: &F as type; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_function_type.carbon:[[@LINE+5]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] // CHECK:STDERR: - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: &F as type; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_function_type.carbon:[[@LINE+3]]:3-12: error: cannot convert non-type value of type `*` to `type` with `as` [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: fail_function_type.carbon:[[@LINE+2]]:3-12: note: type `*` does not implement interface `Core.As(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: &F as type; } diff --git a/toolchain/check/testdata/impl/lookup/fail_poison_custom_witness.carbon b/toolchain/check/testdata/impl/lookup/fail_poison_custom_witness.carbon index 27dc29397407..42ebaf5249fd 100644 --- a/toolchain/check/testdata/impl/lookup/fail_poison_custom_witness.carbon +++ b/toolchain/check/testdata/impl/lookup/fail_poison_custom_witness.carbon @@ -63,13 +63,9 @@ struct A { }; '''; -// CHECK:STDERR: fail_poison_custom_witness.carbon:[[@LINE+8]]:1: error: found `impl` for Cpp.A as Destroy, which has a custom witness [PoisonedImplLookupCustomResult] -// CHECK:STDERR: class B { -// CHECK:STDERR: ^~~~~~~~~ -// CHECK:STDERR: fail_poison_custom_witness.carbon:[[@LINE-14]]:1: in import [InImport] -// CHECK:STDERR: destroy.carbon:35:1: note: the use tried to select the `impl` here, but a custom witness was already chosen [PoisonedImplLookupCustomResultNoteBadImpl] -// CHECK:STDERR: impl forall [T: type] T as Destroy { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_poison_custom_witness.carbon:[[@LINE+4]]:1-9: error: found `impl` for Cpp.A as Destroy, which has a custom witness [PoisonedImplLookupCustomResult] +// CHECK:STDERR: imported from: fail_poison_custom_witness.carbon:[[@LINE-12]]:1 [InImport] +// CHECK:STDERR: destroy.carbon:35:1-36: note: the use tried to select the `impl` here, but a custom witness was already chosen [PoisonedImplLookupCustomResultNoteBadImpl] // CHECK:STDERR: class B { extend base: Cpp.A; diff --git a/toolchain/check/testdata/impl/lookup/fail_todo_undefined_impl.carbon b/toolchain/check/testdata/impl/lookup/fail_todo_undefined_impl.carbon index 10e1b59a4214..71ca633faf72 100644 --- a/toolchain/check/testdata/impl/lookup/fail_todo_undefined_impl.carbon +++ b/toolchain/check/testdata/impl/lookup/fail_todo_undefined_impl.carbon @@ -23,9 +23,7 @@ class C { } fn F() { - // CHECK:STDERR: fail_todo_undefined_impl.carbon:[[@LINE+4]]:3: error: accessing member from impl before it has a defined value [ImplAccessMemberBeforeSet] - // CHECK:STDERR: C.F(); - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_todo_undefined_impl.carbon:[[@LINE+2]]:3-5: error: accessing member from impl before it has a defined value [ImplAccessMemberBeforeSet] // CHECK:STDERR: C.F(); } @@ -37,13 +35,9 @@ impl C as I { } fn G() { - // CHECK:STDERR: fail_todo_undefined_impl.carbon:[[@LINE+8]]:3: error: accessing member from impl before it has a defined value [ImplAccessMemberBeforeSet] - // CHECK:STDERR: C.F(); - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_todo_undefined_impl.carbon:[[@LINE+4]]:3-5: error: accessing member from impl before it has a defined value [ImplAccessMemberBeforeSet] // CHECK:STDERR: - // CHECK:STDERR: fail_todo_undefined_impl.carbon:[[@LINE-22]]:3: error: impl declared but not defined [ImplMissingDefinition] - // CHECK:STDERR: extend impl as I; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_undefined_impl.carbon:[[@LINE-18]]:3-19: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: C.F(); } @@ -95,7 +89,7 @@ fn G() { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc35: = impl_self_witness @C.as.I.impl.e10.%C.ref, @I [concrete = constants.%.b7f] +// CHECK:STDOUT: %.loc33: = impl_self_witness @C.as.I.impl.e10.%C.ref, @I [concrete = constants.%.b7f] // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/lookup/generic.carbon b/toolchain/check/testdata/impl/lookup/generic.carbon index 182da63a3e0f..3df08b5ce9eb 100644 --- a/toolchain/check/testdata/impl/lookup/generic.carbon +++ b/toolchain/check/testdata/impl/lookup/generic.carbon @@ -86,18 +86,14 @@ interface HasF { fn F(self); } -// CHECK:STDERR: fail_incomplete_deduction.carbon:[[@LINE+4]]:13: error: `impl` with unused generic binding [ImplUnusedBinding] -// CHECK:STDERR: impl forall [T: type, U: type] T as HasF { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_incomplete_deduction.carbon:[[@LINE+2]]:13-30: error: `impl` with unused generic binding [ImplUnusedBinding] // CHECK:STDERR: impl forall [T: type, U: type] T as HasF { fn F(unused self) {} } fn G(x: {}) { - // CHECK:STDERR: fail_incomplete_deduction.carbon:[[@LINE+4]]:3: error: cannot access member of interface `HasF` in type `{}` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: x.(HasF.F)(); - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_incomplete_deduction.carbon:[[@LINE+2]]:3-12: error: cannot access member of interface `HasF` in type `{}` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: x.(HasF.F)(); } @@ -120,9 +116,7 @@ class B {} fn G(x: A) { // TODO: It'd be nice to include a note here saying that deduction failed because // we deduced two different values for `T`. - // CHECK:STDERR: fail_inconsistent_deduction.carbon:[[@LINE+4]]:3: error: cannot access member of interface `HasF(B)` in type `A` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: x.(HasF(B).F)(); - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_inconsistent_deduction.carbon:[[@LINE+2]]:3-15: error: cannot access member of interface `HasF(B)` in type `A` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: x.(HasF(B).F)(); } @@ -1461,31 +1455,31 @@ fn G(x: A) { // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %HasF.decl: type = interface_decl @HasF [concrete = constants.%HasF.type] {} {} // CHECK:STDOUT: impl_decl @T.as.HasF.impl [concrete] { -// CHECK:STDOUT: %T.patt.loc12_15.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc12_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %U.patt.loc12_24.1: %pattern_type.9a5 = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc12_24.2 (constants.%U.patt)] +// CHECK:STDOUT: %T.patt.loc10_15.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %U.patt.loc10_24.1: %pattern_type.9a5 = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc10_24.2 (constants.%U.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc12_15.2 [symbolic = %T.loc12_15.1 (constants.%T)] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc10_15.2 [symbolic = %T.loc10_15.1 (constants.%T)] // CHECK:STDOUT: %HasF.ref: type = name_ref HasF, file.%HasF.decl [concrete = constants.%HasF.type] -// CHECK:STDOUT: %.loc12_17.1: type = splice_block %.loc12_17.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc12_15: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc12_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc10_17.1: type = splice_block %.loc10_17.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc10_15: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc10_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc12_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc12_15.1 (constants.%T)] -// CHECK:STDOUT: %.loc12_26.1: type = splice_block %.loc12_26.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc12_24: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc12_26.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %T.loc10_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc10_15.1 (constants.%T)] +// CHECK:STDOUT: %.loc10_26.1: type = splice_block %.loc10_26.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc10_24: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc10_26.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %U.loc12_24.2: type = symbolic_binding U, 1 [symbolic = %U.loc12_24.1 (constants.%U)] +// CHECK:STDOUT: %U.loc10_24.2: type = symbolic_binding U, 1 [symbolic = %U.loc10_24.1 (constants.%U)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc12: = impl_self_witness @T.as.HasF.impl.%T.ref, @HasF [symbolic = @T.as.HasF.impl.%.loc12_42 (constants.%.989)] +// CHECK:STDOUT: %.loc10: = impl_self_witness @T.as.HasF.impl.%T.ref, @HasF [symbolic = @T.as.HasF.impl.%.loc10_42 (constants.%.989)] // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] { // CHECK:STDOUT: %x.param_patt: %pattern_type.a96 = value_param_pattern [concrete = constants.%x.param_patt] // CHECK:STDOUT: %x.patt: %pattern_type.a96 = wrapper_binding_pattern x, %x.param_patt [concrete = constants.%x.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %x.param: %empty_struct_type = value_param call_param0 -// CHECK:STDOUT: %.loc16_10.1: type = splice_block %.loc16_10.3 [concrete = constants.%empty_struct_type] { -// CHECK:STDOUT: %.loc16_10.2: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc16_10.3: type = converted %.loc16_10.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc14_10.1: type = splice_block %.loc14_10.3 [concrete = constants.%empty_struct_type] { +// CHECK:STDOUT: %.loc14_10.2: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc14_10.3: type = converted %.loc14_10.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: } // CHECK:STDOUT: %x: %empty_struct_type = wrapper_binding x, %x.param // CHECK:STDOUT: } @@ -1518,32 +1512,32 @@ fn G(x: A) { // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @T.as.HasF.impl(%T.loc12_15.2: type, %U.loc12_24.2: type) { -// CHECK:STDOUT: %T.patt.loc12_15.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc12_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc12_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc12_15.1 (constants.%T)] -// CHECK:STDOUT: %U.patt.loc12_24.2: %pattern_type.9a5 = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc12_24.2 (constants.%U.patt)] -// CHECK:STDOUT: %U.loc12_24.1: type = symbolic_binding U, 1 [symbolic = %U.loc12_24.1 (constants.%U)] -// CHECK:STDOUT: %.loc12_42: = impl_self_witness %T.loc12_15.1, @HasF [symbolic = %.loc12_42 (constants.%.989)] -// CHECK:STDOUT: %HasF.impl_witness.loc12_42.2: = impl_witness %HasF.impl_witness_table, @T.as.HasF.impl(%T.loc12_15.1, %U.loc12_24.1) [symbolic = %HasF.impl_witness.loc12_42.2 (constants.%HasF.impl_witness)] +// CHECK:STDOUT: generic impl @T.as.HasF.impl(%T.loc10_15.2: type, %U.loc10_24.2: type) { +// CHECK:STDOUT: %T.patt.loc10_15.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc10_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc10_15.1 (constants.%T)] +// CHECK:STDOUT: %U.patt.loc10_24.2: %pattern_type.9a5 = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc10_24.2 (constants.%U.patt)] +// CHECK:STDOUT: %U.loc10_24.1: type = symbolic_binding U, 1 [symbolic = %U.loc10_24.1 (constants.%U)] +// CHECK:STDOUT: %.loc10_42: = impl_self_witness %T.loc10_15.1, @HasF [symbolic = %.loc10_42 (constants.%.989)] +// CHECK:STDOUT: %HasF.impl_witness.loc10_42.2: = impl_witness %HasF.impl_witness_table, @T.as.HasF.impl(%T.loc10_15.1, %U.loc10_24.1) [symbolic = %HasF.impl_witness.loc10_42.2 (constants.%HasF.impl_witness)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %T.as.HasF.impl.F.type: type = fn_type @T.as.HasF.impl.F, @T.as.HasF.impl(%T.loc12_15.1, %U.loc12_24.1) [symbolic = %T.as.HasF.impl.F.type (constants.%T.as.HasF.impl.F.type)] +// CHECK:STDOUT: %T.as.HasF.impl.F.type: type = fn_type @T.as.HasF.impl.F, @T.as.HasF.impl(%T.loc10_15.1, %U.loc10_24.1) [symbolic = %T.as.HasF.impl.F.type (constants.%T.as.HasF.impl.F.type)] // CHECK:STDOUT: %T.as.HasF.impl.F: @T.as.HasF.impl.%T.as.HasF.impl.F.type (%T.as.HasF.impl.F.type) = struct_value () [symbolic = %T.as.HasF.impl.F (constants.%T.as.HasF.impl.F)] // CHECK:STDOUT: // CHECK:STDOUT: impl: %T.ref as %HasF.ref { // CHECK:STDOUT: %T.as.HasF.impl.F.decl: @T.as.HasF.impl.%T.as.HasF.impl.F.type (%T.as.HasF.impl.F.type) = fn_decl @T.as.HasF.impl.F [symbolic = @T.as.HasF.impl.%T.as.HasF.impl.F (constants.%T.as.HasF.impl.F)] { -// CHECK:STDOUT: %self.param_patt.loc13_15.1: @T.as.HasF.impl.F.%pattern_type (%pattern_type.51d) = value_param_pattern [symbolic = %self.param_patt.loc13_15.2 (constants.%self.param_patt.b7c)] -// CHECK:STDOUT: %self.patt.loc13_15.1: @T.as.HasF.impl.F.%pattern_type (%pattern_type.51d) = wrapper_binding_pattern self, %self.param_patt.loc13_15.1 [symbolic = %self.patt.loc13_15.2 (constants.%self.patt.4d9)] +// CHECK:STDOUT: %self.param_patt.loc11_15.1: @T.as.HasF.impl.F.%pattern_type (%pattern_type.51d) = value_param_pattern [symbolic = %self.param_patt.loc11_15.2 (constants.%self.param_patt.b7c)] +// CHECK:STDOUT: %self.patt.loc11_15.1: @T.as.HasF.impl.F.%pattern_type (%pattern_type.51d) = wrapper_binding_pattern self, %self.param_patt.loc11_15.1 [symbolic = %self.patt.loc11_15.2 (constants.%self.patt.4d9)] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: @T.as.HasF.impl.F.%T (%T) = value_param call_param0 -// CHECK:STDOUT: %.loc13_15.1: type = splice_block %Self.ref [symbolic = %T (constants.%T)] { -// CHECK:STDOUT: %.loc13_15.2: type = specific_constant @T.as.HasF.impl.%T.ref, @T.as.HasF.impl(constants.%T, constants.%U) [symbolic = %T (constants.%T)] -// CHECK:STDOUT: %Self.ref: type = name_ref Self, %.loc13_15.2 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %.loc11_15.1: type = splice_block %Self.ref [symbolic = %T (constants.%T)] { +// CHECK:STDOUT: %.loc11_15.2: type = specific_constant @T.as.HasF.impl.%T.ref, @T.as.HasF.impl(constants.%T, constants.%U) [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %Self.ref: type = name_ref Self, %.loc11_15.2 [symbolic = %T (constants.%T)] // CHECK:STDOUT: } // CHECK:STDOUT: %self: @T.as.HasF.impl.F.%T (%T) = wrapper_binding self, %self.param // CHECK:STDOUT: } // CHECK:STDOUT: %HasF.impl_witness_table = impl_witness_table (), @T.as.HasF.impl [concrete] -// CHECK:STDOUT: %HasF.impl_witness.loc12_42.1: = impl_witness %HasF.impl_witness_table, @T.as.HasF.impl(constants.%T, constants.%U) [symbolic = %HasF.impl_witness.loc12_42.2 (constants.%HasF.impl_witness)] +// CHECK:STDOUT: %HasF.impl_witness.loc10_42.1: = impl_witness %HasF.impl_witness_table, @T.as.HasF.impl(constants.%T, constants.%U) [symbolic = %HasF.impl_witness.loc10_42.2 (constants.%HasF.impl_witness)] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %T.as.HasF.impl.F.decl @@ -1562,11 +1556,11 @@ fn G(x: A) { // CHECK:STDOUT: fn(%self.param: @HasF.WithSelf.F.%Self.as_type.loc5_8.1 (%Self.as_type)); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @T.as.HasF.impl.F(@T.as.HasF.impl.%T.loc12_15.2: type, @T.as.HasF.impl.%U.loc12_24.2: type) { +// CHECK:STDOUT: generic fn @T.as.HasF.impl.F(@T.as.HasF.impl.%T.loc10_15.2: type, @T.as.HasF.impl.%U.loc10_24.2: type) { // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic = %T (constants.%T)] // CHECK:STDOUT: %pattern_type: type = pattern_type %T [symbolic = %pattern_type (constants.%pattern_type.51d)] -// CHECK:STDOUT: %self.param_patt.loc13_15.2: @T.as.HasF.impl.F.%pattern_type (%pattern_type.51d) = value_param_pattern [symbolic = %self.param_patt.loc13_15.2 (constants.%self.param_patt.b7c)] -// CHECK:STDOUT: %self.patt.loc13_15.2: @T.as.HasF.impl.F.%pattern_type (%pattern_type.51d) = wrapper_binding_pattern self, %self.param_patt.loc13_15.2 [symbolic = %self.patt.loc13_15.2 (constants.%self.patt.4d9)] +// CHECK:STDOUT: %self.param_patt.loc11_15.2: @T.as.HasF.impl.F.%pattern_type (%pattern_type.51d) = value_param_pattern [symbolic = %self.param_patt.loc11_15.2 (constants.%self.param_patt.b7c)] +// CHECK:STDOUT: %self.patt.loc11_15.2: @T.as.HasF.impl.F.%pattern_type (%pattern_type.51d) = wrapper_binding_pattern self, %self.param_patt.loc11_15.2 [symbolic = %self.patt.loc11_15.2 (constants.%self.patt.4d9)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete: = require_complete_type %T [symbolic = %require_complete (constants.%require_complete)] @@ -1601,12 +1595,12 @@ fn G(x: A) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @T.as.HasF.impl(constants.%T, constants.%U) { -// CHECK:STDOUT: %T.patt.loc12_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc12_15.1 => constants.%T -// CHECK:STDOUT: %U.patt.loc12_24.2 => constants.%U.patt -// CHECK:STDOUT: %U.loc12_24.1 => constants.%U -// CHECK:STDOUT: %.loc12_42 => constants.%.989 -// CHECK:STDOUT: %HasF.impl_witness.loc12_42.2 => constants.%HasF.impl_witness +// CHECK:STDOUT: %T.patt.loc10_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc10_15.1 => constants.%T +// CHECK:STDOUT: %U.patt.loc10_24.2 => constants.%U.patt +// CHECK:STDOUT: %U.loc10_24.1 => constants.%U +// CHECK:STDOUT: %.loc10_42 => constants.%.989 +// CHECK:STDOUT: %HasF.impl_witness.loc10_42.2 => constants.%HasF.impl_witness // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %T.as.HasF.impl.F.type => constants.%T.as.HasF.impl.F.type @@ -1616,8 +1610,8 @@ fn G(x: A) { // CHECK:STDOUT: specific @T.as.HasF.impl.F(constants.%T, constants.%U) { // CHECK:STDOUT: %T => constants.%T // CHECK:STDOUT: %pattern_type => constants.%pattern_type.51d -// CHECK:STDOUT: %self.param_patt.loc13_15.2 => constants.%self.param_patt.b7c -// CHECK:STDOUT: %self.patt.loc13_15.2 => constants.%self.patt.4d9 +// CHECK:STDOUT: %self.param_patt.loc11_15.2 => constants.%self.param_patt.b7c +// CHECK:STDOUT: %self.patt.loc11_15.2 => constants.%self.patt.4d9 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_inconsistent_deduction.carbon @@ -1840,8 +1834,8 @@ fn G(x: A) { // CHECK:STDOUT: %HasF.ref: %HasF.type.c96 = name_ref HasF, file.%HasF.decl [concrete = constants.%HasF.generic] // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B] // CHECK:STDOUT: %HasF.type: type = facet_type <@HasF, @HasF(constants.%B)> [concrete = constants.%HasF.type.673] -// CHECK:STDOUT: %.loc22: %HasF.assoc_type.3f9 = specific_constant @HasF.WithSelf.%assoc0.loc5_13.1, @HasF.WithSelf(constants.%B, constants.%Self.0a5) [concrete = constants.%assoc0.489] -// CHECK:STDOUT: %F.ref: %HasF.assoc_type.3f9 = name_ref F, %.loc22 [concrete = constants.%assoc0.489] +// CHECK:STDOUT: %.loc20: %HasF.assoc_type.3f9 = specific_constant @HasF.WithSelf.%assoc0.loc5_13.1, @HasF.WithSelf(constants.%B, constants.%Self.0a5) [concrete = constants.%assoc0.489] +// CHECK:STDOUT: %F.ref: %HasF.assoc_type.3f9 = name_ref F, %.loc20 [concrete = constants.%assoc0.489] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/lookup/impl_cycle.carbon b/toolchain/check/testdata/impl/lookup/impl_cycle.carbon index 4d8c0c686ff8..dd85b907007f 100644 --- a/toolchain/check/testdata/impl/lookup/impl_cycle.carbon +++ b/toolchain/check/testdata/impl/lookup/impl_cycle.carbon @@ -25,16 +25,10 @@ fn F() { // with a note about the cycle as the reason for impl lookup failing, or the // cycle causes an error so the conversion is not diagnosed. - // CHECK:STDERR: fail_impl_simple_cycle.carbon:[[@LINE+11]]:3: error: cycle found in search for impl of `Z` for type `Point` [ImplLookupCycle] - // CHECK:STDERR: Point as Z; - // CHECK:STDERR: ^~~~~~~~~~ - // CHECK:STDERR: fail_impl_simple_cycle.carbon:[[@LINE-12]]:1: note: determining if this impl clause matches [ImplLookupCycleNote] - // CHECK:STDERR: impl forall [T: Z] T as Z {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_impl_simple_cycle.carbon:[[@LINE+5]]:3-12: error: cycle found in search for impl of `Z` for type `Point` [ImplLookupCycle] + // CHECK:STDERR: fail_impl_simple_cycle.carbon:[[@LINE-10]]:1-27: note: determining if this impl clause matches [ImplLookupCycleNote] // CHECK:STDERR: - // CHECK:STDERR: fail_impl_simple_cycle.carbon:[[@LINE+4]]:3: error: cannot convert type `Point` into type implementing `Z` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Point as Z; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_impl_simple_cycle.carbon:[[@LINE+2]]:3-12: error: cannot convert type `Point` into type implementing `Z` [ConversionFailureTypeToFacet] // CHECK:STDERR: Point as Z; } @@ -51,16 +45,10 @@ impl forall [T: type where .Self impls Z] T as Z {} class Point {} fn F() { - // CHECK:STDERR: fail_impl_simple_where_cycle.carbon:[[@LINE+11]]:3: error: cycle found in search for impl of `type where .Self impls Z` for type `Point` [ImplLookupCycle] - // CHECK:STDERR: Point as Z; - // CHECK:STDERR: ^~~~~~~~~~ - // CHECK:STDERR: fail_impl_simple_where_cycle.carbon:[[@LINE-8]]:1: note: determining if this impl clause matches [ImplLookupCycleNote] - // CHECK:STDERR: impl forall [T: type where .Self impls Z] T as Z {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_impl_simple_where_cycle.carbon:[[@LINE+5]]:3-12: error: cycle found in search for impl of `type where .Self impls Z` for type `Point` [ImplLookupCycle] + // CHECK:STDERR: fail_impl_simple_where_cycle.carbon:[[@LINE-6]]:1-50: note: determining if this impl clause matches [ImplLookupCycleNote] // CHECK:STDERR: - // CHECK:STDERR: fail_impl_simple_where_cycle.carbon:[[@LINE+4]]:3: error: cannot convert type `Point` into type implementing `Z` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Point as Z; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_impl_simple_where_cycle.carbon:[[@LINE+2]]:3-12: error: cannot convert type `Point` into type implementing `Z` [ConversionFailureTypeToFacet] // CHECK:STDERR: Point as Z; } @@ -77,16 +65,10 @@ impl forall [T: Z & Y] T as Z {} class Point {} fn F() { - // CHECK:STDERR: fail_impl_simple_two_interfaces.carbon:[[@LINE+11]]:3: error: cycle found in search for impl of `Z & Y` for type `Point` [ImplLookupCycle] - // CHECK:STDERR: Point as Z; - // CHECK:STDERR: ^~~~~~~~~~ - // CHECK:STDERR: fail_impl_simple_two_interfaces.carbon:[[@LINE-8]]:1: note: determining if this impl clause matches [ImplLookupCycleNote] - // CHECK:STDERR: impl forall [T: Z & Y] T as Z {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_impl_simple_two_interfaces.carbon:[[@LINE+5]]:3-12: error: cycle found in search for impl of `Z & Y` for type `Point` [ImplLookupCycle] + // CHECK:STDERR: fail_impl_simple_two_interfaces.carbon:[[@LINE-6]]:1-31: note: determining if this impl clause matches [ImplLookupCycleNote] // CHECK:STDERR: - // CHECK:STDERR: fail_impl_simple_two_interfaces.carbon:[[@LINE+4]]:3: error: cannot convert type `Point` into type implementing `Z` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Point as Z; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_impl_simple_two_interfaces.carbon:[[@LINE+2]]:3-12: error: cannot convert type `Point` into type implementing `Z` [ConversionFailureTypeToFacet] // CHECK:STDERR: Point as Z; } @@ -106,22 +88,12 @@ impl forall [T: Z] T as X {} class C {} fn F() { - // CHECK:STDERR: fail_impl_long_cycle.carbon:[[@LINE+17]]:3: error: cycle found in search for impl of `Z` for type `C` [ImplLookupCycle] - // CHECK:STDERR: C as Z; - // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_impl_long_cycle.carbon:[[@LINE-9]]:1: note: determining if this impl clause matches [ImplLookupCycleNote] - // CHECK:STDERR: impl forall [T: Y] T as Z {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_long_cycle.carbon:[[@LINE-13]]:1: note: determining if this impl clause matches [ImplLookupCycleNote] - // CHECK:STDERR: impl forall [T: X] T as Y {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_long_cycle.carbon:[[@LINE-14]]:1: note: determining if this impl clause matches [ImplLookupCycleNote] - // CHECK:STDERR: impl forall [T: Z] T as X {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_impl_long_cycle.carbon:[[@LINE+7]]:3-8: error: cycle found in search for impl of `Z` for type `C` [ImplLookupCycle] + // CHECK:STDERR: fail_impl_long_cycle.carbon:[[@LINE-7]]:1-27: note: determining if this impl clause matches [ImplLookupCycleNote] + // CHECK:STDERR: fail_impl_long_cycle.carbon:[[@LINE-9]]:1-27: note: determining if this impl clause matches [ImplLookupCycleNote] + // CHECK:STDERR: fail_impl_long_cycle.carbon:[[@LINE-8]]:1-27: note: determining if this impl clause matches [ImplLookupCycleNote] // CHECK:STDERR: - // CHECK:STDERR: fail_impl_long_cycle.carbon:[[@LINE+4]]:3: error: cannot convert type `C` into type implementing `Z` [ConversionFailureTypeToFacet] - // CHECK:STDERR: C as Z; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_impl_long_cycle.carbon:[[@LINE+2]]:3-8: error: cannot convert type `C` into type implementing `Z` [ConversionFailureTypeToFacet] // CHECK:STDERR: C as Z; } @@ -141,66 +113,32 @@ class D {} fn Compare[T: type, U: ComparableWith(T)](unused t: T, unused u: U) {} fn F() { - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE+17]]:3: error: cycle found in search for impl of `ComparableWith(C)` for type `C` [ImplLookupCycle] - // CHECK:STDERR: Compare({} as C, {} as C); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-12]]:1: note: determining if this impl clause matches [ImplLookupCycleNote] - // CHECK:STDERR: impl forall [U: type, T: ComparableWith(U)] - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-9]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Compare[T: type, U: ComparableWith(T)](unused t: T, unused u: U) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE+7]]:3-27: error: cycle found in search for impl of `ComparableWith(C)` for type `C` [ImplLookupCycle] + // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-10]]:1-43: note: determining if this impl clause matches [ImplLookupCycleNote] + // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-5]]:1-69: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE+7]]:3: error: cannot convert type `C` into type implementing `ComparableWith(C)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Compare({} as C, {} as C); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-16]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Compare[T: type, U: ComparableWith(T)](unused t: T, unused u: U) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE+3]]:3-27: error: cannot convert type `C` into type implementing `ComparableWith(C)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-8]]:1-69: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: Compare({} as C, {} as C); - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE+20]]:3: error: cycle found in search for impl of `ComparableWith(C)` for type `D` [ImplLookupCycle] - // CHECK:STDERR: Compare({} as C, {} as D); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-31]]:1: note: determining if this impl clause matches [ImplLookupCycleNote] - // CHECK:STDERR: impl forall [U: type, T: ComparableWith(U)] - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-34]]:1: note: determining if this impl clause matches [ImplLookupCycleNote] - // CHECK:STDERR: impl forall [U: type, T: ComparableWith(U)] - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-31]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Compare[T: type, U: ComparableWith(T)](unused t: T, unused u: U) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE+8]]:3-27: error: cycle found in search for impl of `ComparableWith(C)` for type `D` [ImplLookupCycle] + // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-19]]:1-43: note: determining if this impl clause matches [ImplLookupCycleNote] + // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-20]]:1-43: note: determining if this impl clause matches [ImplLookupCycleNote] + // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-15]]:1-69: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE+7]]:3: error: cannot convert type `D` into type implementing `ComparableWith(C)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Compare({} as C, {} as D); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-38]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Compare[T: type, U: ComparableWith(T)](unused t: T, unused u: U) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE+3]]:3-27: error: cannot convert type `D` into type implementing `ComparableWith(C)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-18]]:1-69: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: Compare({} as C, {} as D); - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE+20]]:3: error: cycle found in search for impl of `ComparableWith(D)` for type `C` [ImplLookupCycle] - // CHECK:STDERR: Compare({} as D, {} as C); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-53]]:1: note: determining if this impl clause matches [ImplLookupCycleNote] - // CHECK:STDERR: impl forall [U: type, T: ComparableWith(U)] - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-56]]:1: note: determining if this impl clause matches [ImplLookupCycleNote] - // CHECK:STDERR: impl forall [U: type, T: ComparableWith(U)] - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-53]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Compare[T: type, U: ComparableWith(T)](unused t: T, unused u: U) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE+8]]:3-27: error: cycle found in search for impl of `ComparableWith(D)` for type `C` [ImplLookupCycle] + // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-29]]:1-43: note: determining if this impl clause matches [ImplLookupCycleNote] + // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-30]]:1-43: note: determining if this impl clause matches [ImplLookupCycleNote] + // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-25]]:1-69: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE+7]]:3: error: cannot convert type `C` into type implementing `ComparableWith(D)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Compare({} as D, {} as C); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-60]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Compare[T: type, U: ComparableWith(T)](unused t: T, unused u: U) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE+3]]:3-27: error: cannot convert type `C` into type implementing `ComparableWith(D)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-28]]:1-69: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: Compare({} as D, {} as C); } diff --git a/toolchain/check/testdata/impl/lookup/impl_overlap.carbon b/toolchain/check/testdata/impl/lookup/impl_overlap.carbon index 19520852daa2..fe7a1578cb07 100644 --- a/toolchain/check/testdata/impl/lookup/impl_overlap.carbon +++ b/toolchain/check/testdata/impl/lookup/impl_overlap.carbon @@ -98,12 +98,8 @@ final impl forall [T: type] T as Z(T) {} // The final impl here overlaps with the final impl above, but is not in a // match_first. // -// CHECK:STDERR: fail_multiple_finals_overlap_with_interface.carbon:[[@LINE+7]]:1: error: `final impl` overlaps with `final impl` from same file outside a `match_first` block [FinalImplOverlapsSameFile] -// CHECK:STDERR: final impl forall [T: type] T as Z(()) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_multiple_finals_overlap_with_interface.carbon:[[@LINE-8]]:1: note: other `final impl` here [FinalImplOverlapsSameFileNote] -// CHECK:STDERR: final impl forall [T: type] T as Z(T) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_multiple_finals_overlap_with_interface.carbon:[[@LINE+3]]:1-40: error: `final impl` overlaps with `final impl` from same file outside a `match_first` block [FinalImplOverlapsSameFile] +// CHECK:STDERR: fail_multiple_finals_overlap_with_interface.carbon:[[@LINE-6]]:1-39: note: other `final impl` here [FinalImplOverlapsSameFileNote] // CHECK:STDERR: final impl forall [T: type] T as Z(()) {} @@ -112,12 +108,8 @@ class C {} // The final impl here overlaps with the first final impl above, but is not in // a match_first. // -// CHECK:STDERR: fail_multiple_finals_overlap_with_interface.carbon:[[@LINE+7]]:1: error: `final impl` overlaps with `final impl` from same file outside a `match_first` block [FinalImplOverlapsSameFile] -// CHECK:STDERR: final impl C as Z({}) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_multiple_finals_overlap_with_interface.carbon:[[@LINE-22]]:1: note: other `final impl` here [FinalImplOverlapsSameFileNote] -// CHECK:STDERR: final impl forall [T: type] T as Z(T) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_multiple_finals_overlap_with_interface.carbon:[[@LINE+3]]:1-23: error: `final impl` overlaps with `final impl` from same file outside a `match_first` block [FinalImplOverlapsSameFile] +// CHECK:STDERR: fail_multiple_finals_overlap_with_interface.carbon:[[@LINE-16]]:1-39: note: other `final impl` here [FinalImplOverlapsSameFileNote] // CHECK:STDERR: final impl C as Z({}) {} @@ -133,12 +125,8 @@ final impl C as Z(()) {} // The final impl here overlaps with the first final impl above, but is not in // a match_first. // -// CHECK:STDERR: fail_multiple_finals_overlap_with_self_type.carbon:[[@LINE+7]]:1: error: `final impl` overlaps with `final impl` from same file outside a `match_first` block [FinalImplOverlapsSameFile] -// CHECK:STDERR: final impl forall [T: type] C as Z(T) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_multiple_finals_overlap_with_self_type.carbon:[[@LINE-8]]:1: note: other `final impl` here [FinalImplOverlapsSameFileNote] -// CHECK:STDERR: final impl C as Z(()) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_multiple_finals_overlap_with_self_type.carbon:[[@LINE+3]]:1-39: error: `final impl` overlaps with `final impl` from same file outside a `match_first` block [FinalImplOverlapsSameFile] +// CHECK:STDERR: fail_multiple_finals_overlap_with_self_type.carbon:[[@LINE-6]]:1-23: note: other `final impl` here [FinalImplOverlapsSameFileNote] // CHECK:STDERR: final impl forall [T: type] C as Z(T) {} @@ -187,13 +175,9 @@ class C {} // Can't write a final impl in both the interface's file and the root self // type's file (when they are different files). // -// CHECK:STDERR: fail_final_impl_with_both_interface_and_self_but_different_files.carbon:[[@LINE+8]]:1: error: `final impl` overlaps with `final impl` from another file [FinalImplOverlapsDifferentFile] -// CHECK:STDERR: final impl C as Z(()) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_final_impl_with_both_interface_and_self_but_different_files.carbon:[[@LINE-10]]:1: in import [InImport] -// CHECK:STDERR: interface_z_with_impl.carbon:9:1: note: imported `final impl` here [FinalImplOverlapsDifferentFileNote] -// CHECK:STDERR: final impl forall [T: type] T as Z(T) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_final_impl_with_both_interface_and_self_but_different_files.carbon:[[@LINE+4]]:1-23: error: `final impl` overlaps with `final impl` from another file [FinalImplOverlapsDifferentFile] +// CHECK:STDERR: imported from: fail_final_impl_with_both_interface_and_self_but_different_files.carbon:[[@LINE-8]]:1 [InImport] +// CHECK:STDERR: interface_z_with_impl.carbon:9:1-39: note: imported `final impl` here [FinalImplOverlapsDifferentFileNote] // CHECK:STDERR: final impl C as Z(()) {} @@ -207,13 +191,9 @@ class C {} // This final impl is overlapped by a final impl in the interface file, and you // can't write a final impl in two different files. // -// CHECK:STDERR: fail_final_overlaps_final_from_other_file.carbon:[[@LINE+8]]:1: error: `final impl` overlaps with `final impl` from another file [FinalImplOverlapsDifferentFile] -// CHECK:STDERR: final impl C as Z(C) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_final_overlaps_final_from_other_file.carbon:[[@LINE-10]]:1: in import [InImport] -// CHECK:STDERR: interface_z_with_impl.carbon:9:1: note: imported `final impl` here [FinalImplOverlapsDifferentFileNote] -// CHECK:STDERR: final impl forall [T: type] T as Z(T) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_final_overlaps_final_from_other_file.carbon:[[@LINE+4]]:1-22: error: `final impl` overlaps with `final impl` from another file [FinalImplOverlapsDifferentFile] +// CHECK:STDERR: imported from: fail_final_overlaps_final_from_other_file.carbon:[[@LINE-8]]:1 [InImport] +// CHECK:STDERR: interface_z_with_impl.carbon:9:1-39: note: imported `final impl` here [FinalImplOverlapsDifferentFileNote] // CHECK:STDERR: final impl C as Z(C) {} @@ -226,13 +206,9 @@ class C {} // This non-final impl is subsumed by a final impl in the interface file. // -// CHECK:STDERR: fail_final_overlaps_non_final_from_other_file.carbon:[[@LINE+8]]:1: error: `impl` will never be used [ImplFinalOverlapsNonFinal] -// CHECK:STDERR: impl C as Z(C) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_final_overlaps_non_final_from_other_file.carbon:[[@LINE-9]]:1: in import [InImport] -// CHECK:STDERR: interface_z_with_impl.carbon:9:1: note: `final impl` declared here would always be used instead [ImplFinalOverlapsNonFinalNote] -// CHECK:STDERR: final impl forall [T: type] T as Z(T) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_final_overlaps_non_final_from_other_file.carbon:[[@LINE+4]]:1-16: error: `impl` will never be used [ImplFinalOverlapsNonFinal] +// CHECK:STDERR: imported from: fail_final_overlaps_non_final_from_other_file.carbon:[[@LINE-7]]:1 [InImport] +// CHECK:STDERR: interface_z_with_impl.carbon:9:1-39: note: `final impl` declared here would always be used instead [ImplFinalOverlapsNonFinalNote] // CHECK:STDERR: impl C as Z(C) {} @@ -246,9 +222,7 @@ class C; // The root type must be defined in the same library, not just declared. // -// CHECK:STDERR: fail_final_root_self_type_not_defined.carbon:[[@LINE+4]]:1: error: `final impl` found in file that does not contain the root self type nor the interface definition [FinalImplInvalidFile] -// CHECK:STDERR: final impl C as Z(()) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_final_root_self_type_not_defined.carbon:[[@LINE+2]]:1-23: error: `final impl` found in file that does not contain the root self type nor the interface definition [FinalImplInvalidFile] // CHECK:STDERR: final impl C as Z(()) {} @@ -263,9 +237,7 @@ class C {} // Can't make a final impl that is not in the same file as the self type nor // the interface. // -// CHECK:STDERR: fail_final_different_file_from_self_and_interface.carbon:[[@LINE+4]]:1: error: `final impl` found in file that does not contain the root self type nor the interface definition [FinalImplInvalidFile] -// CHECK:STDERR: final impl D(C) as Z(()) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_final_different_file_from_self_and_interface.carbon:[[@LINE+2]]:1-26: error: `final impl` found in file that does not contain the root self type nor the interface definition [FinalImplInvalidFile] // CHECK:STDERR: final impl D(C) as Z(()) {} @@ -279,9 +251,7 @@ class C {} // Can't make a final impl that is not in the same file as the self type nor // the interface. // -// CHECK:STDERR: fail_final_different_file_from_self_and_interface_with_generic_self.carbon:[[@LINE+4]]:1: error: `final impl` found in file that does not contain the root self type nor the interface definition [FinalImplInvalidFile] -// CHECK:STDERR: final impl forall [T: type] T as Z(C) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_final_different_file_from_self_and_interface_with_generic_self.carbon:[[@LINE+2]]:1-39: error: `final impl` found in file that does not contain the root self type nor the interface definition [FinalImplInvalidFile] // CHECK:STDERR: final impl forall [T: type] T as Z(C) {} @@ -290,14 +260,10 @@ library "[[@TEST_NAME]]"; interface Z(T: type) {} -// CHECK:STDERR: fail_final_overlaps_earlier_non_final_impl.carbon:[[@LINE+3]]:1: error: `impl` will never be used [ImplFinalOverlapsNonFinal] -// CHECK:STDERR: impl () as Z(()) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_final_overlaps_earlier_non_final_impl.carbon:[[@LINE+1]]:1-18: error: `impl` will never be used [ImplFinalOverlapsNonFinal] impl () as Z(()) {} -// CHECK:STDERR: fail_final_overlaps_earlier_non_final_impl.carbon:[[@LINE+4]]:1: note: `final impl` declared here would always be used instead [ImplFinalOverlapsNonFinalNote] -// CHECK:STDERR: final impl forall [T: type] T as Z(T) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_final_overlaps_earlier_non_final_impl.carbon:[[@LINE+2]]:1-39: note: `final impl` declared here would always be used instead [ImplFinalOverlapsNonFinalNote] // CHECK:STDERR: final impl forall [T: type] T as Z(T) {} @@ -308,12 +274,8 @@ interface Z(T: type) {} final impl forall [T: type] T as Z(T) {} -// CHECK:STDERR: fail_final_overlaps_later_non_final_impl.carbon:[[@LINE+7]]:1: error: `impl` will never be used [ImplFinalOverlapsNonFinal] -// CHECK:STDERR: impl () as Z(()) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_final_overlaps_later_non_final_impl.carbon:[[@LINE-5]]:1: note: `final impl` declared here would always be used instead [ImplFinalOverlapsNonFinalNote] -// CHECK:STDERR: final impl forall [T: type] T as Z(T) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_final_overlaps_later_non_final_impl.carbon:[[@LINE+3]]:1-18: error: `impl` will never be used [ImplFinalOverlapsNonFinal] +// CHECK:STDERR: fail_final_overlaps_later_non_final_impl.carbon:[[@LINE-3]]:1-39: note: `final impl` declared here would always be used instead [ImplFinalOverlapsNonFinalNote] // CHECK:STDERR: impl () as Z(()) {} @@ -326,12 +288,8 @@ class C {} final impl C as Z(C) {} -// CHECK:STDERR: fail_final_overlaps_earlier_final_impl.carbon:[[@LINE+7]]:1: error: `final impl` overlaps with `final impl` from same file outside a `match_first` block [FinalImplOverlapsSameFile] -// CHECK:STDERR: final impl forall [T: type] T as Z(T) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_final_overlaps_earlier_final_impl.carbon:[[@LINE-5]]:1: note: other `final impl` here [FinalImplOverlapsSameFileNote] -// CHECK:STDERR: final impl C as Z(C) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_final_overlaps_earlier_final_impl.carbon:[[@LINE+3]]:1-39: error: `final impl` overlaps with `final impl` from same file outside a `match_first` block [FinalImplOverlapsSameFile] +// CHECK:STDERR: fail_final_overlaps_earlier_final_impl.carbon:[[@LINE-3]]:1-22: note: other `final impl` here [FinalImplOverlapsSameFileNote] // CHECK:STDERR: final impl forall [T: type] T as Z(T) {} @@ -344,12 +302,8 @@ class C {} final impl forall [T: type] T as Z(T) {} -// CHECK:STDERR: fail_final_overlaps_later_final_impl.carbon:[[@LINE+7]]:1: error: `final impl` overlaps with `final impl` from same file outside a `match_first` block [FinalImplOverlapsSameFile] -// CHECK:STDERR: final impl C as Z(C) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_final_overlaps_later_final_impl.carbon:[[@LINE-5]]:1: note: other `final impl` here [FinalImplOverlapsSameFileNote] -// CHECK:STDERR: final impl forall [T: type] T as Z(T) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_final_overlaps_later_final_impl.carbon:[[@LINE+3]]:1-22: error: `final impl` overlaps with `final impl` from same file outside a `match_first` block [FinalImplOverlapsSameFile] +// CHECK:STDERR: fail_final_overlaps_later_final_impl.carbon:[[@LINE-3]]:1-39: note: other `final impl` here [FinalImplOverlapsSameFileNote] // CHECK:STDERR: final impl C as Z(C) {} @@ -366,12 +320,8 @@ class C(T: type); // No diagnosis here as the type structure is unique. impl forall [T: type] T as Z(C(T)) {} -// CHECK:STDERR: fail_non_final_type_structure_matches_non_final_impl.carbon:[[@LINE+7]]:1: error: found non-final `impl` with the same type structure as another non-final `impl` [ImplNonFinalSameTypeStructure] -// CHECK:STDERR: impl forall [T: type] T as Z(T) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_non_final_type_structure_matches_non_final_impl.carbon:[[@LINE-10]]:1: note: other `impl` here [ImplNonFinalSameTypeStructureNote] -// CHECK:STDERR: impl forall [T: Y] T as Z(T) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_non_final_type_structure_matches_non_final_impl.carbon:[[@LINE+3]]:1-33: error: found non-final `impl` with the same type structure as another non-final `impl` [ImplNonFinalSameTypeStructure] +// CHECK:STDERR: fail_non_final_type_structure_matches_non_final_impl.carbon:[[@LINE-8]]:1-30: note: other `impl` here [ImplNonFinalSameTypeStructureNote] // CHECK:STDERR: impl forall [T: type] T as Z(T) {} @@ -412,11 +362,7 @@ class C(T: type) {} // more specific in the self type. They overlap for the query `C(()) as Z(())` // but neither impl is completely more specific than the other. final impl forall [T: type] C(T) as Z(()) {} -// CHECK:STDERR: fail_final_overlap_where_each_is_more_specific_than_the_other.carbon:[[@LINE+7]]:1: error: `final impl` overlaps with `final impl` from same file outside a `match_first` block [FinalImplOverlapsSameFile] -// CHECK:STDERR: final impl forall [T: type] C(()) as Z(T) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_final_overlap_where_each_is_more_specific_than_the_other.carbon:[[@LINE-4]]:1: note: other `final impl` here [FinalImplOverlapsSameFileNote] -// CHECK:STDERR: final impl forall [T: type] C(T) as Z(()) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_final_overlap_where_each_is_more_specific_than_the_other.carbon:[[@LINE+3]]:1-43: error: `final impl` overlaps with `final impl` from same file outside a `match_first` block [FinalImplOverlapsSameFile] +// CHECK:STDERR: fail_final_overlap_where_each_is_more_specific_than_the_other.carbon:[[@LINE-2]]:1-43: note: other `final impl` here [FinalImplOverlapsSameFileNote] // CHECK:STDERR: final impl forall [T: type] C(()) as Z(T) {} diff --git a/toolchain/check/testdata/impl/lookup/impl_overlap_wrapped_types.carbon b/toolchain/check/testdata/impl/lookup/impl_overlap_wrapped_types.carbon index 41df7d1ad9c5..6061c0738a37 100644 --- a/toolchain/check/testdata/impl/lookup/impl_overlap_wrapped_types.carbon +++ b/toolchain/check/testdata/impl/lookup/impl_overlap_wrapped_types.carbon @@ -41,12 +41,8 @@ impl Core.MaybeUnformed(C) as I {} impl partial C as I {} impl C* as I {} -// CHECK:STDERR: fail_const_overlap.carbon:[[@LINE+7]]:1: error: redefinition of `impl const C as I` [ImplRedefinition] -// CHECK:STDERR: impl const C as I {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_const_overlap.carbon:[[@LINE-8]]:1: note: previous definition was here [ImplPreviousDefinition] -// CHECK:STDERR: impl const C as I {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_const_overlap.carbon:[[@LINE+3]]:1-19: error: redefinition of `impl const C as I` [ImplRedefinition] +// CHECK:STDERR: fail_const_overlap.carbon:[[@LINE-6]]:1-19: note: previous definition was here [ImplPreviousDefinition] // CHECK:STDERR: impl const C as I {} @@ -62,12 +58,8 @@ impl Core.MaybeUnformed(C) as I {} impl partial C as I {} impl C* as I {} -// CHECK:STDERR: fail_maybe_unformed_overlap.carbon:[[@LINE+7]]:1: error: redefinition of `impl Core.MaybeUnformed(C as Core.Destroy) as I` [ImplRedefinition] -// CHECK:STDERR: impl Core.MaybeUnformed(C) as I {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_maybe_unformed_overlap.carbon:[[@LINE-7]]:1: note: previous definition was here [ImplPreviousDefinition] -// CHECK:STDERR: impl Core.MaybeUnformed(C) as I {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_maybe_unformed_overlap.carbon:[[@LINE+3]]:1-33: error: redefinition of `impl Core.MaybeUnformed(C as Core.Destroy) as I` [ImplRedefinition] +// CHECK:STDERR: fail_maybe_unformed_overlap.carbon:[[@LINE-5]]:1-33: note: previous definition was here [ImplPreviousDefinition] // CHECK:STDERR: impl Core.MaybeUnformed(C) as I {} @@ -83,12 +75,8 @@ impl Core.MaybeUnformed(C) as I {} impl partial C as I {} impl C* as I {} -// CHECK:STDERR: fail_partial_overlap.carbon:[[@LINE+7]]:1: error: redefinition of `impl partial C as I` [ImplRedefinition] -// CHECK:STDERR: impl partial C as I {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_partial_overlap.carbon:[[@LINE-6]]:1: note: previous definition was here [ImplPreviousDefinition] -// CHECK:STDERR: impl partial C as I {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_partial_overlap.carbon:[[@LINE+3]]:1-21: error: redefinition of `impl partial C as I` [ImplRedefinition] +// CHECK:STDERR: fail_partial_overlap.carbon:[[@LINE-4]]:1-21: note: previous definition was here [ImplPreviousDefinition] // CHECK:STDERR: impl partial C as I {} @@ -104,11 +92,7 @@ impl Core.MaybeUnformed(C) as I {} impl partial C as I {} impl C* as I {} -// CHECK:STDERR: fail_pointer_overlap.carbon:[[@LINE+7]]:1: error: redefinition of `impl C* as I` [ImplRedefinition] -// CHECK:STDERR: impl C* as I {} -// CHECK:STDERR: ^~~~~~~~~~~~~~ -// CHECK:STDERR: fail_pointer_overlap.carbon:[[@LINE-5]]:1: note: previous definition was here [ImplPreviousDefinition] -// CHECK:STDERR: impl C* as I {} -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_pointer_overlap.carbon:[[@LINE+3]]:1-14: error: redefinition of `impl C* as I` [ImplRedefinition] +// CHECK:STDERR: fail_pointer_overlap.carbon:[[@LINE-3]]:1-14: note: previous definition was here [ImplPreviousDefinition] // CHECK:STDERR: impl C* as I {} diff --git a/toolchain/check/testdata/impl/lookup/import.carbon b/toolchain/check/testdata/impl/lookup/import.carbon index f45f22953a83..6c6bd48bec52 100644 --- a/toolchain/check/testdata/impl/lookup/import.carbon +++ b/toolchain/check/testdata/impl/lookup/import.carbon @@ -216,9 +216,7 @@ import HasExtraInterfaces; fn Test(c: HasExtraInterfaces.C(type)) { // This triggers the import of a bunch more interfaces, which reallocates the // interface ValueStore. Ensure that doesn't result in a use-after-free crash. - // CHECK:STDERR: fail_use_has_extra_interfaces.carbon:[[@LINE+4]]:3: error: cannot access member of interface `HasExtraInterfaces.I` in type `HasExtraInterfaces.C(type)` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: c.(HasExtraInterfaces.I.F)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_use_has_extra_interfaces.carbon:[[@LINE+2]]:3-28: error: cannot access member of interface `HasExtraInterfaces.I` in type `HasExtraInterfaces.C(type)` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: c.(HasExtraInterfaces.I.F)(); } @@ -3586,7 +3584,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: fn @Test(%c.param: %C.6a9) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %c.ref: %C.6a9 = name_ref c, %c -// CHECK:STDOUT: %HasExtraInterfaces.ref.loc12: = name_ref HasExtraInterfaces, imports.%HasExtraInterfaces [concrete = imports.%HasExtraInterfaces] +// CHECK:STDOUT: %HasExtraInterfaces.ref.loc10: = name_ref HasExtraInterfaces, imports.%HasExtraInterfaces [concrete = imports.%HasExtraInterfaces] // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%HasExtraInterfaces.I [concrete = constants.%I.type] // CHECK:STDOUT: %F.ref: %I.assoc_type = name_ref F, imports.%HasExtraInterfaces.import_ref.d70 [concrete = constants.%assoc0] // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/impl/lookup/import_error.carbon b/toolchain/check/testdata/impl/lookup/import_error.carbon index f9d006035ea0..842c85c52cf5 100644 --- a/toolchain/check/testdata/impl/lookup/import_error.carbon +++ b/toolchain/check/testdata/impl/lookup/import_error.carbon @@ -18,9 +18,7 @@ interface Z { } // The value of .X is an error. -// CHECK:STDERR: fail_error_interface_z.carbon:[[@LINE+4]]:34: error: associated constant `.(Z.X)` given two different values `{}` and `()` [AssociatedConstantWithDifferentValues] -// CHECK:STDERR: final impl forall [T: type] T as Z where .X = {} and .X = () {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_error_interface_z.carbon:[[@LINE+2]]:34-60: error: associated constant `.(Z.X)` given two different values `{}` and `()` [AssociatedConstantWithDifferentValues] // CHECK:STDERR: final impl forall [T: type] T as Z where .X = {} and .X = () {} @@ -32,12 +30,8 @@ import library "error_interface_z"; fn F[unused U: type](generic T: Z) { // The value of `.X` is an error. It should not crash though. // - // 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))` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let unused a: T.X = (); - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_import_error.carbon:[[@LINE+3]]:23-24: error: cannot implicitly convert expression of type `()` to `T.(Z.X)` [ConversionFailure] + // CHECK:STDERR: fail_import_error.carbon:[[@LINE+2]]:23-24: note: type `()` does not implement interface `Core.ImplicitAs(T.(Z.X))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused a: T.X = (); } diff --git a/toolchain/check/testdata/impl/lookup/specialization.carbon b/toolchain/check/testdata/impl/lookup/specialization.carbon index 9c657d29277e..a12345be6265 100644 --- a/toolchain/check/testdata/impl/lookup/specialization.carbon +++ b/toolchain/check/testdata/impl/lookup/specialization.carbon @@ -237,12 +237,8 @@ fn F[D: Y](unused d: D) { // because we are in a generic where `D` is an unknown type, which will cause // the query and impl self type to be C(FacetValue) for a symbolic FacetValue. // - // 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))` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let unused a: C(D).(Z.X) = (); - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_specialized_class_with_symbolic_facet_value_param.carbon:[[@LINE+3]]:30-31: error: cannot implicitly convert expression of type `()` to `C(D).(Z.X)` [ConversionFailure] + // CHECK:STDERR: fail_specialized_class_with_symbolic_facet_value_param.carbon:[[@LINE+2]]:30-31: note: type `()` does not implement interface `Core.ImplicitAs(C(D).(Z.X))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused a: C(D).(Z.X) = (); } @@ -339,12 +335,8 @@ impl forall [T: type, U: type] T as Z(U) where .X = () {} fn F[unused U: type](generic T: Z(C)) { // The value of `.X` is symbolic, it can't be assigned a value of type `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))` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let unused a: T.X = {} as C; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_specialization_written_after_generic_use_of_type_constant.carbon:[[@LINE+3]]:23-29: error: cannot implicitly convert expression of type `C` to `T.(Z(C).X)` [ConversionFailure] + // CHECK:STDERR: fail_specialization_written_after_generic_use_of_type_constant.carbon:[[@LINE+2]]:23-29: note: type `C` does not implement interface `Core.ImplicitAs(T.(Z(C).X))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused a: T.X = {} as C; } diff --git a/toolchain/check/testdata/impl/lookup/specialization_poison.carbon b/toolchain/check/testdata/impl/lookup/specialization_poison.carbon index 04a308ad59b6..dd3dc4fcb432 100644 --- a/toolchain/check/testdata/impl/lookup/specialization_poison.carbon +++ b/toolchain/check/testdata/impl/lookup/specialization_poison.carbon @@ -22,9 +22,7 @@ impl forall [U: type] U as I where .T = () { fn F(unused self) -> () { return (); } } -// CHECK:STDERR: fail_final_poisoned_concrete_query_in_specific.carbon:[[@LINE+3]]:24: error: found `impl` that would change the result of an earlier use of `C* as I` [PoisonedImplLookupConcreteResult] -// CHECK:STDERR: fn H[W: type](v: W) -> W.(I.T) { -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_final_poisoned_concrete_query_in_specific.carbon:[[@LINE+1]]:24-30: error: found `impl` that would change the result of an earlier use of `C* as I` [PoisonedImplLookupConcreteResult] fn H[W: type](v: W) -> W.(I.T) { return v.(I.F)(); } @@ -36,12 +34,8 @@ fn G(p: C*) -> () { return H(p); } -// CHECK:STDERR: fail_final_poisoned_concrete_query_in_specific.carbon:[[@LINE+7]]:1: note: the use would select the `impl` here but it was not found yet [PoisonedImplLookupConcreteResultNoteBadImpl] -// CHECK:STDERR: impl C* as I where .T = C { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_final_poisoned_concrete_query_in_specific.carbon:[[@LINE-21]]:1: note: the use had selected the `impl` here [PoisonedImplLookupConcreteResultNotePreviousImpl] -// CHECK:STDERR: impl forall [U: type] U as I where .T = () { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_final_poisoned_concrete_query_in_specific.carbon:[[@LINE+3]]:1-27: note: the use would select the `impl` here but it was not found yet [PoisonedImplLookupConcreteResultNoteBadImpl] +// CHECK:STDERR: fail_final_poisoned_concrete_query_in_specific.carbon:[[@LINE-17]]:1-44: note: the use had selected the `impl` here [PoisonedImplLookupConcreteResultNotePreviousImpl] // CHECK:STDERR: impl C* as I where .T = C { fn F(self) -> C { return *self; } @@ -60,18 +54,12 @@ class C {} fn H[W: type](unused v: W) { // This concrete impl lookup query poisons any further specializations. - // CHECK:STDERR: fail_final_poisoned_concrete_query_in_generic.carbon:[[@LINE+3]]:17: error: found `impl` that would change the result of an earlier use of `C as I` [PoisonedImplLookupConcreteResult] - // CHECK:STDERR: let unused a: C.(I.T) = (); - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_final_poisoned_concrete_query_in_generic.carbon:[[@LINE+1]]:17-23: error: found `impl` that would change the result of an earlier use of `C as I` [PoisonedImplLookupConcreteResult] let unused a: C.(I.T) = (); } -// CHECK:STDERR: fail_final_poisoned_concrete_query_in_generic.carbon:[[@LINE+7]]:1: note: the use would select the `impl` here but it was not found yet [PoisonedImplLookupConcreteResultNoteBadImpl] -// CHECK:STDERR: impl C as I where .T = C {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_final_poisoned_concrete_query_in_generic.carbon:[[@LINE-15]]:1: note: the use had selected the `impl` here [PoisonedImplLookupConcreteResultNotePreviousImpl] -// CHECK:STDERR: impl forall [U: type] U as I where .T = () {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_final_poisoned_concrete_query_in_generic.carbon:[[@LINE+3]]:1-26: note: the use would select the `impl` here but it was not found yet [PoisonedImplLookupConcreteResultNoteBadImpl] +// CHECK:STDERR: fail_final_poisoned_concrete_query_in_generic.carbon:[[@LINE-11]]:1-44: note: the use had selected the `impl` here [PoisonedImplLookupConcreteResultNotePreviousImpl] // CHECK:STDERR: impl C as I where .T = C {} @@ -91,18 +79,12 @@ impl forall [U: type] C(U) as I where .T = () { fn G(c: C(())) -> () { // This concrete impl lookup query poisons any further specializations. - // CHECK:STDERR: fail_final_poisoned_concrete_query_nested_type_in_self.carbon:[[@LINE+3]]:10: error: found `impl` that would change the result of an earlier use of `C(()) as I` [PoisonedImplLookupConcreteResult] - // CHECK:STDERR: return c.(I.F)(); - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_final_poisoned_concrete_query_nested_type_in_self.carbon:[[@LINE+1]]:10-16: error: found `impl` that would change the result of an earlier use of `C(()) as I` [PoisonedImplLookupConcreteResult] return c.(I.F)(); } -// CHECK:STDERR: fail_final_poisoned_concrete_query_nested_type_in_self.carbon:[[@LINE+7]]:1: note: the use would select the `impl` here but it was not found yet [PoisonedImplLookupConcreteResultNoteBadImpl] -// CHECK:STDERR: impl C(()) as I where .T = {} { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_final_poisoned_concrete_query_nested_type_in_self.carbon:[[@LINE-15]]:1: note: the use had selected the `impl` here [PoisonedImplLookupConcreteResultNotePreviousImpl] -// CHECK:STDERR: impl forall [U: type] C(U) as I where .T = () { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_final_poisoned_concrete_query_nested_type_in_self.carbon:[[@LINE+3]]:1-31: note: the use would select the `impl` here but it was not found yet [PoisonedImplLookupConcreteResultNoteBadImpl] +// CHECK:STDERR: fail_final_poisoned_concrete_query_nested_type_in_self.carbon:[[@LINE-11]]:1-47: note: the use had selected the `impl` here [PoisonedImplLookupConcreteResultNotePreviousImpl] // CHECK:STDERR: impl C(()) as I where .T = {} { fn F(unused self) -> {} { return {}; } @@ -124,18 +106,12 @@ class C {} fn G(c: C) -> () { // This concrete impl lookup query poisons any further specializations. - // CHECK:STDERR: fail_final_poisoned_concrete_query_nested_type_in_interface.carbon:[[@LINE+3]]:10: error: found `impl` that would change the result of an earlier use of `C as I(C)` [PoisonedImplLookupConcreteResult] - // CHECK:STDERR: return c.(I(C).F)(); - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_final_poisoned_concrete_query_nested_type_in_interface.carbon:[[@LINE+1]]:10-19: error: found `impl` that would change the result of an earlier use of `C as I(C)` [PoisonedImplLookupConcreteResult] return c.(I(C).F)(); } -// CHECK:STDERR: fail_final_poisoned_concrete_query_nested_type_in_interface.carbon:[[@LINE+7]]:1: note: the use would select the `impl` here but it was not found yet [PoisonedImplLookupConcreteResultNoteBadImpl] -// CHECK:STDERR: impl C as I(C) where .T = {} { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_final_poisoned_concrete_query_nested_type_in_interface.carbon:[[@LINE-17]]:1: note: the use had selected the `impl` here [PoisonedImplLookupConcreteResultNotePreviousImpl] -// CHECK:STDERR: impl forall [U: type] U as I(U) where .T = () { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_final_poisoned_concrete_query_nested_type_in_interface.carbon:[[@LINE+3]]:1-30: note: the use would select the `impl` here but it was not found yet [PoisonedImplLookupConcreteResultNoteBadImpl] +// CHECK:STDERR: fail_final_poisoned_concrete_query_nested_type_in_interface.carbon:[[@LINE-13]]:1-47: note: the use had selected the `impl` here [PoisonedImplLookupConcreteResultNotePreviousImpl] // CHECK:STDERR: impl C as I(C) where .T = {} { fn F(unused self) -> {} { return {}; } @@ -180,19 +156,13 @@ fn F() { musteval fn G() -> auto { class C(T: type) {} impl forall [T: type] C(T) as Z {} - // CHECK:STDERR: fail_poisoned_concrete_lookup_from_eval_fn.carbon:[[@LINE+3]]:5: error: found `impl` that would change the result of an earlier use of `C(D) as Z` [PoisonedImplLookupConcreteResult] - // CHECK:STDERR: C(D) as Z; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_poisoned_concrete_lookup_from_eval_fn.carbon:[[@LINE+1]]:5-13: error: found `impl` that would change the result of an earlier use of `C(D) as Z` [PoisonedImplLookupConcreteResult] C(D) as Z; return C(D); } - // CHECK:STDERR: fail_poisoned_concrete_lookup_from_eval_fn.carbon:[[@LINE+7]]:3: note: the use would select the `impl` here but it was not found yet [PoisonedImplLookupConcreteResultNoteBadImpl] - // CHECK:STDERR: impl G() as Z {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_poisoned_concrete_lookup_from_eval_fn.carbon:[[@LINE-11]]:5: note: the use had selected the `impl` here [PoisonedImplLookupConcreteResultNotePreviousImpl] - // CHECK:STDERR: impl forall [T: type] C(T) as Z {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_poisoned_concrete_lookup_from_eval_fn.carbon:[[@LINE+3]]:3-17: note: the use would select the `impl` here but it was not found yet [PoisonedImplLookupConcreteResultNoteBadImpl] + // CHECK:STDERR: fail_poisoned_concrete_lookup_from_eval_fn.carbon:[[@LINE-7]]:5-37: note: the use had selected the `impl` here [PoisonedImplLookupConcreteResultNotePreviousImpl] // CHECK:STDERR: impl G() as Z {} } 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 6db725185189..60bf1d67ce49 100644 --- a/toolchain/check/testdata/impl/lookup/specialization_with_symbolic_rewrite.carbon +++ b/toolchain/check/testdata/impl/lookup/specialization_with_symbolic_rewrite.carbon @@ -45,12 +45,8 @@ impl forall [T: type, S: type] T as Z(S) where .X = () {} impl forall [T: type] T as Z(C) where .X = T {} fn F(generic 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))` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let unused a: T.X = t; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_nonfinal_specialized_symbolic_rewrite.carbon:[[@LINE+3]]:23: error: cannot implicitly convert expression of type `T` to `T.(Z(C).X)` [ConversionFailure] + // CHECK:STDERR: fail_nonfinal_specialized_symbolic_rewrite.carbon:[[@LINE+2]]:23: note: type `T` does not implement interface `Core.ImplicitAs(T.(Z(C).X))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused a: T.X = t; } @@ -833,33 +829,33 @@ fn F[T: Ptr](var t: T) -> T.(Ptr.Type) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete.loc14: = require_complete_type %T.as_type.loc14_26.1 [symbolic = %require_complete.loc14 (constants.%require_complete.6f0)] // CHECK:STDOUT: %Z.lookup_impl_witness: = lookup_impl_witness %T.loc14_15.1, @Z, @Z(constants.%C) [symbolic = %Z.lookup_impl_witness (constants.%Z.lookup_impl_witness)] -// CHECK:STDOUT: %impl.elem0.loc22_18.2: type = impl_witness_access %Z.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc22_18.2 (constants.%impl.elem0.5bb)] -// CHECK:STDOUT: %require_complete.loc22_18: = require_complete_type %impl.elem0.loc22_18.2 [symbolic = %require_complete.loc22_18 (constants.%require_complete.fee)] -// CHECK:STDOUT: %pattern_type.loc22: type = pattern_type %impl.elem0.loc22_18.2 [symbolic = %pattern_type.loc22 (constants.%pattern_type.58e)] -// CHECK:STDOUT: %a.patt.loc22_15.2: @F.%pattern_type.loc22 (%pattern_type.58e) = value_binding_pattern a [symbolic = %a.patt.loc22_15.2 (constants.%a.patt)] -// CHECK:STDOUT: %ImplicitAs.type.loc22_23.2: type = facet_type <@ImplicitAs, @ImplicitAs(%impl.elem0.loc22_18.2)> [symbolic = %ImplicitAs.type.loc22_23.2 (constants.%ImplicitAs.type.64b)] -// CHECK:STDOUT: %require_complete.loc22_23: = require_complete_type %ImplicitAs.type.loc22_23.2 [symbolic = %require_complete.loc22_23 (constants.%require_complete.535)] -// CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs, @ImplicitAs(%impl.elem0.loc22_18.2) [symbolic = %ImplicitAs.assoc_type (constants.%ImplicitAs.assoc_type.1b5)] +// CHECK:STDOUT: %impl.elem0.loc18_18.2: type = impl_witness_access %Z.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc18_18.2 (constants.%impl.elem0.5bb)] +// CHECK:STDOUT: %require_complete.loc18_18: = require_complete_type %impl.elem0.loc18_18.2 [symbolic = %require_complete.loc18_18 (constants.%require_complete.fee)] +// CHECK:STDOUT: %pattern_type.loc18: type = pattern_type %impl.elem0.loc18_18.2 [symbolic = %pattern_type.loc18 (constants.%pattern_type.58e)] +// CHECK:STDOUT: %a.patt.loc18_15.2: @F.%pattern_type.loc18 (%pattern_type.58e) = value_binding_pattern a [symbolic = %a.patt.loc18_15.2 (constants.%a.patt)] +// CHECK:STDOUT: %ImplicitAs.type.loc18_23.2: type = facet_type <@ImplicitAs, @ImplicitAs(%impl.elem0.loc18_18.2)> [symbolic = %ImplicitAs.type.loc18_23.2 (constants.%ImplicitAs.type.64b)] +// CHECK:STDOUT: %require_complete.loc18_23: = require_complete_type %ImplicitAs.type.loc18_23.2 [symbolic = %require_complete.loc18_23 (constants.%require_complete.535)] +// CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs, @ImplicitAs(%impl.elem0.loc18_18.2) [symbolic = %ImplicitAs.assoc_type (constants.%ImplicitAs.assoc_type.1b5)] // CHECK:STDOUT: %assoc0: @F.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.1b5) = assoc_entity element0, imports.%Core.import_ref.a03 [symbolic = %assoc0 (constants.%assoc0.e44)] // CHECK:STDOUT: // CHECK:STDOUT: fn(%t.param: @F.%T.as_type.loc14_26.1 (%T.as_type)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %t.ref: @F.%T.as_type.loc14_26.1 (%T.as_type) = name_ref t, %t -// CHECK:STDOUT: %ImplicitAs.type.loc22_23.1: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%impl.elem0.5bb)> [symbolic = %ImplicitAs.type.loc22_23.2 (constants.%ImplicitAs.type.64b)] -// CHECK:STDOUT: %.loc22_23.1: @F.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.1b5) = specific_constant imports.%Core.import_ref.383, @ImplicitAs.WithSelf(constants.%impl.elem0.5bb, constants.%Self.862) [symbolic = %assoc0 (constants.%assoc0.e44)] -// CHECK:STDOUT: %Convert.ref: @F.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.1b5) = name_ref Convert, %.loc22_23.1 [symbolic = %assoc0 (constants.%assoc0.e44)] -// CHECK:STDOUT: %.loc22_23.2: @F.%impl.elem0.loc22_18.2 (%impl.elem0.5bb) = converted %t.ref, [concrete = ] -// CHECK:STDOUT: %.loc22_18.1: type = splice_block %impl.elem0.loc22_18.1 [symbolic = %impl.elem0.loc22_18.2 (constants.%impl.elem0.5bb)] { -// CHECK:STDOUT: %T.ref.loc22: %Z.type.a07 = name_ref T, %T.loc14_15.2 [symbolic = %T.loc14_15.1 (constants.%T.bdb)] -// CHECK:STDOUT: %T.as_type.loc22: type = facet_access_type %T.ref.loc22 [symbolic = %T.as_type.loc14_26.1 (constants.%T.as_type)] -// CHECK:STDOUT: %.loc22_18.2: type = converted %T.ref.loc22, %T.as_type.loc22 [symbolic = %T.as_type.loc14_26.1 (constants.%T.as_type)] -// CHECK:STDOUT: %.loc22_18.3: %Z.assoc_type.714 = specific_constant @X.%assoc0, @Z.WithSelf(constants.%C, constants.%T.bdb) [concrete = constants.%assoc0.fd2] -// CHECK:STDOUT: %X.ref: %Z.assoc_type.714 = name_ref X, %.loc22_18.3 [concrete = constants.%assoc0.fd2] -// CHECK:STDOUT: %impl.elem0.loc22_18.1: type = impl_witness_access constants.%Z.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc22_18.2 (constants.%impl.elem0.5bb)] +// CHECK:STDOUT: %ImplicitAs.type.loc18_23.1: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%impl.elem0.5bb)> [symbolic = %ImplicitAs.type.loc18_23.2 (constants.%ImplicitAs.type.64b)] +// CHECK:STDOUT: %.loc18_23.1: @F.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.1b5) = specific_constant imports.%Core.import_ref.383, @ImplicitAs.WithSelf(constants.%impl.elem0.5bb, constants.%Self.862) [symbolic = %assoc0 (constants.%assoc0.e44)] +// CHECK:STDOUT: %Convert.ref: @F.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.1b5) = name_ref Convert, %.loc18_23.1 [symbolic = %assoc0 (constants.%assoc0.e44)] +// CHECK:STDOUT: %.loc18_23.2: @F.%impl.elem0.loc18_18.2 (%impl.elem0.5bb) = converted %t.ref, [concrete = ] +// CHECK:STDOUT: %.loc18_18.1: type = splice_block %impl.elem0.loc18_18.1 [symbolic = %impl.elem0.loc18_18.2 (constants.%impl.elem0.5bb)] { +// CHECK:STDOUT: %T.ref.loc18: %Z.type.a07 = name_ref T, %T.loc14_15.2 [symbolic = %T.loc14_15.1 (constants.%T.bdb)] +// CHECK:STDOUT: %T.as_type.loc18: type = facet_access_type %T.ref.loc18 [symbolic = %T.as_type.loc14_26.1 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc18_18.2: type = converted %T.ref.loc18, %T.as_type.loc18 [symbolic = %T.as_type.loc14_26.1 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc18_18.3: %Z.assoc_type.714 = specific_constant @X.%assoc0, @Z.WithSelf(constants.%C, constants.%T.bdb) [concrete = constants.%assoc0.fd2] +// CHECK:STDOUT: %X.ref: %Z.assoc_type.714 = name_ref X, %.loc18_18.3 [concrete = constants.%assoc0.fd2] +// CHECK:STDOUT: %impl.elem0.loc18_18.1: type = impl_witness_access constants.%Z.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc18_18.2 (constants.%impl.elem0.5bb)] // CHECK:STDOUT: } -// CHECK:STDOUT: %a: @F.%impl.elem0.loc22_18.2 (%impl.elem0.5bb) = wrapper_binding a, [concrete = ] +// CHECK:STDOUT: %a: @F.%impl.elem0.loc18_18.2 (%impl.elem0.5bb) = wrapper_binding a, [concrete = ] // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %a.patt.loc22_15.1: @F.%pattern_type.loc22 (%pattern_type.58e) = value_binding_pattern a [symbolic = %a.patt.loc22_15.2 (constants.%a.patt)] +// CHECK:STDOUT: %a.patt.loc18_15.1: @F.%pattern_type.loc18 (%pattern_type.58e) = value_binding_pattern a [symbolic = %a.patt.loc18_15.2 (constants.%a.patt)] // CHECK:STDOUT: } // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/impl/lookup/unused_generic_binding.carbon b/toolchain/check/testdata/impl/lookup/unused_generic_binding.carbon index 4440f7282579..de0fdf6b8d5b 100644 --- a/toolchain/check/testdata/impl/lookup/unused_generic_binding.carbon +++ b/toolchain/check/testdata/impl/lookup/unused_generic_binding.carbon @@ -24,9 +24,7 @@ class C {} // This impl can never deduce its implicit generic parameter `V`, which // should be diagnosed. // -// CHECK:STDERR: fail_no_binding_used.carbon:[[@LINE+4]]:13: error: `impl` with unused generic binding [ImplUnusedBinding] -// CHECK:STDERR: impl forall [V: type] C as I where .T = {.unmatched: ()} {} -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_no_binding_used.carbon:[[@LINE+2]]:13-21: error: `impl` with unused generic binding [ImplUnusedBinding] // CHECK:STDERR: impl forall [V: type] C as I where .T = {.unmatched: ()} {} @@ -53,9 +51,7 @@ class C {} // should be diagnosed. // https://discord.com/channels/655572317891461132/941071822756143115/1354563497731686550 // -// CHECK:STDERR: fail_one_binding_unused.carbon:[[@LINE+4]]:13: error: `impl` with unused generic binding [ImplUnusedBinding] -// CHECK:STDERR: impl forall [V: type, W: type] V as I where .T = {.unmatched: ()} {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_one_binding_unused.carbon:[[@LINE+2]]:13-30: error: `impl` with unused generic binding [ImplUnusedBinding] // CHECK:STDERR: impl forall [V: type, W: type] V as I where .T = {.unmatched: ()} {} @@ -81,9 +77,7 @@ class C(U: type) { // // TODO: We should point the diagnostic at the binding `U` in C. // - // CHECK:STDERR: fail_inherited_binding_unused.carbon:[[@LINE+4]]:3: error: `impl` with unused generic binding [ImplUnusedBinding] - // CHECK:STDERR: impl C(()) as I where .T = {.unmatched: ()} {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_inherited_binding_unused.carbon:[[@LINE+2]]:3-47: error: `impl` with unused generic binding [ImplUnusedBinding] // CHECK:STDERR: impl C(()) as I where .T = {.unmatched: ()} {} } @@ -107,9 +101,7 @@ class C(U: type) { // // TODO: We should point the diagnostic at the binding `U` in C. // - // CHECK:STDERR: fail_inherited_binding_in_forall_unused.carbon:[[@LINE+4]]:15: error: `impl` with unused generic binding [ImplUnusedBinding] - // CHECK:STDERR: impl forall [V: type] C(V) as I where .T = {.unmatched: ()} {} - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_inherited_binding_in_forall_unused.carbon:[[@LINE+2]]:15-23: error: `impl` with unused generic binding [ImplUnusedBinding] // CHECK:STDERR: impl forall [V: type] C(V) as I where .T = {.unmatched: ()} {} } diff --git a/toolchain/check/testdata/impl/multiple_extend.carbon b/toolchain/check/testdata/impl/multiple_extend.carbon index 3c80dceea2e9..ecc229ee7e90 100644 --- a/toolchain/check/testdata/impl/multiple_extend.carbon +++ b/toolchain/check/testdata/impl/multiple_extend.carbon @@ -62,14 +62,10 @@ class D { } fn B(d: D) { - // CHECK:STDERR: fail_ambiguous_impls.carbon:[[@LINE+4]]:3: error: ambiguous use of name `A` found in multiple extended scopes [NameAmbiguousDueToExtend] - // CHECK:STDERR: D.A(); - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_ambiguous_impls.carbon:[[@LINE+2]]:3-5: error: ambiguous use of name `A` found in multiple extended scopes [NameAmbiguousDueToExtend] // CHECK:STDERR: D.A(); - // CHECK:STDERR: fail_ambiguous_impls.carbon:[[@LINE+4]]:3: error: ambiguous use of name `A` found in multiple extended scopes [NameAmbiguousDueToExtend] - // CHECK:STDERR: d.A(); - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_ambiguous_impls.carbon:[[@LINE+2]]:3-5: error: ambiguous use of name `A` found in multiple extended scopes [NameAmbiguousDueToExtend] // CHECK:STDERR: d.A(); } @@ -120,14 +116,10 @@ class L { } fn M(l: L) { - // CHECK:STDERR: fail_ambiguous_impl_and_base.carbon:[[@LINE+4]]:4: error: ambiguous use of name `K` found in multiple extended scopes [NameAmbiguousDueToExtend] - // CHECK:STDERR: L.K(); - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_ambiguous_impl_and_base.carbon:[[@LINE+2]]:4-6: error: ambiguous use of name `K` found in multiple extended scopes [NameAmbiguousDueToExtend] // CHECK:STDERR: L.K(); - // CHECK:STDERR: fail_ambiguous_impl_and_base.carbon:[[@LINE+4]]:4: error: ambiguous use of name `K` found in multiple extended scopes [NameAmbiguousDueToExtend] - // CHECK:STDERR: l.K(); - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_ambiguous_impl_and_base.carbon:[[@LINE+2]]:4-6: error: ambiguous use of name `K` found in multiple extended scopes [NameAmbiguousDueToExtend] // CHECK:STDERR: l.K(); } @@ -563,10 +555,10 @@ fn P(o: O) { // CHECK:STDOUT: // CHECK:STDOUT: fn @B(%d.param: %D) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %D.ref.loc26: type = name_ref D, file.%D.decl [concrete = constants.%D] -// CHECK:STDOUT: %A.ref.loc26: = name_ref A, [concrete = ] +// CHECK:STDOUT: %D.ref.loc24: type = name_ref D, file.%D.decl [concrete = constants.%D] +// CHECK:STDOUT: %A.ref.loc24: = name_ref A, [concrete = ] // CHECK:STDOUT: %d.ref: %D = name_ref d, %d -// CHECK:STDOUT: %A.ref.loc31: = name_ref A, [concrete = ] +// CHECK:STDOUT: %A.ref.loc27: = name_ref A, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -927,10 +919,10 @@ fn P(o: O) { // CHECK:STDOUT: // CHECK:STDOUT: fn @M(%l.param: %L) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %L.ref.loc24: type = name_ref L, file.%L.decl [concrete = constants.%L] -// CHECK:STDOUT: %K.ref.loc24: = name_ref K, [concrete = ] +// CHECK:STDOUT: %L.ref.loc22: type = name_ref L, file.%L.decl [concrete = constants.%L] +// CHECK:STDOUT: %K.ref.loc22: = name_ref K, [concrete = ] // CHECK:STDOUT: %l.ref: %L = name_ref l, %l -// CHECK:STDOUT: %K.ref.loc29: = name_ref K, [concrete = ] +// CHECK:STDOUT: %K.ref.loc25: = name_ref K, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/name_poisoning.carbon b/toolchain/check/testdata/impl/name_poisoning.carbon index 1d67255b1958..cfd7a0dc6863 100644 --- a/toolchain/check/testdata/impl/name_poisoning.carbon +++ b/toolchain/check/testdata/impl/name_poisoning.carbon @@ -36,16 +36,10 @@ interface I { class B { impl as I { - // CHECK:STDERR: fail_impl_function_poisoned.carbon:[[@LINE+11]]:13: error: accessing member from impl before it has a defined value [ImplAccessMemberBeforeSet] - // CHECK:STDERR: fn A(x: B); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_impl_function_poisoned.carbon:[[@LINE+5]]:13: error: accessing member from impl before it has a defined value [ImplAccessMemberBeforeSet] // CHECK:STDERR: - // CHECK:STDERR: fail_impl_function_poisoned.carbon:[[@LINE+7]]:13: error: cannot implicitly convert non-type value of type `` to `type` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fn A(x: B); - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_impl_function_poisoned.carbon:[[@LINE+4]]:13: note: type `` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fn A(x: B); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_impl_function_poisoned.carbon:[[@LINE+3]]:13: error: cannot implicitly convert non-type value of type `` to `type` [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: fail_impl_function_poisoned.carbon:[[@LINE+2]]:13: note: type `` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn A(x: B); fn B(); diff --git a/toolchain/check/testdata/impl/no_definition_in_impl_file.carbon b/toolchain/check/testdata/impl/no_definition_in_impl_file.carbon index 806747aaf20b..302a48cb8e1a 100644 --- a/toolchain/check/testdata/impl/no_definition_in_impl_file.carbon +++ b/toolchain/check/testdata/impl/no_definition_in_impl_file.carbon @@ -18,9 +18,7 @@ library "[[@TEST_NAME]]"; interface A {} -// CHECK:STDERR: fail_decl_in_api_definition_in_impl.carbon:[[@LINE+4]]:1: error: impl declared but not defined [ImplMissingDefinition] -// CHECK:STDERR: impl () as A; -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_decl_in_api_definition_in_impl.carbon:[[@LINE+2]]:1-13: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl () as A; @@ -28,15 +26,11 @@ impl () as A; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_decl_in_api_definition_in_impl.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl] -// CHECK:STDERR: impl () as A; -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_decl_in_api_definition_in_impl.impl.carbon:[[@LINE+2]]:1-13: error: redeclaration of imported impl [RedeclImportedImpl] // CHECK:STDERR: impl () as A; -// CHECK:STDERR: fail_decl_in_api_definition_in_impl.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl] -// CHECK:STDERR: impl () as A {} -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_decl_in_api_definition_in_impl.impl.carbon:[[@LINE+2]]:1-14: error: redeclaration of imported impl [RedeclImportedImpl] // CHECK:STDERR: impl () as A {} @@ -56,9 +50,7 @@ library "[[@TEST_NAME]]"; interface B {} -// CHECK:STDERR: fail_decl_only_in_api.carbon:[[@LINE+4]]:1: error: impl declared but not defined [ImplMissingDefinition] -// CHECK:STDERR: impl () as B; -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_decl_only_in_api.carbon:[[@LINE+2]]:1-13: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl () as B; @@ -72,9 +64,7 @@ library "[[@TEST_NAME]]"; interface C {} -// CHECK:STDERR: fail_decl_in_api_decl_in_impl.carbon:[[@LINE+4]]:1: error: impl declared but not defined [ImplMissingDefinition] -// CHECK:STDERR: impl () as C; -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_decl_in_api_decl_in_impl.carbon:[[@LINE+2]]:1-13: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl () as C; @@ -82,9 +72,7 @@ impl () as C; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl] -// CHECK:STDERR: impl () as C; -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+2]]:1-13: error: redeclaration of imported impl [RedeclImportedImpl] // CHECK:STDERR: impl () as C; @@ -98,9 +86,7 @@ impl library "[[@TEST_NAME]]"; interface D {} -// CHECK:STDERR: fail_decl_only_in_impl.impl.carbon:[[@LINE+4]]:1: error: impl declared but not defined [ImplMissingDefinition] -// CHECK:STDERR: impl () as D; -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_decl_only_in_impl.impl.carbon:[[@LINE+2]]:1-13: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl () as D; @@ -121,11 +107,11 @@ impl () as D; // CHECK:STDOUT: } // CHECK:STDOUT: %A.decl: type = interface_decl @A [concrete = constants.%A.type] {} {} // CHECK:STDOUT: impl_decl @empty_tuple.type.as.A.impl [concrete] {} { -// CHECK:STDOUT: %.loc10_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc10_7.2: type = converted %.loc10_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc8_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_7.2: type = converted %.loc8_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10: = impl_self_witness @empty_tuple.type.as.A.impl.%.loc10_7.2, @A [concrete = constants.%.b5f] +// CHECK:STDOUT: %.loc8: = impl_self_witness @empty_tuple.type.as.A.impl.%.loc8_7.2, @A [concrete = constants.%.b5f] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @A { @@ -139,7 +125,7 @@ impl () as D; // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_tuple.type.as.A.impl: %.loc10_7.2 as %A.ref; +// CHECK:STDOUT: impl @empty_tuple.type.as.A.impl: %.loc8_7.2 as %A.ref; // CHECK:STDOUT: // CHECK:STDOUT: specific @A.WithSelf(constants.%Self) {} // CHECK:STDOUT: @@ -157,8 +143,8 @@ impl () as D; // CHECK:STDOUT: imports { // CHECK:STDOUT: %Main.A: type = import_ref Main//decl_in_api_definition_in_impl, A, loaded [concrete = constants.%A.type] // CHECK:STDOUT: %Main.import_ref.0a1 = import_ref Main//decl_in_api_definition_in_impl, loc4_13, unloaded -// CHECK:STDOUT: %Main.import_ref.e5c: type = import_ref Main//decl_in_api_definition_in_impl, loc10_7, loaded [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %Main.import_ref.201: type = import_ref Main//decl_in_api_definition_in_impl, loc10_12, loaded [concrete = constants.%A.type] +// CHECK:STDOUT: %Main.import_ref.e5c: type = import_ref Main//decl_in_api_definition_in_impl, loc8_7, loaded [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %Main.import_ref.201: type = import_ref Main//decl_in_api_definition_in_impl, loc8_12, loaded [concrete = constants.%A.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -168,17 +154,17 @@ impl () as D; // CHECK:STDOUT: %default.import.loc2_46.1 = import // CHECK:STDOUT: %default.import.loc2_46.2 = import // CHECK:STDOUT: impl_decl @empty_tuple.type.as.A.impl.2e7a85.1 [concrete] {} { -// CHECK:STDOUT: %.loc8_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_7.2: type = converted %.loc8_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc6_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc6_7.2: type = converted %.loc6_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %A.ref: type = name_ref A, imports.%Main.A [concrete = constants.%A.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8: = impl_self_witness @empty_tuple.type.as.A.impl.2e7a85.1.%.loc8_7.2, @A [concrete = constants.%.b5f] +// CHECK:STDOUT: %.loc6: = impl_self_witness @empty_tuple.type.as.A.impl.2e7a85.1.%.loc6_7.2, @A [concrete = constants.%.b5f] // CHECK:STDOUT: impl_decl @empty_tuple.type.as.A.impl.2e7a85.2 [concrete] {} { -// CHECK:STDOUT: %.loc14_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc14_7.2: type = converted %.loc14_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc10_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc10_7.2: type = converted %.loc10_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %A.ref: type = name_ref A, imports.%Main.A [concrete = constants.%A.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc14: = impl_self_witness @empty_tuple.type.as.A.impl.2e7a85.2.%.loc14_7.2, @A [concrete = constants.%.b5f] +// CHECK:STDOUT: %.loc10: = impl_self_witness @empty_tuple.type.as.A.impl.2e7a85.2.%.loc10_7.2, @A [concrete = constants.%.b5f] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @A [from "fail_decl_in_api_definition_in_impl.carbon"] { @@ -191,9 +177,9 @@ impl () as D; // CHECK:STDOUT: // CHECK:STDOUT: impl @empty_tuple.type.as.A.impl.f51: imports.%Main.import_ref.e5c as imports.%Main.import_ref.201 [from "fail_decl_in_api_definition_in_impl.carbon"]; // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_tuple.type.as.A.impl.2e7a85.1: %.loc8_7.2 as %A.ref; +// CHECK:STDOUT: impl @empty_tuple.type.as.A.impl.2e7a85.1: %.loc6_7.2 as %A.ref; // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_tuple.type.as.A.impl.2e7a85.2: %.loc14_7.2 as %A.ref { +// CHECK:STDOUT: impl @empty_tuple.type.as.A.impl.2e7a85.2: %.loc10_7.2 as %A.ref { // CHECK:STDOUT: !members: // CHECK:STDOUT: extend %A.ref // CHECK:STDOUT: witness = @@ -238,11 +224,11 @@ impl () as D; // CHECK:STDOUT: } // CHECK:STDOUT: %B.decl: type = interface_decl @B [concrete = constants.%B.type] {} {} // CHECK:STDOUT: impl_decl @empty_tuple.type.as.B.impl [concrete] {} { -// CHECK:STDOUT: %.loc10_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc10_7.2: type = converted %.loc10_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc8_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_7.2: type = converted %.loc8_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10: = impl_self_witness @empty_tuple.type.as.B.impl.%.loc10_7.2, @B [concrete = constants.%.9cc] +// CHECK:STDOUT: %.loc8: = impl_self_witness @empty_tuple.type.as.B.impl.%.loc8_7.2, @B [concrete = constants.%.9cc] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @B { @@ -256,7 +242,7 @@ impl () as D; // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_tuple.type.as.B.impl: %.loc10_7.2 as %B.ref; +// CHECK:STDOUT: impl @empty_tuple.type.as.B.impl: %.loc8_7.2 as %B.ref; // CHECK:STDOUT: // CHECK:STDOUT: specific @B.WithSelf(constants.%Self) {} // CHECK:STDOUT: @@ -272,8 +258,8 @@ impl () as D; // CHECK:STDOUT: imports { // CHECK:STDOUT: %Main.B = import_ref Main//decl_only_in_api, B, unloaded // CHECK:STDOUT: %Main.import_ref.c07 = import_ref Main//decl_only_in_api, loc4_13, unloaded -// CHECK:STDOUT: %Main.import_ref.e5c: type = import_ref Main//decl_only_in_api, loc10_7, loaded [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %Main.import_ref.21a: type = import_ref Main//decl_only_in_api, loc10_12, loaded [concrete = constants.%B.type] +// CHECK:STDOUT: %Main.import_ref.e5c: type = import_ref Main//decl_only_in_api, loc8_7, loaded [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %Main.import_ref.21a: type = import_ref Main//decl_only_in_api, loc8_12, loaded [concrete = constants.%B.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -313,11 +299,11 @@ impl () as D; // CHECK:STDOUT: } // CHECK:STDOUT: %C.decl: type = interface_decl @C [concrete = constants.%C.type] {} {} // CHECK:STDOUT: impl_decl @empty_tuple.type.as.C.impl [concrete] {} { -// CHECK:STDOUT: %.loc10_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc10_7.2: type = converted %.loc10_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc8_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_7.2: type = converted %.loc8_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10: = impl_self_witness @empty_tuple.type.as.C.impl.%.loc10_7.2, @C [concrete = constants.%.d74] +// CHECK:STDOUT: %.loc8: = impl_self_witness @empty_tuple.type.as.C.impl.%.loc8_7.2, @C [concrete = constants.%.d74] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @C { @@ -331,7 +317,7 @@ impl () as D; // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_tuple.type.as.C.impl: %.loc10_7.2 as %C.ref; +// CHECK:STDOUT: impl @empty_tuple.type.as.C.impl: %.loc8_7.2 as %C.ref; // CHECK:STDOUT: // CHECK:STDOUT: specific @C.WithSelf(constants.%Self) {} // CHECK:STDOUT: @@ -349,8 +335,8 @@ impl () as D; // CHECK:STDOUT: imports { // CHECK:STDOUT: %Main.C: type = import_ref Main//decl_in_api_decl_in_impl, C, loaded [concrete = constants.%C.type] // CHECK:STDOUT: %Main.import_ref.fb3 = import_ref Main//decl_in_api_decl_in_impl, loc4_13, unloaded -// CHECK:STDOUT: %Main.import_ref.e5c: type = import_ref Main//decl_in_api_decl_in_impl, loc10_7, loaded [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %Main.import_ref.3f1: type = import_ref Main//decl_in_api_decl_in_impl, loc10_12, loaded [concrete = constants.%C.type] +// CHECK:STDOUT: %Main.import_ref.e5c: type = import_ref Main//decl_in_api_decl_in_impl, loc8_7, loaded [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %Main.import_ref.3f1: type = import_ref Main//decl_in_api_decl_in_impl, loc8_12, loaded [concrete = constants.%C.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -360,11 +346,11 @@ impl () as D; // CHECK:STDOUT: %default.import.loc2_40.1 = import // CHECK:STDOUT: %default.import.loc2_40.2 = import // CHECK:STDOUT: impl_decl @empty_tuple.type.as.C.impl.006 [concrete] {} { -// CHECK:STDOUT: %.loc8_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_7.2: type = converted %.loc8_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc6_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc6_7.2: type = converted %.loc6_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8: = impl_self_witness @empty_tuple.type.as.C.impl.006.%.loc8_7.2, @C [concrete = constants.%.d74] +// CHECK:STDOUT: %.loc6: = impl_self_witness @empty_tuple.type.as.C.impl.006.%.loc6_7.2, @C [concrete = constants.%.d74] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @C [from "fail_decl_in_api_decl_in_impl.carbon"] { @@ -377,7 +363,7 @@ impl () as D; // CHECK:STDOUT: // CHECK:STDOUT: impl @empty_tuple.type.as.C.impl.4b9: imports.%Main.import_ref.e5c as imports.%Main.import_ref.3f1 [from "fail_decl_in_api_decl_in_impl.carbon"]; // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_tuple.type.as.C.impl.006: %.loc8_7.2 as %C.ref; +// CHECK:STDOUT: impl @empty_tuple.type.as.C.impl.006: %.loc6_7.2 as %C.ref; // CHECK:STDOUT: // CHECK:STDOUT: specific @C.WithSelf(constants.%Self) {} // CHECK:STDOUT: @@ -406,11 +392,11 @@ impl () as D; // CHECK:STDOUT: %default.import.loc2_33.2 = import // CHECK:STDOUT: %D.decl: type = interface_decl @D [concrete = constants.%D.type] {} {} // CHECK:STDOUT: impl_decl @empty_tuple.type.as.D.impl [concrete] {} { -// CHECK:STDOUT: %.loc10_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc10_7.2: type = converted %.loc10_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc8_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_7.2: type = converted %.loc8_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [concrete = constants.%D.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10: = impl_self_witness @empty_tuple.type.as.D.impl.%.loc10_7.2, @D [concrete = constants.%.d28] +// CHECK:STDOUT: %.loc8: = impl_self_witness @empty_tuple.type.as.D.impl.%.loc8_7.2, @D [concrete = constants.%.d28] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @D { @@ -424,7 +410,7 @@ impl () as D; // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_tuple.type.as.D.impl: %.loc10_7.2 as %D.ref; +// CHECK:STDOUT: impl @empty_tuple.type.as.D.impl: %.loc8_7.2 as %D.ref; // CHECK:STDOUT: // CHECK:STDOUT: specific @D.WithSelf(constants.%Self) {} // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/orphan.carbon b/toolchain/check/testdata/impl/orphan.carbon index 6cb9e9309868..26d7341a516c 100644 --- a/toolchain/check/testdata/impl/orphan.carbon +++ b/toolchain/check/testdata/impl/orphan.carbon @@ -58,9 +58,7 @@ library "[[@TEST_NAME]]"; import library "imports"; -// CHECK:STDERR: fail_imported_class.carbon:[[@LINE+4]]:1: error: orphan `impl` found; something in the self-type or constraint must be defined in the same file [ImplIsOrphan] -// CHECK:STDERR: impl ImportedC as ImportedY {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_imported_class.carbon:[[@LINE+2]]:1-29: error: orphan `impl` found; something in the self-type or constraint must be defined in the same file [ImplIsOrphan] // CHECK:STDERR: impl ImportedC as ImportedY {} @@ -69,9 +67,7 @@ library "[[@TEST_NAME]]"; import library "imports"; -// CHECK:STDERR: fail_imported_class_for_self_specific.carbon:[[@LINE+4]]:1: error: orphan `impl` found; something in the self-type or constraint must be defined in the same file [ImplIsOrphan] -// CHECK:STDERR: impl ImportedD(ImportedC) as ImportedY {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_imported_class_for_self_specific.carbon:[[@LINE+2]]:1-40: error: orphan `impl` found; something in the self-type or constraint must be defined in the same file [ImplIsOrphan] // CHECK:STDERR: impl ImportedD(ImportedC) as ImportedY {} @@ -80,9 +76,7 @@ library "[[@TEST_NAME]]"; import library "imports"; -// CHECK:STDERR: fail_imported_class_for_interface_specific.carbon:[[@LINE+4]]:1: error: orphan `impl` found; something in the self-type or constraint must be defined in the same file [ImplIsOrphan] -// CHECK:STDERR: impl ImportedC as ImportedZ(ImportedC) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_imported_class_for_interface_specific.carbon:[[@LINE+2]]:1-40: error: orphan `impl` found; something in the self-type or constraint must be defined in the same file [ImplIsOrphan] // CHECK:STDERR: impl ImportedC as ImportedZ(ImportedC) {} @@ -151,9 +145,7 @@ library "[[@TEST_NAME]]"; import library "imports"; -// CHECK:STDERR: fail_generic_class_from_import.carbon:[[@LINE+4]]:1: error: orphan `impl` found; something in the self-type or constraint must be defined in the same file [ImplIsOrphan] -// CHECK:STDERR: impl ImportedAnyParam(ImportedD) as ImportedY {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_generic_class_from_import.carbon:[[@LINE+2]]:1-47: error: orphan `impl` found; something in the self-type or constraint must be defined in the same file [ImplIsOrphan] // CHECK:STDERR: impl ImportedAnyParam(ImportedD) as ImportedY {} @@ -171,9 +163,7 @@ library "[[@TEST_NAME]]"; import library "imports"; -// CHECK:STDERR: fail_generic_interface_from_import.carbon:[[@LINE+4]]:1: error: orphan `impl` found; something in the self-type or constraint must be defined in the same file [ImplIsOrphan] -// CHECK:STDERR: impl ImportedAnyParam(ImportedZ) as ImportedY {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_generic_interface_from_import.carbon:[[@LINE+2]]:1-47: error: orphan `impl` found; something in the self-type or constraint must be defined in the same file [ImplIsOrphan] // CHECK:STDERR: impl ImportedAnyParam(ImportedZ) as ImportedY {} @@ -191,9 +181,7 @@ library "[[@TEST_NAME]]"; import library "imports"; -// CHECK:STDERR: fail_generic_named_constraint_from_import.carbon:[[@LINE+4]]:1: error: orphan `impl` found; something in the self-type or constraint must be defined in the same file [ImplIsOrphan] -// CHECK:STDERR: impl ImportedAnyParam(ImportedN) as ImportedY {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_generic_named_constraint_from_import.carbon:[[@LINE+2]]:1-47: error: orphan `impl` found; something in the self-type or constraint must be defined in the same file [ImplIsOrphan] // CHECK:STDERR: impl ImportedAnyParam(ImportedN) as ImportedY {} @@ -254,9 +242,7 @@ interface Z {} // Neither {} nor Z are defined within or by the scope of `F`. fn F(unused generic T: type) { // TODO: The error should be about being an orphan, not an unused binding. - // CHECK:STDERR: fail_todo_orphan_in_generic_fn_scope.carbon:[[@LINE+4]]:3: error: `impl` with unused generic binding [ImplUnusedBinding] - // CHECK:STDERR: impl {} as Z {} - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_orphan_in_generic_fn_scope.carbon:[[@LINE+2]]:3-16: error: `impl` with unused generic binding [ImplUnusedBinding] // CHECK:STDERR: impl {} as Z {} } @@ -365,10 +351,8 @@ library "[[@TEST_NAME]]"; import library "use_extern_class"; -// CHECK:STDERR: fail_todo_extern_class.carbon:[[@LINE+4]]:1: error: redeclaration of `class C` is redundant [RedeclRedundant] -// CHECK:STDERR: extern class C; -// CHECK:STDERR: ^~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_todo_extern_class.carbon:[[@LINE-5]]:1: in import [InImport] +// CHECK:STDERR: fail_todo_extern_class.carbon:[[@LINE+2]]:1-15: error: redeclaration of `class C` is redundant [RedeclRedundant] +// CHECK:STDERR: imported from: fail_todo_extern_class.carbon:[[@LINE-3]]:1 [InImport] extern class C; // --- fail_use_extern_class.carbon @@ -377,13 +361,9 @@ library "[[@TEST_NAME]]"; import library "imports"; // A non-owning decl of C. -// CHECK:STDERR: fail_use_extern_class.carbon:[[@LINE+8]]:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: extern library "extern_class" class C; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_use_extern_class.carbon:[[@LINE+4]]:1-38: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: -// CHECK:STDERR: fail_use_extern_class.carbon:[[@LINE+4]]:1: error: semantics TODO: `extern library` [SemanticsTodo] -// CHECK:STDERR: extern library "extern_class" class C; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_use_extern_class.carbon:[[@LINE+2]]:1-38: error: semantics TODO: `extern library` [SemanticsTodo] // CHECK:STDERR: extern library "extern_class" class C; diff --git a/toolchain/check/testdata/impl/redeclaration.carbon b/toolchain/check/testdata/impl/redeclaration.carbon index c240b03e4833..6201d84ebb7a 100644 --- a/toolchain/check/testdata/impl/redeclaration.carbon +++ b/toolchain/check/testdata/impl/redeclaration.carbon @@ -49,17 +49,11 @@ class C { } // TODO: This should typecheck (see #5366). -// CHECK:STDERR: fail_todo_redeclaration_reenter_class.carbon:[[@LINE+12]]:9: error: expected expression [ExpectedExpr] -// CHECK:STDERR: impl C.(as Z) {} -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_todo_redeclaration_reenter_class.carbon:[[@LINE+6]]:9-10: error: expected expression [ExpectedExpr] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_redeclaration_reenter_class.carbon:[[@LINE+8]]:9: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] -// CHECK:STDERR: impl C.(as Z) {} -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_todo_redeclaration_reenter_class.carbon:[[@LINE+4]]:9-10: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_redeclaration_reenter_class.carbon:[[@LINE+4]]:15: error: expected `as` in `impl` declaration [ImplExpectedAs] -// CHECK:STDERR: impl C.(as Z) {} -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_todo_redeclaration_reenter_class.carbon:[[@LINE+2]]:15: error: expected `as` in `impl` declaration [ImplExpectedAs] // CHECK:STDERR: impl C.(as Z) {} @@ -75,17 +69,11 @@ class C { } // TODO: This should typecheck (see #5366). -// CHECK:STDERR: fail_todo_redeclaration_reenter_class_explicit_self.carbon:[[@LINE+12]]:9: error: name `Self` not found [NameNotFound] -// CHECK:STDERR: impl C.(Self as Z) {} -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_todo_redeclaration_reenter_class_explicit_self.carbon:[[@LINE+6]]:9-12: error: name `Self` not found [NameNotFound] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_redeclaration_reenter_class_explicit_self.carbon:[[@LINE+8]]:20: error: expected `as` in `impl` declaration [ImplExpectedAs] -// CHECK:STDERR: impl C.(Self as Z) {} -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_todo_redeclaration_reenter_class_explicit_self.carbon:[[@LINE+4]]:20: error: expected `as` in `impl` declaration [ImplExpectedAs] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_redeclaration_reenter_class_explicit_self.carbon:[[@LINE+4]]:1: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] -// CHECK:STDERR: impl C.(Self as Z) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_redeclaration_reenter_class_explicit_self.carbon:[[@LINE+2]]:1-21: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: impl C.(Self as Z) {} @@ -99,17 +87,11 @@ class C { } // TODO: This should typecheck (see #5366). -// CHECK:STDERR: fail_todo_redeclaration_reenter_class_mixed_self_outside.carbon:[[@LINE+12]]:9: error: name `Self` not found [NameNotFound] -// CHECK:STDERR: impl C.(Self as Z) {} -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_todo_redeclaration_reenter_class_mixed_self_outside.carbon:[[@LINE+6]]:9-12: error: name `Self` not found [NameNotFound] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_redeclaration_reenter_class_mixed_self_outside.carbon:[[@LINE+8]]:20: error: expected `as` in `impl` declaration [ImplExpectedAs] -// CHECK:STDERR: impl C.(Self as Z) {} -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_todo_redeclaration_reenter_class_mixed_self_outside.carbon:[[@LINE+4]]:20: error: expected `as` in `impl` declaration [ImplExpectedAs] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_redeclaration_reenter_class_mixed_self_outside.carbon:[[@LINE+4]]:1: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] -// CHECK:STDERR: impl C.(Self as Z) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_redeclaration_reenter_class_mixed_self_outside.carbon:[[@LINE+2]]:1-21: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: impl C.(Self as Z) {} @@ -123,17 +105,11 @@ class C { } // TODO: This should typecheck (see #5366). -// CHECK:STDERR: fail_todo_redeclaration_reenter_class_mixed_self_inside.carbon:[[@LINE+12]]:9: error: expected expression [ExpectedExpr] -// CHECK:STDERR: impl C.(as Z) {} -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_todo_redeclaration_reenter_class_mixed_self_inside.carbon:[[@LINE+6]]:9-10: error: expected expression [ExpectedExpr] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_redeclaration_reenter_class_mixed_self_inside.carbon:[[@LINE+8]]:9: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] -// CHECK:STDERR: impl C.(as Z) {} -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_todo_redeclaration_reenter_class_mixed_self_inside.carbon:[[@LINE+4]]:9-10: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_redeclaration_reenter_class_mixed_self_inside.carbon:[[@LINE+4]]:15: error: expected `as` in `impl` declaration [ImplExpectedAs] -// CHECK:STDERR: impl C.(as Z) {} -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_todo_redeclaration_reenter_class_mixed_self_inside.carbon:[[@LINE+2]]:15: error: expected `as` in `impl` declaration [ImplExpectedAs] // CHECK:STDERR: impl C.(as Z) {} @@ -146,15 +122,11 @@ class C; impl C as Z; class C { - // CHECK:STDERR: fail_redeclaration_inside_class_is_separate_impl.carbon:[[@LINE+3]]:3: error: found non-final `impl` with the same type structure as another non-final `impl` [ImplNonFinalSameTypeStructure] - // CHECK:STDERR: impl C as Z {} - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_redeclaration_inside_class_is_separate_impl.carbon:[[@LINE+1]]:3-15: error: found non-final `impl` with the same type structure as another non-final `impl` [ImplNonFinalSameTypeStructure] impl C as Z {} } -// CHECK:STDERR: fail_redeclaration_inside_class_is_separate_impl.carbon:[[@LINE+4]]:1: note: other `impl` here [ImplNonFinalSameTypeStructureNote] -// CHECK:STDERR: impl C as Z {} -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_redeclaration_inside_class_is_separate_impl.carbon:[[@LINE+2]]:1-13: note: other `impl` here [ImplNonFinalSameTypeStructureNote] // CHECK:STDERR: impl C as Z {} @@ -167,12 +139,8 @@ class C { impl C as Z {} } -// CHECK:STDERR: fail_redeclaration_outside_class_is_separate_impl.carbon:[[@LINE+7]]:1: error: found non-final `impl` with the same type structure as another non-final `impl` [ImplNonFinalSameTypeStructure] -// CHECK:STDERR: impl C as Z {} -// CHECK:STDERR: ^~~~~~~~~~~~~ -// CHECK:STDERR: fail_redeclaration_outside_class_is_separate_impl.carbon:[[@LINE-6]]:3: note: other `impl` here [ImplNonFinalSameTypeStructureNote] -// CHECK:STDERR: impl C as Z {} -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_redeclaration_outside_class_is_separate_impl.carbon:[[@LINE+3]]:1-13: error: found non-final `impl` with the same type structure as another non-final `impl` [ImplNonFinalSameTypeStructure] +// CHECK:STDERR: fail_redeclaration_outside_class_is_separate_impl.carbon:[[@LINE-4]]:3-15: note: other `impl` here [ImplNonFinalSameTypeStructureNote] // CHECK:STDERR: impl C as Z {} @@ -188,12 +156,8 @@ fn F() { return C; } // This is not a redeclaration, since it's in a different scope. - // CHECK:STDERR: fail_redeclaration_in_block_scope_is_separate_impl.carbon:[[@LINE+7]]:3: error: found non-final `impl` with the same type structure as another non-final `impl` [ImplNonFinalSameTypeStructure] - // CHECK:STDERR: impl G() as Z {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_redeclaration_in_block_scope_is_separate_impl.carbon:[[@LINE-7]]:5: note: other `impl` here [ImplNonFinalSameTypeStructureNote] - // CHECK:STDERR: impl C as Z {} - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_redeclaration_in_block_scope_is_separate_impl.carbon:[[@LINE+3]]:3-17: error: found non-final `impl` with the same type structure as another non-final `impl` [ImplNonFinalSameTypeStructure] + // CHECK:STDERR: fail_redeclaration_in_block_scope_is_separate_impl.carbon:[[@LINE-5]]:5-17: note: other `impl` here [ImplNonFinalSameTypeStructureNote] // CHECK:STDERR: impl G() as Z {} } @@ -208,9 +172,7 @@ impl C as Z {} // --- fail_redecl_of_imported_impl.impl.carbon impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_redecl_of_imported_impl.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl] -// CHECK:STDERR: impl C as Z {} -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_redecl_of_imported_impl.impl.carbon:[[@LINE+2]]:1-13: error: redeclaration of imported impl [RedeclImportedImpl] // CHECK:STDERR: impl C as Z {} @@ -229,13 +191,9 @@ class D { // But that means it overlaps fully with the impl from the api file, which is // a separate error. - // CHECK:STDERR: fail_decl_of_imported_impl_in_new_scope.impl.carbon:[[@LINE+8]]:3: error: found non-final `impl` with the same type structure as another non-final `impl` [ImplNonFinalSameTypeStructure] - // CHECK:STDERR: impl C as Z {} - // CHECK:STDERR: ^~~~~~~~~~~~~ - // CHECK:STDERR: fail_decl_of_imported_impl_in_new_scope.impl.carbon:[[@LINE-10]]:1: in import [InImport] - // CHECK:STDERR: decl_of_imported_impl_in_new_scope.carbon:5:1: note: other `impl` here [ImplNonFinalSameTypeStructureNote] - // CHECK:STDERR: impl C as Z {} - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_decl_of_imported_impl_in_new_scope.impl.carbon:[[@LINE+4]]:3-15: error: found non-final `impl` with the same type structure as another non-final `impl` [ImplNonFinalSameTypeStructure] + // CHECK:STDERR: imported from: fail_decl_of_imported_impl_in_new_scope.impl.carbon:[[@LINE-8]]:1 [InImport] + // CHECK:STDERR: decl_of_imported_impl_in_new_scope.carbon:5:1-13: note: other `impl` here [ImplNonFinalSameTypeStructureNote] // CHECK:STDERR: impl C as Z {} } @@ -248,13 +206,9 @@ interface Z {} fn F() { class C {} impl C as Z; - // CHECK:STDERR: fail_redecl_in_fn_scope.carbon:[[@LINE+8]]:3: error: impl redeclaration not in a declarative scope; redeclaration is allowed only in a class or namespace [ImplDeclInInvalidScope] - // CHECK:STDERR: impl C as Z {} - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_redecl_in_fn_scope.carbon:[[@LINE+4]]:3-15: error: impl redeclaration not in a declarative scope; redeclaration is allowed only in a class or namespace [ImplDeclInInvalidScope] // CHECK:STDERR: - // CHECK:STDERR: fail_redecl_in_fn_scope.carbon:[[@LINE-5]]:3: error: impl declared but not defined [ImplMissingDefinition] - // CHECK:STDERR: impl C as Z; - // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_redecl_in_fn_scope.carbon:[[@LINE-3]]:3-14: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl C as Z {} } @@ -270,13 +224,9 @@ fn F() { } fn G() { - // CHECK:STDERR: fail_redecl_in_different_fn_scope.carbon:[[@LINE+8]]:3: error: impl redeclaration not in a declarative scope; redeclaration is allowed only in a class or namespace [ImplDeclInInvalidScope] - // CHECK:STDERR: impl C as Z {} - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_redecl_in_different_fn_scope.carbon:[[@LINE+4]]:3-15: error: impl redeclaration not in a declarative scope; redeclaration is allowed only in a class or namespace [ImplDeclInInvalidScope] // CHECK:STDERR: - // CHECK:STDERR: fail_redecl_in_different_fn_scope.carbon:[[@LINE-8]]:3: error: impl declared but not defined [ImplMissingDefinition] - // CHECK:STDERR: impl C as Z; - // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_redecl_in_different_fn_scope.carbon:[[@LINE-6]]:3-14: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl C as Z {} } @@ -290,13 +240,9 @@ fn F() { if (true) { class C {} impl C as Z; - // CHECK:STDERR: fail_redecl_in_block_scope.carbon:[[@LINE+8]]:5: error: impl redeclaration not in a declarative scope; redeclaration is allowed only in a class or namespace [ImplDeclInInvalidScope] - // CHECK:STDERR: impl C as Z {} - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_redecl_in_block_scope.carbon:[[@LINE+4]]:5-17: error: impl redeclaration not in a declarative scope; redeclaration is allowed only in a class or namespace [ImplDeclInInvalidScope] // CHECK:STDERR: - // CHECK:STDERR: fail_redecl_in_block_scope.carbon:[[@LINE-5]]:5: error: impl declared but not defined [ImplMissingDefinition] - // CHECK:STDERR: impl C as Z; - // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_redecl_in_block_scope.carbon:[[@LINE-3]]:5-16: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl C as Z {} } @@ -313,13 +259,9 @@ fn F() { impl C as Z; } if (true) { - // CHECK:STDERR: fail_redecl_in_different_block_scope.carbon:[[@LINE+8]]:5: error: impl redeclaration not in a declarative scope; redeclaration is allowed only in a class or namespace [ImplDeclInInvalidScope] - // CHECK:STDERR: impl C as Z {} - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_redecl_in_different_block_scope.carbon:[[@LINE+4]]:5-17: error: impl redeclaration not in a declarative scope; redeclaration is allowed only in a class or namespace [ImplDeclInInvalidScope] // CHECK:STDERR: - // CHECK:STDERR: fail_redecl_in_different_block_scope.carbon:[[@LINE-7]]:5: error: impl declared but not defined [ImplMissingDefinition] - // CHECK:STDERR: impl C as Z; - // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_redecl_in_different_block_scope.carbon:[[@LINE-5]]:5-16: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl C as Z {} } diff --git a/toolchain/check/testdata/impl/reenter_scopes.carbon b/toolchain/check/testdata/impl/reenter_scopes.carbon index 85321de2b6f9..00c4da891795 100644 --- a/toolchain/check/testdata/impl/reenter_scopes.carbon +++ b/toolchain/check/testdata/impl/reenter_scopes.carbon @@ -21,17 +21,11 @@ class N.C { class D {} } -// CHECK:STDERR: fail_todo_reenter_class_scope.carbon:[[@LINE+12]]:11: error: expected expression [ExpectedExpr] -// CHECK:STDERR: impl N.C.(as Z) { -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_todo_reenter_class_scope.carbon:[[@LINE+6]]:11-12: error: expected expression [ExpectedExpr] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_reenter_class_scope.carbon:[[@LINE+8]]:11: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] -// CHECK:STDERR: impl N.C.(as Z) { -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_todo_reenter_class_scope.carbon:[[@LINE+4]]:11-12: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_reenter_class_scope.carbon:[[@LINE+4]]:17: error: expected `as` in `impl` declaration [ImplExpectedAs] -// CHECK:STDERR: impl N.C.(as Z) { -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_todo_reenter_class_scope.carbon:[[@LINE+2]]:17: error: expected `as` in `impl` declaration [ImplExpectedAs] // CHECK:STDERR: impl N.C.(as Z) { fn ZF() { @@ -51,21 +45,13 @@ class N.C { class D {} } -// CHECK:STDERR: fail_todo_reenter_class_scope_explicit_self.carbon:[[@LINE+16]]:11: error: name `Self` not found [NameNotFound] -// CHECK:STDERR: impl N.C.(Self as Z) { -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_todo_reenter_class_scope_explicit_self.carbon:[[@LINE+8]]:11-14: error: name `Self` not found [NameNotFound] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_reenter_class_scope_explicit_self.carbon:[[@LINE+12]]:19: error: name `Z` not found [NameNotFound] -// CHECK:STDERR: impl N.C.(Self as Z) { -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_todo_reenter_class_scope_explicit_self.carbon:[[@LINE+6]]:19: error: name `Z` not found [NameNotFound] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_reenter_class_scope_explicit_self.carbon:[[@LINE+8]]:22: error: expected `as` in `impl` declaration [ImplExpectedAs] -// CHECK:STDERR: impl N.C.(Self as Z) { -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_todo_reenter_class_scope_explicit_self.carbon:[[@LINE+4]]:22: error: expected `as` in `impl` declaration [ImplExpectedAs] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_reenter_class_scope_explicit_self.carbon:[[@LINE+4]]:1: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] -// CHECK:STDERR: impl N.C.(Self as Z) { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_reenter_class_scope_explicit_self.carbon:[[@LINE+2]]:1-22: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: impl N.C.(Self as Z) { fn ZF() { @@ -85,21 +71,13 @@ class N.C { class D {} } -// CHECK:STDERR: fail_todo_reenter_class_scope_unrelated_self.carbon:[[@LINE+16]]:11: error: name `D` not found [NameNotFound] -// CHECK:STDERR: impl N.C.(D as Z) { -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_todo_reenter_class_scope_unrelated_self.carbon:[[@LINE+8]]:11: error: name `D` not found [NameNotFound] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_reenter_class_scope_unrelated_self.carbon:[[@LINE+12]]:16: error: name `Z` not found [NameNotFound] -// CHECK:STDERR: impl N.C.(D as Z) { -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_todo_reenter_class_scope_unrelated_self.carbon:[[@LINE+6]]:16: error: name `Z` not found [NameNotFound] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_reenter_class_scope_unrelated_self.carbon:[[@LINE+8]]:19: error: expected `as` in `impl` declaration [ImplExpectedAs] -// CHECK:STDERR: impl N.C.(D as Z) { -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_todo_reenter_class_scope_unrelated_self.carbon:[[@LINE+4]]:19: error: expected `as` in `impl` declaration [ImplExpectedAs] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_reenter_class_scope_unrelated_self.carbon:[[@LINE+4]]:1: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] -// CHECK:STDERR: impl N.C.(D as Z) { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_reenter_class_scope_unrelated_self.carbon:[[@LINE+2]]:1-19: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: impl N.C.(D as Z) { fn ZF() { @@ -117,21 +95,13 @@ class N.C {} class N.D {} // The path outside the parens must point to a class. -// CHECK:STDERR: fail_todo_reenter_namespace_scope.carbon:[[@LINE+16]]:9: error: name `C` not found [NameNotFound] -// CHECK:STDERR: impl N.(C as Z) { -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_todo_reenter_namespace_scope.carbon:[[@LINE+8]]:9: error: name `C` not found [NameNotFound] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_reenter_namespace_scope.carbon:[[@LINE+12]]:14: error: name `Z` not found [NameNotFound] -// CHECK:STDERR: impl N.(C as Z) { -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_todo_reenter_namespace_scope.carbon:[[@LINE+6]]:14: error: name `Z` not found [NameNotFound] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_reenter_namespace_scope.carbon:[[@LINE+8]]:17: error: expected `as` in `impl` declaration [ImplExpectedAs] -// CHECK:STDERR: impl N.(C as Z) { -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_todo_reenter_namespace_scope.carbon:[[@LINE+4]]:17: error: expected `as` in `impl` declaration [ImplExpectedAs] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_reenter_namespace_scope.carbon:[[@LINE+4]]:1: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] -// CHECK:STDERR: impl N.(C as Z) { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_reenter_namespace_scope.carbon:[[@LINE+2]]:1-17: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: impl N.(C as Z) { fn ZF() { diff --git a/toolchain/check/testdata/impl/require_satisified_in_interface.carbon b/toolchain/check/testdata/impl/require_satisified_in_interface.carbon index c3825b9fa80c..070bb6aefbd2 100644 --- a/toolchain/check/testdata/impl/require_satisified_in_interface.carbon +++ b/toolchain/check/testdata/impl/require_satisified_in_interface.carbon @@ -23,9 +23,7 @@ interface Y { impl () as Y; // () needs to impl Z at the start of the definition. -// CHECK:STDERR: fail_missing_extend_require_for_concrete_type.carbon:[[@LINE+4]]:1: error: interface `Y` being implemented requires that `()` implements `Z` [InterfaceRequireImplsNotImplemented] -// CHECK:STDERR: impl () as Y {} -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_missing_extend_require_for_concrete_type.carbon:[[@LINE+2]]:1-14: error: interface `Y` being implemented requires that `()` implements `Z` [InterfaceRequireImplsNotImplemented] // CHECK:STDERR: impl () as Y {} @@ -42,9 +40,7 @@ interface Y { impl () as Y; // () needs to impl Z at the start of the definition. -// CHECK:STDERR: fail_missing_require_for_concrete_type.carbon:[[@LINE+4]]:1: error: interface `Y` being implemented requires that `()` implements `Z` [InterfaceRequireImplsNotImplemented] -// CHECK:STDERR: impl () as Y {} -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_missing_require_for_concrete_type.carbon:[[@LINE+2]]:1-14: error: interface `Y` being implemented requires that `()` implements `Z` [InterfaceRequireImplsNotImplemented] // CHECK:STDERR: impl () as Y {} @@ -61,9 +57,7 @@ interface Y { impl forall [T: type] T as Y; // T needs to impl Z at the start of the definition. -// CHECK:STDERR: fail_missing_extend_require_for_symbolic_type.carbon:[[@LINE+4]]:1: error: interface `Y` being implemented requires that `T` implements `Z` [InterfaceRequireImplsNotImplemented] -// CHECK:STDERR: impl forall [T: type] T as Y {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_missing_extend_require_for_symbolic_type.carbon:[[@LINE+2]]:1-30: error: interface `Y` being implemented requires that `T` implements `Z` [InterfaceRequireImplsNotImplemented] // CHECK:STDERR: impl forall [T: type] T as Y {} @@ -80,9 +74,7 @@ interface Y { impl forall [T: type] T as Y; // T needs to impl Z at the start of the definition. -// CHECK:STDERR: fail_missing_require_for_symbolic_type.carbon:[[@LINE+4]]:1: error: interface `Y` being implemented requires that `T` implements `Z` [InterfaceRequireImplsNotImplemented] -// CHECK:STDERR: impl forall [T: type] T as Y {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_missing_require_for_symbolic_type.carbon:[[@LINE+2]]:1-30: error: interface `Y` being implemented requires that `T` implements `Z` [InterfaceRequireImplsNotImplemented] // CHECK:STDERR: impl forall [T: type] T as Y {} @@ -99,9 +91,7 @@ interface Y(U: type) { extend require impls Z1(U) & Z2(B); } -// CHECK:STDERR: fail_missing_extend_require_double.carbon:[[@LINE+4]]:1: error: interface `Y(A)` being implemented requires that `()` implements `Z1(A) & Z2(B)` [InterfaceRequireImplsNotImplemented] -// CHECK:STDERR: impl () as Y(A) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_missing_extend_require_double.carbon:[[@LINE+2]]:1-17: error: interface `Y(A)` being implemented requires that `()` implements `Z1(A) & Z2(B)` [InterfaceRequireImplsNotImplemented] // CHECK:STDERR: impl () as Y(A) {} @@ -118,9 +108,7 @@ interface Y(U: type) { require impls Z1(U) & Z2(B); } -// CHECK:STDERR: fail_missing_require_double.carbon:[[@LINE+4]]:1: error: interface `Y(A)` being implemented requires that `()` implements `Z1(A) & Z2(B)` [InterfaceRequireImplsNotImplemented] -// CHECK:STDERR: impl () as Y(A) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_missing_require_double.carbon:[[@LINE+2]]:1-17: error: interface `Y(A)` being implemented requires that `()` implements `Z1(A) & Z2(B)` [InterfaceRequireImplsNotImplemented] // CHECK:STDERR: impl () as Y(A) {} @@ -227,9 +215,7 @@ interface Y(U: type) { } // Y requires that C impls Z(Self), but it does not do so. -// CHECK:STDERR: fail_require_non_self_missing.carbon:[[@LINE+4]]:1: error: interface `Y(())` being implemented requires that `C` implements `Z(())` [InterfaceRequireImplsNotImplemented] -// CHECK:STDERR: impl () as Y(()) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_require_non_self_missing.carbon:[[@LINE+2]]:1-18: error: interface `Y(())` being implemented requires that `C` implements `Z(())` [InterfaceRequireImplsNotImplemented] // CHECK:STDERR: impl () as Y(()) {} @@ -318,12 +304,8 @@ impl forall [N: Core.IntLiteral, T: C(N)] T as B(N) { } fn F(generic T: C(-1)) { - // 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: fail_impl_requires_itself_cycle_with_monomorphization_error.carbon:[[@LINE+3]]:3-16: error: unable to monomorphize specific `AA()` [ResolvingSpecificHere] + // CHECK:STDERR: fail_impl_requires_itself_cycle_with_monomorphization_error.carbon:[[@LINE-25]]:26: note: array bound of -1 is negative [ArrayBoundNegative] // CHECK:STDERR: T.(A(-1).AA)(); } diff --git a/toolchain/check/testdata/impl/require_satisified_in_named_constraint.carbon b/toolchain/check/testdata/impl/require_satisified_in_named_constraint.carbon index 8dd2d9450b79..16b8fd5f6d98 100644 --- a/toolchain/check/testdata/impl/require_satisified_in_named_constraint.carbon +++ b/toolchain/check/testdata/impl/require_satisified_in_named_constraint.carbon @@ -25,9 +25,7 @@ constraint N { impl () as N; // () needs to impl Z at the start of the definition. -// CHECK:STDERR: fail_missing_require_for_concrete_type.carbon:[[@LINE+4]]:1: error: constraint `N` being implemented requires that `()` implements `Z` [IdentifiedRequireImplsNotImplemented] -// CHECK:STDERR: impl () as N {} -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_missing_require_for_concrete_type.carbon:[[@LINE+2]]:1-14: error: constraint `N` being implemented requires that `()` implements `Z` [IdentifiedRequireImplsNotImplemented] // CHECK:STDERR: impl () as N {} @@ -46,9 +44,7 @@ constraint N { impl forall [T: type] T as N; // T needs to impl Z at the start of the definition. -// CHECK:STDERR: fail_missing_require_for_symbolic_type.carbon:[[@LINE+4]]:1: error: constraint `N` being implemented requires that `T` implements `Z` [IdentifiedRequireImplsNotImplemented] -// CHECK:STDERR: impl forall [T: type] T as N {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_missing_require_for_symbolic_type.carbon:[[@LINE+2]]:1-30: error: constraint `N` being implemented requires that `T` implements `Z` [IdentifiedRequireImplsNotImplemented] // CHECK:STDERR: impl forall [T: type] T as N {} @@ -171,13 +167,9 @@ impl () as N; // Wrong type for the requirement. impl () as Z where .Z1 = {}; -// CHECK:STDERR: fail_require_non_extended_rewrite_wrong_type.carbon:[[@LINE+8]]:1: error: constraint `N` being implemented requires that `().(Z.Z1)` equals `()`; found `{}` and `()` [IdentifiedRequireImplsNotEquivalent] -// CHECK:STDERR: impl () as N {} -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_require_non_extended_rewrite_wrong_type.carbon:[[@LINE+4]]:1-14: error: constraint `N` being implemented requires that `().(Z.Z1)` equals `()`; found `{}` and `()` [IdentifiedRequireImplsNotEquivalent] // CHECK:STDERR: -// CHECK:STDERR: fail_require_non_extended_rewrite_wrong_type.carbon:[[@LINE-6]]:1: error: impl declared but not defined [ImplMissingDefinition] -// CHECK:STDERR: impl () as Z where .Z1 = {}; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_require_non_extended_rewrite_wrong_type.carbon:[[@LINE-4]]:1-28: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl () as N {} @@ -210,8 +202,6 @@ constraint N { } // Wrong type for `.Z1`. -// CHECK:STDERR: fail_require_non_extended_rewrite_same_interface_wrong_type.carbon:[[@LINE+4]]:1: error: constraint `N where .(Z.Z1) = {}` being implemented requires that `().(Z.Z1)` equals `()`; found `{}` and `()` [IdentifiedRequireImplsNotEquivalent] -// CHECK:STDERR: impl () as N where .Z1 = {} {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_require_non_extended_rewrite_same_interface_wrong_type.carbon:[[@LINE+2]]:1-29: error: constraint `N where .(Z.Z1) = {}` being implemented requires that `().(Z.Z1)` equals `()`; found `{}` and `()` [IdentifiedRequireImplsNotEquivalent] // CHECK:STDERR: impl () as N where .Z1 = {} {} diff --git a/toolchain/check/testdata/impl/rewrites.carbon b/toolchain/check/testdata/impl/rewrites.carbon index 75766230f9a7..913bc9aa3d5b 100644 --- a/toolchain/check/testdata/impl/rewrites.carbon +++ b/toolchain/check/testdata/impl/rewrites.carbon @@ -28,9 +28,7 @@ interface I { let X: type; } interface J {} // .X does not impl J. -// CHECK:STDERR: fail_rewrite_in_facet_type_before_missing_impl.carbon:[[@LINE+4]]:1: error: constraint `I where () impls J and .(I.X) = ()` being implemented requires that `()` implements `J` [IdentifiedRequireImplsNotImplemented] -// CHECK:STDERR: impl forall [T: type] T as I where .X = () and .X impls J {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_rewrite_in_facet_type_before_missing_impl.carbon:[[@LINE+2]]:1-59: error: constraint `I where () impls J and .(I.X) = ()` being implemented requires that `()` implements `J` [IdentifiedRequireImplsNotImplemented] // CHECK:STDERR: impl forall [T: type] T as I where .X = () and .X impls J {} @@ -53,9 +51,7 @@ interface I { let X: type; } interface J {} // .X does not impl J. -// CHECK:STDERR: fail_rewrite_in_facet_type_after_missing_impl.carbon:[[@LINE+4]]:1: error: constraint `I where .(I.X) impls J and .(I.X) = ()` being implemented requires that `()` implements `J` [IdentifiedRequireImplsNotImplemented] -// CHECK:STDERR: impl forall [T: type] T as I where .X impls J and .X = () {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_rewrite_in_facet_type_after_missing_impl.carbon:[[@LINE+2]]:1-59: error: constraint `I where .(I.X) impls J and .(I.X) = ()` being implemented requires that `()` implements `J` [IdentifiedRequireImplsNotImplemented] // CHECK:STDERR: impl forall [T: type] T as I where .X impls J and .X = () {} @@ -85,9 +81,7 @@ constraint GivesI { } // .X does not impl J. -// CHECK:STDERR: fail_rewrite_in_named_constraint_missing_impl.carbon:[[@LINE+4]]:1: error: constraint `GivesI where .(I.X) impls J` being implemented requires that `()` implements `J` [IdentifiedRequireImplsNotImplemented] -// CHECK:STDERR: impl forall [T: type] T as GivesI where .X impls J {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_rewrite_in_named_constraint_missing_impl.carbon:[[@LINE+2]]:1-52: error: constraint `GivesI where .(I.X) impls J` being implemented requires that `()` implements `J` [IdentifiedRequireImplsNotImplemented] // CHECK:STDERR: impl forall [T: type] T as GivesI where .X impls J {} @@ -119,9 +113,7 @@ constraint GivesI { } // .X does not impl J. -// CHECK:STDERR: fail_rewrite_and_impls_in_named_constraint_missing_impl.carbon:[[@LINE+4]]:1: error: constraint `GivesI` being implemented requires that `()` implements `J` [IdentifiedRequireImplsNotImplemented] -// CHECK:STDERR: impl forall [T: type] T as GivesI {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_rewrite_and_impls_in_named_constraint_missing_impl.carbon:[[@LINE+2]]:1-35: error: constraint `GivesI` being implemented requires that `()` implements `J` [IdentifiedRequireImplsNotImplemented] // CHECK:STDERR: impl forall [T: type] T as GivesI {} diff --git a/toolchain/check/testdata/impl/use_assoc_entity.carbon b/toolchain/check/testdata/impl/use_assoc_entity.carbon index cf07eb398274..021a9774e2f8 100644 --- a/toolchain/check/testdata/impl/use_assoc_entity.carbon +++ b/toolchain/check/testdata/impl/use_assoc_entity.carbon @@ -268,33 +268,19 @@ class A {} // TODO: Make sure this behaves reasonably once we support `where` declarations. -// CHECK:STDERR: fail_todo_associated_constant_use_before_value_known.carbon:[[@LINE+14]]:1: error: associated constant T not given a value in impl of interface J [ImplAssociatedConstantNeedsValue] -// CHECK:STDERR: impl A as J { -// CHECK:STDERR: ^~~~~~~~~~~~~ -// CHECK:STDERR: fail_todo_associated_constant_use_before_value_known.carbon:[[@LINE-11]]:7: note: associated constant declared here [AssociatedConstantHere] -// CHECK:STDERR: let T: type; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_todo_associated_constant_use_before_value_known.carbon:[[@LINE+6]]:1-13: error: associated constant T not given a value in impl of interface J [ImplAssociatedConstantNeedsValue] +// CHECK:STDERR: fail_todo_associated_constant_use_before_value_known.carbon:[[@LINE-9]]:7-13: note: associated constant declared here [AssociatedConstantHere] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_associated_constant_use_before_value_known.carbon:[[@LINE+7]]:1: error: associated constant U not given a value in impl of interface J [ImplAssociatedConstantNeedsValue] -// CHECK:STDERR: impl A as J { -// CHECK:STDERR: ^~~~~~~~~~~~~ -// CHECK:STDERR: fail_todo_associated_constant_use_before_value_known.carbon:[[@LINE-17]]:7: note: associated constant declared here [AssociatedConstantHere] -// CHECK:STDERR: let U: type; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_todo_associated_constant_use_before_value_known.carbon:[[@LINE+3]]:1-13: error: associated constant U not given a value in impl of interface J [ImplAssociatedConstantNeedsValue] +// CHECK:STDERR: fail_todo_associated_constant_use_before_value_known.carbon:[[@LINE-11]]:7-13: note: associated constant declared here [AssociatedConstantHere] // CHECK:STDERR: impl A as J { - // CHECK:STDERR: fail_todo_associated_constant_use_before_value_known.carbon:[[@LINE+8]]:3: error: unrecognized declaration introducer [UnrecognizedDecl] - // CHECK:STDERR: where .U = T; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_todo_associated_constant_use_before_value_known.carbon:[[@LINE+4]]:3-7: error: unrecognized declaration introducer [UnrecognizedDecl] // CHECK:STDERR: - // CHECK:STDERR: fail_todo_associated_constant_use_before_value_known.carbon:[[@LINE+4]]:3: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] - // CHECK:STDERR: where .U = T; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_todo_associated_constant_use_before_value_known.carbon:[[@LINE+2]]:3-7: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: where .U = T; - // CHECK:STDERR: fail_todo_associated_constant_use_before_value_known.carbon:[[@LINE+4]]:3: error: unrecognized declaration introducer [UnrecognizedDecl] - // CHECK:STDERR: where .T = (); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_todo_associated_constant_use_before_value_known.carbon:[[@LINE+2]]:3-7: error: unrecognized declaration introducer [UnrecognizedDecl] // CHECK:STDERR: where .T = (); } @@ -332,9 +318,7 @@ impl A as J { // definition of `G()` until the enclosing `impl` is complete. // TODO: Diagnose this better. eval fn G() -> type { return A; } - // CHECK:STDERR: fail_associated_fn_use_in_decl_after_decl.carbon:[[@LINE+4]]:13: error: cannot evaluate type expression [TypeExprEvaluationFailure] - // CHECK:STDERR: fn F() -> G(); - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_associated_fn_use_in_decl_after_decl.carbon:[[@LINE+2]]:13-15: error: cannot evaluate type expression [TypeExprEvaluationFailure] // CHECK:STDERR: fn F() -> G(); } @@ -350,9 +334,7 @@ interface J { class A {} impl A as J { - // CHECK:STDERR: fail_associated_fn_use_in_decl_before_decl.carbon:[[@LINE+4]]:13: error: accessing member from impl before it has a defined value [ImplAccessMemberBeforeSet] - // CHECK:STDERR: fn F() -> G(); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_associated_fn_use_in_decl_before_decl.carbon:[[@LINE+2]]:13: error: accessing member from impl before it has a defined value [ImplAccessMemberBeforeSet] // CHECK:STDERR: fn F() -> G(); eval fn G() -> type { return A; } @@ -363,19 +345,11 @@ library "[[@TEST_NAME]]"; interface J2 { let U2: type; - // CHECK:STDERR: fail_todo_self_period_associated_type.carbon:[[@LINE+14]]:17: error: member access into facet of incomplete type `J2` [IncompleteTypeInMemberAccessOfFacet] - // CHECK:STDERR: fn F(self, z: Self.U2) -> Self.U2; - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_todo_self_period_associated_type.carbon:[[@LINE-5]]:1: note: interface is currently being defined [InterfaceIncompleteWithinDefinition] - // CHECK:STDERR: interface J2 { - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_self_period_associated_type.carbon:[[@LINE+6]]:17-20: error: member access into facet of incomplete type `J2` [IncompleteTypeInMemberAccessOfFacet] + // CHECK:STDERR: fail_todo_self_period_associated_type.carbon:[[@LINE-3]]:1-14: note: interface is currently being defined [InterfaceIncompleteWithinDefinition] // CHECK:STDERR: - // CHECK:STDERR: fail_todo_self_period_associated_type.carbon:[[@LINE+7]]:29: error: member access into facet of incomplete type `J2` [IncompleteTypeInMemberAccessOfFacet] - // CHECK:STDERR: fn F(self, z: Self.U2) -> Self.U2; - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_todo_self_period_associated_type.carbon:[[@LINE-12]]:1: note: interface is currently being defined [InterfaceIncompleteWithinDefinition] - // CHECK:STDERR: interface J2 { - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_self_period_associated_type.carbon:[[@LINE+3]]:29-32: error: member access into facet of incomplete type `J2` [IncompleteTypeInMemberAccessOfFacet] + // CHECK:STDERR: fail_todo_self_period_associated_type.carbon:[[@LINE-6]]:1-14: note: interface is currently being defined [InterfaceIncompleteWithinDefinition] // CHECK:STDERR: fn F(self, z: Self.U2) -> Self.U2; } @@ -403,19 +377,11 @@ interface K { } impl () as K where .V = {.a: ()} { - // CHECK:STDERR: fail_associated_type_in_signature_mismatch.carbon:[[@LINE+14]]:21: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn F(unused self, v: {.x: ()}) -> {.x: ()} { return v; } - // CHECK:STDERR: ^~~~~~~~~~~ - // CHECK:STDERR: fail_associated_type_in_signature_mismatch.carbon:[[@LINE-7]]:3: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: fn F(self, v: V) -> V; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_associated_type_in_signature_mismatch.carbon:[[@LINE+6]]:21-31: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: fail_associated_type_in_signature_mismatch.carbon:[[@LINE-5]]:3-24: note: while building thunk to match the signature of this function [ThunkSignature] // CHECK:STDERR: - // CHECK:STDERR: fail_associated_type_in_signature_mismatch.carbon:[[@LINE+7]]:3: error: cannot convert from struct type `{.x: ()}` to `{.a: ()}`: unexpected field `x` in source type [StructInitUnexpectedFieldInConversion] - // CHECK:STDERR: fn F(unused self, v: {.x: ()}) -> {.x: ()} { return v; } - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_associated_type_in_signature_mismatch.carbon:[[@LINE-14]]:3: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: fn F(self, v: V) -> V; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_associated_type_in_signature_mismatch.carbon:[[@LINE+3]]:3-46: error: cannot convert from struct type `{.x: ()}` to `{.a: ()}`: unexpected field `x` in source type [StructInitUnexpectedFieldInConversion] + // CHECK:STDERR: fail_associated_type_in_signature_mismatch.carbon:[[@LINE-8]]:3-24: note: while building thunk to match the signature of this function [ThunkSignature] // CHECK:STDERR: fn F(unused self, v: {.x: ()}) -> {.x: ()} { return v; } } diff --git a/toolchain/check/testdata/impl/using_invalid_interface.carbon b/toolchain/check/testdata/impl/using_invalid_interface.carbon index ee77dbeb41d2..90a8e9875074 100644 --- a/toolchain/check/testdata/impl/using_invalid_interface.carbon +++ b/toolchain/check/testdata/impl/using_invalid_interface.carbon @@ -19,12 +19,8 @@ class ArgToI(T: I) {} interface IMisuse { let Arg: type; - // CHECK:STDERR: fail_invalid_interface.carbon:[[@LINE+7]]:18: error: cannot convert type `Arg` into type implementing `I` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fn Op(self) -> ArgToI(Arg); - // CHECK:STDERR: ^~~~~~~~~~~ - // CHECK:STDERR: fail_invalid_interface.carbon:[[@LINE-7]]:14: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: class ArgToI(T: I) {} - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_invalid_interface.carbon:[[@LINE+3]]:18-28: error: cannot convert type `Arg` into type implementing `I` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_invalid_interface.carbon:[[@LINE-5]]:14-17: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: fn Op(self) -> ArgToI(Arg); } @@ -35,14 +31,10 @@ library "[[@TEST_NAME]]"; import library "invalid_interface"; class C { - // CHECK:STDERR: fail_misusing_invalid_interface.carbon:[[@LINE+4]]:32: error: name `T` not found [NameNotFound] - // CHECK:STDERR: impl as IMisuse where .Arg = T { - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_misusing_invalid_interface.carbon:[[@LINE+2]]:32: error: name `T` not found [NameNotFound] // CHECK:STDERR: impl as IMisuse where .Arg = T { - // CHECK:STDERR: fail_misusing_invalid_interface.carbon:[[@LINE+4]]:34: error: name `T` not found [NameNotFound] - // CHECK:STDERR: fn Op(unused self) -> ArgToI(T) { - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_misusing_invalid_interface.carbon:[[@LINE+2]]:34: error: name `T` not found [NameNotFound] // CHECK:STDERR: fn Op(unused self) -> ArgToI(T) { return {}; @@ -50,27 +42,17 @@ class C { } } -// CHECK:STDERR: fail_misusing_invalid_interface.carbon:[[@LINE+8]]:28: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] -// CHECK:STDERR: fn F(generic T: IMisuse) { T.Op(); } -// CHECK:STDERR: ^~~~~~ -// CHECK:STDERR: fail_misusing_invalid_interface.carbon:[[@LINE-21]]:1: in import [InImport] -// CHECK:STDERR: fail_invalid_interface.carbon:16:3: note: calling function declared here [InCallToEntity] -// CHECK:STDERR: fn Op(self) -> ArgToI(Arg); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_misusing_invalid_interface.carbon:[[@LINE+4]]:28-33: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] +// CHECK:STDERR: imported from: fail_misusing_invalid_interface.carbon:[[@LINE-15]]:1 [InImport] +// CHECK:STDERR: fail_invalid_interface.carbon:12:3-29: note: calling function declared here [InCallToEntity] // CHECK:STDERR: fn F(generic T: IMisuse) { T.Op(); } fn G() { var c: C; - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: F(c); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_misusing_invalid_interface.carbon:[[@LINE-10]]:14: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(generic T: IMisuse) { T.Op(); } - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_misusing_invalid_interface.carbon:[[@LINE+4]]:3-6: error: cannot implicitly convert non-type value of type `C` into type implementing `IMisuse` [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: fail_misusing_invalid_interface.carbon:[[@LINE+3]]:3-6: note: type `C` does not implement interface `Core.ImplicitAs(IMisuse)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: fail_misusing_invalid_interface.carbon:[[@LINE-6]]:14-23: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: F(c); } @@ -84,13 +66,9 @@ class ArgC {} class C { impl as IMisuse where .Arg = ArgC { - // CHECK:STDERR: fail_using_invalid_interface.carbon:[[@LINE+8]]:27: error: cannot convert type `ArgC` into type implementing `I` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fn Op(unused self) -> ArgToI(ArgC) { - // CHECK:STDERR: ^~~~~~~~~~~~ - // CHECK:STDERR: fail_using_invalid_interface.carbon:[[@LINE-9]]:1: in import [InImport] - // CHECK:STDERR: fail_invalid_interface.carbon:5:14: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: class ArgToI(T: I) {} - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_using_invalid_interface.carbon:[[@LINE+4]]:27-38: error: cannot convert type `ArgC` into type implementing `I` [ConversionFailureTypeToFacet] + // CHECK:STDERR: imported from: fail_using_invalid_interface.carbon:[[@LINE-7]]:1 [InImport] + // CHECK:STDERR: fail_invalid_interface.carbon:5:14-17: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: fn Op(unused self) -> ArgToI(ArgC) { return {}; @@ -98,27 +76,17 @@ class C { } } -// CHECK:STDERR: fail_using_invalid_interface.carbon:[[@LINE+8]]:28: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] -// CHECK:STDERR: fn F(generic T: IMisuse) { T.Op(); } -// CHECK:STDERR: ^~~~~~ -// CHECK:STDERR: fail_using_invalid_interface.carbon:[[@LINE-23]]:1: in import [InImport] -// CHECK:STDERR: fail_invalid_interface.carbon:16:3: note: calling function declared here [InCallToEntity] -// CHECK:STDERR: fn Op(self) -> ArgToI(Arg); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_using_invalid_interface.carbon:[[@LINE+4]]:28-33: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] +// CHECK:STDERR: imported from: fail_using_invalid_interface.carbon:[[@LINE-17]]:1 [InImport] +// CHECK:STDERR: fail_invalid_interface.carbon:12:3-29: note: calling function declared here [InCallToEntity] // CHECK:STDERR: fn F(generic T: IMisuse) { T.Op(); } fn G() { var c: C; - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: F(c); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_using_invalid_interface.carbon:[[@LINE-10]]:14: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(generic T: IMisuse) { T.Op(); } - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_using_invalid_interface.carbon:[[@LINE+4]]:3-6: error: cannot implicitly convert non-type value of type `C` into type implementing `IMisuse` [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: fail_using_invalid_interface.carbon:[[@LINE+3]]:3-6: note: type `C` does not implement interface `Core.ImplicitAs(IMisuse)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: fail_using_invalid_interface.carbon:[[@LINE-6]]:14-23: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: F(c); } diff --git a/toolchain/check/testdata/index/fail_array_large_index.carbon b/toolchain/check/testdata/index/fail_array_large_index.carbon index c95dfadd3ba6..d379809b1d03 100644 --- a/toolchain/check/testdata/index/fail_array_large_index.carbon +++ b/toolchain/check/testdata/index/fail_array_large_index.carbon @@ -14,15 +14,11 @@ var a: array(i32, 1) = (12,); -// CHECK:STDERR: fail_array_large_index.carbon:[[@LINE+4]]:16: error: array index `1` is past the end of type `array(i32, 1)` [ArrayIndexOutOfBounds] -// CHECK:STDERR: var b: i32 = a[1]; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_array_large_index.carbon:[[@LINE+2]]:16: error: array index `1` is past the end of type `array(i32, 1)` [ArrayIndexOutOfBounds] // CHECK:STDERR: var b: i32 = a[1]; -// CHECK:STDERR: fail_array_large_index.carbon:[[@LINE+4]]:16: error: array index `2147483647` is past the end of type `array(i32, 1)` [ArrayIndexOutOfBounds] -// CHECK:STDERR: var c: i32 = a[0x7FFF_FFFF]; -// CHECK:STDERR: ^~~~~~~~~~~ +// CHECK:STDERR: fail_array_large_index.carbon:[[@LINE+2]]:16-26: error: array index `2147483647` is past the end of type `array(i32, 1)` [ArrayIndexOutOfBounds] // CHECK:STDERR: var c: i32 = a[0x7FFF_FFFF]; @@ -126,14 +122,14 @@ var c: i32 = a[0x7FFF_FFFF]; // CHECK:STDOUT: %a.var_patt: %pattern_type.dc1 = var_pattern %a.patt [concrete = constants.%a.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %b.var: ref %i32 = var_storage %b.var_patt [concrete] -// CHECK:STDOUT: %i32.loc21: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc19: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %b: ref %i32 = wrapper_binding b, %b.var [concrete = %b.var] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %b.patt: %pattern_type.d94 = ref_binding_pattern b [concrete = constants.%b.patt] // CHECK:STDOUT: %b.var_patt: %pattern_type.d94 = var_pattern %b.patt [concrete = constants.%b.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %c.var: ref %i32 = var_storage %c.var_patt [concrete] -// CHECK:STDOUT: %i32.loc27: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc23: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %c: ref %i32 = wrapper_binding c, %c.var [concrete = %c.var] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %c.patt: %pattern_type.d94 = ref_binding_pattern c [concrete = constants.%c.patt] @@ -157,40 +153,40 @@ var c: i32 = a[0x7FFF_FFFF]; // CHECK:STDOUT: %.loc15_28.5: init %Array.00c to file.%a.var = array_init (%.loc15_28.4) [concrete = constants.%array] // CHECK:STDOUT: %.loc15_1: init %Array.00c = converted %.loc15_28.1, %.loc15_28.5 [concrete = constants.%array] // CHECK:STDOUT: assign file.%a.var, %.loc15_1 -// CHECK:STDOUT: %a.ref.loc21: ref %Array.00c = name_ref a, file.%a [concrete = file.%a.var] +// CHECK:STDOUT: %a.ref.loc19: ref %Array.00c = name_ref a, file.%a [concrete = file.%a.var] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %impl.elem0.loc21_16: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc21_16.1: = bound_method %int_1, %impl.elem0.loc21_16 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] -// CHECK:STDOUT: %specific_fn.loc21_16: = specific_function %impl.elem0.loc21_16, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc21_16.2: = bound_method %int_1, %specific_fn.loc21_16 [concrete = constants.%bound_method.3bd] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc21: init %i32 = call %bound_method.loc21_16.2(%int_1) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc21_16.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc21 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc21_16.2: %i32 = converted %int_1, %.loc21_16.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc21_17.1: ref %i32 = array_index %a.ref.loc21, %.loc21_16.2 [concrete = ] -// CHECK:STDOUT: %.loc21_17.2: %i32 = acquire_value %.loc21_17.1 [concrete = ] -// CHECK:STDOUT: %impl.elem0.loc21_17: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] -// CHECK:STDOUT: %bound_method.loc21_17.1: = bound_method %.loc21_17.2, %impl.elem0.loc21_17 [concrete = ] -// CHECK:STDOUT: %specific_fn.loc21_17: = specific_function %impl.elem0.loc21_17, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc21_17.2: = bound_method %.loc21_17.2, %specific_fn.loc21_17 [concrete = ] -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc21: init %i32 = call %bound_method.loc21_17.2(%.loc21_17.2) [concrete = ] -// CHECK:STDOUT: assign file.%b.var, %Int.as.Copy.impl.Op.call.loc21 -// CHECK:STDOUT: %a.ref.loc27: ref %Array.00c = name_ref a, file.%a [concrete = file.%a.var] +// CHECK:STDOUT: %impl.elem0.loc19_16: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc19_16.1: = bound_method %int_1, %impl.elem0.loc19_16 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] +// CHECK:STDOUT: %specific_fn.loc19_16: = specific_function %impl.elem0.loc19_16, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc19_16.2: = bound_method %int_1, %specific_fn.loc19_16 [concrete = constants.%bound_method.3bd] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc19: init %i32 = call %bound_method.loc19_16.2(%int_1) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc19_16.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc19 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc19_16.2: %i32 = converted %int_1, %.loc19_16.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc19_17.1: ref %i32 = array_index %a.ref.loc19, %.loc19_16.2 [concrete = ] +// CHECK:STDOUT: %.loc19_17.2: %i32 = acquire_value %.loc19_17.1 [concrete = ] +// CHECK:STDOUT: %impl.elem0.loc19_17: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] +// CHECK:STDOUT: %bound_method.loc19_17.1: = bound_method %.loc19_17.2, %impl.elem0.loc19_17 [concrete = ] +// CHECK:STDOUT: %specific_fn.loc19_17: = specific_function %impl.elem0.loc19_17, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc19_17.2: = bound_method %.loc19_17.2, %specific_fn.loc19_17 [concrete = ] +// CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc19: init %i32 = call %bound_method.loc19_17.2(%.loc19_17.2) [concrete = ] +// CHECK:STDOUT: assign file.%b.var, %Int.as.Copy.impl.Op.call.loc19 +// CHECK:STDOUT: %a.ref.loc23: ref %Array.00c = name_ref a, file.%a [concrete = file.%a.var] // CHECK:STDOUT: %int_2147483647: Core.IntLiteral = int_value 2147483647 [concrete = constants.%int_2147483647.d89] -// CHECK:STDOUT: %impl.elem0.loc27_16: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc27_16.1: = bound_method %int_2147483647, %impl.elem0.loc27_16 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.90a] -// CHECK:STDOUT: %specific_fn.loc27_16: = specific_function %impl.elem0.loc27_16, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc27_16.2: = bound_method %int_2147483647, %specific_fn.loc27_16 [concrete = constants.%bound_method.eca] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc27: init %i32 = call %bound_method.loc27_16.2(%int_2147483647) [concrete = constants.%int_2147483647.85c] -// CHECK:STDOUT: %.loc27_16.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc27 [concrete = constants.%int_2147483647.85c] -// CHECK:STDOUT: %.loc27_16.2: %i32 = converted %int_2147483647, %.loc27_16.1 [concrete = constants.%int_2147483647.85c] -// CHECK:STDOUT: %.loc27_27.1: ref %i32 = array_index %a.ref.loc27, %.loc27_16.2 [concrete = ] -// CHECK:STDOUT: %.loc27_27.2: %i32 = acquire_value %.loc27_27.1 [concrete = ] -// CHECK:STDOUT: %impl.elem0.loc27_27: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] -// CHECK:STDOUT: %bound_method.loc27_27.1: = bound_method %.loc27_27.2, %impl.elem0.loc27_27 [concrete = ] -// CHECK:STDOUT: %specific_fn.loc27_27: = specific_function %impl.elem0.loc27_27, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc27_27.2: = bound_method %.loc27_27.2, %specific_fn.loc27_27 [concrete = ] -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc27: init %i32 = call %bound_method.loc27_27.2(%.loc27_27.2) [concrete = ] -// CHECK:STDOUT: assign file.%c.var, %Int.as.Copy.impl.Op.call.loc27 +// CHECK:STDOUT: %impl.elem0.loc23_16: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc23_16.1: = bound_method %int_2147483647, %impl.elem0.loc23_16 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.90a] +// CHECK:STDOUT: %specific_fn.loc23_16: = specific_function %impl.elem0.loc23_16, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc23_16.2: = bound_method %int_2147483647, %specific_fn.loc23_16 [concrete = constants.%bound_method.eca] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc23: init %i32 = call %bound_method.loc23_16.2(%int_2147483647) [concrete = constants.%int_2147483647.85c] +// CHECK:STDOUT: %.loc23_16.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc23 [concrete = constants.%int_2147483647.85c] +// CHECK:STDOUT: %.loc23_16.2: %i32 = converted %int_2147483647, %.loc23_16.1 [concrete = constants.%int_2147483647.85c] +// CHECK:STDOUT: %.loc23_27.1: ref %i32 = array_index %a.ref.loc23, %.loc23_16.2 [concrete = ] +// CHECK:STDOUT: %.loc23_27.2: %i32 = acquire_value %.loc23_27.1 [concrete = ] +// CHECK:STDOUT: %impl.elem0.loc23_27: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] +// CHECK:STDOUT: %bound_method.loc23_27.1: = bound_method %.loc23_27.2, %impl.elem0.loc23_27 [concrete = ] +// CHECK:STDOUT: %specific_fn.loc23_27: = specific_function %impl.elem0.loc23_27, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc23_27.2: = bound_method %.loc23_27.2, %specific_fn.loc23_27 [concrete = ] +// CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc23: init %i32 = call %bound_method.loc23_27.2(%.loc23_27.2) [concrete = ] +// CHECK:STDOUT: assign file.%c.var, %Int.as.Copy.impl.Op.call.loc23 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: 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 da038037d2ff..fd180a5097f9 100644 --- a/toolchain/check/testdata/index/fail_array_non_int_indexing.carbon +++ b/toolchain/check/testdata/index/fail_array_non_int_indexing.carbon @@ -13,12 +13,8 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_array_non_int_indexing.carbon 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)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var b: i32 = a[2.6]; -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_array_non_int_indexing.carbon:[[@LINE+3]]:16-18: error: cannot implicitly convert expression of type `Core.FloatLiteral` to `i32` [ConversionFailure] +// CHECK:STDERR: fail_array_non_int_indexing.carbon:[[@LINE+2]]:16-18: note: type `Core.FloatLiteral` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var b: i32 = a[2.6]; @@ -113,7 +109,7 @@ var b: i32 = a[2.6]; // CHECK:STDOUT: %a.var_patt: %pattern_type.dc1 = var_pattern %a.patt [concrete = constants.%a.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %b.var: ref %i32 = var_storage %b.var_patt [concrete] -// CHECK:STDOUT: %i32.loc23: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc19: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %b: ref %i32 = wrapper_binding b, %b.var [concrete = %b.var] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %b.patt: %pattern_type.d94 = ref_binding_pattern b [concrete = constants.%b.patt] @@ -139,14 +135,14 @@ var b: i32 = a[2.6]; // CHECK:STDOUT: assign file.%a.var, %.loc15_1 // CHECK:STDOUT: %a.ref: ref %Array.00c = name_ref a, file.%a [concrete = file.%a.var] // CHECK:STDOUT: %float: Core.FloatLiteral = float_literal_value 26e-1 [concrete = constants.%float] -// CHECK:STDOUT: %.loc23_16: %i32 = converted %float, [concrete = ] -// CHECK:STDOUT: %.loc23_19.1: ref %i32 = array_index %a.ref, [concrete = ] -// CHECK:STDOUT: %.loc23_19.2: %i32 = acquire_value %.loc23_19.1 [concrete = ] -// CHECK:STDOUT: %impl.elem0.loc23: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] -// CHECK:STDOUT: %bound_method.loc23_19.1: = bound_method %.loc23_19.2, %impl.elem0.loc23 [concrete = ] -// CHECK:STDOUT: %specific_fn.loc23: = specific_function %impl.elem0.loc23, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc23_19.2: = bound_method %.loc23_19.2, %specific_fn.loc23 [concrete = ] -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc23_19.2(%.loc23_19.2) [concrete = ] +// CHECK:STDOUT: %.loc19_16: %i32 = converted %float, [concrete = ] +// CHECK:STDOUT: %.loc19_19.1: ref %i32 = array_index %a.ref, [concrete = ] +// CHECK:STDOUT: %.loc19_19.2: %i32 = acquire_value %.loc19_19.1 [concrete = ] +// CHECK:STDOUT: %impl.elem0.loc19: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] +// CHECK:STDOUT: %bound_method.loc19_19.1: = bound_method %.loc19_19.2, %impl.elem0.loc19 [concrete = ] +// CHECK:STDOUT: %specific_fn.loc19: = specific_function %impl.elem0.loc19, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc19_19.2: = bound_method %.loc19_19.2, %specific_fn.loc19 [concrete = ] +// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc19_19.2(%.loc19_19.2) [concrete = ] // CHECK:STDOUT: assign file.%b.var, %Int.as.Copy.impl.Op.call // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/fail_array_out_of_bound_access.carbon b/toolchain/check/testdata/index/fail_array_out_of_bound_access.carbon index 559e3f3ab885..d068ffedc443 100644 --- a/toolchain/check/testdata/index/fail_array_out_of_bound_access.carbon +++ b/toolchain/check/testdata/index/fail_array_out_of_bound_access.carbon @@ -13,9 +13,7 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_array_out_of_bound_access.carbon var a: array(i32, 1) = (12,); -// CHECK:STDERR: fail_array_out_of_bound_access.carbon:[[@LINE+4]]:16: error: array index `1` is past the end of type `array(i32, 1)` [ArrayIndexOutOfBounds] -// CHECK:STDERR: var b: i32 = a[1]; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_array_out_of_bound_access.carbon:[[@LINE+2]]:16: error: array index `1` is past the end of type `array(i32, 1)` [ArrayIndexOutOfBounds] // CHECK:STDERR: var b: i32 = a[1]; @@ -112,7 +110,7 @@ var b: i32 = a[1]; // CHECK:STDOUT: %a.var_patt: %pattern_type.dc1 = var_pattern %a.patt [concrete = constants.%a.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %b.var: ref %i32 = var_storage %b.var_patt [concrete] -// CHECK:STDOUT: %i32.loc20: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc18: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %b: ref %i32 = wrapper_binding b, %b.var [concrete = %b.var] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %b.patt: %pattern_type.d94 = ref_binding_pattern b [concrete = constants.%b.patt] @@ -138,20 +136,20 @@ var b: i32 = a[1]; // CHECK:STDOUT: assign file.%a.var, %.loc15_1 // CHECK:STDOUT: %a.ref: ref %Array.00c = name_ref a, file.%a [concrete = file.%a.var] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %impl.elem0.loc20_16: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc20_16.1: = bound_method %int_1, %impl.elem0.loc20_16 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] -// CHECK:STDOUT: %specific_fn.loc20_16: = specific_function %impl.elem0.loc20_16, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc20_16.2: = bound_method %int_1, %specific_fn.loc20_16 [concrete = constants.%bound_method.3bd] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc20: init %i32 = call %bound_method.loc20_16.2(%int_1) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc20_16.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc20 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc20_16.2: %i32 = converted %int_1, %.loc20_16.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc20_17.1: ref %i32 = array_index %a.ref, %.loc20_16.2 [concrete = ] -// CHECK:STDOUT: %.loc20_17.2: %i32 = acquire_value %.loc20_17.1 [concrete = ] -// CHECK:STDOUT: %impl.elem0.loc20_17: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] -// CHECK:STDOUT: %bound_method.loc20_17.1: = bound_method %.loc20_17.2, %impl.elem0.loc20_17 [concrete = ] -// CHECK:STDOUT: %specific_fn.loc20_17: = specific_function %impl.elem0.loc20_17, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc20_17.2: = bound_method %.loc20_17.2, %specific_fn.loc20_17 [concrete = ] -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc20_17.2(%.loc20_17.2) [concrete = ] +// CHECK:STDOUT: %impl.elem0.loc18_16: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc18_16.1: = bound_method %int_1, %impl.elem0.loc18_16 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] +// CHECK:STDOUT: %specific_fn.loc18_16: = specific_function %impl.elem0.loc18_16, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc18_16.2: = bound_method %int_1, %specific_fn.loc18_16 [concrete = constants.%bound_method.3bd] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc18: init %i32 = call %bound_method.loc18_16.2(%int_1) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc18_16.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc18 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc18_16.2: %i32 = converted %int_1, %.loc18_16.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc18_17.1: ref %i32 = array_index %a.ref, %.loc18_16.2 [concrete = ] +// CHECK:STDOUT: %.loc18_17.2: %i32 = acquire_value %.loc18_17.1 [concrete = ] +// CHECK:STDOUT: %impl.elem0.loc18_17: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] +// CHECK:STDOUT: %bound_method.loc18_17.1: = bound_method %.loc18_17.2, %impl.elem0.loc18_17 [concrete = ] +// CHECK:STDOUT: %specific_fn.loc18_17: = specific_function %impl.elem0.loc18_17, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc18_17.2: = bound_method %.loc18_17.2, %specific_fn.loc18_17 [concrete = ] +// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc18_17.2(%.loc18_17.2) [concrete = ] // CHECK:STDOUT: assign file.%b.var, %Int.as.Copy.impl.Op.call // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/fail_expr_category.carbon b/toolchain/check/testdata/index/fail_expr_category.carbon index 62adb10d4ab1..e37ae9dc276d 100644 --- a/toolchain/check/testdata/index/fail_expr_category.carbon +++ b/toolchain/check/testdata/index/fail_expr_category.carbon @@ -16,27 +16,19 @@ fn F() -> array(i32, 3); fn G(b: array(i32, 3)) { // Indexing an array value gives a value. - // CHECK:STDERR: fail_expr_category.carbon:[[@LINE+4]]:25: error: cannot take the address of non-reference expression [AddrOfNonRef] - // CHECK:STDERR: var unused pb: i32* = &b[0]; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_expr_category.carbon:[[@LINE+2]]:25: error: cannot take the address of non-reference expression [AddrOfNonRef] // CHECK:STDERR: var unused pb: i32* = &b[0]; - // CHECK:STDERR: fail_expr_category.carbon:[[@LINE+4]]:3: error: expression is not assignable [AssignmentToNonAssignable] - // CHECK:STDERR: b[0] = 4; - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_expr_category.carbon:[[@LINE+2]]:3-6: error: expression is not assignable [AssignmentToNonAssignable] // CHECK:STDERR: b[0] = 4; // Indexing an ephemeral reference (materialized from an initializing // expression) gives a value. - // CHECK:STDERR: fail_expr_category.carbon:[[@LINE+4]]:25: error: cannot take the address of non-reference expression [AddrOfNonRef] - // CHECK:STDERR: var unused pf: i32* = &F()[0]; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_expr_category.carbon:[[@LINE+2]]:25: error: cannot take the address of non-reference expression [AddrOfNonRef] // CHECK:STDERR: var unused pf: i32* = &F()[0]; - // CHECK:STDERR: fail_expr_category.carbon:[[@LINE+4]]:3: error: expression is not assignable [AssignmentToNonAssignable] - // CHECK:STDERR: F()[0] = 4; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_expr_category.carbon:[[@LINE+2]]:3-8: error: expression is not assignable [AssignmentToNonAssignable] // CHECK:STDERR: F()[0] = 4; } @@ -106,29 +98,29 @@ fn G(b: array(i32, 3)) { // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] // CHECK:STDOUT: %self.param_patt.0c5: %pattern_type.d94 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.749: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt.0c5 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc41_5.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc33_5.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc41_5.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc33_5.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.1: %Destroy.WithSelf.Op.type.ef016f.1 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1: type = fn_type @Destroy.WithSelf.SelfDestruct.loc41_5.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1: type = fn_type @Destroy.WithSelf.SelfDestruct.loc33_5.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.1: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1 = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.e31: %pattern_type.d4e = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.6c6: %pattern_type.d4e = wrapper_binding_pattern self, %self.param_patt.e31 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc41_5.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc33_5.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = struct_value () [concrete] // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc41_5.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc33_5.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.2: %Destroy.WithSelf.Op.type.ef016f.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc41_5.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc33_5.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.2: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2 = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.6cc: %pattern_type.7dc = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.a12: %pattern_type.7dc = wrapper_binding_pattern self, %self.param_patt.6cc [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc36 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc30 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc36 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc30 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.3: %Destroy.WithSelf.Op.type.ef016f.3 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.3: type = fn_type @Destroy.WithSelf.SelfDestruct.loc36 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.3: type = fn_type @Destroy.WithSelf.SelfDestruct.loc30 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.3: %Destroy.WithSelf.SelfDestruct.type.fbceb5.3 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -154,42 +146,42 @@ fn G(b: array(i32, 3)) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc41_5.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc33_5.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d94 = ref_param_pattern [concrete = constants.%self.param_patt.0c5] // CHECK:STDOUT: %self.patt: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.749] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %i32 = ref_param call_param0 // CHECK:STDOUT: %self: ref %i32 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc41_5.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc33_5.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d94 = ref_param_pattern [concrete = constants.%self.param_patt.0c5] // CHECK:STDOUT: %self.patt: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.749] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %i32 = ref_param call_param0 // CHECK:STDOUT: %self: ref %i32 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc41_5.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc33_5.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d4e = ref_param_pattern [concrete = constants.%self.param_patt.e31] // CHECK:STDOUT: %self.patt: %pattern_type.d4e = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.6c6] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %Array.95c = ref_param call_param0 // CHECK:STDOUT: %self: ref %Array.95c = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc41_5.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc33_5.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d4e = ref_param_pattern [concrete = constants.%self.param_patt.e31] // CHECK:STDOUT: %self.patt: %pattern_type.d4e = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.6c6] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %Array.95c = ref_param call_param0 // CHECK:STDOUT: %self: ref %Array.95c = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc36 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.3] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc30 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.3] { // CHECK:STDOUT: %self.param_patt: %pattern_type.7dc = ref_param_pattern [concrete = constants.%self.param_patt.6cc] // CHECK:STDOUT: %self.patt: %pattern_type.7dc = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.a12] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %ptr.a17 = ref_param call_param0 // CHECK:STDOUT: %self: ref %ptr.a17 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.3: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc36 [concrete = constants.%Destroy.WithSelf.Op.403171.3] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.3: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc30 [concrete = constants.%Destroy.WithSelf.Op.403171.3] { // CHECK:STDOUT: %self.param_patt: %pattern_type.7dc = ref_param_pattern [concrete = constants.%self.param_patt.6cc] // CHECK:STDOUT: %self.patt: %pattern_type.7dc = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.a12] // CHECK:STDOUT: } { @@ -235,160 +227,160 @@ fn G(b: array(i32, 3)) { // CHECK:STDOUT: fn @G(%b.param: %Array.95c) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %pb.var: ref %ptr.a17 = var_storage %pb.var_patt -// CHECK:STDOUT: %b.ref.loc23: %Array.95c = name_ref b, %b -// CHECK:STDOUT: %int_0.loc23: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] -// CHECK:STDOUT: %impl.elem0.loc23_28: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc23_28.1: = bound_method %int_0.loc23, %impl.elem0.loc23_28 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] -// CHECK:STDOUT: %specific_fn.loc23_28: = specific_function %impl.elem0.loc23_28, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc23_28.2: = bound_method %int_0.loc23, %specific_fn.loc23_28 [concrete = constants.%bound_method.036] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc23: init %i32 = call %bound_method.loc23_28.2(%int_0.loc23) [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc23_28.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc23 [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc23_28.2: %i32 = converted %int_0.loc23, %.loc23_28.1 [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc23_29.1: ref %Array.95c = value_as_ref %b.ref.loc23 -// CHECK:STDOUT: %.loc23_29.2: ref %i32 = array_index %.loc23_29.1, %.loc23_28.2 -// CHECK:STDOUT: %.loc23_29.3: %i32 = acquire_value %.loc23_29.2 -// CHECK:STDOUT: %addr.loc23: %ptr.a17 = addr_of [concrete = ] -// CHECK:STDOUT: %impl.elem0.loc23_25: %.309 = impl_witness_access constants.%Copy.impl_witness.83a, element0 [concrete = constants.%ptr.as.Copy.impl.Op.81f] -// CHECK:STDOUT: %bound_method.loc23_25.1: = bound_method %addr.loc23, %impl.elem0.loc23_25 [concrete = ] -// CHECK:STDOUT: %specific_fn.loc23_25: = specific_function %impl.elem0.loc23_25, @ptr.as.Copy.impl.Op(constants.%i32) [concrete = constants.%ptr.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc23_25.2: = bound_method %addr.loc23, %specific_fn.loc23_25 [concrete = ] -// CHECK:STDOUT: %ptr.as.Copy.impl.Op.call.loc23: init %ptr.a17 = call %bound_method.loc23_25.2(%addr.loc23) [concrete = ] -// CHECK:STDOUT: assign %pb.var, %ptr.as.Copy.impl.Op.call.loc23 -// CHECK:STDOUT: %.loc23_21: type = splice_block %ptr.loc23 [concrete = constants.%ptr.a17] { -// CHECK:STDOUT: %i32.loc23: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %ptr.loc23: type = ptr_type %i32.loc23 [concrete = constants.%ptr.a17] +// CHECK:STDOUT: %b.ref.loc21: %Array.95c = name_ref b, %b +// CHECK:STDOUT: %int_0.loc21: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] +// CHECK:STDOUT: %impl.elem0.loc21_28: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc21_28.1: = bound_method %int_0.loc21, %impl.elem0.loc21_28 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] +// CHECK:STDOUT: %specific_fn.loc21_28: = specific_function %impl.elem0.loc21_28, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc21_28.2: = bound_method %int_0.loc21, %specific_fn.loc21_28 [concrete = constants.%bound_method.036] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc21: init %i32 = call %bound_method.loc21_28.2(%int_0.loc21) [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc21_28.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc21 [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc21_28.2: %i32 = converted %int_0.loc21, %.loc21_28.1 [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc21_29.1: ref %Array.95c = value_as_ref %b.ref.loc21 +// CHECK:STDOUT: %.loc21_29.2: ref %i32 = array_index %.loc21_29.1, %.loc21_28.2 +// CHECK:STDOUT: %.loc21_29.3: %i32 = acquire_value %.loc21_29.2 +// CHECK:STDOUT: %addr.loc21: %ptr.a17 = addr_of [concrete = ] +// CHECK:STDOUT: %impl.elem0.loc21_25: %.309 = impl_witness_access constants.%Copy.impl_witness.83a, element0 [concrete = constants.%ptr.as.Copy.impl.Op.81f] +// CHECK:STDOUT: %bound_method.loc21_25.1: = bound_method %addr.loc21, %impl.elem0.loc21_25 [concrete = ] +// CHECK:STDOUT: %specific_fn.loc21_25: = specific_function %impl.elem0.loc21_25, @ptr.as.Copy.impl.Op(constants.%i32) [concrete = constants.%ptr.as.Copy.impl.Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc21_25.2: = bound_method %addr.loc21, %specific_fn.loc21_25 [concrete = ] +// CHECK:STDOUT: %ptr.as.Copy.impl.Op.call.loc21: init %ptr.a17 = call %bound_method.loc21_25.2(%addr.loc21) [concrete = ] +// CHECK:STDOUT: assign %pb.var, %ptr.as.Copy.impl.Op.call.loc21 +// CHECK:STDOUT: %.loc21_21: type = splice_block %ptr.loc21 [concrete = constants.%ptr.a17] { +// CHECK:STDOUT: %i32.loc21: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %ptr.loc21: type = ptr_type %i32.loc21 [concrete = constants.%ptr.a17] // CHECK:STDOUT: } // CHECK:STDOUT: %pb: ref %ptr.a17 = wrapper_binding pb, %pb.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %pb.patt: %pattern_type.7dc = ref_binding_pattern pb [concrete = constants.%pb.patt] // CHECK:STDOUT: %pb.var_patt: %pattern_type.7dc = var_pattern %pb.patt [concrete = constants.%pb.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %b.ref.loc28: %Array.95c = name_ref b, %b -// CHECK:STDOUT: %int_0.loc28: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] -// CHECK:STDOUT: %impl.elem0.loc28_5: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc28_5.1: = bound_method %int_0.loc28, %impl.elem0.loc28_5 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] -// CHECK:STDOUT: %specific_fn.loc28_5: = specific_function %impl.elem0.loc28_5, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc28_5.2: = bound_method %int_0.loc28, %specific_fn.loc28_5 [concrete = constants.%bound_method.036] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc28_5: init %i32 = call %bound_method.loc28_5.2(%int_0.loc28) [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc28_5.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc28_5 [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc28_5.2: %i32 = converted %int_0.loc28, %.loc28_5.1 [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc28_6.1: ref %Array.95c = value_as_ref %b.ref.loc28 -// CHECK:STDOUT: %.loc28_6.2: ref %i32 = array_index %.loc28_6.1, %.loc28_5.2 -// CHECK:STDOUT: %.loc28_6.3: %i32 = acquire_value %.loc28_6.2 -// CHECK:STDOUT: %int_4.loc28: Core.IntLiteral = int_value 4 [concrete = constants.%int_4.0c1] -// CHECK:STDOUT: %impl.elem0.loc28_8: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc28_8.1: = bound_method %int_4.loc28, %impl.elem0.loc28_8 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.776] -// CHECK:STDOUT: %specific_fn.loc28_8: = specific_function %impl.elem0.loc28_8, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc28_8.2: = bound_method %int_4.loc28, %specific_fn.loc28_8 [concrete = constants.%bound_method.7fa] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc28_8: init %i32 = call %bound_method.loc28_8.2(%int_4.loc28) [concrete = constants.%int_4.6bf] -// CHECK:STDOUT: %.loc28_8: init %i32 = converted %int_4.loc28, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc28_8 [concrete = constants.%int_4.6bf] -// CHECK:STDOUT: assign %.loc28_6.3, %.loc28_8 +// CHECK:STDOUT: %b.ref.loc24: %Array.95c = name_ref b, %b +// CHECK:STDOUT: %int_0.loc24: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] +// CHECK:STDOUT: %impl.elem0.loc24_5: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc24_5.1: = bound_method %int_0.loc24, %impl.elem0.loc24_5 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] +// CHECK:STDOUT: %specific_fn.loc24_5: = specific_function %impl.elem0.loc24_5, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc24_5.2: = bound_method %int_0.loc24, %specific_fn.loc24_5 [concrete = constants.%bound_method.036] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc24_5: init %i32 = call %bound_method.loc24_5.2(%int_0.loc24) [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc24_5.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc24_5 [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc24_5.2: %i32 = converted %int_0.loc24, %.loc24_5.1 [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc24_6.1: ref %Array.95c = value_as_ref %b.ref.loc24 +// CHECK:STDOUT: %.loc24_6.2: ref %i32 = array_index %.loc24_6.1, %.loc24_5.2 +// CHECK:STDOUT: %.loc24_6.3: %i32 = acquire_value %.loc24_6.2 +// CHECK:STDOUT: %int_4.loc24: Core.IntLiteral = int_value 4 [concrete = constants.%int_4.0c1] +// CHECK:STDOUT: %impl.elem0.loc24_8: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc24_8.1: = bound_method %int_4.loc24, %impl.elem0.loc24_8 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.776] +// CHECK:STDOUT: %specific_fn.loc24_8: = specific_function %impl.elem0.loc24_8, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc24_8.2: = bound_method %int_4.loc24, %specific_fn.loc24_8 [concrete = constants.%bound_method.7fa] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc24_8: init %i32 = call %bound_method.loc24_8.2(%int_4.loc24) [concrete = constants.%int_4.6bf] +// CHECK:STDOUT: %.loc24_8: init %i32 = converted %int_4.loc24, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc24_8 [concrete = constants.%int_4.6bf] +// CHECK:STDOUT: assign %.loc24_6.3, %.loc24_8 // CHECK:STDOUT: %pf.var: ref %ptr.a17 = var_storage %pf.var_patt -// CHECK:STDOUT: %F.ref.loc36: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] -// CHECK:STDOUT: %.loc36_28.1: ref %Array.95c = temporary_storage -// CHECK:STDOUT: %F.call.loc36: init %Array.95c to %.loc36_28.1 = call %F.ref.loc36() -// CHECK:STDOUT: %int_0.loc36: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] -// CHECK:STDOUT: %.loc36_28.2: ref %Array.95c = temporary %.loc36_28.1, %F.call.loc36 -// CHECK:STDOUT: %impl.elem0.loc36_30: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc36_30.1: = bound_method %int_0.loc36, %impl.elem0.loc36_30 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] -// CHECK:STDOUT: %specific_fn.loc36_30: = specific_function %impl.elem0.loc36_30, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc36_30.2: = bound_method %int_0.loc36, %specific_fn.loc36_30 [concrete = constants.%bound_method.036] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc36: init %i32 = call %bound_method.loc36_30.2(%int_0.loc36) [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc36_30.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc36 [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc36_30.2: %i32 = converted %int_0.loc36, %.loc36_30.1 [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc36_31.1: ref %i32 = array_index %.loc36_28.2, %.loc36_30.2 -// CHECK:STDOUT: %.loc36_31.2: %i32 = acquire_value %.loc36_31.1 -// CHECK:STDOUT: %addr.loc36: %ptr.a17 = addr_of [concrete = ] -// CHECK:STDOUT: %impl.elem0.loc36_25: %.309 = impl_witness_access constants.%Copy.impl_witness.83a, element0 [concrete = constants.%ptr.as.Copy.impl.Op.81f] -// CHECK:STDOUT: %bound_method.loc36_25.1: = bound_method %addr.loc36, %impl.elem0.loc36_25 [concrete = ] -// CHECK:STDOUT: %specific_fn.loc36_25: = specific_function %impl.elem0.loc36_25, @ptr.as.Copy.impl.Op(constants.%i32) [concrete = constants.%ptr.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc36_25.2: = bound_method %addr.loc36, %specific_fn.loc36_25 [concrete = ] -// CHECK:STDOUT: %ptr.as.Copy.impl.Op.call.loc36: init %ptr.a17 = call %bound_method.loc36_25.2(%addr.loc36) [concrete = ] -// CHECK:STDOUT: assign %pf.var, %ptr.as.Copy.impl.Op.call.loc36 -// CHECK:STDOUT: %.loc36_21: type = splice_block %ptr.loc36 [concrete = constants.%ptr.a17] { -// CHECK:STDOUT: %i32.loc36: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %ptr.loc36: type = ptr_type %i32.loc36 [concrete = constants.%ptr.a17] +// CHECK:STDOUT: %F.ref.loc30: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] +// CHECK:STDOUT: %.loc30_28.1: ref %Array.95c = temporary_storage +// CHECK:STDOUT: %F.call.loc30: init %Array.95c to %.loc30_28.1 = call %F.ref.loc30() +// CHECK:STDOUT: %int_0.loc30: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] +// CHECK:STDOUT: %.loc30_28.2: ref %Array.95c = temporary %.loc30_28.1, %F.call.loc30 +// CHECK:STDOUT: %impl.elem0.loc30_30: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc30_30.1: = bound_method %int_0.loc30, %impl.elem0.loc30_30 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] +// CHECK:STDOUT: %specific_fn.loc30_30: = specific_function %impl.elem0.loc30_30, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc30_30.2: = bound_method %int_0.loc30, %specific_fn.loc30_30 [concrete = constants.%bound_method.036] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc30: init %i32 = call %bound_method.loc30_30.2(%int_0.loc30) [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc30_30.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc30 [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc30_30.2: %i32 = converted %int_0.loc30, %.loc30_30.1 [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc30_31.1: ref %i32 = array_index %.loc30_28.2, %.loc30_30.2 +// CHECK:STDOUT: %.loc30_31.2: %i32 = acquire_value %.loc30_31.1 +// CHECK:STDOUT: %addr.loc30: %ptr.a17 = addr_of [concrete = ] +// CHECK:STDOUT: %impl.elem0.loc30_25: %.309 = impl_witness_access constants.%Copy.impl_witness.83a, element0 [concrete = constants.%ptr.as.Copy.impl.Op.81f] +// CHECK:STDOUT: %bound_method.loc30_25.1: = bound_method %addr.loc30, %impl.elem0.loc30_25 [concrete = ] +// CHECK:STDOUT: %specific_fn.loc30_25: = specific_function %impl.elem0.loc30_25, @ptr.as.Copy.impl.Op(constants.%i32) [concrete = constants.%ptr.as.Copy.impl.Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc30_25.2: = bound_method %addr.loc30, %specific_fn.loc30_25 [concrete = ] +// CHECK:STDOUT: %ptr.as.Copy.impl.Op.call.loc30: init %ptr.a17 = call %bound_method.loc30_25.2(%addr.loc30) [concrete = ] +// CHECK:STDOUT: assign %pf.var, %ptr.as.Copy.impl.Op.call.loc30 +// CHECK:STDOUT: %.loc30_21: type = splice_block %ptr.loc30 [concrete = constants.%ptr.a17] { +// CHECK:STDOUT: %i32.loc30: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %ptr.loc30: type = ptr_type %i32.loc30 [concrete = constants.%ptr.a17] // CHECK:STDOUT: } // CHECK:STDOUT: %pf: ref %ptr.a17 = wrapper_binding pf, %pf.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %pf.patt: %pattern_type.7dc = ref_binding_pattern pf [concrete = constants.%pf.patt] // CHECK:STDOUT: %pf.var_patt: %pattern_type.7dc = var_pattern %pf.patt [concrete = constants.%pf.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %F.ref.loc41: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] -// CHECK:STDOUT: %.loc41_5.1: ref %Array.95c = temporary_storage -// CHECK:STDOUT: %F.call.loc41: init %Array.95c to %.loc41_5.1 = call %F.ref.loc41() -// CHECK:STDOUT: %int_0.loc41: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] -// CHECK:STDOUT: %.loc41_5.2: ref %Array.95c = temporary %.loc41_5.1, %F.call.loc41 -// CHECK:STDOUT: %impl.elem0.loc41_7: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc41_7.1: = bound_method %int_0.loc41, %impl.elem0.loc41_7 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] -// CHECK:STDOUT: %specific_fn.loc41_7: = specific_function %impl.elem0.loc41_7, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc41_7.2: = bound_method %int_0.loc41, %specific_fn.loc41_7 [concrete = constants.%bound_method.036] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc41_7: init %i32 = call %bound_method.loc41_7.2(%int_0.loc41) [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc41_7.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc41_7 [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc41_7.2: %i32 = converted %int_0.loc41, %.loc41_7.1 [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc41_8.1: ref %i32 = array_index %.loc41_5.2, %.loc41_7.2 -// CHECK:STDOUT: %.loc41_8.2: %i32 = acquire_value %.loc41_8.1 -// CHECK:STDOUT: %int_4.loc41: Core.IntLiteral = int_value 4 [concrete = constants.%int_4.0c1] -// CHECK:STDOUT: %impl.elem0.loc41_10: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc41_10.1: = bound_method %int_4.loc41, %impl.elem0.loc41_10 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.776] -// CHECK:STDOUT: %specific_fn.loc41_10: = specific_function %impl.elem0.loc41_10, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc41_10.2: = bound_method %int_4.loc41, %specific_fn.loc41_10 [concrete = constants.%bound_method.7fa] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc41_10: init %i32 = call %bound_method.loc41_10.2(%int_4.loc41) [concrete = constants.%int_4.6bf] -// CHECK:STDOUT: %.loc41_10: init %i32 = converted %int_4.loc41, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc41_10 [concrete = constants.%int_4.6bf] -// CHECK:STDOUT: assign %.loc41_8.2, %.loc41_10 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc41: = bound_method %.loc41_5.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc41: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc41(%.loc41_5.2) -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc36_28: = bound_method %.loc36_28.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc36_28: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc36_28(%.loc36_28.2) -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc36_3: = bound_method %pf.var, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.3 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc36_3: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc36_3(%pf.var) -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc23: = bound_method %pb.var, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.3 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc23: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc23(%pb.var) +// CHECK:STDOUT: %F.ref.loc33: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] +// CHECK:STDOUT: %.loc33_5.1: ref %Array.95c = temporary_storage +// CHECK:STDOUT: %F.call.loc33: init %Array.95c to %.loc33_5.1 = call %F.ref.loc33() +// CHECK:STDOUT: %int_0.loc33: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] +// CHECK:STDOUT: %.loc33_5.2: ref %Array.95c = temporary %.loc33_5.1, %F.call.loc33 +// CHECK:STDOUT: %impl.elem0.loc33_7: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc33_7.1: = bound_method %int_0.loc33, %impl.elem0.loc33_7 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] +// CHECK:STDOUT: %specific_fn.loc33_7: = specific_function %impl.elem0.loc33_7, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc33_7.2: = bound_method %int_0.loc33, %specific_fn.loc33_7 [concrete = constants.%bound_method.036] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc33_7: init %i32 = call %bound_method.loc33_7.2(%int_0.loc33) [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc33_7.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc33_7 [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc33_7.2: %i32 = converted %int_0.loc33, %.loc33_7.1 [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc33_8.1: ref %i32 = array_index %.loc33_5.2, %.loc33_7.2 +// CHECK:STDOUT: %.loc33_8.2: %i32 = acquire_value %.loc33_8.1 +// CHECK:STDOUT: %int_4.loc33: Core.IntLiteral = int_value 4 [concrete = constants.%int_4.0c1] +// CHECK:STDOUT: %impl.elem0.loc33_10: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc33_10.1: = bound_method %int_4.loc33, %impl.elem0.loc33_10 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.776] +// CHECK:STDOUT: %specific_fn.loc33_10: = specific_function %impl.elem0.loc33_10, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc33_10.2: = bound_method %int_4.loc33, %specific_fn.loc33_10 [concrete = constants.%bound_method.7fa] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc33_10: init %i32 = call %bound_method.loc33_10.2(%int_4.loc33) [concrete = constants.%int_4.6bf] +// CHECK:STDOUT: %.loc33_10: init %i32 = converted %int_4.loc33, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc33_10 [concrete = constants.%int_4.6bf] +// CHECK:STDOUT: assign %.loc33_8.2, %.loc33_10 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc33: = bound_method %.loc33_5.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc33: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc33(%.loc33_5.2) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc30_28: = bound_method %.loc30_28.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc30_28: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc30_28(%.loc30_28.2) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc30_3: = bound_method %pf.var, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.3 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc30_3: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc30_3(%pf.var) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc21: = bound_method %pb.var, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.3 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc21: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc21(%pb.var) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc41_5.1(%self.param: ref %i32) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc33_5.1(%self.param: ref %i32) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc41_5.1(%self.param: ref %i32) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc33_5.1(%self.param: ref %i32) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc41_5.1(%self.param: ref %i32) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc33_5.1(%self.param: ref %i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.1(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.1(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc41_5.2(%self.param: ref %Array.95c) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc33_5.2(%self.param: ref %Array.95c) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2] -// CHECK:STDOUT: %.loc41_5.1: ref %i32 = array_index %self.param, %int_2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc41_5.1: = bound_method %.loc41_5.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc41_5.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc41_5.1(%.loc41_5.1) +// CHECK:STDOUT: %.loc33_5.1: ref %i32 = array_index %self.param, %int_2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc33_5.1: = bound_method %.loc33_5.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc33_5.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc33_5.1(%.loc33_5.1) // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %.loc41_5.2: ref %i32 = array_index %self.param, %int_1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc41_5.2: = bound_method %.loc41_5.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc41_5.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc41_5.2(%.loc41_5.2) +// CHECK:STDOUT: %.loc33_5.2: ref %i32 = array_index %self.param, %int_1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc33_5.2: = bound_method %.loc33_5.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc33_5.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc33_5.2(%.loc33_5.2) // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] -// CHECK:STDOUT: %.loc41_5.3: ref %i32 = array_index %self.param, %int_0 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc41_5.3: = bound_method %.loc41_5.3, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc41_5.3: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc41_5.3(%.loc41_5.3) +// CHECK:STDOUT: %.loc33_5.3: ref %i32 = array_index %self.param, %int_0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc33_5.3: = bound_method %.loc33_5.3, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc33_5.3: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc33_5.3(%.loc33_5.3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc41_5.2(%self.param: ref %Array.95c) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc33_5.2(%self.param: ref %Array.95c) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc41_5.2(%self.param: ref %Array.95c) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc33_5.2(%self.param: ref %Array.95c) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.2(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.2(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc36(%self.param: ref %ptr.a17) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc30(%self.param: ref %ptr.a17) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc36(%self.param: ref %ptr.a17) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc30(%self.param: ref %ptr.a17) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc36(%self.param: ref %ptr.a17) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc30(%self.param: ref %ptr.a17) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.3(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.3(%self.param) diff --git a/toolchain/check/testdata/index/fail_invalid_base.carbon b/toolchain/check/testdata/index/fail_invalid_base.carbon index ce8a724c7847..95cca4118bd5 100644 --- a/toolchain/check/testdata/index/fail_invalid_base.carbon +++ b/toolchain/check/testdata/index/fail_invalid_base.carbon @@ -14,28 +14,20 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_invalid_base.carbon namespace N; -// CHECK:STDERR: fail_invalid_base.carbon:[[@LINE+4]]:14: error: expression cannot be used as a value [UseOfNonExprAsValue] -// CHECK:STDERR: var a: i32 = N[0]; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_invalid_base.carbon:[[@LINE+2]]:14: error: expression cannot be used as a value [UseOfNonExprAsValue] // CHECK:STDERR: var a: i32 = N[0]; fn F(); -// CHECK:STDERR: fail_invalid_base.carbon:[[@LINE+4]]:14: error: cannot access member of interface `Core.IndexWith(Core.IntLiteral)` in type `` that does not implement that interface [MissingImplInMemberAccess] -// CHECK:STDERR: var b: i32 = F[1]; -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_invalid_base.carbon:[[@LINE+2]]:14-17: error: cannot access member of interface `Core.IndexWith(Core.IntLiteral)` in type `` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: var b: i32 = F[1]; -// CHECK:STDERR: fail_invalid_base.carbon:[[@LINE+4]]:14: error: cannot access member of interface `Core.IndexWith(Core.IntLiteral)` in type `{.a: Core.IntLiteral, .b: Core.IntLiteral}` that does not implement that interface [MissingImplInMemberAccess] -// CHECK:STDERR: var c: i32 = {.a = 1, .b = 2}[0]; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_invalid_base.carbon:[[@LINE+2]]:14-32: error: cannot access member of interface `Core.IndexWith(Core.IntLiteral)` in type `{.a: Core.IntLiteral, .b: Core.IntLiteral}` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: var c: i32 = {.a = 1, .b = 2}[0]; -// CHECK:STDERR: fail_invalid_base.carbon:[[@LINE+4]]:14: error: cannot access member of interface `Core.IndexWith(Core.IntLiteral)` in type `type` that does not implement that interface [MissingImplInMemberAccess] -// CHECK:STDERR: var d: i32 = {.a: i32, .b: i32}[0]; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_invalid_base.carbon:[[@LINE+2]]:14-34: error: cannot access member of interface `Core.IndexWith(Core.IntLiteral)` in type `type` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: var d: i32 = {.a: i32, .b: i32}[0]; @@ -92,7 +84,7 @@ var d: i32 = {.a: i32, .b: i32}[0]; // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %N: = namespace [concrete] {} // CHECK:STDOUT: %a.var: ref %i32 = var_storage %a.var_patt [concrete] -// CHECK:STDOUT: %i32.loc21: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc19: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %a: ref %i32 = wrapper_binding a, %a.var [concrete = %a.var] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %a.patt: %pattern_type.d94 = ref_binding_pattern a [concrete = constants.%a.patt] @@ -100,21 +92,21 @@ var d: i32 = {.a: i32, .b: i32}[0]; // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} // CHECK:STDOUT: %b.var: ref %i32 = var_storage %b.var_patt [concrete] -// CHECK:STDOUT: %i32.loc28: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc24: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %b: ref %i32 = wrapper_binding b, %b.var [concrete = %b.var] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %b.patt: %pattern_type.d94 = ref_binding_pattern b [concrete = constants.%b.patt] // CHECK:STDOUT: %b.var_patt: %pattern_type.d94 = var_pattern %b.patt [concrete = constants.%b.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %c.var: ref %i32 = var_storage %c.var_patt [concrete] -// CHECK:STDOUT: %i32.loc34: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc28: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %c: ref %i32 = wrapper_binding c, %c.var [concrete = %c.var] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %c.patt: %pattern_type.d94 = ref_binding_pattern c [concrete = constants.%c.patt] // CHECK:STDOUT: %c.var_patt: %pattern_type.d94 = var_pattern %c.patt [concrete = constants.%c.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %d.var: ref %i32 = var_storage %d.var_patt [concrete] -// CHECK:STDOUT: %i32.loc40: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %d: ref %i32 = wrapper_binding d, %d.var [concrete = %d.var] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %d.patt: %pattern_type.d94 = ref_binding_pattern d [concrete = constants.%d.patt] @@ -127,22 +119,22 @@ var d: i32 = {.a: i32, .b: i32}[0]; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %N.ref: = name_ref N, file.%N [concrete = file.%N] -// CHECK:STDOUT: %int_0.loc21: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] +// CHECK:STDOUT: %int_0.loc19: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] // CHECK:STDOUT: assign file.%a.var, // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] -// CHECK:STDOUT: %int_1.loc28: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %int_1.loc24: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] // CHECK:STDOUT: assign file.%b.var, -// CHECK:STDOUT: %int_1.loc34: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %int_1.loc28: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2] -// CHECK:STDOUT: %.loc34_29.1: %struct_type.a.b.cfd = struct_literal (%int_1.loc34, %int_2) [concrete = constants.%struct] -// CHECK:STDOUT: %int_0.loc34: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] -// CHECK:STDOUT: %struct: %struct_type.a.b.cfd = struct_value (%int_1.loc34, %int_2) [concrete = constants.%struct] -// CHECK:STDOUT: %.loc34_29.2: %struct_type.a.b.cfd = converted %.loc34_29.1, %struct [concrete = constants.%struct] +// CHECK:STDOUT: %.loc28_29.1: %struct_type.a.b.cfd = struct_literal (%int_1.loc28, %int_2) [concrete = constants.%struct] +// CHECK:STDOUT: %int_0.loc28: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] +// CHECK:STDOUT: %struct: %struct_type.a.b.cfd = struct_value (%int_1.loc28, %int_2) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc28_29.2: %struct_type.a.b.cfd = converted %.loc28_29.1, %struct [concrete = constants.%struct] // CHECK:STDOUT: assign file.%c.var, -// CHECK:STDOUT: %i32.loc40_19: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %i32.loc40_28: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc32_19: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc32_28: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.a.b: type = struct_type {.a: %i32, .b: %i32} [concrete = constants.%struct_type.a.b.250] -// CHECK:STDOUT: %int_0.loc40: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] +// CHECK:STDOUT: %int_0.loc32: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] // CHECK:STDOUT: assign file.%d.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/fail_name_not_found.carbon b/toolchain/check/testdata/index/fail_name_not_found.carbon index 097ce5d35c48..eae94349d3bb 100644 --- a/toolchain/check/testdata/index/fail_name_not_found.carbon +++ b/toolchain/check/testdata/index/fail_name_not_found.carbon @@ -13,9 +13,7 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_name_not_found.carbon fn Main() { - // CHECK:STDERR: fail_name_not_found.carbon:[[@LINE+4]]:23: error: name `a` not found [NameNotFound] - // CHECK:STDERR: var unused b: i32 = a[0]; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_name_not_found.carbon:[[@LINE+2]]:23: error: name `a` not found [NameNotFound] // CHECK:STDERR: var unused b: i32 = a[0]; } @@ -38,11 +36,11 @@ fn Main() { // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] // CHECK:STDOUT: %self.param_patt.0c5: %pattern_type.d94 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.749: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt.0c5 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfc: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc20 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfc: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc18 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01: %Destroy.WithSelf.SubobjectDestroy.type.dfc = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef0: type = fn_type @Destroy.WithSelf.Op.loc20 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef0: type = fn_type @Destroy.WithSelf.Op.loc18 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403: %Destroy.WithSelf.Op.type.ef0 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbc: type = fn_type @Destroy.WithSelf.SelfDestruct.loc20 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbc: type = fn_type @Destroy.WithSelf.SelfDestruct.loc18 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3: %Destroy.WithSelf.SelfDestruct.type.fbc = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -58,14 +56,14 @@ fn Main() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl: %Destroy.WithSelf.SubobjectDestroy.type.dfc = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc20 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl: %Destroy.WithSelf.SubobjectDestroy.type.dfc = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc18 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d94 = ref_param_pattern [concrete = constants.%self.param_patt.0c5] // CHECK:STDOUT: %self.patt: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.749] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %i32 = ref_param call_param0 // CHECK:STDOUT: %self: ref %i32 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl: %Destroy.WithSelf.Op.type.ef0 = fn_decl @Destroy.WithSelf.Op.loc20 [concrete = constants.%Destroy.WithSelf.Op.403] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl: %Destroy.WithSelf.Op.type.ef0 = fn_decl @Destroy.WithSelf.Op.loc18 [concrete = constants.%Destroy.WithSelf.Op.403] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d94 = ref_param_pattern [concrete = constants.%self.param_patt.0c5] // CHECK:STDOUT: %self.patt: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.749] // CHECK:STDOUT: } { @@ -101,11 +99,11 @@ fn Main() { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc20(%self.param: ref %i32) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc18(%self.param: ref %i32) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc20(%self.param: ref %i32) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc18(%self.param: ref %i32) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc20(%self.param: ref %i32) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc18(%self.param: ref %i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl(%self.param) diff --git a/toolchain/check/testdata/index/fail_negative_indexing.carbon b/toolchain/check/testdata/index/fail_negative_indexing.carbon index d3fbec85399e..4d370c57112b 100644 --- a/toolchain/check/testdata/index/fail_negative_indexing.carbon +++ b/toolchain/check/testdata/index/fail_negative_indexing.carbon @@ -13,9 +13,7 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_negative_indexing.carbon var c: array(i32, 2) = (42, 42); -// CHECK:STDERR: fail_negative_indexing.carbon:[[@LINE+4]]:16: error: array index `-10` is past the end of type `array(i32, 2)` [ArrayIndexOutOfBounds] -// CHECK:STDERR: var d: i32 = c[-10]; -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_negative_indexing.carbon:[[@LINE+2]]:16-18: error: array index `-10` is past the end of type `array(i32, 2)` [ArrayIndexOutOfBounds] // CHECK:STDERR: var d: i32 = c[-10]; @@ -129,7 +127,7 @@ var d: i32 = c[-10]; // CHECK:STDOUT: %c.var_patt: %pattern_type.c08 = var_pattern %c.patt [concrete = constants.%c.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %d.var: ref %i32 = var_storage %d.var_patt [concrete] -// CHECK:STDOUT: %i32.loc20: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc18: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %d: ref %i32 = wrapper_binding d, %d.var [concrete = %d.var] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %d.patt: %pattern_type.d94 = ref_binding_pattern d [concrete = constants.%d.patt] @@ -166,24 +164,24 @@ var d: i32 = c[-10]; // CHECK:STDOUT: %c.ref: ref %Array.641 = name_ref c, file.%c [concrete = file.%c.var] // CHECK:STDOUT: %int_10: Core.IntLiteral = int_value 10 [concrete = constants.%int_10] // CHECK:STDOUT: %impl.elem1: %.2ac = impl_witness_access constants.%Negate.impl_witness, element1 [concrete = constants.%Core.IntLiteral.as.Negate.impl.Op] -// CHECK:STDOUT: %bound_method.loc20_16.1: = bound_method %int_10, %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.loc20_16.1(%int_10) [concrete = constants.%int_-10.06d] -// CHECK:STDOUT: %impl.elem0.loc20_16: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc20_16.2: = bound_method %Core.IntLiteral.as.Negate.impl.Op.call, %impl.elem0.loc20_16 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.b38] -// CHECK:STDOUT: %specific_fn.loc20_16: = specific_function %impl.elem0.loc20_16, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc20_16.3: = bound_method %Core.IntLiteral.as.Negate.impl.Op.call, %specific_fn.loc20_16 [concrete = constants.%bound_method.378] -// CHECK:STDOUT: %.loc20_16.1: Core.IntLiteral = value_of_initializer %Core.IntLiteral.as.Negate.impl.Op.call [concrete = constants.%int_-10.06d] -// CHECK:STDOUT: %.loc20_16.2: Core.IntLiteral = converted %Core.IntLiteral.as.Negate.impl.Op.call, %.loc20_16.1 [concrete = constants.%int_-10.06d] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc20: init %i32 = call %bound_method.loc20_16.3(%.loc20_16.2) [concrete = constants.%int_-10.bee] -// CHECK:STDOUT: %.loc20_16.3: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc20 [concrete = constants.%int_-10.bee] -// CHECK:STDOUT: %.loc20_16.4: %i32 = converted %Core.IntLiteral.as.Negate.impl.Op.call, %.loc20_16.3 [concrete = constants.%int_-10.bee] -// CHECK:STDOUT: %.loc20_19.1: ref %i32 = array_index %c.ref, %.loc20_16.4 [concrete = ] -// CHECK:STDOUT: %.loc20_19.2: %i32 = acquire_value %.loc20_19.1 [concrete = ] -// CHECK:STDOUT: %impl.elem0.loc20_19: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] -// CHECK:STDOUT: %bound_method.loc20_19.1: = bound_method %.loc20_19.2, %impl.elem0.loc20_19 [concrete = ] -// CHECK:STDOUT: %specific_fn.loc20_19: = specific_function %impl.elem0.loc20_19, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc20_19.2: = bound_method %.loc20_19.2, %specific_fn.loc20_19 [concrete = ] -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc20_19.2(%.loc20_19.2) [concrete = ] +// CHECK:STDOUT: %bound_method.loc18_16.1: = bound_method %int_10, %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.loc18_16.1(%int_10) [concrete = constants.%int_-10.06d] +// CHECK:STDOUT: %impl.elem0.loc18_16: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc18_16.2: = bound_method %Core.IntLiteral.as.Negate.impl.Op.call, %impl.elem0.loc18_16 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.b38] +// CHECK:STDOUT: %specific_fn.loc18_16: = specific_function %impl.elem0.loc18_16, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc18_16.3: = bound_method %Core.IntLiteral.as.Negate.impl.Op.call, %specific_fn.loc18_16 [concrete = constants.%bound_method.378] +// CHECK:STDOUT: %.loc18_16.1: Core.IntLiteral = value_of_initializer %Core.IntLiteral.as.Negate.impl.Op.call [concrete = constants.%int_-10.06d] +// CHECK:STDOUT: %.loc18_16.2: Core.IntLiteral = converted %Core.IntLiteral.as.Negate.impl.Op.call, %.loc18_16.1 [concrete = constants.%int_-10.06d] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc18: init %i32 = call %bound_method.loc18_16.3(%.loc18_16.2) [concrete = constants.%int_-10.bee] +// CHECK:STDOUT: %.loc18_16.3: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc18 [concrete = constants.%int_-10.bee] +// CHECK:STDOUT: %.loc18_16.4: %i32 = converted %Core.IntLiteral.as.Negate.impl.Op.call, %.loc18_16.3 [concrete = constants.%int_-10.bee] +// CHECK:STDOUT: %.loc18_19.1: ref %i32 = array_index %c.ref, %.loc18_16.4 [concrete = ] +// CHECK:STDOUT: %.loc18_19.2: %i32 = acquire_value %.loc18_19.1 [concrete = ] +// CHECK:STDOUT: %impl.elem0.loc18_19: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] +// CHECK:STDOUT: %bound_method.loc18_19.1: = bound_method %.loc18_19.2, %impl.elem0.loc18_19 [concrete = ] +// CHECK:STDOUT: %specific_fn.loc18_19: = specific_function %impl.elem0.loc18_19, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc18_19.2: = bound_method %.loc18_19.2, %specific_fn.loc18_19 [concrete = ] +// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc18_19.2(%.loc18_19.2) [concrete = ] // CHECK:STDOUT: assign file.%d.var, %Int.as.Copy.impl.Op.call // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/fail_non_tuple_access.carbon b/toolchain/check/testdata/index/fail_non_tuple_access.carbon index 12571e2ae0f6..d3f464a34ea6 100644 --- a/toolchain/check/testdata/index/fail_non_tuple_access.carbon +++ b/toolchain/check/testdata/index/fail_non_tuple_access.carbon @@ -13,9 +13,7 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_non_tuple_access.carbon fn Main() { - // CHECK:STDERR: fail_non_tuple_access.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Core.IndexWith(Core.IntLiteral)` in type `Core.IntLiteral` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: 0[1]; - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_non_tuple_access.carbon:[[@LINE+2]]:3-6: error: cannot access member of interface `Core.IndexWith(Core.IntLiteral)` in type `Core.IntLiteral` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: 0[1]; } diff --git a/toolchain/check/testdata/interface/compound_member_access.carbon b/toolchain/check/testdata/interface/compound_member_access.carbon index fc7178d5efe1..3b227e0d12d2 100644 --- a/toolchain/check/testdata/interface/compound_member_access.carbon +++ b/toolchain/check/testdata/interface/compound_member_access.carbon @@ -57,12 +57,8 @@ fn Simple3(generic T: K2, x: T) { // Compound member access does not. It tries to convert `y` to `K2`, but only // its type `V` can. fn Compound3(generic 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: y.(K2.Q2)(); - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_caller_instance_interface_not.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert non-type value of type `V` into type implementing `K2` [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: fail_caller_instance_interface_not.carbon:[[@LINE+2]]:3-11: note: type `V` does not implement interface `Core.ImplicitAs(K2)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: y.(K2.Q2)(); } @@ -98,34 +94,22 @@ interface L2 { // Simple member access. Fails since calling an instance method without an object. fn Simple5(generic T: L2) { - // CHECK:STDERR: fail_interface_instance_caller_not.carbon:[[@LINE+7]]:3: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] - // CHECK:STDERR: T.R2(); - // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_interface_instance_caller_not.carbon:[[@LINE-9]]:3: note: calling function declared here [InCallToEntity] - // CHECK:STDERR: fn R2(self); - // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_interface_instance_caller_not.carbon:[[@LINE+3]]:3-8: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] + // CHECK:STDERR: fail_interface_instance_caller_not.carbon:[[@LINE-7]]:3-14: note: calling function declared here [InCallToEntity] // CHECK:STDERR: T.R2(); - // CHECK:STDERR: fail_interface_instance_caller_not.carbon:[[@LINE+7]]:3: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] - // CHECK:STDERR: T.S2(); - // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_interface_instance_caller_not.carbon:[[@LINE-16]]:3: note: calling function declared here [InCallToEntity] - // CHECK:STDERR: fn S2(ref self); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_interface_instance_caller_not.carbon:[[@LINE+3]]:3-8: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] + // CHECK:STDERR: fail_interface_instance_caller_not.carbon:[[@LINE-10]]:3-18: note: calling function declared here [InCallToEntity] // CHECK:STDERR: T.S2(); } // TODO: Expected to fail in the same way as `Simple5`. fn Compound5(generic V: L2) { - // CHECK:STDERR: fail_interface_instance_caller_not.carbon:[[@LINE+4]]:3: error: cannot access member of interface `L2` in type `L2` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: V.(L2.R2)(); - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_interface_instance_caller_not.carbon:[[@LINE+2]]:3-11: error: cannot access member of interface `L2` in type `L2` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: V.(L2.R2)(); - // CHECK:STDERR: fail_interface_instance_caller_not.carbon:[[@LINE+4]]:3: error: cannot access member of interface `L2` in type `L2` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: V.(L2.S2)(); - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_interface_instance_caller_not.carbon:[[@LINE+2]]:3-11: error: cannot access member of interface `L2` in type `L2` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: V.(L2.S2)(); } @@ -145,28 +129,16 @@ impl C as A { // Since `A.G` is a non-instance method, compound member access may only be // used with a type, not an instance. 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: ({} as C).((A & A).G)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+3]]:3-23: error: cannot implicitly convert non-type value of type `C` into type implementing `A` [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+2]]:3-23: note: type `C` does not implement interface `Core.ImplicitAs(A)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: ({} as C).((A & A).G)(); - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: (({} as C) as (C as (A & A))).((A & A).G)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+3]]:3-43: error: cannot implicitly convert non-type value of type `C` into type implementing `A` [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+2]]:3-43: 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: 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: (({} as C) as (C as (A & A))).(A.G)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+3]]:3-37: error: cannot implicitly convert non-type value of type `C` into type implementing `A` [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+2]]:3-37: note: type `C` does not implement interface `Core.ImplicitAs(A)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: (({} as C) as (C as (A & A))).(A.G)(); } @@ -696,9 +668,9 @@ fn Works() { // CHECK:STDOUT: fn(%y.param: @Compound3.%V.as_type.loc14_32.1 (%V.as_type)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %y.ref: @Compound3.%V.as_type.loc14_32.1 (%V.as_type) = name_ref y, %y -// CHECK:STDOUT: %K2.ref.loc22: type = name_ref K2, file.%K2.decl [concrete = constants.%K2.type] +// CHECK:STDOUT: %K2.ref.loc18: type = name_ref K2, file.%K2.decl [concrete = constants.%K2.type] // CHECK:STDOUT: %Q2.ref: %K2.assoc_type = name_ref Q2, @K2.WithSelf.%assoc0 [concrete = constants.%assoc0.441] -// CHECK:STDOUT: %.loc22: %K2.type = converted %y.ref, [concrete = ] +// CHECK:STDOUT: %.loc18: %K2.type = converted %y.ref, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -1226,13 +1198,13 @@ fn Works() { // CHECK:STDOUT: %T.loc10_21.2: %L2.type = symbolic_binding T, 0 [symbolic = %T.loc10_21.1 (constants.%T)] // CHECK:STDOUT: } // CHECK:STDOUT: %Compound5.decl: %Compound5.type = fn_decl @Compound5 [concrete = constants.%Compound5] { -// CHECK:STDOUT: %V.patt.loc30_23.1: %pattern_type.5b3 = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc30_23.2 (constants.%V.patt)] +// CHECK:STDOUT: %V.patt.loc22_23.1: %pattern_type.5b3 = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc22_23.2 (constants.%V.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc30: type = splice_block %L2.ref.loc30 [concrete = constants.%L2.type] { +// CHECK:STDOUT: %.loc22: type = splice_block %L2.ref.loc22 [concrete = constants.%L2.type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %L2.ref.loc30: type = name_ref L2, file.%L2.decl [concrete = constants.%L2.type] +// CHECK:STDOUT: %L2.ref.loc22: type = name_ref L2, file.%L2.decl [concrete = constants.%L2.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %V.loc30_23.2: %L2.type = symbolic_binding V, 0 [symbolic = %V.loc30_23.1 (constants.%V)] +// CHECK:STDOUT: %V.loc22_23.2: %L2.type = symbolic_binding V, 0 [symbolic = %V.loc22_23.1 (constants.%V)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1302,44 +1274,44 @@ fn Works() { // CHECK:STDOUT: %T.loc10_21.1: %L2.type = symbolic_binding T, 0 [symbolic = %T.loc10_21.1 (constants.%T)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %T.as_type.loc18_4.2: type = facet_access_type %T.loc10_21.1 [symbolic = %T.as_type.loc18_4.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.as_type.loc14_4.2: type = facet_access_type %T.loc10_21.1 [symbolic = %T.as_type.loc14_4.2 (constants.%T.as_type)] // CHECK:STDOUT: %L2.WithSelf.R2.type: type = fn_type @L2.WithSelf.R2, @L2.WithSelf(%T.loc10_21.1) [symbolic = %L2.WithSelf.R2.type (constants.%L2.WithSelf.R2.type.4ee)] -// CHECK:STDOUT: %.loc18_4.2: type = fn_type_with_self_type %L2.WithSelf.R2.type, %T.loc10_21.1 [symbolic = %.loc18_4.2 (constants.%.253)] +// CHECK:STDOUT: %.loc14_4.2: type = fn_type_with_self_type %L2.WithSelf.R2.type, %T.loc10_21.1 [symbolic = %.loc14_4.2 (constants.%.253)] // CHECK:STDOUT: %L2.lookup_impl_witness: = lookup_impl_witness %T.loc10_21.1, @L2 [symbolic = %L2.lookup_impl_witness (constants.%L2.lookup_impl_witness.d84)] -// CHECK:STDOUT: %impl.elem0.loc18_4.2: @Simple5.%.loc18_4.2 (%.253) = impl_witness_access %L2.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc18_4.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %impl.elem0.loc14_4.2: @Simple5.%.loc14_4.2 (%.253) = impl_witness_access %L2.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc14_4.2 (constants.%impl.elem0)] // CHECK:STDOUT: %L2.WithSelf.S2.type: type = fn_type @L2.WithSelf.S2, @L2.WithSelf(%T.loc10_21.1) [symbolic = %L2.WithSelf.S2.type (constants.%L2.WithSelf.S2.type.746)] -// CHECK:STDOUT: %.loc26_4.2: type = fn_type_with_self_type %L2.WithSelf.S2.type, %T.loc10_21.1 [symbolic = %.loc26_4.2 (constants.%.3d3)] -// CHECK:STDOUT: %impl.elem1.loc26_4.2: @Simple5.%.loc26_4.2 (%.3d3) = impl_witness_access %L2.lookup_impl_witness, element1 [symbolic = %impl.elem1.loc26_4.2 (constants.%impl.elem1)] +// CHECK:STDOUT: %.loc18_4.2: type = fn_type_with_self_type %L2.WithSelf.S2.type, %T.loc10_21.1 [symbolic = %.loc18_4.2 (constants.%.3d3)] +// CHECK:STDOUT: %impl.elem1.loc18_4.2: @Simple5.%.loc18_4.2 (%.3d3) = impl_witness_access %L2.lookup_impl_witness, element1 [symbolic = %impl.elem1.loc18_4.2 (constants.%impl.elem1)] // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %T.ref.loc18: %L2.type = name_ref T, %T.loc10_21.2 [symbolic = %T.loc10_21.1 (constants.%T)] -// CHECK:STDOUT: %T.as_type.loc18_4.1: type = facet_access_type %T.ref.loc18 [symbolic = %T.as_type.loc18_4.2 (constants.%T.as_type)] -// CHECK:STDOUT: %.loc18_4.1: type = converted %T.ref.loc18, %T.as_type.loc18_4.1 [symbolic = %T.as_type.loc18_4.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.ref.loc14: %L2.type = name_ref T, %T.loc10_21.2 [symbolic = %T.loc10_21.1 (constants.%T)] +// CHECK:STDOUT: %T.as_type.loc14_4.1: type = facet_access_type %T.ref.loc14 [symbolic = %T.as_type.loc14_4.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc14_4.1: type = converted %T.ref.loc14, %T.as_type.loc14_4.1 [symbolic = %T.as_type.loc14_4.2 (constants.%T.as_type)] // CHECK:STDOUT: %R2.ref: %L2.assoc_type = name_ref R2, @L2.WithSelf.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc18_4.1: @Simple5.%.loc18_4.2 (%.253) = impl_witness_access constants.%L2.lookup_impl_witness.d84, element0 [symbolic = %impl.elem0.loc18_4.2 (constants.%impl.elem0)] -// CHECK:STDOUT: %T.ref.loc26: %L2.type = name_ref T, %T.loc10_21.2 [symbolic = %T.loc10_21.1 (constants.%T)] -// CHECK:STDOUT: %T.as_type.loc26: type = facet_access_type %T.ref.loc26 [symbolic = %T.as_type.loc18_4.2 (constants.%T.as_type)] -// CHECK:STDOUT: %.loc26_4.1: type = converted %T.ref.loc26, %T.as_type.loc26 [symbolic = %T.as_type.loc18_4.2 (constants.%T.as_type)] +// CHECK:STDOUT: %impl.elem0.loc14_4.1: @Simple5.%.loc14_4.2 (%.253) = impl_witness_access constants.%L2.lookup_impl_witness.d84, element0 [symbolic = %impl.elem0.loc14_4.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %T.ref.loc18: %L2.type = name_ref T, %T.loc10_21.2 [symbolic = %T.loc10_21.1 (constants.%T)] +// CHECK:STDOUT: %T.as_type.loc18: type = facet_access_type %T.ref.loc18 [symbolic = %T.as_type.loc14_4.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc18_4.1: type = converted %T.ref.loc18, %T.as_type.loc18 [symbolic = %T.as_type.loc14_4.2 (constants.%T.as_type)] // CHECK:STDOUT: %S2.ref: %L2.assoc_type = name_ref S2, @L2.WithSelf.%assoc1 [concrete = constants.%assoc1] -// CHECK:STDOUT: %impl.elem1.loc26_4.1: @Simple5.%.loc26_4.2 (%.3d3) = impl_witness_access constants.%L2.lookup_impl_witness.d84, element1 [symbolic = %impl.elem1.loc26_4.2 (constants.%impl.elem1)] +// CHECK:STDOUT: %impl.elem1.loc18_4.1: @Simple5.%.loc18_4.2 (%.3d3) = impl_witness_access constants.%L2.lookup_impl_witness.d84, element1 [symbolic = %impl.elem1.loc18_4.2 (constants.%impl.elem1)] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Compound5(%V.loc30_23.2: %L2.type) { -// CHECK:STDOUT: %V.patt.loc30_23.2: %pattern_type.5b3 = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc30_23.2 (constants.%V.patt)] -// CHECK:STDOUT: %V.loc30_23.1: %L2.type = symbolic_binding V, 0 [symbolic = %V.loc30_23.1 (constants.%V)] +// CHECK:STDOUT: generic fn @Compound5(%V.loc22_23.2: %L2.type) { +// CHECK:STDOUT: %V.patt.loc22_23.2: %pattern_type.5b3 = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc22_23.2 (constants.%V.patt)] +// CHECK:STDOUT: %V.loc22_23.1: %L2.type = symbolic_binding V, 0 [symbolic = %V.loc22_23.1 (constants.%V)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %V.ref.loc35: %L2.type = name_ref V, %V.loc30_23.2 [symbolic = %V.loc30_23.1 (constants.%V)] -// CHECK:STDOUT: %L2.ref.loc35: type = name_ref L2, file.%L2.decl [concrete = constants.%L2.type] +// CHECK:STDOUT: %V.ref.loc25: %L2.type = name_ref V, %V.loc22_23.2 [symbolic = %V.loc22_23.1 (constants.%V)] +// CHECK:STDOUT: %L2.ref.loc25: type = name_ref L2, file.%L2.decl [concrete = constants.%L2.type] // CHECK:STDOUT: %R2.ref: %L2.assoc_type = name_ref R2, @L2.WithSelf.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %V.ref.loc40: %L2.type = name_ref V, %V.loc30_23.2 [symbolic = %V.loc30_23.1 (constants.%V)] -// CHECK:STDOUT: %L2.ref.loc40: type = name_ref L2, file.%L2.decl [concrete = constants.%L2.type] +// CHECK:STDOUT: %V.ref.loc28: %L2.type = name_ref V, %V.loc22_23.2 [symbolic = %V.loc22_23.1 (constants.%V)] +// CHECK:STDOUT: %L2.ref.loc28: type = name_ref L2, file.%L2.decl [concrete = constants.%L2.type] // CHECK:STDOUT: %S2.ref: %L2.assoc_type = name_ref S2, @L2.WithSelf.%assoc1 [concrete = constants.%assoc1] // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -1385,8 +1357,8 @@ fn Works() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Compound5(constants.%V) { -// CHECK:STDOUT: %V.patt.loc30_23.2 => constants.%V.patt -// CHECK:STDOUT: %V.loc30_23.1 => constants.%V +// CHECK:STDOUT: %V.patt.loc22_23.2 => constants.%V.patt +// CHECK:STDOUT: %V.loc22_23.1 => constants.%V // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_combine_non_instance.carbon @@ -1504,62 +1476,62 @@ fn Works() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Fails() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc22_5.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %C.ref.loc22: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc22_5.2: ref %C = temporary_storage -// CHECK:STDOUT: %.loc22_5.3: init %C to %.loc22_5.2 = class_init () [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc22_7: init %C = converted %.loc22_5.1, %.loc22_5.3 [concrete = constants.%C.val] -// CHECK:STDOUT: %A.ref.loc22_15: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %A.ref.loc22_19: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %impl.elem0.loc22: %.b4e = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op] -// CHECK:STDOUT: %bound_method.loc22: = bound_method %A.ref.loc22_15, %impl.elem0.loc22 [concrete = constants.%type.as.BitAndWith.impl.Op.bound] -// CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call.loc22: init type = call %bound_method.loc22(%A.ref.loc22_15, %A.ref.loc22_19) [concrete = constants.%A.type] +// CHECK:STDOUT: %.loc18_5.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %C.ref.loc18: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %.loc18_5.2: ref %C = temporary_storage +// CHECK:STDOUT: %.loc18_5.3: init %C to %.loc18_5.2 = class_init () [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc18_7: init %C = converted %.loc18_5.1, %.loc18_5.3 [concrete = constants.%C.val] +// CHECK:STDOUT: %A.ref.loc18_15: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %A.ref.loc18_19: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %impl.elem0.loc18: %.b4e = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op] +// CHECK:STDOUT: %bound_method.loc18: = bound_method %A.ref.loc18_15, %impl.elem0.loc18 [concrete = constants.%type.as.BitAndWith.impl.Op.bound] +// CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call.loc18: init type = call %bound_method.loc18(%A.ref.loc18_15, %A.ref.loc18_19) [concrete = constants.%A.type] +// CHECK:STDOUT: %G.ref.loc18: %A.assoc_type = name_ref G, @A.WithSelf.%assoc0 [concrete = constants.%assoc0.050] +// CHECK:STDOUT: %.loc18_12: %A.type = converted %.loc18_7, [concrete = ] +// CHECK:STDOUT: %.loc22_6.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %C.ref.loc22_11: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %.loc22_6.2: ref %C = temporary_storage +// CHECK:STDOUT: %.loc22_6.3: init %C to %.loc22_6.2 = class_init () [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc22_8: init %C = converted %.loc22_6.1, %.loc22_6.3 [concrete = constants.%C.val] +// CHECK:STDOUT: %C.ref.loc22_18: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %A.ref.loc22_24: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %A.ref.loc22_28: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %impl.elem0.loc22_26: %.b4e = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op] +// CHECK:STDOUT: %bound_method.loc22_26: = bound_method %A.ref.loc22_24, %impl.elem0.loc22_26 [concrete = constants.%type.as.BitAndWith.impl.Op.bound] +// CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call.loc22_26: init type = call %bound_method.loc22_26(%A.ref.loc22_24, %A.ref.loc22_28) [concrete = constants.%A.type] +// CHECK:STDOUT: %.loc22_29.1: type = value_of_initializer %type.as.BitAndWith.impl.Op.call.loc22_26 [concrete = constants.%A.type] +// CHECK:STDOUT: %.loc22_29.2: type = converted %type.as.BitAndWith.impl.Op.call.loc22_26, %.loc22_29.1 [concrete = constants.%A.type] +// CHECK:STDOUT: %A.facet.loc22: %A.type = facet_value %C.ref.loc22_18, (constants.%A.impl_witness) [concrete = constants.%A.facet] +// CHECK:STDOUT: %.loc22_20: %A.type = converted %C.ref.loc22_18, %A.facet.loc22 [concrete = constants.%A.facet] +// CHECK:STDOUT: %as_type.loc22: type = facet_access_type %.loc22_20 [concrete = constants.%C] +// CHECK:STDOUT: %.loc22_30: type = converted %.loc22_20, %as_type.loc22 [concrete = constants.%C] +// CHECK:STDOUT: %A.ref.loc22_35: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %A.ref.loc22_39: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %impl.elem0.loc22_37: %.b4e = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op] +// CHECK:STDOUT: %bound_method.loc22_37: = bound_method %A.ref.loc22_35, %impl.elem0.loc22_37 [concrete = constants.%type.as.BitAndWith.impl.Op.bound] +// CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call.loc22_37: init type = call %bound_method.loc22_37(%A.ref.loc22_35, %A.ref.loc22_39) [concrete = constants.%A.type] // CHECK:STDOUT: %G.ref.loc22: %A.assoc_type = name_ref G, @A.WithSelf.%assoc0 [concrete = constants.%assoc0.050] -// CHECK:STDOUT: %.loc22_12: %A.type = converted %.loc22_7, [concrete = ] -// CHECK:STDOUT: %.loc30_6.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %C.ref.loc30_11: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc30_6.2: ref %C = temporary_storage -// CHECK:STDOUT: %.loc30_6.3: init %C to %.loc30_6.2 = class_init () [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc30_8: init %C = converted %.loc30_6.1, %.loc30_6.3 [concrete = constants.%C.val] -// CHECK:STDOUT: %C.ref.loc30_18: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %A.ref.loc30_24: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %A.ref.loc30_28: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %impl.elem0.loc30_26: %.b4e = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op] -// CHECK:STDOUT: %bound_method.loc30_26: = bound_method %A.ref.loc30_24, %impl.elem0.loc30_26 [concrete = constants.%type.as.BitAndWith.impl.Op.bound] -// CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call.loc30_26: init type = call %bound_method.loc30_26(%A.ref.loc30_24, %A.ref.loc30_28) [concrete = constants.%A.type] -// CHECK:STDOUT: %.loc30_29.1: type = value_of_initializer %type.as.BitAndWith.impl.Op.call.loc30_26 [concrete = constants.%A.type] -// CHECK:STDOUT: %.loc30_29.2: type = converted %type.as.BitAndWith.impl.Op.call.loc30_26, %.loc30_29.1 [concrete = constants.%A.type] -// CHECK:STDOUT: %A.facet.loc30: %A.type = facet_value %C.ref.loc30_18, (constants.%A.impl_witness) [concrete = constants.%A.facet] -// CHECK:STDOUT: %.loc30_20: %A.type = converted %C.ref.loc30_18, %A.facet.loc30 [concrete = constants.%A.facet] -// CHECK:STDOUT: %as_type.loc30: type = facet_access_type %.loc30_20 [concrete = constants.%C] -// CHECK:STDOUT: %.loc30_30: type = converted %.loc30_20, %as_type.loc30 [concrete = constants.%C] -// CHECK:STDOUT: %A.ref.loc30_35: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %A.ref.loc30_39: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %impl.elem0.loc30_37: %.b4e = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op] -// CHECK:STDOUT: %bound_method.loc30_37: = bound_method %A.ref.loc30_35, %impl.elem0.loc30_37 [concrete = constants.%type.as.BitAndWith.impl.Op.bound] -// CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call.loc30_37: init type = call %bound_method.loc30_37(%A.ref.loc30_35, %A.ref.loc30_39) [concrete = constants.%A.type] -// CHECK:STDOUT: %G.ref.loc30: %A.assoc_type = name_ref G, @A.WithSelf.%assoc0 [concrete = constants.%assoc0.050] -// CHECK:STDOUT: %.loc30_32: %A.type = converted %.loc30_8, [concrete = ] -// CHECK:STDOUT: %.loc38_6.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %C.ref.loc38_11: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc38_6.2: ref %C = temporary_storage -// CHECK:STDOUT: %.loc38_6.3: init %C to %.loc38_6.2 = class_init () [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc38_8: init %C = converted %.loc38_6.1, %.loc38_6.3 [concrete = constants.%C.val] -// CHECK:STDOUT: %C.ref.loc38_18: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %A.ref.loc38_24: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %A.ref.loc38_28: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %impl.elem0.loc38: %.b4e = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op] -// CHECK:STDOUT: %bound_method.loc38: = bound_method %A.ref.loc38_24, %impl.elem0.loc38 [concrete = constants.%type.as.BitAndWith.impl.Op.bound] -// CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call.loc38: init type = call %bound_method.loc38(%A.ref.loc38_24, %A.ref.loc38_28) [concrete = constants.%A.type] -// CHECK:STDOUT: %.loc38_29.1: type = value_of_initializer %type.as.BitAndWith.impl.Op.call.loc38 [concrete = constants.%A.type] -// CHECK:STDOUT: %.loc38_29.2: type = converted %type.as.BitAndWith.impl.Op.call.loc38, %.loc38_29.1 [concrete = constants.%A.type] -// CHECK:STDOUT: %A.facet.loc38: %A.type = facet_value %C.ref.loc38_18, (constants.%A.impl_witness) [concrete = constants.%A.facet] -// CHECK:STDOUT: %.loc38_20: %A.type = converted %C.ref.loc38_18, %A.facet.loc38 [concrete = constants.%A.facet] -// CHECK:STDOUT: %as_type.loc38: type = facet_access_type %.loc38_20 [concrete = constants.%C] -// CHECK:STDOUT: %.loc38_30: type = converted %.loc38_20, %as_type.loc38 [concrete = constants.%C] -// CHECK:STDOUT: %A.ref.loc38_34: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %G.ref.loc38: %A.assoc_type = name_ref G, @A.WithSelf.%assoc0 [concrete = constants.%assoc0.050] -// CHECK:STDOUT: %.loc38_32: %A.type = converted %.loc38_8, [concrete = ] +// CHECK:STDOUT: %.loc22_32: %A.type = converted %.loc22_8, [concrete = ] +// CHECK:STDOUT: %.loc26_6.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %C.ref.loc26_11: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %.loc26_6.2: ref %C = temporary_storage +// CHECK:STDOUT: %.loc26_6.3: init %C to %.loc26_6.2 = class_init () [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc26_8: init %C = converted %.loc26_6.1, %.loc26_6.3 [concrete = constants.%C.val] +// CHECK:STDOUT: %C.ref.loc26_18: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %A.ref.loc26_24: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %A.ref.loc26_28: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %impl.elem0.loc26: %.b4e = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op] +// CHECK:STDOUT: %bound_method.loc26: = bound_method %A.ref.loc26_24, %impl.elem0.loc26 [concrete = constants.%type.as.BitAndWith.impl.Op.bound] +// CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call.loc26: init type = call %bound_method.loc26(%A.ref.loc26_24, %A.ref.loc26_28) [concrete = constants.%A.type] +// CHECK:STDOUT: %.loc26_29.1: type = value_of_initializer %type.as.BitAndWith.impl.Op.call.loc26 [concrete = constants.%A.type] +// CHECK:STDOUT: %.loc26_29.2: type = converted %type.as.BitAndWith.impl.Op.call.loc26, %.loc26_29.1 [concrete = constants.%A.type] +// CHECK:STDOUT: %A.facet.loc26: %A.type = facet_value %C.ref.loc26_18, (constants.%A.impl_witness) [concrete = constants.%A.facet] +// CHECK:STDOUT: %.loc26_20: %A.type = converted %C.ref.loc26_18, %A.facet.loc26 [concrete = constants.%A.facet] +// CHECK:STDOUT: %as_type.loc26: type = facet_access_type %.loc26_20 [concrete = constants.%C] +// CHECK:STDOUT: %.loc26_30: type = converted %.loc26_20, %as_type.loc26 [concrete = constants.%C] +// CHECK:STDOUT: %A.ref.loc26_34: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %G.ref.loc26: %A.assoc_type = name_ref G, @A.WithSelf.%assoc0 [concrete = constants.%assoc0.050] +// CHECK:STDOUT: %.loc26_32: %A.type = converted %.loc26_8, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/fail_add_member_outside_definition.carbon b/toolchain/check/testdata/interface/fail_add_member_outside_definition.carbon index 8674514a27f8..b8f23e45baee 100644 --- a/toolchain/check/testdata/interface/fail_add_member_outside_definition.carbon +++ b/toolchain/check/testdata/interface/fail_add_member_outside_definition.carbon @@ -14,24 +14,18 @@ interface Interface { } -// CHECK:STDERR: fail_add_member_outside_definition.carbon:[[@LINE+4]]:14: error: out-of-line declaration requires a declaration in scoped entity [QualifiedDeclOutsideScopeEntity] -// CHECK:STDERR: fn Interface.F() {} -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_add_member_outside_definition.carbon:[[@LINE+2]]:14: error: out-of-line declaration requires a declaration in scoped entity [QualifiedDeclOutsideScopeEntity] // CHECK:STDERR: fn Interface.F() {} // Nesting interfaces like this is not valid, but make sure we don't crash. interface Outer { interface Inner { - // CHECK:STDERR: fail_add_member_outside_definition.carbon:[[@LINE+4]]:8: error: name `Outer` not found [NameNotFound] - // CHECK:STDERR: fn Outer.F(); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_add_member_outside_definition.carbon:[[@LINE+2]]:8-12: error: name `Outer` not found [NameNotFound] // CHECK:STDERR: fn Outer.F(); } - // CHECK:STDERR: fail_add_member_outside_definition.carbon:[[@LINE+4]]:12: error: out-of-line declaration requires a declaration in scoped entity [QualifiedDeclOutsideScopeEntity] - // CHECK:STDERR: fn Inner.F(); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_add_member_outside_definition.carbon:[[@LINE+2]]:12: error: out-of-line declaration requires a declaration in scoped entity [QualifiedDeclOutsideScopeEntity] // CHECK:STDERR: fn Inner.F(); } @@ -48,9 +42,9 @@ interface Outer { // CHECK:STDOUT: %Self.a58: %Outer.type = symbolic_binding Self, 0 [symbolic] // CHECK:STDOUT: %Inner.type: type = facet_type <@Inner, @Inner(%Self.a58)> [symbolic] // CHECK:STDOUT: %Self.4ae: %Inner.type = symbolic_binding Self, 1 [symbolic] -// CHECK:STDOUT: %Inner.WithSelf.F.type.3f066d.1: type = fn_type @Inner.WithSelf.F.loc30, @Inner.WithSelf(%Self.a58, %Self.4ae) [symbolic] +// CHECK:STDOUT: %Inner.WithSelf.F.type.3f066d.1: type = fn_type @Inner.WithSelf.F.loc26, @Inner.WithSelf(%Self.a58, %Self.4ae) [symbolic] // CHECK:STDOUT: %Inner.WithSelf.F.3cb3ec.1: %Inner.WithSelf.F.type.3f066d.1 = struct_value () [symbolic] -// CHECK:STDOUT: %Inner.WithSelf.F.type.3f066d.2: type = fn_type @Inner.WithSelf.F.loc36, @Inner.WithSelf(%Self.a58, %Self.4ae) [symbolic] +// CHECK:STDOUT: %Inner.WithSelf.F.type.3f066d.2: type = fn_type @Inner.WithSelf.F.loc30, @Inner.WithSelf(%Self.a58, %Self.4ae) [symbolic] // CHECK:STDOUT: %Inner.WithSelf.F.3cb3ec.2: %Inner.WithSelf.F.type.3f066d.2 = struct_value () [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -82,7 +76,7 @@ interface Outer { // CHECK:STDOUT: // CHECK:STDOUT: !with Self: // CHECK:STDOUT: %Inner.decl: type = interface_decl @Inner [symbolic = @Outer.WithSelf.%Inner.type (constants.%Inner.type)] {} {} -// CHECK:STDOUT: %Inner.WithSelf.F.decl: @Outer.WithSelf.%Inner.WithSelf.F.type (%Inner.WithSelf.F.type.3f066d.2) = fn_decl @Inner.WithSelf.F.loc36 [symbolic = @Outer.WithSelf.%Inner.WithSelf.F (constants.%Inner.WithSelf.F.3cb3ec.2)] {} {} +// CHECK:STDOUT: %Inner.WithSelf.F.decl: @Outer.WithSelf.%Inner.WithSelf.F.type (%Inner.WithSelf.F.type.3f066d.2) = fn_decl @Inner.WithSelf.F.loc30 [symbolic = @Outer.WithSelf.%Inner.WithSelf.F (constants.%Inner.WithSelf.F.3cb3ec.2)] {} {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self @@ -94,19 +88,19 @@ interface Outer { // CHECK:STDOUT: // CHECK:STDOUT: generic interface @Inner(@Outer.%Self: %Outer.type) { // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Self.loc25_19.2: %Outer.type = symbolic_binding Self, 0 [symbolic = %Self.loc25_19.2 (constants.%Self.a58)] -// CHECK:STDOUT: %Inner.type: type = facet_type <@Inner, @Inner(%Self.loc25_19.2)> [symbolic = %Inner.type (constants.%Inner.type)] -// CHECK:STDOUT: %Self.loc25_19.3: @Inner.%Inner.type (%Inner.type) = symbolic_binding Self, 1 [symbolic = %Self.loc25_19.3 (constants.%Self.4ae)] +// CHECK:STDOUT: %Self.loc23_19.2: %Outer.type = symbolic_binding Self, 0 [symbolic = %Self.loc23_19.2 (constants.%Self.a58)] +// CHECK:STDOUT: %Inner.type: type = facet_type <@Inner, @Inner(%Self.loc23_19.2)> [symbolic = %Inner.type (constants.%Inner.type)] +// CHECK:STDOUT: %Self.loc23_19.3: @Inner.%Inner.type (%Inner.type) = symbolic_binding Self, 1 [symbolic = %Self.loc23_19.3 (constants.%Self.4ae)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.loc25_19.1: @Inner.%Inner.type (%Inner.type) = symbolic_binding Self, 1 [symbolic = %Self.loc25_19.3 (constants.%Self.4ae)] +// CHECK:STDOUT: %Self.loc23_19.1: @Inner.%Inner.type (%Inner.type) = symbolic_binding Self, 1 [symbolic = %Self.loc23_19.3 (constants.%Self.4ae)] // CHECK:STDOUT: %Inner.WithSelf.decl = interface_with_self_decl @Inner [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !with Self: -// CHECK:STDOUT: %Inner.WithSelf.F.decl: @Inner.WithSelf.%Inner.WithSelf.F.type (%Inner.WithSelf.F.type.3f066d.1) = fn_decl @Inner.WithSelf.F.loc30 [symbolic = @Inner.WithSelf.%Inner.WithSelf.F (constants.%Inner.WithSelf.F.3cb3ec.1)] {} {} +// CHECK:STDOUT: %Inner.WithSelf.F.decl: @Inner.WithSelf.%Inner.WithSelf.F.type (%Inner.WithSelf.F.type.3f066d.1) = fn_decl @Inner.WithSelf.F.loc26 [symbolic = @Inner.WithSelf.%Inner.WithSelf.F (constants.%Inner.WithSelf.F.3cb3ec.1)] {} {} // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.loc25_19.1 +// CHECK:STDOUT: .Self = %Self.loc23_19.1 // CHECK:STDOUT: .F = @Outer.WithSelf.%Inner.WithSelf.F.decl // CHECK:STDOUT: witness = () // CHECK:STDOUT: @@ -123,11 +117,11 @@ interface Outer { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Inner.WithSelf.F.loc30(@Outer.%Self: %Outer.type, @Inner.%Self.loc25_19.1: @Inner.%Inner.type (%Inner.type)) { +// CHECK:STDOUT: generic fn @Inner.WithSelf.F.loc26(@Outer.%Self: %Outer.type, @Inner.%Self.loc23_19.1: @Inner.%Inner.type (%Inner.type)) { // CHECK:STDOUT: fn(); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Inner.WithSelf.F.loc36(@Outer.%Self: %Outer.type, @Inner.%Self.loc25_19.1: @Inner.%Inner.type (%Inner.type)) { +// CHECK:STDOUT: generic fn @Inner.WithSelf.F.loc30(@Outer.%Self: %Outer.type, @Inner.%Self.loc23_19.1: @Inner.%Inner.type (%Inner.type)) { // CHECK:STDOUT: fn(); // CHECK:STDOUT: } // CHECK:STDOUT: @@ -139,14 +133,14 @@ interface Outer { // CHECK:STDOUT: // CHECK:STDOUT: specific @Inner(constants.%Self.a58) { // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Self.loc25_19.2 => constants.%Self.a58 +// CHECK:STDOUT: %Self.loc23_19.2 => constants.%Self.a58 // CHECK:STDOUT: %Inner.type => constants.%Inner.type -// CHECK:STDOUT: %Self.loc25_19.3 => constants.%Self.4ae +// CHECK:STDOUT: %Self.loc23_19.3 => constants.%Self.4ae // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Inner.WithSelf(constants.%Self.a58, constants.%Self.4ae) {} // CHECK:STDOUT: +// CHECK:STDOUT: specific @Inner.WithSelf.F.loc26(constants.%Self.a58, constants.%Self.4ae) {} +// CHECK:STDOUT: // CHECK:STDOUT: specific @Inner.WithSelf.F.loc30(constants.%Self.a58, constants.%Self.4ae) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Inner.WithSelf.F.loc36(constants.%Self.a58, constants.%Self.4ae) {} -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/fail_assoc_const_alias.carbon b/toolchain/check/testdata/interface/fail_assoc_const_alias.carbon index 7d253c551415..593ef73019a5 100644 --- a/toolchain/check/testdata/interface/fail_assoc_const_alias.carbon +++ b/toolchain/check/testdata/interface/fail_assoc_const_alias.carbon @@ -19,9 +19,7 @@ interface I { interface J { alias U = I.T; - // CHECK:STDERR: fail_alias_to_different_interface.carbon:[[@LINE+4]]:13: error: cannot convert type `Self` that implements `J` into type implementing `I` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fn F() -> U; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_alias_to_different_interface.carbon:[[@LINE+2]]:13: error: cannot convert type `Self` that implements `J` into type implementing `I` [ConversionFailureFacetToFacet] // CHECK:STDERR: fn F() -> U; } @@ -52,9 +50,7 @@ interface A { } interface B { alias F = A.F; - // CHECK:STDERR: fail_call_method_alias.carbon:[[@LINE+4]]:13: error: cannot convert type `Self` that implements `B` into type implementing `A` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fn G() -> F(); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_call_method_alias.carbon:[[@LINE+2]]:13: error: cannot convert type `Self` that implements `B` into type implementing `A` [ConversionFailureFacetToFacet] // CHECK:STDERR: fn G() -> F(); } 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 3edcadd289a3..18fd37ad95ef 100644 --- a/toolchain/check/testdata/interface/fail_assoc_const_bad_default.carbon +++ b/toolchain/check/testdata/interface/fail_assoc_const_bad_default.carbon @@ -13,12 +13,8 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/fail_assoc_const_bad_default.carbon 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let T: type = 42; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_assoc_const_bad_default.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: fail_assoc_const_bad_default.carbon:[[@LINE+2]]:3-19: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let T: type = 42; } @@ -62,7 +58,7 @@ interface I { // CHECK:STDOUT: %T: type = assoc_const_decl @T [concrete] { // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.WithSelf.%T [concrete = constants.%assoc0.2ce] // CHECK:STDOUT: %int_42: Core.IntLiteral = int_value 42 [concrete = constants.%int_42] -// CHECK:STDOUT: %.loc23: type = converted %int_42, [concrete = ] +// CHECK:STDOUT: %.loc19: type = converted %int_42, [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: diff --git a/toolchain/check/testdata/interface/fail_assoc_fn_invalid_use.carbon b/toolchain/check/testdata/interface/fail_assoc_fn_invalid_use.carbon index 48fce784ae38..64b01bad8a6a 100644 --- a/toolchain/check/testdata/interface/fail_assoc_fn_invalid_use.carbon +++ b/toolchain/check/testdata/interface/fail_assoc_fn_invalid_use.carbon @@ -21,9 +21,7 @@ interface I { } fn Use(generic T: I) { - // CHECK:STDERR: fail_member_access.carbon:[[@LINE+4]]:3: error: type `` does not support qualified expressions [QualifiedExprUnsupported] - // CHECK:STDERR: T.F.member; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_member_access.carbon:[[@LINE+2]]:3-12: error: type `` does not support qualified expressions [QualifiedExprUnsupported] // CHECK:STDERR: T.F.member; } @@ -117,20 +115,20 @@ fn Use(generic T: I) { // CHECK:STDOUT: %T.loc8_17.1: %I.type = symbolic_binding T, 0 [symbolic = %T.loc8_17.1 (constants.%T)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %T.as_type.loc13_4.2: type = facet_access_type %T.loc8_17.1 [symbolic = %T.as_type.loc13_4.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.as_type.loc11_4.2: type = facet_access_type %T.loc8_17.1 [symbolic = %T.as_type.loc11_4.2 (constants.%T.as_type)] // CHECK:STDOUT: %I.WithSelf.F.type: type = fn_type @I.WithSelf.F, @I.WithSelf(%T.loc8_17.1) [symbolic = %I.WithSelf.F.type (constants.%I.WithSelf.F.type.eae)] -// CHECK:STDOUT: %.loc13_4.2: type = fn_type_with_self_type %I.WithSelf.F.type, %T.loc8_17.1 [symbolic = %.loc13_4.2 (constants.%.b94)] +// CHECK:STDOUT: %.loc11_4.2: type = fn_type_with_self_type %I.WithSelf.F.type, %T.loc8_17.1 [symbolic = %.loc11_4.2 (constants.%.b94)] // CHECK:STDOUT: %I.lookup_impl_witness: = lookup_impl_witness %T.loc8_17.1, @I [symbolic = %I.lookup_impl_witness (constants.%I.lookup_impl_witness)] -// CHECK:STDOUT: %impl.elem0.loc13_4.2: @Use.%.loc13_4.2 (%.b94) = impl_witness_access %I.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc13_4.2 (constants.%impl.elem0)] -// CHECK:STDOUT: %require_complete: = require_complete_type %.loc13_4.2 [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %impl.elem0.loc11_4.2: @Use.%.loc11_4.2 (%.b94) = impl_witness_access %I.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc11_4.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %require_complete: = require_complete_type %.loc11_4.2 [symbolic = %require_complete (constants.%require_complete)] // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %T.ref: %I.type = name_ref T, %T.loc8_17.2 [symbolic = %T.loc8_17.1 (constants.%T)] -// CHECK:STDOUT: %T.as_type.loc13_4.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc13_4.2 (constants.%T.as_type)] -// CHECK:STDOUT: %.loc13_4.1: type = converted %T.ref, %T.as_type.loc13_4.1 [symbolic = %T.as_type.loc13_4.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.as_type.loc11_4.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc11_4.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc11_4.1: type = converted %T.ref, %T.as_type.loc11_4.1 [symbolic = %T.as_type.loc11_4.2 (constants.%T.as_type)] // CHECK:STDOUT: %F.ref: %I.assoc_type = name_ref F, @I.WithSelf.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc13_4.1: @Use.%.loc13_4.2 (%.b94) = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc13_4.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %impl.elem0.loc11_4.1: @Use.%.loc11_4.2 (%.b94) = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc11_4.2 (constants.%impl.elem0)] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/interface/fail_definition_imported.carbon b/toolchain/check/testdata/interface/fail_definition_imported.carbon index 19ae0e534767..ec49cd5c26e0 100644 --- a/toolchain/check/testdata/interface/fail_definition_imported.carbon +++ b/toolchain/check/testdata/interface/fail_definition_imported.carbon @@ -24,13 +24,9 @@ library "[[@TEST_NAME]]"; import library "a"; // TODO: Replace this diagnostic with one that better describes the error, such as 'DeclaredInMultipleLibraries'. -// CHECK:STDERR: fail_b.carbon:[[@LINE+8]]:1: error: redeclaration of `interface I` is redundant [RedeclRedundant] -// CHECK:STDERR: interface I {} -// CHECK:STDERR: ^~~~~~~~~~~~~ -// CHECK:STDERR: fail_b.carbon:[[@LINE-6]]:1: in import [InImport] -// CHECK:STDERR: a.carbon:4:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: interface I; -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_b.carbon:[[@LINE+4]]:1-13: error: redeclaration of `interface I` is redundant [RedeclRedundant] +// CHECK:STDERR: imported from: fail_b.carbon:[[@LINE-4]]:1 [InImport] +// CHECK:STDERR: a.carbon:4:1-12: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: interface I {} diff --git a/toolchain/check/testdata/interface/fail_duplicate.carbon b/toolchain/check/testdata/interface/fail_duplicate.carbon index 5359369d481a..abef5924bf62 100644 --- a/toolchain/check/testdata/interface/fail_duplicate.carbon +++ b/toolchain/check/testdata/interface/fail_duplicate.carbon @@ -18,12 +18,8 @@ library "[[@TEST_NAME]]"; interface Interface { } -// CHECK:STDERR: fail_redefine_without_dependents.carbon:[[@LINE+7]]:1: error: redefinition of `interface Interface` [RedeclRedef] -// CHECK:STDERR: interface Interface { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_redefine_without_dependents.carbon:[[@LINE-5]]:1: note: previously defined here [RedeclPrevDef] -// CHECK:STDERR: interface Interface { } -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_redefine_without_dependents.carbon:[[@LINE+3]]:1-21: error: redefinition of `interface Interface` [RedeclRedef] +// CHECK:STDERR: fail_redefine_without_dependents.carbon:[[@LINE-3]]:1-21: note: previously defined here [RedeclPrevDef] // CHECK:STDERR: interface Interface { fn F(); @@ -35,12 +31,8 @@ library "[[@TEST_NAME]]"; interface Interface {} -// CHECK:STDERR: fail_redefine_with_dependents.carbon:[[@LINE+7]]:1: error: redefinition of `interface Interface` [RedeclRedef] -// CHECK:STDERR: interface Interface { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_redefine_with_dependents.carbon:[[@LINE-5]]:1: note: previously defined here [RedeclPrevDef] -// CHECK:STDERR: interface Interface {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_redefine_with_dependents.carbon:[[@LINE+3]]:1-21: error: redefinition of `interface Interface` [RedeclRedef] +// CHECK:STDERR: fail_redefine_with_dependents.carbon:[[@LINE-3]]:1-21: note: previously defined here [RedeclPrevDef] // CHECK:STDERR: interface Interface { fn F(self); @@ -52,12 +44,8 @@ library "[[@TEST_NAME]]"; fn Function(); -// CHECK:STDERR: fail_name_conflict_with_fn.carbon:[[@LINE+7]]:11: error: duplicate name `Function` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: interface Function; -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_name_conflict_with_fn.carbon:[[@LINE-5]]:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: fn Function(); -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_name_conflict_with_fn.carbon:[[@LINE+3]]:11-18: error: duplicate name `Function` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_name_conflict_with_fn.carbon:[[@LINE-3]]:1-14: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: interface Function; @@ -65,12 +53,8 @@ interface Function; class Class; -// CHECK:STDERR: fail_name_conflict_with_class.carbon:[[@LINE+7]]:11: error: duplicate name `Class` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: interface Class { } -// CHECK:STDERR: ^~~~~ -// CHECK:STDERR: fail_name_conflict_with_class.carbon:[[@LINE-5]]:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: class Class; -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_name_conflict_with_class.carbon:[[@LINE+3]]:11-15: error: duplicate name `Class` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_name_conflict_with_class.carbon:[[@LINE-3]]:1-12: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: interface Class { } @@ -81,12 +65,12 @@ interface Class { } // CHECK:STDOUT: type: type = facet_type [concrete] // CHECK:STDOUT: %Interface.type.283524.1: type = facet_type <@Interface.loc4> [concrete] // CHECK:STDOUT: %Self.3ce02d.1: %Interface.type.283524.1 = symbolic_binding Self, 0 [symbolic] -// CHECK:STDOUT: %Interface.type.283524.2: type = facet_type <@Interface.loc13> [concrete] +// CHECK:STDOUT: %Interface.type.283524.2: type = facet_type <@Interface.loc9> [concrete] // CHECK:STDOUT: %Self.3ce02d.2: %Interface.type.283524.2 = symbolic_binding Self, 0 [symbolic] -// CHECK:STDOUT: %Interface.WithSelf.F.type: type = fn_type @Interface.WithSelf.F, @Interface.WithSelf.loc13(%Self.3ce02d.2) [symbolic] +// CHECK:STDOUT: %Interface.WithSelf.F.type: type = fn_type @Interface.WithSelf.F, @Interface.WithSelf.loc9(%Self.3ce02d.2) [symbolic] // CHECK:STDOUT: %Interface.WithSelf.F: %Interface.WithSelf.F.type = struct_value () [symbolic] -// CHECK:STDOUT: %Interface.assoc_type: type = assoc_entity_type @Interface.loc13 [concrete] -// CHECK:STDOUT: %assoc0: %Interface.assoc_type = assoc_entity element0, @Interface.WithSelf.loc13.%Interface.WithSelf.F.decl [concrete] +// CHECK:STDOUT: %Interface.assoc_type: type = assoc_entity_type @Interface.loc9 [concrete] +// CHECK:STDOUT: %assoc0: %Interface.assoc_type = assoc_entity element0, @Interface.WithSelf.loc9.%Interface.WithSelf.F.decl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -94,7 +78,7 @@ interface Class { } // CHECK:STDOUT: .Interface = %Interface.decl.loc4 // CHECK:STDOUT: } // CHECK:STDOUT: %Interface.decl.loc4: type = interface_decl @Interface.loc4 [concrete = constants.%Interface.type.283524.1] {} {} -// CHECK:STDOUT: %Interface.decl.loc13: type = interface_decl @Interface.loc13 [concrete = constants.%Interface.type.283524.2] {} {} +// CHECK:STDOUT: %Interface.decl.loc9: type = interface_decl @Interface.loc9 [concrete = constants.%Interface.type.283524.2] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Interface.loc4 { @@ -108,29 +92,29 @@ interface Class { } // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: interface @Interface.loc13 { +// CHECK:STDOUT: interface @Interface.loc9 { // CHECK:STDOUT: %Self: %Interface.type.283524.2 = symbolic_binding Self, 0 [symbolic = constants.%Self.3ce02d.2] -// CHECK:STDOUT: %Interface.WithSelf.decl = interface_with_self_decl @Interface.loc13 [concrete] +// CHECK:STDOUT: %Interface.WithSelf.decl = interface_with_self_decl @Interface.loc9 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !with Self: -// CHECK:STDOUT: %Interface.WithSelf.F.decl: @Interface.WithSelf.loc13.%Interface.WithSelf.F.type (%Interface.WithSelf.F.type) = fn_decl @Interface.WithSelf.F [symbolic = @Interface.WithSelf.loc13.%Interface.WithSelf.F (constants.%Interface.WithSelf.F)] {} {} +// CHECK:STDOUT: %Interface.WithSelf.F.decl: @Interface.WithSelf.loc9.%Interface.WithSelf.F.type (%Interface.WithSelf.F.type) = fn_decl @Interface.WithSelf.F [symbolic = @Interface.WithSelf.loc9.%Interface.WithSelf.F (constants.%Interface.WithSelf.F)] {} {} // CHECK:STDOUT: %assoc0: %Interface.assoc_type = assoc_entity element0, %Interface.WithSelf.F.decl [concrete = constants.%assoc0] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = @Interface.WithSelf.loc13.%assoc0 -// CHECK:STDOUT: witness = (@Interface.WithSelf.loc13.%Interface.WithSelf.F.decl) +// CHECK:STDOUT: .F = @Interface.WithSelf.loc9.%assoc0 +// CHECK:STDOUT: witness = (@Interface.WithSelf.loc9.%Interface.WithSelf.F.decl) // CHECK:STDOUT: // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Interface.WithSelf.F(@Interface.loc13.%Self: %Interface.type.283524.2) { +// CHECK:STDOUT: generic fn @Interface.WithSelf.F(@Interface.loc9.%Self: %Interface.type.283524.2) { // CHECK:STDOUT: fn(); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Interface.WithSelf.loc4(constants.%Self.3ce02d.1) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Interface.WithSelf.loc13(constants.%Self.3ce02d.2) {} +// CHECK:STDOUT: specific @Interface.WithSelf.loc9(constants.%Self.3ce02d.2) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @Interface.WithSelf.F(constants.%Self.3ce02d.2) {} // CHECK:STDOUT: @@ -140,16 +124,16 @@ interface Class { } // CHECK:STDOUT: type: type = facet_type [concrete] // CHECK:STDOUT: %Interface.type.283524.1: type = facet_type <@Interface.loc4> [concrete] // CHECK:STDOUT: %Self.3ce02d.1: %Interface.type.283524.1 = symbolic_binding Self, 0 [symbolic] -// CHECK:STDOUT: %Interface.type.283524.2: type = facet_type <@Interface.loc13> [concrete] +// CHECK:STDOUT: %Interface.type.283524.2: type = facet_type <@Interface.loc9> [concrete] // CHECK:STDOUT: %Self.3ce02d.2: %Interface.type.283524.2 = symbolic_binding Self, 0 [symbolic] // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.3ce02d.2 [symbolic] // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type [symbolic] // CHECK:STDOUT: %self.param_patt: %pattern_type = value_param_pattern [symbolic] // CHECK:STDOUT: %self.patt: %pattern_type = wrapper_binding_pattern self, %self.param_patt [symbolic] -// CHECK:STDOUT: %Interface.WithSelf.F.type: type = fn_type @Interface.WithSelf.F, @Interface.WithSelf.loc13(%Self.3ce02d.2) [symbolic] +// CHECK:STDOUT: %Interface.WithSelf.F.type: type = fn_type @Interface.WithSelf.F, @Interface.WithSelf.loc9(%Self.3ce02d.2) [symbolic] // CHECK:STDOUT: %Interface.WithSelf.F: %Interface.WithSelf.F.type = struct_value () [symbolic] -// CHECK:STDOUT: %Interface.assoc_type: type = assoc_entity_type @Interface.loc13 [concrete] -// CHECK:STDOUT: %assoc0: %Interface.assoc_type = assoc_entity element0, @Interface.WithSelf.loc13.%Interface.WithSelf.F.decl [concrete] +// CHECK:STDOUT: %Interface.assoc_type: type = assoc_entity_type @Interface.loc9 [concrete] +// CHECK:STDOUT: %assoc0: %Interface.assoc_type = assoc_entity element0, @Interface.WithSelf.loc9.%Interface.WithSelf.F.decl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -157,7 +141,7 @@ interface Class { } // CHECK:STDOUT: .Interface = %Interface.decl.loc4 // CHECK:STDOUT: } // CHECK:STDOUT: %Interface.decl.loc4: type = interface_decl @Interface.loc4 [concrete = constants.%Interface.type.283524.1] {} {} -// CHECK:STDOUT: %Interface.decl.loc13: type = interface_decl @Interface.loc13 [concrete = constants.%Interface.type.283524.2] {} {} +// CHECK:STDOUT: %Interface.decl.loc9: type = interface_decl @Interface.loc9 [concrete = constants.%Interface.type.283524.2] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Interface.loc4 { @@ -171,53 +155,53 @@ interface Class { } // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: interface @Interface.loc13 { +// CHECK:STDOUT: interface @Interface.loc9 { // CHECK:STDOUT: %Self: %Interface.type.283524.2 = symbolic_binding Self, 0 [symbolic = constants.%Self.3ce02d.2] -// CHECK:STDOUT: %Interface.WithSelf.decl = interface_with_self_decl @Interface.loc13 [concrete] +// CHECK:STDOUT: %Interface.WithSelf.decl = interface_with_self_decl @Interface.loc9 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !with Self: -// CHECK:STDOUT: %Interface.WithSelf.F.decl: @Interface.WithSelf.loc13.%Interface.WithSelf.F.type (%Interface.WithSelf.F.type) = fn_decl @Interface.WithSelf.F [symbolic = @Interface.WithSelf.loc13.%Interface.WithSelf.F (constants.%Interface.WithSelf.F)] { -// CHECK:STDOUT: %self.param_patt.loc14_8.1: @Interface.WithSelf.F.%pattern_type (%pattern_type) = value_param_pattern [symbolic = %self.param_patt.loc14_8.2 (constants.%self.param_patt)] -// CHECK:STDOUT: %self.patt.loc14_8.1: @Interface.WithSelf.F.%pattern_type (%pattern_type) = wrapper_binding_pattern self, %self.param_patt.loc14_8.1 [symbolic = %self.patt.loc14_8.2 (constants.%self.patt)] +// CHECK:STDOUT: %Interface.WithSelf.F.decl: @Interface.WithSelf.loc9.%Interface.WithSelf.F.type (%Interface.WithSelf.F.type) = fn_decl @Interface.WithSelf.F [symbolic = @Interface.WithSelf.loc9.%Interface.WithSelf.F (constants.%Interface.WithSelf.F)] { +// CHECK:STDOUT: %self.param_patt.loc10_8.1: @Interface.WithSelf.F.%pattern_type (%pattern_type) = value_param_pattern [symbolic = %self.param_patt.loc10_8.2 (constants.%self.param_patt)] +// CHECK:STDOUT: %self.patt.loc10_8.1: @Interface.WithSelf.F.%pattern_type (%pattern_type) = wrapper_binding_pattern self, %self.param_patt.loc10_8.1 [symbolic = %self.patt.loc10_8.2 (constants.%self.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: @Interface.WithSelf.F.%Self.as_type.loc14_8.1 (%Self.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc14_8.1: type = splice_block %.loc14_8.2 [symbolic = %Self.as_type.loc14_8.1 (constants.%Self.as_type)] { -// CHECK:STDOUT: %Self.ref: %Interface.type.283524.2 = name_ref Self, @Interface.loc13.%Self [symbolic = %Self (constants.%Self.3ce02d.2)] -// CHECK:STDOUT: %Self.as_type.loc14_8.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc14_8.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %.loc14_8.2: type = converted %Self.ref, %Self.as_type.loc14_8.2 [symbolic = %Self.as_type.loc14_8.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %self.param: @Interface.WithSelf.F.%Self.as_type.loc10_8.1 (%Self.as_type) = value_param call_param0 +// CHECK:STDOUT: %.loc10_8.1: type = splice_block %.loc10_8.2 [symbolic = %Self.as_type.loc10_8.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %Self.ref: %Interface.type.283524.2 = name_ref Self, @Interface.loc9.%Self [symbolic = %Self (constants.%Self.3ce02d.2)] +// CHECK:STDOUT: %Self.as_type.loc10_8.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc10_8.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc10_8.2: type = converted %Self.ref, %Self.as_type.loc10_8.2 [symbolic = %Self.as_type.loc10_8.1 (constants.%Self.as_type)] // CHECK:STDOUT: } -// CHECK:STDOUT: %self: @Interface.WithSelf.F.%Self.as_type.loc14_8.1 (%Self.as_type) = wrapper_binding self, %self.param +// CHECK:STDOUT: %self: @Interface.WithSelf.F.%Self.as_type.loc10_8.1 (%Self.as_type) = wrapper_binding self, %self.param // CHECK:STDOUT: } // CHECK:STDOUT: %assoc0: %Interface.assoc_type = assoc_entity element0, %Interface.WithSelf.F.decl [concrete = constants.%assoc0] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = @Interface.WithSelf.loc13.%assoc0 -// CHECK:STDOUT: witness = (@Interface.WithSelf.loc13.%Interface.WithSelf.F.decl) +// CHECK:STDOUT: .F = @Interface.WithSelf.loc9.%assoc0 +// CHECK:STDOUT: witness = (@Interface.WithSelf.loc9.%Interface.WithSelf.F.decl) // CHECK:STDOUT: // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Interface.WithSelf.F(@Interface.loc13.%Self: %Interface.type.283524.2) { +// CHECK:STDOUT: generic fn @Interface.WithSelf.F(@Interface.loc9.%Self: %Interface.type.283524.2) { // CHECK:STDOUT: %Self: %Interface.type.283524.2 = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.3ce02d.2)] -// CHECK:STDOUT: %Self.as_type.loc14_8.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc14_8.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc14_8.1 [symbolic = %pattern_type (constants.%pattern_type)] -// CHECK:STDOUT: %self.param_patt.loc14_8.2: @Interface.WithSelf.F.%pattern_type (%pattern_type) = value_param_pattern [symbolic = %self.param_patt.loc14_8.2 (constants.%self.param_patt)] -// CHECK:STDOUT: %self.patt.loc14_8.2: @Interface.WithSelf.F.%pattern_type (%pattern_type) = wrapper_binding_pattern self, %self.param_patt.loc14_8.2 [symbolic = %self.patt.loc14_8.2 (constants.%self.patt)] +// CHECK:STDOUT: %Self.as_type.loc10_8.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc10_8.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc10_8.1 [symbolic = %pattern_type (constants.%pattern_type)] +// CHECK:STDOUT: %self.param_patt.loc10_8.2: @Interface.WithSelf.F.%pattern_type (%pattern_type) = value_param_pattern [symbolic = %self.param_patt.loc10_8.2 (constants.%self.param_patt)] +// CHECK:STDOUT: %self.patt.loc10_8.2: @Interface.WithSelf.F.%pattern_type (%pattern_type) = wrapper_binding_pattern self, %self.param_patt.loc10_8.2 [symbolic = %self.patt.loc10_8.2 (constants.%self.patt)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%self.param: @Interface.WithSelf.F.%Self.as_type.loc14_8.1 (%Self.as_type)); +// CHECK:STDOUT: fn(%self.param: @Interface.WithSelf.F.%Self.as_type.loc10_8.1 (%Self.as_type)); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Interface.WithSelf.loc4(constants.%Self.3ce02d.1) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Interface.WithSelf.loc13(constants.%Self.3ce02d.2) {} +// CHECK:STDOUT: specific @Interface.WithSelf.loc9(constants.%Self.3ce02d.2) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @Interface.WithSelf.F(constants.%Self.3ce02d.2) { // CHECK:STDOUT: %Self => constants.%Self.3ce02d.2 -// CHECK:STDOUT: %Self.as_type.loc14_8.1 => constants.%Self.as_type +// CHECK:STDOUT: %Self.as_type.loc10_8.1 => constants.%Self.as_type // CHECK:STDOUT: %pattern_type => constants.%pattern_type -// CHECK:STDOUT: %self.param_patt.loc14_8.2 => constants.%self.param_patt -// CHECK:STDOUT: %self.patt.loc14_8.2 => constants.%self.patt +// CHECK:STDOUT: %self.param_patt.loc10_8.2 => constants.%self.param_patt +// CHECK:STDOUT: %self.patt.loc10_8.2 => constants.%self.patt // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_name_conflict_with_fn.carbon @@ -226,7 +210,7 @@ interface Class { } // CHECK:STDOUT: type: type = facet_type [concrete] // CHECK:STDOUT: %Function.type.b68: type = fn_type @Function.loc4 [concrete] // CHECK:STDOUT: %Function: %Function.type.b68 = struct_value () [concrete] -// CHECK:STDOUT: %Function.type.186: type = facet_type <@Function.loc13> [concrete] +// CHECK:STDOUT: %Function.type.186: type = facet_type <@Function.loc9> [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -234,10 +218,10 @@ interface Class { } // CHECK:STDOUT: .Function = %Function.decl.loc4 // CHECK:STDOUT: } // CHECK:STDOUT: %Function.decl.loc4: %Function.type.b68 = fn_decl @Function.loc4 [concrete = constants.%Function] {} {} -// CHECK:STDOUT: %Function.decl.loc13: type = interface_decl @Function.loc13 [concrete = constants.%Function.type.186] {} {} +// CHECK:STDOUT: %Function.decl.loc9: type = interface_decl @Function.loc9 [concrete = constants.%Function.type.186] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: interface @Function.loc13; +// CHECK:STDOUT: interface @Function.loc9; // CHECK:STDOUT: // CHECK:STDOUT: fn @Function.loc4(); // CHECK:STDOUT: @@ -246,7 +230,7 @@ interface Class { } // CHECK:STDOUT: constants { // CHECK:STDOUT: type: type = facet_type [concrete] // CHECK:STDOUT: %Class: type = class_type @Class.loc2 [concrete] -// CHECK:STDOUT: %Class.type: type = facet_type <@Class.loc11> [concrete] +// CHECK:STDOUT: %Class.type: type = facet_type <@Class.loc7> [concrete] // CHECK:STDOUT: %Self: %Class.type = symbolic_binding Self, 0 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -255,12 +239,12 @@ interface Class { } // CHECK:STDOUT: .Class = %Class.decl.loc2 // CHECK:STDOUT: } // CHECK:STDOUT: %Class.decl.loc2: type = class_decl @Class.loc2 [concrete = constants.%Class] {} {} -// CHECK:STDOUT: %Class.decl.loc11: type = interface_decl @Class.loc11 [concrete = constants.%Class.type] {} {} +// CHECK:STDOUT: %Class.decl.loc7: type = interface_decl @Class.loc7 [concrete = constants.%Class.type] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: interface @Class.loc11 { +// CHECK:STDOUT: interface @Class.loc7 { // CHECK:STDOUT: %Self: %Class.type = symbolic_binding Self, 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %Class.WithSelf.decl = interface_with_self_decl @Class.loc11 [concrete] +// CHECK:STDOUT: %Class.WithSelf.decl = interface_with_self_decl @Class.loc7 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self diff --git a/toolchain/check/testdata/interface/fail_generic_redeclaration.carbon b/toolchain/check/testdata/interface/fail_generic_redeclaration.carbon index 65122a6a80b4..e0606c55a9ec 100644 --- a/toolchain/check/testdata/interface/fail_generic_redeclaration.carbon +++ b/toolchain/check/testdata/interface/fail_generic_redeclaration.carbon @@ -13,32 +13,20 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/fail_generic_redeclaration.carbon interface NotGeneric; -// CHECK:STDERR: fail_generic_redeclaration.carbon:[[@LINE+7]]:1: error: redeclaration differs because of parameter list [RedeclParamListDiffers] -// CHECK:STDERR: interface NotGeneric(T: type) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_generic_redeclaration.carbon:[[@LINE-4]]:1: note: previously declared without parameter list [RedeclParamListPrevious] -// CHECK:STDERR: interface NotGeneric; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_generic_redeclaration.carbon:[[@LINE+3]]:1-31: error: redeclaration differs because of parameter list [RedeclParamListDiffers] +// CHECK:STDERR: fail_generic_redeclaration.carbon:[[@LINE-2]]:1-21: note: previously declared without parameter list [RedeclParamListPrevious] // CHECK:STDERR: interface NotGeneric(T: type) {} interface Generic(T: type); -// CHECK:STDERR: fail_generic_redeclaration.carbon:[[@LINE+7]]:1: error: redeclaration differs because of missing parameter list [RedeclParamListDiffers] -// CHECK:STDERR: interface Generic {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_generic_redeclaration.carbon:[[@LINE-4]]:1: note: previously declared with parameter list [RedeclParamListPrevious] -// CHECK:STDERR: interface Generic(T: type); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_generic_redeclaration.carbon:[[@LINE+3]]:1-19: error: redeclaration differs because of missing parameter list [RedeclParamListDiffers] +// CHECK:STDERR: fail_generic_redeclaration.carbon:[[@LINE-2]]:1-27: note: previously declared with parameter list [RedeclParamListPrevious] // CHECK:STDERR: interface Generic {} interface DifferentParams(T: type); -// CHECK:STDERR: fail_generic_redeclaration.carbon:[[@LINE+7]]:27: error: type `` of parameter 1 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] -// CHECK:STDERR: interface DifferentParams(T: ()) {} -// CHECK:STDERR: ^~~~~ -// CHECK:STDERR: fail_generic_redeclaration.carbon:[[@LINE-4]]:27: note: previous declaration's corresponding parameter here [RedeclParamPrevious] -// CHECK:STDERR: interface DifferentParams(T: type); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_generic_redeclaration.carbon:[[@LINE+3]]:27-31: error: type `` of parameter 1 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] +// CHECK:STDERR: fail_generic_redeclaration.carbon:[[@LINE-2]]:27-33: note: previous declaration's corresponding parameter here [RedeclParamPrevious] // CHECK:STDERR: interface DifferentParams(T: ()) {} @@ -51,106 +39,106 @@ interface DifferentParams(T: ()) {} // CHECK:STDOUT: %pattern_type.9a5: type = pattern_type type [concrete] // CHECK:STDOUT: %T.patt.3a0: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic] // CHECK:STDOUT: %T.67d: type = symbolic_binding T, 0 [symbolic] -// CHECK:STDOUT: %NotGeneric.type.fec: type = generic_interface_type @NotGeneric.loc23 [concrete] +// CHECK:STDOUT: %NotGeneric.type.fec: type = generic_interface_type @NotGeneric.loc19 [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %NotGeneric.generic: %NotGeneric.type.fec = struct_value () [concrete] -// CHECK:STDOUT: %NotGeneric.type.bdb: type = facet_type <@NotGeneric.loc23, @NotGeneric.loc23(%T.67d)> [symbolic] +// CHECK:STDOUT: %NotGeneric.type.bdb: type = facet_type <@NotGeneric.loc19, @NotGeneric.loc19(%T.67d)> [symbolic] // CHECK:STDOUT: %Self.b56: %NotGeneric.type.bdb = symbolic_binding Self, 1 [symbolic] -// CHECK:STDOUT: %Generic.type.30d: type = generic_interface_type @Generic.loc25 [concrete] +// CHECK:STDOUT: %Generic.type.30d: type = generic_interface_type @Generic.loc21 [concrete] // CHECK:STDOUT: %Generic.generic: %Generic.type.30d = struct_value () [concrete] -// CHECK:STDOUT: %Generic.type.b2d: type = facet_type <@Generic.loc33> [concrete] +// CHECK:STDOUT: %Generic.type.b2d: type = facet_type <@Generic.loc25> [concrete] // CHECK:STDOUT: %Self.c53: %Generic.type.b2d = symbolic_binding Self, 0 [symbolic] -// CHECK:STDOUT: %DifferentParams.type.998819.1: type = generic_interface_type @DifferentParams.loc35 [concrete] +// CHECK:STDOUT: %DifferentParams.type.998819.1: type = generic_interface_type @DifferentParams.loc27 [concrete] // CHECK:STDOUT: %DifferentParams.generic.54c122.1: %DifferentParams.type.998819.1 = struct_value () [concrete] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] // CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete] // CHECK:STDOUT: %T.patt.8f8: %pattern_type.cb1 = symbolic_binding_pattern T, 0 [symbolic] // CHECK:STDOUT: %T.d5f: %empty_tuple.type = symbolic_binding T, 0 [symbolic] -// CHECK:STDOUT: %DifferentParams.type.998819.2: type = generic_interface_type @DifferentParams.loc43 [concrete] +// CHECK:STDOUT: %DifferentParams.type.998819.2: type = generic_interface_type @DifferentParams.loc31 [concrete] // CHECK:STDOUT: %DifferentParams.generic.54c122.2: %DifferentParams.type.998819.2 = struct_value () [concrete] -// CHECK:STDOUT: %DifferentParams.type.848: type = facet_type <@DifferentParams.loc43, @DifferentParams.loc43(%T.d5f)> [symbolic] +// CHECK:STDOUT: %DifferentParams.type.848: type = facet_type <@DifferentParams.loc31, @DifferentParams.loc31(%T.d5f)> [symbolic] // CHECK:STDOUT: %Self.63c: %DifferentParams.type.848 = symbolic_binding Self, 1 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { // CHECK:STDOUT: .NotGeneric = %NotGeneric.decl.loc15 -// CHECK:STDOUT: .Generic = %Generic.decl.loc25 -// CHECK:STDOUT: .DifferentParams = %DifferentParams.decl.loc35 +// CHECK:STDOUT: .Generic = %Generic.decl.loc21 +// CHECK:STDOUT: .DifferentParams = %DifferentParams.decl.loc27 // CHECK:STDOUT: } // CHECK:STDOUT: %NotGeneric.decl.loc15: type = interface_decl @NotGeneric.loc15 [concrete = constants.%NotGeneric.type.fd5] {} {} -// CHECK:STDOUT: %NotGeneric.decl.loc23: %NotGeneric.type.fec = interface_decl @NotGeneric.loc23 [concrete = constants.%NotGeneric.generic] { -// CHECK:STDOUT: %T.patt.loc23_23.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc23_23.2 (constants.%T.patt.3a0)] +// CHECK:STDOUT: %NotGeneric.decl.loc19: %NotGeneric.type.fec = interface_decl @NotGeneric.loc19 [concrete = constants.%NotGeneric.generic] { +// CHECK:STDOUT: %T.patt.loc19_23.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc19_23.2 (constants.%T.patt.3a0)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc23_25.1: type = splice_block %.loc23_25.2 [concrete = type] { +// CHECK:STDOUT: %.loc19_25.1: type = splice_block %.loc19_25.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc23_25.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc19_25.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc23_23.2: type = symbolic_binding T, 0 [symbolic = %T.loc23_23.1 (constants.%T.67d)] +// CHECK:STDOUT: %T.loc19_23.2: type = symbolic_binding T, 0 [symbolic = %T.loc19_23.1 (constants.%T.67d)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Generic.decl.loc25: %Generic.type.30d = interface_decl @Generic.loc25 [concrete = constants.%Generic.generic] { -// CHECK:STDOUT: %T.patt.loc25_20.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc25_20.2 (constants.%T.patt.3a0)] +// CHECK:STDOUT: %Generic.decl.loc21: %Generic.type.30d = interface_decl @Generic.loc21 [concrete = constants.%Generic.generic] { +// CHECK:STDOUT: %T.patt.loc21_20.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc21_20.2 (constants.%T.patt.3a0)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc25_22.1: type = splice_block %.loc25_22.2 [concrete = type] { +// CHECK:STDOUT: %.loc21_22.1: type = splice_block %.loc21_22.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc25_22.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc21_22.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc25_20.2: type = symbolic_binding T, 0 [symbolic = %T.loc25_20.1 (constants.%T.67d)] +// CHECK:STDOUT: %T.loc21_20.2: type = symbolic_binding T, 0 [symbolic = %T.loc21_20.1 (constants.%T.67d)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Generic.decl.loc33: type = interface_decl @Generic.loc33 [concrete = constants.%Generic.type.b2d] {} {} -// CHECK:STDOUT: %DifferentParams.decl.loc35: %DifferentParams.type.998819.1 = interface_decl @DifferentParams.loc35 [concrete = constants.%DifferentParams.generic.54c122.1] { -// CHECK:STDOUT: %T.patt.loc35_28.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc35_28.2 (constants.%T.patt.3a0)] +// CHECK:STDOUT: %Generic.decl.loc25: type = interface_decl @Generic.loc25 [concrete = constants.%Generic.type.b2d] {} {} +// CHECK:STDOUT: %DifferentParams.decl.loc27: %DifferentParams.type.998819.1 = interface_decl @DifferentParams.loc27 [concrete = constants.%DifferentParams.generic.54c122.1] { +// CHECK:STDOUT: %T.patt.loc27_28.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc27_28.2 (constants.%T.patt.3a0)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc35_30.1: type = splice_block %.loc35_30.2 [concrete = type] { +// CHECK:STDOUT: %.loc27_30.1: type = splice_block %.loc27_30.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc35_30.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc27_30.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc35_28.2: type = symbolic_binding T, 0 [symbolic = %T.loc35_28.1 (constants.%T.67d)] +// CHECK:STDOUT: %T.loc27_28.2: type = symbolic_binding T, 0 [symbolic = %T.loc27_28.1 (constants.%T.67d)] // CHECK:STDOUT: } -// CHECK:STDOUT: %DifferentParams.decl.loc43: %DifferentParams.type.998819.2 = interface_decl @DifferentParams.loc43 [concrete = constants.%DifferentParams.generic.54c122.2] { -// CHECK:STDOUT: %T.patt.loc43_28.1: %pattern_type.cb1 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc43_28.2 (constants.%T.patt.8f8)] +// CHECK:STDOUT: %DifferentParams.decl.loc31: %DifferentParams.type.998819.2 = interface_decl @DifferentParams.loc31 [concrete = constants.%DifferentParams.generic.54c122.2] { +// CHECK:STDOUT: %T.patt.loc31_28.1: %pattern_type.cb1 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc31_28.2 (constants.%T.patt.8f8)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc43_31.1: type = splice_block %.loc43_31.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc31_31.1: type = splice_block %.loc31_31.3 [concrete = constants.%empty_tuple.type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc43_31.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc43_31.3: type = converted %.loc43_31.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc31_31.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc31_31.3: type = converted %.loc31_31.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc43_28.2: %empty_tuple.type = symbolic_binding T, 0 [symbolic = %T.loc43_28.1 (constants.%T.d5f)] +// CHECK:STDOUT: %T.loc31_28.2: %empty_tuple.type = symbolic_binding T, 0 [symbolic = %T.loc31_28.1 (constants.%T.d5f)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @NotGeneric.loc15; // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @NotGeneric.loc23(%T.loc23_23.2: type) { -// CHECK:STDOUT: %T.patt.loc23_23.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc23_23.2 (constants.%T.patt.3a0)] -// CHECK:STDOUT: %T.loc23_23.1: type = symbolic_binding T, 0 [symbolic = %T.loc23_23.1 (constants.%T.67d)] +// CHECK:STDOUT: generic interface @NotGeneric.loc19(%T.loc19_23.2: type) { +// CHECK:STDOUT: %T.patt.loc19_23.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc19_23.2 (constants.%T.patt.3a0)] +// CHECK:STDOUT: %T.loc19_23.1: type = symbolic_binding T, 0 [symbolic = %T.loc19_23.1 (constants.%T.67d)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %NotGeneric.type: type = facet_type <@NotGeneric.loc23, @NotGeneric.loc23(%T.loc23_23.1)> [symbolic = %NotGeneric.type (constants.%NotGeneric.type.bdb)] -// CHECK:STDOUT: %Self.loc23_31.2: @NotGeneric.loc23.%NotGeneric.type (%NotGeneric.type.bdb) = symbolic_binding Self, 1 [symbolic = %Self.loc23_31.2 (constants.%Self.b56)] +// CHECK:STDOUT: %NotGeneric.type: type = facet_type <@NotGeneric.loc19, @NotGeneric.loc19(%T.loc19_23.1)> [symbolic = %NotGeneric.type (constants.%NotGeneric.type.bdb)] +// CHECK:STDOUT: %Self.loc19_31.2: @NotGeneric.loc19.%NotGeneric.type (%NotGeneric.type.bdb) = symbolic_binding Self, 1 [symbolic = %Self.loc19_31.2 (constants.%Self.b56)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.loc23_31.1: @NotGeneric.loc23.%NotGeneric.type (%NotGeneric.type.bdb) = symbolic_binding Self, 1 [symbolic = %Self.loc23_31.2 (constants.%Self.b56)] -// CHECK:STDOUT: %NotGeneric.WithSelf.decl = interface_with_self_decl @NotGeneric.loc23 [concrete] +// CHECK:STDOUT: %Self.loc19_31.1: @NotGeneric.loc19.%NotGeneric.type (%NotGeneric.type.bdb) = symbolic_binding Self, 1 [symbolic = %Self.loc19_31.2 (constants.%Self.b56)] +// CHECK:STDOUT: %NotGeneric.WithSelf.decl = interface_with_self_decl @NotGeneric.loc19 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.loc23_31.1 +// CHECK:STDOUT: .Self = %Self.loc19_31.1 // CHECK:STDOUT: witness = () // CHECK:STDOUT: // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @Generic.loc25(%T.loc25_20.2: type) { -// CHECK:STDOUT: %T.patt.loc25_20.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc25_20.2 (constants.%T.patt.3a0)] -// CHECK:STDOUT: %T.loc25_20.1: type = symbolic_binding T, 0 [symbolic = %T.loc25_20.1 (constants.%T.67d)] +// CHECK:STDOUT: generic interface @Generic.loc21(%T.loc21_20.2: type) { +// CHECK:STDOUT: %T.patt.loc21_20.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc21_20.2 (constants.%T.patt.3a0)] +// CHECK:STDOUT: %T.loc21_20.1: type = symbolic_binding T, 0 [symbolic = %T.loc21_20.1 (constants.%T.67d)] // CHECK:STDOUT: // CHECK:STDOUT: interface; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: interface @Generic.loc33 { +// CHECK:STDOUT: interface @Generic.loc25 { // CHECK:STDOUT: %Self: %Generic.type.b2d = symbolic_binding Self, 0 [symbolic = constants.%Self.c53] -// CHECK:STDOUT: %Generic.WithSelf.decl = interface_with_self_decl @Generic.loc33 [concrete] +// CHECK:STDOUT: %Generic.WithSelf.decl = interface_with_self_decl @Generic.loc25 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self @@ -159,55 +147,55 @@ interface DifferentParams(T: ()) {} // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @DifferentParams.loc35(%T.loc35_28.2: type) { -// CHECK:STDOUT: %T.patt.loc35_28.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc35_28.2 (constants.%T.patt.3a0)] -// CHECK:STDOUT: %T.loc35_28.1: type = symbolic_binding T, 0 [symbolic = %T.loc35_28.1 (constants.%T.67d)] +// CHECK:STDOUT: generic interface @DifferentParams.loc27(%T.loc27_28.2: type) { +// CHECK:STDOUT: %T.patt.loc27_28.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc27_28.2 (constants.%T.patt.3a0)] +// CHECK:STDOUT: %T.loc27_28.1: type = symbolic_binding T, 0 [symbolic = %T.loc27_28.1 (constants.%T.67d)] // CHECK:STDOUT: // CHECK:STDOUT: interface; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @DifferentParams.loc43(%T.loc43_28.2: %empty_tuple.type) { -// CHECK:STDOUT: %T.patt.loc43_28.2: %pattern_type.cb1 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc43_28.2 (constants.%T.patt.8f8)] -// CHECK:STDOUT: %T.loc43_28.1: %empty_tuple.type = symbolic_binding T, 0 [symbolic = %T.loc43_28.1 (constants.%T.d5f)] +// CHECK:STDOUT: generic interface @DifferentParams.loc31(%T.loc31_28.2: %empty_tuple.type) { +// CHECK:STDOUT: %T.patt.loc31_28.2: %pattern_type.cb1 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc31_28.2 (constants.%T.patt.8f8)] +// CHECK:STDOUT: %T.loc31_28.1: %empty_tuple.type = symbolic_binding T, 0 [symbolic = %T.loc31_28.1 (constants.%T.d5f)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %DifferentParams.type: type = facet_type <@DifferentParams.loc43, @DifferentParams.loc43(%T.loc43_28.1)> [symbolic = %DifferentParams.type (constants.%DifferentParams.type.848)] -// CHECK:STDOUT: %Self.loc43_34.2: @DifferentParams.loc43.%DifferentParams.type (%DifferentParams.type.848) = symbolic_binding Self, 1 [symbolic = %Self.loc43_34.2 (constants.%Self.63c)] +// CHECK:STDOUT: %DifferentParams.type: type = facet_type <@DifferentParams.loc31, @DifferentParams.loc31(%T.loc31_28.1)> [symbolic = %DifferentParams.type (constants.%DifferentParams.type.848)] +// CHECK:STDOUT: %Self.loc31_34.2: @DifferentParams.loc31.%DifferentParams.type (%DifferentParams.type.848) = symbolic_binding Self, 1 [symbolic = %Self.loc31_34.2 (constants.%Self.63c)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.loc43_34.1: @DifferentParams.loc43.%DifferentParams.type (%DifferentParams.type.848) = symbolic_binding Self, 1 [symbolic = %Self.loc43_34.2 (constants.%Self.63c)] -// CHECK:STDOUT: %DifferentParams.WithSelf.decl = interface_with_self_decl @DifferentParams.loc43 [concrete] +// CHECK:STDOUT: %Self.loc31_34.1: @DifferentParams.loc31.%DifferentParams.type (%DifferentParams.type.848) = symbolic_binding Self, 1 [symbolic = %Self.loc31_34.2 (constants.%Self.63c)] +// CHECK:STDOUT: %DifferentParams.WithSelf.decl = interface_with_self_decl @DifferentParams.loc31 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.loc43_34.1 +// CHECK:STDOUT: .Self = %Self.loc31_34.1 // CHECK:STDOUT: witness = () // CHECK:STDOUT: // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @NotGeneric.loc23(constants.%T.67d) { -// CHECK:STDOUT: %T.patt.loc23_23.2 => constants.%T.patt.3a0 -// CHECK:STDOUT: %T.loc23_23.1 => constants.%T.67d +// CHECK:STDOUT: specific @NotGeneric.loc19(constants.%T.67d) { +// CHECK:STDOUT: %T.patt.loc19_23.2 => constants.%T.patt.3a0 +// CHECK:STDOUT: %T.loc19_23.1 => constants.%T.67d // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @NotGeneric.WithSelf(constants.%T.67d, constants.%Self.b56) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Generic.loc25(constants.%T.67d) { -// CHECK:STDOUT: %T.patt.loc25_20.2 => constants.%T.patt.3a0 -// CHECK:STDOUT: %T.loc25_20.1 => constants.%T.67d +// CHECK:STDOUT: specific @Generic.loc21(constants.%T.67d) { +// CHECK:STDOUT: %T.patt.loc21_20.2 => constants.%T.patt.3a0 +// CHECK:STDOUT: %T.loc21_20.1 => constants.%T.67d // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Generic.WithSelf(constants.%Self.c53) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @DifferentParams.loc35(constants.%T.67d) { -// CHECK:STDOUT: %T.patt.loc35_28.2 => constants.%T.patt.3a0 -// CHECK:STDOUT: %T.loc35_28.1 => constants.%T.67d +// CHECK:STDOUT: specific @DifferentParams.loc27(constants.%T.67d) { +// CHECK:STDOUT: %T.patt.loc27_28.2 => constants.%T.patt.3a0 +// CHECK:STDOUT: %T.loc27_28.1 => constants.%T.67d // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @DifferentParams.loc43(constants.%T.d5f) { -// CHECK:STDOUT: %T.patt.loc43_28.2 => constants.%T.patt.8f8 -// CHECK:STDOUT: %T.loc43_28.1 => constants.%T.d5f +// CHECK:STDOUT: specific @DifferentParams.loc31(constants.%T.d5f) { +// CHECK:STDOUT: %T.patt.loc31_28.2 => constants.%T.patt.8f8 +// CHECK:STDOUT: %T.loc31_28.1 => constants.%T.d5f // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @DifferentParams.WithSelf(constants.%T.d5f, constants.%Self.63c) {} diff --git a/toolchain/check/testdata/interface/fail_incorrect_destroy_method_declarations.carbon b/toolchain/check/testdata/interface/fail_incorrect_destroy_method_declarations.carbon index 027e87710fd9..1f71e94ae2e8 100644 --- a/toolchain/check/testdata/interface/fail_incorrect_destroy_method_declarations.carbon +++ b/toolchain/check/testdata/interface/fail_incorrect_destroy_method_declarations.carbon @@ -16,9 +16,7 @@ package Core library "too_few_assoc_functions_declared"; -// CHECK:STDERR: fail_too_few_assoc_functions_declared.carbon:[[@LINE+4]]:1: error: semantics TODO: `interface `Core.Destroy` needs exactly 3 associated functions` [SemanticsTodo] -// CHECK:STDERR: interface Destroy { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_few_assoc_functions_declared.carbon:[[@LINE+2]]:1-19: error: semantics TODO: `interface `Core.Destroy` needs exactly 3 associated functions` [SemanticsTodo] // CHECK:STDERR: interface Destroy { final fn SubobjectDestroy(ref self) {} @@ -29,9 +27,7 @@ interface Destroy { package Core library "too_many_assoc_functions_declared"; -// CHECK:STDERR: fail_too_many_assoc_functions_declared.carbon:[[@LINE+4]]:1: error: semantics TODO: `interface `Core.Destroy` needs exactly 3 associated functions` [SemanticsTodo] -// CHECK:STDERR: interface Destroy { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_many_assoc_functions_declared.carbon:[[@LINE+2]]:1-19: error: semantics TODO: `interface `Core.Destroy` needs exactly 3 associated functions` [SemanticsTodo] // CHECK:STDERR: interface Destroy { fn Op(ref self); @@ -45,9 +41,7 @@ interface Destroy { package Core library "op_associated_type"; interface Destroy { - // CHECK:STDERR: fail_op_associated_type.carbon:[[@LINE+4]]:7: error: semantics TODO: `associated entity must be a method` [SemanticsTodo] - // CHECK:STDERR: let Op: type; - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_op_associated_type.carbon:[[@LINE+2]]:7-14: error: semantics TODO: `associated entity must be a method` [SemanticsTodo] // CHECK:STDERR: let Op: type; final fn SubobjectDestroy(ref self) {} @@ -59,9 +53,7 @@ interface Destroy { package Core library "op_wrong_name"; interface Destroy { - // CHECK:STDERR: fail_op_wrong_name.carbon:[[@LINE+4]]:3: error: semantics TODO: `associated function #1 must be named `Op`` [SemanticsTodo] - // CHECK:STDERR: final fn SubobjectDestroy(ref self) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_op_wrong_name.carbon:[[@LINE+2]]:3-39: error: semantics TODO: `associated function #1 must be named `Op`` [SemanticsTodo] // CHECK:STDERR: final fn SubobjectDestroy(ref self) {} fn Op(ref self); @@ -73,9 +65,7 @@ interface Destroy { package Core library "op_no_params"; interface Destroy { - // CHECK:STDERR: fail_op_no_params.carbon:[[@LINE+4]]:3: error: semantics TODO: `associated function must have exactly 1 parameter` [SemanticsTodo] - // CHECK:STDERR: fn Op(); - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_op_no_params.carbon:[[@LINE+2]]:3-10: error: semantics TODO: `associated function must have exactly 1 parameter` [SemanticsTodo] // CHECK:STDERR: fn Op(); final fn SubobjectDestroy(unused ref self) {} @@ -87,9 +77,7 @@ interface Destroy { package Core library "op_two_params"; interface Destroy { - // CHECK:STDERR: fail_op_two_params.carbon:[[@LINE+4]]:3: error: semantics TODO: `associated function must have exactly 1 parameter` [SemanticsTodo] - // CHECK:STDERR: fn Op(ref self, x: Self); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_op_two_params.carbon:[[@LINE+2]]:3-27: error: semantics TODO: `associated function must have exactly 1 parameter` [SemanticsTodo] // CHECK:STDERR: fn Op(ref self, x: Self); final fn SubobjectDestroy(unused ref self) {} @@ -103,9 +91,7 @@ package Core library "op_param_not_self"; class C {} interface Destroy { - // CHECK:STDERR: fail_op_param_not_self.carbon:[[@LINE+4]]:3: error: semantics TODO: `associated function must take `ref self` as its parameter` [SemanticsTodo] - // CHECK:STDERR: fn Op(c: C); - // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_op_param_not_self.carbon:[[@LINE+2]]:3-14: error: semantics TODO: `associated function must take `ref self` as its parameter` [SemanticsTodo] // CHECK:STDERR: fn Op(c: C); final fn SubobjectDestroy(unused ref self) {} @@ -117,9 +103,7 @@ interface Destroy { package Core library "op_param_is_generic"; interface Destroy { - // CHECK:STDERR: fail_op_param_is_generic.carbon:[[@LINE+4]]:3: error: semantics TODO: `associated function must take `ref self` as its parameter` [SemanticsTodo] - // CHECK:STDERR: fn Op[T: type](ref c: T); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_op_param_is_generic.carbon:[[@LINE+2]]:3-27: error: semantics TODO: `associated function must take `ref self` as its parameter` [SemanticsTodo] // CHECK:STDERR: fn Op[T: type](ref c: T); final fn SubobjectDestroy(unused ref self) {} @@ -131,9 +115,7 @@ interface Destroy { package Core library "op_self_param_not_reference"; interface Destroy { - // CHECK:STDERR: fail_op_self_param_not_reference.carbon:[[@LINE+4]]:3: error: semantics TODO: `associated function must take `ref self` as its parameter` [SemanticsTodo] - // CHECK:STDERR: fn Op(self); - // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_op_self_param_not_reference.carbon:[[@LINE+2]]:3-14: error: semantics TODO: `associated function must take `ref self` as its parameter` [SemanticsTodo] // CHECK:STDERR: fn Op(self); final fn SubobjectDestroy(unused ref self) {} @@ -145,9 +127,7 @@ interface Destroy { package Core library "op_explicit_self_type"; interface Destroy { - // CHECK:STDERR: fail_op_explicit_self_type.carbon:[[@LINE+4]]:3: error: semantics TODO: `associated function must take `ref self` as its parameter` [SemanticsTodo] - // CHECK:STDERR: fn Op(ref s: Self); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_op_explicit_self_type.carbon:[[@LINE+2]]:3-21: error: semantics TODO: `associated function must take `ref self` as its parameter` [SemanticsTodo] // CHECK:STDERR: fn Op(ref s: Self); final fn SubobjectDestroy(unused ref self) {} @@ -159,9 +139,7 @@ interface Destroy { package Core library "op_final"; interface Destroy { - // CHECK:STDERR: fail_op_final.carbon:[[@LINE+4]]:3: error: semantics TODO: `associated function must not have an interface modifier` [SemanticsTodo] - // CHECK:STDERR: final fn Op(unused ref self) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_op_final.carbon:[[@LINE+2]]:3-32: error: semantics TODO: `associated function must not have an interface modifier` [SemanticsTodo] // CHECK:STDERR: final fn Op(unused ref self) {} final fn SubobjectDestroy(unused ref self) {} @@ -173,9 +151,7 @@ interface Destroy { package Core library "op_default"; interface Destroy { - // CHECK:STDERR: fail_op_default.carbon:[[@LINE+4]]:3: error: semantics TODO: `associated function must not have an interface modifier` [SemanticsTodo] - // CHECK:STDERR: default fn Op(unused ref self) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_op_default.carbon:[[@LINE+2]]:3-34: error: semantics TODO: `associated function must not have an interface modifier` [SemanticsTodo] // CHECK:STDERR: default fn Op(unused ref self) {} final fn SubobjectDestroy(unused ref self) {} @@ -189,9 +165,7 @@ package Core library "self_destruct_associated_type"; interface Destroy { fn Op(ref self); final fn SubobjectDestroy(unused ref self) {} - // CHECK:STDERR: fail_self_destruct_associated_type.carbon:[[@LINE+4]]:7: error: semantics TODO: `associated entity must be a method` [SemanticsTodo] - // CHECK:STDERR: let SelfDestruct: type; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_self_destruct_associated_type.carbon:[[@LINE+2]]:7-24: error: semantics TODO: `associated entity must be a method` [SemanticsTodo] // CHECK:STDERR: let SelfDestruct: type; } @@ -203,9 +177,7 @@ package Core library "self_destruct_wrong_name"; interface Destroy { fn Op(ref self); final fn SubobjectDestroy(unused ref self) {} - // CHECK:STDERR: fail_self_destruct_wrong_name.carbon:[[@LINE+4]]:3: error: semantics TODO: `associated function #3 must be named `SelfDestruct`` [SemanticsTodo] - // CHECK:STDERR: final fn selfDestruct(unused ref self) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_self_destruct_wrong_name.carbon:[[@LINE+2]]:3-42: error: semantics TODO: `associated function #3 must be named `SelfDestruct`` [SemanticsTodo] // CHECK:STDERR: final fn selfDestruct(unused ref self) {} } @@ -217,9 +189,7 @@ package Core library "self_destruct_no_params"; interface Destroy { fn Op(ref self); final fn SubobjectDestroy(unused ref self) {} - // CHECK:STDERR: fail_self_destruct_no_params.carbon:[[@LINE+4]]:3: error: semantics TODO: `associated function must have exactly 1 parameter` [SemanticsTodo] - // CHECK:STDERR: final fn SelfDestruct() {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_self_destruct_no_params.carbon:[[@LINE+2]]:3-27: error: semantics TODO: `associated function must have exactly 1 parameter` [SemanticsTodo] // CHECK:STDERR: final fn SelfDestruct() {} } @@ -231,9 +201,7 @@ package Core library "self_destruct_two_params"; interface Destroy { fn Op(ref self); final fn SubobjectDestroy(unused ref self) {} - // CHECK:STDERR: fail_self_destruct_two_params.carbon:[[@LINE+4]]:3: error: semantics TODO: `associated function must have exactly 1 parameter` [SemanticsTodo] - // CHECK:STDERR: final fn SelfDestruct(unused ref self, unused x: Self) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_self_destruct_two_params.carbon:[[@LINE+2]]:3-58: error: semantics TODO: `associated function must have exactly 1 parameter` [SemanticsTodo] // CHECK:STDERR: final fn SelfDestruct(unused ref self, unused x: Self) {} } @@ -247,9 +215,7 @@ class C {} interface Destroy { fn Op(ref self); final fn SubobjectDestroy(unused ref self) {} - // CHECK:STDERR: fail_self_destruct_param_not_self.carbon:[[@LINE+4]]:3: error: semantics TODO: `associated function must take `ref self` as its parameter` [SemanticsTodo] - // CHECK:STDERR: final fn SelfDestruct(unused ref c: C) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_self_destruct_param_not_self.carbon:[[@LINE+2]]:3-42: error: semantics TODO: `associated function must take `ref self` as its parameter` [SemanticsTodo] // CHECK:STDERR: final fn SelfDestruct(unused ref c: C) {} } @@ -261,9 +227,7 @@ package Core library "self_destruct_param_is_generic"; interface Destroy { fn Op(ref self); final fn SubobjectDestroy(unused ref self) {} - // CHECK:STDERR: fail_self_destruct_param_is_generic.carbon:[[@LINE+4]]:3: error: semantics TODO: `associated function must take `ref self` as its parameter` [SemanticsTodo] - // CHECK:STDERR: final fn SelfDestruct[T: type](unused ref c: T) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_self_destruct_param_is_generic.carbon:[[@LINE+2]]:3-51: error: semantics TODO: `associated function must take `ref self` as its parameter` [SemanticsTodo] // CHECK:STDERR: final fn SelfDestruct[T: type](unused ref c: T) {} } @@ -275,9 +239,7 @@ package Core library "self_destruct_self_param_not_reference"; interface Destroy { fn Op(ref self); final fn SubobjectDestroy(unused ref self) {} - // CHECK:STDERR: fail_self_destruct_self_param_not_reference.carbon:[[@LINE+4]]:3: error: semantics TODO: `associated function must take `ref self` as its parameter` [SemanticsTodo] - // CHECK:STDERR: final fn SelfDestruct(unused self) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_self_destruct_self_param_not_reference.carbon:[[@LINE+2]]:3-38: error: semantics TODO: `associated function must take `ref self` as its parameter` [SemanticsTodo] // CHECK:STDERR: final fn SelfDestruct(unused self) {} } @@ -289,9 +251,7 @@ package Core library "self_destruct_explicit_self_type"; interface Destroy { fn Op(ref self); final fn SubobjectDestroy(unused ref self) {} - // CHECK:STDERR: fail_self_destruct_explicit_self_type.carbon:[[@LINE+4]]:3: error: semantics TODO: `associated function must take `ref self` as its parameter` [SemanticsTodo] - // CHECK:STDERR: final fn SelfDestruct(unused ref s: Self) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_self_destruct_explicit_self_type.carbon:[[@LINE+2]]:3-45: error: semantics TODO: `associated function must take `ref self` as its parameter` [SemanticsTodo] // CHECK:STDERR: final fn SelfDestruct(unused ref s: Self) {} } @@ -303,9 +263,7 @@ package Core library "self_destruct_not_final"; interface Destroy { fn Op(ref self); final fn SubobjectDestroy(unused ref self) {} - // CHECK:STDERR: fail_self_destruct_not_final.carbon:[[@LINE+4]]:3: error: semantics TODO: `associated function must be `final`` [SemanticsTodo] - // CHECK:STDERR: fn SelfDestruct(unused ref self) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_self_destruct_not_final.carbon:[[@LINE+2]]:3-36: error: semantics TODO: `associated function must be `final`` [SemanticsTodo] // CHECK:STDERR: fn SelfDestruct(unused ref self) {} } @@ -317,9 +275,7 @@ package Core library "self_destruct_default"; interface Destroy { fn Op(ref self); final fn SubobjectDestroy(unused ref self) {} - // CHECK:STDERR: fail_self_destruct_default.carbon:[[@LINE+4]]:3: error: semantics TODO: `associated function must be `final`` [SemanticsTodo] - // CHECK:STDERR: default fn SelfDestruct(unused ref self) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_self_destruct_default.carbon:[[@LINE+2]]:3-44: error: semantics TODO: `associated function must be `final`` [SemanticsTodo] // CHECK:STDERR: default fn SelfDestruct(unused ref self) {} } diff --git a/toolchain/check/testdata/interface/fail_incorrect_subobject_destroy_method_declarations.carbon b/toolchain/check/testdata/interface/fail_incorrect_subobject_destroy_method_declarations.carbon index a702c4786230..519f08e04dd9 100644 --- a/toolchain/check/testdata/interface/fail_incorrect_subobject_destroy_method_declarations.carbon +++ b/toolchain/check/testdata/interface/fail_incorrect_subobject_destroy_method_declarations.carbon @@ -16,9 +16,7 @@ package Core library "op_not_declared"; -// CHECK:STDERR: fail_op_not_declared.carbon:[[@LINE+4]]:1: error: semantics TODO: `interface `Core.Destroy` needs exactly 3 associated functions` [SemanticsTodo] -// CHECK:STDERR: interface Destroy { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_op_not_declared.carbon:[[@LINE+2]]:1-19: error: semantics TODO: `interface `Core.Destroy` needs exactly 3 associated functions` [SemanticsTodo] // CHECK:STDERR: interface Destroy { fn Op(ref self); @@ -31,9 +29,7 @@ package Core library "op_associated_type"; interface Destroy { fn Op(ref self); - // CHECK:STDERR: fail_op_associated_type.carbon:[[@LINE+4]]:7: error: semantics TODO: `associated entity must be a method` [SemanticsTodo] - // CHECK:STDERR: let SubobjectDestroy: type; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_op_associated_type.carbon:[[@LINE+2]]:7-28: error: semantics TODO: `associated entity must be a method` [SemanticsTodo] // CHECK:STDERR: let SubobjectDestroy: type; final fn SelfDestruct(unused ref self) {} @@ -45,9 +41,7 @@ package Core library "op_wrong_name"; interface Destroy { fn Op(ref self); - // CHECK:STDERR: fail_op_wrong_name.carbon:[[@LINE+4]]:3: error: semantics TODO: `associated function #2 must be named `SubobjectDestroy`` [SemanticsTodo] - // CHECK:STDERR: final fn SelfDestruct(unused ref self) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_op_wrong_name.carbon:[[@LINE+2]]:3-42: error: semantics TODO: `associated function #2 must be named `SubobjectDestroy`` [SemanticsTodo] // CHECK:STDERR: final fn SelfDestruct(unused ref self) {} final fn SubobjectDestroy(unused ref self) {} @@ -59,9 +53,7 @@ package Core library "op_no_params"; interface Destroy { fn Op(ref self); - // CHECK:STDERR: fail_op_no_params.carbon:[[@LINE+4]]:3: error: semantics TODO: `associated function must have exactly 1 parameter` [SemanticsTodo] - // CHECK:STDERR: final fn SubobjectDestroy() {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_op_no_params.carbon:[[@LINE+2]]:3-31: error: semantics TODO: `associated function must have exactly 1 parameter` [SemanticsTodo] // CHECK:STDERR: final fn SubobjectDestroy() {} final fn SelfDestruct(unused ref self) {} @@ -73,9 +65,7 @@ package Core library "op_two_params"; interface Destroy { fn Op(ref self); - // CHECK:STDERR: fail_op_two_params.carbon:[[@LINE+4]]:3: error: semantics TODO: `associated function must have exactly 1 parameter` [SemanticsTodo] - // CHECK:STDERR: final fn SubobjectDestroy(unused ref self, unused x: Self) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_op_two_params.carbon:[[@LINE+2]]:3-62: error: semantics TODO: `associated function must have exactly 1 parameter` [SemanticsTodo] // CHECK:STDERR: final fn SubobjectDestroy(unused ref self, unused x: Self) {} final fn SelfDestruct(unused ref self) {} @@ -89,9 +79,7 @@ class C {} interface Destroy { fn Op(ref self); - // CHECK:STDERR: fail_op_param_not_self.carbon:[[@LINE+4]]:3: error: semantics TODO: `associated function must take `ref self` as its parameter` [SemanticsTodo] - // CHECK:STDERR: final fn SubobjectDestroy(unused ref c: C) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_op_param_not_self.carbon:[[@LINE+2]]:3-46: error: semantics TODO: `associated function must take `ref self` as its parameter` [SemanticsTodo] // CHECK:STDERR: final fn SubobjectDestroy(unused ref c: C) {} final fn SelfDestruct(unused ref self) {} @@ -103,9 +91,7 @@ package Core library "op_param_is_generic"; interface Destroy { fn Op(ref self); - // CHECK:STDERR: fail_op_param_is_generic.carbon:[[@LINE+4]]:3: error: semantics TODO: `associated function must take `ref self` as its parameter` [SemanticsTodo] - // CHECK:STDERR: final fn SubobjectDestroy[T: type](unused ref c: T) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_op_param_is_generic.carbon:[[@LINE+2]]:3-55: error: semantics TODO: `associated function must take `ref self` as its parameter` [SemanticsTodo] // CHECK:STDERR: final fn SubobjectDestroy[T: type](unused ref c: T) {} final fn SelfDestruct(unused ref self) {} @@ -117,9 +103,7 @@ package Core library "op_self_param_not_reference"; interface Destroy { fn Op(ref self); - // CHECK:STDERR: fail_op_self_param_not_reference.carbon:[[@LINE+4]]:3: error: semantics TODO: `associated function must take `ref self` as its parameter` [SemanticsTodo] - // CHECK:STDERR: final fn SubobjectDestroy(unused self) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_op_self_param_not_reference.carbon:[[@LINE+2]]:3-42: error: semantics TODO: `associated function must take `ref self` as its parameter` [SemanticsTodo] // CHECK:STDERR: final fn SubobjectDestroy(unused self) {} final fn SelfDestruct(unused ref self) {} @@ -131,9 +115,7 @@ package Core library "op_explicit_self_type"; interface Destroy { fn Op(ref self); - // CHECK:STDERR: fail_op_explicit_self_type.carbon:[[@LINE+4]]:3: error: semantics TODO: `associated function must take `ref self` as its parameter` [SemanticsTodo] - // CHECK:STDERR: final fn SubobjectDestroy(unused ref s: Self) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_op_explicit_self_type.carbon:[[@LINE+2]]:3-49: error: semantics TODO: `associated function must take `ref self` as its parameter` [SemanticsTodo] // CHECK:STDERR: final fn SubobjectDestroy(unused ref s: Self) {} final fn SelfDestruct(unused ref self) {} @@ -145,9 +127,7 @@ package Core library "op_not_final"; interface Destroy { fn Op(ref self); - // CHECK:STDERR: fail_op_not_final.carbon:[[@LINE+4]]:3: error: semantics TODO: `associated function must be `final`` [SemanticsTodo] - // CHECK:STDERR: fn SubobjectDestroy(unused ref self) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_op_not_final.carbon:[[@LINE+2]]:3-40: error: semantics TODO: `associated function must be `final`` [SemanticsTodo] // CHECK:STDERR: fn SubobjectDestroy(unused ref self) {} final fn SelfDestruct(unused ref self) {} @@ -159,9 +139,7 @@ package Core library "op_default"; interface Destroy { fn Op(ref self); - // CHECK:STDERR: fail_op_default.carbon:[[@LINE+4]]:3: error: semantics TODO: `associated function must be `final`` [SemanticsTodo] - // CHECK:STDERR: default fn SubobjectDestroy(unused ref self) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_op_default.carbon:[[@LINE+2]]:3-48: error: semantics TODO: `associated function must be `final`` [SemanticsTodo] // CHECK:STDERR: default fn SubobjectDestroy(unused ref self) {} final fn SelfDestruct(unused ref self) {} diff --git a/toolchain/check/testdata/interface/fail_lookup_in_type_type.carbon b/toolchain/check/testdata/interface/fail_lookup_in_type_type.carbon index 34a2cbbc6029..b27a51564ac1 100644 --- a/toolchain/check/testdata/interface/fail_lookup_in_type_type.carbon +++ b/toolchain/check/testdata/interface/fail_lookup_in_type_type.carbon @@ -16,9 +16,7 @@ library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_lookup_in_type.carbon:[[@LINE+4]]:8: error: type `type` does not support qualified expressions [QualifiedExprUnsupported] -// CHECK:STDERR: let T: type.not_found = {}; -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_lookup_in_type.carbon:[[@LINE+2]]:8-21: error: type `type` does not support qualified expressions [QualifiedExprUnsupported] // CHECK:STDERR: let T: type.not_found = {}; @@ -26,9 +24,7 @@ let T: type.not_found = {}; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_lookup_type_where.carbon:[[@LINE+4]]:8: error: type `type` does not support qualified expressions [QualifiedExprUnsupported] -// CHECK:STDERR: let U: (type where .Self impls type).missing = {}; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_lookup_type_where.carbon:[[@LINE+2]]:8-44: error: type `type` does not support qualified expressions [QualifiedExprUnsupported] // CHECK:STDERR: let U: (type where .Self impls type).missing = {}; @@ -44,7 +40,7 @@ let U: (type where .Self impls type).missing = {}; // CHECK:STDOUT: package: = namespace [concrete] { // CHECK:STDOUT: .T = %T // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc6: type = type_literal type [concrete = type] // CHECK:STDOUT: %T: = wrapper_binding T, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %T.patt: = value_binding_pattern T [concrete = ] @@ -53,7 +49,7 @@ let U: (type where .Self impls type).missing = {}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc6: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -72,18 +68,18 @@ let U: (type where .Self impls type).missing = {}; // CHECK:STDOUT: .U = %U // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = splice_block [concrete = ] { -// CHECK:STDOUT: %.loc8_9: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc6_9: type = type_literal type [concrete = type] // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc8_9 [concrete] -// CHECK:STDOUT: %.Self.ref.loc8_20.1: type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc8_32: type = type_literal type [concrete = type] -// CHECK:STDOUT: %impls.loc8_26.1 = requirement_impls %.Self.ref.loc8_20.1, %.loc8_32 [concrete] +// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc6_9 [concrete] +// CHECK:STDOUT: %.Self.ref.loc6_20.1: type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc6_32: type = type_literal type [concrete = type] +// CHECK:STDOUT: %impls.loc6_26.1 = requirement_impls %.Self.ref.loc6_20.1, %.loc6_32 [concrete] // CHECK:STDOUT: %.Self: type = symbolic_binding .Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %.Self.ref.loc8_20.2: type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %impls.loc8_26.2 = requirement_impls %.Self.ref.loc8_20.2, %.loc8_32 [concrete] -// CHECK:STDOUT: %.loc8_14: type = where_expr [concrete = type] { -// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc8_9 [concrete] -// CHECK:STDOUT: %impls.loc8_26.2 = requirement_impls %.Self.ref.loc8_20.2, %.loc8_32 [concrete] +// CHECK:STDOUT: %.Self.ref.loc6_20.2: type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] +// CHECK:STDOUT: %impls.loc6_26.2 = requirement_impls %.Self.ref.loc6_20.2, %.loc6_32 [concrete] +// CHECK:STDOUT: %.loc6_14: type = where_expr [concrete = type] { +// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc6_9 [concrete] +// CHECK:STDOUT: %impls.loc6_26.2 = requirement_impls %.Self.ref.loc6_20.2, %.loc6_32 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: %U: = wrapper_binding U, [concrete = ] @@ -94,7 +90,7 @@ let U: (type where .Self impls type).missing = {}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc6: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/fail_lookup_undefined.carbon b/toolchain/check/testdata/interface/fail_lookup_undefined.carbon index 28851b2663a0..ca9ed70e8a6d 100644 --- a/toolchain/check/testdata/interface/fail_lookup_undefined.carbon +++ b/toolchain/check/testdata/interface/fail_lookup_undefined.carbon @@ -14,38 +14,24 @@ interface Undefined; -// CHECK:STDERR: fail_lookup_undefined.carbon:[[@LINE+7]]:4: error: cannot declare a member of undefined interface `Undefined` [QualifiedDeclInUndefinedInterfaceScope] -// CHECK:STDERR: fn Undefined.F(); -// CHECK:STDERR: ^~~~~~~~~ -// CHECK:STDERR: fail_lookup_undefined.carbon:[[@LINE-5]]:1: note: interface was forward declared here [InterfaceForwardDeclaredHere] -// CHECK:STDERR: interface Undefined; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_lookup_undefined.carbon:[[@LINE+3]]:4-12: error: cannot declare a member of undefined interface `Undefined` [QualifiedDeclInUndefinedInterfaceScope] +// CHECK:STDERR: fail_lookup_undefined.carbon:[[@LINE-3]]:1-20: note: interface was forward declared here [InterfaceForwardDeclaredHere] // CHECK:STDERR: fn Undefined.F(); fn Test() { - // CHECK:STDERR: fail_lookup_undefined.carbon:[[@LINE+7]]:3: error: member access into incomplete facet type `Undefined` [QualifiedExprInIncompleteFacetTypeScope] - // CHECK:STDERR: Undefined.G(); - // CHECK:STDERR: ^~~~~~~~~~~ - // CHECK:STDERR: fail_lookup_undefined.carbon:[[@LINE-15]]:1: note: interface was forward declared here [InterfaceForwardDeclaredHere] - // CHECK:STDERR: interface Undefined; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_lookup_undefined.carbon:[[@LINE+3]]:3-13: error: member access into incomplete facet type `Undefined` [QualifiedExprInIncompleteFacetTypeScope] + // CHECK:STDERR: fail_lookup_undefined.carbon:[[@LINE-9]]:1-20: note: interface was forward declared here [InterfaceForwardDeclaredHere] // CHECK:STDERR: Undefined.G(); } interface BeingDefined { - // CHECK:STDERR: fail_lookup_undefined.carbon:[[@LINE+7]]:13: error: member access into incomplete facet type `BeingDefined` [QualifiedExprInIncompleteFacetTypeScope] - // CHECK:STDERR: fn H() -> BeingDefined.T; - // CHECK:STDERR: ^~~~~~~~~~~~~~ - // CHECK:STDERR: fail_lookup_undefined.carbon:[[@LINE-4]]:1: note: interface is currently being defined [InterfaceIncompleteWithinDefinition] - // CHECK:STDERR: interface BeingDefined { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_lookup_undefined.carbon:[[@LINE+3]]:13-26: error: member access into incomplete facet type `BeingDefined` [QualifiedExprInIncompleteFacetTypeScope] + // CHECK:STDERR: fail_lookup_undefined.carbon:[[@LINE-2]]:1-24: note: interface is currently being defined [InterfaceIncompleteWithinDefinition] // CHECK:STDERR: fn H() -> BeingDefined.T; - // CHECK:STDERR: fail_lookup_undefined.carbon:[[@LINE+4]]:6: error: name `BeingDefined` not found [NameNotFound] - // CHECK:STDERR: fn BeingDefined.I(); - // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_lookup_undefined.carbon:[[@LINE+2]]:6-17: error: name `BeingDefined` not found [NameNotFound] // CHECK:STDERR: fn BeingDefined.I(); } diff --git a/toolchain/check/testdata/interface/fail_member_lookup.carbon b/toolchain/check/testdata/interface/fail_member_lookup.carbon index 941fc42ec630..2ab4d6de1ee6 100644 --- a/toolchain/check/testdata/interface/fail_member_lookup.carbon +++ b/toolchain/check/testdata/interface/fail_member_lookup.carbon @@ -22,27 +22,19 @@ interface Interface { } fn F() { - // CHECK:STDERR: fail_member_lookup.carbon:[[@LINE+4]]:3: error: value of type `` is not callable [CallToNonCallable] - // CHECK:STDERR: Interface.F(); - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_member_lookup.carbon:[[@LINE+2]]:3-15: error: value of type `` is not callable [CallToNonCallable] // CHECK:STDERR: Interface.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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var unused v: Interface.T; - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_member_lookup.carbon:[[@LINE+3]]:17-27: error: cannot implicitly convert non-type value of type `` to `type` [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: fail_member_lookup.carbon:[[@LINE+2]]:17-27: note: type `` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused v: Interface.T; } interface Different {} -// CHECK:STDERR: fail_member_lookup.carbon:[[@LINE+4]]:31: error: cannot convert type `U` that implements `Different` into type implementing `Interface` [ConversionFailureFacetToFacet] -// CHECK:STDERR: fn G(generic U: Different) -> U.(Interface.T); -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_member_lookup.carbon:[[@LINE+2]]:31-45: error: cannot convert type `U` that implements `Different` into type implementing `Interface` [ConversionFailureFacetToFacet] // CHECK:STDERR: fn G(generic U: Different) -> U.(Interface.T); @@ -97,18 +89,18 @@ fn G(generic U: Different) -> U.(Interface.T); // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} // CHECK:STDOUT: %Different.decl: type = interface_decl @Different [concrete = constants.%Different.type] {} {} // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] { -// CHECK:STDOUT: %U.patt.loc32_15.1: %pattern_type.776 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc32_15.2 (constants.%U.patt)] +// CHECK:STDOUT: %U.patt.loc24_15.1: %pattern_type.776 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc24_15.2 (constants.%U.patt)] // CHECK:STDOUT: %return.patt: = return_slot_pattern , [concrete = ] // CHECK:STDOUT: } { -// CHECK:STDOUT: %U.ref: %Different.type = name_ref U, %U.loc32_15.2 [symbolic = %U.loc32_15.1 (constants.%U)] +// CHECK:STDOUT: %U.ref: %Different.type = name_ref U, %U.loc24_15.2 [symbolic = %U.loc24_15.1 (constants.%U)] // CHECK:STDOUT: %Interface.ref: type = name_ref Interface, file.%Interface.decl [concrete = constants.%Interface.type] // CHECK:STDOUT: %T.ref: %Interface.assoc_type = name_ref T, @T.%assoc1 [concrete = constants.%assoc1] -// CHECK:STDOUT: %U.as_type.loc32_32.2: type = facet_access_type %U.ref [symbolic = %U.as_type.loc32_32.1 (constants.%U.as_type)] -// CHECK:STDOUT: %.loc32: type = splice_block %Different.ref [concrete = constants.%Different.type] { +// CHECK:STDOUT: %U.as_type.loc24_32.2: type = facet_access_type %U.ref [symbolic = %U.as_type.loc24_32.1 (constants.%U.as_type)] +// CHECK:STDOUT: %.loc24: type = splice_block %Different.ref [concrete = constants.%Different.type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %Different.ref: type = name_ref Different, file.%Different.decl [concrete = constants.%Different.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %U.loc32_15.2: %Different.type = symbolic_binding U, 0 [symbolic = %U.loc32_15.1 (constants.%U)] +// CHECK:STDOUT: %U.loc24_15.2: %Different.type = symbolic_binding U, 0 [symbolic = %U.loc24_15.1 (constants.%U)] // CHECK:STDOUT: %return: = return_slot // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -150,14 +142,14 @@ fn G(generic U: Different) -> U.(Interface.T); // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Interface.ref.loc14: type = name_ref Interface, file.%Interface.decl [concrete = constants.%Interface.type] +// CHECK:STDOUT: %Interface.ref.loc12: type = name_ref Interface, file.%Interface.decl [concrete = constants.%Interface.type] // CHECK:STDOUT: %F.ref: %Interface.assoc_type = name_ref F, @Interface.WithSelf.%assoc0 [concrete = constants.%assoc0.b3c] // CHECK:STDOUT: %v.var: ref = var_storage %v.var_patt [concrete = ] // CHECK:STDOUT: assign %v.var, // CHECK:STDOUT: %.1: = splice_block [concrete = ] { -// CHECK:STDOUT: %Interface.ref.loc23: type = name_ref Interface, file.%Interface.decl [concrete = constants.%Interface.type] +// CHECK:STDOUT: %Interface.ref.loc17: type = name_ref Interface, file.%Interface.decl [concrete = constants.%Interface.type] // CHECK:STDOUT: %T.ref: %Interface.assoc_type = name_ref T, @T.%assoc1 [concrete = constants.%assoc1] -// CHECK:STDOUT: %.loc23: type = converted %T.ref, [concrete = ] +// CHECK:STDOUT: %.loc17: type = converted %T.ref, [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %v: = wrapper_binding v, [concrete = ] // CHECK:STDOUT: name_binding_decl { @@ -167,10 +159,10 @@ fn G(generic U: Different) -> U.(Interface.T); // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @G(%U.loc32_15.2: %Different.type) { -// CHECK:STDOUT: %U.patt.loc32_15.2: %pattern_type.776 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc32_15.2 (constants.%U.patt)] -// CHECK:STDOUT: %U.loc32_15.1: %Different.type = symbolic_binding U, 0 [symbolic = %U.loc32_15.1 (constants.%U)] -// CHECK:STDOUT: %U.as_type.loc32_32.1: type = facet_access_type %U.loc32_15.1 [symbolic = %U.as_type.loc32_32.1 (constants.%U.as_type)] +// CHECK:STDOUT: generic fn @G(%U.loc24_15.2: %Different.type) { +// CHECK:STDOUT: %U.patt.loc24_15.2: %pattern_type.776 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc24_15.2 (constants.%U.patt)] +// CHECK:STDOUT: %U.loc24_15.1: %Different.type = symbolic_binding U, 0 [symbolic = %U.loc24_15.1 (constants.%U)] +// CHECK:STDOUT: %U.as_type.loc24_32.1: type = facet_access_type %U.loc24_15.1 [symbolic = %U.as_type.loc24_32.1 (constants.%U.as_type)] // CHECK:STDOUT: // CHECK:STDOUT: fn() -> ; // CHECK:STDOUT: } @@ -187,8 +179,8 @@ fn G(generic U: Different) -> U.(Interface.T); // CHECK:STDOUT: specific @Different.WithSelf(constants.%Self.8ba) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @G(constants.%U) { -// CHECK:STDOUT: %U.patt.loc32_15.2 => constants.%U.patt -// CHECK:STDOUT: %U.loc32_15.1 => constants.%U -// CHECK:STDOUT: %U.as_type.loc32_32.1 => constants.%U.as_type +// CHECK:STDOUT: %U.patt.loc24_15.2 => constants.%U.patt +// CHECK:STDOUT: %U.loc24_15.1 => constants.%U +// CHECK:STDOUT: %U.as_type.loc24_32.1 => constants.%U.as_type // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/fail_modifiers.carbon b/toolchain/check/testdata/interface/fail_modifiers.carbon index b231114c6a84..f59aa3ae5930 100644 --- a/toolchain/check/testdata/interface/fail_modifiers.carbon +++ b/toolchain/check/testdata/interface/fail_modifiers.carbon @@ -16,9 +16,7 @@ library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_abstract.carbon:[[@LINE+4]]:1: error: `abstract` not allowed on `interface` declaration [ModifierNotAllowedOnDeclaration] -// CHECK:STDERR: abstract interface Abstract { -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_abstract.carbon:[[@LINE+2]]:1-8: error: `abstract` not allowed on `interface` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: abstract interface Abstract { } @@ -27,9 +25,7 @@ abstract interface Abstract { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_default.carbon:[[@LINE+4]]:1: error: `default` not allowed on `interface` declaration [ModifierNotAllowedOnDeclaration] -// CHECK:STDERR: default interface Default; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_default.carbon:[[@LINE+2]]:1-7: error: `default` not allowed on `interface` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: default interface Default; @@ -37,9 +33,7 @@ default interface Default; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_virtual.carbon:[[@LINE+4]]:1: error: `virtual` not allowed on `interface` declaration [ModifierNotAllowedOnDeclaration] -// CHECK:STDERR: virtual interface Virtual { -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_virtual.carbon:[[@LINE+2]]:1-7: error: `virtual` not allowed on `interface` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: virtual interface Virtual { } @@ -48,9 +42,7 @@ virtual interface Virtual { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_protected.carbon:[[@LINE+4]]:1: error: `protected` not allowed; requires class scope [ModifierProtectedNotAllowed] -// CHECK:STDERR: protected interface Protected; -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_protected.carbon:[[@LINE+2]]:1-9: error: `protected` not allowed; requires class scope [ModifierProtectedNotAllowed] // CHECK:STDERR: protected interface Protected; @@ -59,9 +51,7 @@ protected interface Protected; library "[[@TEST_NAME]]"; interface I { - // CHECK:STDERR: fail_private_member.carbon:[[@LINE+4]]:3: error: `private` not allowed; requires class or file scope [ModifierPrivateNotAllowed] - // CHECK:STDERR: private fn F(self); - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_private_member.carbon:[[@LINE+2]]:3-9: error: `private` not allowed; requires class or file scope [ModifierPrivateNotAllowed] // CHECK:STDERR: private fn F(self); } @@ -71,9 +61,7 @@ interface I { library "[[@TEST_NAME]]"; interface I { - // CHECK:STDERR: fail_protected_member.carbon:[[@LINE+4]]:3: error: `protected` not allowed; requires class scope [ModifierProtectedNotAllowed] - // CHECK:STDERR: protected fn F(self); - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_protected_member.carbon:[[@LINE+2]]:3-11: error: `protected` not allowed; requires class scope [ModifierProtectedNotAllowed] // CHECK:STDERR: protected fn F(self); } @@ -195,16 +183,16 @@ interface I { // CHECK:STDOUT: // CHECK:STDOUT: !with Self: // CHECK:STDOUT: %I.WithSelf.F.decl: @I.WithSelf.%I.WithSelf.F.type (%I.WithSelf.F.type) = fn_decl @I.WithSelf.F [symbolic = @I.WithSelf.%I.WithSelf.F (constants.%I.WithSelf.F)] { -// CHECK:STDOUT: %self.param_patt.loc9_16.1: @I.WithSelf.F.%pattern_type (%pattern_type) = value_param_pattern [symbolic = %self.param_patt.loc9_16.2 (constants.%self.param_patt)] -// CHECK:STDOUT: %self.patt.loc9_16.1: @I.WithSelf.F.%pattern_type (%pattern_type) = wrapper_binding_pattern self, %self.param_patt.loc9_16.1 [symbolic = %self.patt.loc9_16.2 (constants.%self.patt)] +// CHECK:STDOUT: %self.param_patt.loc7_16.1: @I.WithSelf.F.%pattern_type (%pattern_type) = value_param_pattern [symbolic = %self.param_patt.loc7_16.2 (constants.%self.param_patt)] +// CHECK:STDOUT: %self.patt.loc7_16.1: @I.WithSelf.F.%pattern_type (%pattern_type) = wrapper_binding_pattern self, %self.param_patt.loc7_16.1 [symbolic = %self.patt.loc7_16.2 (constants.%self.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: @I.WithSelf.F.%Self.as_type.loc9_16.1 (%Self.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc9_16.1: type = splice_block %.loc9_16.2 [symbolic = %Self.as_type.loc9_16.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %self.param: @I.WithSelf.F.%Self.as_type.loc7_16.1 (%Self.as_type) = value_param call_param0 +// CHECK:STDOUT: %.loc7_16.1: type = splice_block %.loc7_16.2 [symbolic = %Self.as_type.loc7_16.1 (constants.%Self.as_type)] { // CHECK:STDOUT: %Self.ref: %I.type = name_ref Self, @I.%Self [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc9_16.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc9_16.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %.loc9_16.2: type = converted %Self.ref, %Self.as_type.loc9_16.2 [symbolic = %Self.as_type.loc9_16.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %Self.as_type.loc7_16.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc7_16.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc7_16.2: type = converted %Self.ref, %Self.as_type.loc7_16.2 [symbolic = %Self.as_type.loc7_16.1 (constants.%Self.as_type)] // CHECK:STDOUT: } -// CHECK:STDOUT: %self: @I.WithSelf.F.%Self.as_type.loc9_16.1 (%Self.as_type) = wrapper_binding self, %self.param +// CHECK:STDOUT: %self: @I.WithSelf.F.%Self.as_type.loc7_16.1 (%Self.as_type) = wrapper_binding self, %self.param // CHECK:STDOUT: } // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, %I.WithSelf.F.decl [concrete = constants.%assoc0] // CHECK:STDOUT: @@ -218,22 +206,22 @@ interface I { // CHECK:STDOUT: // CHECK:STDOUT: generic fn @I.WithSelf.F(@I.%Self: %I.type) { // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc9_16.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_16.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc9_16.1 [symbolic = %pattern_type (constants.%pattern_type)] -// CHECK:STDOUT: %self.param_patt.loc9_16.2: @I.WithSelf.F.%pattern_type (%pattern_type) = value_param_pattern [symbolic = %self.param_patt.loc9_16.2 (constants.%self.param_patt)] -// CHECK:STDOUT: %self.patt.loc9_16.2: @I.WithSelf.F.%pattern_type (%pattern_type) = wrapper_binding_pattern self, %self.param_patt.loc9_16.2 [symbolic = %self.patt.loc9_16.2 (constants.%self.patt)] +// CHECK:STDOUT: %Self.as_type.loc7_16.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc7_16.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc7_16.1 [symbolic = %pattern_type (constants.%pattern_type)] +// CHECK:STDOUT: %self.param_patt.loc7_16.2: @I.WithSelf.F.%pattern_type (%pattern_type) = value_param_pattern [symbolic = %self.param_patt.loc7_16.2 (constants.%self.param_patt)] +// CHECK:STDOUT: %self.patt.loc7_16.2: @I.WithSelf.F.%pattern_type (%pattern_type) = wrapper_binding_pattern self, %self.param_patt.loc7_16.2 [symbolic = %self.patt.loc7_16.2 (constants.%self.patt)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%self.param: @I.WithSelf.F.%Self.as_type.loc9_16.1 (%Self.as_type)); +// CHECK:STDOUT: fn(%self.param: @I.WithSelf.F.%Self.as_type.loc7_16.1 (%Self.as_type)); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @I.WithSelf(constants.%Self) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @I.WithSelf.F(constants.%Self) { // CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.as_type.loc9_16.1 => constants.%Self.as_type +// CHECK:STDOUT: %Self.as_type.loc7_16.1 => constants.%Self.as_type // CHECK:STDOUT: %pattern_type => constants.%pattern_type -// CHECK:STDOUT: %self.param_patt.loc9_16.2 => constants.%self.param_patt -// CHECK:STDOUT: %self.patt.loc9_16.2 => constants.%self.patt +// CHECK:STDOUT: %self.param_patt.loc7_16.2 => constants.%self.param_patt +// CHECK:STDOUT: %self.patt.loc7_16.2 => constants.%self.patt // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_protected_member.carbon @@ -265,16 +253,16 @@ interface I { // CHECK:STDOUT: // CHECK:STDOUT: !with Self: // CHECK:STDOUT: %I.WithSelf.F.decl: @I.WithSelf.%I.WithSelf.F.type (%I.WithSelf.F.type) = fn_decl @I.WithSelf.F [symbolic = @I.WithSelf.%I.WithSelf.F (constants.%I.WithSelf.F)] { -// CHECK:STDOUT: %self.param_patt.loc9_18.1: @I.WithSelf.F.%pattern_type (%pattern_type) = value_param_pattern [symbolic = %self.param_patt.loc9_18.2 (constants.%self.param_patt)] -// CHECK:STDOUT: %self.patt.loc9_18.1: @I.WithSelf.F.%pattern_type (%pattern_type) = wrapper_binding_pattern self, %self.param_patt.loc9_18.1 [symbolic = %self.patt.loc9_18.2 (constants.%self.patt)] +// CHECK:STDOUT: %self.param_patt.loc7_18.1: @I.WithSelf.F.%pattern_type (%pattern_type) = value_param_pattern [symbolic = %self.param_patt.loc7_18.2 (constants.%self.param_patt)] +// CHECK:STDOUT: %self.patt.loc7_18.1: @I.WithSelf.F.%pattern_type (%pattern_type) = wrapper_binding_pattern self, %self.param_patt.loc7_18.1 [symbolic = %self.patt.loc7_18.2 (constants.%self.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: @I.WithSelf.F.%Self.as_type.loc9_18.1 (%Self.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc9_18.1: type = splice_block %.loc9_18.2 [symbolic = %Self.as_type.loc9_18.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %self.param: @I.WithSelf.F.%Self.as_type.loc7_18.1 (%Self.as_type) = value_param call_param0 +// CHECK:STDOUT: %.loc7_18.1: type = splice_block %.loc7_18.2 [symbolic = %Self.as_type.loc7_18.1 (constants.%Self.as_type)] { // CHECK:STDOUT: %Self.ref: %I.type = name_ref Self, @I.%Self [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc9_18.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc9_18.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %.loc9_18.2: type = converted %Self.ref, %Self.as_type.loc9_18.2 [symbolic = %Self.as_type.loc9_18.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %Self.as_type.loc7_18.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc7_18.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc7_18.2: type = converted %Self.ref, %Self.as_type.loc7_18.2 [symbolic = %Self.as_type.loc7_18.1 (constants.%Self.as_type)] // CHECK:STDOUT: } -// CHECK:STDOUT: %self: @I.WithSelf.F.%Self.as_type.loc9_18.1 (%Self.as_type) = wrapper_binding self, %self.param +// CHECK:STDOUT: %self: @I.WithSelf.F.%Self.as_type.loc7_18.1 (%Self.as_type) = wrapper_binding self, %self.param // CHECK:STDOUT: } // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, %I.WithSelf.F.decl [concrete = constants.%assoc0] // CHECK:STDOUT: @@ -288,21 +276,21 @@ interface I { // CHECK:STDOUT: // CHECK:STDOUT: generic fn @I.WithSelf.F(@I.%Self: %I.type) { // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc9_18.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_18.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc9_18.1 [symbolic = %pattern_type (constants.%pattern_type)] -// CHECK:STDOUT: %self.param_patt.loc9_18.2: @I.WithSelf.F.%pattern_type (%pattern_type) = value_param_pattern [symbolic = %self.param_patt.loc9_18.2 (constants.%self.param_patt)] -// CHECK:STDOUT: %self.patt.loc9_18.2: @I.WithSelf.F.%pattern_type (%pattern_type) = wrapper_binding_pattern self, %self.param_patt.loc9_18.2 [symbolic = %self.patt.loc9_18.2 (constants.%self.patt)] +// CHECK:STDOUT: %Self.as_type.loc7_18.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc7_18.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc7_18.1 [symbolic = %pattern_type (constants.%pattern_type)] +// CHECK:STDOUT: %self.param_patt.loc7_18.2: @I.WithSelf.F.%pattern_type (%pattern_type) = value_param_pattern [symbolic = %self.param_patt.loc7_18.2 (constants.%self.param_patt)] +// CHECK:STDOUT: %self.patt.loc7_18.2: @I.WithSelf.F.%pattern_type (%pattern_type) = wrapper_binding_pattern self, %self.param_patt.loc7_18.2 [symbolic = %self.patt.loc7_18.2 (constants.%self.patt)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%self.param: @I.WithSelf.F.%Self.as_type.loc9_18.1 (%Self.as_type)); +// CHECK:STDOUT: fn(%self.param: @I.WithSelf.F.%Self.as_type.loc7_18.1 (%Self.as_type)); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @I.WithSelf(constants.%Self) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @I.WithSelf.F(constants.%Self) { // CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.as_type.loc9_18.1 => constants.%Self.as_type +// CHECK:STDOUT: %Self.as_type.loc7_18.1 => constants.%Self.as_type // CHECK:STDOUT: %pattern_type => constants.%pattern_type -// CHECK:STDOUT: %self.param_patt.loc9_18.2 => constants.%self.param_patt -// CHECK:STDOUT: %self.patt.loc9_18.2 => constants.%self.patt +// CHECK:STDOUT: %self.param_patt.loc7_18.2 => constants.%self.param_patt +// CHECK:STDOUT: %self.patt.loc7_18.2 => constants.%self.patt // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/fail_redeclare_member.carbon b/toolchain/check/testdata/interface/fail_redeclare_member.carbon index 9101eff34e40..ce51f908538b 100644 --- a/toolchain/check/testdata/interface/fail_redeclare_member.carbon +++ b/toolchain/check/testdata/interface/fail_redeclare_member.carbon @@ -14,12 +14,8 @@ interface Interface { fn F(); - // CHECK:STDERR: fail_redeclare_member.carbon:[[@LINE+7]]:3: error: redeclaration of `fn F` is redundant [RedeclRedundant] - // CHECK:STDERR: fn F(); - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_redeclare_member.carbon:[[@LINE-4]]:3: note: previously declared here [RedeclPrevDecl] - // CHECK:STDERR: fn F(); - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_redeclare_member.carbon:[[@LINE+3]]:3-9: error: redeclaration of `fn F` is redundant [RedeclRedundant] + // CHECK:STDERR: fail_redeclare_member.carbon:[[@LINE-2]]:3-9: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: fn F(); } @@ -50,7 +46,7 @@ interface Interface { // CHECK:STDOUT: !with Self: // CHECK:STDOUT: %Interface.WithSelf.F.decl.loc16: @Interface.WithSelf.%Interface.WithSelf.F.type (%Interface.WithSelf.F.type) = fn_decl @Interface.WithSelf.F [symbolic = @Interface.WithSelf.%Interface.WithSelf.F (constants.%Interface.WithSelf.F)] {} {} // CHECK:STDOUT: %assoc0: %Interface.assoc_type = assoc_entity element0, %Interface.WithSelf.F.decl.loc16 [concrete = constants.%assoc0] -// CHECK:STDOUT: %Interface.WithSelf.F.decl.loc24: @Interface.WithSelf.%Interface.WithSelf.F.type (%Interface.WithSelf.F.type) = fn_decl @Interface.WithSelf.F [symbolic = @Interface.WithSelf.%Interface.WithSelf.F (constants.%Interface.WithSelf.F)] {} {} +// CHECK:STDOUT: %Interface.WithSelf.F.decl.loc20: @Interface.WithSelf.%Interface.WithSelf.F.type (%Interface.WithSelf.F.type) = fn_decl @Interface.WithSelf.F [symbolic = @Interface.WithSelf.%Interface.WithSelf.F (constants.%Interface.WithSelf.F)] {} {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self diff --git a/toolchain/check/testdata/interface/fail_todo_assoc_const_default.carbon b/toolchain/check/testdata/interface/fail_todo_assoc_const_default.carbon index cd2b0d15a9e5..f5a2ec0015cb 100644 --- a/toolchain/check/testdata/interface/fail_todo_assoc_const_default.carbon +++ b/toolchain/check/testdata/interface/fail_todo_assoc_const_default.carbon @@ -13,14 +13,10 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/fail_todo_assoc_const_default.carbon interface I { - // CHECK:STDERR: fail_todo_assoc_const_default.carbon:[[@LINE+4]]:3: error: semantics TODO: `interface modifier` [SemanticsTodo] - // CHECK:STDERR: default let T: type = (i32, i32); - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_todo_assoc_const_default.carbon:[[@LINE+2]]:3-9: error: semantics TODO: `interface modifier` [SemanticsTodo] // CHECK:STDERR: default let T: type = (i32, i32); - // CHECK:STDERR: fail_todo_assoc_const_default.carbon:[[@LINE+4]]:3: error: semantics TODO: `interface modifier` [SemanticsTodo] - // CHECK:STDERR: default let N: i32 = 42; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_todo_assoc_const_default.carbon:[[@LINE+2]]:3-9: error: semantics TODO: `interface modifier` [SemanticsTodo] // CHECK:STDERR: default let N: i32 = 42; } @@ -89,21 +85,21 @@ interface I { // CHECK:STDOUT: !with Self: // CHECK:STDOUT: %T: type = assoc_const_decl @T [concrete] { // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.WithSelf.%T [concrete = constants.%assoc0.2ce] -// CHECK:STDOUT: %i32.loc20_26: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %i32.loc20_31: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc20_34: %tuple.type.693 = tuple_literal (%i32.loc20_26, %i32.loc20_31) [concrete = constants.%tuple] -// CHECK:STDOUT: %.loc20_35: type = converted %.loc20_34, constants.%tuple.type.35f [concrete = constants.%tuple.type.35f] +// CHECK:STDOUT: %i32.loc18_26: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc18_31: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc18_34: %tuple.type.693 = tuple_literal (%i32.loc18_26, %i32.loc18_31) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc18_35: type = converted %.loc18_34, constants.%tuple.type.35f [concrete = constants.%tuple.type.35f] // CHECK:STDOUT: } // CHECK:STDOUT: %N: %i32 = assoc_const_decl @N [concrete] { // CHECK:STDOUT: %assoc1: %I.assoc_type = assoc_entity element1, @I.WithSelf.%N [concrete = constants.%assoc1] // CHECK:STDOUT: %int_42: Core.IntLiteral = int_value 42 [concrete = constants.%int_42.20e] // CHECK:STDOUT: %impl.elem0: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc25_26.1: = bound_method %int_42, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %bound_method.loc21_26.1: = bound_method %int_42, %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.loc25_26.2: = bound_method %int_42, %specific_fn [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc25_26.2(%int_42) [concrete = constants.%int_42.db5] -// CHECK:STDOUT: %.loc25_26.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_42.db5] -// CHECK:STDOUT: %.loc25_26.2: %i32 = converted %int_42, %.loc25_26.1 [concrete = constants.%int_42.db5] +// CHECK:STDOUT: %bound_method.loc21_26.2: = bound_method %int_42, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc21_26.2(%int_42) [concrete = constants.%int_42.db5] +// CHECK:STDOUT: %.loc21_26.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_42.db5] +// CHECK:STDOUT: %.loc21_26.2: %i32 = converted %int_42, %.loc21_26.1 [concrete = constants.%int_42.db5] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: diff --git a/toolchain/check/testdata/interface/fail_type_as_facet.carbon b/toolchain/check/testdata/interface/fail_type_as_facet.carbon index 1c4974c03bf1..41369965d8bb 100644 --- a/toolchain/check/testdata/interface/fail_type_as_facet.carbon +++ b/toolchain/check/testdata/interface/fail_type_as_facet.carbon @@ -12,12 +12,8 @@ interface I { let T: type; - // CHECK:STDERR: fail_type_as_facet.carbon:[[@LINE+7]]:17: error: cannot implicitly convert non-type value of type `T` to `type` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fn F[X: T](x: X); - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_type_as_facet.carbon:[[@LINE+4]]:17: 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: fail_type_as_facet.carbon:[[@LINE+3]]:17: error: cannot implicitly convert non-type value of type `T` to `type` [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: fail_type_as_facet.carbon:[[@LINE+2]]:17: 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); } diff --git a/toolchain/check/testdata/interface/generic.carbon b/toolchain/check/testdata/interface/generic.carbon index f8e4cd704ba5..9ac49cf02283 100644 --- a/toolchain/check/testdata/interface/generic.carbon +++ b/toolchain/check/testdata/interface/generic.carbon @@ -52,12 +52,8 @@ class B {} fn F(generic T: Generic(A)); fn G(generic T: Generic(B)) { - // CHECK:STDERR: fail_mismatched_args.carbon:[[@LINE+7]]:3: error: cannot convert type `T` that implements `Generic(B)` into type implementing `Generic(A)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: F(T); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_mismatched_args.carbon:[[@LINE-5]]:14: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn F(generic T: Generic(A)); - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_mismatched_args.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `Generic(B)` into type implementing `Generic(A)` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_mismatched_args.carbon:[[@LINE-3]]:14-26: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: F(T); } @@ -67,12 +63,8 @@ library "[[@TEST_NAME]]"; interface Generic(T: type) {} -// CHECK:STDERR: fail_args_count_mismatch.carbon:[[@LINE+7]]:24: error: 2 arguments passed to generic interface expecting 1 argument [CallArgCountMismatch] -// CHECK:STDERR: fn F(unused generic T: Generic((), ())) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_args_count_mismatch.carbon:[[@LINE-5]]:1: note: calling generic interface declared here [InCallToEntity] -// CHECK:STDERR: interface Generic(T: type) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_args_count_mismatch.carbon:[[@LINE+3]]:24-38: error: 2 arguments passed to generic interface expecting 1 argument [CallArgCountMismatch] +// CHECK:STDERR: fail_args_count_mismatch.carbon:[[@LINE-3]]:1-28: note: calling generic interface declared here [InCallToEntity] // CHECK:STDERR: fn F(unused generic T: Generic((), ())) {} @@ -595,13 +587,13 @@ fn F(unused generic T: Generic((), ())) {} // CHECK:STDOUT: %T.loc10_15.1: %Generic.type.a24 = symbolic_binding T, 0 [symbolic = %T.loc10_15.1 (constants.%T.ec1)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %T.as_type.loc18_6.2: type = facet_access_type %T.loc10_15.1 [symbolic = %T.as_type.loc18_6.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.as_type.loc14_6.2: type = facet_access_type %T.loc10_15.1 [symbolic = %T.as_type.loc14_6.2 (constants.%T.as_type)] // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] // CHECK:STDOUT: %T.ref: %Generic.type.a24 = name_ref T, %T.loc10_15.2 [symbolic = %T.loc10_15.1 (constants.%T.ec1)] -// CHECK:STDOUT: %T.as_type.loc18_6.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc18_6.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.as_type.loc14_6.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc14_6.2 (constants.%T.as_type)] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -671,8 +663,8 @@ fn F(unused generic T: Generic((), ())) {} // CHECK:STDOUT: %.1: = splice_block [concrete = ] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %Generic.ref: %Generic.type.30d = name_ref Generic, file.%Generic.decl [concrete = constants.%Generic.generic] -// CHECK:STDOUT: %.loc12_33: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc12_37: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_33: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_37: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] // CHECK:STDOUT: } // CHECK:STDOUT: %T: = symbolic_binding T, 0 [concrete = ] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/interface/generic_vs_params.carbon b/toolchain/check/testdata/interface/generic_vs_params.carbon index 2367f3e61de1..870a88f4fa4d 100644 --- a/toolchain/check/testdata/interface/generic_vs_params.carbon +++ b/toolchain/check/testdata/interface/generic_vs_params.carbon @@ -36,9 +36,7 @@ impl X as C(X).GenericAndParams(X) {} library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_non_generic_implicit_params.carbon:[[@LINE+4]]:13: error: parameters of generic types must be constant [GenericParamMustBeConstant] -// CHECK:STDERR: interface A[runtime T: type]() {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_non_generic_implicit_params.carbon:[[@LINE+2]]:13-27: error: parameters of generic types must be constant [GenericParamMustBeConstant] // CHECK:STDERR: interface A[runtime T: type]() {} @@ -46,9 +44,7 @@ interface A[runtime T: type]() {} library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_non_generic_params.carbon:[[@LINE+4]]:13: error: parameters of generic types must be constant [GenericParamMustBeConstant] -// CHECK:STDERR: interface A(runtime T: type) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_non_generic_params.carbon:[[@LINE+2]]:13-27: error: parameters of generic types must be constant [GenericParamMustBeConstant] // CHECK:STDERR: interface A(runtime T: type) {} @@ -56,9 +52,7 @@ interface A(runtime T: type) {} library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_implicit_params_only_empty.carbon:[[@LINE+4]]:14: error: expected explicit parameters after implicit parameters [GenericMissingExplicitParameters] -// CHECK:STDERR: interface Bar[] {} -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_implicit_params_only_empty.carbon:[[@LINE+2]]:14-15: error: expected explicit parameters after implicit parameters [GenericMissingExplicitParameters] // CHECK:STDERR: interface Bar[] {} @@ -66,9 +60,7 @@ interface Bar[] {} library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_implicit_params_only.carbon:[[@LINE+4]]:14: error: expected explicit parameters after implicit parameters [GenericMissingExplicitParameters] -// CHECK:STDERR: interface Bar[T: type] {} -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_implicit_params_only.carbon:[[@LINE+2]]:14-22: error: expected explicit parameters after implicit parameters [GenericMissingExplicitParameters] // CHECK:STDERR: interface Bar[T: type] {} @@ -571,30 +563,30 @@ interface Bar[T: type] {} // CHECK:STDOUT: .Bar = %Bar.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Bar.decl: %Bar.type.3f0 = interface_decl @Bar [concrete = constants.%Bar.generic] { -// CHECK:STDOUT: %T.patt.loc8_16.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_16.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc6_16.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_16.2 (constants.%T.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc8_18.1: type = splice_block %.loc8_18.2 [concrete = type] { +// CHECK:STDOUT: %.loc6_18.1: type = splice_block %.loc6_18.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc8_18.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc6_18.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc8_16.2: type = symbolic_binding T, 0 [symbolic = %T.loc8_16.1 (constants.%T)] +// CHECK:STDOUT: %T.loc6_16.2: type = symbolic_binding T, 0 [symbolic = %T.loc6_16.1 (constants.%T)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @Bar(%T.loc8_16.2: type) { -// CHECK:STDOUT: %T.patt.loc8_16.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_16.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc8_16.1: type = symbolic_binding T, 0 [symbolic = %T.loc8_16.1 (constants.%T)] +// CHECK:STDOUT: generic interface @Bar(%T.loc6_16.2: type) { +// CHECK:STDOUT: %T.patt.loc6_16.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_16.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc6_16.1: type = symbolic_binding T, 0 [symbolic = %T.loc6_16.1 (constants.%T)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Bar.type: type = facet_type <@Bar, @Bar(%T.loc8_16.1)> [symbolic = %Bar.type (constants.%Bar.type.223)] -// CHECK:STDOUT: %Self.loc8_24.2: @Bar.%Bar.type (%Bar.type.223) = symbolic_binding Self, 1 [symbolic = %Self.loc8_24.2 (constants.%Self)] +// CHECK:STDOUT: %Bar.type: type = facet_type <@Bar, @Bar(%T.loc6_16.1)> [symbolic = %Bar.type (constants.%Bar.type.223)] +// CHECK:STDOUT: %Self.loc6_24.2: @Bar.%Bar.type (%Bar.type.223) = symbolic_binding Self, 1 [symbolic = %Self.loc6_24.2 (constants.%Self)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.loc8_24.1: @Bar.%Bar.type (%Bar.type.223) = symbolic_binding Self, 1 [symbolic = %Self.loc8_24.2 (constants.%Self)] +// CHECK:STDOUT: %Self.loc6_24.1: @Bar.%Bar.type (%Bar.type.223) = symbolic_binding Self, 1 [symbolic = %Self.loc6_24.2 (constants.%Self)] // CHECK:STDOUT: %Bar.WithSelf.decl = interface_with_self_decl @Bar [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.loc8_24.1 +// CHECK:STDOUT: .Self = %Self.loc6_24.1 // CHECK:STDOUT: witness = () // CHECK:STDOUT: // CHECK:STDOUT: !requires: @@ -602,8 +594,8 @@ interface Bar[T: type] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Bar(constants.%T) { -// CHECK:STDOUT: %T.patt.loc8_16.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc8_16.1 => constants.%T +// CHECK:STDOUT: %T.patt.loc6_16.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc6_16.1 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Bar.WithSelf(constants.%T, constants.%Self) {} diff --git a/toolchain/check/testdata/interface/import_access.carbon b/toolchain/check/testdata/interface/import_access.carbon index 696d8b76ff60..37a0ca14e344 100644 --- a/toolchain/check/testdata/interface/import_access.carbon +++ b/toolchain/check/testdata/interface/import_access.carbon @@ -53,9 +53,7 @@ package Test library "[[@TEST_NAME]]"; import library "def"; -// CHECK:STDERR: fail_local_def.carbon:[[@LINE+4]]:16: error: name `Def` not found [NameNotFound] -// CHECK:STDERR: fn F(unused i: Def) {} -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_local_def.carbon:[[@LINE+2]]:16-18: error: name `Def` not found [NameNotFound] // CHECK:STDERR: fn F(unused i: Def) {} @@ -65,9 +63,7 @@ package Other library "[[@TEST_NAME]]"; import Test library "def"; -// CHECK:STDERR: fail_other_def.carbon:[[@LINE+4]]:16: error: member name `Def` not found in `Test` [MemberNameNotFoundInInstScope] -// CHECK:STDERR: fn F(unused i: Test.Def) {} -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_other_def.carbon:[[@LINE+2]]:16-23: error: member name `Def` not found in `Test` [MemberNameNotFoundInInstScope] // CHECK:STDERR: fn F(unused i: Test.Def) {} @@ -83,9 +79,7 @@ package Test library "[[@TEST_NAME]]"; import library "forward_with_def"; -// CHECK:STDERR: fail_local_forward_with_def.carbon:[[@LINE+4]]:16: error: name `ForwardWithDef` not found [NameNotFound] -// CHECK:STDERR: fn F(unused i: ForwardWithDef) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_local_forward_with_def.carbon:[[@LINE+2]]:16-29: error: name `ForwardWithDef` not found [NameNotFound] // CHECK:STDERR: fn F(unused i: ForwardWithDef) {} @@ -95,9 +89,7 @@ package Other library "[[@TEST_NAME]]"; import Test library "forward_with_def"; -// CHECK:STDERR: fail_other_forward_with_def.carbon:[[@LINE+4]]:16: error: member name `ForwardWithDef` not found in `Test` [MemberNameNotFoundInInstScope] -// CHECK:STDERR: fn F(unused i: Test.ForwardWithDef) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_other_forward_with_def.carbon:[[@LINE+2]]:16-34: error: member name `ForwardWithDef` not found in `Test` [MemberNameNotFoundInInstScope] // CHECK:STDERR: fn F(unused i: Test.ForwardWithDef) {} @@ -105,18 +97,12 @@ fn F(unused i: Test.ForwardWithDef) {} impl package Test library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_todo_forward.impl.carbon:[[@LINE+7]]:16: error: name `Forward` not found [NameNotFound] -// CHECK:STDERR: fn F(unused i: Forward*) {} -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_todo_forward.impl.carbon:[[@LINE+3]]:16-22: error: name `Forward` not found [NameNotFound] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_forward.impl.carbon:[[@LINE+3]]:16: error: name `Forward` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: fn F(unused i: Forward*) {} -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_todo_forward.impl.carbon:[[@LINE+1]]:16-22: error: name `Forward` used before it was declared [NameUseBeforeDecl] fn F(unused i: Forward*) {} -// CHECK:STDERR: fail_todo_forward.impl.carbon:[[@LINE+4]]:11: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: interface Forward {} -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_todo_forward.impl.carbon:[[@LINE+2]]:11-17: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: interface Forward {} @@ -126,9 +112,7 @@ package Test library "[[@TEST_NAME]]"; import library "forward"; -// CHECK:STDERR: fail_local_forward.carbon:[[@LINE+4]]:16: error: name `Forward` not found [NameNotFound] -// CHECK:STDERR: fn F(unused i: Forward*) {} -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_local_forward.carbon:[[@LINE+2]]:16-22: error: name `Forward` not found [NameNotFound] // CHECK:STDERR: fn F(unused i: Forward*) {} @@ -138,9 +122,7 @@ package Other library "[[@TEST_NAME]]"; import Test library "forward"; -// CHECK:STDERR: fail_other_forward.carbon:[[@LINE+4]]:16: error: name `Forward` not found [NameNotFound] -// CHECK:STDERR: fn F(unused i: Forward*) {} -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_other_forward.carbon:[[@LINE+2]]:16-22: error: name `Forward` not found [NameNotFound] // CHECK:STDERR: fn F(unused i: Forward*) {} @@ -477,7 +459,7 @@ private interface Redecl {} // CHECK:STDOUT: %i.patt: = wrapper_binding_pattern i, %i.param_patt [concrete = ] // CHECK:STDOUT: } { // CHECK:STDOUT: %i.param: = value_param call_param0 -// CHECK:STDOUT: %.loc11: type = splice_block %ptr [concrete = ] { +// CHECK:STDOUT: %.loc7: type = splice_block %ptr [concrete = ] { // CHECK:STDOUT: %Forward.ref: = name_ref Forward, [concrete = ] // CHECK:STDOUT: %ptr: type = ptr_type [concrete = ] // CHECK:STDOUT: } @@ -523,7 +505,7 @@ private interface Redecl {} // CHECK:STDOUT: %i.patt: = wrapper_binding_pattern i, %i.param_patt [concrete = ] // CHECK:STDOUT: } { // CHECK:STDOUT: %i.param: = value_param call_param0 -// CHECK:STDOUT: %.loc10: type = splice_block %ptr [concrete = ] { +// CHECK:STDOUT: %.loc8: type = splice_block %ptr [concrete = ] { // CHECK:STDOUT: %Forward.ref: = name_ref Forward, [concrete = ] // CHECK:STDOUT: %ptr: type = ptr_type [concrete = ] // CHECK:STDOUT: } @@ -562,7 +544,7 @@ private interface Redecl {} // CHECK:STDOUT: %i.patt: = wrapper_binding_pattern i, %i.param_patt [concrete = ] // CHECK:STDOUT: } { // CHECK:STDOUT: %i.param: = value_param call_param0 -// CHECK:STDOUT: %.loc10: type = splice_block %ptr [concrete = ] { +// CHECK:STDOUT: %.loc8: type = splice_block %ptr [concrete = ] { // CHECK:STDOUT: %Forward.ref: = name_ref Forward, [concrete = ] // CHECK:STDOUT: %ptr: type = ptr_type [concrete = ] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/interface/import_interface_decl.carbon b/toolchain/check/testdata/interface/import_interface_decl.carbon index 72b6d351dc6b..270be01c38e8 100644 --- a/toolchain/check/testdata/interface/import_interface_decl.carbon +++ b/toolchain/check/testdata/interface/import_interface_decl.carbon @@ -21,9 +21,7 @@ impl library "[[@TEST_NAME]]"; // --- fail_b.carbon library "[[@TEST_NAME]]"; interface B {} -// CHECK:STDERR: fail_b.carbon:[[@LINE+4]]:1: error: impl declared but not defined [ImplMissingDefinition] -// CHECK:STDERR: impl () as B; -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_b.carbon:[[@LINE+2]]:1-13: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl () as B; @@ -57,8 +55,8 @@ impl library "[[@TEST_NAME]]"; // CHECK:STDOUT: imports { // CHECK:STDOUT: %Main.B = import_ref Main//b, B, unloaded // CHECK:STDOUT: %Main.import_ref.c07 = import_ref Main//b, loc2_13, unloaded -// CHECK:STDOUT: %Main.import_ref.e5c: type = import_ref Main//b, loc7_7, loaded [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %Main.import_ref.21a: type = import_ref Main//b, loc7_12, loaded [concrete = constants.%B.type] +// CHECK:STDOUT: %Main.import_ref.e5c: type = import_ref Main//b, loc5_7, loaded [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %Main.import_ref.21a: type = import_ref Main//b, loc5_12, loaded [concrete = constants.%B.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { diff --git a/toolchain/check/testdata/interface/incomplete.carbon b/toolchain/check/testdata/interface/incomplete.carbon index 4d6747c811f3..bbace1a870a8 100644 --- a/toolchain/check/testdata/interface/incomplete.carbon +++ b/toolchain/check/testdata/interface/incomplete.carbon @@ -30,12 +30,8 @@ interface I { let T: C; } -// CHECK:STDERR: fail_incomplete_type_impl.carbon:[[@LINE+7]]:26: error: invalid use of incomplete type `C` [IncompleteTypeInConversion] -// CHECK:STDERR: impl {} as I where .T = ({} as C) {} -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_incomplete_type_impl.carbon:[[@LINE-9]]:1: note: class was forward declared here [ClassForwardDeclaredHere] -// CHECK:STDERR: class C; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_incomplete_type_impl.carbon:[[@LINE+3]]:26-32: error: invalid use of incomplete type `C` [IncompleteTypeInConversion] +// CHECK:STDERR: fail_incomplete_type_impl.carbon:[[@LINE-7]]:1-8: note: class was forward declared here [ClassForwardDeclaredHere] // CHECK:STDERR: impl {} as I where .T = ({} as C) {} @@ -59,12 +55,8 @@ library "[[@TEST_NAME]]"; constraint A; interface B { - // CHECK:STDERR: fail_incomplete_extend_constraint.carbon:[[@LINE+7]]:24: error: facet type `A` cannot be identified in `require` declaration [RequireImplsUnidentifiedFacetType] - // CHECK:STDERR: extend require impls A; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_incomplete_extend_constraint.carbon:[[@LINE-6]]:1: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere] - // CHECK:STDERR: constraint A; - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_incomplete_extend_constraint.carbon:[[@LINE+3]]:24: error: facet type `A` cannot be identified in `require` declaration [RequireImplsUnidentifiedFacetType] + // CHECK:STDERR: fail_incomplete_extend_constraint.carbon:[[@LINE-4]]:1-13: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere] // CHECK:STDERR: extend require impls A; } @@ -73,12 +65,8 @@ interface B { library "[[@TEST_NAME]]"; interface A { - // CHECK:STDERR: fail_extend_require_enclosing.carbon:[[@LINE+7]]:24: error: `extend require` of incomplete facet type `A` [RequireImplsIncompleteFacetType] - // CHECK:STDERR: extend require impls A; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_extend_require_enclosing.carbon:[[@LINE-4]]:1: note: interface is currently being defined [InterfaceIncompleteWithinDefinition] - // CHECK:STDERR: interface A { - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_extend_require_enclosing.carbon:[[@LINE+3]]:24: error: `extend require` of incomplete facet type `A` [RequireImplsIncompleteFacetType] + // CHECK:STDERR: fail_extend_require_enclosing.carbon:[[@LINE-2]]:1-13: note: interface is currently being defined [InterfaceIncompleteWithinDefinition] // CHECK:STDERR: extend require impls A; } @@ -87,12 +75,8 @@ interface A { library "[[@TEST_NAME]]"; interface A(T: type) { - // CHECK:STDERR: fail_extend_require_enclosing_generic.carbon:[[@LINE+7]]:24: error: `extend require` of incomplete facet type `A({})` [RequireImplsIncompleteFacetType] - // CHECK:STDERR: extend require impls A({}); - // CHECK:STDERR: ^~~~~ - // CHECK:STDERR: fail_extend_require_enclosing_generic.carbon:[[@LINE-4]]:1: note: interface is currently being defined [InterfaceIncompleteWithinDefinition] - // CHECK:STDERR: interface A(T: type) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_extend_require_enclosing_generic.carbon:[[@LINE+3]]:24-28: error: `extend require` of incomplete facet type `A({})` [RequireImplsIncompleteFacetType] + // CHECK:STDERR: fail_extend_require_enclosing_generic.carbon:[[@LINE-2]]:1-22: note: interface is currently being defined [InterfaceIncompleteWithinDefinition] // CHECK:STDERR: extend require impls A({}); } @@ -168,24 +152,24 @@ interface A(T: type) { // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {} // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {} // CHECK:STDOUT: impl_decl @empty_struct_type.as..impl [concrete] {} { -// CHECK:STDOUT: %.loc16_7.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc16_7.2: type = converted %.loc16_7.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc12_7.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc12_7.2: type = converted %.loc12_7.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: %.Self.frozen: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc16_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc12_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %T.ref: %I.assoc_type = name_ref T, @T.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc16_20.1: %C = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.419] -// CHECK:STDOUT: %.loc16_27: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %impl.elem0.loc12_20.1: %C = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.419] +// CHECK:STDOUT: %.loc12_27: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %rewrite.loc16_23.1 = requirement_rewrite %impl.elem0.loc16_20.1, [concrete] -// CHECK:STDOUT: %impl.elem0.loc16_20.2: %C = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.adf] -// CHECK:STDOUT: %rewrite.loc16_23.2 = requirement_rewrite %impl.elem0.loc16_20.2, [concrete] -// CHECK:STDOUT: %.loc16_14: type = where_expr [concrete = ] { +// CHECK:STDOUT: %rewrite.loc12_23.1 = requirement_rewrite %impl.elem0.loc12_20.1, [concrete] +// CHECK:STDOUT: %impl.elem0.loc12_20.2: %C = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.adf] +// CHECK:STDOUT: %rewrite.loc12_23.2 = requirement_rewrite %impl.elem0.loc12_20.2, [concrete] +// CHECK:STDOUT: %.loc12_14: type = where_expr [concrete = ] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %rewrite.loc16_23.2 = requirement_rewrite %impl.elem0.loc16_20.2, [concrete] +// CHECK:STDOUT: %rewrite.loc12_23.2 = requirement_rewrite %impl.elem0.loc12_20.2, [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -209,7 +193,7 @@ interface A(T: type) { // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_struct_type.as..impl: %.loc16_7.2 as { +// CHECK:STDOUT: impl @empty_struct_type.as..impl: %.loc12_7.2 as { // CHECK:STDOUT: !members: // CHECK:STDOUT: extend // CHECK:STDOUT: witness = @@ -395,9 +379,9 @@ interface A(T: type) { // CHECK:STDOUT: // CHECK:STDOUT: !with Self: // CHECK:STDOUT: %A.WithSelf.Self.as_type.impls.A.type.require.decl = require_decl @A.WithSelf.Self.as_type.impls.A.type.require [concrete] { -// CHECK:STDOUT: require %Self.as_type.loc11_18.1 impls %A.ref +// CHECK:STDOUT: require %Self.as_type.loc7_18.1 impls %A.ref // CHECK:STDOUT: } { -// CHECK:STDOUT: %Self.as_type.loc11_18.1: type = facet_access_type @A.%Self [symbolic = %Self.as_type.loc11_18.2 (constants.%Self.as_type)] +// CHECK:STDOUT: %Self.as_type.loc7_18.1: type = facet_access_type @A.%Self [symbolic = %Self.as_type.loc7_18.2 (constants.%Self.as_type)] // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A.type] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -412,14 +396,14 @@ interface A(T: type) { // CHECK:STDOUT: // CHECK:STDOUT: generic require @A.WithSelf.Self.as_type.impls.A.type.require(@A.%Self: %A.type) { // CHECK:STDOUT: %Self: %A.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc11_18.2: type = facet_access_type %Self [symbolic = %Self.as_type.loc11_18.2 (constants.%Self.as_type)] +// CHECK:STDOUT: %Self.as_type.loc7_18.2: type = facet_access_type %Self [symbolic = %Self.as_type.loc7_18.2 (constants.%Self.as_type)] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @A.WithSelf(constants.%Self) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @A.WithSelf.Self.as_type.impls.A.type.require(constants.%Self) { // CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.as_type.loc11_18.2 => constants.%Self.as_type +// CHECK:STDOUT: %Self.as_type.loc7_18.2 => constants.%Self.as_type // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_extend_require_enclosing_generic.carbon @@ -469,13 +453,13 @@ interface A(T: type) { // CHECK:STDOUT: // CHECK:STDOUT: !with Self: // CHECK:STDOUT: %A.WithSelf.Self.as_type.impls.A.type.require.decl = require_decl @A.WithSelf.Self.as_type.impls.A.type.require [concrete] { -// CHECK:STDOUT: require %Self.as_type.loc11_18.1 impls %A.type.loc11_28 +// CHECK:STDOUT: require %Self.as_type.loc7_18.1 impls %A.type.loc7_28 // CHECK:STDOUT: } { -// CHECK:STDOUT: %Self.as_type.loc11_18.1: type = facet_access_type @A.%Self.loc3_22.1 [symbolic = %Self.as_type.loc11_18.2 (constants.%Self.as_type)] +// CHECK:STDOUT: %Self.as_type.loc7_18.1: type = facet_access_type @A.%Self.loc3_22.1 [symbolic = %Self.as_type.loc7_18.2 (constants.%Self.as_type)] // CHECK:STDOUT: %A.ref: %A.type.55a = name_ref A, file.%A.decl [concrete = constants.%A.generic] -// CHECK:STDOUT: %.loc11_27: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc11_28: type = converted %.loc11_27, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %A.type.loc11_28: type = facet_type <@A, @A(constants.%empty_struct_type)> [concrete = constants.%A.type.ae6] +// CHECK:STDOUT: %.loc7_27: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc7_28: type = converted %.loc7_27, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %A.type.loc7_28: type = facet_type <@A, @A(constants.%empty_struct_type)> [concrete = constants.%A.type.ae6] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -490,9 +474,9 @@ interface A(T: type) { // CHECK:STDOUT: // CHECK:STDOUT: generic require @A.WithSelf.Self.as_type.impls.A.type.require(@A.%T.loc3_14.2: type, @A.%Self.loc3_22.1: @A.%A.type (%A.type.fa0)) { // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic = %T (constants.%T)] -// CHECK:STDOUT: %A.type.loc11_18: type = facet_type <@A, @A(%T)> [symbolic = %A.type.loc11_18 (constants.%A.type.fa0)] -// CHECK:STDOUT: %Self: @A.WithSelf.Self.as_type.impls.A.type.require.%A.type.loc11_18 (%A.type.fa0) = symbolic_binding Self, 1 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc11_18.2: type = facet_access_type %Self [symbolic = %Self.as_type.loc11_18.2 (constants.%Self.as_type)] +// CHECK:STDOUT: %A.type.loc7_18: type = facet_type <@A, @A(%T)> [symbolic = %A.type.loc7_18 (constants.%A.type.fa0)] +// CHECK:STDOUT: %Self: @A.WithSelf.Self.as_type.impls.A.type.require.%A.type.loc7_18 (%A.type.fa0) = symbolic_binding Self, 1 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc7_18.2: type = facet_access_type %Self [symbolic = %Self.as_type.loc7_18.2 (constants.%Self.as_type)] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @A(constants.%T) { @@ -509,8 +493,8 @@ interface A(T: type) { // CHECK:STDOUT: // CHECK:STDOUT: specific @A.WithSelf.Self.as_type.impls.A.type.require(constants.%T, constants.%Self) { // CHECK:STDOUT: %T => constants.%T -// CHECK:STDOUT: %A.type.loc11_18 => constants.%A.type.fa0 +// CHECK:STDOUT: %A.type.loc7_18 => constants.%A.type.fa0 // CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.as_type.loc11_18.2 => constants.%Self.as_type +// CHECK:STDOUT: %Self.as_type.loc7_18.2 => constants.%Self.as_type // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/member_lookup.carbon b/toolchain/check/testdata/interface/member_lookup.carbon index 468384a6b4c2..59e58c898976 100644 --- a/toolchain/check/testdata/interface/member_lookup.carbon +++ b/toolchain/check/testdata/interface/member_lookup.carbon @@ -37,17 +37,13 @@ interface Interface(T: type) { } fn AccessMissingGeneric[T: type](generic I: Interface(T)) -> T { - // CHECK:STDERR: fail_no_member.carbon:[[@LINE+4]]:10: error: member name `nonesuch` not found in `Interface(T)` [MemberNameNotFoundInSpecificScope] - // CHECK:STDERR: return I.nonesuch; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_no_member.carbon:[[@LINE+2]]:10-19: error: member name `nonesuch` not found in `Interface(T)` [MemberNameNotFoundInSpecificScope] // CHECK:STDERR: return I.nonesuch; } fn AccessMissingConcrete(generic I: Interface(i32)) -> i32 { - // CHECK:STDERR: fail_no_member.carbon:[[@LINE+4]]:10: error: member name `nonesuch` not found in `Interface(i32)` [MemberNameNotFoundInSpecificScope] - // CHECK:STDERR: return I.nonesuch; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_no_member.carbon:[[@LINE+2]]:10-19: error: member name `nonesuch` not found in `Interface(i32)` [MemberNameNotFoundInSpecificScope] // CHECK:STDERR: return I.nonesuch; } @@ -475,19 +471,19 @@ fn AccessMissingConcrete(generic I: Interface(i32)) -> i32 { // CHECK:STDOUT: %return: ref @AccessMissingGeneric.%T.loc8_26.1 (%T) = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %AccessMissingConcrete.decl: %AccessMissingConcrete.type = fn_decl @AccessMissingConcrete [concrete = constants.%AccessMissingConcrete] { -// CHECK:STDOUT: %I.patt.loc16_35.1: %pattern_type.5c6 = symbolic_binding_pattern I, 0 [symbolic = %I.patt.loc16_35.2 (constants.%I.patt.e71)] +// CHECK:STDOUT: %I.patt.loc14_35.1: %pattern_type.5c6 = symbolic_binding_pattern I, 0 [symbolic = %I.patt.loc14_35.2 (constants.%I.patt.e71)] // CHECK:STDOUT: %return.param_patt: %pattern_type.d94 = out_param_pattern [concrete = constants.%return.param_patt.299] -// CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32.loc16_56 [concrete = constants.%return.patt.6fa] +// CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32.loc14_56 [concrete = constants.%return.patt.6fa] // CHECK:STDOUT: } { -// CHECK:STDOUT: %i32.loc16_56: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc16_56: Core.Form = init_form %i32.loc16_56 [concrete = constants.%.0b3] -// CHECK:STDOUT: %.loc16_50: type = splice_block %Interface.type [concrete = constants.%Interface.type.5ec] { +// CHECK:STDOUT: %i32.loc14_56: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc14_56: Core.Form = init_form %i32.loc14_56 [concrete = constants.%.0b3] +// CHECK:STDOUT: %.loc14_50: type = splice_block %Interface.type [concrete = constants.%Interface.type.5ec] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %Interface.ref: %Interface.type.1b1 = name_ref Interface, file.%Interface.decl [concrete = constants.%Interface.generic] -// CHECK:STDOUT: %i32.loc16_47: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc14_47: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %Interface.type: type = facet_type <@Interface, @Interface(constants.%i32)> [concrete = constants.%Interface.type.5ec] // CHECK:STDOUT: } -// CHECK:STDOUT: %I.loc16_35.2: %Interface.type.5ec = symbolic_binding I, 0 [symbolic = %I.loc16_35.1 (constants.%I.eef)] +// CHECK:STDOUT: %I.loc14_35.2: %Interface.type.5ec = symbolic_binding I, 0 [symbolic = %I.loc14_35.1 (constants.%I.eef)] // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param0 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } @@ -536,31 +532,31 @@ fn AccessMissingConcrete(generic I: Interface(i32)) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete.loc8: = require_complete_type %T.loc8_26.1 [symbolic = %require_complete.loc8 (constants.%require_complete.944)] -// CHECK:STDOUT: %require_complete.loc13: = require_complete_type %Interface.type.loc8_56.1 [symbolic = %require_complete.loc13 (constants.%require_complete.e4d)] -// CHECK:STDOUT: %I.as_type.loc13_11.2: type = facet_access_type %I.loc8_43.1 [symbolic = %I.as_type.loc13_11.2 (constants.%I.as_type.c4b)] +// CHECK:STDOUT: %require_complete.loc11: = require_complete_type %Interface.type.loc8_56.1 [symbolic = %require_complete.loc11 (constants.%require_complete.e4d)] +// CHECK:STDOUT: %I.as_type.loc11_11.2: type = facet_access_type %I.loc8_43.1 [symbolic = %I.as_type.loc11_11.2 (constants.%I.as_type.c4b)] // CHECK:STDOUT: // CHECK:STDOUT: fn() -> out %return.param: @AccessMissingGeneric.%T.loc8_26.1 (%T) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %I.ref: @AccessMissingGeneric.%Interface.type.loc8_56.1 (%Interface.type.128) = name_ref I, %I.loc8_43.2 [symbolic = %I.loc8_43.1 (constants.%I.165)] -// CHECK:STDOUT: %I.as_type.loc13_11.1: type = facet_access_type %I.ref [symbolic = %I.as_type.loc13_11.2 (constants.%I.as_type.c4b)] -// CHECK:STDOUT: %.loc13: type = converted %I.ref, %I.as_type.loc13_11.1 [symbolic = %I.as_type.loc13_11.2 (constants.%I.as_type.c4b)] +// CHECK:STDOUT: %I.as_type.loc11_11.1: type = facet_access_type %I.ref [symbolic = %I.as_type.loc11_11.2 (constants.%I.as_type.c4b)] +// CHECK:STDOUT: %.loc11: type = converted %I.ref, %I.as_type.loc11_11.1 [symbolic = %I.as_type.loc11_11.2 (constants.%I.as_type.c4b)] // CHECK:STDOUT: %nonesuch.ref: = name_ref nonesuch, [concrete = ] // CHECK:STDOUT: return to %return.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @AccessMissingConcrete(%I.loc16_35.2: %Interface.type.5ec) { -// CHECK:STDOUT: %I.patt.loc16_35.2: %pattern_type.5c6 = symbolic_binding_pattern I, 0 [symbolic = %I.patt.loc16_35.2 (constants.%I.patt.e71)] -// CHECK:STDOUT: %I.loc16_35.1: %Interface.type.5ec = symbolic_binding I, 0 [symbolic = %I.loc16_35.1 (constants.%I.eef)] +// CHECK:STDOUT: generic fn @AccessMissingConcrete(%I.loc14_35.2: %Interface.type.5ec) { +// CHECK:STDOUT: %I.patt.loc14_35.2: %pattern_type.5c6 = symbolic_binding_pattern I, 0 [symbolic = %I.patt.loc14_35.2 (constants.%I.patt.e71)] +// CHECK:STDOUT: %I.loc14_35.1: %Interface.type.5ec = symbolic_binding I, 0 [symbolic = %I.loc14_35.1 (constants.%I.eef)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %I.as_type.loc21_11.2: type = facet_access_type %I.loc16_35.1 [symbolic = %I.as_type.loc21_11.2 (constants.%I.as_type.bed)] +// CHECK:STDOUT: %I.as_type.loc17_11.2: type = facet_access_type %I.loc14_35.1 [symbolic = %I.as_type.loc17_11.2 (constants.%I.as_type.bed)] // CHECK:STDOUT: // CHECK:STDOUT: fn() -> out %return.param: %i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %I.ref: %Interface.type.5ec = name_ref I, %I.loc16_35.2 [symbolic = %I.loc16_35.1 (constants.%I.eef)] -// CHECK:STDOUT: %I.as_type.loc21_11.1: type = facet_access_type %I.ref [symbolic = %I.as_type.loc21_11.2 (constants.%I.as_type.bed)] -// CHECK:STDOUT: %.loc21: type = converted %I.ref, %I.as_type.loc21_11.1 [symbolic = %I.as_type.loc21_11.2 (constants.%I.as_type.bed)] +// CHECK:STDOUT: %I.ref: %Interface.type.5ec = name_ref I, %I.loc14_35.2 [symbolic = %I.loc14_35.1 (constants.%I.eef)] +// CHECK:STDOUT: %I.as_type.loc17_11.1: type = facet_access_type %I.ref [symbolic = %I.as_type.loc17_11.2 (constants.%I.as_type.bed)] +// CHECK:STDOUT: %.loc17: type = converted %I.ref, %I.as_type.loc17_11.1 [symbolic = %I.as_type.loc17_11.2 (constants.%I.as_type.bed)] // CHECK:STDOUT: %nonesuch.ref: = name_ref nonesuch, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -614,8 +610,8 @@ fn AccessMissingConcrete(generic I: Interface(i32)) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @AccessMissingConcrete(constants.%I.eef) { -// CHECK:STDOUT: %I.patt.loc16_35.2 => constants.%I.patt.e71 -// CHECK:STDOUT: %I.loc16_35.1 => constants.%I.eef +// CHECK:STDOUT: %I.patt.loc14_35.2 => constants.%I.patt.e71 +// CHECK:STDOUT: %I.loc14_35.1 => constants.%I.eef // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Interface.WithSelf(constants.%i32, constants.%Self.5b9) { diff --git a/toolchain/check/testdata/interface/modifiers.carbon b/toolchain/check/testdata/interface/modifiers.carbon index 20e076bc2ef8..8f582d33f4b0 100644 --- a/toolchain/check/testdata/interface/modifiers.carbon +++ b/toolchain/check/testdata/interface/modifiers.carbon @@ -165,25 +165,17 @@ interface I { library "[[@TEST_NAME]]"; interface Modifiers { - // CHECK:STDERR: fail_todo_deferred_modifiers.carbon:[[@LINE+4]]:3: error: TODO: `default` modifier currently requires an inline definition [ModifierFinalRequiresDefaultImpl] - // CHECK:STDERR: default fn DefaultFunction(); - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_todo_deferred_modifiers.carbon:[[@LINE+2]]:3-9: error: TODO: `default` modifier currently requires an inline definition [ModifierFinalRequiresDefaultImpl] // CHECK:STDERR: default fn DefaultFunction(); - // CHECK:STDERR: fail_todo_deferred_modifiers.carbon:[[@LINE+4]]:3: error: TODO: `default` modifier currently requires an inline definition [ModifierFinalRequiresDefaultImpl] - // CHECK:STDERR: default fn DefaultMethod(self); - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_todo_deferred_modifiers.carbon:[[@LINE+2]]:3-9: error: TODO: `default` modifier currently requires an inline definition [ModifierFinalRequiresDefaultImpl] // CHECK:STDERR: default fn DefaultMethod(self); - // CHECK:STDERR: fail_todo_deferred_modifiers.carbon:[[@LINE+4]]:3: error: TODO: `final` modifier currently requires an inline definition [ModifierFinalRequiresDefaultImpl] - // CHECK:STDERR: final fn FinalFunction(); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_todo_deferred_modifiers.carbon:[[@LINE+2]]:3-7: error: TODO: `final` modifier currently requires an inline definition [ModifierFinalRequiresDefaultImpl] // CHECK:STDERR: final fn FinalFunction(); - // CHECK:STDERR: fail_todo_deferred_modifiers.carbon:[[@LINE+4]]:3: error: TODO: `final` modifier currently requires an inline definition [ModifierFinalRequiresDefaultImpl] - // CHECK:STDERR: final fn FinalMethod(self); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_todo_deferred_modifiers.carbon:[[@LINE+2]]:3-7: error: TODO: `final` modifier currently requires an inline definition [ModifierFinalRequiresDefaultImpl] // CHECK:STDERR: final fn FinalMethod(self); } @@ -194,13 +186,9 @@ library "[[@TEST_NAME]]"; import library "final_interfaces"; class C { - // CHECK:STDERR: fail_impl_final.carbon:[[@LINE+8]]:3: error: attempted to implement `M`, which is final in interface `FinalMethod` [ImplFinalFunction] - // CHECK:STDERR: impl as FinalMethod { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_final.carbon:[[@LINE-6]]:1: in import [InImport] - // CHECK:STDERR: final_interfaces.carbon:10:3: note: associated function M declared here [AssociatedFunctionHere] - // CHECK:STDERR: final fn M(unused self) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_impl_final.carbon:[[@LINE+4]]:3-23: error: attempted to implement `M`, which is final in interface `FinalMethod` [ImplFinalFunction] + // CHECK:STDERR: imported from: fail_impl_final.carbon:[[@LINE-4]]:1 [InImport] + // CHECK:STDERR: final_interfaces.carbon:10:3-27: note: associated function M declared here [AssociatedFunctionHere] // CHECK:STDERR: impl as FinalMethod { fn M(unused self) { } @@ -212,14 +200,10 @@ class C { library "[[@TEST_NAME]]"; interface C { - // CHECK:STDERR: fail_modified_associated_constants.carbon:[[@LINE+4]]:3: error: semantics TODO: `interface modifier` [SemanticsTodo] - // CHECK:STDERR: default let T: type = C; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_modified_associated_constants.carbon:[[@LINE+2]]:3-9: error: semantics TODO: `interface modifier` [SemanticsTodo] // CHECK:STDERR: default let T: type = C; - // CHECK:STDERR: fail_modified_associated_constants.carbon:[[@LINE+4]]:3: error: semantics TODO: `interface modifier` [SemanticsTodo] - // CHECK:STDERR: final let U: type = C; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_modified_associated_constants.carbon:[[@LINE+2]]:3-7: error: semantics TODO: `interface modifier` [SemanticsTodo] // CHECK:STDERR: final let U: type = C; } diff --git a/toolchain/check/testdata/interface/name_poisoning.carbon b/toolchain/check/testdata/interface/name_poisoning.carbon index 3081933dcb79..8796548c7b11 100644 --- a/toolchain/check/testdata/interface/name_poisoning.carbon +++ b/toolchain/check/testdata/interface/name_poisoning.carbon @@ -44,15 +44,11 @@ interface I; namespace N; // Use `package.I` and poison `N.I`. -// CHECK:STDERR: fail_declare_after_poison.carbon:[[@LINE+3]]:19: error: name `I` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: fn N.F(generic x: I); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_declare_after_poison.carbon:[[@LINE+1]]:19: error: name `I` used before it was declared [NameUseBeforeDecl] fn N.F(generic x: I); // Failure: N.I declared after it was poisoned. -// CHECK:STDERR: fail_declare_after_poison.carbon:[[@LINE+4]]:13: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: interface N.I {} -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_declare_after_poison.carbon:[[@LINE+2]]:13: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: interface N.I {} @@ -66,9 +62,7 @@ namespace N; // Use `package.I` and poison `N.I`. fn N.F1(generic x: I); -// CHECK:STDERR: fail_use_poison.carbon:[[@LINE+4]]:20: error: member name `I` not found in `N` [MemberNameNotFoundInInstScope] -// CHECK:STDERR: fn N.F2(generic x: N.I); -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_use_poison.carbon:[[@LINE+2]]:20-22: error: member name `I` not found in `N` [MemberNameNotFoundInInstScope] // CHECK:STDERR: fn N.F2(generic x: N.I); @@ -80,20 +74,14 @@ interface I; namespace N; // Use `package.I` and poison `N.I`. -// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+3]]:20: error: name `I` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: fn N.F1(generic x: I); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+1]]:20: error: name `I` used before it was declared [NameUseBeforeDecl] fn N.F1(generic x: I); -// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+4]]:13: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: interface N.I; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+2]]:13: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: interface N.I; -// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+4]]:20: error: member name `I` not found in `N` [MemberNameNotFoundInInstScope] -// CHECK:STDERR: fn N.F2(generic x: N.I); -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+2]]:20-22: error: member name `I` not found in `N` [MemberNameNotFoundInInstScope] // CHECK:STDERR: fn N.F2(generic x: N.I); @@ -104,12 +92,8 @@ library "[[@TEST_NAME]]"; interface I; namespace N; -// CHECK:STDERR: fail_alias.carbon:[[@LINE+7]]:13: error: name `I` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: alias N.I = I; -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_alias.carbon:[[@LINE+4]]:9: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: alias N.I = I; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_alias.carbon:[[@LINE+3]]:13: error: name `I` used before it was declared [NameUseBeforeDecl] +// CHECK:STDERR: fail_alias.carbon:[[@LINE+2]]:9: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: alias N.I = I; @@ -126,32 +110,20 @@ interface I2 { // * `I2.I1` // * `I2.I3.I1` // * `I2.I3.I4.I1` - // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+3]]:23: error: name `I1` used before it was declared [NameUseBeforeDecl] - // CHECK:STDERR: fn F(generic x: I1); - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+1]]:23-24: error: name `I1` used before it was declared [NameUseBeforeDecl] fn F(generic x: I1); - // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+7]]:17: note: declared here [NameUseBeforeDeclNote] - // CHECK:STDERR: interface I1; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+3]]:17-18: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: - // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE-6]]:23: error: name `I1` used before it was declared [NameUseBeforeDecl] - // CHECK:STDERR: fn F(generic x: I1); - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE-4]]:23-24: error: name `I1` used before it was declared [NameUseBeforeDecl] interface I1; } - // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+7]]:15: note: declared here [NameUseBeforeDeclNote] - // CHECK:STDERR: interface I1; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+3]]:15-16: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: - // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE-15]]:23: error: name `I1` used before it was declared [NameUseBeforeDecl] - // CHECK:STDERR: fn F(generic x: I1); - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE-9]]:23-24: error: name `I1` used before it was declared [NameUseBeforeDecl] interface I1; } - // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+4]]:13: note: declared here [NameUseBeforeDeclNote] - // CHECK:STDERR: interface I1; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+2]]:13-14: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: interface I1; } @@ -177,27 +149,17 @@ library "[[@TEST_NAME]]"; namespace N; // `package.I` and `N.I` poisoned when not found. -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+7]]:19: error: name `I` not found [NameNotFound] -// CHECK:STDERR: fn N.F(generic x: I); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+3]]:19: error: name `I` not found [NameNotFound] // CHECK:STDERR: -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+3]]:19: error: name `I` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: fn N.F(generic x: I); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+1]]:19: error: name `I` used before it was declared [NameUseBeforeDecl] fn N.F(generic x: I); // TODO: We should ideally only produce one diagnostic here. -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+7]]:11: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: interface I; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+3]]:11: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE-7]]:19: error: name `I` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: fn N.F(generic x: I); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE-5]]:19: error: name `I` used before it was declared [NameUseBeforeDecl] interface I; -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+4]]:13: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: interface N.I; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+2]]:13: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: interface N.I; @@ -209,14 +171,10 @@ fn F() { interface I1 {} class C { - // CHECK:STDERR: fail_poison_with_lexical_result.carbon:[[@LINE+3]]:12: error: name `I1` used before it was declared [NameUseBeforeDecl] - // CHECK:STDERR: var v: I1; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_poison_with_lexical_result.carbon:[[@LINE+1]]:12-13: error: name `I1` used before it was declared [NameUseBeforeDecl] var v: I1; - // CHECK:STDERR: fail_poison_with_lexical_result.carbon:[[@LINE+4]]:15: note: declared here [NameUseBeforeDeclNote] - // CHECK:STDERR: interface I1; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_poison_with_lexical_result.carbon:[[@LINE+2]]:15-16: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: interface I1; } diff --git a/toolchain/check/testdata/interface/no_definition_in_impl_file.carbon b/toolchain/check/testdata/interface/no_definition_in_impl_file.carbon index 3a57a8517ea3..c24d89fbc561 100644 --- a/toolchain/check/testdata/interface/no_definition_in_impl_file.carbon +++ b/toolchain/check/testdata/interface/no_definition_in_impl_file.carbon @@ -52,17 +52,11 @@ interface C; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+12]]:1: error: redeclaration of `interface C` is redundant [RedeclRedundant] -// CHECK:STDERR: interface C; -// CHECK:STDERR: ^~~~~~~~~~~~ -// CHECK:STDERR: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: decl_in_api_decl_in_impl.carbon:4:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: interface C; -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+6]]:1-12: error: redeclaration of `interface C` is redundant [RedeclRedundant] +// CHECK:STDERR: imported from: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: decl_in_api_decl_in_impl.carbon:4:1-12: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: -// CHECK:STDERR: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+4]]:1: error: no definition found for declaration in impl file [MissingDefinitionInImpl] -// CHECK:STDERR: interface C; -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+2]]:1-12: error: no definition found for declaration in impl file [MissingDefinitionInImpl] // CHECK:STDERR: interface C; @@ -76,13 +70,9 @@ interface D; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_decl_in_api_decl_and_definition_in_impl.impl.carbon:[[@LINE+8]]:1: error: redeclaration of `interface D` is redundant [RedeclRedundant] -// CHECK:STDERR: interface D; -// CHECK:STDERR: ^~~~~~~~~~~~ -// CHECK:STDERR: fail_decl_in_api_decl_and_definition_in_impl.impl.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: decl_in_api_decl_and_definition_in_impl.carbon:4:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: interface D; -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_decl_in_api_decl_and_definition_in_impl.impl.carbon:[[@LINE+4]]:1-12: error: redeclaration of `interface D` is redundant [RedeclRedundant] +// CHECK:STDERR: imported from: fail_decl_in_api_decl_and_definition_in_impl.impl.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: decl_in_api_decl_and_definition_in_impl.carbon:4:1-12: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: interface D; @@ -96,8 +86,6 @@ library "[[@TEST_NAME]]"; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_decl_only_in_impl.impl.carbon:[[@LINE+4]]:1: error: no definition found for declaration in impl file [MissingDefinitionInImpl] -// CHECK:STDERR: interface E; -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_decl_only_in_impl.impl.carbon:[[@LINE+2]]:1-12: error: no definition found for declaration in impl file [MissingDefinitionInImpl] // CHECK:STDERR: interface E; diff --git a/toolchain/check/testdata/interface/observe.carbon b/toolchain/check/testdata/interface/observe.carbon index 090dac3929d9..1d5c394815b4 100644 --- a/toolchain/check/testdata/interface/observe.carbon +++ b/toolchain/check/testdata/interface/observe.carbon @@ -38,31 +38,19 @@ import library "transitive"; fn F[T: Transitive](t: T) { var a: T.A = t.GetA(); - // CHECK:STDERR: fail_todo_equivalent.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `T.(Transitive.A)` to `T.(Transitive.B)` [ConversionFailure] - // CHECK:STDERR: var b: T.B = a; - // CHECK:STDERR: ^~~~~~~~~~ - // CHECK:STDERR: fail_todo_equivalent.carbon:[[@LINE+4]]:3: note: type `T.(Transitive.A)` does not implement interface `Core.ImplicitAs(T.(Transitive.B))` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var b: T.B = a; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_todo_equivalent.carbon:[[@LINE+3]]:3-12: error: cannot implicitly convert expression of type `T.(Transitive.A)` to `T.(Transitive.B)` [ConversionFailure] + // CHECK:STDERR: fail_todo_equivalent.carbon:[[@LINE+2]]:3-12: note: type `T.(Transitive.A)` does not implement interface `Core.ImplicitAs(T.(Transitive.B))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var b: T.B = a; b.InQ(); - // CHECK:STDERR: fail_todo_equivalent.carbon:[[@LINE+8]]:3: error: cannot convert type `T.(Transitive.A)` that implements `Core.Destroy & P` into type implementing `R` [ConversionFailureFacetToFacet] - // CHECK:STDERR: a.(T.C.InR)(); - // CHECK:STDERR: ^~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_equivalent.carbon:[[@LINE-18]]:1: in import [InImport] - // CHECK:STDERR: transitive.carbon:5:15: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: interface R { fn InR(self); } - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_equivalent.carbon:[[@LINE+4]]:3-15: error: cannot convert type `T.(Transitive.A)` that implements `Core.Destroy & P` into type implementing `R` [ConversionFailureFacetToFacet] + // CHECK:STDERR: imported from: fail_todo_equivalent.carbon:[[@LINE-12]]:1 [InImport] + // CHECK:STDERR: transitive.carbon:5:15-27: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: a.(T.C.InR)(); - // CHECK:STDERR: fail_todo_equivalent.carbon:[[@LINE+7]]:4: error: cannot convert expression of type `T.(Transitive.A)` to `T.(Transitive.C)` with `as` [ConversionFailure] - // CHECK:STDERR: (a as T.C).InR(); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_todo_equivalent.carbon:[[@LINE+4]]:4: note: type `T.(Transitive.A)` does not implement interface `Core.As(T.(Transitive.C))` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: (a as T.C).InR(); - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_todo_equivalent.carbon:[[@LINE+3]]:4-11: error: cannot convert expression of type `T.(Transitive.A)` to `T.(Transitive.C)` with `as` [ConversionFailure] + // CHECK:STDERR: fail_todo_equivalent.carbon:[[@LINE+2]]:4-11: note: type `T.(Transitive.A)` does not implement interface `Core.As(T.(Transitive.C))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: (a as T.C).InR(); } @@ -78,12 +66,8 @@ fn RequiresA[T: A](unused x: T) {} fn F[T: C](x: T) { observe T impls B; - // CHECK:STDERR: fail_todo_impls.carbon:[[@LINE+7]]:3: error: cannot convert type `T` that implements `C` into type implementing `A` [ConversionFailureFacetToFacet] - // CHECK:STDERR: RequiresA(x); - // CHECK:STDERR: ^~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_impls.carbon:[[@LINE-7]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn RequiresA[T: A](unused x: T) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_impls.carbon:[[@LINE+3]]:3-14: error: cannot convert type `T` that implements `C` into type implementing `A` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_todo_impls.carbon:[[@LINE-5]]:1-33: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: RequiresA(x); } @@ -98,19 +82,13 @@ fn G[T: Transitive](t: T) { var a: T.A = t.GetA(); observe T.A == T.B impls Q; - // CHECK:STDERR: fail_todo_equivalent_impls.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Q` in type `T.(Transitive.A)` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: a.(Q.InQ)(); - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_todo_equivalent_impls.carbon:[[@LINE+2]]:3-11: error: cannot access member of interface `Q` in type `T.(Transitive.A)` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: a.(Q.InQ)(); observe T.A == T.C impls R; - // CHECK:STDERR: fail_todo_equivalent_impls.carbon:[[@LINE+7]]:3: error: cannot convert type `T.(Transitive.A)` that implements `P & Core.Destroy` into type implementing `P & Q & R` [ConversionFailureFacetToFacet] - // CHECK:STDERR: TakesPQR(a); - // CHECK:STDERR: ^~~~~~~~~~~ - // CHECK:STDERR: fail_todo_equivalent_impls.carbon:[[@LINE-15]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn TakesPQR[U: P & Q & R](unused u: U) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_equivalent_impls.carbon:[[@LINE+3]]:3-13: error: cannot convert type `T.(Transitive.A)` that implements `P & Core.Destroy` into type implementing `P & Q & R` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_todo_equivalent_impls.carbon:[[@LINE-11]]:1-40: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: TakesPQR(a); } @@ -124,18 +102,12 @@ fn TakesPQR[U: P & Q & R](unused u: U) {} fn G[T: Transitive](t: T) { var a: T.A = t.GetA(); - // CHECK:STDERR: fail_equivalent_impls_without_observe.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Q` in type `T.(Transitive.A)` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: a.(Q.InQ)(); - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_equivalent_impls_without_observe.carbon:[[@LINE+2]]:3-11: error: cannot access member of interface `Q` in type `T.(Transitive.A)` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: a.(Q.InQ)(); - // CHECK:STDERR: fail_equivalent_impls_without_observe.carbon:[[@LINE+7]]:3: error: cannot convert type `T.(Transitive.A)` that implements `P & Core.Destroy` into type implementing `P & Q & R` [ConversionFailureFacetToFacet] - // CHECK:STDERR: TakesPQR(a); - // CHECK:STDERR: ^~~~~~~~~~~ - // CHECK:STDERR: fail_equivalent_impls_without_observe.carbon:[[@LINE-13]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn TakesPQR[U: P & Q & R](unused u: U) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_equivalent_impls_without_observe.carbon:[[@LINE+3]]:3-13: error: cannot convert type `T.(Transitive.A)` that implements `P & Core.Destroy` into type implementing `P & Q & R` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_equivalent_impls_without_observe.carbon:[[@LINE-9]]:1-40: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: TakesPQR(a); } @@ -149,13 +121,9 @@ fn G[T: Transitive](t: T) { observe T.A == T.B == T.C; var a: T.A = t.GetA(); - // CHECK:STDERR: fail_todo_same_observe_in_both_scopes.carbon:[[@LINE+8]]:3: error: cannot convert type `T.(Transitive.A)` that implements `Core.Destroy & P` into type implementing `R` [ConversionFailureFacetToFacet] - // CHECK:STDERR: a.(T.C.InR)(); - // CHECK:STDERR: ^~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_same_observe_in_both_scopes.carbon:[[@LINE-9]]:1: in import [InImport] - // CHECK:STDERR: transitive.carbon:5:15: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: interface R { fn InR(self); } - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_same_observe_in_both_scopes.carbon:[[@LINE+4]]:3-15: error: cannot convert type `T.(Transitive.A)` that implements `Core.Destroy & P` into type implementing `R` [ConversionFailureFacetToFacet] + // CHECK:STDERR: imported from: fail_todo_same_observe_in_both_scopes.carbon:[[@LINE-7]]:1 [InImport] + // CHECK:STDERR: transitive.carbon:5:15-27: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: a.(T.C.InR)(); } @@ -197,12 +165,8 @@ fn F[T: A, U: B where .Self == T]() { observe T == U; fn InnerF(x: U) { - // CHECK:STDERR: fail_todo_nested_functions_in_outer.carbon:[[@LINE+7]]:5: error: cannot convert type `U` that implements `B where...` into type implementing `A` [ConversionFailureFacetToFacet] - // CHECK:STDERR: RequiresA(x); - // CHECK:STDERR: ^~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_nested_functions_in_outer.carbon:[[@LINE-8]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn RequiresA[T: A](unused x: T) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_nested_functions_in_outer.carbon:[[@LINE+3]]:5-16: error: cannot convert type `U` that implements `B where...` into type implementing `A` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_todo_nested_functions_in_outer.carbon:[[@LINE-6]]:1-33: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: RequiresA(x); } @@ -221,12 +185,8 @@ fn F[T: A, U: B where .Self == T]() { fn InnerF(x: U) { observe T == U; - // CHECK:STDERR: fail_todo_nested_functions_in_inner.carbon:[[@LINE+7]]:5: error: cannot convert type `U` that implements `B where...` into type implementing `A` [ConversionFailureFacetToFacet] - // CHECK:STDERR: RequiresA(x); - // CHECK:STDERR: ^~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_nested_functions_in_inner.carbon:[[@LINE-9]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn RequiresA[T: A](unused x: T) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_nested_functions_in_inner.carbon:[[@LINE+3]]:5-16: error: cannot convert type `U` that implements `B where...` into type implementing `A` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_todo_nested_functions_in_inner.carbon:[[@LINE-7]]:1-33: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: RequiresA(x); } @@ -242,12 +202,8 @@ fn RequiresA[T: A](unused x: T) {} fn F[T: A, U: B where .Self == T]() { fn InnerF(x: U) { - // CHECK:STDERR: fail_nested_functions_lexical_order.carbon:[[@LINE+7]]:5: error: cannot convert type `U` that implements `B where...` into type implementing `A` [ConversionFailureFacetToFacet] - // CHECK:STDERR: RequiresA(x); - // CHECK:STDERR: ^~~~~~~~~~~~ - // CHECK:STDERR: fail_nested_functions_lexical_order.carbon:[[@LINE-7]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn RequiresA[T: A](unused x: T) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_nested_functions_lexical_order.carbon:[[@LINE+3]]:5-16: error: cannot convert type `U` that implements `B where...` into type implementing `A` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_nested_functions_lexical_order.carbon:[[@LINE-5]]:1-33: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: RequiresA(x); } @@ -268,12 +224,8 @@ fn F[T: A, U: B where .Self == T](x: U) { observe T == U; } - // CHECK:STDERR: fail_nested_functions_leak_upward.carbon:[[@LINE+7]]:3: error: cannot convert type `U` that implements `B where...` into type implementing `A` [ConversionFailureFacetToFacet] - // CHECK:STDERR: RequiresA(x); - // CHECK:STDERR: ^~~~~~~~~~~~ - // CHECK:STDERR: fail_nested_functions_leak_upward.carbon:[[@LINE-10]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn RequiresA[T: A](unused x: T) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_nested_functions_leak_upward.carbon:[[@LINE+3]]:3-14: error: cannot convert type `U` that implements `B where...` into type implementing `A` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_nested_functions_leak_upward.carbon:[[@LINE-8]]:1-33: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: RequiresA(x); } @@ -288,12 +240,8 @@ fn RequiresA[T: A](unused x: T) {} fn F[T: A, U: B where .Self == T, V: B](x: U) { observe T == V; - // CHECK:STDERR: fail_not_observed.carbon:[[@LINE+7]]:3: error: cannot convert type `U` that implements `B where...` into type implementing `A` [ConversionFailureFacetToFacet] - // CHECK:STDERR: RequiresA(x); - // CHECK:STDERR: ^~~~~~~~~~~~ - // CHECK:STDERR: fail_not_observed.carbon:[[@LINE-7]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn RequiresA[T: A](unused x: T) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_not_observed.carbon:[[@LINE+3]]:3-14: error: cannot convert type `U` that implements `B where...` into type implementing `A` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_not_observed.carbon:[[@LINE-5]]:1-33: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: RequiresA(x); } @@ -307,12 +255,8 @@ interface B {} fn TakesA[T: A](unused x: T) {} fn F[T: A, U: B](x: U) { observe T == U; - // CHECK:STDERR: fail_invalid_equivalent.carbon:[[@LINE+7]]:3: error: cannot convert type `U` that implements `B` into type implementing `A` [ConversionFailureFacetToFacet] - // CHECK:STDERR: TakesA(x); - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_invalid_equivalent.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn TakesA[T: A](unused x: T) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_invalid_equivalent.carbon:[[@LINE+3]]:3-11: error: cannot convert type `U` that implements `B` into type implementing `A` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_invalid_equivalent.carbon:[[@LINE-4]]:1-30: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: TakesA(x); } @@ -321,9 +265,7 @@ fn F[T: A, U: B](x: U) { library "[[@TEST_NAME]]"; class C(T: type, U: type) { - // CHECK:STDERR: fail_wrong_scope_class.carbon:[[@LINE+4]]:3: error: `observe` can only be used in an `interface` or `function` [ObserveInWrongScope] - // CHECK:STDERR: observe T == U; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_wrong_scope_class.carbon:[[@LINE+2]]:3-9: error: `observe` can only be used in an `interface` or `function` [ObserveInWrongScope] // CHECK:STDERR: observe T == U; } @@ -332,9 +274,7 @@ class C(T: type, U: type) { library "[[@TEST_NAME]]"; constraint C(T: type, U: type) { - // CHECK:STDERR: fail_wrong_scope_named_constraint.carbon:[[@LINE+4]]:3: error: `observe` can only be used in an `interface` or `function` [ObserveInWrongScope] - // CHECK:STDERR: observe T == U; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_wrong_scope_named_constraint.carbon:[[@LINE+2]]:3-9: error: `observe` can only be used in an `interface` or `function` [ObserveInWrongScope] // CHECK:STDERR: observe T == U; } @@ -346,9 +286,7 @@ class C {} interface A {} fn F[T: A]() { - // CHECK:STDERR: fail_non_facet_type_in_impls.carbon:[[@LINE+4]]:19: error: right argument of `impls` requirement must be a facet type [ImplsOnNonFacetType] - // CHECK:STDERR: observe T impls C; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_non_facet_type_in_impls.carbon:[[@LINE+2]]:19: error: right argument of `impls` requirement must be a facet type [ImplsOnNonFacetType] // CHECK:STDERR: observe T impls C; } @@ -380,13 +318,9 @@ impl C as A {} fn F[T: I(C)](t: T) { var u: T.U = t.GetU(); - // CHECK:STDERR: fail_todo_generic_import.carbon:[[@LINE+8]]:3: error: cannot convert type `T.(I(C as A & Core.Destroy).U)` that implements `Core.Destroy & B where...` into type implementing `A & Core.Destroy` [ConversionFailureFacetToFacet] - // CHECK:STDERR: t.TakesT(u); - // CHECK:STDERR: ^~~~~~~~~~~ - // CHECK:STDERR: fail_todo_generic_import.carbon:[[@LINE-11]]:1: in import [InImport] - // CHECK:STDERR: generic_observe.carbon:10:3: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn TakesT(self, t: T); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_generic_import.carbon:[[@LINE+4]]:3-13: error: cannot convert type `T.(I(C as A & Core.Destroy).U)` that implements `Core.Destroy & B where...` into type implementing `A & Core.Destroy` [ConversionFailureFacetToFacet] + // CHECK:STDERR: imported from: fail_todo_generic_import.carbon:[[@LINE-9]]:1 [InImport] + // CHECK:STDERR: generic_observe.carbon:10:3-24: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: t.TakesT(u); } diff --git a/toolchain/check/testdata/interface/require.carbon b/toolchain/check/testdata/interface/require.carbon index 0ec3a8cbf3dc..07c2b682246b 100644 --- a/toolchain/check/testdata/interface/require.carbon +++ b/toolchain/check/testdata/interface/require.carbon @@ -28,20 +28,14 @@ fn F(generic T: Z, generic t: T) { // `T: Z` since the identified facet type doesn't include `Y`. The // identified facet type needs to include extends inside interfaces? - // CHECK:STDERR: fail_todo_extend.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Y` in type `T` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: T.YY(); - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_todo_extend.carbon:[[@LINE+2]]:3-6: error: cannot access member of interface `Y` in type `T` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: T.YY(); - // CHECK:STDERR: fail_todo_extend.carbon:[[@LINE+4]]:3: error: cannot convert type `T` that implements `Z` into type implementing `Y` [ConversionFailureFacetToFacet] - // CHECK:STDERR: T.(Y.YY)(); - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_todo_extend.carbon:[[@LINE+2]]:3-10: error: cannot convert type `T` that implements `Z` into type implementing `Y` [ConversionFailureFacetToFacet] // CHECK:STDERR: T.(Y.YY)(); - // CHECK:STDERR: fail_todo_extend.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Y` in type `T` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: t.YY(); - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_todo_extend.carbon:[[@LINE+2]]:3-6: error: cannot access member of interface `Y` in type `T` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: t.YY(); } @@ -64,14 +58,10 @@ fn F(generic T: Z) { // `T: Z` since the identified facet type doesn't include `Y`. The // identified facet type needs to include extends inside interfaces? // - // CHECK:STDERR: fail_todo_extend_with_self.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Y(T)` in type `T` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: T.YY(); - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_todo_extend_with_self.carbon:[[@LINE+2]]:3-6: error: cannot access member of interface `Y(T)` in type `T` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: T.YY(); - // CHECK:STDERR: fail_todo_extend_with_self.carbon:[[@LINE+4]]:3: error: cannot convert type `T` that implements `Z` into type implementing `Y(T)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: T.(Y(T).YY)(); - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_todo_extend_with_self.carbon:[[@LINE+2]]:3-13: error: cannot convert type `T` that implements `Z` into type implementing `Y(T)` [ConversionFailureFacetToFacet] // CHECK:STDERR: T.(Y(T).YY)(); } @@ -90,9 +80,7 @@ interface Z { //@dump-sem-ir-end fn F(generic T: Z) { - // CHECK:STDERR: fail_todo_implicit_self_impls.carbon:[[@LINE+4]]:3: error: cannot convert type `T` that implements `Z` into type implementing `Y` [ConversionFailureFacetToFacet] - // CHECK:STDERR: T.(Y.YY)(); - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_todo_implicit_self_impls.carbon:[[@LINE+2]]:3-10: error: cannot convert type `T` that implements `Z` into type implementing `Y` [ConversionFailureFacetToFacet] // CHECK:STDERR: T.(Y.YY)(); } @@ -111,9 +99,7 @@ interface Z { //@dump-sem-ir-end fn F(generic T: Z) { - // CHECK:STDERR: fail_todo_explicit_self_impls.carbon:[[@LINE+4]]:3: error: cannot convert type `T` that implements `Z` into type implementing `Y` [ConversionFailureFacetToFacet] - // CHECK:STDERR: T.(Y.YY)(); - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_todo_explicit_self_impls.carbon:[[@LINE+2]]:3-10: error: cannot convert type `T` that implements `Z` into type implementing `Y` [ConversionFailureFacetToFacet] // CHECK:STDERR: T.(Y.YY)(); } @@ -132,9 +118,7 @@ interface Z { fn F(generic T: Z) { // This should fail name lookup since Z does not extend Y. // - // CHECK:STDERR: fail_implicit_self_no_extend_name_lookup_fails.carbon:[[@LINE+4]]:3: error: member name `YY` not found in `Z` [MemberNameNotFoundInSpecificScope] - // CHECK:STDERR: T.YY(); - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_implicit_self_no_extend_name_lookup_fails.carbon:[[@LINE+2]]:3-6: error: member name `YY` not found in `Z` [MemberNameNotFoundInSpecificScope] // CHECK:STDERR: T.YY(); } @@ -153,9 +137,7 @@ interface Z { fn F(generic T: Z) { // This should fail name lookup since Z does not extend Y. // - // CHECK:STDERR: fail_explicit_self_no_extend_name_lookup_fails.carbon:[[@LINE+4]]:3: error: member name `YY` not found in `Z` [MemberNameNotFoundInSpecificScope] - // CHECK:STDERR: T.YY(); - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_explicit_self_no_extend_name_lookup_fails.carbon:[[@LINE+2]]:3-6: error: member name `YY` not found in `Z` [MemberNameNotFoundInSpecificScope] // CHECK:STDERR: T.YY(); } @@ -189,9 +171,7 @@ interface Z { fn F(generic T: Z) { // This fails because `T impls Z` implies that `C(T) impls Y`, not that // `T impls Y`. - // CHECK:STDERR: fail_non_self_doesnt_provide_witness_for_self.carbon:[[@LINE+4]]:3: error: cannot convert type `T` that implements `Z` into type implementing `Y` [ConversionFailureFacetToFacet] - // CHECK:STDERR: T.(Y.YY)(); - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_non_self_doesnt_provide_witness_for_self.carbon:[[@LINE+2]]:3-10: error: cannot convert type `T` that implements `Z` into type implementing `Y` [ConversionFailureFacetToFacet] // CHECK:STDERR: T.(Y.YY)(); } @@ -210,9 +190,7 @@ interface Z { } fn F(generic T: Z) { - // CHECK:STDERR: fail_todo_non_self_provide_witness_for_non_self.carbon:[[@LINE+4]]:3: error: cannot convert type `C(T)` into type implementing `Y` [ConversionFailureTypeToFacet] - // CHECK:STDERR: C(T).(Y.YY)(); - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_todo_non_self_provide_witness_for_non_self.carbon:[[@LINE+2]]:3-13: error: cannot convert type `C(T)` into type implementing `Y` [ConversionFailureTypeToFacet] // CHECK:STDERR: C(T).(Y.YY)(); } @@ -249,9 +227,7 @@ interface Z(T: type) { // it would appear in the type structure used for impl lookup (so inside a // `where` does not count). But they don't. // - // CHECK:STDERR: fail_require_impls_without_self.carbon:[[@LINE+4]]:3: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Y` without a `Self` argument [RequireImplsMissingSelf] - // CHECK:STDERR: require T impls Y where .Y1 = Self; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_require_impls_without_self.carbon:[[@LINE+2]]:3-37: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Y` without a `Self` argument [RequireImplsMissingSelf] // CHECK:STDERR: require T impls Y where .Y1 = Self; } @@ -264,9 +240,7 @@ interface Y(T: type) {} interface Z(T: type) { // Self is in one interface but not the other. // - // CHECK:STDERR: fail_require_impls_without_self_in_one_interface.carbon:[[@LINE+4]]:3: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Y({})` without a `Self` argument [RequireImplsMissingSelf] - // CHECK:STDERR: require T impls Y(Self) & Y({}); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_require_impls_without_self_in_one_interface.carbon:[[@LINE+2]]:3-34: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Y({})` without a `Self` argument [RequireImplsMissingSelf] // CHECK:STDERR: require T impls Y(Self) & Y({}); } @@ -279,13 +253,9 @@ interface Y(T: type) {} interface Z(T: type) { // Self does not appear in either interface, we should get an error for each. // - // CHECK:STDERR: fail_require_impls_without_self_in_multiple_interfaces.carbon:[[@LINE+8]]:3: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Y(())` without a `Self` argument [RequireImplsMissingSelf] - // CHECK:STDERR: require T impls Y(()) & Y({}); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_require_impls_without_self_in_multiple_interfaces.carbon:[[@LINE+4]]:3-32: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Y(())` without a `Self` argument [RequireImplsMissingSelf] // CHECK:STDERR: - // CHECK:STDERR: fail_require_impls_without_self_in_multiple_interfaces.carbon:[[@LINE+4]]:3: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Y({})` without a `Self` argument [RequireImplsMissingSelf] - // CHECK:STDERR: require T impls Y(()) & Y({}); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_require_impls_without_self_in_multiple_interfaces.carbon:[[@LINE+2]]:3-32: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Y({})` without a `Self` argument [RequireImplsMissingSelf] // CHECK:STDERR: require T impls Y(()) & Y({}); } @@ -294,9 +264,7 @@ interface Z(T: type) { library "[[@TEST_NAME]]"; interface Z(T: type) { - // CHECK:STDERR: fail_self_impls_self.carbon:[[@LINE+4]]:17: error: `require` declaration constrained by a non-facet type; expected an `interface` or `constraint` name after `impls` [RequireImplsMissingFacetType] - // CHECK:STDERR: require impls Self; - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_self_impls_self.carbon:[[@LINE+2]]:17-20: error: `require` declaration constrained by a non-facet type; expected an `interface` or `constraint` name after `impls` [RequireImplsMissingFacetType] // CHECK:STDERR: require impls Self; } @@ -307,9 +275,7 @@ library "[[@TEST_NAME]]"; class C(T: type) {} interface Z(T: type) { - // CHECK:STDERR: fail_impls_type.carbon:[[@LINE+4]]:19: error: `require` declaration constrained by a non-facet type; expected an `interface` or `constraint` name after `impls` [RequireImplsMissingFacetType] - // CHECK:STDERR: require T impls C(Self); - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_impls_type.carbon:[[@LINE+2]]:19-25: error: `require` declaration constrained by a non-facet type; expected an `interface` or `constraint` name after `impls` [RequireImplsMissingFacetType] // CHECK:STDERR: require T impls C(Self); } @@ -320,12 +286,8 @@ library "[[@TEST_NAME]]"; interface Y {} 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: require 1 impls Y; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_non_type_impls.carbon:[[@LINE+3]]:11: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: fail_non_type_impls.carbon:[[@LINE+2]]:11: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: require 1 impls Y; } @@ -336,9 +298,7 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z(T: type) { - // CHECK:STDERR: fail_impls_non_type.carbon:[[@LINE+4]]:17: error: `require` declaration constrained by a non-facet type; expected an `interface` or `constraint` name after `impls` [RequireImplsMissingFacetType] - // CHECK:STDERR: require impls 1; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_impls_non_type.carbon:[[@LINE+2]]:17: error: `require` declaration constrained by a non-facet type; expected an `interface` or `constraint` name after `impls` [RequireImplsMissingFacetType] // CHECK:STDERR: require impls 1; } diff --git a/toolchain/check/testdata/interface/require_invalid_modifiers.carbon b/toolchain/check/testdata/interface/require_invalid_modifiers.carbon index e4b16c042406..bfa32c9f87f7 100644 --- a/toolchain/check/testdata/interface/require_invalid_modifiers.carbon +++ b/toolchain/check/testdata/interface/require_invalid_modifiers.carbon @@ -16,9 +16,7 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z { - // CHECK:STDERR: fail_abstract_require.carbon:[[@LINE+4]]:3: error: `abstract` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] - // CHECK:STDERR: abstract require impls Y; - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_abstract_require.carbon:[[@LINE+2]]:3-10: error: `abstract` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: abstract require impls Y; } @@ -29,9 +27,7 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z { - // CHECK:STDERR: fail_base_require.carbon:[[@LINE+4]]:3: error: `base` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] - // CHECK:STDERR: base require impls Y; - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_base_require.carbon:[[@LINE+2]]:3-6: error: `base` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: base require impls Y; } @@ -42,9 +38,7 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z { - // CHECK:STDERR: fail_default_require.carbon:[[@LINE+4]]:3: error: `default` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] - // CHECK:STDERR: default require impls Y; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_default_require.carbon:[[@LINE+2]]:3-9: error: `default` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: default require impls Y; } @@ -55,9 +49,7 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z { - // CHECK:STDERR: fail_extern_require.carbon:[[@LINE+4]]:3: error: `extern` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] - // CHECK:STDERR: extern require impls Y; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_extern_require.carbon:[[@LINE+2]]:3-8: error: `extern` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: extern require impls Y; } @@ -68,9 +60,7 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z { - // CHECK:STDERR: fail_final_require.carbon:[[@LINE+4]]:3: error: `final` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] - // CHECK:STDERR: final require impls Y; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_final_require.carbon:[[@LINE+2]]:3-7: error: `final` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: final require impls Y; } @@ -81,9 +71,7 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z { - // CHECK:STDERR: fail_impl_require.carbon:[[@LINE+4]]:3: error: `impl` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] - // CHECK:STDERR: impl require impls Y; - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_impl_require.carbon:[[@LINE+2]]:3-6: error: `impl` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: impl require impls Y; } @@ -94,9 +82,7 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z { - // CHECK:STDERR: fail_override_require.carbon:[[@LINE+4]]:3: error: `override` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] - // CHECK:STDERR: override require impls Y; - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_override_require.carbon:[[@LINE+2]]:3-10: error: `override` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: override require impls Y; } @@ -107,13 +93,9 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z { - // CHECK:STDERR: fail_returned_require.carbon:[[@LINE+8]]:3: error: unrecognized declaration introducer [UnrecognizedDecl] - // CHECK:STDERR: returned require impls Y; - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_returned_require.carbon:[[@LINE+4]]:3-10: error: unrecognized declaration introducer [UnrecognizedDecl] // CHECK:STDERR: - // CHECK:STDERR: fail_returned_require.carbon:[[@LINE+4]]:3: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] - // CHECK:STDERR: returned require impls Y; - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_returned_require.carbon:[[@LINE+2]]:3-10: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: returned require impls Y; } @@ -124,9 +106,7 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z { - // CHECK:STDERR: fail_private_require.carbon:[[@LINE+4]]:3: error: `private` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] - // CHECK:STDERR: private require impls Y; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_private_require.carbon:[[@LINE+2]]:3-9: error: `private` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: private require impls Y; } @@ -137,9 +117,7 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z { - // CHECK:STDERR: fail_protected_require.carbon:[[@LINE+4]]:3: error: `protected` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] - // CHECK:STDERR: protected require impls Y; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_protected_require.carbon:[[@LINE+2]]:3-11: error: `protected` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: protected require impls Y; } @@ -150,9 +128,7 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z { - // CHECK:STDERR: fail_override_virtual.carbon:[[@LINE+4]]:3: error: `virtual` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] - // CHECK:STDERR: virtual require impls Y; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_override_virtual.carbon:[[@LINE+2]]:3-9: error: `virtual` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: virtual require impls Y; } diff --git a/toolchain/check/testdata/interface/syntactic_merge.carbon b/toolchain/check/testdata/interface/syntactic_merge.carbon index 3fced46873a1..5886c9815dfd 100644 --- a/toolchain/check/testdata/interface/syntactic_merge.carbon +++ b/toolchain/check/testdata/interface/syntactic_merge.carbon @@ -41,12 +41,8 @@ library "[[@TEST_NAME]]"; class C {} interface Foo(a: C); -// CHECK:STDERR: fail_parens.carbon:[[@LINE+7]]:18: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: interface Foo(a: (C)) {} -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_parens.carbon:[[@LINE-4]]:18: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] -// CHECK:STDERR: interface Foo(a: C); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_parens.carbon:[[@LINE+3]]:18: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] +// CHECK:STDERR: fail_parens.carbon:[[@LINE-2]]:18: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] // CHECK:STDERR: interface Foo(a: (C)) {} @@ -57,12 +53,8 @@ library "[[@TEST_NAME]]"; class C {} interface Foo(a: C); -// CHECK:STDERR: fail_raw_identifier.carbon:[[@LINE+7]]:18: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: interface Foo(a: r#C) {} -// CHECK:STDERR: ^~~ -// CHECK:STDERR: fail_raw_identifier.carbon:[[@LINE-4]]:18: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] -// CHECK:STDERR: interface Foo(a: C); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_raw_identifier.carbon:[[@LINE+3]]:18-20: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] +// CHECK:STDERR: fail_raw_identifier.carbon:[[@LINE-2]]:18: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] // CHECK:STDERR: interface Foo(a: r#C) {} @@ -80,22 +72,14 @@ interface Bar(a: D); impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_todo_two_file.impl.carbon:[[@LINE+8]]:11: error: duplicate name `Foo` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: interface Foo(a: C) {} -// CHECK:STDERR: ^~~ -// CHECK:STDERR: fail_todo_two_file.impl.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: two_file.carbon:7:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: interface Foo(a: C); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_two_file.impl.carbon:[[@LINE+4]]:11-13: error: duplicate name `Foo` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_todo_two_file.impl.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: two_file.carbon:7:1-20: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: interface Foo(a: C) {} -// CHECK:STDERR: fail_todo_two_file.impl.carbon:[[@LINE+8]]:11: error: duplicate name `Bar` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: interface Bar(a: D) {} -// CHECK:STDERR: ^~~ -// CHECK:STDERR: fail_todo_two_file.impl.carbon:[[@LINE-14]]:1: in import [InImport] -// CHECK:STDERR: two_file.carbon:8:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: interface Bar(a: D); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_two_file.impl.carbon:[[@LINE+4]]:11-13: error: duplicate name `Bar` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_todo_two_file.impl.carbon:[[@LINE-8]]:1 [InImport] +// CHECK:STDERR: two_file.carbon:8:1-20: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: interface Bar(a: D) {} @@ -107,12 +91,8 @@ class C {} alias D = C; interface Foo(a: C); -// CHECK:STDERR: fail_name_mismatch.carbon:[[@LINE+7]]:15: error: redeclaration differs at parameter 1 [RedeclParamDiffers] -// CHECK:STDERR: interface Foo(b: D) {} -// CHECK:STDERR: ^~~~ -// CHECK:STDERR: fail_name_mismatch.carbon:[[@LINE-4]]:15: note: previous declaration's corresponding parameter here [RedeclParamPrevious] -// CHECK:STDERR: interface Foo(a: C); -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_name_mismatch.carbon:[[@LINE+3]]:15-18: error: redeclaration differs at parameter 1 [RedeclParamDiffers] +// CHECK:STDERR: fail_name_mismatch.carbon:[[@LINE-2]]:15-18: note: previous declaration's corresponding parameter here [RedeclParamPrevious] // CHECK:STDERR: interface Foo(b: D) {} @@ -124,12 +104,8 @@ class C {} alias D = C; interface Foo(a: C); -// CHECK:STDERR: fail_alias.carbon:[[@LINE+7]]:18: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: interface Foo(a: D) {} -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_alias.carbon:[[@LINE-4]]:18: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] -// CHECK:STDERR: interface Foo(a: C); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_alias.carbon:[[@LINE+3]]:18: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] +// CHECK:STDERR: fail_alias.carbon:[[@LINE-2]]:18: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] // CHECK:STDERR: interface Foo(a: D) {} @@ -141,12 +117,8 @@ class C {} alias D = C; interface Foo[a: C](); -// CHECK:STDERR: fail_deduced_alias.carbon:[[@LINE+7]]:18: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: interface Foo[a: D]() {} -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_deduced_alias.carbon:[[@LINE-4]]:18: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] -// CHECK:STDERR: interface Foo[a: C](); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_deduced_alias.carbon:[[@LINE+3]]:18: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] +// CHECK:STDERR: fail_deduced_alias.carbon:[[@LINE-2]]:18: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] // CHECK:STDERR: interface Foo[a: D]() {} @@ -167,13 +139,9 @@ alias D = C; // TODO: This fails because importing interfaces doesn't work well. It should // fail due to `C` versus `D`, but may succeed if importing interfaces is fixed // before syntax matching on imports is supported. -// CHECK:STDERR: fail_alias_two_file.impl.carbon:[[@LINE+8]]:11: error: duplicate name `Foo` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: interface Foo(a: D) {} -// CHECK:STDERR: ^~~ -// CHECK:STDERR: fail_alias_two_file.impl.carbon:[[@LINE-10]]:1: in import [InImport] -// CHECK:STDERR: alias_two_file.carbon:6:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: interface Foo(a: C); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_alias_two_file.impl.carbon:[[@LINE+4]]:11-13: error: duplicate name `Foo` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_alias_two_file.impl.carbon:[[@LINE-8]]:1 [InImport] +// CHECK:STDERR: alias_two_file.carbon:6:1-20: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: interface Foo(a: D) {} @@ -184,16 +152,10 @@ library "[[@TEST_NAME]]"; class C {} interface Foo(a: const C); -// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE+11]]:18: warning: `const` applied repeatedly to the same type has no additional effect [RepeatedConst] -// CHECK:STDERR: interface Foo(a: const (const C)) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE+5]]:18-32: warning: `const` applied repeatedly to the same type has no additional effect [RepeatedConst] // CHECK:STDERR: -// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE+7]]:24: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: interface Foo(a: const (const C)) {} -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE-8]]:24: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] -// CHECK:STDERR: interface Foo(a: const C); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE+3]]:24: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] +// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE-4]]:24: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] // CHECK:STDERR: interface Foo(a: const (const C)) {} @@ -419,9 +381,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a: %C = symbolic_binding a, 0 [symbolic] // CHECK:STDOUT: %Foo.type.bc6a25.1: type = generic_interface_type @Foo.loc6 [concrete] // CHECK:STDOUT: %Foo.generic.d3ea5a.1: %Foo.type.bc6a25.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc14 [concrete] +// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc10 [concrete] // CHECK:STDOUT: %Foo.generic.d3ea5a.2: %Foo.type.bc6a25.2 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.137: type = facet_type <@Foo.loc14, @Foo.loc14(%a)> [symbolic] +// CHECK:STDOUT: %Foo.type.137: type = facet_type <@Foo.loc10, @Foo.loc10(%a)> [symbolic] // CHECK:STDOUT: %Self: %Foo.type.137 = symbolic_binding Self, 1 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -440,14 +402,14 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: } // CHECK:STDOUT: %a.loc6_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc6_16.1 (constants.%a)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc14: %Foo.type.bc6a25.2 = interface_decl @Foo.loc14 [concrete = constants.%Foo.generic.d3ea5a.2] { -// CHECK:STDOUT: %a.patt.loc14_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc14_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %Foo.decl.loc10: %Foo.type.bc6a25.2 = interface_decl @Foo.loc10 [concrete = constants.%Foo.generic.d3ea5a.2] { +// CHECK:STDOUT: %a.patt.loc10_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc10_16.2 (constants.%a.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc14: type = splice_block %C.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc10: type = splice_block %C.ref [concrete = constants.%C] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.loc14_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc14_16.1 (constants.%a)] +// CHECK:STDOUT: %a.loc10_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc10_16.1 (constants.%a)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -458,20 +420,20 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: interface; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @Foo.loc14(%a.loc14_16.2: %C) { -// CHECK:STDOUT: %a.patt.loc14_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc14_16.2 (constants.%a.patt)] -// CHECK:STDOUT: %a.loc14_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc14_16.1 (constants.%a)] +// CHECK:STDOUT: generic interface @Foo.loc10(%a.loc10_16.2: %C) { +// CHECK:STDOUT: %a.patt.loc10_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc10_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %a.loc10_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc10_16.1 (constants.%a)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc14, @Foo.loc14(%a.loc14_16.1)> [symbolic = %Foo.type (constants.%Foo.type.137)] -// CHECK:STDOUT: %Self.loc14_23.2: @Foo.loc14.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc14_23.2 (constants.%Self)] +// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc10, @Foo.loc10(%a.loc10_16.1)> [symbolic = %Foo.type (constants.%Foo.type.137)] +// CHECK:STDOUT: %Self.loc10_23.2: @Foo.loc10.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc10_23.2 (constants.%Self)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.loc14_23.1: @Foo.loc14.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc14_23.2 (constants.%Self)] -// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc14 [concrete] +// CHECK:STDOUT: %Self.loc10_23.1: @Foo.loc10.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc10_23.2 (constants.%Self)] +// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc10 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.loc14_23.1 +// CHECK:STDOUT: .Self = %Self.loc10_23.1 // CHECK:STDOUT: witness = () // CHECK:STDOUT: // CHECK:STDOUT: !requires: @@ -491,9 +453,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a.loc6_16.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Foo.loc14(constants.%a) { -// CHECK:STDOUT: %a.patt.loc14_16.2 => constants.%a.patt -// CHECK:STDOUT: %a.loc14_16.1 => constants.%a +// CHECK:STDOUT: specific @Foo.loc10(constants.%a) { +// CHECK:STDOUT: %a.patt.loc10_16.2 => constants.%a.patt +// CHECK:STDOUT: %a.loc10_16.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Foo.WithSelf(constants.%a, constants.%Self) {} @@ -511,9 +473,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a: %C = symbolic_binding a, 0 [symbolic] // CHECK:STDOUT: %Foo.type.bc6a25.1: type = generic_interface_type @Foo.loc6 [concrete] // CHECK:STDOUT: %Foo.generic.d3ea5a.1: %Foo.type.bc6a25.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc14 [concrete] +// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc10 [concrete] // CHECK:STDOUT: %Foo.generic.d3ea5a.2: %Foo.type.bc6a25.2 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.137: type = facet_type <@Foo.loc14, @Foo.loc14(%a)> [symbolic] +// CHECK:STDOUT: %Foo.type.137: type = facet_type <@Foo.loc10, @Foo.loc10(%a)> [symbolic] // CHECK:STDOUT: %Self: %Foo.type.137 = symbolic_binding Self, 1 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -532,14 +494,14 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: } // CHECK:STDOUT: %a.loc6_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc6_16.1 (constants.%a)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc14: %Foo.type.bc6a25.2 = interface_decl @Foo.loc14 [concrete = constants.%Foo.generic.d3ea5a.2] { -// CHECK:STDOUT: %a.patt.loc14_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc14_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %Foo.decl.loc10: %Foo.type.bc6a25.2 = interface_decl @Foo.loc10 [concrete = constants.%Foo.generic.d3ea5a.2] { +// CHECK:STDOUT: %a.patt.loc10_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc10_16.2 (constants.%a.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc14: type = splice_block %C.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc10: type = splice_block %C.ref [concrete = constants.%C] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.loc14_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc14_16.1 (constants.%a)] +// CHECK:STDOUT: %a.loc10_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc10_16.1 (constants.%a)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -550,20 +512,20 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: interface; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @Foo.loc14(%a.loc14_16.2: %C) { -// CHECK:STDOUT: %a.patt.loc14_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc14_16.2 (constants.%a.patt)] -// CHECK:STDOUT: %a.loc14_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc14_16.1 (constants.%a)] +// CHECK:STDOUT: generic interface @Foo.loc10(%a.loc10_16.2: %C) { +// CHECK:STDOUT: %a.patt.loc10_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc10_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %a.loc10_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc10_16.1 (constants.%a)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc14, @Foo.loc14(%a.loc14_16.1)> [symbolic = %Foo.type (constants.%Foo.type.137)] -// CHECK:STDOUT: %Self.loc14_23.2: @Foo.loc14.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc14_23.2 (constants.%Self)] +// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc10, @Foo.loc10(%a.loc10_16.1)> [symbolic = %Foo.type (constants.%Foo.type.137)] +// CHECK:STDOUT: %Self.loc10_23.2: @Foo.loc10.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc10_23.2 (constants.%Self)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.loc14_23.1: @Foo.loc14.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc14_23.2 (constants.%Self)] -// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc14 [concrete] +// CHECK:STDOUT: %Self.loc10_23.1: @Foo.loc10.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc10_23.2 (constants.%Self)] +// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc10 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.loc14_23.1 +// CHECK:STDOUT: .Self = %Self.loc10_23.1 // CHECK:STDOUT: witness = () // CHECK:STDOUT: // CHECK:STDOUT: !requires: @@ -583,9 +545,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a.loc6_16.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Foo.loc14(constants.%a) { -// CHECK:STDOUT: %a.patt.loc14_16.2 => constants.%a.patt -// CHECK:STDOUT: %a.loc14_16.1 => constants.%a +// CHECK:STDOUT: specific @Foo.loc10(constants.%a) { +// CHECK:STDOUT: %a.patt.loc10_16.2 => constants.%a.patt +// CHECK:STDOUT: %a.loc10_16.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Foo.WithSelf(constants.%a, constants.%Self) {} @@ -682,15 +644,15 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a: %C = symbolic_binding a, 0 [symbolic] // CHECK:STDOUT: %Foo.type.bc6a25.1: type = generic_interface_type @Foo.1 [concrete] // CHECK:STDOUT: %Foo.generic.d3ea5a.1: %Foo.type.bc6a25.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc12 [concrete] +// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc8 [concrete] // CHECK:STDOUT: %Foo.generic.d3ea5a.2: %Foo.type.bc6a25.2 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.137: type = facet_type <@Foo.loc12, @Foo.loc12(%a)> [symbolic] +// CHECK:STDOUT: %Foo.type.137: type = facet_type <@Foo.loc8, @Foo.loc8(%a)> [symbolic] // CHECK:STDOUT: %Self.4d3: %Foo.type.137 = symbolic_binding Self, 1 [symbolic] // CHECK:STDOUT: %Bar.type.3f06c8.1: type = generic_interface_type @Bar.1 [concrete] // CHECK:STDOUT: %Bar.generic.b3011f.1: %Bar.type.3f06c8.1 = struct_value () [concrete] -// CHECK:STDOUT: %Bar.type.3f06c8.2: type = generic_interface_type @Bar.loc21 [concrete] +// CHECK:STDOUT: %Bar.type.3f06c8.2: type = generic_interface_type @Bar.loc13 [concrete] // CHECK:STDOUT: %Bar.generic.b3011f.2: %Bar.type.3f06c8.2 = struct_value () [concrete] -// CHECK:STDOUT: %Bar.type.309: type = facet_type <@Bar.loc21, @Bar.loc21(%a)> [symbolic] +// CHECK:STDOUT: %Bar.type.309: type = facet_type <@Bar.loc13, @Bar.loc13(%a)> [symbolic] // CHECK:STDOUT: %Self.3ee: %Bar.type.309 = symbolic_binding Self, 1 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -714,23 +676,23 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: } // CHECK:STDOUT: %default.import.loc2_24.1 = import // CHECK:STDOUT: %default.import.loc2_24.2 = import -// CHECK:STDOUT: %Foo.decl: %Foo.type.bc6a25.2 = interface_decl @Foo.loc12 [concrete = constants.%Foo.generic.d3ea5a.2] { -// CHECK:STDOUT: %a.patt.loc12_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc12_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %Foo.decl: %Foo.type.bc6a25.2 = interface_decl @Foo.loc8 [concrete = constants.%Foo.generic.d3ea5a.2] { +// CHECK:STDOUT: %a.patt.loc8_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc8_16.2 (constants.%a.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc12: type = splice_block %C.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc8: type = splice_block %C.ref [concrete = constants.%C] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.loc12_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc12_16.1 (constants.%a)] +// CHECK:STDOUT: %a.loc8_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc8_16.1 (constants.%a)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Bar.decl: %Bar.type.3f06c8.2 = interface_decl @Bar.loc21 [concrete = constants.%Bar.generic.b3011f.2] { -// CHECK:STDOUT: %a.patt.loc21_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc21_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %Bar.decl: %Bar.type.3f06c8.2 = interface_decl @Bar.loc13 [concrete = constants.%Bar.generic.b3011f.2] { +// CHECK:STDOUT: %a.patt.loc13_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc13_16.2 (constants.%a.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc21: type = splice_block %D.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc13: type = splice_block %D.ref [concrete = constants.%C] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %D.ref: type = name_ref D, imports.%Main.D [concrete = constants.%C] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.loc21_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc21_16.1 (constants.%a)] +// CHECK:STDOUT: %a.loc13_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc13_16.1 (constants.%a)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -741,20 +703,20 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: interface; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @Foo.loc12(%a.loc12_16.2: %C) { -// CHECK:STDOUT: %a.patt.loc12_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc12_16.2 (constants.%a.patt)] -// CHECK:STDOUT: %a.loc12_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc12_16.1 (constants.%a)] +// CHECK:STDOUT: generic interface @Foo.loc8(%a.loc8_16.2: %C) { +// CHECK:STDOUT: %a.patt.loc8_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc8_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %a.loc8_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc8_16.1 (constants.%a)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc12, @Foo.loc12(%a.loc12_16.1)> [symbolic = %Foo.type (constants.%Foo.type.137)] -// CHECK:STDOUT: %Self.loc12_21.2: @Foo.loc12.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc12_21.2 (constants.%Self.4d3)] +// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc8, @Foo.loc8(%a.loc8_16.1)> [symbolic = %Foo.type (constants.%Foo.type.137)] +// CHECK:STDOUT: %Self.loc8_21.2: @Foo.loc8.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc8_21.2 (constants.%Self.4d3)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.loc12_21.1: @Foo.loc12.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc12_21.2 (constants.%Self.4d3)] -// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc12 [concrete] +// CHECK:STDOUT: %Self.loc8_21.1: @Foo.loc8.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc8_21.2 (constants.%Self.4d3)] +// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc8 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.loc12_21.1 +// CHECK:STDOUT: .Self = %Self.loc8_21.1 // CHECK:STDOUT: witness = () // CHECK:STDOUT: // CHECK:STDOUT: !requires: @@ -768,20 +730,20 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: interface; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @Bar.loc21(%a.loc21_16.2: %C) { -// CHECK:STDOUT: %a.patt.loc21_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc21_16.2 (constants.%a.patt)] -// CHECK:STDOUT: %a.loc21_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc21_16.1 (constants.%a)] +// CHECK:STDOUT: generic interface @Bar.loc13(%a.loc13_16.2: %C) { +// CHECK:STDOUT: %a.patt.loc13_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc13_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %a.loc13_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc13_16.1 (constants.%a)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Bar.type: type = facet_type <@Bar.loc21, @Bar.loc21(%a.loc21_16.1)> [symbolic = %Bar.type (constants.%Bar.type.309)] -// CHECK:STDOUT: %Self.loc21_21.2: @Bar.loc21.%Bar.type (%Bar.type.309) = symbolic_binding Self, 1 [symbolic = %Self.loc21_21.2 (constants.%Self.3ee)] +// CHECK:STDOUT: %Bar.type: type = facet_type <@Bar.loc13, @Bar.loc13(%a.loc13_16.1)> [symbolic = %Bar.type (constants.%Bar.type.309)] +// CHECK:STDOUT: %Self.loc13_21.2: @Bar.loc13.%Bar.type (%Bar.type.309) = symbolic_binding Self, 1 [symbolic = %Self.loc13_21.2 (constants.%Self.3ee)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.loc21_21.1: @Bar.loc21.%Bar.type (%Bar.type.309) = symbolic_binding Self, 1 [symbolic = %Self.loc21_21.2 (constants.%Self.3ee)] -// CHECK:STDOUT: %Bar.WithSelf.decl = interface_with_self_decl @Bar.loc21 [concrete] +// CHECK:STDOUT: %Self.loc13_21.1: @Bar.loc13.%Bar.type (%Bar.type.309) = symbolic_binding Self, 1 [symbolic = %Self.loc13_21.2 (constants.%Self.3ee)] +// CHECK:STDOUT: %Bar.WithSelf.decl = interface_with_self_decl @Bar.loc13 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.loc21_21.1 +// CHECK:STDOUT: .Self = %Self.loc13_21.1 // CHECK:STDOUT: witness = () // CHECK:STDOUT: // CHECK:STDOUT: !requires: @@ -800,9 +762,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Foo.loc12(constants.%a) { -// CHECK:STDOUT: %a.patt.loc12_16.2 => constants.%a.patt -// CHECK:STDOUT: %a.loc12_16.1 => constants.%a +// CHECK:STDOUT: specific @Foo.loc8(constants.%a) { +// CHECK:STDOUT: %a.patt.loc8_16.2 => constants.%a.patt +// CHECK:STDOUT: %a.loc8_16.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Foo.WithSelf(constants.%a, constants.%Self.4d3) {} @@ -812,9 +774,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Bar.loc21(constants.%a) { -// CHECK:STDOUT: %a.patt.loc21_16.2 => constants.%a.patt -// CHECK:STDOUT: %a.loc21_16.1 => constants.%a +// CHECK:STDOUT: specific @Bar.loc13(constants.%a) { +// CHECK:STDOUT: %a.patt.loc13_16.2 => constants.%a.patt +// CHECK:STDOUT: %a.loc13_16.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Bar.WithSelf(constants.%a, constants.%Self.3ee) {} @@ -834,9 +796,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %Foo.generic.d3ea5a.1: %Foo.type.bc6a25.1 = struct_value () [concrete] // CHECK:STDOUT: %b.patt: %pattern_type = symbolic_binding_pattern b, 0 [symbolic] // CHECK:STDOUT: %b: %C = symbolic_binding b, 0 [symbolic] -// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc15 [concrete] +// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc11 [concrete] // CHECK:STDOUT: %Foo.generic.d3ea5a.2: %Foo.type.bc6a25.2 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.137: type = facet_type <@Foo.loc15, @Foo.loc15(%b)> [symbolic] +// CHECK:STDOUT: %Foo.type.137: type = facet_type <@Foo.loc11, @Foo.loc11(%b)> [symbolic] // CHECK:STDOUT: %Self: %Foo.type.137 = symbolic_binding Self, 1 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -858,14 +820,14 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: } // CHECK:STDOUT: %a.loc7_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc7_16.1 (constants.%a)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc15: %Foo.type.bc6a25.2 = interface_decl @Foo.loc15 [concrete = constants.%Foo.generic.d3ea5a.2] { -// CHECK:STDOUT: %b.patt.loc15_16.1: %pattern_type = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc15_16.2 (constants.%b.patt)] +// CHECK:STDOUT: %Foo.decl.loc11: %Foo.type.bc6a25.2 = interface_decl @Foo.loc11 [concrete = constants.%Foo.generic.d3ea5a.2] { +// CHECK:STDOUT: %b.patt.loc11_16.1: %pattern_type = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc11_16.2 (constants.%b.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc15: type = splice_block %D.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc11: type = splice_block %D.ref [concrete = constants.%C] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D [concrete = constants.%C] // CHECK:STDOUT: } -// CHECK:STDOUT: %b.loc15_16.2: %C = symbolic_binding b, 0 [symbolic = %b.loc15_16.1 (constants.%b)] +// CHECK:STDOUT: %b.loc11_16.2: %C = symbolic_binding b, 0 [symbolic = %b.loc11_16.1 (constants.%b)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -876,20 +838,20 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: interface; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @Foo.loc15(%b.loc15_16.2: %C) { -// CHECK:STDOUT: %b.patt.loc15_16.2: %pattern_type = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc15_16.2 (constants.%b.patt)] -// CHECK:STDOUT: %b.loc15_16.1: %C = symbolic_binding b, 0 [symbolic = %b.loc15_16.1 (constants.%b)] +// CHECK:STDOUT: generic interface @Foo.loc11(%b.loc11_16.2: %C) { +// CHECK:STDOUT: %b.patt.loc11_16.2: %pattern_type = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc11_16.2 (constants.%b.patt)] +// CHECK:STDOUT: %b.loc11_16.1: %C = symbolic_binding b, 0 [symbolic = %b.loc11_16.1 (constants.%b)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc15, @Foo.loc15(%b.loc15_16.1)> [symbolic = %Foo.type (constants.%Foo.type.137)] -// CHECK:STDOUT: %Self.loc15_21.2: @Foo.loc15.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc15_21.2 (constants.%Self)] +// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc11, @Foo.loc11(%b.loc11_16.1)> [symbolic = %Foo.type (constants.%Foo.type.137)] +// CHECK:STDOUT: %Self.loc11_21.2: @Foo.loc11.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc11_21.2 (constants.%Self)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.loc15_21.1: @Foo.loc15.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc15_21.2 (constants.%Self)] -// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc15 [concrete] +// CHECK:STDOUT: %Self.loc11_21.1: @Foo.loc11.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc11_21.2 (constants.%Self)] +// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc11 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.loc15_21.1 +// CHECK:STDOUT: .Self = %Self.loc11_21.1 // CHECK:STDOUT: witness = () // CHECK:STDOUT: // CHECK:STDOUT: !requires: @@ -909,9 +871,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a.loc7_16.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Foo.loc15(constants.%b) { -// CHECK:STDOUT: %b.patt.loc15_16.2 => constants.%b.patt -// CHECK:STDOUT: %b.loc15_16.1 => constants.%b +// CHECK:STDOUT: specific @Foo.loc11(constants.%b) { +// CHECK:STDOUT: %b.patt.loc11_16.2 => constants.%b.patt +// CHECK:STDOUT: %b.loc11_16.1 => constants.%b // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Foo.WithSelf(constants.%b, constants.%Self) {} @@ -929,9 +891,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a: %C = symbolic_binding a, 0 [symbolic] // CHECK:STDOUT: %Foo.type.bc6a25.1: type = generic_interface_type @Foo.loc7 [concrete] // CHECK:STDOUT: %Foo.generic.d3ea5a.1: %Foo.type.bc6a25.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc15 [concrete] +// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc11 [concrete] // CHECK:STDOUT: %Foo.generic.d3ea5a.2: %Foo.type.bc6a25.2 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.137: type = facet_type <@Foo.loc15, @Foo.loc15(%a)> [symbolic] +// CHECK:STDOUT: %Foo.type.137: type = facet_type <@Foo.loc11, @Foo.loc11(%a)> [symbolic] // CHECK:STDOUT: %Self: %Foo.type.137 = symbolic_binding Self, 1 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -953,14 +915,14 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: } // CHECK:STDOUT: %a.loc7_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc7_16.1 (constants.%a)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc15: %Foo.type.bc6a25.2 = interface_decl @Foo.loc15 [concrete = constants.%Foo.generic.d3ea5a.2] { -// CHECK:STDOUT: %a.patt.loc15_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc15_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %Foo.decl.loc11: %Foo.type.bc6a25.2 = interface_decl @Foo.loc11 [concrete = constants.%Foo.generic.d3ea5a.2] { +// CHECK:STDOUT: %a.patt.loc11_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc11_16.2 (constants.%a.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc15: type = splice_block %D.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc11: type = splice_block %D.ref [concrete = constants.%C] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D [concrete = constants.%C] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.loc15_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc15_16.1 (constants.%a)] +// CHECK:STDOUT: %a.loc11_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc11_16.1 (constants.%a)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -971,20 +933,20 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: interface; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @Foo.loc15(%a.loc15_16.2: %C) { -// CHECK:STDOUT: %a.patt.loc15_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc15_16.2 (constants.%a.patt)] -// CHECK:STDOUT: %a.loc15_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc15_16.1 (constants.%a)] +// CHECK:STDOUT: generic interface @Foo.loc11(%a.loc11_16.2: %C) { +// CHECK:STDOUT: %a.patt.loc11_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc11_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %a.loc11_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc11_16.1 (constants.%a)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc15, @Foo.loc15(%a.loc15_16.1)> [symbolic = %Foo.type (constants.%Foo.type.137)] -// CHECK:STDOUT: %Self.loc15_21.2: @Foo.loc15.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc15_21.2 (constants.%Self)] +// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc11, @Foo.loc11(%a.loc11_16.1)> [symbolic = %Foo.type (constants.%Foo.type.137)] +// CHECK:STDOUT: %Self.loc11_21.2: @Foo.loc11.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc11_21.2 (constants.%Self)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.loc15_21.1: @Foo.loc15.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc15_21.2 (constants.%Self)] -// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc15 [concrete] +// CHECK:STDOUT: %Self.loc11_21.1: @Foo.loc11.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc11_21.2 (constants.%Self)] +// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc11 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.loc15_21.1 +// CHECK:STDOUT: .Self = %Self.loc11_21.1 // CHECK:STDOUT: witness = () // CHECK:STDOUT: // CHECK:STDOUT: !requires: @@ -1004,9 +966,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a.loc7_16.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Foo.loc15(constants.%a) { -// CHECK:STDOUT: %a.patt.loc15_16.2 => constants.%a.patt -// CHECK:STDOUT: %a.loc15_16.1 => constants.%a +// CHECK:STDOUT: specific @Foo.loc11(constants.%a) { +// CHECK:STDOUT: %a.patt.loc11_16.2 => constants.%a.patt +// CHECK:STDOUT: %a.loc11_16.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Foo.WithSelf(constants.%a, constants.%Self) {} @@ -1024,9 +986,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a: %C = symbolic_binding a, 0 [symbolic] // CHECK:STDOUT: %Foo.type.bc6a25.1: type = generic_interface_type @Foo.loc7 [concrete] // CHECK:STDOUT: %Foo.generic.d3ea5a.1: %Foo.type.bc6a25.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc15 [concrete] +// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc11 [concrete] // CHECK:STDOUT: %Foo.generic.d3ea5a.2: %Foo.type.bc6a25.2 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.137: type = facet_type <@Foo.loc15, @Foo.loc15(%a)> [symbolic] +// CHECK:STDOUT: %Foo.type.137: type = facet_type <@Foo.loc11, @Foo.loc11(%a)> [symbolic] // CHECK:STDOUT: %Self: %Foo.type.137 = symbolic_binding Self, 1 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1048,14 +1010,14 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: } // CHECK:STDOUT: %a.loc7_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc7_16.1 (constants.%a)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc15: %Foo.type.bc6a25.2 = interface_decl @Foo.loc15 [concrete = constants.%Foo.generic.d3ea5a.2] { -// CHECK:STDOUT: %a.patt.loc15_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc15_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %Foo.decl.loc11: %Foo.type.bc6a25.2 = interface_decl @Foo.loc11 [concrete = constants.%Foo.generic.d3ea5a.2] { +// CHECK:STDOUT: %a.patt.loc11_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc11_16.2 (constants.%a.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc15: type = splice_block %D.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc11: type = splice_block %D.ref [concrete = constants.%C] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D [concrete = constants.%C] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.loc15_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc15_16.1 (constants.%a)] +// CHECK:STDOUT: %a.loc11_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc11_16.1 (constants.%a)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1066,20 +1028,20 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: interface; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @Foo.loc15(%a.loc15_16.2: %C) { -// CHECK:STDOUT: %a.patt.loc15_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc15_16.2 (constants.%a.patt)] -// CHECK:STDOUT: %a.loc15_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc15_16.1 (constants.%a)] +// CHECK:STDOUT: generic interface @Foo.loc11(%a.loc11_16.2: %C) { +// CHECK:STDOUT: %a.patt.loc11_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc11_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %a.loc11_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc11_16.1 (constants.%a)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc15, @Foo.loc15(%a.loc15_16.1)> [symbolic = %Foo.type (constants.%Foo.type.137)] -// CHECK:STDOUT: %Self.loc15_23.2: @Foo.loc15.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc15_23.2 (constants.%Self)] +// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc11, @Foo.loc11(%a.loc11_16.1)> [symbolic = %Foo.type (constants.%Foo.type.137)] +// CHECK:STDOUT: %Self.loc11_23.2: @Foo.loc11.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc11_23.2 (constants.%Self)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.loc15_23.1: @Foo.loc15.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc15_23.2 (constants.%Self)] -// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc15 [concrete] +// CHECK:STDOUT: %Self.loc11_23.1: @Foo.loc11.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc11_23.2 (constants.%Self)] +// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc11 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.loc15_23.1 +// CHECK:STDOUT: .Self = %Self.loc11_23.1 // CHECK:STDOUT: witness = () // CHECK:STDOUT: // CHECK:STDOUT: !requires: @@ -1099,9 +1061,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a.loc7_16.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Foo.loc15(constants.%a) { -// CHECK:STDOUT: %a.patt.loc15_16.2 => constants.%a.patt -// CHECK:STDOUT: %a.loc15_16.1 => constants.%a +// CHECK:STDOUT: specific @Foo.loc11(constants.%a) { +// CHECK:STDOUT: %a.patt.loc11_16.2 => constants.%a.patt +// CHECK:STDOUT: %a.loc11_16.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Foo.WithSelf(constants.%a, constants.%Self) {} @@ -1171,9 +1133,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a: %C = symbolic_binding a, 0 [symbolic] // CHECK:STDOUT: %Foo.type.bc6a25.1: type = generic_interface_type @Foo.1 [concrete] // CHECK:STDOUT: %Foo.generic.d3ea5a.1: %Foo.type.bc6a25.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc17 [concrete] +// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc13 [concrete] // CHECK:STDOUT: %Foo.generic.d3ea5a.2: %Foo.type.bc6a25.2 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.137: type = facet_type <@Foo.loc17, @Foo.loc17(%a)> [symbolic] +// CHECK:STDOUT: %Foo.type.137: type = facet_type <@Foo.loc13, @Foo.loc13(%a)> [symbolic] // CHECK:STDOUT: %Self: %Foo.type.137 = symbolic_binding Self, 1 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1195,14 +1157,14 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %default.import.loc2_30.2 = import // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C] // CHECK:STDOUT: %D: type = alias_binding D, %C.ref [concrete = constants.%C] -// CHECK:STDOUT: %Foo.decl: %Foo.type.bc6a25.2 = interface_decl @Foo.loc17 [concrete = constants.%Foo.generic.d3ea5a.2] { -// CHECK:STDOUT: %a.patt.loc17_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc17_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %Foo.decl: %Foo.type.bc6a25.2 = interface_decl @Foo.loc13 [concrete = constants.%Foo.generic.d3ea5a.2] { +// CHECK:STDOUT: %a.patt.loc13_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc13_16.2 (constants.%a.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc17: type = splice_block %D.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc13: type = splice_block %D.ref [concrete = constants.%C] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D [concrete = constants.%C] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.loc17_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc17_16.1 (constants.%a)] +// CHECK:STDOUT: %a.loc13_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc13_16.1 (constants.%a)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1213,20 +1175,20 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: interface; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @Foo.loc17(%a.loc17_16.2: %C) { -// CHECK:STDOUT: %a.patt.loc17_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc17_16.2 (constants.%a.patt)] -// CHECK:STDOUT: %a.loc17_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc17_16.1 (constants.%a)] +// CHECK:STDOUT: generic interface @Foo.loc13(%a.loc13_16.2: %C) { +// CHECK:STDOUT: %a.patt.loc13_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc13_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %a.loc13_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc13_16.1 (constants.%a)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc17, @Foo.loc17(%a.loc17_16.1)> [symbolic = %Foo.type (constants.%Foo.type.137)] -// CHECK:STDOUT: %Self.loc17_21.2: @Foo.loc17.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc17_21.2 (constants.%Self)] +// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc13, @Foo.loc13(%a.loc13_16.1)> [symbolic = %Foo.type (constants.%Foo.type.137)] +// CHECK:STDOUT: %Self.loc13_21.2: @Foo.loc13.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc13_21.2 (constants.%Self)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.loc17_21.1: @Foo.loc17.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc17_21.2 (constants.%Self)] -// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc17 [concrete] +// CHECK:STDOUT: %Self.loc13_21.1: @Foo.loc13.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc13_21.2 (constants.%Self)] +// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc13 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.loc17_21.1 +// CHECK:STDOUT: .Self = %Self.loc13_21.1 // CHECK:STDOUT: witness = () // CHECK:STDOUT: // CHECK:STDOUT: !requires: @@ -1245,9 +1207,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Foo.loc17(constants.%a) { -// CHECK:STDOUT: %a.patt.loc17_16.2 => constants.%a.patt -// CHECK:STDOUT: %a.loc17_16.1 => constants.%a +// CHECK:STDOUT: specific @Foo.loc13(constants.%a) { +// CHECK:STDOUT: %a.patt.loc13_16.2 => constants.%a.patt +// CHECK:STDOUT: %a.loc13_16.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Foo.WithSelf(constants.%a, constants.%Self) {} @@ -1266,9 +1228,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a: %const = symbolic_binding a, 0 [symbolic] // CHECK:STDOUT: %Foo.type.bc6a25.1: type = generic_interface_type @Foo.loc6 [concrete] // CHECK:STDOUT: %Foo.generic.d3ea5a.1: %Foo.type.bc6a25.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc18 [concrete] +// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc12 [concrete] // CHECK:STDOUT: %Foo.generic.d3ea5a.2: %Foo.type.bc6a25.2 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.758: type = facet_type <@Foo.loc18, @Foo.loc18(%a)> [symbolic] +// CHECK:STDOUT: %Foo.type.758: type = facet_type <@Foo.loc12, @Foo.loc12(%a)> [symbolic] // CHECK:STDOUT: %Self: %Foo.type.758 = symbolic_binding Self, 1 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1288,16 +1250,16 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: } // CHECK:STDOUT: %a.loc6_16.2: %const = symbolic_binding a, 0 [symbolic = %a.loc6_16.1 (constants.%a)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc18: %Foo.type.bc6a25.2 = interface_decl @Foo.loc18 [concrete = constants.%Foo.generic.d3ea5a.2] { -// CHECK:STDOUT: %a.patt.loc18_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc18_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %Foo.decl.loc12: %Foo.type.bc6a25.2 = interface_decl @Foo.loc12 [concrete = constants.%Foo.generic.d3ea5a.2] { +// CHECK:STDOUT: %a.patt.loc12_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc12_16.2 (constants.%a.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc18: type = splice_block %const.loc18_18 [concrete = constants.%const] { +// CHECK:STDOUT: %.loc12: type = splice_block %const.loc12_18 [concrete = constants.%const] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %const.loc18_25: type = const_type %C.ref [concrete = constants.%const] -// CHECK:STDOUT: %const.loc18_18: type = const_type %const.loc18_25 [concrete = constants.%const] +// CHECK:STDOUT: %const.loc12_25: type = const_type %C.ref [concrete = constants.%const] +// CHECK:STDOUT: %const.loc12_18: type = const_type %const.loc12_25 [concrete = constants.%const] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.loc18_16.2: %const = symbolic_binding a, 0 [symbolic = %a.loc18_16.1 (constants.%a)] +// CHECK:STDOUT: %a.loc12_16.2: %const = symbolic_binding a, 0 [symbolic = %a.loc12_16.1 (constants.%a)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1308,20 +1270,20 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: interface; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @Foo.loc18(%a.loc18_16.2: %const) { -// CHECK:STDOUT: %a.patt.loc18_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc18_16.2 (constants.%a.patt)] -// CHECK:STDOUT: %a.loc18_16.1: %const = symbolic_binding a, 0 [symbolic = %a.loc18_16.1 (constants.%a)] +// CHECK:STDOUT: generic interface @Foo.loc12(%a.loc12_16.2: %const) { +// CHECK:STDOUT: %a.patt.loc12_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc12_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %a.loc12_16.1: %const = symbolic_binding a, 0 [symbolic = %a.loc12_16.1 (constants.%a)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc18, @Foo.loc18(%a.loc18_16.1)> [symbolic = %Foo.type (constants.%Foo.type.758)] -// CHECK:STDOUT: %Self.loc18_35.2: @Foo.loc18.%Foo.type (%Foo.type.758) = symbolic_binding Self, 1 [symbolic = %Self.loc18_35.2 (constants.%Self)] +// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc12, @Foo.loc12(%a.loc12_16.1)> [symbolic = %Foo.type (constants.%Foo.type.758)] +// CHECK:STDOUT: %Self.loc12_35.2: @Foo.loc12.%Foo.type (%Foo.type.758) = symbolic_binding Self, 1 [symbolic = %Self.loc12_35.2 (constants.%Self)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.loc18_35.1: @Foo.loc18.%Foo.type (%Foo.type.758) = symbolic_binding Self, 1 [symbolic = %Self.loc18_35.2 (constants.%Self)] -// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc18 [concrete] +// CHECK:STDOUT: %Self.loc12_35.1: @Foo.loc12.%Foo.type (%Foo.type.758) = symbolic_binding Self, 1 [symbolic = %Self.loc12_35.2 (constants.%Self)] +// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc12 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.loc18_35.1 +// CHECK:STDOUT: .Self = %Self.loc12_35.1 // CHECK:STDOUT: witness = () // CHECK:STDOUT: // CHECK:STDOUT: !requires: @@ -1341,9 +1303,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a.loc6_16.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Foo.loc18(constants.%a) { -// CHECK:STDOUT: %a.patt.loc18_16.2 => constants.%a.patt -// CHECK:STDOUT: %a.loc18_16.1 => constants.%a +// CHECK:STDOUT: specific @Foo.loc12(constants.%a) { +// CHECK:STDOUT: %a.patt.loc12_16.2 => constants.%a.patt +// CHECK:STDOUT: %a.loc12_16.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Foo.WithSelf(constants.%a, constants.%Self) {} diff --git a/toolchain/check/testdata/interop/cpp/basics/cpp_diagnostics.carbon b/toolchain/check/testdata/interop/cpp/basics/cpp_diagnostics.carbon index fea344e8cbaf..4597a2970d5a 100644 --- a/toolchain/check/testdata/interop/cpp/basics/cpp_diagnostics.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/cpp_diagnostics.carbon @@ -22,10 +22,8 @@ library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_cpp_file_with_one_error.carbon:[[@LINE+5]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_import_cpp_file_with_one_error.carbon:[[@LINE+3]]:10 [InCppInclude] // CHECK:STDERR: ./one_error.h:2:2: error: "error1" [CppInteropParseError] -// CHECK:STDERR: 2 | #error "error1" -// CHECK:STDERR: | ^ // CHECK:STDERR: import Cpp library "one_error.h"; @@ -42,15 +40,11 @@ import Cpp library "one_error.h"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_cpp_file_with_multiple_errors.carbon:[[@LINE+10]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_import_cpp_file_with_multiple_errors.carbon:[[@LINE+6]]:10 [InCppInclude] // CHECK:STDERR: ./multiple_errors.h:2:2: error: "error1" [CppInteropParseError] -// CHECK:STDERR: 2 | #error "error1" -// CHECK:STDERR: | ^ // CHECK:STDERR: -// CHECK:STDERR: fail_import_cpp_file_with_multiple_errors.carbon:[[@LINE+5]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_import_cpp_file_with_multiple_errors.carbon:[[@LINE+3]]:10 [InCppInclude] // CHECK:STDERR: ./multiple_errors.h:3:2: error: "error2" [CppInteropParseError] -// CHECK:STDERR: 3 | #error "error2" -// CHECK:STDERR: | ^ // CHECK:STDERR: import Cpp library "multiple_errors.h"; @@ -67,10 +61,8 @@ import Cpp library "multiple_errors.h"; library "[[@TEST_NAME]]"; //@dump-sem-ir-begin -// CHECK:STDERR: import_cpp_file_with_one_warning.carbon:[[@LINE+5]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: import_cpp_file_with_one_warning.carbon:[[@LINE+3]]:10 [InCppInclude] // CHECK:STDERR: ./one_warning.h:2:2: warning: "warning1" [CppInteropParseWarning] -// CHECK:STDERR: 2 | #warning "warning1" -// CHECK:STDERR: | ^ // CHECK:STDERR: import Cpp library "one_warning.h"; //@dump-sem-ir-end @@ -90,20 +82,14 @@ import Cpp library "one_warning.h"; library "[[@TEST_NAME]]"; //@dump-sem-ir-begin -// CHECK:STDERR: import_cpp_file_with_multiple_warnings.carbon:[[@LINE+15]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: import_cpp_file_with_multiple_warnings.carbon:[[@LINE+9]]:10 [InCppInclude] // CHECK:STDERR: ./multiple_warnings.h:2:2: warning: "warning1" [CppInteropParseWarning] -// CHECK:STDERR: 2 | #warning "warning1" -// CHECK:STDERR: | ^ // CHECK:STDERR: -// CHECK:STDERR: import_cpp_file_with_multiple_warnings.carbon:[[@LINE+10]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: import_cpp_file_with_multiple_warnings.carbon:[[@LINE+6]]:10 [InCppInclude] // CHECK:STDERR: ./multiple_warnings.h:3:2: warning: "warning2" [CppInteropParseWarning] -// CHECK:STDERR: 3 | #warning "warning2" -// CHECK:STDERR: | ^ // CHECK:STDERR: -// CHECK:STDERR: import_cpp_file_with_multiple_warnings.carbon:[[@LINE+5]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: import_cpp_file_with_multiple_warnings.carbon:[[@LINE+3]]:10 [InCppInclude] // CHECK:STDERR: ./multiple_warnings.h:4:2: warning: "warning3" [CppInteropParseWarning] -// CHECK:STDERR: 4 | #warning "warning3" -// CHECK:STDERR: | ^ // CHECK:STDERR: import Cpp library "multiple_warnings.h"; //@dump-sem-ir-end @@ -121,15 +107,11 @@ import Cpp library "multiple_warnings.h"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_cpp_file_with_one_error_and_one_warning.carbon:[[@LINE+10]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_import_cpp_file_with_one_error_and_one_warning.carbon:[[@LINE+6]]:10 [InCppInclude] // CHECK:STDERR: ./one_error_and_one_warning.h:2:2: error: "error1" [CppInteropParseError] -// CHECK:STDERR: 2 | #error "error1" -// CHECK:STDERR: | ^ // CHECK:STDERR: -// CHECK:STDERR: fail_import_cpp_file_with_one_error_and_one_warning.carbon:[[@LINE+5]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_import_cpp_file_with_one_error_and_one_warning.carbon:[[@LINE+3]]:10 [InCppInclude] // CHECK:STDERR: ./one_error_and_one_warning.h:3:2: warning: "warning1" [CppInteropParseWarning] -// CHECK:STDERR: 3 | #warning "warning1" -// CHECK:STDERR: | ^ // CHECK:STDERR: import Cpp library "one_error_and_one_warning.h"; @@ -149,30 +131,20 @@ import Cpp library "one_error_and_one_warning.h"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon:[[@LINE+25]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon:[[@LINE+15]]:10 [InCppInclude] // CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:2:2: error: "error1" [CppInteropParseError] -// CHECK:STDERR: 2 | #error "error1" -// CHECK:STDERR: | ^ // CHECK:STDERR: -// CHECK:STDERR: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon:[[@LINE+20]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon:[[@LINE+12]]:10 [InCppInclude] // CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:3:2: error: "error2" [CppInteropParseError] -// CHECK:STDERR: 3 | #error "error2" -// CHECK:STDERR: | ^ // CHECK:STDERR: -// CHECK:STDERR: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon:[[@LINE+15]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon:[[@LINE+9]]:10 [InCppInclude] // CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:4:2: warning: "warning1" [CppInteropParseWarning] -// CHECK:STDERR: 4 | #warning "warning1" -// CHECK:STDERR: | ^ // CHECK:STDERR: -// CHECK:STDERR: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon:[[@LINE+10]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon:[[@LINE+6]]:10 [InCppInclude] // CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:5:2: warning: "warning2" [CppInteropParseWarning] -// CHECK:STDERR: 5 | #warning "warning2" -// CHECK:STDERR: | ^ // CHECK:STDERR: -// CHECK:STDERR: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon:[[@LINE+5]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon:[[@LINE+3]]:10 [InCppInclude] // CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:6:2: warning: "warning3" [CppInteropParseWarning] -// CHECK:STDERR: 6 | #warning "warning3" -// CHECK:STDERR: | ^ // CHECK:STDERR: import Cpp library "multiple_errors_and_multiple_warnings.h"; @@ -195,26 +167,18 @@ import Cpp library "multiple_errors_and_multiple_warnings.h"; library "[[@TEST_NAME]]"; //@dump-sem-ir-begin -// CHECK:STDERR: import_multiple_cpp_files_with_warnings.carbon:[[@LINE+5]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: import_multiple_cpp_files_with_warnings.carbon:[[@LINE+3]]:10 [InCppInclude] // CHECK:STDERR: ./multi_one_warning.h:2:2: warning: "warning1" [CppInteropParseWarning] -// CHECK:STDERR: 2 | #warning "warning1" -// CHECK:STDERR: | ^ // CHECK:STDERR: import Cpp library "multi_one_warning.h"; -// CHECK:STDERR: import_multiple_cpp_files_with_warnings.carbon:[[@LINE+15]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: import_multiple_cpp_files_with_warnings.carbon:[[@LINE+9]]:10 [InCppInclude] // CHECK:STDERR: ./multi_multiple_warnings.h:2:2: warning: "warning1" [CppInteropParseWarning] -// CHECK:STDERR: 2 | #warning "warning1" -// CHECK:STDERR: | ^ // CHECK:STDERR: -// CHECK:STDERR: import_multiple_cpp_files_with_warnings.carbon:[[@LINE+10]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: import_multiple_cpp_files_with_warnings.carbon:[[@LINE+6]]:10 [InCppInclude] // CHECK:STDERR: ./multi_multiple_warnings.h:3:2: warning: "warning2" [CppInteropParseWarning] -// CHECK:STDERR: 3 | #warning "warning2" -// CHECK:STDERR: | ^ // CHECK:STDERR: -// CHECK:STDERR: import_multiple_cpp_files_with_warnings.carbon:[[@LINE+5]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: import_multiple_cpp_files_with_warnings.carbon:[[@LINE+3]]:10 [InCppInclude] // CHECK:STDERR: ./multi_multiple_warnings.h:4:2: warning: "warning3" [CppInteropParseWarning] -// CHECK:STDERR: 4 | #warning "warning3" -// CHECK:STDERR: | ^ // CHECK:STDERR: import Cpp library "multi_multiple_warnings.h"; //@dump-sem-ir-end @@ -240,41 +204,27 @@ import Cpp library "multi_multiple_warnings.h"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+10]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+6]]:10 [InCppInclude] // CHECK:STDERR: ./multi_one_error_and_one_warning.h:2:2: error: "error1" [CppInteropParseError] -// CHECK:STDERR: 2 | #error "error1" -// CHECK:STDERR: | ^ // CHECK:STDERR: -// CHECK:STDERR: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+5]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+3]]:10 [InCppInclude] // CHECK:STDERR: ./multi_one_error_and_one_warning.h:3:2: warning: "warning1" [CppInteropParseWarning] -// CHECK:STDERR: 3 | #warning "warning1" -// CHECK:STDERR: | ^ // CHECK:STDERR: import Cpp library "multi_one_error_and_one_warning.h"; -// CHECK:STDERR: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+25]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+15]]:10 [InCppInclude] // CHECK:STDERR: ./multi_multiple_errors_and_multiple_warnings.h:2:2: error: "error1" [CppInteropParseError] -// CHECK:STDERR: 2 | #error "error1" -// CHECK:STDERR: | ^ // CHECK:STDERR: -// CHECK:STDERR: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+20]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+12]]:10 [InCppInclude] // CHECK:STDERR: ./multi_multiple_errors_and_multiple_warnings.h:3:2: error: "error2" [CppInteropParseError] -// CHECK:STDERR: 3 | #error "error2" -// CHECK:STDERR: | ^ // CHECK:STDERR: -// CHECK:STDERR: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+15]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+9]]:10 [InCppInclude] // CHECK:STDERR: ./multi_multiple_errors_and_multiple_warnings.h:4:2: warning: "warning1" [CppInteropParseWarning] -// CHECK:STDERR: 4 | #warning "warning1" -// CHECK:STDERR: | ^ // CHECK:STDERR: -// CHECK:STDERR: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+10]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+6]]:10 [InCppInclude] // CHECK:STDERR: ./multi_multiple_errors_and_multiple_warnings.h:5:2: warning: "warning2" [CppInteropParseWarning] -// CHECK:STDERR: 5 | #warning "warning2" -// CHECK:STDERR: | ^ // CHECK:STDERR: -// CHECK:STDERR: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+5]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+3]]:10 [InCppInclude] // CHECK:STDERR: ./multi_multiple_errors_and_multiple_warnings.h:6:2: warning: "warning3" [CppInteropParseWarning] -// CHECK:STDERR: 6 | #warning "warning3" -// CHECK:STDERR: | ^ // CHECK:STDERR: import Cpp library "multi_multiple_errors_and_multiple_warnings.h"; @@ -294,11 +244,9 @@ import Cpp library "multi_multiple_errors_and_multiple_warnings.h"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_indirect_error.carbon:[[@LINE+6]]:10: in file included here [InCppInclude] -// CHECK:STDERR: ./indirect_error.h:2:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_import_indirect_error.carbon:[[@LINE+4]]:10 [InCppInclude] +// CHECK:STDERR: included from: ./indirect_error.h:2:10 [InCppInclude] // CHECK:STDERR: ./indirect_one_error.h:2:2: error: "error1" [CppInteropParseError] -// CHECK:STDERR: 2 | #error "error1" -// CHECK:STDERR: | ^ // CHECK:STDERR: import Cpp library "indirect_error.h"; @@ -319,11 +267,9 @@ import Cpp library "indirect_error.h"; library "[[@TEST_NAME]]"; //@dump-sem-ir-begin -// CHECK:STDERR: import_indirect_warning.carbon:[[@LINE+6]]:10: in file included here [InCppInclude] -// CHECK:STDERR: ./indirect_warning.h:2:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: import_indirect_warning.carbon:[[@LINE+4]]:10 [InCppInclude] +// CHECK:STDERR: included from: ./indirect_warning.h:2:10 [InCppInclude] // CHECK:STDERR: ./indirect_one_warning.h:2:2: warning: "warning1" [CppInteropParseWarning] -// CHECK:STDERR: 2 | #warning "warning1" -// CHECK:STDERR: | ^ // CHECK:STDERR: import Cpp library "indirect_warning.h"; //@dump-sem-ir-end @@ -343,14 +289,10 @@ library "[[@TEST_NAME]]"; //!Lexer error: whitespace is required after the comment introducer. // TODO: Move this warning to be after the lexer error. -// CHECK:STDERR: fail_import_cpp_library_lexer_error.carbon:[[@LINE+9]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_import_cpp_library_lexer_error.carbon:[[@LINE+5]]:10 [InCppInclude] // CHECK:STDERR: ./lexer_error_one_warning.h:2:2: warning: "warning1" [CppInteropParseWarning] -// CHECK:STDERR: 2 | #warning "warning1" -// CHECK:STDERR: | ^ // CHECK:STDERR: -// CHECK:STDERR: fail_import_cpp_library_lexer_error.carbon:[[@LINE-8]]:3: error: whitespace is required after '//' [NoWhitespaceAfterCommentIntroducer] -// CHECK:STDERR: //!Lexer error: whitespace is required after the comment introducer. -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_import_cpp_library_lexer_error.carbon:[[@LINE-6]]:3: error: whitespace is required after '//' [NoWhitespaceAfterCommentIntroducer] // CHECK:STDERR: import Cpp library "lexer_error_one_warning.h"; @@ -366,18 +308,14 @@ double score = 0.1 library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_fix_it_hints.carbon:[[@LINE+6]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_import_fix_it_hints.carbon:[[@LINE+4]]:10 [InCppInclude] // CHECK:STDERR: ./fix_it_hints.h:2:19: error: expected ';' after top level declarator [CppInteropParseError] -// CHECK:STDERR: 2 | double score = 0.1 -// CHECK:STDERR: | ^ -// CHECK:STDERR: | ; +// CHECK:STDERR: ./fix_it_hints.h:2:19: note: insert `;` here [CppInteropFixItInsertion] // CHECK:STDERR: import Cpp library "fix_it_hints.h"; fn F() { - // CHECK:STDERR: fail_import_fix_it_hints.carbon:[[@LINE+4]]:3: error: member name `foo` not found in `Cpp` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: Cpp.foo(); - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_import_fix_it_hints.carbon:[[@LINE+2]]:3-9: error: member name `foo` not found in `Cpp` [MemberNameNotFoundInInstScope] // CHECK:STDERR: Cpp.foo(); } @@ -398,14 +336,10 @@ inline void call_foobar() { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_with_notes.carbon:[[@LINE+9]]:10: in file included here [InCppInclude] -// CHECK:STDERR: ./with_notes.h:5:3: error: no matching function for call to 'foobar' [CppInteropParseError] -// CHECK:STDERR: 5 | foobar(1, 2); -// CHECK:STDERR: | ^~~~~~ -// CHECK:STDERR: fail_with_notes.carbon:[[@LINE+5]]:10: in file included here [InCppInclude] -// CHECK:STDERR: ./with_notes.h:2:6: note: candidate function not viable: requires 1 argument, but 2 were provided [CppInteropParseNote] -// CHECK:STDERR: 2 | void foobar(int); -// CHECK:STDERR: | ^ ~~~ +// CHECK:STDERR: included from: fail_with_notes.carbon:[[@LINE+5]]:10 [InCppInclude] +// CHECK:STDERR: ./with_notes.h:5:3-8: error: no matching function for call to 'foobar' [CppInteropParseError] +// CHECK:STDERR: ./with_notes.h:2:6: note: candidate function not viable [CppInteropParseNote] +// CHECK:STDERR: ./with_notes.h:2:13-15: note: requires 1 argument, but 2 were provided [CppInteropParseNoteReason] // CHECK:STDERR: import Cpp library "with_notes.h"; @@ -434,20 +368,12 @@ FOO library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_use_context_stack.carbon:[[@LINE+15]]:10: in file included here [InCppInclude] -// CHECK:STDERR: ./direct_include.h:4:10: in file included here [InCppInclude] -// CHECK:STDERR: ./indirect_include.h:2:13: in expansion of macro defined here [InCppMacroExpansion] -// CHECK:STDERR: ./direct_include.h:2:13: in expansion of macro defined here [InCppMacroExpansion] -// CHECK:STDERR: ./indirect_include.h:3:20: in expansion of macro defined here [InCppMacroExpansion] +// CHECK:STDERR: included from: fail_use_context_stack.carbon:[[@LINE+7]]:10 [InCppInclude] +// CHECK:STDERR: included from: ./direct_include.h:4:10 [InCppInclude] +// CHECK:STDERR: expanded from macro defined at: ./indirect_include.h:2:13 [InCppMacroExpansion] +// CHECK:STDERR: expanded from macro defined at: ./direct_include.h:2:13 [InCppMacroExpansion] +// CHECK:STDERR: expanded from macro defined at: ./indirect_include.h:3:20 [InCppMacroExpansion] // CHECK:STDERR: ./indirect_include.h:5:1: error: unknown type name 'error' [CppInteropParseError] -// CHECK:STDERR: 5 | FOO -// CHECK:STDERR: | ^ -// CHECK:STDERR: 2 | #define FOO BAR -// CHECK:STDERR: | ^ -// CHECK:STDERR: 2 | #define BAR BAZ -// CHECK:STDERR: | ^ -// CHECK:STDERR: 3 | #define BAZ void f(error); -// CHECK:STDERR: | ^ // CHECK:STDERR: import Cpp library "direct_include.h"; @@ -459,9 +385,7 @@ import Cpp library "direct_include.h"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_loc_in_inline_simple.carbon:[[@LINE+4]]:9: error: use of undeclared identifier 'banana' [CppInteropParseError] -// CHECK:STDERR: 8 | int n = banana; -// CHECK:STDERR: | ^~~~~~ +// CHECK:STDERR: fail_loc_in_inline_simple.carbon:[[@LINE+2]]:9-14: error: use of undeclared identifier 'banana' [CppInteropParseError] // CHECK:STDERR: import Cpp inline "int n = banana;"; @@ -469,12 +393,8 @@ import Cpp inline "int n = banana;"; import Cpp inline '''c++ void f(const int n) { - // CHECK:STDERR: fail_loc_in_inline_block.carbon:[[@LINE+7]]:3: error: cannot assign to variable 'n' with const-qualified type 'const int' [CppInteropParseError] - // CHECK:STDERR: 11 | ++n; - // CHECK:STDERR: | ^ ~ - // CHECK:STDERR: fail_loc_in_inline_block.carbon:[[@LINE-4]]:18: note: variable 'n' declared const here [CppInteropParseNote] - // CHECK:STDERR: 3 | void f(const int n) { - // CHECK:STDERR: | ~~~~~~~~~~^ + // CHECK:STDERR: fail_loc_in_inline_block.carbon:[[@LINE+3]]:3: error: cannot assign to variable 'n' with const-qualified type 'const int' [CppInteropParseError] + // CHECK:STDERR: fail_loc_in_inline_block.carbon:[[@LINE-2]]:8-18: note: variable 'n' declared const here [CppInteropParseNote] // CHECK:STDERR: ++n; } diff --git a/toolchain/check/testdata/interop/cpp/basics/fail_import_fix_its.carbon b/toolchain/check/testdata/interop/cpp/basics/fail_import_fix_its.carbon new file mode 100644 index 000000000000..de589f327a8f --- /dev/null +++ b/toolchain/check/testdata/interop/cpp/basics/fail_import_fix_its.carbon @@ -0,0 +1,72 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon +// EXTRA-ARGS: --target=x86_64-linux-gnu --clang-arg=-std=c++20 --clang-arg=-Wextra-semi +// +// AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/basics/fail_import_fix_its.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/basics/fail_import_fix_its.carbon + +// Covers the three shapes a Clang fix-it comes in, each of which becomes a +// label saying what to do rather than the inline rendering Clang would draw. +// +// TODO: Remove the `extra ';'` warning on `` that every +// file here gets. It comes from the `;` that `InitializeCppDomain` puts in the +// main file, not from any code here, and only shows because of `-Wextra-semi`. + +// --- replacement.h + +int variable_name; +int other = varable_name; + +// --- fail_import_replacement.carbon + +library "[[@TEST_NAME]]"; + +// CHECK:STDERR: :1:1: warning: extra ';' outside of a function is incompatible with C++98 [CppInteropParseWarning] +// CHECK:STDERR: :1:1: note: remove this [CppInteropFixItRemoval] +// CHECK:STDERR: +// CHECK:STDERR: included from: fail_import_replacement.carbon:[[@LINE+5]]:10 [InCppInclude] +// CHECK:STDERR: ./replacement.h:3:13-24: error: use of undeclared identifier 'varable_name'; did you mean 'variable_name'? [CppInteropParseError] +// CHECK:STDERR: ./replacement.h:3:13-24: note: replace with `variable_name` [CppInteropFixItReplacement] +// CHECK:STDERR: ./replacement.h:2:5: note: 'variable_name' declared here [CppInteropParseNote] +// CHECK:STDERR: +import Cpp library "replacement.h"; + +// --- removal.h + +struct WithExtraSemi {};; + +// --- import_removal.carbon + +library "[[@TEST_NAME]]"; + +// CHECK:STDERR: :1:1: warning: extra ';' outside of a function is incompatible with C++98 [CppInteropParseWarning] +// CHECK:STDERR: :1:1: note: remove this [CppInteropFixItRemoval] +// CHECK:STDERR: +// CHECK:STDERR: included from: import_removal.carbon:[[@LINE+4]]:10 [InCppInclude] +// CHECK:STDERR: ./removal.h:2:25: warning: extra ';' outside of a function is incompatible with C++98 [CppInteropParseWarning] +// CHECK:STDERR: ./removal.h:2:25: note: remove this [CppInteropFixItRemoval] +// CHECK:STDERR: +import Cpp library "removal.h"; + +// --- insertion.h + +double missing_semicolon = 0.1 + +// --- fail_import_insertion.carbon + +library "[[@TEST_NAME]]"; + +// CHECK:STDERR: :1:1: warning: extra ';' outside of a function is incompatible with C++98 [CppInteropParseWarning] +// CHECK:STDERR: :1:1: note: remove this [CppInteropFixItRemoval] +// CHECK:STDERR: +// CHECK:STDERR: included from: fail_import_insertion.carbon:[[@LINE+4]]:10 [InCppInclude] +// CHECK:STDERR: ./insertion.h:2:31: error: expected ';' after top level declarator [CppInteropParseError] +// CHECK:STDERR: ./insertion.h:2:31: note: insert `;` here [CppInteropFixItInsertion] +// CHECK:STDERR: +import Cpp library "insertion.h"; diff --git a/toolchain/check/testdata/interop/cpp/basics/import/bad_import.carbon b/toolchain/check/testdata/interop/cpp/basics/import/bad_import.carbon index 00eb8a0d6642..bb615e7ed4f0 100644 --- a/toolchain/check/testdata/interop/cpp/basics/import/bad_import.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/import/bad_import.carbon @@ -16,19 +16,13 @@ library "[[@TEST_NAME]]"; import Cpp inline '''c++ // CHECK:STDERR: :1:2: error: expected '}' [CppInteropParseError] -// CHECK:STDERR: 1 | ; -// CHECK:STDERR: | ^ -// CHECK:STDERR: fail_unterminated_import_inline.carbon:[[@LINE+4]]:10: note: to match this '{' [CppInteropParseNote] -// CHECK:STDERR: 12 | void f() { -// CHECK:STDERR: | ^ +// CHECK:STDERR: fail_unterminated_import_inline.carbon:[[@LINE+2]]:10: note: to match this '{' [CppInteropParseNote] // CHECK:STDERR: void f() { '''; import Cpp inline '''c++ -// CHECK:STDERR: fail_unterminated_import_inline.carbon:[[@LINE+4]]:1: error: extraneous closing brace ('}') [CppInteropParseError] -// CHECK:STDERR: 20 | } -// CHECK:STDERR: | ^ +// CHECK:STDERR: fail_unterminated_import_inline.carbon:[[@LINE+2]]:1: error: extraneous closing brace ('}') [CppInteropParseError] // CHECK:STDERR: } '''; @@ -37,13 +31,9 @@ import Cpp inline '''c++ library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_cpp_library_without_name_and_inline_without_content.carbon:[[@LINE+8]]:20: error: expected a string literal to specify the library name [ExpectedLibraryName] -// CHECK:STDERR: import Cpp library inline; -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_import_cpp_library_without_name_and_inline_without_content.carbon:[[@LINE+4]]:20-25: error: expected a string literal to specify the library name [ExpectedLibraryName] // CHECK:STDERR: -// CHECK:STDERR: fail_import_cpp_library_without_name_and_inline_without_content.carbon:[[@LINE+4]]:20: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] -// CHECK:STDERR: import Cpp library inline; -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_import_cpp_library_without_name_and_inline_without_content.carbon:[[@LINE+2]]:20-25: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: import Cpp library inline; @@ -51,13 +41,9 @@ import Cpp library inline; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_cpp_library_with_name_and_inline_without_content.carbon:[[@LINE+8]]:28: error: `import` declarations must end with a `;` [ExpectedDeclSemi] -// CHECK:STDERR: import Cpp library "foo.h" inline; -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_import_cpp_library_with_name_and_inline_without_content.carbon:[[@LINE+4]]:28-33: error: `import` declarations must end with a `;` [ExpectedDeclSemi] // CHECK:STDERR: -// CHECK:STDERR: fail_import_cpp_library_with_name_and_inline_without_content.carbon:[[@LINE+4]]:1: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] -// CHECK:STDERR: import Cpp library "foo.h" inline; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_import_cpp_library_with_name_and_inline_without_content.carbon:[[@LINE+2]]:1-34: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: import Cpp library "foo.h" inline; @@ -65,13 +51,9 @@ import Cpp library "foo.h" inline; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_cpp_library_without_name_and_inline_with_content.carbon:[[@LINE+8]]:20: error: expected a string literal to specify the library name [ExpectedLibraryName] -// CHECK:STDERR: import Cpp library inline ""; -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_import_cpp_library_without_name_and_inline_with_content.carbon:[[@LINE+4]]:20-25: error: expected a string literal to specify the library name [ExpectedLibraryName] // CHECK:STDERR: -// CHECK:STDERR: fail_import_cpp_library_without_name_and_inline_with_content.carbon:[[@LINE+4]]:20: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] -// CHECK:STDERR: import Cpp library inline ""; -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_import_cpp_library_without_name_and_inline_with_content.carbon:[[@LINE+2]]:20-25: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: import Cpp library inline ""; @@ -79,12 +61,8 @@ import Cpp library inline ""; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_cpp_library_with_name_and_inline_with_content.carbon:[[@LINE+8]]:28: error: `import` declarations must end with a `;` [ExpectedDeclSemi] -// CHECK:STDERR: import Cpp library "foo.h" inline ""; -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_import_cpp_library_with_name_and_inline_with_content.carbon:[[@LINE+4]]:28-33: error: `import` declarations must end with a `;` [ExpectedDeclSemi] // CHECK:STDERR: -// CHECK:STDERR: fail_import_cpp_library_with_name_and_inline_with_content.carbon:[[@LINE+4]]:1: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] -// CHECK:STDERR: import Cpp library "foo.h" inline ""; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_import_cpp_library_with_name_and_inline_with_content.carbon:[[@LINE+2]]:1-37: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: import Cpp library "foo.h" inline ""; diff --git a/toolchain/check/testdata/interop/cpp/basics/import/bad_import_empty.carbon b/toolchain/check/testdata/interop/cpp/basics/import/bad_import_empty.carbon index 57505070d434..19103653d1fc 100644 --- a/toolchain/check/testdata/interop/cpp/basics/import/bad_import_empty.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/import/bad_import_empty.carbon @@ -18,8 +18,6 @@ library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_cpp_library_empty.carbon:[[@LINE+4]]:10: error: empty filename [CppInteropParseError] -// CHECK:STDERR: 8 | #include "" -// CHECK:STDERR: | ^ +// CHECK:STDERR: fail_import_cpp_library_empty.carbon:[[@LINE+2]]:10: error: empty filename [CppInteropParseError] // CHECK:STDERR: import Cpp library ""; diff --git a/toolchain/check/testdata/interop/cpp/basics/import/bad_import_nested_quotes.carbon b/toolchain/check/testdata/interop/cpp/basics/import/bad_import_nested_quotes.carbon index e3c4704a1bc9..ce84b3ae0d34 100644 --- a/toolchain/check/testdata/interop/cpp/basics/import/bad_import_nested_quotes.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/import/bad_import_nested_quotes.carbon @@ -20,18 +20,12 @@ library "[[@TEST_NAME]]"; // TODO: Translate the file to a `#include` that includes the named file // properly. `\` escapes aren't processed in regular `#include`s. -// CHECK:STDERR: fail_todo_import_cpp_library_file_with_quotes.carbon:[[@LINE+14]]:10: error: '\' file not found [CppInteropParseError] -// CHECK:STDERR: 20 | #include "\"foo.h\"" -// CHECK:STDERR: | ^~~ +// CHECK:STDERR: fail_todo_import_cpp_library_file_with_quotes.carbon:[[@LINE+8]]:10-12: error: '\' file not found [CppInteropParseError] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_import_cpp_library_file_with_quotes.carbon:[[@LINE+10]]:13: error: invalid suffix on literal; C++11 requires a space between literal and identifier [CppInteropParseError] -// CHECK:STDERR: 20 | #include "\"foo.h\"" -// CHECK:STDERR: | ^ -// CHECK:STDERR: | {{}} +// CHECK:STDERR: fail_todo_import_cpp_library_file_with_quotes.carbon:[[@LINE+6]]:13: error: invalid suffix on literal; C++11 requires a space between literal and identifier [CppInteropParseError] +// CHECK:STDERR: fail_todo_import_cpp_library_file_with_quotes.carbon:[[@LINE+5]]:13: note: insert ` ` here [CppInteropFixItInsertion] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_import_cpp_library_file_with_quotes.carbon:[[@LINE+5]]:13: warning: extra tokens at end of #include directive [CppInteropParseWarning] -// CHECK:STDERR: 20 | #include "\"foo.h\"" -// CHECK:STDERR: | ^ -// CHECK:STDERR: | // +// CHECK:STDERR: fail_todo_import_cpp_library_file_with_quotes.carbon:[[@LINE+3]]:13: warning: extra tokens at end of #include directive [CppInteropParseWarning] +// CHECK:STDERR: fail_todo_import_cpp_library_file_with_quotes.carbon:[[@LINE+2]]:13: note: insert `//` here [CppInteropFixItInsertion] // CHECK:STDERR: import Cpp library "\"foo.h\""; diff --git a/toolchain/check/testdata/interop/cpp/basics/import/bad_import_not_found.carbon b/toolchain/check/testdata/interop/cpp/basics/import/bad_import_not_found.carbon index 9516f9842ac6..c5832dffa655 100644 --- a/toolchain/check/testdata/interop/cpp/basics/import/bad_import_not_found.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/import/bad_import_not_found.carbon @@ -18,8 +18,6 @@ library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_cpp_file_not_found.carbon:[[@LINE+4]]:10: error: 'not_found.h' file not found [CppInteropParseError] -// CHECK:STDERR: 8 | #include "not_found.h" -// CHECK:STDERR: | ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_cpp_file_not_found.carbon:[[@LINE+2]]:10-22: error: 'not_found.h' file not found [CppInteropParseError] // CHECK:STDERR: import Cpp library "not_found.h"; diff --git a/toolchain/check/testdata/interop/cpp/basics/import/cpp_namespace.carbon b/toolchain/check/testdata/interop/cpp/basics/import/cpp_namespace.carbon index 939f8256f77a..4239b7a64d23 100644 --- a/toolchain/check/testdata/interop/cpp/basics/import/cpp_namespace.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/import/cpp_namespace.carbon @@ -20,13 +20,9 @@ library "[[@TEST_NAME]]"; import Cpp library "header.h"; -// CHECK:STDERR: fail_duplicate_cpp_name.carbon:[[@LINE+8]]:11: error: `namespace` introducer should be followed by a name [ExpectedDeclName] -// CHECK:STDERR: namespace Cpp; -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_duplicate_cpp_name.carbon:[[@LINE+4]]:11-13: error: `namespace` introducer should be followed by a name [ExpectedDeclName] // CHECK:STDERR: -// CHECK:STDERR: fail_duplicate_cpp_name.carbon:[[@LINE+4]]:11: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] -// CHECK:STDERR: namespace Cpp; -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_duplicate_cpp_name.carbon:[[@LINE+2]]:11-13: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: namespace Cpp; @@ -37,13 +33,9 @@ library "[[@TEST_NAME]]"; import Cpp library "header.h"; namespace N; -// CHECK:STDERR: fail_cpp_in_inner_namespace.carbon:[[@LINE+8]]:13: error: `.` should be followed by a name [ExpectedDeclNameAfterPeriod] -// CHECK:STDERR: namespace N.Cpp; -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_cpp_in_inner_namespace.carbon:[[@LINE+4]]:13-15: error: `.` should be followed by a name [ExpectedDeclNameAfterPeriod] // CHECK:STDERR: -// CHECK:STDERR: fail_cpp_in_inner_namespace.carbon:[[@LINE+4]]:13: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] -// CHECK:STDERR: namespace N.Cpp; -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_cpp_in_inner_namespace.carbon:[[@LINE+2]]:13-15: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: namespace N.Cpp; @@ -63,13 +55,9 @@ library "[[@TEST_NAME]]"; import Cpp library "header.h"; -// CHECK:STDERR: fail_add_name_to_cpp_namespace.carbon:[[@LINE+8]]:7: error: `class` introducer should be followed by a name [ExpectedDeclName] -// CHECK:STDERR: class Cpp.C {}; -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_add_name_to_cpp_namespace.carbon:[[@LINE+4]]:7-9: error: `class` introducer should be followed by a name [ExpectedDeclName] // CHECK:STDERR: -// CHECK:STDERR: fail_add_name_to_cpp_namespace.carbon:[[@LINE+4]]:7: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] -// CHECK:STDERR: class Cpp.C {}; -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_add_name_to_cpp_namespace.carbon:[[@LINE+2]]:7-9: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: class Cpp.C {}; diff --git a/toolchain/check/testdata/interop/cpp/basics/import/fail_fuzzing.carbon b/toolchain/check/testdata/interop/cpp/basics/import/fail_fuzzing.carbon index fa4c714bd70e..9aa75882e13c 100644 --- a/toolchain/check/testdata/interop/cpp/basics/import/fail_fuzzing.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/import/fail_fuzzing.carbon @@ -11,8 +11,6 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/basics/import/fail_fuzzing.carbon -// CHECK:STDERR: fail_fuzzing.carbon:[[@LINE+4]]:1: error: `Cpp` import found during fuzzing [CppInteropFuzzing] -// CHECK:STDERR: import Cpp library "file.h"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_fuzzing.carbon:[[@LINE+2]]:1-28: error: `Cpp` import found during fuzzing [CppInteropFuzzing] // CHECK:STDERR: import Cpp library "file.h"; diff --git a/toolchain/check/testdata/interop/cpp/basics/import/import.carbon b/toolchain/check/testdata/interop/cpp/basics/import/import.carbon index debf9d53a66e..d11aff42013b 100644 --- a/toolchain/check/testdata/interop/cpp/basics/import/import.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/import/import.carbon @@ -30,11 +30,9 @@ alias MyStructAlias = Cpp.MyStruct; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_todo_import_struct_api.carbon:[[@LINE+6]]:1: in import [InImport] -// CHECK:STDERR: struct_api.carbon:4:10: in file included here [InCppInclude] +// CHECK:STDERR: imported from: fail_todo_import_struct_api.carbon:[[@LINE+4]]:1 [InImport] +// CHECK:STDERR: included from: struct_api.carbon:4:10 [InCppInclude] // CHECK:STDERR: ./struct.h:2:8: error: semantics TODO: `indirect import of C++ declaration with no direct Cpp import` [SemanticsTodo] -// CHECK:STDERR: struct MyStruct { void Foo(); }; -// CHECK:STDERR: ^ // CHECK:STDERR: import library "struct_api"; diff --git a/toolchain/check/testdata/interop/cpp/basics/import/indirect.carbon b/toolchain/check/testdata/interop/cpp/basics/import/indirect.carbon index 643b4f27de26..61c772615e43 100644 --- a/toolchain/check/testdata/interop/cpp/basics/import/indirect.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/import/indirect.carbon @@ -89,13 +89,9 @@ namespace A { fn TryToUseNotLeaked() { // TODO: Clang's diagnostic for using a class whose definition is not // reachable is confusing. - // CHECK:STDERR: fail_not_leaked.carbon:[[@LINE+8]]:17: error: binding pattern has incomplete type `X` in name binding declaration [IncompleteTypeInBindingDecl] - // CHECK:STDERR: var unused x: Cpp.A.X = 0; - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: direct_import.carbon:4:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_not_leaked.carbon:[[@LINE+4]]:17-23: error: binding pattern has incomplete type `X` in name binding declaration [IncompleteTypeInBindingDecl] + // CHECK:STDERR: included from: direct_import.carbon:4:10 [InCppInclude] // CHECK:STDERR: ./shared.h:3:10: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: struct X { - // CHECK:STDERR: ^ // CHECK:STDERR: var unused x: Cpp.A.X = 0; } diff --git a/toolchain/check/testdata/interop/cpp/basics/inline/decl.carbon b/toolchain/check/testdata/interop/cpp/basics/inline/decl.carbon index 96dbe7597629..e3189aced96e 100644 --- a/toolchain/check/testdata/interop/cpp/basics/inline/decl.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/inline/decl.carbon @@ -45,12 +45,8 @@ void f() {} '''; inline Cpp ''' -// CHECK:STDERR: fail_redefinition.carbon:[[@LINE+7]]:6: error: redefinition of 'f' [CppInteropParseError] -// CHECK:STDERR: 18 | void f() {} -// CHECK:STDERR: | ^ -// CHECK:STDERR: fail_redefinition.carbon:[[@LINE-7]]:6: note: previous definition is here [CppInteropParseNote] -// CHECK:STDERR: 7 | void f() {} -// CHECK:STDERR: | ^ +// CHECK:STDERR: fail_redefinition.carbon:[[@LINE+3]]:6: error: redefinition of 'f' [CppInteropParseError] +// CHECK:STDERR: fail_redefinition.carbon:[[@LINE-5]]:6: note: previous definition is here [CppInteropParseNote] // CHECK:STDERR: void f() {} '''; @@ -61,17 +57,13 @@ library "[[@TEST_NAME]]"; import Cpp; -// CHECK:STDERR: fail_diag_location.carbon:[[@LINE+4]]:12: error: use of undeclared identifier 'undeclared' [CppInteropParseError] -// CHECK:STDERR: 10 | void f() { undeclared = 0; } -// CHECK:STDERR: | ^~~~~~~~~~ +// CHECK:STDERR: fail_diag_location.carbon:[[@LINE+2]]:12-21: error: use of undeclared identifier 'undeclared' [CppInteropParseError] // CHECK:STDERR: inline Cpp "void f() { undeclared = 0; }"; inline Cpp ''' void g() { - // CHECK:STDERR: fail_diag_location.carbon:[[@LINE+4]]:3: error: use of undeclared identifier 'undeclared' [CppInteropParseError] - // CHECK:STDERR: 18 | undeclared = 0; - // CHECK:STDERR: | ^~~~~~~~~~ + // CHECK:STDERR: fail_diag_location.carbon:[[@LINE+2]]:3-12: error: use of undeclared identifier 'undeclared' [CppInteropParseError] // CHECK:STDERR: undeclared = 0; } @@ -81,9 +73,7 @@ void g() { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_inline_no_import.carbon:[[@LINE+4]]:8: error: name `Cpp` not found [NameNotFound] -// CHECK:STDERR: inline Cpp ""; -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_inline_no_import.carbon:[[@LINE+2]]:8-10: error: name `Cpp` not found [NameNotFound] // CHECK:STDERR: inline Cpp ""; @@ -94,33 +84,25 @@ library "[[@TEST_NAME]]"; import Cpp; class C { - // CHECK:STDERR: fail_nested.carbon:[[@LINE+4]]:3: error: `inline Cpp` declaration not at file scope [InlineDeclNotAtFileScope] - // CHECK:STDERR: inline Cpp ""; - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_nested.carbon:[[@LINE+2]]:3-16: error: `inline Cpp` declaration not at file scope [InlineDeclNotAtFileScope] // CHECK:STDERR: inline Cpp ""; } interface I { - // CHECK:STDERR: fail_nested.carbon:[[@LINE+4]]:3: error: `inline Cpp` declaration not at file scope [InlineDeclNotAtFileScope] - // CHECK:STDERR: inline Cpp ""; - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_nested.carbon:[[@LINE+2]]:3-16: error: `inline Cpp` declaration not at file scope [InlineDeclNotAtFileScope] // CHECK:STDERR: inline Cpp ""; } constraint N { - // CHECK:STDERR: fail_nested.carbon:[[@LINE+4]]:3: error: `inline Cpp` declaration not at file scope [InlineDeclNotAtFileScope] - // CHECK:STDERR: inline Cpp ""; - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_nested.carbon:[[@LINE+2]]:3-16: error: `inline Cpp` declaration not at file scope [InlineDeclNotAtFileScope] // CHECK:STDERR: inline Cpp ""; } impl C as I { - // CHECK:STDERR: fail_nested.carbon:[[@LINE+4]]:3: error: `inline Cpp` declaration not at file scope [InlineDeclNotAtFileScope] - // CHECK:STDERR: inline Cpp ""; - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_nested.carbon:[[@LINE+2]]:3-16: error: `inline Cpp` declaration not at file scope [InlineDeclNotAtFileScope] // CHECK:STDERR: inline Cpp ""; } @@ -129,13 +111,9 @@ impl C as I { fn F() { // TODO: Should this be a check error rather than a parse error? - // CHECK:STDERR: fail_nested_fn.carbon:[[@LINE+8]]:3: error: expected expression [ExpectedExpr] - // CHECK:STDERR: inline Cpp ""; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_nested_fn.carbon:[[@LINE+4]]:3-8: error: expected expression [ExpectedExpr] // CHECK:STDERR: - // CHECK:STDERR: fail_nested_fn.carbon:[[@LINE+4]]:3: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] - // CHECK:STDERR: inline Cpp ""; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_nested_fn.carbon:[[@LINE+2]]:3-8: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: inline Cpp ""; } diff --git a/toolchain/check/testdata/interop/cpp/basics/inline/modules.carbon b/toolchain/check/testdata/interop/cpp/basics/inline/modules.carbon index 985ee80821cc..9dcfa4854464 100644 --- a/toolchain/check/testdata/interop/cpp/basics/inline/modules.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/inline/modules.carbon @@ -17,16 +17,11 @@ library "[[@TEST_NAME]]"; // TODO: This diagnostic isn't very good. import Cpp inline ''' -// CHECK:STDERR: fail_export_module_in_inline_cpp.carbon:[[@LINE+11]]:8: error: module declaration must not come from an #include directive [CppInteropParseError] -// CHECK:STDERR: 17 | export module Foo; -// CHECK:STDERR: | ^~~~~~~~~~~ +// CHECK:STDERR: fail_export_module_in_inline_cpp.carbon:[[@LINE+6]]:8-18: error: module declaration must not come from an #include directive [CppInteropParseError] // CHECK:STDERR: -// CHECK:STDERR: fail_export_module_in_inline_cpp.carbon:[[@LINE+7]]:8: error: module declaration must occur at the start of the translation unit [CppInteropParseError] -// CHECK:STDERR: 17 | export module Foo; -// CHECK:STDERR: | ^ +// CHECK:STDERR: fail_export_module_in_inline_cpp.carbon:[[@LINE+4]]:8: error: module declaration must occur at the start of the translation unit [CppInteropParseError] // CHECK:STDERR: :1:1: note: add 'module;' to the start of the file to introduce a global module fragment [CppInteropParseNote] -// CHECK:STDERR: 1 | ; -// CHECK:STDERR: | ^ +// CHECK:STDERR: :1:1: note: insert `module; ` here [CppInteropFixItInsertion] // CHECK:STDERR: export module Foo; '''; @@ -37,20 +32,13 @@ library "[[@TEST_NAME]]"; // TODO: This diagnostic isn't very good. import Cpp inline ''' -// CHECK:STDERR: fail_module_in_inline_cpp.carbon:[[@LINE+15]]:1: error: module declaration must not come from an #include directive [CppInteropParseError] -// CHECK:STDERR: 21 | module Bar; -// CHECK:STDERR: | ^~~~~~~~~~~ +// CHECK:STDERR: fail_module_in_inline_cpp.carbon:[[@LINE+8]]:1-11: error: module declaration must not come from an #include directive [CppInteropParseError] // CHECK:STDERR: -// CHECK:STDERR: fail_module_in_inline_cpp.carbon:[[@LINE+11]]:1: error: module declaration must occur at the start of the translation unit [CppInteropParseError] -// CHECK:STDERR: 21 | module Bar; -// CHECK:STDERR: | ^ +// CHECK:STDERR: fail_module_in_inline_cpp.carbon:[[@LINE+6]]:1: error: module declaration must occur at the start of the translation unit [CppInteropParseError] // CHECK:STDERR: :1:1: note: add 'module;' to the start of the file to introduce a global module fragment [CppInteropParseNote] -// CHECK:STDERR: 1 | ; -// CHECK:STDERR: | ^ +// CHECK:STDERR: :1:1: note: insert `module; ` here [CppInteropFixItInsertion] // CHECK:STDERR: -// CHECK:STDERR: fail_module_in_inline_cpp.carbon:[[@LINE+4]]:8: error: module name 'Foo' specified on command line does not match name of module [CppInteropParseError] -// CHECK:STDERR: 21 | module Bar; -// CHECK:STDERR: | ^~~ +// CHECK:STDERR: fail_module_in_inline_cpp.carbon:[[@LINE+2]]:8-10: error: module name 'Foo' specified on command line does not match name of module [CppInteropParseError] // CHECK:STDERR: module Bar; '''; @@ -61,32 +49,21 @@ library "[[@TEST_NAME]]"; // TODO: This diagnostic isn't very good. import Cpp inline ''' -// CHECK:STDERR: fail_global_module_in_inline_cpp.carbon:[[@LINE+8]]:1: error: module declaration must not come from an #include directive [CppInteropParseError] -// CHECK:STDERR: 14 | module; -// CHECK:STDERR: | ^~~~~~~ +// CHECK:STDERR: fail_global_module_in_inline_cpp.carbon:[[@LINE+4]]:1-7: error: module declaration must not come from an #include directive [CppInteropParseError] // CHECK:STDERR: -// CHECK:STDERR: fail_global_module_in_inline_cpp.carbon:[[@LINE+4]]:1: error: 'module;' introducing a global module fragment can appear only at the start of the translation unit [CppInteropParseError] -// CHECK:STDERR: 14 | module; -// CHECK:STDERR: | ^~~~~~~ +// CHECK:STDERR: fail_global_module_in_inline_cpp.carbon:[[@LINE+2]]:1-7: error: 'module;' introducing a global module fragment can appear only at the start of the translation unit [CppInteropParseError] // CHECK:STDERR: module; int n; -// CHECK:STDERR: fail_global_module_in_inline_cpp.carbon:[[@LINE+15]]:1: error: module declaration must not come from an #include directive [CppInteropParseError] -// CHECK:STDERR: 33 | module Baz; -// CHECK:STDERR: | ^~~~~~~~~~~ +// CHECK:STDERR: fail_global_module_in_inline_cpp.carbon:[[@LINE+8]]:1-11: error: module declaration must not come from an #include directive [CppInteropParseError] // CHECK:STDERR: -// CHECK:STDERR: fail_global_module_in_inline_cpp.carbon:[[@LINE+11]]:1: error: module declaration must occur at the start of the translation unit [CppInteropParseError] -// CHECK:STDERR: 33 | module Baz; -// CHECK:STDERR: | ^ +// CHECK:STDERR: fail_global_module_in_inline_cpp.carbon:[[@LINE+6]]:1: error: module declaration must occur at the start of the translation unit [CppInteropParseError] // CHECK:STDERR: :1:1: note: add 'module;' to the start of the file to introduce a global module fragment [CppInteropParseNote] -// CHECK:STDERR: 1 | ; -// CHECK:STDERR: | ^ +// CHECK:STDERR: :1:1: note: insert `module; ` here [CppInteropFixItInsertion] // CHECK:STDERR: -// CHECK:STDERR: fail_global_module_in_inline_cpp.carbon:[[@LINE+4]]:8: error: module name 'Foo' specified on command line does not match name of module [CppInteropParseError] -// CHECK:STDERR: 33 | module Baz; -// CHECK:STDERR: | ^~~ +// CHECK:STDERR: fail_global_module_in_inline_cpp.carbon:[[@LINE+2]]:8-10: error: module name 'Foo' specified on command line does not match name of module [CppInteropParseError] // CHECK:STDERR: module Baz; '''; @@ -97,9 +74,7 @@ library "[[@TEST_NAME]]"; // TODO: Also test that a valid module import works. import Cpp inline ''' -// CHECK:STDERR: fail_import_in_inline_cpp.carbon:[[@LINE+4]]:8: error: 'file_that_does_not_exist.h' file not found [CppInteropParseError] -// CHECK:STDERR: 10 | import "file_that_does_not_exist.h"; -// CHECK:STDERR: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_import_in_inline_cpp.carbon:[[@LINE+2]]:8-35: error: 'file_that_does_not_exist.h' file not found [CppInteropParseError] // CHECK:STDERR: import "file_that_does_not_exist.h"; '''; diff --git a/toolchain/check/testdata/interop/cpp/basics/share_ast.carbon b/toolchain/check/testdata/interop/cpp/basics/share_ast.carbon index 3546bc8f8daa..8cf7bb60d703 100644 --- a/toolchain/check/testdata/interop/cpp/basics/share_ast.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/share_ast.carbon @@ -38,9 +38,7 @@ import Cpp; fn CallLeakedA() -> i32 { // This should not be found as we have not imported "a.h". - // CHECK:STDERR: fail_a_does_not_leak.carbon:[[@LINE+4]]:10: error: member name `GetA` not found in `Cpp` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: return Cpp.GetA(); - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_a_does_not_leak.carbon:[[@LINE+2]]:10-17: error: member name `GetA` not found in `Cpp` [MemberNameNotFoundInInstScope] // CHECK:STDERR: return Cpp.GetA(); } diff --git a/toolchain/check/testdata/interop/cpp/basics/unsupported_decl_type.carbon b/toolchain/check/testdata/interop/cpp/basics/unsupported_decl_type.carbon index 6b73db76923d..d30313295cc9 100644 --- a/toolchain/check/testdata/interop/cpp/basics/unsupported_decl_type.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/unsupported_decl_type.carbon @@ -19,17 +19,13 @@ auto [a, b] = X{}; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_todo_use_structured_binding.carbon:[[@LINE+4]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_todo_use_structured_binding.carbon:[[@LINE+2]]:10 [InCppInclude] // CHECK:STDERR: ./structured_binding.h:3:7: error: semantics TODO: `Unsupported: Declaration type Binding` [SemanticsTodo] -// CHECK:STDERR: auto [a, b] = X{}; -// CHECK:STDERR: ^ import Cpp library "structured_binding.h"; fn F() -> i32 { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_use_structured_binding.carbon:[[@LINE+4]]:10: note: in `Cpp` name lookup for `a` [InCppNameLookup] - // CHECK:STDERR: return Cpp.a; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_todo_use_structured_binding.carbon:[[@LINE+2]]:10-14: note: in `Cpp` name lookup for `a` [InCppNameLookup] // CHECK:STDERR: return Cpp.a; //@dump-sem-ir-end diff --git a/toolchain/check/testdata/interop/cpp/basics/unused_internal.carbon b/toolchain/check/testdata/interop/cpp/basics/unused_internal.carbon index 27c40a5ec7da..fc3e2bde064f 100644 --- a/toolchain/check/testdata/interop/cpp/basics/unused_internal.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/unused_internal.carbon @@ -16,14 +16,10 @@ library "[[@TEST_NAME]]"; import Cpp inline '''c++ -// CHECK:STDERR: unused.carbon:[[@LINE+4]]:12: warning: unused variable 'n' [CppInteropParseWarning] -// CHECK:STDERR: 9 | static int n = 0; -// CHECK:STDERR: | ^ +// CHECK:STDERR: unused.carbon:[[@LINE+2]]:12: warning: unused variable 'n' [CppInteropParseWarning] // CHECK:STDERR: static int n = 0; -// CHECK:STDERR: unused.carbon:[[@LINE+4]]:13: warning: unused function 'f' [CppInteropParseWarning] -// CHECK:STDERR: 14 | static void f() {} -// CHECK:STDERR: | ^ +// CHECK:STDERR: unused.carbon:[[@LINE+2]]:13: warning: unused function 'f' [CppInteropParseWarning] // CHECK:STDERR: static void f() {} '''; diff --git a/toolchain/check/testdata/interop/cpp/class/export/base.carbon b/toolchain/check/testdata/interop/cpp/class/export/base.carbon index ad56191aff07..88be42d22e43 100644 --- a/toolchain/check/testdata/interop/cpp/class/export/base.carbon +++ b/toolchain/check/testdata/interop/cpp/class/export/base.carbon @@ -62,12 +62,8 @@ import Cpp; class FinalClass {} inline Cpp ''' -// CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE+7]]:12: error: base 'FinalClass' is marked 'final' [CppInteropParseError] -// CHECK:STDERR: 15 | struct A : Carbon::FinalClass {}; -// CHECK:STDERR: | ^ -// CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE-6]]:18: note: 'FinalClass' declared here [CppInteropParseNote] -// CHECK:STDERR: 5 | class FinalClass {} -// CHECK:STDERR: | ^ +// CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE+3]]:12: error: base 'FinalClass' is marked 'final' [CppInteropParseError] +// CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE-4]]:18: note: 'FinalClass' declared here [CppInteropParseNote] // CHECK:STDERR: struct A : Carbon::FinalClass {}; '''; @@ -84,21 +80,15 @@ struct VirtualDestructor { }; '''; -// CHECK:STDERR: fail_abstract.carbon:[[@LINE+4]]:1: error: cannot access member of interface `Core.Destroy` in type `AbstractWithVdtor` that does not implement that interface [MissingImplInMemberAccess] -// CHECK:STDERR: abstract class AbstractWithVdtor { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_abstract.carbon:[[@LINE+2]]:1-34: error: cannot access member of interface `Core.Destroy` in type `AbstractWithVdtor` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: abstract class AbstractWithVdtor { extend base: Cpp.VirtualDestructor; } inline Cpp ''' -// CHECK:STDERR: fail_abstract.carbon:[[@LINE+7]]:27: error: variable type 'Carbon::AbstractWithVdtor' is an abstract class [CppInteropParseError] -// CHECK:STDERR: 28 | Carbon::AbstractWithVdtor x; -// CHECK:STDERR: | ^ -// CHECK:STDERR: fail_abstract.carbon:[[@LINE-8]]:34: note: unimplemented pure virtual method '~AbstractWithVdtor' in 'AbstractWithVdtor' [CppInteropParseNote] -// CHECK:STDERR: 16 | abstract class AbstractWithVdtor { -// CHECK:STDERR: | ^ +// CHECK:STDERR: fail_abstract.carbon:[[@LINE+3]]:27: error: variable type 'Carbon::AbstractWithVdtor' is an abstract class [CppInteropParseError] +// CHECK:STDERR: fail_abstract.carbon:[[@LINE-6]]:34: note: unimplemented pure virtual method '~AbstractWithVdtor' in 'AbstractWithVdtor' [CppInteropParseNote] // CHECK:STDERR: Carbon::AbstractWithVdtor x; '''; @@ -110,13 +100,9 @@ import Cpp; // TODO: Find a way to export this to C++ as an abstract class, despite not // having a vptr. -// CHECK:STDERR: fail_todo_abstract_nonvirtual_dtor.carbon:[[@LINE+8]]:1: error: semantics TODO: `exporting abstract class with no abstract methods and non-virtual destructor to C++` [SemanticsTodo] -// CHECK:STDERR: abstract class AbstractNonvirtualDtor {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_abstract_nonvirtual_dtor.carbon:[[@LINE+4]]:1-39: error: semantics TODO: `exporting abstract class with no abstract methods and non-virtual destructor to C++` [SemanticsTodo] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_abstract_nonvirtual_dtor.carbon:[[@LINE+4]]:1: error: cannot access member of interface `Core.Destroy` in type `AbstractNonvirtualDtor` that does not implement that interface [MissingImplInMemberAccess] -// CHECK:STDERR: abstract class AbstractNonvirtualDtor {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_abstract_nonvirtual_dtor.carbon:[[@LINE+2]]:1-39: error: cannot access member of interface `Core.Destroy` in type `AbstractNonvirtualDtor` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: abstract class AbstractNonvirtualDtor {} @@ -132,9 +118,7 @@ import Cpp; // TODO: We should support generating a base subobject destructor for an // abstract class, even though we refuse to generate a complete object // destructor. -// CHECK:STDERR: fail_todo_abstract_nonvirtual_dtor_but_virtual_fns.carbon:[[@LINE+4]]:1: error: cannot access member of interface `Core.Destroy` in type `AbstractWithMethodNoVptr` that does not implement that interface [MissingImplInMemberAccess] -// CHECK:STDERR: abstract class AbstractWithMethodNoVptr { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_abstract_nonvirtual_dtor_but_virtual_fns.carbon:[[@LINE+2]]:1-41: error: cannot access member of interface `Core.Destroy` in type `AbstractWithMethodNoVptr` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: abstract class AbstractWithMethodNoVptr { abstract fn F(self); @@ -153,21 +137,15 @@ import Cpp; // TODO: We should support generating a base subobject destructor for an // abstract class, even though we refuse to generate a complete object // destructor. -// CHECK:STDERR: fail_variable_with_abstract_method.carbon:[[@LINE+4]]:1: error: cannot access member of interface `Core.Destroy` in type `AbstractWithMethod` that does not implement that interface [MissingImplInMemberAccess] -// CHECK:STDERR: abstract class AbstractWithMethod { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_variable_with_abstract_method.carbon:[[@LINE+2]]:1-35: error: cannot access member of interface `Core.Destroy` in type `AbstractWithMethod` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: abstract class AbstractWithMethod { abstract fn F(self); } inline Cpp ''' -// CHECK:STDERR: fail_variable_with_abstract_method.carbon:[[@LINE+7]]:28: error: variable type 'Carbon::AbstractWithMethod' is an abstract class [CppInteropParseError] -// CHECK:STDERR: 24 | Carbon::AbstractWithMethod x_abstract; -// CHECK:STDERR: | ^ -// CHECK:STDERR: fail_variable_with_abstract_method.carbon:[[@LINE-7]]:22: note: unimplemented pure virtual method 'F' in 'AbstractWithMethod' [CppInteropParseNote] -// CHECK:STDERR: 13 | abstract fn F(self); -// CHECK:STDERR: | ^ +// CHECK:STDERR: fail_variable_with_abstract_method.carbon:[[@LINE+3]]:28: error: variable type 'Carbon::AbstractWithMethod' is an abstract class [CppInteropParseError] +// CHECK:STDERR: fail_variable_with_abstract_method.carbon:[[@LINE-5]]:22: note: unimplemented pure virtual method 'F' in 'AbstractWithMethod' [CppInteropParseNote] // CHECK:STDERR: Carbon::AbstractWithMethod x_abstract; '''; @@ -180,9 +158,7 @@ import Cpp; // TODO: We should support generating a base subobject destructor for an // abstract class, even though we refuse to generate a complete object // destructor. -// CHECK:STDERR: fail_todo_abstract_method_overridden_in_cpp.carbon:[[@LINE+4]]:1: error: cannot access member of interface `Core.Destroy` in type `AbstractToOverride` that does not implement that interface [MissingImplInMemberAccess] -// CHECK:STDERR: abstract class AbstractToOverride { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_abstract_method_overridden_in_cpp.carbon:[[@LINE+2]]:1-35: error: cannot access member of interface `Core.Destroy` in type `AbstractToOverride` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: abstract class AbstractToOverride { abstract fn F(ref self); diff --git a/toolchain/check/testdata/interop/cpp/class/export/class.carbon b/toolchain/check/testdata/interop/cpp/class/export/class.carbon index 59344d74ebc7..3fe7e21602e4 100644 --- a/toolchain/check/testdata/interop/cpp/class/export/class.carbon +++ b/toolchain/check/testdata/interop/cpp/class/export/class.carbon @@ -59,19 +59,13 @@ library "[[@TEST_NAME]]"; import Cpp; -// CHECK:STDERR: fail_incomplete_concrete.carbon:[[@LINE+4]]:1: error: class was forward declared here [ClassForwardDeclaredHere] -// CHECK:STDERR: class IncompleteConcreteA; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_incomplete_concrete.carbon:[[@LINE+2]]:1-26: error: class was forward declared here [ClassForwardDeclaredHere] // CHECK:STDERR: class IncompleteConcreteA; inline Cpp ''' -// CHECK:STDERR: fail_incomplete_concrete.carbon:[[@LINE+7]]:29: error: variable has incomplete type 'Carbon::IncompleteConcreteA' [CppInteropParseError] -// CHECK:STDERR: 19 | Carbon::IncompleteConcreteA incomplete_concrete_a; -// CHECK:STDERR: | ^ -// CHECK:STDERR: fail_incomplete_concrete.carbon:[[@LINE-6]]:26: note: forward declaration of 'Carbon::IncompleteConcreteA' [CppInteropParseNote] -// CHECK:STDERR: 9 | class IncompleteConcreteA; -// CHECK:STDERR: | ^ +// CHECK:STDERR: fail_incomplete_concrete.carbon:[[@LINE+3]]:29: error: variable has incomplete type 'Carbon::IncompleteConcreteA' [CppInteropParseError] +// CHECK:STDERR: fail_incomplete_concrete.carbon:[[@LINE-4]]:26: note: forward declaration of 'Carbon::IncompleteConcreteA' [CppInteropParseNote] // CHECK:STDERR: Carbon::IncompleteConcreteA incomplete_concrete_a; '''; @@ -81,9 +75,7 @@ library "[[@TEST_NAME]]"; import Cpp; -// CHECK:STDERR: fail_todo_monomorphization_failure.carbon:[[@LINE+4]]:1: error: semantics TODO: `binding maps to a non-type template parameter` [SemanticsTodo] -// CHECK:STDERR: class B(N: i32) { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_monomorphization_failure.carbon:[[@LINE+2]]:1-17: error: semantics TODO: `binding maps to a non-type template parameter` [SemanticsTodo] // CHECK:STDERR: class B(N: i32) { var a: array(i8, N); @@ -94,13 +86,9 @@ class B(N: i32) { alias T = B(-1); inline Cpp ''' -// CHECK:STDERR: fail_todo_monomorphization_failure.carbon:[[@LINE+8]]:1: error: semantics TODO: `interop with unsupported type` [SemanticsTodo] -// CHECK:STDERR: Carbon::T t; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_todo_monomorphization_failure.carbon:[[@LINE+4]]:1: error: semantics TODO: `interop with unsupported type` [SemanticsTodo] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_monomorphization_failure.carbon:[[@LINE+4]]:9: error: no type named 'T' in namespace 'Carbon' [CppInteropParseError] -// CHECK:STDERR: 26 | Carbon::T t; -// CHECK:STDERR: | ~~~~~~~~^ +// CHECK:STDERR: fail_todo_monomorphization_failure.carbon:[[@LINE+2]]:9: error: no type named 'T' in namespace 'Carbon' [CppInteropParseError] // CHECK:STDERR: Carbon::T t; '''; diff --git a/toolchain/check/testdata/interop/cpp/class/export/field.carbon b/toolchain/check/testdata/interop/cpp/class/export/field.carbon index 2e1aac84c7ad..c9e1dd5770a6 100644 --- a/toolchain/check/testdata/interop/cpp/class/export/field.carbon +++ b/toolchain/check/testdata/interop/cpp/class/export/field.carbon @@ -75,14 +75,10 @@ class EmptyClass {} inline Cpp ''' void AccessNonexistentField() { Carbon::EmptyClass a; - // CHECK:STDERR: fail_nonexistent_field.carbon:[[@LINE+4]]:5: error: no member named 'x' in 'Carbon::EmptyClass' [CppInteropParseError] - // CHECK:STDERR: 13 | a.x = 12; - // CHECK:STDERR: | ~ ^ + // CHECK:STDERR: fail_nonexistent_field.carbon:[[@LINE+2]]:5: error: no member named 'x' in 'Carbon::EmptyClass' [CppInteropParseError] // CHECK:STDERR: a.x = 12; - // CHECK:STDERR: fail_nonexistent_field.carbon:[[@LINE+4]]:5: error: no member named 'y' in 'Carbon::EmptyClass' [CppInteropParseError] - // CHECK:STDERR: 18 | a.y = 34; - // CHECK:STDERR: | ~ ^ + // CHECK:STDERR: fail_nonexistent_field.carbon:[[@LINE+2]]:5: error: no member named 'y' in 'Carbon::EmptyClass' [CppInteropParseError] // CHECK:STDERR: a.y = 34; } @@ -93,14 +89,10 @@ library "[[@TEST_NAME]]"; import Cpp; class UnsupportedFieldType { - // CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+4]]:7: error: semantics TODO: `failed to map Carbon type to C++` [SemanticsTodo] - // CHECK:STDERR: var x: (); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+2]]:7-11: error: semantics TODO: `failed to map Carbon type to C++` [SemanticsTodo] // CHECK:STDERR: var x: (); - // CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+4]]:7: error: semantics TODO: `failed to map Carbon type to C++` [SemanticsTodo] - // CHECK:STDERR: var y: (); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+2]]:7-11: error: semantics TODO: `failed to map Carbon type to C++` [SemanticsTodo] // CHECK:STDERR: var y: (); } @@ -108,14 +100,10 @@ class UnsupportedFieldType { inline Cpp ''' void AccessUnsupportedField() { Carbon::UnsupportedFieldType a; - // CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+4]]:5: error: no member named 'x' in 'Carbon::UnsupportedFieldType' [CppInteropParseError] - // CHECK:STDERR: 24 | a.x; - // CHECK:STDERR: | ~ ^ + // CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+2]]:5: error: no member named 'x' in 'Carbon::UnsupportedFieldType' [CppInteropParseError] // CHECK:STDERR: a.x; - // CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+4]]:5: error: no member named 'y' in 'Carbon::UnsupportedFieldType' [CppInteropParseError] - // CHECK:STDERR: 29 | a.y; - // CHECK:STDERR: | ~ ^ + // CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+2]]:5: error: no member named 'y' in 'Carbon::UnsupportedFieldType' [CppInteropParseError] // CHECK:STDERR: a.y; } @@ -132,9 +120,7 @@ class AdaptedClass { inline Cpp ''' void AccessAdaptedField() { Carbon::AdaptedClass a; - // CHECK:STDERR: fail_adapter.carbon:[[@LINE+4]]:5: error: no member named 'x' in 'Carbon::AdaptedClass' [CppInteropParseError] - // CHECK:STDERR: 15 | a.x = 12; - // CHECK:STDERR: | ~ ^ + // CHECK:STDERR: fail_adapter.carbon:[[@LINE+2]]:5: error: no member named 'x' in 'Carbon::AdaptedClass' [CppInteropParseError] // CHECK:STDERR: a.x = 12; } @@ -146,9 +132,7 @@ import Cpp; // This should not cause a crash. class InvalidBaseClass { - // CHECK:STDERR: fail_invalid.carbon:[[@LINE+4]]:16: error: name `Whoops` not found [NameNotFound] - // CHECK:STDERR: extend base: Whoops; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:16-21: error: name `Whoops` not found [NameNotFound] // CHECK:STDERR: extend base: Whoops; } @@ -172,12 +156,8 @@ class ClassWithPrivateField { inline Cpp ''' int AccessPrivateField() { auto c = Carbon::ClassWithPrivateField::Make(); - // CHECK:STDERR: fail_private_field.carbon:[[@LINE+7]]:12: error: 'x' is a private member of 'Carbon::ClassWithPrivateField' [CppInteropParseError] - // CHECK:STDERR: 22 | return c.x; - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_private_field.carbon:[[@LINE-9]]:16: note: implicitly declared private here [CppInteropParseNote] - // CHECK:STDERR: 9 | private var x: i32; - // CHECK:STDERR: | ^ + // CHECK:STDERR: fail_private_field.carbon:[[@LINE+3]]:12: error: 'x' is a private member of 'Carbon::ClassWithPrivateField' [CppInteropParseError] + // CHECK:STDERR: fail_private_field.carbon:[[@LINE-7]]:16: note: implicitly declared private here [CppInteropParseNote] // CHECK:STDERR: return c.x; } diff --git a/toolchain/check/testdata/interop/cpp/class/export/generic.carbon b/toolchain/check/testdata/interop/cpp/class/export/generic.carbon index a615597aa124..c8e0d839ef93 100644 --- a/toolchain/check/testdata/interop/cpp/class/export/generic.carbon +++ b/toolchain/check/testdata/interop/cpp/class/export/generic.carbon @@ -45,9 +45,7 @@ void FSpecific() { library "[[@TEST_NAME]]"; import Cpp; -// CHECK:STDERR: fail_unsupported_specific_arg.carbon:[[@LINE+4]]:1: error: semantics TODO: `failed to map specific type arg to C++` [SemanticsTodo] -// CHECK:STDERR: class UnsupportedClass(T: type) { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_unsupported_specific_arg.carbon:[[@LINE+2]]:1-33: error: semantics TODO: `failed to map specific type arg to C++` [SemanticsTodo] // CHECK:STDERR: class UnsupportedClass(T: type) { var t: T; @@ -56,13 +54,9 @@ alias AliasEmptyTuple = UnsupportedClass(()); inline Cpp ''' void FUnsupported() { - // CHECK:STDERR: fail_unsupported_specific_arg.carbon:[[@LINE+8]]:11: error: semantics TODO: `interop with unsupported type` [SemanticsTodo] - // CHECK:STDERR: Carbon::AliasEmptyTuple a; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_unsupported_specific_arg.carbon:[[@LINE+4]]:11: error: semantics TODO: `interop with unsupported type` [SemanticsTodo] // CHECK:STDERR: - // CHECK:STDERR: fail_unsupported_specific_arg.carbon:[[@LINE+4]]:11: error: no type named 'AliasEmptyTuple' in namespace 'Carbon' [CppInteropParseError] - // CHECK:STDERR: 23 | Carbon::AliasEmptyTuple a; - // CHECK:STDERR: | ~~~~~~~~^ + // CHECK:STDERR: fail_unsupported_specific_arg.carbon:[[@LINE+2]]:11: error: no type named 'AliasEmptyTuple' in namespace 'Carbon' [CppInteropParseError] // CHECK:STDERR: Carbon::AliasEmptyTuple a; a.t = 123; @@ -74,9 +68,7 @@ library "[[@TEST_NAME]]"; import Cpp; class ClassWithMethod(T: type) { - // CHECK:STDERR: fail_todo_generic_class_method_call.carbon:[[@LINE+4]]:3: error: semantics TODO: `non-class non-namespace name scope` [SemanticsTodo] - // CHECK:STDERR: fn M(unused ref self) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_generic_class_method_call.carbon:[[@LINE+2]]:3-25: error: semantics TODO: `non-class non-namespace name scope` [SemanticsTodo] // CHECK:STDERR: fn M(unused ref self) {} } @@ -84,9 +76,7 @@ class ClassWithMethod(T: type) { inline Cpp ''' void FMethodCall() { Carbon::ClassWithMethod c; - // CHECK:STDERR: fail_todo_generic_class_method_call.carbon:[[@LINE+4]]:5: error: no member named 'M' in 'Carbon::ClassWithMethod' [CppInteropParseError] - // CHECK:STDERR: 19 | c.M(); - // CHECK:STDERR: | ~ ^ + // CHECK:STDERR: fail_todo_generic_class_method_call.carbon:[[@LINE+2]]:5: error: no member named 'M' in 'Carbon::ClassWithMethod' [CppInteropParseError] // CHECK:STDERR: c.M(); } diff --git a/toolchain/check/testdata/interop/cpp/class/export/method.carbon b/toolchain/check/testdata/interop/cpp/class/export/method.carbon index 7cba98f648b4..a6f0df556e6c 100644 --- a/toolchain/check/testdata/interop/cpp/class/export/method.carbon +++ b/toolchain/check/testdata/interop/cpp/class/export/method.carbon @@ -92,12 +92,8 @@ class RefMethodRValueClass { inline Cpp ''' void RefMethodRValue() { - // CHECK:STDERR: fail_ref_method_rvalue.carbon:[[@LINE+7]]:3: error: 'this' argument to member function 'M' is an rvalue, but function has non-const lvalue ref-qualifier [CppInteropParseError] - // CHECK:STDERR: 17 | Carbon::RefMethodRValueClass().M(); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_ref_method_rvalue.carbon:[[@LINE-8]]:17: note: 'M' declared here [CppInteropParseNote] - // CHECK:STDERR: 5 | fn M(ref self); - // CHECK:STDERR: | ^ + // CHECK:STDERR: fail_ref_method_rvalue.carbon:[[@LINE+3]]:3: error: 'this' argument to member function 'M' is an rvalue, but function has non-const lvalue ref-qualifier [CppInteropParseError] + // CHECK:STDERR: fail_ref_method_rvalue.carbon:[[@LINE-6]]:17: note: 'M' declared here [CppInteropParseNote] // CHECK:STDERR: Carbon::RefMethodRValueClass().M(); } @@ -113,12 +109,8 @@ class RefMethodConstLValueClass { inline Cpp ''' void RefMethodConstLValue(const Carbon::RefMethodConstLValueClass& c) { - // CHECK:STDERR: fail_ref_method_const_lvalue.carbon:[[@LINE+7]]:3: error: 'this' argument to member function 'M' has type 'const Carbon::RefMethodConstLValueClass', but function is not marked const [CppInteropParseError] - // CHECK:STDERR: 17 | c.M(); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_ref_method_const_lvalue.carbon:[[@LINE-8]]:17: note: 'M' declared here [CppInteropParseNote] - // CHECK:STDERR: 5 | fn M(ref self); - // CHECK:STDERR: | ^ + // CHECK:STDERR: fail_ref_method_const_lvalue.carbon:[[@LINE+3]]:3: error: 'this' argument to member function 'M' has type 'const Carbon::RefMethodConstLValueClass', but function is not marked const [CppInteropParseError] + // CHECK:STDERR: fail_ref_method_const_lvalue.carbon:[[@LINE-6]]:17: note: 'M' declared here [CppInteropParseNote] // CHECK:STDERR: c.M(); } diff --git a/toolchain/check/testdata/interop/cpp/class/export/override.carbon b/toolchain/check/testdata/interop/cpp/class/export/override.carbon index 92c01a66b45b..105e59845104 100644 --- a/toolchain/check/testdata/interop/cpp/class/export/override.carbon +++ b/toolchain/check/testdata/interop/cpp/class/export/override.carbon @@ -70,9 +70,7 @@ struct VBase { }; '''; -// CHECK:STDERR: fail_todo_generic.carbon:[[@LINE+4]]:1: error: semantics TODO: `generic class deriving from C++ virtual class` [SemanticsTodo] -// CHECK:STDERR: class GenericZ(T: type) { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_generic.carbon:[[@LINE+2]]:1-25: error: semantics TODO: `generic class deriving from C++ virtual class` [SemanticsTodo] // CHECK:STDERR: class GenericZ(T: type) { extend base: Cpp.VBase; diff --git a/toolchain/check/testdata/interop/cpp/class/export/static.carbon b/toolchain/check/testdata/interop/cpp/class/export/static.carbon index 6902b98f51ba..ed4bd455941e 100644 --- a/toolchain/check/testdata/interop/cpp/class/export/static.carbon +++ b/toolchain/check/testdata/interop/cpp/class/export/static.carbon @@ -34,12 +34,8 @@ class PrivateClass { inline Cpp ''' int PrivateStatic() { - // CHECK:STDERR: fail_static_private.carbon:[[@LINE+7]]:32: error: 'x' is a private member of 'Carbon::PrivateClass' [CppInteropParseError] - // CHECK:STDERR: 17 | return Carbon::PrivateClass::x; - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_static_private.carbon:[[@LINE-8]]:23: note: implicitly declared private here [CppInteropParseNote] - // CHECK:STDERR: 5 | private static var x: i32 = 123; - // CHECK:STDERR: | ^ + // CHECK:STDERR: fail_static_private.carbon:[[@LINE+3]]:32: error: 'x' is a private member of 'Carbon::PrivateClass' [CppInteropParseError] + // CHECK:STDERR: fail_static_private.carbon:[[@LINE-6]]:23: note: implicitly declared private here [CppInteropParseNote] // CHECK:STDERR: return Carbon::PrivateClass::x; } diff --git a/toolchain/check/testdata/interop/cpp/class/import/abstract.carbon b/toolchain/check/testdata/interop/cpp/class/import/abstract.carbon index 3e788080ef97..c85200b75786 100644 --- a/toolchain/check/testdata/interop/cpp/class/import/abstract.carbon +++ b/toolchain/check/testdata/interop/cpp/class/import/abstract.carbon @@ -57,9 +57,7 @@ import Cpp library "abstract.h"; class C { extend base: Cpp.A; - // CHECK:STDERR: fail_impl_mismatch_member.carbon:[[@LINE+4]]:3: error: override without compatible virtual in base class [OverrideWithoutVirtualInBase] - // CHECK:STDERR: override fn invalid(unused ref self) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_impl_mismatch_member.carbon:[[@LINE+2]]:3-40: error: override without compatible virtual in base class [OverrideWithoutVirtualInBase] // CHECK:STDERR: override fn invalid(unused ref self) {} } @@ -78,9 +76,7 @@ library "[[@TEST_NAME]]"; import Cpp library "abstract_final.h"; class C { - // CHECK:STDERR: fail_derive_from_abstract_final.carbon:[[@LINE+4]]:16: error: deriving from final type `AbstractFinal`; base type must be an `abstract` or `base` class [BaseIsFinal] - // CHECK:STDERR: extend base: Cpp.AbstractFinal; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_derive_from_abstract_final.carbon:[[@LINE+2]]:16-32: error: deriving from final type `AbstractFinal`; base type must be an `abstract` or `base` class [BaseIsFinal] // CHECK:STDERR: extend base: Cpp.AbstractFinal; } diff --git a/toolchain/check/testdata/interop/cpp/class/import/access.carbon b/toolchain/check/testdata/interop/cpp/class/import/access.carbon index 0170ab73ccbb..0362d28a481d 100644 --- a/toolchain/check/testdata/interop/cpp/class/import/access.carbon +++ b/toolchain/check/testdata/interop/cpp/class/import/access.carbon @@ -70,21 +70,13 @@ library "[[@TEST_NAME]]"; import Cpp library "non_function_member_protected.h"; fn F(c: Cpp.NonFunctionMemberProtected) { - // CHECK:STDERR: fail_import_non_function_member_protected.carbon:[[@LINE+8]]:35: error: cannot access protected member `instance_data` of type `Cpp.NonFunctionMemberProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: let unused instance_data: i32 = c.instance_data; - // CHECK:STDERR: ^~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_non_function_member_protected.carbon:[[@LINE-6]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_non_function_member_protected.carbon:[[@LINE+4]]:35-49: error: cannot access protected member `instance_data` of type `Cpp.NonFunctionMemberProtected` [ClassInvalidMemberAccess] + // CHECK:STDERR: included from: fail_import_non_function_member_protected.carbon:[[@LINE-4]]:10 [InCppInclude] // CHECK:STDERR: ./non_function_member_protected.h:2:7: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: class NonFunctionMemberProtected { - // CHECK:STDERR: ^ // CHECK:STDERR: let unused instance_data: i32 = c.instance_data; - // CHECK:STDERR: fail_import_non_function_member_protected.carbon:[[@LINE+7]]:33: error: cannot access protected member `static_data` of type `Cpp.NonFunctionMemberProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: let unused static_data: i32 = Cpp.NonFunctionMemberProtected.static_data; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_non_function_member_protected.carbon:[[@LINE+4]]:33: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: let unused static_data: i32 = Cpp.NonFunctionMemberProtected.static_data; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_non_function_member_protected.carbon:[[@LINE+3]]:33-74: error: cannot access protected member `static_data` of type `Cpp.NonFunctionMemberProtected` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_import_non_function_member_protected.carbon:[[@LINE+2]]:33-74: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: let unused static_data: i32 = Cpp.NonFunctionMemberProtected.static_data; } @@ -100,21 +92,13 @@ class Derived { } fn F(d: Derived) { - // CHECK:STDERR: fail_import_non_function_member_protected_extend.carbon:[[@LINE+8]]:35: error: cannot access protected member `instance_data` of type `Derived` [ClassInvalidMemberAccess] - // CHECK:STDERR: let unused instance_data: i32 = d.instance_data; - // CHECK:STDERR: ^~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_non_function_member_protected_extend.carbon:[[@LINE-10]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_non_function_member_protected_extend.carbon:[[@LINE+4]]:35-49: error: cannot access protected member `instance_data` of type `Derived` [ClassInvalidMemberAccess] + // CHECK:STDERR: included from: fail_import_non_function_member_protected_extend.carbon:[[@LINE-8]]:10 [InCppInclude] // CHECK:STDERR: ./non_function_member_protected.h:2:7: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: class NonFunctionMemberProtected { - // CHECK:STDERR: ^ // CHECK:STDERR: let unused instance_data: i32 = d.instance_data; - // CHECK:STDERR: fail_import_non_function_member_protected_extend.carbon:[[@LINE+7]]:33: error: cannot access protected member `static_data` of type `Derived` [ClassInvalidMemberAccess] - // CHECK:STDERR: let unused static_data: i32 = Derived.static_data; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_non_function_member_protected_extend.carbon:[[@LINE+4]]:33: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: let unused static_data: i32 = Derived.static_data; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_non_function_member_protected_extend.carbon:[[@LINE+3]]:33-51: error: cannot access protected member `static_data` of type `Derived` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_import_non_function_member_protected_extend.carbon:[[@LINE+2]]:33-51: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: let unused static_data: i32 = Derived.static_data; } @@ -155,21 +139,13 @@ library "[[@TEST_NAME]]"; import Cpp library "non_function_member_private.h"; fn F(c: Cpp.NonFunctionMemberPrivate) { - // CHECK:STDERR: fail_import_non_function_member_private.carbon:[[@LINE+8]]:35: error: cannot access private member `instance_data` of type `Cpp.NonFunctionMemberPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: let unused instance_data: i32 = c.instance_data; - // CHECK:STDERR: ^~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_non_function_member_private.carbon:[[@LINE-6]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_non_function_member_private.carbon:[[@LINE+4]]:35-49: error: cannot access private member `instance_data` of type `Cpp.NonFunctionMemberPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: included from: fail_import_non_function_member_private.carbon:[[@LINE-4]]:10 [InCppInclude] // CHECK:STDERR: ./non_function_member_private.h:2:7: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: class NonFunctionMemberPrivate { - // CHECK:STDERR: ^ // CHECK:STDERR: let unused instance_data: i32 = c.instance_data; - // CHECK:STDERR: fail_import_non_function_member_private.carbon:[[@LINE+7]]:33: error: cannot access private member `static_data` of type `Cpp.NonFunctionMemberPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: let unused static_data: i32 = Cpp.NonFunctionMemberPrivate.static_data; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_non_function_member_private.carbon:[[@LINE+4]]:33: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: let unused static_data: i32 = Cpp.NonFunctionMemberPrivate.static_data; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_non_function_member_private.carbon:[[@LINE+3]]:33-72: error: cannot access private member `static_data` of type `Cpp.NonFunctionMemberPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_import_non_function_member_private.carbon:[[@LINE+2]]:33-72: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: let unused static_data: i32 = Cpp.NonFunctionMemberPrivate.static_data; } @@ -183,42 +159,26 @@ import Cpp library "non_function_member_private.h"; class Derived { extend base: Cpp.NonFunctionMemberPrivate; fn F(self) { - // CHECK:STDERR: fail_import_non_function_member_private_extend.carbon:[[@LINE+8]]:37: error: cannot access private member `instance_data` of type `Cpp.NonFunctionMemberPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: let unused instance_data: i32 = self.instance_data; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_non_function_member_private_extend.carbon:[[@LINE-8]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_non_function_member_private_extend.carbon:[[@LINE+4]]:37-54: error: cannot access private member `instance_data` of type `Cpp.NonFunctionMemberPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: included from: fail_import_non_function_member_private_extend.carbon:[[@LINE-6]]:10 [InCppInclude] // CHECK:STDERR: ./non_function_member_private.h:2:7: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: class NonFunctionMemberPrivate { - // CHECK:STDERR: ^ // CHECK:STDERR: let unused instance_data: i32 = self.instance_data; } } fn F(d: Derived) { - // CHECK:STDERR: fail_import_non_function_member_private_extend.carbon:[[@LINE+8]]:35: error: cannot access private member `instance_data` of type `Cpp.NonFunctionMemberPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: let unused instance_data: i32 = d.instance_data; - // CHECK:STDERR: ^~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_non_function_member_private_extend.carbon:[[@LINE-21]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_non_function_member_private_extend.carbon:[[@LINE+4]]:35-49: error: cannot access private member `instance_data` of type `Cpp.NonFunctionMemberPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: included from: fail_import_non_function_member_private_extend.carbon:[[@LINE-15]]:10 [InCppInclude] // CHECK:STDERR: ./non_function_member_private.h:2:7: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: class NonFunctionMemberPrivate { - // CHECK:STDERR: ^ // CHECK:STDERR: let unused instance_data: i32 = d.instance_data; - // CHECK:STDERR: fail_import_non_function_member_private_extend.carbon:[[@LINE+7]]:41: error: cannot access private member `static_data` of type `Cpp.NonFunctionMemberPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: let unused derived_static_data: i32 = Derived.static_data; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_non_function_member_private_extend.carbon:[[@LINE+4]]:41: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: let unused derived_static_data: i32 = Derived.static_data; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_non_function_member_private_extend.carbon:[[@LINE+3]]:41-59: error: cannot access private member `static_data` of type `Cpp.NonFunctionMemberPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_import_non_function_member_private_extend.carbon:[[@LINE+2]]:41-59: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: let unused derived_static_data: i32 = Derived.static_data; - // CHECK:STDERR: fail_import_non_function_member_private_extend.carbon:[[@LINE+7]]:38: error: cannot access private member `static_data` of type `Cpp.NonFunctionMemberPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: let unused base_static_data: i32 = Cpp.NonFunctionMemberPrivate.static_data; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_non_function_member_private_extend.carbon:[[@LINE-4]]:41: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: let unused derived_static_data: i32 = Derived.static_data; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_non_function_member_private_extend.carbon:[[@LINE+3]]:38-77: error: cannot access private member `static_data` of type `Cpp.NonFunctionMemberPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_import_non_function_member_private_extend.carbon:[[@LINE-2]]:41-59: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: let unused base_static_data: i32 = Cpp.NonFunctionMemberPrivate.static_data; } @@ -234,12 +194,8 @@ class Derived { fn F() { // TODO: `NonFunctionMemberPrivate.static_data` is private, so this // should fail. - // CHECK:STDERR: fail_import_non_function_member_private_extend_static_within_member_function.carbon:[[@LINE+7]]:47: error: cannot access private member `static_data` of type `Cpp.NonFunctionMemberPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: let unused unqualified_static_data: i32 = static_data; - // CHECK:STDERR: ^~~~~~~~~~~ - // CHECK:STDERR: fail_import_non_function_member_private_extend_static_within_member_function.carbon:[[@LINE+4]]:47: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: let unused unqualified_static_data: i32 = static_data; - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_import_non_function_member_private_extend_static_within_member_function.carbon:[[@LINE+3]]:47-57: error: cannot access private member `static_data` of type `Cpp.NonFunctionMemberPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_import_non_function_member_private_extend_static_within_member_function.carbon:[[@LINE+2]]:47-57: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: let unused unqualified_static_data: i32 = static_data; } @@ -288,20 +244,12 @@ library "[[@TEST_NAME]]"; import Cpp library "function_member_protected.h"; fn F(c: Cpp.FunctionMemberProtected*) { - // CHECK:STDERR: fail_import_function_member_protected.carbon:[[@LINE+7]]:3: error: cannot access protected member `instance_fn` of type `Cpp.FunctionMemberProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: c->instance_fn(); - // CHECK:STDERR: ^~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_function_member_protected.carbon:[[@LINE+4]]:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: c->instance_fn(); - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_function_member_protected.carbon:[[@LINE+3]]:3-16: error: cannot access protected member `instance_fn` of type `Cpp.FunctionMemberProtected` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_import_function_member_protected.carbon:[[@LINE+2]]:3-16: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: c->instance_fn(); - // CHECK:STDERR: fail_import_function_member_protected.carbon:[[@LINE+7]]:3: error: cannot access protected member `static_fn` of type `Cpp.FunctionMemberProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.FunctionMemberProtected.static_fn(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_function_member_protected.carbon:[[@LINE+4]]:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.FunctionMemberProtected.static_fn(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_function_member_protected.carbon:[[@LINE+3]]:3-39: error: cannot access protected member `static_fn` of type `Cpp.FunctionMemberProtected` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_import_function_member_protected.carbon:[[@LINE+2]]:3-39: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.FunctionMemberProtected.static_fn(); } @@ -317,13 +265,10 @@ class Derived { fn F(self) { //@dump-sem-ir-begin // TODO: It should be possible to call protected methods in the base class. - // CHECK:STDERR: fail_todo_import_function_member_protected_extend_call_instance_in_member.carbon:[[@LINE+8]]:22: error: no matching function for call to 'instance_fn' [CppInteropParseError] - // CHECK:STDERR: 19 | self.instance_fn(); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_todo_import_function_member_protected_extend_call_instance_in_member.carbon:[[@LINE-10]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./function_member_protected.h:4:8: note: candidate function not viable: cannot convert argument of incomplete type 'const Carbon::Derived' to 'FunctionMemberProtected' for object argument [CppInteropParseNote] - // CHECK:STDERR: 4 | auto instance_fn() -> void; - // CHECK:STDERR: | ^ + // CHECK:STDERR: fail_todo_import_function_member_protected_extend_call_instance_in_member.carbon:[[@LINE+5]]:5-20: error: no matching function for call to 'instance_fn' [CppInteropParseError] + // CHECK:STDERR: included from: fail_todo_import_function_member_protected_extend_call_instance_in_member.carbon:[[@LINE-8]]:10 [InCppInclude] + // CHECK:STDERR: ./function_member_protected.h:4:8: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: ./function_member_protected.h:4:19-20: note: cannot convert argument of incomplete type 'const Carbon::Derived' to 'FunctionMemberProtected' for object argument [CppInteropParseNoteReason] // CHECK:STDERR: self.instance_fn(); //@dump-sem-ir-end @@ -368,64 +313,36 @@ import Cpp library "function_member_private.h"; class Derived { extend base: Cpp.FunctionMemberPrivate; fn F(self) { - // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE+7]]:5: error: cannot access private member `instance_fn` of type `Cpp.FunctionMemberPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: self.instance_fn(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE+4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: self.instance_fn(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE+3]]:5-20: error: cannot access private member `instance_fn` of type `Cpp.FunctionMemberPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE+2]]:5-20: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: self.instance_fn(); - // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE+7]]:5: error: cannot access private member `static_fn` of type `Cpp.FunctionMemberPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: static_fn(); - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE+4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: static_fn(); - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE+3]]:5-13: error: cannot access private member `static_fn` of type `Cpp.FunctionMemberPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE+2]]:5-13: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: static_fn(); - // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE+7]]:5: error: cannot access private member `static_fn` of type `Cpp.FunctionMemberPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: Derived.static_fn(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE-4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: static_fn(); - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE+3]]:5-21: error: cannot access private member `static_fn` of type `Cpp.FunctionMemberPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE-2]]:5-13: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Derived.static_fn(); - // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE+7]]:5: error: cannot access private member `static_fn` of type `Cpp.FunctionMemberPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.FunctionMemberPrivate.static_fn(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE-12]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: static_fn(); - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE+3]]:5-39: error: cannot access private member `static_fn` of type `Cpp.FunctionMemberPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE-6]]:5-13: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.FunctionMemberPrivate.static_fn(); } } fn F(c: Cpp.FunctionMemberPrivate*) { - // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE+7]]:3: error: cannot access private member `instance_fn` of type `Cpp.FunctionMemberPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: c->instance_fn(); - // CHECK:STDERR: ^~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE-32]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: self.instance_fn(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE+3]]:3-16: error: cannot access private member `instance_fn` of type `Cpp.FunctionMemberPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE-18]]:5-20: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: c->instance_fn(); - // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE+7]]:3: error: cannot access private member `static_fn` of type `Cpp.FunctionMemberPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: Derived.static_fn(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE-32]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: static_fn(); - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE+3]]:3-19: error: cannot access private member `static_fn` of type `Cpp.FunctionMemberPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE-18]]:5-13: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Derived.static_fn(); - // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE+7]]:3: error: cannot access private member `static_fn` of type `Cpp.FunctionMemberPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.FunctionMemberPrivate.static_fn(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE-40]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: static_fn(); - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE+3]]:3-37: error: cannot access private member `static_fn` of type `Cpp.FunctionMemberPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE-22]]:5-13: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.FunctionMemberPrivate.static_fn(); } @@ -472,22 +389,14 @@ library "[[@TEST_NAME]]"; import Cpp library "overload_set.h"; fn F() { - // CHECK:STDERR: fail_import_overload_set_protected.carbon:[[@LINE+8]]:3: error: cannot access protected member `OverloadSet` of type `Cpp.OverloadSet` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.OverloadSet.OverloadSet(Cpp.ProtectedCall.ProtectedCall()); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_overload_set_protected.carbon:[[@LINE-6]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_overload_set_protected.carbon:[[@LINE+4]]:3-64: error: cannot access protected member `OverloadSet` of type `Cpp.OverloadSet` [ClassInvalidMemberAccess] + // CHECK:STDERR: included from: fail_import_overload_set_protected.carbon:[[@LINE-4]]:10 [InCppInclude] // CHECK:STDERR: ./overload_set.h:11:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: OverloadSet(ProtectedCall x); - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.OverloadSet.OverloadSet(Cpp.ProtectedCall.ProtectedCall()); - // CHECK:STDERR: fail_import_overload_set_protected.carbon:[[@LINE+8]]:3: error: cannot access protected member `Overload` of type `Cpp.OverloadSet` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.OverloadSet.Overload(Cpp.ProtectedCall.ProtectedCall()); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_overload_set_protected.carbon:[[@LINE-15]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_overload_set_protected.carbon:[[@LINE+4]]:3-61: error: cannot access protected member `Overload` of type `Cpp.OverloadSet` [ClassInvalidMemberAccess] + // CHECK:STDERR: included from: fail_import_overload_set_protected.carbon:[[@LINE-9]]:10 [InCppInclude] // CHECK:STDERR: ./overload_set.h:12:15: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: static auto Overload(ProtectedCall x) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.OverloadSet.Overload(Cpp.ProtectedCall.ProtectedCall()); } @@ -533,22 +442,14 @@ library "[[@TEST_NAME]]"; import Cpp library "overload_set.h"; fn F() { - // CHECK:STDERR: fail_import_overload_set_private.carbon:[[@LINE+8]]:3: error: cannot access private member `OverloadSet` of type `Cpp.OverloadSet` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.OverloadSet.OverloadSet(Cpp.PrivateCall.PrivateCall()); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_overload_set_private.carbon:[[@LINE-6]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_overload_set_private.carbon:[[@LINE+4]]:3-60: error: cannot access private member `OverloadSet` of type `Cpp.OverloadSet` [ClassInvalidMemberAccess] + // CHECK:STDERR: included from: fail_import_overload_set_private.carbon:[[@LINE-4]]:10 [InCppInclude] // CHECK:STDERR: ./overload_set.h:14:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: OverloadSet(PrivateCall x); - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.OverloadSet.OverloadSet(Cpp.PrivateCall.PrivateCall()); - // CHECK:STDERR: fail_import_overload_set_private.carbon:[[@LINE+8]]:3: error: cannot access private member `Overload` of type `Cpp.OverloadSet` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.OverloadSet.Overload(Cpp.PrivateCall.PrivateCall()); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_overload_set_private.carbon:[[@LINE-15]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_overload_set_private.carbon:[[@LINE+4]]:3-57: error: cannot access private member `Overload` of type `Cpp.OverloadSet` [ClassInvalidMemberAccess] + // CHECK:STDERR: included from: fail_import_overload_set_private.carbon:[[@LINE-9]]:10 [InCppInclude] // CHECK:STDERR: ./overload_set.h:15:15: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: static auto Overload(PrivateCall x) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.OverloadSet.Overload(Cpp.PrivateCall.PrivateCall()); } @@ -563,25 +464,17 @@ class D { extend base: Cpp.OverloadSet; fn MakePrivate() -> D { - // CHECK:STDERR: fail_import_overload_set_private_base.carbon:[[@LINE+8]]:21: error: cannot access private member `OverloadSet` of type `Cpp.OverloadSet` [ClassInvalidMemberAccess] - // CHECK:STDERR: return {.base = OverloadSet(Cpp.PrivateCall.PrivateCall())}; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_overload_set_private_base.carbon:[[@LINE-9]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_overload_set_private_base.carbon:[[@LINE+4]]:21-62: error: cannot access private member `OverloadSet` of type `Cpp.OverloadSet` [ClassInvalidMemberAccess] + // CHECK:STDERR: included from: fail_import_overload_set_private_base.carbon:[[@LINE-7]]:10 [InCppInclude] // CHECK:STDERR: ./overload_set.h:14:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: OverloadSet(PrivateCall x); - // CHECK:STDERR: ^ // CHECK:STDERR: return {.base = OverloadSet(Cpp.PrivateCall.PrivateCall())}; } fn CallPrivate() { - // CHECK:STDERR: fail_import_overload_set_private_base.carbon:[[@LINE+8]]:5: error: cannot access private member `Overload` of type `Cpp.OverloadSet` [ClassInvalidMemberAccess] - // CHECK:STDERR: Overload(Cpp.PrivateCall.PrivateCall()); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_overload_set_private_base.carbon:[[@LINE-21]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_overload_set_private_base.carbon:[[@LINE+4]]:5-43: error: cannot access private member `Overload` of type `Cpp.OverloadSet` [ClassInvalidMemberAccess] + // CHECK:STDERR: included from: fail_import_overload_set_private_base.carbon:[[@LINE-15]]:10 [InCppInclude] // CHECK:STDERR: ./overload_set.h:15:15: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: static auto Overload(PrivateCall x) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Overload(Cpp.PrivateCall.PrivateCall()); } @@ -614,24 +507,16 @@ library "[[@TEST_NAME]]"; import Cpp library "overload_set_base_class.h"; fn F() { - // CHECK:STDERR: fail_import_overload_set_public_base_class_call_non_public.carbon:[[@LINE+9]]:3: error: cannot access protected member `Overload` of type `Cpp.OverloadPublic` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.OverloadPublic.Overload(Cpp.ProtectedCall.ProtectedCall()); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_overload_set_public_base_class_call_non_public.carbon:[[@LINE-6]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./overload_set_base_class.h:2:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_overload_set_public_base_class_call_non_public.carbon:[[@LINE+5]]:3-64: error: cannot access protected member `Overload` of type `Cpp.OverloadPublic` [ClassInvalidMemberAccess] + // CHECK:STDERR: included from: fail_import_overload_set_public_base_class_call_non_public.carbon:[[@LINE-4]]:10 [InCppInclude] + // CHECK:STDERR: included from: ./overload_set_base_class.h:2:10 [InCppInclude] // CHECK:STDERR: ./overload_set.h:12:15: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: static auto Overload(ProtectedCall x) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.OverloadPublic.Overload(Cpp.ProtectedCall.ProtectedCall()); - // CHECK:STDERR: fail_import_overload_set_public_base_class_call_non_public.carbon:[[@LINE+9]]:3: error: cannot access private member `Overload` of type `Cpp.OverloadPublic` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.OverloadPublic.Overload(Cpp.PrivateCall.PrivateCall()); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_overload_set_public_base_class_call_non_public.carbon:[[@LINE-16]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./overload_set_base_class.h:2:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_overload_set_public_base_class_call_non_public.carbon:[[@LINE+5]]:3-60: error: cannot access private member `Overload` of type `Cpp.OverloadPublic` [ClassInvalidMemberAccess] + // CHECK:STDERR: included from: fail_import_overload_set_public_base_class_call_non_public.carbon:[[@LINE-10]]:10 [InCppInclude] + // CHECK:STDERR: included from: ./overload_set_base_class.h:2:10 [InCppInclude] // CHECK:STDERR: ./overload_set.h:15:15: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: static auto Overload(PrivateCall x) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.OverloadPublic.Overload(Cpp.PrivateCall.PrivateCall()); } @@ -663,14 +548,10 @@ class Derived { extend base: Cpp.OverloadPublic; fn F() { - // CHECK:STDERR: fail_import_overload_set_public_base_class_derived_call_private.carbon:[[@LINE+9]]:5: error: cannot access private member `Overload` of type `Cpp.OverloadPublic` [ClassInvalidMemberAccess] - // CHECK:STDERR: Overload(Cpp.PrivateCall.PrivateCall()); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_overload_set_public_base_class_derived_call_private.carbon:[[@LINE-9]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./overload_set_base_class.h:2:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_overload_set_public_base_class_derived_call_private.carbon:[[@LINE+5]]:5-43: error: cannot access private member `Overload` of type `Cpp.OverloadPublic` [ClassInvalidMemberAccess] + // CHECK:STDERR: included from: fail_import_overload_set_public_base_class_derived_call_private.carbon:[[@LINE-7]]:10 [InCppInclude] + // CHECK:STDERR: included from: ./overload_set_base_class.h:2:10 [InCppInclude] // CHECK:STDERR: ./overload_set.h:15:15: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: static auto Overload(PrivateCall x) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Overload(Cpp.PrivateCall.PrivateCall()); } @@ -683,28 +564,16 @@ library "[[@TEST_NAME]]"; import Cpp library "overload_set_base_class.h"; fn F() { - // CHECK:STDERR: fail_import_overload_set_protected_base_class.carbon:[[@LINE+7]]:3: error: cannot access protected member `Overload` of type `Cpp.OverloadProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.OverloadProtected.Overload(Cpp.PublicCall.PublicCall()); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_overload_set_protected_base_class.carbon:[[@LINE+4]]:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.OverloadProtected.Overload(Cpp.PublicCall.PublicCall()); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_overload_set_protected_base_class.carbon:[[@LINE+3]]:3-32: error: cannot access protected member `Overload` of type `Cpp.OverloadProtected` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_import_overload_set_protected_base_class.carbon:[[@LINE+2]]:3-32: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.OverloadProtected.Overload(Cpp.PublicCall.PublicCall()); - // CHECK:STDERR: fail_import_overload_set_protected_base_class.carbon:[[@LINE+7]]:3: error: cannot access protected member `Overload` of type `Cpp.OverloadProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.OverloadProtected.Overload(Cpp.ProtectedCall.ProtectedCall()); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_overload_set_protected_base_class.carbon:[[@LINE-4]]:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.OverloadProtected.Overload(Cpp.PublicCall.PublicCall()); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_overload_set_protected_base_class.carbon:[[@LINE+3]]:3-32: error: cannot access protected member `Overload` of type `Cpp.OverloadProtected` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_import_overload_set_protected_base_class.carbon:[[@LINE-2]]:3-32: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.OverloadProtected.Overload(Cpp.ProtectedCall.ProtectedCall()); - // CHECK:STDERR: fail_import_overload_set_protected_base_class.carbon:[[@LINE+7]]:3: error: cannot access protected member `Overload` of type `Cpp.OverloadProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.OverloadProtected.Overload(Cpp.PrivateCall.PrivateCall()); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_overload_set_protected_base_class.carbon:[[@LINE-12]]:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.OverloadProtected.Overload(Cpp.PublicCall.PublicCall()); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_overload_set_protected_base_class.carbon:[[@LINE+3]]:3-32: error: cannot access protected member `Overload` of type `Cpp.OverloadProtected` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_import_overload_set_protected_base_class.carbon:[[@LINE-6]]:3-32: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.OverloadProtected.Overload(Cpp.PrivateCall.PrivateCall()); } @@ -736,14 +605,10 @@ class Derived { extend base: Cpp.OverloadProtected; fn F() { - // CHECK:STDERR: fail_import_overload_set_protected_base_class_derived_call_private.carbon:[[@LINE+9]]:5: error: cannot access private member `Overload` of type `Cpp.OverloadProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: Overload(Cpp.PrivateCall.PrivateCall()); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_overload_set_protected_base_class_derived_call_private.carbon:[[@LINE-9]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./overload_set_base_class.h:2:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_overload_set_protected_base_class_derived_call_private.carbon:[[@LINE+5]]:5-43: error: cannot access private member `Overload` of type `Cpp.OverloadProtected` [ClassInvalidMemberAccess] + // CHECK:STDERR: included from: fail_import_overload_set_protected_base_class_derived_call_private.carbon:[[@LINE-7]]:10 [InCppInclude] + // CHECK:STDERR: included from: ./overload_set_base_class.h:2:10 [InCppInclude] // CHECK:STDERR: ./overload_set.h:15:15: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: static auto Overload(PrivateCall x) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Overload(Cpp.PrivateCall.PrivateCall()); } @@ -756,28 +621,16 @@ library "[[@TEST_NAME]]"; import Cpp library "overload_set_base_class.h"; fn F() { - // CHECK:STDERR: fail_import_overload_set_private_base_class.carbon:[[@LINE+7]]:3: error: cannot access private member `Overload` of type `Cpp.OverloadPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.OverloadPrivate.Overload(Cpp.PublicCall.PublicCall()); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_overload_set_private_base_class.carbon:[[@LINE+4]]:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.OverloadPrivate.Overload(Cpp.PublicCall.PublicCall()); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_overload_set_private_base_class.carbon:[[@LINE+3]]:3-30: error: cannot access private member `Overload` of type `Cpp.OverloadPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_import_overload_set_private_base_class.carbon:[[@LINE+2]]:3-30: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.OverloadPrivate.Overload(Cpp.PublicCall.PublicCall()); - // CHECK:STDERR: fail_import_overload_set_private_base_class.carbon:[[@LINE+7]]:3: error: cannot access private member `Overload` of type `Cpp.OverloadPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.OverloadPrivate.Overload(Cpp.ProtectedCall.ProtectedCall()); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_overload_set_private_base_class.carbon:[[@LINE-4]]:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.OverloadPrivate.Overload(Cpp.PublicCall.PublicCall()); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_overload_set_private_base_class.carbon:[[@LINE+3]]:3-30: error: cannot access private member `Overload` of type `Cpp.OverloadPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_import_overload_set_private_base_class.carbon:[[@LINE-2]]:3-30: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.OverloadPrivate.Overload(Cpp.ProtectedCall.ProtectedCall()); - // CHECK:STDERR: fail_import_overload_set_private_base_class.carbon:[[@LINE+7]]:3: error: cannot access private member `Overload` of type `Cpp.OverloadPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.OverloadPrivate.Overload(Cpp.PrivateCall.PrivateCall()); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_overload_set_private_base_class.carbon:[[@LINE-12]]:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.OverloadPrivate.Overload(Cpp.PublicCall.PublicCall()); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_overload_set_private_base_class.carbon:[[@LINE+3]]:3-30: error: cannot access private member `Overload` of type `Cpp.OverloadPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_import_overload_set_private_base_class.carbon:[[@LINE-6]]:3-30: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.OverloadPrivate.Overload(Cpp.PrivateCall.PrivateCall()); } @@ -792,28 +645,16 @@ class Derived { extend base: Cpp.OverloadPrivate; fn F() { - // CHECK:STDERR: fail_import_overload_set_private_base_class_derived.carbon:[[@LINE+7]]:5: error: cannot access private member `Overload` of type `Cpp.OverloadPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: Overload(Cpp.PublicCall.PublicCall()); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_import_overload_set_private_base_class_derived.carbon:[[@LINE+4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Overload(Cpp.PublicCall.PublicCall()); - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_import_overload_set_private_base_class_derived.carbon:[[@LINE+3]]:5-12: error: cannot access private member `Overload` of type `Cpp.OverloadPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_import_overload_set_private_base_class_derived.carbon:[[@LINE+2]]:5-12: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Overload(Cpp.PublicCall.PublicCall()); - // CHECK:STDERR: fail_import_overload_set_private_base_class_derived.carbon:[[@LINE+7]]:5: error: cannot access private member `Overload` of type `Cpp.OverloadPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: Overload(Cpp.ProtectedCall.ProtectedCall()); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_import_overload_set_private_base_class_derived.carbon:[[@LINE-4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Overload(Cpp.PublicCall.PublicCall()); - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_import_overload_set_private_base_class_derived.carbon:[[@LINE+3]]:5-12: error: cannot access private member `Overload` of type `Cpp.OverloadPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_import_overload_set_private_base_class_derived.carbon:[[@LINE-2]]:5-12: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Overload(Cpp.ProtectedCall.ProtectedCall()); - // CHECK:STDERR: fail_import_overload_set_private_base_class_derived.carbon:[[@LINE+7]]:5: error: cannot access private member `Overload` of type `Cpp.OverloadPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: Overload(Cpp.PrivateCall.PrivateCall()); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_import_overload_set_private_base_class_derived.carbon:[[@LINE-12]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Overload(Cpp.PublicCall.PublicCall()); - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_import_overload_set_private_base_class_derived.carbon:[[@LINE+3]]:5-12: error: cannot access private member `Overload` of type `Cpp.OverloadPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_import_overload_set_private_base_class_derived.carbon:[[@LINE-6]]:5-12: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Overload(Cpp.PrivateCall.PrivateCall()); } @@ -895,32 +736,20 @@ class Derived { extend base: Cpp.Public; fn CallStatic() { - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+7]]:5: error: cannot access private member `PrivateStatic` of type `Cpp.Public` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.Public.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.Public.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+3]]:5-28: error: cannot access private member `PrivateStatic` of type `Cpp.Public` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+2]]:5-28: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.Public.PrivateStatic(); - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+7]]:5: error: cannot access private member `PrivateStatic` of type `Cpp.Public` [ClassInvalidMemberAccess] - // CHECK:STDERR: Self.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE-4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.Public.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+3]]:5-22: error: cannot access private member `PrivateStatic` of type `Cpp.Public` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE-2]]:5-28: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Self.PrivateStatic(); } fn CallInstance(var instance: Cpp.Public) { //@dump-sem-ir-begin - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+7]]:5: error: cannot access private member `PrivateInstance` of type `Cpp.Public` [ClassInvalidMemberAccess] - // CHECK:STDERR: instance.PrivateInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: instance.PrivateInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+3]]:5-28: error: cannot access private member `PrivateInstance` of type `Cpp.Public` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+2]]:5-28: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: instance.PrivateInstance(); //@dump-sem-ir-end @@ -928,54 +757,30 @@ class Derived { } fn Call(var instance: Cpp.Public) { - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+7]]:3: error: cannot access protected member `ProtectedStatic` of type `Cpp.Public` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.Public.ProtectedStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+4]]:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.Public.ProtectedStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+3]]:3-28: error: cannot access protected member `ProtectedStatic` of type `Cpp.Public` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+2]]:3-28: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.Public.ProtectedStatic(); - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+7]]:3: error: cannot access protected member `ProtectedStatic` of type `Derived` [ClassInvalidMemberAccess] - // CHECK:STDERR: Derived.ProtectedStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE-4]]:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.Public.ProtectedStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+3]]:3-25: error: cannot access protected member `ProtectedStatic` of type `Derived` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE-2]]:3-28: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Derived.ProtectedStatic(); - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+7]]:3: error: cannot access private member `PrivateStatic` of type `Cpp.Public` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.Public.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE-46]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.Public.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+3]]:3-26: error: cannot access private member `PrivateStatic` of type `Cpp.Public` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE-28]]:5-28: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.Public.PrivateStatic(); - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+7]]:3: error: cannot access private member `PrivateStatic` of type `Cpp.Public` [ClassInvalidMemberAccess] - // CHECK:STDERR: Derived.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE-54]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.Public.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+3]]:3-23: error: cannot access private member `PrivateStatic` of type `Cpp.Public` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE-32]]:5-28: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Derived.PrivateStatic(); - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+7]]:3: error: cannot access protected member `ProtectedInstance` of type `Cpp.Public` [ClassInvalidMemberAccess] - // CHECK:STDERR: instance.ProtectedInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+4]]:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: instance.ProtectedInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+3]]:3-28: error: cannot access protected member `ProtectedInstance` of type `Cpp.Public` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+2]]:3-28: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: instance.ProtectedInstance(); - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+7]]:3: error: cannot access private member `PrivateInstance` of type `Cpp.Public` [ClassInvalidMemberAccess] - // CHECK:STDERR: instance.PrivateInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE-51]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: instance.PrivateInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+3]]:3-26: error: cannot access private member `PrivateInstance` of type `Cpp.Public` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE-29]]:5-28: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: instance.PrivateInstance(); } @@ -1021,110 +826,62 @@ class Derived { extend base: Cpp.Protected; fn CallStatic() { - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+7]]:5: error: cannot access private member `PrivateStatic` of type `Cpp.Protected` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.Protected.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.Protected.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+3]]:5-31: error: cannot access private member `PrivateStatic` of type `Cpp.Protected` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+2]]:5-31: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.Protected.PrivateStatic(); - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+7]]:5: error: cannot access private member `PrivateStatic` of type `Cpp.Protected` [ClassInvalidMemberAccess] - // CHECK:STDERR: Self.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE-4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.Protected.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+3]]:5-22: error: cannot access private member `PrivateStatic` of type `Cpp.Protected` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE-2]]:5-31: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Self.PrivateStatic(); } fn CallInstance(var instance: Cpp.Protected) { - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+7]]:5: error: cannot access private member `PrivateInstance` of type `Cpp.Protected` [ClassInvalidMemberAccess] - // CHECK:STDERR: instance.PrivateInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: instance.PrivateInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+3]]:5-28: error: cannot access private member `PrivateInstance` of type `Cpp.Protected` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+2]]:5-28: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: instance.PrivateInstance(); } } fn Call(var instance: Cpp.Protected) { - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+7]]:3: error: cannot access protected member `PublicStatic` of type `Cpp.Protected` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.Protected.PublicStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+4]]:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.Protected.PublicStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+3]]:3-28: error: cannot access protected member `PublicStatic` of type `Cpp.Protected` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+2]]:3-28: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.Protected.PublicStatic(); - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+7]]:3: error: cannot access protected member `PublicStatic` of type `Derived` [ClassInvalidMemberAccess] - // CHECK:STDERR: Derived.PublicStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE-4]]:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.Protected.PublicStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+3]]:3-22: error: cannot access protected member `PublicStatic` of type `Derived` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE-2]]:3-28: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Derived.PublicStatic(); - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+7]]:3: error: cannot access protected member `ProtectedStatic` of type `Cpp.Protected` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.Protected.ProtectedStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+4]]:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.Protected.ProtectedStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+3]]:3-31: error: cannot access protected member `ProtectedStatic` of type `Cpp.Protected` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+2]]:3-31: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.Protected.ProtectedStatic(); - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+7]]:3: error: cannot access protected member `ProtectedStatic` of type `Derived` [ClassInvalidMemberAccess] - // CHECK:STDERR: Derived.ProtectedStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE-4]]:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.Protected.ProtectedStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+3]]:3-25: error: cannot access protected member `ProtectedStatic` of type `Derived` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE-2]]:3-31: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Derived.ProtectedStatic(); - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+7]]:3: error: cannot access private member `PrivateStatic` of type `Cpp.Protected` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.Protected.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE-61]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.Protected.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+3]]:3-29: error: cannot access private member `PrivateStatic` of type `Cpp.Protected` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE-35]]:5-31: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.Protected.PrivateStatic(); - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+7]]:3: error: cannot access private member `PrivateStatic` of type `Cpp.Protected` [ClassInvalidMemberAccess] - // CHECK:STDERR: Derived.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE-69]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.Protected.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+3]]:3-23: error: cannot access private member `PrivateStatic` of type `Cpp.Protected` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE-39]]:5-31: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Derived.PrivateStatic(); - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+7]]:3: error: cannot access protected member `PublicInstance` of type `Cpp.Protected` [ClassInvalidMemberAccess] - // CHECK:STDERR: instance.PublicInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+4]]:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: instance.PublicInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+3]]:3-25: error: cannot access protected member `PublicInstance` of type `Cpp.Protected` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+2]]:3-25: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: instance.PublicInstance(); - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+7]]:3: error: cannot access protected member `ProtectedInstance` of type `Cpp.Protected` [ClassInvalidMemberAccess] - // CHECK:STDERR: instance.ProtectedInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+4]]:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: instance.ProtectedInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+3]]:3-28: error: cannot access protected member `ProtectedInstance` of type `Cpp.Protected` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+2]]:3-28: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: instance.ProtectedInstance(); - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+7]]:3: error: cannot access private member `PrivateInstance` of type `Cpp.Protected` [ClassInvalidMemberAccess] - // CHECK:STDERR: instance.PrivateInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE-75]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: instance.PrivateInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+3]]:3-26: error: cannot access private member `PrivateInstance` of type `Cpp.Protected` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE-41]]:5-28: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: instance.PrivateInstance(); } @@ -1139,162 +896,90 @@ class Derived { extend base: Cpp.Private; fn CallStatic() { - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+7]]:5: error: cannot access private member `PublicStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.Private.PublicStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.Private.PublicStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:5-28: error: cannot access private member `PublicStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+2]]:5-28: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.Private.PublicStatic(); - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+7]]:5: error: cannot access private member `PublicStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: Self.PublicStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.Private.PublicStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:5-21: error: cannot access private member `PublicStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-2]]:5-28: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Self.PublicStatic(); - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+7]]:5: error: cannot access private member `ProtectedStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.Private.ProtectedStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.Private.ProtectedStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:5-31: error: cannot access private member `ProtectedStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+2]]:5-31: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.Private.ProtectedStatic(); - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+7]]:5: error: cannot access private member `ProtectedStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: Self.ProtectedStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.Private.ProtectedStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:5-24: error: cannot access private member `ProtectedStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-2]]:5-31: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Self.ProtectedStatic(); - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+7]]:5: error: cannot access private member `PrivateStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.Private.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.Private.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:5-29: error: cannot access private member `PrivateStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+2]]:5-29: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.Private.PrivateStatic(); - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+7]]:5: error: cannot access private member `PrivateStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: Self.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.Private.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:5-22: error: cannot access private member `PrivateStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-2]]:5-29: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Self.PrivateStatic(); } fn CallInstance(var instance: Cpp.Private) { - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+7]]:5: error: cannot access private member `PublicInstance` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: instance.PublicInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: instance.PublicInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:5-27: error: cannot access private member `PublicInstance` of type `Cpp.Private` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+2]]:5-27: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: instance.PublicInstance(); - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+7]]:5: error: cannot access private member `ProtectedInstance` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: instance.ProtectedInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: instance.ProtectedInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:5-30: error: cannot access private member `ProtectedInstance` of type `Cpp.Private` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+2]]:5-30: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: instance.ProtectedInstance(); - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+7]]:5: error: cannot access private member `PrivateInstance` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: instance.PrivateInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: instance.PrivateInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:5-28: error: cannot access private member `PrivateInstance` of type `Cpp.Private` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+2]]:5-28: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: instance.PrivateInstance(); } } fn Call(var instance: Cpp.Private) { - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+7]]:3: error: cannot access private member `PublicStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.Private.PublicStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-79]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.Private.PublicStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:3-26: error: cannot access private member `PublicStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-45]]:5-28: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.Private.PublicStatic(); - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+7]]:3: error: cannot access private member `PublicStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: Derived.PublicStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-87]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.Private.PublicStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:3-22: error: cannot access private member `PublicStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-49]]:5-28: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Derived.PublicStatic(); - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+7]]:3: error: cannot access private member `ProtectedStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.Private.ProtectedStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-79]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.Private.ProtectedStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:3-29: error: cannot access private member `ProtectedStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-45]]:5-31: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.Private.ProtectedStatic(); - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+7]]:3: error: cannot access private member `ProtectedStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: Derived.ProtectedStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-87]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.Private.ProtectedStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:3-25: error: cannot access private member `ProtectedStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-49]]:5-31: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Derived.ProtectedStatic(); - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+7]]:3: error: cannot access private member `PrivateStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.Private.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-79]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.Private.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:3-27: error: cannot access private member `PrivateStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-45]]:5-29: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.Private.PrivateStatic(); - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+7]]:3: error: cannot access private member `PrivateStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: Derived.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-87]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.Private.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:3-23: error: cannot access private member `PrivateStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-49]]:5-29: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Derived.PrivateStatic(); - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+7]]:3: error: cannot access private member `PublicInstance` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: instance.PublicInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-77]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: instance.PublicInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:3-25: error: cannot access private member `PublicInstance` of type `Cpp.Private` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-43]]:5-27: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: instance.PublicInstance(); - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+7]]:3: error: cannot access private member `ProtectedInstance` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: instance.ProtectedInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-76]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: instance.ProtectedInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:3-28: error: cannot access private member `ProtectedInstance` of type `Cpp.Private` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-42]]:5-30: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: instance.ProtectedInstance(); - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+7]]:3: error: cannot access private member `PrivateInstance` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: instance.PrivateInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-75]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: instance.PrivateInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:3-26: error: cannot access private member `PrivateInstance` of type `Cpp.Private` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-41]]:5-28: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: instance.PrivateInstance(); } @@ -1340,110 +1025,62 @@ class Derived { extend base: Cpp.PublicProtected; fn CallStatic() { - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+7]]:5: error: cannot access private member `PrivateStatic` of type `Cpp.PublicProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.PublicProtected.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.PublicProtected.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+3]]:5-37: error: cannot access private member `PrivateStatic` of type `Cpp.PublicProtected` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+2]]:5-37: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.PublicProtected.PrivateStatic(); - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+7]]:5: error: cannot access private member `PrivateStatic` of type `Cpp.PublicProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: Self.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE-4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.PublicProtected.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+3]]:5-22: error: cannot access private member `PrivateStatic` of type `Cpp.PublicProtected` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE-2]]:5-37: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Self.PrivateStatic(); } fn CallInstance(var instance: Cpp.PublicProtected) { - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+7]]:5: error: cannot access private member `PrivateInstance` of type `Cpp.PublicProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: instance.PrivateInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: instance.PrivateInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+3]]:5-28: error: cannot access private member `PrivateInstance` of type `Cpp.PublicProtected` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+2]]:5-28: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: instance.PrivateInstance(); } } fn Call(var instance: Cpp.PublicProtected) { - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+7]]:3: error: cannot access protected member `PublicStatic` of type `Cpp.PublicProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.PublicProtected.PublicStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+4]]:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.PublicProtected.PublicStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+3]]:3-34: error: cannot access protected member `PublicStatic` of type `Cpp.PublicProtected` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+2]]:3-34: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.PublicProtected.PublicStatic(); - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+7]]:3: error: cannot access protected member `PublicStatic` of type `Derived` [ClassInvalidMemberAccess] - // CHECK:STDERR: Derived.PublicStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE-4]]:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.PublicProtected.PublicStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+3]]:3-22: error: cannot access protected member `PublicStatic` of type `Derived` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE-2]]:3-34: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Derived.PublicStatic(); - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+7]]:3: error: cannot access protected member `ProtectedStatic` of type `Cpp.PublicProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.PublicProtected.ProtectedStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+4]]:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.PublicProtected.ProtectedStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+3]]:3-37: error: cannot access protected member `ProtectedStatic` of type `Cpp.PublicProtected` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+2]]:3-37: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.PublicProtected.ProtectedStatic(); - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+7]]:3: error: cannot access protected member `ProtectedStatic` of type `Derived` [ClassInvalidMemberAccess] - // CHECK:STDERR: Derived.ProtectedStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE-4]]:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.PublicProtected.ProtectedStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+3]]:3-25: error: cannot access protected member `ProtectedStatic` of type `Derived` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE-2]]:3-37: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Derived.ProtectedStatic(); - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+7]]:3: error: cannot access private member `PrivateStatic` of type `Cpp.PublicProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.PublicProtected.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE-61]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.PublicProtected.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+3]]:3-35: error: cannot access private member `PrivateStatic` of type `Cpp.PublicProtected` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE-35]]:5-37: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.PublicProtected.PrivateStatic(); - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+7]]:3: error: cannot access private member `PrivateStatic` of type `Cpp.PublicProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: Derived.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE-69]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.PublicProtected.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+3]]:3-23: error: cannot access private member `PrivateStatic` of type `Cpp.PublicProtected` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE-39]]:5-37: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Derived.PrivateStatic(); - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+7]]:3: error: cannot access protected member `PublicInstance` of type `Cpp.PublicProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: instance.PublicInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+4]]:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: instance.PublicInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+3]]:3-25: error: cannot access protected member `PublicInstance` of type `Cpp.PublicProtected` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+2]]:3-25: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: instance.PublicInstance(); - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+7]]:3: error: cannot access protected member `ProtectedInstance` of type `Cpp.PublicProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: instance.ProtectedInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+4]]:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: instance.ProtectedInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+3]]:3-28: error: cannot access protected member `ProtectedInstance` of type `Cpp.PublicProtected` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+2]]:3-28: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: instance.ProtectedInstance(); - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+7]]:3: error: cannot access private member `PrivateInstance` of type `Cpp.PublicProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: instance.PrivateInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE-75]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: instance.PrivateInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+3]]:3-26: error: cannot access private member `PrivateInstance` of type `Cpp.PublicProtected` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE-41]]:5-28: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: instance.PrivateInstance(); } @@ -1458,162 +1095,90 @@ class Derived { extend base: Cpp.PublicPrivate; fn CallStatic() { - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+7]]:5: error: cannot access private member `PublicStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.PublicPrivate.PublicStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.PublicPrivate.PublicStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:5-34: error: cannot access private member `PublicStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+2]]:5-34: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.PublicPrivate.PublicStatic(); - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+7]]:5: error: cannot access private member `PublicStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: Self.PublicStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.PublicPrivate.PublicStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:5-21: error: cannot access private member `PublicStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-2]]:5-34: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Self.PublicStatic(); - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+7]]:5: error: cannot access private member `ProtectedStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.PublicPrivate.ProtectedStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.PublicPrivate.ProtectedStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:5-37: error: cannot access private member `ProtectedStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+2]]:5-37: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.PublicPrivate.ProtectedStatic(); - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+7]]:5: error: cannot access private member `ProtectedStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: Self.ProtectedStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.PublicPrivate.ProtectedStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:5-24: error: cannot access private member `ProtectedStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-2]]:5-37: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Self.ProtectedStatic(); - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+7]]:5: error: cannot access private member `PrivateStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.PublicPrivate.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.PublicPrivate.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:5-35: error: cannot access private member `PrivateStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+2]]:5-35: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.PublicPrivate.PrivateStatic(); - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+7]]:5: error: cannot access private member `PrivateStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: Self.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.PublicPrivate.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:5-22: error: cannot access private member `PrivateStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-2]]:5-35: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Self.PrivateStatic(); } fn CallInstance(var instance: Cpp.PublicPrivate) { - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+7]]:5: error: cannot access private member `PublicInstance` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: instance.PublicInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: instance.PublicInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:5-27: error: cannot access private member `PublicInstance` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+2]]:5-27: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: instance.PublicInstance(); - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+7]]:5: error: cannot access private member `ProtectedInstance` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: instance.ProtectedInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: instance.ProtectedInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:5-30: error: cannot access private member `ProtectedInstance` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+2]]:5-30: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: instance.ProtectedInstance(); - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+7]]:5: error: cannot access private member `PrivateInstance` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: instance.PrivateInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+4]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: instance.PrivateInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:5-28: error: cannot access private member `PrivateInstance` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+2]]:5-28: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: instance.PrivateInstance(); } } fn Call(var instance: Cpp.PublicPrivate) { - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+7]]:3: error: cannot access private member `PublicStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.PublicPrivate.PublicStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-79]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.PublicPrivate.PublicStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:3-32: error: cannot access private member `PublicStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-45]]:5-34: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.PublicPrivate.PublicStatic(); - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+7]]:3: error: cannot access private member `PublicStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: Derived.PublicStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-87]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.PublicPrivate.PublicStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:3-22: error: cannot access private member `PublicStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-49]]:5-34: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Derived.PublicStatic(); - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+7]]:3: error: cannot access private member `ProtectedStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.PublicPrivate.ProtectedStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-79]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.PublicPrivate.ProtectedStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:3-35: error: cannot access private member `ProtectedStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-45]]:5-37: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.PublicPrivate.ProtectedStatic(); - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+7]]:3: error: cannot access private member `ProtectedStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: Derived.ProtectedStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-87]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.PublicPrivate.ProtectedStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:3-25: error: cannot access private member `ProtectedStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-49]]:5-37: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Derived.ProtectedStatic(); - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+7]]:3: error: cannot access private member `PrivateStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: Cpp.PublicPrivate.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-79]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.PublicPrivate.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:3-33: error: cannot access private member `PrivateStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-45]]:5-35: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Cpp.PublicPrivate.PrivateStatic(); - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+7]]:3: error: cannot access private member `PrivateStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: Derived.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-87]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: Cpp.PublicPrivate.PrivateStatic(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:3-23: error: cannot access private member `PrivateStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-49]]:5-35: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: Derived.PrivateStatic(); - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+7]]:3: error: cannot access private member `PublicInstance` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: instance.PublicInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-77]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: instance.PublicInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:3-25: error: cannot access private member `PublicInstance` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-43]]:5-27: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: instance.PublicInstance(); - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+7]]:3: error: cannot access private member `ProtectedInstance` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: instance.ProtectedInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-76]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: instance.ProtectedInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:3-28: error: cannot access private member `ProtectedInstance` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-42]]:5-30: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: instance.ProtectedInstance(); - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+7]]:3: error: cannot access private member `PrivateInstance` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: instance.PrivateInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-75]]:5: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: instance.PrivateInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:3-26: error: cannot access private member `PrivateInstance` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] + // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-41]]:5-28: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: instance.PrivateInstance(); } diff --git a/toolchain/check/testdata/interop/cpp/class/import/base.carbon b/toolchain/check/testdata/interop/cpp/class/import/base.carbon index 9ef20f617a65..e2b088bee276 100644 --- a/toolchain/check/testdata/interop/cpp/class/import/base.carbon +++ b/toolchain/check/testdata/interop/cpp/class/import/base.carbon @@ -156,111 +156,71 @@ library "[[@TEST_NAME]]"; import Cpp library "multiple_inheritance.h"; 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 `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*)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return p; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `C*` to `Cpp.A*` [ConversionFailure] + // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.C*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; } 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 `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*)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return p; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `C*` to `Cpp.B*` [ConversionFailure] + // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.C*` does not implement interface `Core.ImplicitAs(Cpp.B*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; } 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 `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*)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return p; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `OneNonEmptyBase*` to `Cpp.Empty1*` [ConversionFailure] + // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.OneNonEmptyBase*` does not implement interface `Core.ImplicitAs(Cpp.Empty1*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; } 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 `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*)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return p; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `OneNonEmptyBase*` to `Cpp.Empty2*` [ConversionFailure] + // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.OneNonEmptyBase*` does not implement interface `Core.ImplicitAs(Cpp.Empty2*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; } 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 `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*)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return p; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `TwoNonEmptyBases*` to `Cpp.A*` [ConversionFailure] + // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.TwoNonEmptyBases*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; } 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 `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*)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return p; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `TwoNonEmptyBases*` to `Cpp.B*` [ConversionFailure] + // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.TwoNonEmptyBases*` does not implement interface `Core.ImplicitAs(Cpp.B*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; } 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 `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*)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return p; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `OnePolymorphicBase*` to `Cpp.A*` [ConversionFailure] + // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.OnePolymorphicBase*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; } 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 `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*)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return p; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `OnePolymorphicBase*` to `Cpp.B*` [ConversionFailure] + // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.OnePolymorphicBase*` does not implement interface `Core.ImplicitAs(Cpp.B*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; } fn ConvertTwoPolymorphicBasesToPolymorphic1(p: Cpp.TwoPolymorphicBases*) -> Cpp.Polymorphic1* { - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `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*)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return p; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `TwoPolymorphicBases*` to `Cpp.Polymorphic1*` [ConversionFailure] + // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.TwoPolymorphicBases*` does not implement interface `Core.ImplicitAs(Cpp.Polymorphic1*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; } fn ConvertTwoPolymorphicBasesToPolymorphic2(p: Cpp.TwoPolymorphicBases*) -> Cpp.Polymorphic2* { - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `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*)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return p; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `TwoPolymorphicBases*` to `Cpp.Polymorphic2*` [ConversionFailure] + // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.TwoPolymorphicBases*` does not implement interface `Core.ImplicitAs(Cpp.Polymorphic2*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; } @@ -308,12 +268,8 @@ library "[[@TEST_NAME]]"; import Cpp library "virtual_inheritance.h"; fn Convert(p: Cpp.VirtB*) -> Cpp.VirtA* { - // CHECK:STDERR: fail_todo_use_virtual_inheritance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `VirtB*` to `Cpp.VirtA*` [ConversionFailure] - // CHECK:STDERR: return p; - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_todo_use_virtual_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.VirtB*` does not implement interface `Core.ImplicitAs(Cpp.VirtA*)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return p; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_todo_use_virtual_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `VirtB*` to `Cpp.VirtA*` [ConversionFailure] + // CHECK:STDERR: fail_todo_use_virtual_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.VirtB*` does not implement interface `Core.ImplicitAs(Cpp.VirtA*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; } @@ -343,89 +299,57 @@ library "[[@TEST_NAME]]"; import Cpp library "diamond.h"; fn ConvertBA(p: Cpp.DiamondB*) -> Cpp.DiamondA* { - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `DiamondB*` to `Cpp.DiamondA*` [ConversionFailure] - // CHECK:STDERR: return p; - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:3: note: type `Cpp.DiamondB*` does not implement interface `Core.ImplicitAs(Cpp.DiamondA*)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return p; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `DiamondB*` to `Cpp.DiamondA*` [ConversionFailure] + // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:3-11: note: type `Cpp.DiamondB*` does not implement interface `Core.ImplicitAs(Cpp.DiamondA*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; } fn ConvertCA(p: Cpp.DiamondC*) -> Cpp.DiamondA* { - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `DiamondC*` to `Cpp.DiamondA*` [ConversionFailure] - // CHECK:STDERR: return p; - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:3: note: type `Cpp.DiamondC*` does not implement interface `Core.ImplicitAs(Cpp.DiamondA*)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return p; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `DiamondC*` to `Cpp.DiamondA*` [ConversionFailure] + // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:3-11: note: type `Cpp.DiamondC*` does not implement interface `Core.ImplicitAs(Cpp.DiamondA*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; } fn ConvertDB(p: Cpp.DiamondD*) -> Cpp.DiamondB* { - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `DiamondD*` to `Cpp.DiamondB*` [ConversionFailure] - // CHECK:STDERR: return p; - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:3: note: type `Cpp.DiamondD*` does not implement interface `Core.ImplicitAs(Cpp.DiamondB*)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return p; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `DiamondD*` to `Cpp.DiamondB*` [ConversionFailure] + // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:3-11: note: type `Cpp.DiamondD*` does not implement interface `Core.ImplicitAs(Cpp.DiamondB*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; } fn ConvertDC(p: Cpp.DiamondD*) -> Cpp.DiamondC* { - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `DiamondD*` to `Cpp.DiamondC*` [ConversionFailure] - // CHECK:STDERR: return p; - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:3: note: type `Cpp.DiamondD*` does not implement interface `Core.ImplicitAs(Cpp.DiamondC*)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return p; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `DiamondD*` to `Cpp.DiamondC*` [ConversionFailure] + // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:3-11: note: type `Cpp.DiamondD*` does not implement interface `Core.ImplicitAs(Cpp.DiamondC*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; } fn AccessBA(d: Cpp.DiamondD) -> i32 { - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:11: error: cannot convert expression of type `DiamondD` to `Cpp.DiamondB` with `as` [ConversionFailure] - // CHECK:STDERR: return (d as Cpp.DiamondB).b; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:11: note: type `Cpp.DiamondD` does not implement interface `Core.As(Cpp.DiamondB)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return (d as Cpp.DiamondB).b; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:11-27: error: cannot convert expression of type `DiamondD` to `Cpp.DiamondB` with `as` [ConversionFailure] + // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:11-27: note: type `Cpp.DiamondD` does not implement interface `Core.As(Cpp.DiamondB)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return (d as Cpp.DiamondB).b; } fn AccessCA(d: Cpp.DiamondD) -> i32 { - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:11: error: cannot convert expression of type `DiamondD` to `Cpp.DiamondC` with `as` [ConversionFailure] - // CHECK:STDERR: return (d as Cpp.DiamondC).b; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:11: note: type `Cpp.DiamondD` does not implement interface `Core.As(Cpp.DiamondC)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return (d as Cpp.DiamondC).b; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:11-27: error: cannot convert expression of type `DiamondD` to `Cpp.DiamondC` with `as` [ConversionFailure] + // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:11-27: note: type `Cpp.DiamondD` does not implement interface `Core.As(Cpp.DiamondC)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return (d as Cpp.DiamondC).b; } fn AccessDB(d: Cpp.DiamondD) -> i32 { - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:10: error: cannot implicitly convert expression of type `DiamondD` to `Cpp.DiamondB` [ConversionFailure] - // CHECK:STDERR: return d.b; - // CHECK:STDERR: ^~~ - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:10: note: type `Cpp.DiamondD` does not implement interface `Core.ImplicitAs(Cpp.DiamondB)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return d.b; - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:10-12: error: cannot implicitly convert expression of type `DiamondD` to `Cpp.DiamondB` [ConversionFailure] + // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:10-12: note: type `Cpp.DiamondD` does not implement interface `Core.ImplicitAs(Cpp.DiamondB)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return d.b; } fn AccessDC(d: Cpp.DiamondD) -> i32 { - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:10: error: cannot implicitly convert expression of type `DiamondD` to `Cpp.DiamondC` [ConversionFailure] - // CHECK:STDERR: return d.c; - // CHECK:STDERR: ^~~ - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:10: note: type `Cpp.DiamondD` does not implement interface `Core.ImplicitAs(Cpp.DiamondC)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return d.c; - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:10-12: error: cannot implicitly convert expression of type `DiamondD` to `Cpp.DiamondC` [ConversionFailure] + // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:10-12: note: type `Cpp.DiamondD` does not implement interface `Core.ImplicitAs(Cpp.DiamondC)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return d.c; } @@ -441,9 +365,7 @@ library "[[@TEST_NAME]]"; import Cpp library "final.h"; class B { - // CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE+4]]:16: error: deriving from final type `FinalA`; base type must be an `abstract` or `base` class [BaseIsFinal] - // CHECK:STDERR: extend base: Cpp.FinalA; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE+2]]:16-25: error: deriving from final type `FinalA`; base type must be an `abstract` or `base` class [BaseIsFinal] // CHECK:STDERR: extend base: Cpp.FinalA; } @@ -459,9 +381,7 @@ library "[[@TEST_NAME]]"; import Cpp library "union.h"; class V { - // CHECK:STDERR: fail_derive_from_union.carbon:[[@LINE+4]]:16: error: deriving from final type `U`; base type must be an `abstract` or `base` class [BaseIsFinal] - // CHECK:STDERR: extend base: Cpp.U; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_derive_from_union.carbon:[[@LINE+2]]:16-20: error: deriving from final type `U`; base type must be an `abstract` or `base` class [BaseIsFinal] // CHECK:STDERR: extend base: Cpp.U; } diff --git a/toolchain/check/testdata/interop/cpp/class/import/class.carbon b/toolchain/check/testdata/interop/cpp/class/import/class.carbon index 373803e0926f..7dea034bdac0 100644 --- a/toolchain/check/testdata/interop/cpp/class/import/class.carbon +++ b/toolchain/check/testdata/interop/cpp/class/import/class.carbon @@ -35,13 +35,9 @@ library "[[@TEST_NAME]]"; import Cpp library "declaration.h"; fn MyF() { - // CHECK:STDERR: fail_use_declaration_as_definition.carbon:[[@LINE+8]]:19: error: binding pattern has incomplete type `DeclBar` in name binding declaration [IncompleteTypeInBindingDecl] - // CHECK:STDERR: var unused bar: Cpp.DeclBar; - // CHECK:STDERR: ^~~~~~~~~~~ - // CHECK:STDERR: fail_use_declaration_as_definition.carbon:[[@LINE-6]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_use_declaration_as_definition.carbon:[[@LINE+4]]:19-29: error: binding pattern has incomplete type `DeclBar` in name binding declaration [IncompleteTypeInBindingDecl] + // CHECK:STDERR: included from: fail_use_declaration_as_definition.carbon:[[@LINE-4]]:10 [InCppInclude] // CHECK:STDERR: ./declaration.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: class DeclBar; - // CHECK:STDERR: ^ // CHECK:STDERR: var unused bar: Cpp.DeclBar; } @@ -235,19 +231,11 @@ class Class1; class Generic(x: Core.Copy) { } -// CHECK:STDERR: fail_copy_witness_of_incomplete_class.carbon:[[@LINE+14]]:19: error: argument to C++ call has incomplete type `Cpp.Class1` [IncompleteTypeInCopyWitness] -// CHECK:STDERR: fn GenericUse(p2: Generic(Cpp.Class1)) { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_copy_witness_of_incomplete_class.carbon:[[@LINE-9]]:7: note: class was forward declared here [ClassForwardDeclaredHere] -// CHECK:STDERR: class Class1; -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_copy_witness_of_incomplete_class.carbon:[[@LINE-9]]:15: note: initializing generic parameter `x` declared here [InitializingGenericParam] -// CHECK:STDERR: class Generic(x: Core.Copy) { -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_copy_witness_of_incomplete_class.carbon:[[@LINE+6]]:19-37: error: argument to C++ call has incomplete type `Cpp.Class1` [IncompleteTypeInCopyWitness] +// CHECK:STDERR: fail_copy_witness_of_incomplete_class.carbon:[[@LINE-7]]:7: note: class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: fail_copy_witness_of_incomplete_class.carbon:[[@LINE-5]]:15-26: note: initializing generic parameter `x` declared here [InitializingGenericParam] // CHECK:STDERR: -// CHECK:STDERR: fail_copy_witness_of_incomplete_class.carbon:[[@LINE+4]]:15: warning: binding `p2` unused [UnusedBinding] -// CHECK:STDERR: fn GenericUse(p2: Generic(Cpp.Class1)) { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_copy_witness_of_incomplete_class.carbon:[[@LINE+2]]:15-37: warning: binding `p2` unused [UnusedBinding] // CHECK:STDERR: fn GenericUse(p2: Generic(Cpp.Class1)) { } diff --git a/toolchain/check/testdata/interop/cpp/class/import/constructor.carbon b/toolchain/check/testdata/interop/cpp/class/import/constructor.carbon index e92962fa4c2e..9930edec5b8b 100644 --- a/toolchain/check/testdata/interop/cpp/class/import/constructor.carbon +++ b/toolchain/check/testdata/interop/cpp/class/import/constructor.carbon @@ -80,12 +80,8 @@ fn G(generic T: Core.Default & Core.Destroy) { } fn CallG() { - // CHECK:STDERR: fail_no_default.carbon:[[@LINE+7]]:3: error: cannot convert type `NoDefault` into type implementing `Core.Default & Core.Destroy` [ConversionFailureTypeToFacet] - // CHECK:STDERR: G(Cpp.NoDefault); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_no_default.carbon:[[@LINE-8]]:14: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn G(generic T: Core.Default & Core.Destroy) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_no_default.carbon:[[@LINE+3]]:3-18: error: cannot convert type `NoDefault` into type implementing `Core.Default & Core.Destroy` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_no_default.carbon:[[@LINE-6]]:14-43: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: G(Cpp.NoDefault); } @@ -212,26 +208,15 @@ library "[[@TEST_NAME]]"; import Cpp library "deleted.h"; fn F() { - // CHECK:STDERR: fail_import_deleted.carbon:[[@LINE+8]]:54: error: call to deleted function 'DeletedC' [CppInteropParseError] - // CHECK:STDERR: 15 | let unused c: Cpp.DeletedC = Cpp.DeletedC.DeletedC(); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_import_deleted.carbon:[[@LINE-6]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_deleted.carbon:[[@LINE+4]]:32-52: error: call to deleted function 'DeletedC' [CppInteropParseError] + // CHECK:STDERR: included from: fail_import_deleted.carbon:[[@LINE-4]]:10 [InCppInclude] // CHECK:STDERR: ./deleted.h:4:3: note: candidate constructor has been explicitly deleted [CppInteropParseNote] - // CHECK:STDERR: 4 | DeletedC() = delete; - // CHECK:STDERR: | ^ // CHECK:STDERR: let unused c: Cpp.DeletedC = Cpp.DeletedC.DeletedC(); - // CHECK:STDERR: fail_import_deleted.carbon:[[@LINE+12]]:55: error: call to deleted function 'DeletedD' [CppInteropParseError] - // CHECK:STDERR: 28 | let unused d: Cpp.DeletedD = Cpp.DeletedD.DeletedD(0); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_import_deleted.carbon:[[@LINE-15]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_deleted.carbon:[[@LINE+5]]:32-52: error: call to deleted function 'DeletedD' [CppInteropParseError] + // CHECK:STDERR: included from: fail_import_deleted.carbon:[[@LINE-9]]:10 [InCppInclude] // CHECK:STDERR: ./deleted.h:9:3: note: candidate constructor has been explicitly deleted [CppInteropParseNote] - // CHECK:STDERR: 9 | DeletedD(int) = delete; - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_import_deleted.carbon:[[@LINE-19]]:10: in file included here [InCppInclude] // CHECK:STDERR: ./deleted.h:10:3: note: candidate constructor [CppInteropParseNote] - // CHECK:STDERR: 10 | DeletedD(short); - // CHECK:STDERR: | ^ // CHECK:STDERR: let unused d: Cpp.DeletedD = Cpp.DeletedD.DeletedD(0); } @@ -300,13 +285,9 @@ library "[[@TEST_NAME]]"; import Cpp library "incomplete.h"; fn F() { - // CHECK:STDERR: fail_import_incomplete.carbon:[[@LINE+8]]:4: error: member access into incomplete class `Cpp.IncompleteC` [QualifiedExprInIncompleteClassScope] - // CHECK:STDERR: Cpp.IncompleteC.IncompleteC(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_incomplete.carbon:[[@LINE-6]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_incomplete.carbon:[[@LINE+4]]:4-30: error: member access into incomplete class `Cpp.IncompleteC` [QualifiedExprInIncompleteClassScope] + // CHECK:STDERR: included from: fail_import_incomplete.carbon:[[@LINE-4]]:10 [InCppInclude] // CHECK:STDERR: ./incomplete.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: class IncompleteC; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.IncompleteC.IncompleteC(); } diff --git a/toolchain/check/testdata/interop/cpp/class/import/field.carbon b/toolchain/check/testdata/interop/cpp/class/import/field.carbon index 68289ec4a77b..180462b098ca 100644 --- a/toolchain/check/testdata/interop/cpp/class/import/field.carbon +++ b/toolchain/check/testdata/interop/cpp/class/import/field.carbon @@ -125,31 +125,23 @@ fn G(s: Cpp.BitfieldUnion) -> i32 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_todo_use_bitfields.carbon:[[@LINE+4]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_todo_use_bitfields.carbon:[[@LINE+2]]:10 [InCppInclude] // CHECK:STDERR: ./with_bitfields.h:4:7: error: semantics TODO: `Unsupported: field declaration has unhandled type or kind` [SemanticsTodo] -// CHECK:STDERR: int b : 2; -// CHECK:STDERR: ^ import Cpp library "with_bitfields.h"; fn F(s: Cpp.BitfieldStruct) -> i32 { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_use_bitfields.carbon:[[@LINE+8]]:10: note: in `Cpp` name lookup for `b` [InCppNameLookup] - // CHECK:STDERR: return s.b; - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_todo_use_bitfields.carbon:[[@LINE+4]]:10-12: note: in `Cpp` name lookup for `b` [InCppNameLookup] // CHECK:STDERR: - // CHECK:STDERR: fail_todo_use_bitfields.carbon:[[@LINE-8]]:10: in file included here [InCppInclude] + // CHECK:STDERR: included from: fail_todo_use_bitfields.carbon:[[@LINE-6]]:10 [InCppInclude] // CHECK:STDERR: ./with_bitfields.h:9:7: error: semantics TODO: `Unsupported: field declaration has unhandled type or kind` [SemanticsTodo] - // CHECK:STDERR: int d : 3; - // CHECK:STDERR: ^ return s.b; //@dump-sem-ir-end } fn G(s: Cpp.BitfieldUnion) -> i32 { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_use_bitfields.carbon:[[@LINE+4]]:10: note: in `Cpp` name lookup for `d` [InCppNameLookup] - // CHECK:STDERR: return s.d; - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_todo_use_bitfields.carbon:[[@LINE+2]]:10-12: note: in `Cpp` name lookup for `d` [InCppNameLookup] // CHECK:STDERR: return s.d; //@dump-sem-ir-end @@ -183,16 +175,12 @@ fn Test(m: Cpp.UnsupportedMembers*) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_use_unsupported_members.carbon:[[@LINE+4]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_use_unsupported_members.carbon:[[@LINE+2]]:10 [InCppInclude] // CHECK:STDERR: ./unsupported_members.h:4:16: error: semantics TODO: `Unsupported: field declaration has unhandled type or kind` [SemanticsTodo] -// CHECK:STDERR: volatile int is_volatile; -// CHECK:STDERR: ^ import Cpp library "unsupported_members.h"; fn Test(m: Cpp.UnsupportedMembers*) { - // CHECK:STDERR: fail_use_unsupported_members.carbon:[[@LINE+4]]:23: note: in `Cpp` name lookup for `is_volatile` [InCppNameLookup] - // CHECK:STDERR: let unused a: i32 = m->is_volatile; - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_use_unsupported_members.carbon:[[@LINE+2]]:23-36: note: in `Cpp` name lookup for `is_volatile` [InCppNameLookup] // CHECK:STDERR: let unused a: i32 = m->is_volatile; } diff --git a/toolchain/check/testdata/interop/cpp/class/import/invalid.carbon b/toolchain/check/testdata/interop/cpp/class/import/invalid.carbon index 12e14a1ae964..478762d6afaf 100644 --- a/toolchain/check/testdata/interop/cpp/class/import/invalid.carbon +++ b/toolchain/check/testdata/interop/cpp/class/import/invalid.carbon @@ -16,9 +16,7 @@ library "[[@TEST_NAME]]"; import Cpp inline ''' struct Base { - // CHECK:STDERR: fail_invalid_base.carbon:[[@LINE+4]]:3: error: unknown type name 'no_such_type' [CppInteropParseError] - // CHECK:STDERR: 10 | no_such_type invalid; - // CHECK:STDERR: | ^ + // CHECK:STDERR: fail_invalid_base.carbon:[[@LINE+2]]:3: error: unknown type name 'no_such_type' [CppInteropParseError] // CHECK:STDERR: no_such_type invalid; }; diff --git a/toolchain/check/testdata/interop/cpp/class/import/method.carbon b/toolchain/check/testdata/interop/cpp/class/import/method.carbon index 66faa827e954..2e01230ccea3 100644 --- a/toolchain/check/testdata/interop/cpp/class/import/method.carbon +++ b/toolchain/check/testdata/interop/cpp/class/import/method.carbon @@ -59,44 +59,28 @@ library "[[@TEST_NAME]]"; import Cpp library "object_param_qualifiers.h"; fn Value(v: Cpp.HasQualifiers) { - // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+8]]:11: error: no matching function for call to 'plain' [CppInteropParseError] - // CHECK:STDERR: 15 | v.plain(); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE-6]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+4]]:3-9: error: no matching function for call to 'plain' [CppInteropParseError] + // CHECK:STDERR: included from: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE-4]]:10 [InCppInclude] // CHECK:STDERR: ./object_param_qualifiers.h:3:8: note: candidate function not viable: 'this' argument has type 'const HasQualifiers', but method is not marked const [CppInteropParseNote] - // CHECK:STDERR: 3 | void plain(); - // CHECK:STDERR: | ^ // CHECK:STDERR: v.plain(); // TODO: This should remain invalid once we support `volatile`. - // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+8]]:19: error: no matching function for call to 'volatile_this' [CppInteropParseError] - // CHECK:STDERR: 26 | v.volatile_this(); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE-17]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+4]]:3-17: error: no matching function for call to 'volatile_this' [CppInteropParseError] + // CHECK:STDERR: included from: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE-11]]:10 [InCppInclude] // CHECK:STDERR: ./object_param_qualifiers.h:5:8: note: candidate function not viable: 'this' argument has type 'const HasQualifiers', but method is not marked const [CppInteropParseNote] - // CHECK:STDERR: 5 | void volatile_this() volatile; - // CHECK:STDERR: | ^ // CHECK:STDERR: v.volatile_this(); - // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+8]]:14: error: no matching function for call to 'ref_this' [CppInteropParseError] - // CHECK:STDERR: 36 | v.ref_this(); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE-27]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+4]]:3-12: error: no matching function for call to 'ref_this' [CppInteropParseError] + // CHECK:STDERR: included from: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE-17]]:10 [InCppInclude] // CHECK:STDERR: ./object_param_qualifiers.h:7:8: note: candidate function not viable: 'this' argument has type 'const HasQualifiers', but method is not marked const [CppInteropParseNote] - // CHECK:STDERR: 7 | void ref_this() &; - // CHECK:STDERR: | ^ // CHECK:STDERR: v.ref_this(); - // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+8]]:18: error: no matching function for call to 'ref_ref_this' [CppInteropParseError] - // CHECK:STDERR: 46 | v.ref_ref_this(); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE-37]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+4]]:3-16: error: no matching function for call to 'ref_ref_this' [CppInteropParseError] + // CHECK:STDERR: included from: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE-23]]:10 [InCppInclude] // CHECK:STDERR: ./object_param_qualifiers.h:10:8: note: candidate function not viable: 'this' argument has type 'const HasQualifiers', but method is not marked const [CppInteropParseNote] - // CHECK:STDERR: 10 | void ref_ref_this() &&; - // CHECK:STDERR: | ^ // CHECK:STDERR: v.ref_ref_this(); } @@ -109,9 +93,7 @@ import Cpp library "object_param_qualifiers.h"; fn Ref(p: Cpp.HasQualifiers*) { // TODO: This should eventually be accepted if we support `volatile`. - // CHECK:STDERR: fail_todo_bad_object_param_qualifiers_by_ref.carbon:[[@LINE+4]]:3: error: semantics TODO: `Unsupported: parameter type: volatile struct HasQualifiers &` [SemanticsTodo] - // CHECK:STDERR: p->volatile_this(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_bad_object_param_qualifiers_by_ref.carbon:[[@LINE+2]]:3-20: error: semantics TODO: `Unsupported: parameter type: volatile struct HasQualifiers &` [SemanticsTodo] // CHECK:STDERR: p->volatile_this(); } @@ -123,23 +105,17 @@ library "[[@TEST_NAME]]"; import Cpp library "object_param_qualifiers.h"; fn Ref(p: Cpp.HasQualifiers*) { - // CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+8]]:19: error: no matching function for call to 'ref_ref_this' [CppInteropParseError] - // CHECK:STDERR: 15 | p->ref_ref_this(); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE-6]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./object_param_qualifiers.h:10:8: note: candidate function not viable: expects an rvalue for object argument [CppInteropParseNote] - // CHECK:STDERR: 10 | void ref_ref_this() &&; - // CHECK:STDERR: | ^ + // CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+5]]:3-17: error: no matching function for call to 'ref_ref_this' [CppInteropParseError] + // CHECK:STDERR: included from: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE-4]]:10 [InCppInclude] + // CHECK:STDERR: ./object_param_qualifiers.h:10:8: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: ./object_param_qualifiers.h:10:20-21: note: expects an rvalue for object argument [CppInteropParseNoteReason] // CHECK:STDERR: p->ref_ref_this(); - // CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+8]]:25: error: no matching function for call to 'const_ref_ref_this' [CppInteropParseError] - // CHECK:STDERR: 25 | p->const_ref_ref_this(); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE-16]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./object_param_qualifiers.h:11:8: note: candidate function not viable: expects an rvalue for object argument [CppInteropParseNote] - // CHECK:STDERR: 11 | void const_ref_ref_this() const&&; - // CHECK:STDERR: | ^ + // CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+5]]:3-23: error: no matching function for call to 'const_ref_ref_this' [CppInteropParseError] + // CHECK:STDERR: included from: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE-11]]:10 [InCppInclude] + // CHECK:STDERR: ./object_param_qualifiers.h:11:8: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: ./object_param_qualifiers.h:11:26-27: note: expects an rvalue for object argument [CppInteropParseNoteReason] // CHECK:STDERR: p->const_ref_ref_this(); } @@ -153,13 +129,10 @@ import Cpp library "object_param_qualifiers.h"; fn Make() -> Cpp.HasQualifiers; fn F() { - // CHECK:STDERR: fail_bad_object_param_qualifiers_for_temporary.carbon:[[@LINE+8]]:19: error: no matching function for call to 'ref_this' [CppInteropParseError] - // CHECK:STDERR: 17 | Make().ref_this(); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_bad_object_param_qualifiers_for_temporary.carbon:[[@LINE-8]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./object_param_qualifiers.h:7:8: note: candidate function not viable: expects an lvalue for object argument [CppInteropParseNote] - // CHECK:STDERR: 7 | void ref_this() &; - // CHECK:STDERR: | ^ + // CHECK:STDERR: fail_bad_object_param_qualifiers_for_temporary.carbon:[[@LINE+5]]:3-17: error: no matching function for call to 'ref_this' [CppInteropParseError] + // CHECK:STDERR: included from: fail_bad_object_param_qualifiers_for_temporary.carbon:[[@LINE-6]]:10 [InCppInclude] + // CHECK:STDERR: ./object_param_qualifiers.h:7:8: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: ./object_param_qualifiers.h:7:16-17: note: expects an lvalue for object argument [CppInteropParseNoteReason] // CHECK:STDERR: Make().ref_this(); } @@ -234,9 +207,7 @@ struct ExplicitObjectParamUnsupported { '''; fn Call(e: Cpp.ExplicitObjectParamUnsupported) { - // CHECK:STDERR: fail_call_explicit_object_param_with_unsupported_type_param.carbon:[[@LINE+4]]:3: error: semantics TODO: `Unsupported: parameter type: _BitInt(23)` [SemanticsTodo] - // CHECK:STDERR: e.(Cpp.ExplicitObjectParamUnsupported.F)(1); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_call_explicit_object_param_with_unsupported_type_param.carbon:[[@LINE+2]]:3-45: error: semantics TODO: `Unsupported: parameter type: _BitInt(23)` [SemanticsTodo] // CHECK:STDERR: e.(Cpp.ExplicitObjectParamUnsupported.F)(1); } diff --git a/toolchain/check/testdata/interop/cpp/class/import/non_aggregate_init.carbon b/toolchain/check/testdata/interop/cpp/class/import/non_aggregate_init.carbon index be298692794d..84353542e859 100644 --- a/toolchain/check/testdata/interop/cpp/class/import/non_aggregate_init.carbon +++ b/toolchain/check/testdata/interop/cpp/class/import/non_aggregate_init.carbon @@ -29,12 +29,8 @@ library "[[@TEST_NAME]]"; import Cpp library "non_aggregate.h"; 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var _: Cpp.X = {}; - // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_non_aggregate_init.carbon:[[@LINE+3]]:3-14: error: cannot implicitly convert expression of type `{}` to `Cpp.X` [ConversionFailure] + // CHECK:STDERR: fail_non_aggregate_init.carbon:[[@LINE+2]]:3-14: note: type `{}` does not implement interface `Core.ImplicitAs(Cpp.X)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var _: Cpp.X = {}; } diff --git a/toolchain/check/testdata/interop/cpp/class/import/override.carbon b/toolchain/check/testdata/interop/cpp/class/import/override.carbon index 9d556e7b84a1..dccbb3279c5c 100644 --- a/toolchain/check/testdata/interop/cpp/class/import/override.carbon +++ b/toolchain/check/testdata/interop/cpp/class/import/override.carbon @@ -41,21 +41,11 @@ import Cpp library "overload.h"; class Overload0Params { extend base: Cpp.OverloadedBase; // - // CHECK:STDERR: fail_overload_no_matching_arity.carbon:[[@LINE+16]]:3: error: override without compatible virtual in base class [OverrideWithoutVirtualInBase] - // CHECK:STDERR: override fn f(self); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_overload_no_matching_arity.carbon:[[@LINE-8]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_overload_no_matching_arity.carbon:[[@LINE+6]]:3-22: error: override without compatible virtual in base class [OverrideWithoutVirtualInBase] + // CHECK:STDERR: included from: fail_overload_no_matching_arity.carbon:[[@LINE-6]]:10 [InCppInclude] // CHECK:STDERR: ./overload.h:6:16: note: base class function has more parameters (1 vs 0 excluding `self`) [OverrideCandidateArityMismatch] - // CHECK:STDERR: virtual void f(X x); - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_overload_no_matching_arity.carbon:[[@LINE-12]]:10: in file included here [InCppInclude] // CHECK:STDERR: ./overload.h:7:16: note: base class function has more parameters (1 vs 0 excluding `self`) [OverrideCandidateArityMismatch] - // CHECK:STDERR: virtual void f(Y y); - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_overload_no_matching_arity.carbon:[[@LINE-16]]:10: in file included here [InCppInclude] // CHECK:STDERR: ./overload.h:8:16: note: base class function has more parameters (2 vs 0 excluding `self`) [OverrideCandidateArityMismatch] - // CHECK:STDERR: virtual void f(X x, Y y); - // CHECK:STDERR: ^ // CHECK:STDERR: override fn f(self); } @@ -63,21 +53,11 @@ class Overload0Params { class Overload3Params { extend base: Cpp.OverloadedBase; // - // CHECK:STDERR: fail_overload_no_matching_arity.carbon:[[@LINE+16]]:3: error: override without compatible virtual in base class [OverrideWithoutVirtualInBase] - // CHECK:STDERR: override fn f(self, x: Cpp.X, y: Cpp.Y, z: Cpp.X); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_overload_no_matching_arity.carbon:[[@LINE-30]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_overload_no_matching_arity.carbon:[[@LINE+6]]:3-52: error: override without compatible virtual in base class [OverrideWithoutVirtualInBase] + // CHECK:STDERR: included from: fail_overload_no_matching_arity.carbon:[[@LINE-18]]:10 [InCppInclude] // CHECK:STDERR: ./overload.h:6:16: note: base class function has fewer parameters (1 vs 3 excluding `self`) [OverrideCandidateArityMismatch] - // CHECK:STDERR: virtual void f(X x); - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_overload_no_matching_arity.carbon:[[@LINE-34]]:10: in file included here [InCppInclude] // CHECK:STDERR: ./overload.h:7:16: note: base class function has fewer parameters (1 vs 3 excluding `self`) [OverrideCandidateArityMismatch] - // CHECK:STDERR: virtual void f(Y y); - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_overload_no_matching_arity.carbon:[[@LINE-38]]:10: in file included here [InCppInclude] // CHECK:STDERR: ./overload.h:8:16: note: base class function has fewer parameters (2 vs 3 excluding `self`) [OverrideCandidateArityMismatch] - // CHECK:STDERR: virtual void f(X x, Y y); - // CHECK:STDERR: ^ // CHECK:STDERR: override fn f(self, x: Cpp.X, y: Cpp.Y, z: Cpp.X); } @@ -94,19 +74,13 @@ import Cpp library "overload.h"; class OverloadX { extend base: Cpp.OverloadedBase; // - // CHECK:STDERR: fail_overload_type.carbon:[[@LINE+16]]:23: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: override fn f(self, x: Cpp.X); - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_overload_type.carbon:[[@LINE+10]]:23-30: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: // CHECK:STDERR: fail_overload_type.carbon: error: cannot implicitly convert expression of type `Cpp.Y` to `Cpp.X` [ConversionFailure] // CHECK:STDERR: fail_overload_type.carbon: note: type `Cpp.Y` does not implement interface `Core.ImplicitAs(Cpp.X)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_overload_type.carbon:[[@LINE+10]]:23: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: override fn f(self, x: Cpp.X); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_overload_type.carbon:[[@LINE-14]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_overload_type.carbon:[[@LINE+6]]:23-30: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: included from: fail_overload_type.carbon:[[@LINE-10]]:10 [InCppInclude] // CHECK:STDERR: ./overload.h:7:16: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: virtual void f(Y y); - // CHECK:STDERR: ^ // CHECK:STDERR: // CHECK:STDERR: fail_overload_type.carbon: error: cannot implicitly convert expression of type `Cpp.X` to `Cpp.Y` [ConversionFailure] // CHECK:STDERR: fail_overload_type.carbon: note: type `Cpp.X` does not implement interface `Core.ImplicitAs(Cpp.Y)` [MissingImplInMemberAccessInContext] @@ -116,19 +90,13 @@ class OverloadX { class OverloadY { extend base: Cpp.OverloadedBase; // - // CHECK:STDERR: fail_overload_type.carbon:[[@LINE+14]]:23: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: override fn f(self, y: Cpp.Y); - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_overload_type.carbon:[[@LINE+8]]:23-30: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: // CHECK:STDERR: fail_overload_type.carbon: error: cannot implicitly convert expression of type `Cpp.X` to `Cpp.Y` [ConversionFailure] // CHECK:STDERR: fail_overload_type.carbon: note: type `Cpp.X` does not implement interface `Core.ImplicitAs(Cpp.Y)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_overload_type.carbon:[[@LINE+8]]:23: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: override fn f(self, y: Cpp.Y); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_overload_type.carbon:[[@LINE-36]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_overload_type.carbon:[[@LINE+4]]:23-30: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: included from: fail_overload_type.carbon:[[@LINE-26]]:10 [InCppInclude] // CHECK:STDERR: ./overload.h:6:16: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: virtual void f(X x); - // CHECK:STDERR: ^ // CHECK:STDERR: override fn f(self, y: Cpp.Y); } diff --git a/toolchain/check/testdata/interop/cpp/class/import/template.carbon b/toolchain/check/testdata/interop/cpp/class/import/template.carbon index 74e46ed75658..e6ebd4b628ee 100644 --- a/toolchain/check/testdata/interop/cpp/class/import/template.carbon +++ b/toolchain/check/testdata/interop/cpp/class/import/template.carbon @@ -65,17 +65,10 @@ 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+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: fail_use_instantiation_error.carbon:[[@LINE+5]]:8-22: error: member access into incomplete class `Cpp.X` [QualifiedExprInIncompleteClassScope] +// CHECK:STDERR: included from: fail_use_instantiation_error.carbon:[[@LINE-6]]:10 [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 @@ -296,11 +289,11 @@ fn G() { // CHECK:STDOUT: %x.var_patt: %pattern_type.d94 = var_pattern %x.patt [concrete = constants.%x.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %y.var: ref %i32 = var_storage %y.var_patt [concrete] -// CHECK:STDOUT: %.loc21: type = splice_block %type.ref.loc21 [concrete = constants.%i32] { -// CHECK:STDOUT: %Cpp.ref.loc21: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %.loc14: type = splice_block %type.ref.loc14 [concrete = constants.%i32] { +// CHECK:STDOUT: %Cpp.ref.loc14: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %Xint.ref: type = name_ref Xint, imports.%X.decl.b67 [concrete = constants.%X.c92] // CHECK:STDOUT: -// CHECK:STDOUT: %type.ref.loc21: type = name_ref r#type, %i32.2 [concrete = constants.%i32] +// CHECK:STDOUT: %type.ref.loc14: type = name_ref r#type, %i32.2 [concrete = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %y: ref %i32 = wrapper_binding y, %y.var [concrete = %y.var] // CHECK:STDOUT: name_binding_decl { @@ -319,14 +312,14 @@ fn G() { // 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.753] // CHECK:STDOUT: %.loc7: init %i32 = converted %int_0.loc7, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7 [concrete = constants.%int_0.753] // 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: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc21_1.1: = bound_method %int_0.loc21, %impl.elem0.loc21 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc21: = specific_function %impl.elem0.loc21, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc21_1.2: = bound_method %int_0.loc21, %specific_fn.loc21 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc21: init %i32 = call %bound_method.loc21_1.2(%int_0.loc21) [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc21: init %i32 = converted %int_0.loc21, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc21 [concrete = constants.%int_0.753] -// CHECK:STDOUT: assign file.%y.var, %.loc21 +// CHECK:STDOUT: %int_0.loc14: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] +// CHECK:STDOUT: %impl.elem0.loc14: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc14_1.1: = bound_method %int_0.loc14, %impl.elem0.loc14 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc14: = specific_function %impl.elem0.loc14, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc14_1.2: = bound_method %int_0.loc14, %specific_fn.loc14 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc14: init %i32 = call %bound_method.loc14_1.2(%int_0.loc14) [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc14: init %i32 = converted %int_0.loc14, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc14 [concrete = constants.%int_0.753] +// CHECK:STDOUT: assign file.%y.var, %.loc14 // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interop/cpp/class/import/union.carbon b/toolchain/check/testdata/interop/cpp/class/import/union.carbon index ddc477fcd1c1..bf9afea6246e 100644 --- a/toolchain/check/testdata/interop/cpp/class/import/union.carbon +++ b/toolchain/check/testdata/interop/cpp/class/import/union.carbon @@ -35,13 +35,9 @@ library "[[@TEST_NAME]]"; import Cpp library "declaration.h"; fn MyF() { - // CHECK:STDERR: fail_use_declaration_as_definition.carbon:[[@LINE+8]]:19: error: binding pattern has incomplete type `DeclBar` in name binding declaration [IncompleteTypeInBindingDecl] - // CHECK:STDERR: var unused bar: Cpp.DeclBar; - // CHECK:STDERR: ^~~~~~~~~~~ - // CHECK:STDERR: fail_use_declaration_as_definition.carbon:[[@LINE-6]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_use_declaration_as_definition.carbon:[[@LINE+4]]:19-29: error: binding pattern has incomplete type `DeclBar` in name binding declaration [IncompleteTypeInBindingDecl] + // CHECK:STDERR: included from: fail_use_declaration_as_definition.carbon:[[@LINE-4]]:10 [InCppInclude] // CHECK:STDERR: ./declaration.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: union DeclBar; - // CHECK:STDERR: ^ // CHECK:STDERR: var unused bar: Cpp.DeclBar; } diff --git a/toolchain/check/testdata/interop/cpp/const/access.carbon b/toolchain/check/testdata/interop/cpp/const/access.carbon index ef1c90a690aa..7882247a420d 100644 --- a/toolchain/check/testdata/interop/cpp/const/access.carbon +++ b/toolchain/check/testdata/interop/cpp/const/access.carbon @@ -37,16 +37,10 @@ const S& Get(); '''; fn F() { - // CHECK:STDERR: fail_const_member_assign.carbon:[[@LINE+11]]:3: error: expression is not assignable [AssignmentToNonAssignable] - // CHECK:STDERR: Cpp.Get().x = 123; - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_const_member_assign.carbon:[[@LINE+5]]:3-13: error: expression is not assignable [AssignmentToNonAssignable] // CHECK:STDERR: - // CHECK:STDERR: fail_const_member_assign.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Core.IntLiteral` to `const i32` [ConversionFailure] - // CHECK:STDERR: Cpp.Get().x = 123; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_const_member_assign.carbon:[[@LINE+4]]:3: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(const i32)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: Cpp.Get().x = 123; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_const_member_assign.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `Core.IntLiteral` to `const i32` [ConversionFailure] + // CHECK:STDERR: fail_const_member_assign.carbon:[[@LINE+2]]:3-19: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(const i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: Cpp.Get().x = 123; } @@ -63,9 +57,7 @@ const S& Get(); '''; fn F() { - // CHECK:STDERR: fail_const_member_assign_cast.carbon:[[@LINE+4]]:3: error: expression is not assignable [AssignmentToNonAssignable] - // CHECK:STDERR: Cpp.Get().x = 123 as i32; - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_const_member_assign_cast.carbon:[[@LINE+2]]:3-13: error: expression is not assignable [AssignmentToNonAssignable] // CHECK:STDERR: Cpp.Get().x = 123 as i32; } diff --git a/toolchain/check/testdata/interop/cpp/enum/convert.carbon b/toolchain/check/testdata/interop/cpp/enum/convert.carbon index 7beda382a9e5..d65a24ff45be 100644 --- a/toolchain/check/testdata/interop/cpp/enum/convert.carbon +++ b/toolchain/check/testdata/interop/cpp/enum/convert.carbon @@ -39,48 +39,28 @@ library "[[@TEST_NAME]]"; import Cpp library "enum.h"; 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: Cpp.Enum.a as i8; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+3]]:3-18: error: cannot convert expression of type `Cpp.Enum` to `i8` with `as` [ConversionFailure] + // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+2]]:3-18: note: type `Cpp.Enum` does not implement interface `Core.As(i8)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: Cpp.Enum.a as i8; - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: Cpp.Enum.a as i32; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+3]]:3-19: error: cannot convert expression of type `Cpp.Enum` to `i32` with `as` [ConversionFailure] + // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+2]]:3-19: note: type `Cpp.Enum` does not implement interface `Core.As(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: Cpp.Enum.a as i32; - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: (42 as i8) as Cpp.Enum; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+3]]:3-24: error: cannot convert expression of type `i8` to `Cpp.Enum` with `as` [ConversionFailure] + // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+2]]:3-24: note: type `i8` does not implement interface `Core.As(Cpp.Enum)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: (42 as i8) as Cpp.Enum; - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: (42 as i32) as Cpp.Enum; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+3]]:3-25: error: cannot convert expression of type `i32` to `Cpp.Enum` with `as` [ConversionFailure] + // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+2]]:3-25: note: type `i32` does not implement interface `Core.As(Cpp.Enum)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: (42 as i32) as Cpp.Enum; - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: Cpp.a as Cpp.DifferentSize; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+3]]:3-28: error: cannot convert expression of type `Cpp.Enum` to `Cpp.DifferentSize` with `as` [ConversionFailure] + // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+2]]:3-28: note: type `Cpp.Enum` does not implement interface `Core.As(Cpp.DifferentSize)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: Cpp.a as Cpp.DifferentSize; } diff --git a/toolchain/check/testdata/interop/cpp/enum/eq.carbon b/toolchain/check/testdata/interop/cpp/enum/eq.carbon index b126aee10886..b5be4ce72c83 100644 --- a/toolchain/check/testdata/interop/cpp/enum/eq.carbon +++ b/toolchain/check/testdata/interop/cpp/enum/eq.carbon @@ -76,12 +76,8 @@ fn CompareGeneric[U: type, T: Core.EqWith(U)](x: T, y: U) -> bool { } fn CompareHeterogeneousFail(x: Cpp.Scoped, y: Cpp.Unscoped) -> bool { - // CHECK:STDERR: fail_heterogeneous.carbon:[[@LINE+7]]:10: error: cannot convert type `Cpp.Scoped` into type implementing `Core.EqWith(Cpp.Unscoped)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: return CompareGeneric(x, y); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_heterogeneous.carbon:[[@LINE-8]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn CompareGeneric[U: type, T: Core.EqWith(U)](x: T, y: U) -> bool { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_heterogeneous.carbon:[[@LINE+3]]:10-29: error: cannot convert type `Cpp.Scoped` into type implementing `Core.EqWith(Cpp.Unscoped)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_heterogeneous.carbon:[[@LINE-6]]:1-67: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: return CompareGeneric(x, y); } diff --git a/toolchain/check/testdata/interop/cpp/enum/incomplete.carbon b/toolchain/check/testdata/interop/cpp/enum/incomplete.carbon index 79b5dbd23151..c243f3b488c4 100644 --- a/toolchain/check/testdata/interop/cpp/enum/incomplete.carbon +++ b/toolchain/check/testdata/interop/cpp/enum/incomplete.carbon @@ -21,10 +21,8 @@ enum UnsizedEnum; library "[[@TEST_NAME]]"; -// CHECK:STDERR: import_declaration.carbon:[[@LINE+5]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: import_declaration.carbon:[[@LINE+3]]:10 [InCppInclude] // CHECK:STDERR: ./declaration.h:4:6: warning: forward references to 'enum' types are a Microsoft extension [CppInteropParseWarning] -// CHECK:STDERR: 4 | enum UnsizedEnum; -// CHECK:STDERR: | ^ // CHECK:STDERR: import Cpp library "declaration.h"; @@ -36,23 +34,17 @@ fn F(e: Cpp.UnsizedEnum); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_use_declaration_as_definition.carbon:[[@LINE+5]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_use_declaration_as_definition.carbon:[[@LINE+3]]:10 [InCppInclude] // CHECK:STDERR: ./declaration.h:4:6: warning: forward references to 'enum' types are a Microsoft extension [CppInteropParseWarning] -// CHECK:STDERR: 4 | enum UnsizedEnum; -// CHECK:STDERR: | ^ // CHECK:STDERR: import Cpp library "declaration.h"; fn MyF() { // TODO: It's a bit surprising to refer to this type as a class, even though // we model it as a class in Carbon. Consider customizing the diagnostic. - // CHECK:STDERR: fail_use_declaration_as_definition.carbon:[[@LINE+8]]:17: error: binding pattern has incomplete type `UnsizedEnum` in name binding declaration [IncompleteTypeInBindingDecl] - // CHECK:STDERR: var unused e: Cpp.UnsizedEnum; - // CHECK:STDERR: ^~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_use_declaration_as_definition.carbon:[[@LINE-8]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_use_declaration_as_definition.carbon:[[@LINE+4]]:17-31: error: binding pattern has incomplete type `UnsizedEnum` in name binding declaration [IncompleteTypeInBindingDecl] + // CHECK:STDERR: included from: fail_use_declaration_as_definition.carbon:[[@LINE-6]]:10 [InCppInclude] // CHECK:STDERR: ./declaration.h:4:6: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: enum UnsizedEnum; - // CHECK:STDERR: ^ // CHECK:STDERR: var unused e: Cpp.UnsizedEnum; } @@ -83,7 +75,7 @@ fn MyF() { // CHECK:STDOUT: %e.patt: %pattern_type = wrapper_binding_pattern e, %e.param_patt [concrete = constants.%e.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %e.param: %UnsizedEnum = value_param call_param0 -// CHECK:STDOUT: %.loc12: type = splice_block %UnsizedEnum.ref [concrete = constants.%UnsizedEnum] { +// CHECK:STDOUT: %.loc10: type = splice_block %UnsizedEnum.ref [concrete = constants.%UnsizedEnum] { // CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %UnsizedEnum.ref: type = name_ref UnsizedEnum, imports.%UnsizedEnum.decl [concrete = constants.%UnsizedEnum] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/interop/cpp/enum/invalid.carbon b/toolchain/check/testdata/interop/cpp/enum/invalid.carbon index 508be3d306b2..036ee157533e 100644 --- a/toolchain/check/testdata/interop/cpp/enum/invalid.carbon +++ b/toolchain/check/testdata/interop/cpp/enum/invalid.carbon @@ -15,9 +15,7 @@ library "[[@TEST_NAME]]"; import Cpp inline ''' -// CHECK:STDERR: fail_invalid_underlying_type.carbon:[[@LINE+4]]:20: error: unknown type name 'no_such_type' [CppInteropParseError] -// CHECK:STDERR: 9 | enum InvalidEnum : no_such_type {}; -// CHECK:STDERR: | ^ +// CHECK:STDERR: fail_invalid_underlying_type.carbon:[[@LINE+2]]:20: error: unknown type name 'no_such_type' [CppInteropParseError] // CHECK:STDERR: enum InvalidEnum : no_such_type {}; '''; diff --git a/toolchain/check/testdata/interop/cpp/enum/scoped.carbon b/toolchain/check/testdata/interop/cpp/enum/scoped.carbon index d6fa2f61b023..cf011910231a 100644 --- a/toolchain/check/testdata/interop/cpp/enum/scoped.carbon +++ b/toolchain/check/testdata/interop/cpp/enum/scoped.carbon @@ -33,9 +33,7 @@ library "[[@TEST_NAME]]"; import Cpp library "enum.h"; fn F() { - // CHECK:STDERR: fail_name_without_scope.carbon:[[@LINE+4]]:28: error: member name `b` not found in `Cpp` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: let unused b: Cpp.Enum = Cpp.b; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_name_without_scope.carbon:[[@LINE+2]]:28-32: error: member name `b` not found in `Cpp` [MemberNameNotFoundInInstScope] // CHECK:STDERR: let unused b: Cpp.Enum = Cpp.b; } diff --git a/toolchain/check/testdata/interop/cpp/enum/unscoped.carbon b/toolchain/check/testdata/interop/cpp/enum/unscoped.carbon index afad4083e563..3c66c199b681 100644 --- a/toolchain/check/testdata/interop/cpp/enum/unscoped.carbon +++ b/toolchain/check/testdata/interop/cpp/enum/unscoped.carbon @@ -36,21 +36,13 @@ library "[[@TEST_NAME]]"; import Cpp library "enum.h"; 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let unused c: Cpp.Other = Cpp.Enum.c; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_wrong_enum.carbon:[[@LINE+3]]:29-38: error: cannot implicitly convert expression of type `Cpp.Enum` to `Cpp.Other` [ConversionFailure] + // CHECK:STDERR: fail_wrong_enum.carbon:[[@LINE+2]]:29-38: 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: 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let unused c2: Cpp.Other = Cpp.c; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_wrong_enum.carbon:[[@LINE+3]]:30-34: error: cannot implicitly convert expression of type `Cpp.Enum` to `Cpp.Other` [ConversionFailure] + // CHECK:STDERR: fail_wrong_enum.carbon:[[@LINE+2]]:30-34: note: type `Cpp.Enum` does not implement interface `Core.ImplicitAs(Cpp.Other)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused c2: Cpp.Other = Cpp.c; } @@ -62,9 +54,7 @@ library "[[@TEST_NAME]]"; import Cpp library "enum.h"; fn F() { - // CHECK:STDERR: fail_non_enum_member.carbon:[[@LINE+4]]:29: error: member name `d` not found in `Cpp.Enum` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: let unused c: Cpp.Other = Cpp.Enum.d; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_non_enum_member.carbon:[[@LINE+2]]:29-38: error: member name `d` not found in `Cpp.Enum` [MemberNameNotFoundInInstScope] // CHECK:STDERR: let unused c: Cpp.Other = Cpp.Enum.d; } diff --git a/toolchain/check/testdata/interop/cpp/enum/using.carbon b/toolchain/check/testdata/interop/cpp/enum/using.carbon index 19a71ef16541..0a620675d501 100644 --- a/toolchain/check/testdata/interop/cpp/enum/using.carbon +++ b/toolchain/check/testdata/interop/cpp/enum/using.carbon @@ -28,15 +28,11 @@ using enum Zoo::Animal; library "[[@TEST_NAME]]"; -// CHECK:STDERR: import_enum.carbon:[[@LINE+10]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: import_enum.carbon:[[@LINE+6]]:10 [InCppInclude] // CHECK:STDERR: ./enum.h:5:7: warning: using enum declaration is a C++20 extension [CppInteropParseWarning] -// CHECK:STDERR: 5 | using enum Color; -// CHECK:STDERR: | ^ // CHECK:STDERR: -// CHECK:STDERR: import_enum.carbon:[[@LINE+5]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: import_enum.carbon:[[@LINE+3]]:10 [InCppInclude] // CHECK:STDERR: ./enum.h:12:7: warning: using enum declaration is a C++20 extension [CppInteropParseWarning] -// CHECK:STDERR: 12 | using enum Zoo::Animal; -// CHECK:STDERR: | ^ // CHECK:STDERR: import Cpp library "enum.h"; @@ -93,46 +89,46 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Cpp.ref.loc18_32: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %Color.ref.loc18_35: type = name_ref Color, imports.%Color.decl [concrete = constants.%Color] +// CHECK:STDOUT: %Cpp.ref.loc14_32: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Color.ref.loc14_35: type = name_ref Color, imports.%Color.decl [concrete = constants.%Color] // CHECK:STDOUT: %Red.ref: %Color = name_ref Red, imports.%int_0.59e [concrete = constants.%int_0.59e] -// CHECK:STDOUT: %.loc18: type = splice_block %Color.ref.loc18_23 [concrete = constants.%Color] { -// CHECK:STDOUT: %Cpp.ref.loc18_20: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %Color.ref.loc18_23: type = name_ref Color, imports.%Color.decl [concrete = constants.%Color] +// CHECK:STDOUT: %.loc14: type = splice_block %Color.ref.loc14_23 [concrete = constants.%Color] { +// CHECK:STDOUT: %Cpp.ref.loc14_20: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Color.ref.loc14_23: type = name_ref Color, imports.%Color.decl [concrete = constants.%Color] // CHECK:STDOUT: } // CHECK:STDOUT: %col: %Color = wrapper_binding col, %Red.ref // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %col.patt: %pattern_type.732 = value_binding_pattern col [concrete = constants.%col.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Cpp.ref.loc19_33: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Cpp.ref.loc15_33: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %Blue.ref: %Color = name_ref Blue, imports.%int_1.b76 [concrete = constants.%int_1.b76] -// CHECK:STDOUT: %.loc19: type = splice_block %Color.ref.loc19 [concrete = constants.%Color] { -// CHECK:STDOUT: %Cpp.ref.loc19_21: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %Color.ref.loc19: type = name_ref Color, imports.%Color.decl [concrete = constants.%Color] +// CHECK:STDOUT: %.loc15: type = splice_block %Color.ref.loc15 [concrete = constants.%Color] { +// CHECK:STDOUT: %Cpp.ref.loc15_21: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Color.ref.loc15: type = name_ref Color, imports.%Color.decl [concrete = constants.%Color] // CHECK:STDOUT: } // CHECK:STDOUT: %colb: %Color = wrapper_binding colb, %Blue.ref // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %colb.patt: %pattern_type.732 = value_binding_pattern colb [concrete = constants.%colb.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Cpp.ref.loc20_37: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %Zoo.ref.loc20_40: type = name_ref Zoo, imports.%Zoo.decl [concrete = constants.%Zoo] -// CHECK:STDOUT: %Animal.ref.loc20_44: type = name_ref Animal, imports.%Animal.decl [concrete = constants.%Animal] +// CHECK:STDOUT: %Cpp.ref.loc16_37: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Zoo.ref.loc16_40: type = name_ref Zoo, imports.%Zoo.decl [concrete = constants.%Zoo] +// CHECK:STDOUT: %Animal.ref.loc16_44: type = name_ref Animal, imports.%Animal.decl [concrete = constants.%Animal] // CHECK:STDOUT: %Cat.ref: %Animal = name_ref Cat, imports.%int_0.648 [concrete = constants.%int_0.648] -// CHECK:STDOUT: %.loc20: type = splice_block %Animal.ref.loc20_27 [concrete = constants.%Animal] { -// CHECK:STDOUT: %Cpp.ref.loc20_20: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %Zoo.ref.loc20_23: type = name_ref Zoo, imports.%Zoo.decl [concrete = constants.%Zoo] -// CHECK:STDOUT: %Animal.ref.loc20_27: type = name_ref Animal, imports.%Animal.decl [concrete = constants.%Animal] +// CHECK:STDOUT: %.loc16: type = splice_block %Animal.ref.loc16_27 [concrete = constants.%Animal] { +// CHECK:STDOUT: %Cpp.ref.loc16_20: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Zoo.ref.loc16_23: type = name_ref Zoo, imports.%Zoo.decl [concrete = constants.%Zoo] +// CHECK:STDOUT: %Animal.ref.loc16_27: type = name_ref Animal, imports.%Animal.decl [concrete = constants.%Animal] // CHECK:STDOUT: } // CHECK:STDOUT: %pet: %Animal = wrapper_binding pet, %Cat.ref // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %pet.patt: %pattern_type.8cd = value_binding_pattern pet [concrete = constants.%pet.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Cpp.ref.loc21_38: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Cpp.ref.loc17_38: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %Dog.ref: %Animal = name_ref Dog, imports.%int_1.e7b [concrete = constants.%int_1.e7b] -// CHECK:STDOUT: %.loc21: type = splice_block %Animal.ref.loc21 [concrete = constants.%Animal] { -// CHECK:STDOUT: %Cpp.ref.loc21_21: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %Zoo.ref.loc21: type = name_ref Zoo, imports.%Zoo.decl [concrete = constants.%Zoo] -// CHECK:STDOUT: %Animal.ref.loc21: type = name_ref Animal, imports.%Animal.decl [concrete = constants.%Animal] +// CHECK:STDOUT: %.loc17: type = splice_block %Animal.ref.loc17 [concrete = constants.%Animal] { +// CHECK:STDOUT: %Cpp.ref.loc17_21: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Zoo.ref.loc17: type = name_ref Zoo, imports.%Zoo.decl [concrete = constants.%Zoo] +// CHECK:STDOUT: %Animal.ref.loc17: type = name_ref Animal, imports.%Animal.decl [concrete = constants.%Animal] // CHECK:STDOUT: } // CHECK:STDOUT: %pet2: %Animal = wrapper_binding pet2, %Dog.ref // CHECK:STDOUT: name_binding_decl { diff --git a/toolchain/check/testdata/interop/cpp/function/export/array.carbon b/toolchain/check/testdata/interop/cpp/function/export/array.carbon index b69f3ceb77bc..9b5694460130 100644 --- a/toolchain/check/testdata/interop/cpp/function/export/array.carbon +++ b/toolchain/check/testdata/interop/cpp/function/export/array.carbon @@ -43,33 +43,21 @@ import Cpp; // HLSL extension, or by mapping to a `std::array` parameter. // TODO: These diagnostics are very bad. -// CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE+8]]:1: error: semantics TODO: `by-var array parameter` [SemanticsTodo] -// CHECK:STDERR: fn FArrayVarParam(var a: array(i32, 5)) -> i32 { return a[2]; } -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE+4]]:1-48: error: semantics TODO: `by-var array parameter` [SemanticsTodo] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE+4]]:1: error: semantics TODO: `failed to map C++ type to Carbon` [SemanticsTodo] -// CHECK:STDERR: fn FArrayVarParam(var a: array(i32, 5)) -> i32 { return a[2]; } -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE+2]]:1-48: error: semantics TODO: `failed to map C++ type to Carbon` [SemanticsTodo] // CHECK:STDERR: fn FArrayVarParam(var a: array(i32, 5)) -> i32 { return a[2]; } inline Cpp ''' int GArrayVarParam() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE+15]]:10: error: no member named 'FArrayVarParam' in namespace 'Carbon'; did you mean 'GArrayVarParam'? [CppInteropParseError] - // CHECK:STDERR: 39 | return Carbon::FArrayVarParam({1, 2, 3, 4, 5}); - // CHECK:STDERR: | ^~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: | GArrayVarParam - // CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE-6]]:5: note: 'GArrayVarParam' declared here [CppInteropParseNote] - // CHECK:STDERR: 22 | int GArrayVarParam() { - // CHECK:STDERR: | ^ + // CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE+7]]:10: error: no member named 'FArrayVarParam' in namespace 'Carbon'; did you mean 'GArrayVarParam'? [CppInteropParseError] + // CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE+6]]:10-31: note: replace with `GArrayVarParam` [CppInteropFixItReplacement] + // CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE-4]]:5: note: 'GArrayVarParam' declared here [CppInteropParseNote] // CHECK:STDERR: - // CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE+7]]:33: error: too many arguments to function call, expected 0, have 1 [CppInteropParseError] - // CHECK:STDERR: 39 | return Carbon::FArrayVarParam({1, 2, 3, 4, 5}); - // CHECK:STDERR: | ~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE-13]]:5: note: 'GArrayVarParam' declared here [CppInteropParseNote] - // CHECK:STDERR: 22 | int GArrayVarParam() { - // CHECK:STDERR: | ^ + // CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE+3]]:33-47: error: too many arguments to function call, expected 0, have 1 [CppInteropParseError] + // CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE-7]]:5: note: 'GArrayVarParam' declared here [CppInteropParseNote] // CHECK:STDERR: return Carbon::FArrayVarParam({1, 2, 3, 4, 5}); //@dump-sem-ir-end @@ -85,9 +73,7 @@ import Cpp; // types, as C++ does not have such return types. // TODO: Support this, perhaps by returning a `std::array`. -// CHECK:STDERR: fail_todo_array_return.carbon:[[@LINE+4]]:1: error: semantics TODO: `array return type` [SemanticsTodo] -// CHECK:STDERR: fn FArrayReturn() -> array(i32, 5) { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_array_return.carbon:[[@LINE+2]]:1-36: error: semantics TODO: `array return type` [SemanticsTodo] // CHECK:STDERR: fn FArrayReturn() -> array(i32, 5) { return (1, 2, 3, 4, 5); @@ -95,18 +81,12 @@ fn FArrayReturn() -> array(i32, 5) { inline Cpp ''' int GArrayReturn() { - // CHECK:STDERR: fail_todo_array_return.carbon:[[@LINE+8]]:16: error: no member named 'FArrayReturn' in namespace 'Carbon'; did you mean 'GArrayReturn'? [CppInteropParseError] - // CHECK:STDERR: 27 | auto &&arr = Carbon::FArrayReturn(); - // CHECK:STDERR: | ^~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: | GArrayReturn - // CHECK:STDERR: fail_todo_array_return.carbon:[[@LINE-5]]:5: note: 'GArrayReturn' declared here [CppInteropParseNote] - // CHECK:STDERR: 18 | int GArrayReturn() { - // CHECK:STDERR: | ^ + // CHECK:STDERR: fail_todo_array_return.carbon:[[@LINE+4]]:16: error: no member named 'FArrayReturn' in namespace 'Carbon'; did you mean 'GArrayReturn'? [CppInteropParseError] + // CHECK:STDERR: fail_todo_array_return.carbon:[[@LINE+3]]:16-35: note: replace with `GArrayReturn` [CppInteropFixItReplacement] + // CHECK:STDERR: fail_todo_array_return.carbon:[[@LINE-3]]:5: note: 'GArrayReturn' declared here [CppInteropParseNote] // CHECK:STDERR: auto &&arr = Carbon::FArrayReturn(); - // CHECK:STDERR: fail_todo_array_return.carbon:[[@LINE+4]]:13: error: subscripted value is not an array, pointer, or vector [CppInteropParseError] - // CHECK:STDERR: 32 | return arr[0]; - // CHECK:STDERR: | ~~~^~ + // CHECK:STDERR: fail_todo_array_return.carbon:[[@LINE+2]]:13: error: subscripted value is not an array, pointer, or vector [CppInteropParseError] // CHECK:STDERR: return arr[0]; } diff --git a/toolchain/check/testdata/interop/cpp/function/export/constructor.carbon b/toolchain/check/testdata/interop/cpp/function/export/constructor.carbon index 36e8e81c0ae0..1c48e92089eb 100644 --- a/toolchain/check/testdata/interop/cpp/function/export/constructor.carbon +++ b/toolchain/check/testdata/interop/cpp/function/export/constructor.carbon @@ -36,18 +36,10 @@ class FactoryIsMethod { inline Cpp ''' void CallFactoryIsMethod() { - // CHECK:STDERR: fail_factory_is_method.carbon:[[@LINE+13]]:27: error: no matching constructor for initialization of 'Carbon::FactoryIsMethod' [CppInteropParseError] - // CHECK:STDERR: 24 | Carbon::FactoryIsMethod a(42); - // CHECK:STDERR: | ^ ~~ - // CHECK:STDERR: fail_factory_is_method.carbon:[[@LINE-9]]:23: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const FactoryIsMethod' for 1st argument [CppInteropParseNote] - // CHECK:STDERR: 5 | class FactoryIsMethod { - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_factory_is_method.carbon:[[@LINE-12]]:23: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'FactoryIsMethod' for 1st argument [CppInteropParseNote] - // CHECK:STDERR: 5 | class FactoryIsMethod { - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_factory_is_method.carbon:[[@LINE-15]]:23: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided [CppInteropParseNote] - // CHECK:STDERR: 5 | class FactoryIsMethod { - // CHECK:STDERR: | ^ + // CHECK:STDERR: fail_factory_is_method.carbon:[[@LINE+5]]:27: error: no matching constructor for initialization of 'Carbon::FactoryIsMethod' [CppInteropParseError] + // CHECK:STDERR: fail_factory_is_method.carbon:[[@LINE-7]]:23: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const FactoryIsMethod' for 1st argument [CppInteropParseNote] + // CHECK:STDERR: fail_factory_is_method.carbon:[[@LINE-8]]:23: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'FactoryIsMethod' for 1st argument [CppInteropParseNote] + // CHECK:STDERR: fail_factory_is_method.carbon:[[@LINE-9]]:23: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided [CppInteropParseNote] // CHECK:STDERR: Carbon::FactoryIsMethod a(42); } @@ -64,18 +56,10 @@ class FactoryDoesntReturnSelf { inline Cpp ''' void CallFactoryDoesntReturnSelf() { - // CHECK:STDERR: fail_factory_doesnt_return_self.carbon:[[@LINE+13]]:35: error: no matching constructor for initialization of 'Carbon::FactoryDoesntReturnSelf' [CppInteropParseError] - // CHECK:STDERR: 24 | Carbon::FactoryDoesntReturnSelf a(42); - // CHECK:STDERR: | ^ ~~ - // CHECK:STDERR: fail_factory_doesnt_return_self.carbon:[[@LINE-9]]:31: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const FactoryDoesntReturnSelf' for 1st argument [CppInteropParseNote] - // CHECK:STDERR: 5 | class FactoryDoesntReturnSelf { - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_factory_doesnt_return_self.carbon:[[@LINE-12]]:31: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'FactoryDoesntReturnSelf' for 1st argument [CppInteropParseNote] - // CHECK:STDERR: 5 | class FactoryDoesntReturnSelf { - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_factory_doesnt_return_self.carbon:[[@LINE-15]]:31: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided [CppInteropParseNote] - // CHECK:STDERR: 5 | class FactoryDoesntReturnSelf { - // CHECK:STDERR: | ^ + // CHECK:STDERR: fail_factory_doesnt_return_self.carbon:[[@LINE+5]]:35: error: no matching constructor for initialization of 'Carbon::FactoryDoesntReturnSelf' [CppInteropParseError] + // CHECK:STDERR: fail_factory_doesnt_return_self.carbon:[[@LINE-7]]:31: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const FactoryDoesntReturnSelf' for 1st argument [CppInteropParseNote] + // CHECK:STDERR: fail_factory_doesnt_return_self.carbon:[[@LINE-8]]:31: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'FactoryDoesntReturnSelf' for 1st argument [CppInteropParseNote] + // CHECK:STDERR: fail_factory_doesnt_return_self.carbon:[[@LINE-9]]:31: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided [CppInteropParseNote] // CHECK:STDERR: Carbon::FactoryDoesntReturnSelf a(42); } @@ -92,18 +76,10 @@ class FactoryReturnsByRef { inline Cpp ''' void CallFactoryReturnsByRef() { - // CHECK:STDERR: fail_factory_returns_by_ref.carbon:[[@LINE+13]]:31: error: no matching constructor for initialization of 'Carbon::FactoryReturnsByRef' [CppInteropParseError] - // CHECK:STDERR: 24 | Carbon::FactoryReturnsByRef a(42); - // CHECK:STDERR: | ^ ~~ - // CHECK:STDERR: fail_factory_returns_by_ref.carbon:[[@LINE-9]]:27: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const FactoryReturnsByRef' for 1st argument [CppInteropParseNote] - // CHECK:STDERR: 5 | class FactoryReturnsByRef { - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_factory_returns_by_ref.carbon:[[@LINE-12]]:27: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'FactoryReturnsByRef' for 1st argument [CppInteropParseNote] - // CHECK:STDERR: 5 | class FactoryReturnsByRef { - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_factory_returns_by_ref.carbon:[[@LINE-15]]:27: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided [CppInteropParseNote] - // CHECK:STDERR: 5 | class FactoryReturnsByRef { - // CHECK:STDERR: | ^ + // CHECK:STDERR: fail_factory_returns_by_ref.carbon:[[@LINE+5]]:31: error: no matching constructor for initialization of 'Carbon::FactoryReturnsByRef' [CppInteropParseError] + // CHECK:STDERR: fail_factory_returns_by_ref.carbon:[[@LINE-7]]:27: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const FactoryReturnsByRef' for 1st argument [CppInteropParseNote] + // CHECK:STDERR: fail_factory_returns_by_ref.carbon:[[@LINE-8]]:27: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'FactoryReturnsByRef' for 1st argument [CppInteropParseNote] + // CHECK:STDERR: fail_factory_returns_by_ref.carbon:[[@LINE-9]]:27: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided [CppInteropParseNote] // CHECK:STDERR: Carbon::FactoryReturnsByRef a(42); } @@ -115,9 +91,7 @@ library "[[@TEST_NAME]]"; import Cpp; class GenericConstructor { - // CHECK:STDERR: fail_todo_call_generic_constructor.carbon:[[@LINE+4]]:3: error: semantics TODO: `support exporting generic member functions` [SemanticsTodo] - // CHECK:STDERR: fn GenericConstructor[T: type](_: T) -> Self { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_call_generic_constructor.carbon:[[@LINE+2]]:3-48: error: semantics TODO: `support exporting generic member functions` [SemanticsTodo] // CHECK:STDERR: fn GenericConstructor[T: type](_: T) -> Self { return {}; @@ -126,18 +100,10 @@ class GenericConstructor { inline Cpp ''' void CallGenericConstructor() { - // CHECK:STDERR: fail_todo_call_generic_constructor.carbon:[[@LINE+13]]:30: error: no matching constructor for initialization of 'Carbon::GenericConstructor' [CppInteropParseError] - // CHECK:STDERR: 30 | Carbon::GenericConstructor b(0); - // CHECK:STDERR: | ^ ~ - // CHECK:STDERR: fail_todo_call_generic_constructor.carbon:[[@LINE-15]]:26: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const GenericConstructor' for 1st argument [CppInteropParseNote] - // CHECK:STDERR: 5 | class GenericConstructor { - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_todo_call_generic_constructor.carbon:[[@LINE-18]]:26: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'GenericConstructor' for 1st argument [CppInteropParseNote] - // CHECK:STDERR: 5 | class GenericConstructor { - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_todo_call_generic_constructor.carbon:[[@LINE-21]]:26: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided [CppInteropParseNote] - // CHECK:STDERR: 5 | class GenericConstructor { - // CHECK:STDERR: | ^ + // CHECK:STDERR: fail_todo_call_generic_constructor.carbon:[[@LINE+5]]:30: error: no matching constructor for initialization of 'Carbon::GenericConstructor' [CppInteropParseError] + // CHECK:STDERR: fail_todo_call_generic_constructor.carbon:[[@LINE-11]]:26: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const GenericConstructor' for 1st argument [CppInteropParseNote] + // CHECK:STDERR: fail_todo_call_generic_constructor.carbon:[[@LINE-12]]:26: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'GenericConstructor' for 1st argument [CppInteropParseNote] + // CHECK:STDERR: fail_todo_call_generic_constructor.carbon:[[@LINE-13]]:26: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided [CppInteropParseNote] // CHECK:STDERR: Carbon::GenericConstructor b(0); } @@ -149,9 +115,7 @@ library "[[@TEST_NAME]]"; import Cpp; class GenericClass(T: type) { - // CHECK:STDERR: fail_todo_call_generic_class_constructor.carbon:[[@LINE+4]]:3: error: semantics TODO: `non-class non-namespace name scope` [SemanticsTodo] - // CHECK:STDERR: fn GenericClass(_: T) -> Self { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_call_generic_class_constructor.carbon:[[@LINE+2]]:3-33: error: semantics TODO: `non-class non-namespace name scope` [SemanticsTodo] // CHECK:STDERR: fn GenericClass(_: T) -> Self { return {}; @@ -160,18 +124,10 @@ class GenericClass(T: type) { inline Cpp ''' void CallGenericClass() { - // CHECK:STDERR: fail_todo_call_generic_class_constructor.carbon:[[@LINE+13]]:29: error: no matching constructor for initialization of 'Carbon::GenericClass' [CppInteropParseError] - // CHECK:STDERR: 30 | Carbon::GenericClass c(0); - // CHECK:STDERR: | ^ ~ - // CHECK:STDERR: fail_todo_call_generic_class_constructor.carbon:[[@LINE-15]]:29: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const GenericClass' for 1st argument [CppInteropParseNote] - // CHECK:STDERR: 5 | class GenericClass(T: type) { - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_todo_call_generic_class_constructor.carbon:[[@LINE-18]]:29: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'GenericClass' for 1st argument [CppInteropParseNote] - // CHECK:STDERR: 5 | class GenericClass(T: type) { - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_todo_call_generic_class_constructor.carbon:[[@LINE-21]]:29: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided [CppInteropParseNote] - // CHECK:STDERR: 5 | class GenericClass(T: type) { - // CHECK:STDERR: | ^ + // CHECK:STDERR: fail_todo_call_generic_class_constructor.carbon:[[@LINE+5]]:29: error: no matching constructor for initialization of 'Carbon::GenericClass' [CppInteropParseError] + // CHECK:STDERR: fail_todo_call_generic_class_constructor.carbon:[[@LINE-11]]:29: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const GenericClass' for 1st argument [CppInteropParseNote] + // CHECK:STDERR: fail_todo_call_generic_class_constructor.carbon:[[@LINE-12]]:29: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'GenericClass' for 1st argument [CppInteropParseNote] + // CHECK:STDERR: fail_todo_call_generic_class_constructor.carbon:[[@LINE-13]]:29: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided [CppInteropParseNote] // CHECK:STDERR: Carbon::GenericClass c(0); } diff --git a/toolchain/check/testdata/interop/cpp/function/export/function.carbon b/toolchain/check/testdata/interop/cpp/function/export/function.carbon index 75b9497d9daf..95e136ae487d 100644 --- a/toolchain/check/testdata/interop/cpp/function/export/function.carbon +++ b/toolchain/check/testdata/interop/cpp/function/export/function.carbon @@ -95,14 +95,9 @@ fn HasGenericArg(generic T: type, a: T) { a; } library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_todo_generic.carbon:[[@LINE+9]]:1: in import [InImport] -// CHECK:STDERR: other_generic.carbon:3:1: error: 1 argument passed to function expecting 2 arguments [CallArgCountMismatch] -// CHECK:STDERR: fn HasGenericArg(generic T: type, a: T) { a; } -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_todo_generic.carbon:[[@LINE+5]]:1: in import [InImport] -// CHECK:STDERR: other_generic.carbon:3:1: note: calling function declared here [InCallToEntity] -// CHECK:STDERR: fn HasGenericArg(generic T: type, a: T) { a; } -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: imported from: fail_todo_generic.carbon:[[@LINE+4]]:1 [InImport] +// CHECK:STDERR: other_generic.carbon:3:1-41: error: 1 argument passed to function expecting 2 arguments [CallArgCountMismatch] +// CHECK:STDERR: other_generic.carbon:3:1-41: note: calling function declared here [InCallToEntity] // CHECK:STDERR: import OtherGeneric; import Cpp inline ''' diff --git a/toolchain/check/testdata/interop/cpp/function/export/generic.carbon b/toolchain/check/testdata/interop/cpp/function/export/generic.carbon index 8923c24784cd..b78fc58bd59c 100644 --- a/toolchain/check/testdata/interop/cpp/function/export/generic.carbon +++ b/toolchain/check/testdata/interop/cpp/function/export/generic.carbon @@ -52,21 +52,15 @@ Carbon::B CallInterfaceF() { library "[[@TEST_NAME]]"; import Cpp; -// CHECK:STDERR: fail_todo_non_type_generic.carbon:[[@LINE+4]]:1: error: semantics TODO: `binding maps to a non-type template parameter` [SemanticsTodo] -// CHECK:STDERR: fn NonTypeF[unused N: i32]() {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_non_type_generic.carbon:[[@LINE+2]]:1-30: error: semantics TODO: `binding maps to a non-type template parameter` [SemanticsTodo] // CHECK:STDERR: fn NonTypeF[unused N: i32]() {} inline Cpp ''' void CallNonTypeF() { - // CHECK:STDERR: fail_todo_non_type_generic.carbon:[[@LINE+8]]:11: error: no member named 'NonTypeF' in namespace 'Carbon' [CppInteropParseError] - // CHECK:STDERR: 20 | Carbon::NonTypeF<3>(); - // CHECK:STDERR: | ^~~~~~~~ + // CHECK:STDERR: fail_todo_non_type_generic.carbon:[[@LINE+4]]:11-18: error: no member named 'NonTypeF' in namespace 'Carbon' [CppInteropParseError] // CHECK:STDERR: - // CHECK:STDERR: fail_todo_non_type_generic.carbon:[[@LINE+4]]:23: error: expected expression [CppInteropParseError] - // CHECK:STDERR: 20 | Carbon::NonTypeF<3>(); - // CHECK:STDERR: | ^ + // CHECK:STDERR: fail_todo_non_type_generic.carbon:[[@LINE+2]]:23: error: expected expression [CppInteropParseError] // CHECK:STDERR: Carbon::NonTypeF<3>(); } @@ -91,9 +85,7 @@ library "[[@TEST_NAME]]"; import Cpp; class EnclosingA(T: type) { - // CHECK:STDERR: fail_todo_enclosing_generic.carbon:[[@LINE+4]]:3: error: semantics TODO: `non-class non-namespace name scope` [SemanticsTodo] - // CHECK:STDERR: fn MemberF[U: type](x: T, y: U); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_enclosing_generic.carbon:[[@LINE+2]]:3-34: error: semantics TODO: `non-class non-namespace name scope` [SemanticsTodo] // CHECK:STDERR: fn MemberF[U: type](x: T, y: U); } @@ -105,9 +97,7 @@ void CallEnclosingF() { // is to test a generic function within an enclosing generic scope. // Carbon::EnclosingB b; - // CHECK:STDERR: fail_todo_enclosing_generic.carbon:[[@LINE+4]]:5: error: no member named 'MemberF' in 'Carbon::EnclosingA' [CppInteropParseError] - // CHECK:STDERR: 23 | b.MemberF(1, 2); - // CHECK:STDERR: | ~ ^ + // CHECK:STDERR: fail_todo_enclosing_generic.carbon:[[@LINE+2]]:5: error: no member named 'MemberF' in 'Carbon::EnclosingA' [CppInteropParseError] // CHECK:STDERR: b.MemberF(1, 2); } @@ -117,21 +107,15 @@ void CallEnclosingF() { library "[[@TEST_NAME]]"; import Cpp; -// CHECK:STDERR: fail_generic_unsupported_type.carbon:[[@LINE+4]]:1: error: semantics TODO: `failed to import C++ type` [SemanticsTodo] -// CHECK:STDERR: fn UnsupportedF[T: type](unused t: T) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_generic_unsupported_type.carbon:[[@LINE+2]]:1-39: error: semantics TODO: `failed to import C++ type` [SemanticsTodo] // CHECK:STDERR: fn UnsupportedF[T: type](unused t: T) {} inline Cpp ''' void CallUnsupportedF() { volatile int x; - // CHECK:STDERR: fail_generic_unsupported_type.carbon:[[@LINE+7]]:3: error: no matching function for call to 'UnsupportedF' [CppInteropParseError] - // CHECK:STDERR: 20 | Carbon::UnsupportedF(x); - // CHECK:STDERR: | ^~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_generic_unsupported_type.carbon:[[@LINE-8]]:39: note: candidate template ignored: substitution failure [with T = volatile int] [CppInteropParseNote] - // CHECK:STDERR: 8 | fn UnsupportedF[T: type](unused t: T) {} - // CHECK:STDERR: | ^ + // CHECK:STDERR: fail_generic_unsupported_type.carbon:[[@LINE+3]]:3-22: error: no matching function for call to 'UnsupportedF' [CppInteropParseError] + // CHECK:STDERR: fail_generic_unsupported_type.carbon:[[@LINE-6]]:39: note: candidate template ignored: substitution failure [with T = volatile int] [CppInteropParseNote] // CHECK:STDERR: Carbon::UnsupportedF(x); } diff --git a/toolchain/check/testdata/interop/cpp/function/import/arithmetic_types_bridged.carbon b/toolchain/check/testdata/interop/cpp/function/import/arithmetic_types_bridged.carbon index dd70f915b3d7..75dc207e023a 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/arithmetic_types_bridged.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/arithmetic_types_bridged.carbon @@ -123,9 +123,7 @@ import Cpp library "wchar_t_param.h"; fn F() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_import_wchar_t_param.carbon:[[@LINE+4]]:3: error: semantics TODO: `Unsupported: parameter type: wchar_t` [SemanticsTodo] - // CHECK:STDERR: Cpp.foo('X'); - // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_import_wchar_t_param.carbon:[[@LINE+2]]:3-14: error: semantics TODO: `Unsupported: parameter type: wchar_t` [SemanticsTodo] // CHECK:STDERR: Cpp.foo('X'); //@dump-sem-ir-end @@ -143,10 +141,8 @@ auto foo(char8_t c) -> void; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_todo_import_char8_t_param.carbon:[[@LINE+5]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_todo_import_char8_t_param.carbon:[[@LINE+3]]:10 [InCppInclude] // CHECK:STDERR: ./char8_t_param.h:2:10: error: unknown type name 'char8_t' [CppInteropParseError] -// CHECK:STDERR: 2 | auto foo(char8_t c) -> void; -// CHECK:STDERR: | ^ // CHECK:STDERR: import Cpp library "char8_t_param.h"; @@ -172,9 +168,7 @@ import Cpp library "char16_t_param.h"; fn F() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_import_char16_t_param.carbon:[[@LINE+4]]:3: error: semantics TODO: `Unsupported: parameter type: char16_t` [SemanticsTodo] - // CHECK:STDERR: Cpp.foo(1); - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_todo_import_char16_t_param.carbon:[[@LINE+2]]:3-12: error: semantics TODO: `Unsupported: parameter type: char16_t` [SemanticsTodo] // CHECK:STDERR: Cpp.foo(1); //@dump-sem-ir-end @@ -196,9 +190,7 @@ import Cpp library "char32_t_param.h"; fn F() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_import_char32_t_param.carbon:[[@LINE+4]]:3: error: semantics TODO: `Unsupported: parameter type: char32_t` [SemanticsTodo] - // CHECK:STDERR: Cpp.foo(1); - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_todo_import_char32_t_param.carbon:[[@LINE+2]]:3-12: error: semantics TODO: `Unsupported: parameter type: char32_t` [SemanticsTodo] // CHECK:STDERR: Cpp.foo(1); //@dump-sem-ir-end @@ -242,13 +234,9 @@ library "[[@TEST_NAME]]"; import Cpp library "short_param.h"; fn F() { - // CHECK:STDERR: fail_import_short_param_overflow_max.carbon:[[@LINE+8]]:11: error: integer value 32768 too large for type `i16` [IntTooLargeForType] - // CHECK:STDERR: Cpp.foo(0x8000); - // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_import_short_param_overflow_max.carbon:[[@LINE-6]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_short_param_overflow_max.carbon:[[@LINE+4]]:11-16: error: integer value 32768 too large for type `i16` [IntTooLargeForType] + // CHECK:STDERR: included from: fail_import_short_param_overflow_max.carbon:[[@LINE-4]]:10 [InCppInclude] // CHECK:STDERR: ./short_param.h:2:16: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto foo(short a) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.foo(0x8000); } @@ -272,13 +260,9 @@ library "[[@TEST_NAME]]"; import Cpp library "short_param.h"; fn F() { - // CHECK:STDERR: fail_import_short_param_overflow_min.carbon:[[@LINE+8]]:11: error: integer value -32769 too large for type `i16` [IntTooLargeForType] - // CHECK:STDERR: Cpp.foo(-0x8001); - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_import_short_param_overflow_min.carbon:[[@LINE-6]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_short_param_overflow_min.carbon:[[@LINE+4]]:11-17: error: integer value -32769 too large for type `i16` [IntTooLargeForType] + // CHECK:STDERR: included from: fail_import_short_param_overflow_min.carbon:[[@LINE-4]]:10 [InCppInclude] // CHECK:STDERR: ./short_param.h:2:16: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto foo(short a) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.foo(-0x8001); } @@ -290,16 +274,10 @@ library "[[@TEST_NAME]]"; import Cpp library "short_param.h"; 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)` [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] + // CHECK:STDERR: fail_import_short_param_int32_arg.carbon:[[@LINE+5]]:11-18: error: cannot implicitly convert expression of type `i32` to `i16` [ConversionFailure] + // CHECK:STDERR: fail_import_short_param_int32_arg.carbon:[[@LINE+4]]:11-18: note: type `i32` does not implement interface `Core.ImplicitAs(i16)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: included from: fail_import_short_param_int32_arg.carbon:[[@LINE-5]]:10 [InCppInclude] // CHECK:STDERR: ./short_param.h:2:16: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto foo(short a) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.foo(1 as i32); } @@ -527,9 +505,7 @@ import Cpp library "bit_int_24_param.h"; fn F() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_import_bit_int_24_param.carbon:[[@LINE+4]]:3: error: semantics TODO: `Unsupported: parameter type: bit_int_24` [SemanticsTodo] - // CHECK:STDERR: Cpp.foo(1); - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_todo_import_bit_int_24_param.carbon:[[@LINE+2]]:3-12: error: semantics TODO: `Unsupported: parameter type: bit_int_24` [SemanticsTodo] // CHECK:STDERR: Cpp.foo(1); //@dump-sem-ir-end @@ -1168,7 +1144,7 @@ fn F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value] -// CHECK:STDOUT: %.loc12: Core.CharLiteral = char_value U+0058 [concrete = constants.%.d16] +// CHECK:STDOUT: %.loc10: Core.CharLiteral = char_value U+0058 [concrete = constants.%.d16] // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1221,13 +1197,13 @@ fn F() { // CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] // CHECK:STDOUT: %impl.elem0: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc13_11.1: = bound_method %int_1, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %bound_method.loc11_11.1: = bound_method %int_1, %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.loc13_11.2: = bound_method %int_1, %specific_fn [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc13_11.2(%int_1) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc13_11.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc13_11.2: %i32 = converted %int_1, %.loc13_11.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl(%.loc13_11.2) +// CHECK:STDOUT: %bound_method.loc11_11.2: = bound_method %int_1, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc11_11.2(%int_1) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc11_11.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc11_11.2: %i32 = converted %int_1, %.loc11_11.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl(%.loc11_11.2) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interop/cpp/function/import/arithmetic_types_direct.carbon b/toolchain/check/testdata/interop/cpp/function/import/arithmetic_types_direct.carbon index 2a8c8982912f..661dd6418479 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/arithmetic_types_direct.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/arithmetic_types_direct.carbon @@ -54,13 +54,9 @@ library "[[@TEST_NAME]]"; import Cpp library "int_param.h"; fn F() { - // CHECK:STDERR: fail_import_int_param_overflow_max.carbon:[[@LINE+8]]:11: error: integer value 2147483648 too large for type `i32` [IntTooLargeForType] - // CHECK:STDERR: Cpp.foo(0x8000_0000); - // CHECK:STDERR: ^~~~~~~~~~~ - // CHECK:STDERR: fail_import_int_param_overflow_max.carbon:[[@LINE-6]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_int_param_overflow_max.carbon:[[@LINE+4]]:11-21: error: integer value 2147483648 too large for type `i32` [IntTooLargeForType] + // CHECK:STDERR: included from: fail_import_int_param_overflow_max.carbon:[[@LINE-4]]:10 [InCppInclude] // CHECK:STDERR: ./int_param.h:2:14: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto foo(int a) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.foo(0x8000_0000); } @@ -84,13 +80,9 @@ library "[[@TEST_NAME]]"; import Cpp library "int_param.h"; fn F() { - // CHECK:STDERR: fail_import_int_param_overflow_min.carbon:[[@LINE+8]]:11: error: integer value -2147483649 too large for type `i32` [IntTooLargeForType] - // CHECK:STDERR: Cpp.foo(-0x8000_0001); - // CHECK:STDERR: ^~~~~~~~~~~~ - // CHECK:STDERR: fail_import_int_param_overflow_min.carbon:[[@LINE-6]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_int_param_overflow_min.carbon:[[@LINE+4]]:11-22: error: integer value -2147483649 too large for type `i32` [IntTooLargeForType] + // CHECK:STDERR: included from: fail_import_int_param_overflow_min.carbon:[[@LINE-4]]:10 [InCppInclude] // CHECK:STDERR: ./int_param.h:2:14: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto foo(int a) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.foo(-0x8000_0001); } @@ -164,25 +156,17 @@ import Cpp library "unsigned_int_param.h"; fn F() { Cpp.foo(0); - // CHECK:STDERR: fail_import_unsigned_int_param_overflow.carbon:[[@LINE+8]]:11: error: negative integer value -1 converted to unsigned type `u32` [NegativeIntInUnsignedType] - // CHECK:STDERR: Cpp.foo(-1); - // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_import_unsigned_int_param_overflow.carbon:[[@LINE-8]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_unsigned_int_param_overflow.carbon:[[@LINE+4]]:11-12: error: negative integer value -1 converted to unsigned type `u32` [NegativeIntInUnsignedType] + // CHECK:STDERR: included from: fail_import_unsigned_int_param_overflow.carbon:[[@LINE-6]]:10 [InCppInclude] // CHECK:STDERR: ./unsigned_int_param.h:2:23: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto foo(unsigned int a) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.foo(-1); Cpp.foo(0x0_FFFF_FFFF); - // CHECK:STDERR: fail_import_unsigned_int_param_overflow.carbon:[[@LINE+8]]:11: error: integer value 4294967296 too large for type `u32` [IntTooLargeForType] - // CHECK:STDERR: Cpp.foo(0x1_0000_0000); - // CHECK:STDERR: ^~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_unsigned_int_param_overflow.carbon:[[@LINE-20]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_unsigned_int_param_overflow.carbon:[[@LINE+4]]:11-23: error: integer value 4294967296 too large for type `u32` [IntTooLargeForType] + // CHECK:STDERR: included from: fail_import_unsigned_int_param_overflow.carbon:[[@LINE-14]]:10 [InCppInclude] // CHECK:STDERR: ./unsigned_int_param.h:2:23: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto foo(unsigned int a) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.foo(0x1_0000_0000); } diff --git a/toolchain/check/testdata/interop/cpp/function/import/class.carbon b/toolchain/check/testdata/interop/cpp/function/import/class.carbon index 8560cd6a102a..9f6194b5f07f 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/class.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/class.carbon @@ -25,57 +25,29 @@ auto foo_decl_param2(ForwardDeclaredClass) -> void; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+8]]:10: in file included here [InCppInclude] -// CHECK:STDERR: ./decl_value_param_type.h:4:6: error: argument type 'ForwardDeclaredClass' is incomplete [CppInteropParseError] -// CHECK:STDERR: 4 | auto foo_decl_param1(ForwardDeclaredClass) -> void; -// CHECK:STDERR: | ^~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+4]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE+3]]:10 [InCppInclude] +// CHECK:STDERR: ./decl_value_param_type.h:4:6-20: error: argument type 'ForwardDeclaredClass' is incomplete [CppInteropParseError] // CHECK:STDERR: ./decl_value_param_type.h:2:7: note: forward declaration of 'ForwardDeclaredClass' [CppInteropParseNote] -// CHECK:STDERR: 2 | class ForwardDeclaredClass; -// CHECK:STDERR: | ^ import Cpp library "decl_value_param_type.h"; fn F(p: Cpp.ForwardDeclaredClass*) { - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+12]]:3: note: in thunk for C++ function used here [InCppThunk] - // CHECK:STDERR: Cpp.foo_decl_param1(*p); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+5]]:3-25: note: in thunk for C++ function used here [InCppThunk] // CHECK:STDERR: - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE-7]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./decl_value_param_type.h:5:6: error: argument type 'ForwardDeclaredClass' is incomplete [CppInteropParseError] - // CHECK:STDERR: 5 | auto foo_decl_param2(ForwardDeclaredClass) -> void; - // CHECK:STDERR: | ^~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE-11]]:10: in file included here [InCppInclude] + // CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE-5]]:10 [InCppInclude] + // CHECK:STDERR: ./decl_value_param_type.h:5:6-20: error: argument type 'ForwardDeclaredClass' is incomplete [CppInteropParseError] // CHECK:STDERR: ./decl_value_param_type.h:2:7: note: forward declaration of 'ForwardDeclaredClass' [CppInteropParseNote] - // CHECK:STDERR: 2 | class ForwardDeclaredClass; - // CHECK:STDERR: | ^ Cpp.foo_decl_param1(*p); - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+28]]:3: note: in thunk for C++ function used here [InCppThunk] - // CHECK:STDERR: Cpp.foo_decl_param2(*p); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+12]]:3-25: note: in thunk for C++ function used here [InCppThunk] // CHECK:STDERR: - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE-5]]:23: error: forming value of incomplete type `Cpp.ForwardDeclaredClass` [IncompleteTypeInValueConversion] - // CHECK:STDERR: Cpp.foo_decl_param1(*p); - // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE-23]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE-3]]:23-24: error: forming value of incomplete type `Cpp.ForwardDeclaredClass` [IncompleteTypeInValueConversion] + // CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE-12]]:10 [InCppInclude] // CHECK:STDERR: ./decl_value_param_type.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: class ForwardDeclaredClass; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE-27]]:10: in file included here [InCppInclude] // CHECK:STDERR: ./decl_value_param_type.h:4:42: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto foo_decl_param1(ForwardDeclaredClass) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+12]]:23: error: forming value of incomplete type `Cpp.ForwardDeclaredClass` [IncompleteTypeInValueConversion] - // CHECK:STDERR: Cpp.foo_decl_param2(*p); - // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE-35]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+5]]:23-24: error: forming value of incomplete type `Cpp.ForwardDeclaredClass` [IncompleteTypeInValueConversion] + // CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE-17]]:10 [InCppInclude] // CHECK:STDERR: ./decl_value_param_type.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: class ForwardDeclaredClass; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE-39]]:10: in file included here [InCppInclude] // CHECK:STDERR: ./decl_value_param_type.h:5:42: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto foo_decl_param2(ForwardDeclaredClass) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.foo_decl_param2(*p); } @@ -118,25 +90,15 @@ auto foo_non_copyable_param(NonCopyableClass) -> void; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_non_copyable_param_type.carbon:[[@LINE+12]]:10: in file included here [InCppInclude] -// CHECK:STDERR: ./non_copyable_param_type.h:6:6: error: call to deleted constructor of 'NonCopyableClass' [CppInteropParseError] -// CHECK:STDERR: 6 | auto foo_non_copyable_param(NonCopyableClass) -> void; -// CHECK:STDERR: | ^~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_import_non_copyable_param_type.carbon:[[@LINE+8]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_import_non_copyable_param_type.carbon:[[@LINE+4]]:10 [InCppInclude] +// CHECK:STDERR: ./non_copyable_param_type.h:6:6-27: error: call to deleted constructor of 'NonCopyableClass' [CppInteropParseError] // CHECK:STDERR: ./non_copyable_param_type.h:3:3: note: 'NonCopyableClass' has been explicitly marked deleted here [CppInteropParseNote] -// CHECK:STDERR: 3 | NonCopyableClass(const NonCopyableClass&) = delete; -// CHECK:STDERR: | ^ -// CHECK:STDERR: fail_import_non_copyable_param_type.carbon:[[@LINE+4]]:10: in file included here [InCppInclude] // CHECK:STDERR: ./non_copyable_param_type.h:6:45: note: passing argument to parameter here [CppInteropParseNote] -// CHECK:STDERR: 6 | auto foo_non_copyable_param(NonCopyableClass) -> void; -// CHECK:STDERR: | ^ import Cpp library "non_copyable_param_type.h"; fn F(c: Cpp.NonCopyableClass) { //@dump-sem-ir-begin - // CHECK:STDERR: fail_import_non_copyable_param_type.carbon:[[@LINE+4]]:3: note: in thunk for C++ function used here [InCppThunk] - // CHECK:STDERR: Cpp.foo_non_copyable_param(c); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_non_copyable_param_type.carbon:[[@LINE+2]]:3-31: note: in thunk for C++ function used here [InCppThunk] // CHECK:STDERR: Cpp.foo_non_copyable_param(c); //@dump-sem-ir-end @@ -172,24 +134,14 @@ fn F() { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_pass_move_only_param_value.carbon:[[@LINE+12]]:10: in file included here [InCppInclude] -// CHECK:STDERR: ./move_only_param_type.h:6:6: error: call to implicitly-deleted copy constructor of 'MoveOnlyClass' [CppInteropParseError] -// CHECK:STDERR: 6 | auto foo_move_only_param(MoveOnlyClass) -> void; -// CHECK:STDERR: | ^~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_pass_move_only_param_value.carbon:[[@LINE+8]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_pass_move_only_param_value.carbon:[[@LINE+4]]:10 [InCppInclude] +// CHECK:STDERR: ./move_only_param_type.h:6:6-24: error: call to implicitly-deleted copy constructor of 'MoveOnlyClass' [CppInteropParseError] // CHECK:STDERR: ./move_only_param_type.h:3:3: note: copy constructor is implicitly deleted because 'MoveOnlyClass' has a user-declared move constructor [CppInteropParseNote] -// CHECK:STDERR: 3 | MoveOnlyClass(MoveOnlyClass&&); -// CHECK:STDERR: | ^ -// CHECK:STDERR: fail_pass_move_only_param_value.carbon:[[@LINE+4]]:10: in file included here [InCppInclude] // CHECK:STDERR: ./move_only_param_type.h:6:39: note: passing argument to parameter here [CppInteropParseNote] -// CHECK:STDERR: 6 | auto foo_move_only_param(MoveOnlyClass) -> void; -// CHECK:STDERR: | ^ import Cpp library "move_only_param_type.h"; fn F(c: Cpp.MoveOnlyClass) { - // CHECK:STDERR: fail_pass_move_only_param_value.carbon:[[@LINE+4]]:3: note: in thunk for C++ function used here [InCppThunk] - // CHECK:STDERR: Cpp.foo_move_only_param(c); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_pass_move_only_param_value.carbon:[[@LINE+2]]:3-28: note: in thunk for C++ function used here [InCppThunk] // CHECK:STDERR: Cpp.foo_move_only_param(c); } @@ -198,24 +150,14 @@ fn F(c: Cpp.MoveOnlyClass) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_pass_move_only_param_ref.carbon:[[@LINE+12]]:10: in file included here [InCppInclude] -// CHECK:STDERR: ./move_only_param_type.h:6:6: error: call to implicitly-deleted copy constructor of 'MoveOnlyClass' [CppInteropParseError] -// CHECK:STDERR: 6 | auto foo_move_only_param(MoveOnlyClass) -> void; -// CHECK:STDERR: | ^~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_pass_move_only_param_ref.carbon:[[@LINE+8]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_pass_move_only_param_ref.carbon:[[@LINE+4]]:10 [InCppInclude] +// CHECK:STDERR: ./move_only_param_type.h:6:6-24: error: call to implicitly-deleted copy constructor of 'MoveOnlyClass' [CppInteropParseError] // CHECK:STDERR: ./move_only_param_type.h:3:3: note: copy constructor is implicitly deleted because 'MoveOnlyClass' has a user-declared move constructor [CppInteropParseNote] -// CHECK:STDERR: 3 | MoveOnlyClass(MoveOnlyClass&&); -// CHECK:STDERR: | ^ -// CHECK:STDERR: fail_pass_move_only_param_ref.carbon:[[@LINE+4]]:10: in file included here [InCppInclude] // CHECK:STDERR: ./move_only_param_type.h:6:39: note: passing argument to parameter here [CppInteropParseNote] -// CHECK:STDERR: 6 | auto foo_move_only_param(MoveOnlyClass) -> void; -// CHECK:STDERR: | ^ import Cpp library "move_only_param_type.h"; fn F(ref c: Cpp.MoveOnlyClass) { - // CHECK:STDERR: fail_pass_move_only_param_ref.carbon:[[@LINE+4]]:3: note: in thunk for C++ function used here [InCppThunk] - // CHECK:STDERR: Cpp.foo_move_only_param(c); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_pass_move_only_param_ref.carbon:[[@LINE+2]]:3-28: note: in thunk for C++ function used here [InCppThunk] // CHECK:STDERR: Cpp.foo_move_only_param(c); } @@ -224,24 +166,14 @@ fn F(ref c: Cpp.MoveOnlyClass) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_todo_pass_move_only_param_ref_by_move.carbon:[[@LINE+12]]:10: in file included here [InCppInclude] -// CHECK:STDERR: ./move_only_param_type.h:6:6: error: call to implicitly-deleted copy constructor of 'MoveOnlyClass' [CppInteropParseError] -// CHECK:STDERR: 6 | auto foo_move_only_param(MoveOnlyClass) -> void; -// CHECK:STDERR: | ^~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_todo_pass_move_only_param_ref_by_move.carbon:[[@LINE+8]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_todo_pass_move_only_param_ref_by_move.carbon:[[@LINE+4]]:10 [InCppInclude] +// CHECK:STDERR: ./move_only_param_type.h:6:6-24: error: call to implicitly-deleted copy constructor of 'MoveOnlyClass' [CppInteropParseError] // CHECK:STDERR: ./move_only_param_type.h:3:3: note: copy constructor is implicitly deleted because 'MoveOnlyClass' has a user-declared move constructor [CppInteropParseNote] -// CHECK:STDERR: 3 | MoveOnlyClass(MoveOnlyClass&&); -// CHECK:STDERR: | ^ -// CHECK:STDERR: fail_todo_pass_move_only_param_ref_by_move.carbon:[[@LINE+4]]:10: in file included here [InCppInclude] // CHECK:STDERR: ./move_only_param_type.h:6:39: note: passing argument to parameter here [CppInteropParseNote] -// CHECK:STDERR: 6 | auto foo_move_only_param(MoveOnlyClass) -> void; -// CHECK:STDERR: | ^ import Cpp library "move_only_param_type.h"; fn F(ref c: Cpp.MoveOnlyClass) { - // CHECK:STDERR: fail_todo_pass_move_only_param_ref_by_move.carbon:[[@LINE+4]]:3: note: in thunk for C++ function used here [InCppThunk] - // CHECK:STDERR: Cpp.foo_move_only_param(Cpp.move_move_only(ref c)); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_pass_move_only_param_ref_by_move.carbon:[[@LINE+2]]:3-52: note: in thunk for C++ function used here [InCppThunk] // CHECK:STDERR: Cpp.foo_move_only_param(Cpp.move_move_only(ref c)); } @@ -427,13 +359,9 @@ library "[[@TEST_NAME]]"; import Cpp library "incomplete.h"; fn F() { - // CHECK:STDERR: fail_import_incomplete.carbon:[[@LINE+8]]:3: error: member access into incomplete class `Cpp.Incomplete` [QualifiedExprInIncompleteClassScope] - // CHECK:STDERR: Cpp.Incomplete.foo(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_incomplete.carbon:[[@LINE-6]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_incomplete.carbon:[[@LINE+4]]:3-20: error: member access into incomplete class `Cpp.Incomplete` [QualifiedExprInIncompleteClassScope] + // CHECK:STDERR: included from: fail_import_incomplete.carbon:[[@LINE-4]]:10 [InCppInclude] // CHECK:STDERR: ./incomplete.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: class Incomplete; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.Incomplete.foo(); } @@ -496,36 +424,19 @@ auto foo_decl_value_return() -> DeclValueReturnClass; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+12]]:10: in file included here [InCppInclude] -// CHECK:STDERR: ./decl_value_return_type.h:4:6: error: calling 'foo_decl_value_return' with incomplete return type 'DeclValueReturnClass' [CppInteropParseError] -// CHECK:STDERR: 4 | auto foo_decl_value_return() -> DeclValueReturnClass; -// CHECK:STDERR: | ^~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+8]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_import_decl_value_return_type.carbon:[[@LINE+4]]:10 [InCppInclude] +// CHECK:STDERR: ./decl_value_return_type.h:4:6-26: error: calling 'foo_decl_value_return' with incomplete return type 'DeclValueReturnClass' [CppInteropParseError] // CHECK:STDERR: ./decl_value_return_type.h:4:6: note: 'foo_decl_value_return' declared here [CppInteropParseNote] -// CHECK:STDERR: 4 | auto foo_decl_value_return() -> DeclValueReturnClass; -// CHECK:STDERR: | ^ -// CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+4]]:10: in file included here [InCppInclude] // CHECK:STDERR: ./decl_value_return_type.h:2:7: note: forward declaration of 'DeclValueReturnClass' [CppInteropParseNote] -// CHECK:STDERR: 2 | class DeclValueReturnClass; -// CHECK:STDERR: | ^ import Cpp library "decl_value_return_type.h"; fn F() { - // CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+16]]:3: note: in thunk for C++ function used here [InCppThunk] - // CHECK:STDERR: Cpp.foo_decl_value_return(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+7]]:3-29: note: in thunk for C++ function used here [InCppThunk] // CHECK:STDERR: - // CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+12]]:3: error: function returns incomplete type `Cpp.DeclValueReturnClass` [IncompleteTypeInFunctionReturnType] - // CHECK:STDERR: Cpp.foo_decl_value_return(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE-10]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+5]]:3-29: error: function returns incomplete type `Cpp.DeclValueReturnClass` [IncompleteTypeInFunctionReturnType] + // CHECK:STDERR: included from: fail_import_decl_value_return_type.carbon:[[@LINE-6]]:10 [InCppInclude] // CHECK:STDERR: ./decl_value_return_type.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: class DeclValueReturnClass; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE-14]]:10: in file included here [InCppInclude] // CHECK:STDERR: ./decl_value_return_type.h:4:33: note: return type declared here [IncompleteReturnTypeHere] - // CHECK:STDERR: auto foo_decl_value_return() -> DeclValueReturnClass; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.foo_decl_value_return(); } @@ -664,7 +575,7 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%c.param: %NonCopyableClass) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Cpp.ref.loc24: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Cpp.ref.loc14: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %foo_non_copyable_param.ref: %foo_non_copyable_param.cpp_overload_set.type = name_ref foo_non_copyable_param, imports.%foo_non_copyable_param.cpp_overload_set.value [concrete = constants.%foo_non_copyable_param.cpp_overload_set.value] // CHECK:STDOUT: %c.ref: %NonCopyableClass = name_ref c, %c // CHECK:STDOUT: %foo_non_copyable_param.call: init %empty_tuple.type = call imports.%foo_non_copyable_param.decl(%c.ref) diff --git a/toolchain/check/testdata/interop/cpp/function/import/constexpr.carbon b/toolchain/check/testdata/interop/cpp/function/import/constexpr.carbon index 172598a98c21..46908710cddd 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/constexpr.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/constexpr.carbon @@ -72,9 +72,7 @@ constexpr int invalid_const_fn(int a) { } '''; -// CHECK:STDERR: fail_invalid_constant_eval.carbon:[[@LINE+4]]:19: error: array bound is not a constant [InvalidArrayExpr] -// CHECK:STDERR: let a: array(i32, Cpp.invalid_const_fn(5)) = (1, 2, 3); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_invalid_constant_eval.carbon:[[@LINE+2]]:19-41: error: array bound is not a constant [InvalidArrayExpr] // CHECK:STDERR: let a: array(i32, Cpp.invalid_const_fn(5)) = (1, 2, 3); @@ -103,28 +101,16 @@ var a: i32 = 0; // TODO: This is failing when building the thunk, not when calling it. inline Cpp ''' -// CHECK:STDERR: fail_nonconstant_consteval_call.carbon:[[@LINE+9]]:15: error: call to consteval function 'nonconst_consteval_fn' is not a constant expression [CppInteropParseError] -// CHECK:STDERR: 19 | consteval int nonconst_consteval_fn(const int &r) { return r; } -// CHECK:STDERR: | ^ -// CHECK:STDERR: fail_nonconstant_consteval_call.carbon:[[@LINE+6]]:15: note: function parameter 'r' with unknown value cannot be used in a constant expression [CppInteropParseNote] -// CHECK:STDERR: 19 | consteval int nonconst_consteval_fn(const int &r) { return r; } -// CHECK:STDERR: | ^ -// CHECK:STDERR: fail_nonconstant_consteval_call.carbon:[[@LINE+3]]:15: note: declared here [CppInteropParseNote] -// CHECK:STDERR: 19 | consteval int nonconst_consteval_fn(const int &r) { return r; } -// CHECK:STDERR: | ^ +// CHECK:STDERR: fail_nonconstant_consteval_call.carbon:[[@LINE+3]]:15: error: call to consteval function 'nonconst_consteval_fn' is not a constant expression [CppInteropParseError] +// CHECK:STDERR: fail_nonconstant_consteval_call.carbon:[[@LINE+2]]:15: note: function parameter 'r' with unknown value cannot be used in a constant expression [CppInteropParseNote] +// CHECK:STDERR: fail_nonconstant_consteval_call.carbon:[[@LINE+1]]:15: note: declared here [CppInteropParseNote] consteval int nonconst_consteval_fn(const int &r) { return r; } '''; -// CHECK:STDERR: fail_nonconstant_consteval_call.carbon:[[@LINE+11]]:14: note: in thunk for C++ function used here [InCppThunk] -// CHECK:STDERR: var b: i32 = Cpp.nonconst_consteval_fn(a); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_nonconstant_consteval_call.carbon:[[@LINE+5]]:14-41: note: in thunk for C++ function used here [InCppThunk] // CHECK:STDERR: -// CHECK:STDERR: fail_nonconstant_consteval_call.carbon:[[@LINE+7]]:14: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] -// CHECK:STDERR: var b: i32 = Cpp.nonconst_consteval_fn(a); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_nonconstant_consteval_call.carbon:[[@LINE-10]]:15: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] -// CHECK:STDERR: consteval int nonconst_consteval_fn(const int &r) { return r; } -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_nonconstant_consteval_call.carbon:[[@LINE+3]]:14-41: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: fail_nonconstant_consteval_call.carbon:[[@LINE-6]]:15: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] // CHECK:STDERR: var b: i32 = Cpp.nonconst_consteval_fn(a); @@ -144,17 +130,13 @@ struct ConstexprC { // TODO: This should probably be allowed. eval fn F() -> i32 { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_constructor.carbon:[[@LINE+3]]:27: error: expression is runtime; expected constant [EvalRequiresConstantValue] - // CHECK:STDERR: let c: Cpp.ConstexprC = 3; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_todo_constructor.carbon:[[@LINE+1]]:27: error: expression is runtime; expected constant [EvalRequiresConstantValue] let c: Cpp.ConstexprC = 3; return c.a; //@dump-sem-ir-end } -// CHECK:STDERR: fail_todo_constructor.carbon:[[@LINE+4]]:19: note: in call to F here [InCallToEvalFn] -// CHECK:STDERR: let a: array(i32, F()) = (1, 2, 3); -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_todo_constructor.carbon:[[@LINE+2]]:19-21: note: in call to F here [InCallToEvalFn] // CHECK:STDERR: let a: array(i32, F()) = (1, 2, 3); @@ -202,9 +184,9 @@ let a: array(i32, F()) = (1, 2, 3); // CHECK:STDOUT: %self.patt.d4e: %pattern_type.3cc = wrapper_binding_pattern self, %self.param_patt.d94 [concrete] // CHECK:STDOUT: %ConstexprC.cpp_destructor.type: type = fn_type @ConstexprC.cpp_destructor [concrete] // CHECK:STDOUT: %ConstexprC.cpp_destructor: %ConstexprC.cpp_destructor.type = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef0: type = fn_type @Destroy.WithSelf.Op.loc19 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef0: type = fn_type @Destroy.WithSelf.Op.loc17 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403: %Destroy.WithSelf.Op.type.ef0 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbc: type = fn_type @Destroy.WithSelf.SelfDestruct.loc19 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbc: type = fn_type @Destroy.WithSelf.SelfDestruct.loc17 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3: %Destroy.WithSelf.SelfDestruct.type.fbc = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -231,7 +213,7 @@ let a: array(i32, F()) = (1, 2, 3); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl: %Destroy.WithSelf.Op.type.ef0 = fn_decl @Destroy.WithSelf.Op.loc19 [concrete = constants.%Destroy.WithSelf.Op.403] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl: %Destroy.WithSelf.Op.type.ef0 = fn_decl @Destroy.WithSelf.Op.loc17 [concrete = constants.%Destroy.WithSelf.Op.403] { // CHECK:STDOUT: %self.param_patt: %pattern_type.3cc = ref_param_pattern [concrete = constants.%self.param_patt.d94] // CHECK:STDOUT: %self.patt: %pattern_type.3cc = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.d4e] // CHECK:STDOUT: } { @@ -243,46 +225,46 @@ let a: array(i32, F()) = (1, 2, 3); // CHECK:STDOUT: fn @F() -> out %return.param: %i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba] -// CHECK:STDOUT: %.loc19_27.1: ref %ConstexprC = temporary_storage -// CHECK:STDOUT: %impl.elem0.loc19: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc19_27.1: = bound_method %int_3, %impl.elem0.loc19 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc19: = specific_function %impl.elem0.loc19, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc19_27.2: = bound_method %int_3, %specific_fn.loc19 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc19_27.2(%int_3) [concrete = constants.%int_3.9f3] -// CHECK:STDOUT: %.loc19_27.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_3.9f3] -// CHECK:STDOUT: %.loc19_27.3: %i32 = converted %int_3, %.loc19_27.2 [concrete = constants.%int_3.9f3] -// CHECK:STDOUT: %addr: %ptr.0b8 = addr_of %.loc19_27.1 -// CHECK:STDOUT: %ConstexprC__carbon_thunk.call: init %empty_tuple.type = call imports.%ConstexprC__carbon_thunk.decl(%.loc19_27.3, %addr) -// CHECK:STDOUT: %.loc19_27.4: init %ConstexprC to %.loc19_27.1 = mark_in_place_init %ConstexprC__carbon_thunk.call -// CHECK:STDOUT: %.loc19_27.5: init %ConstexprC = converted %int_3, %.loc19_27.4 -// CHECK:STDOUT: %.loc19_27.6: ref %ConstexprC = temporary %.loc19_27.1, %.loc19_27.5 -// CHECK:STDOUT: %.loc19_27.7: %ConstexprC = acquire_value %.loc19_27.6 -// CHECK:STDOUT: %.loc19_13: type = splice_block %ConstexprC.ref [concrete = constants.%ConstexprC] { +// CHECK:STDOUT: %.loc17_27.1: ref %ConstexprC = temporary_storage +// CHECK:STDOUT: %impl.elem0.loc17: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc17_27.1: = bound_method %int_3, %impl.elem0.loc17 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc17: = specific_function %impl.elem0.loc17, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc17_27.2: = bound_method %int_3, %specific_fn.loc17 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc17_27.2(%int_3) [concrete = constants.%int_3.9f3] +// CHECK:STDOUT: %.loc17_27.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_3.9f3] +// CHECK:STDOUT: %.loc17_27.3: %i32 = converted %int_3, %.loc17_27.2 [concrete = constants.%int_3.9f3] +// CHECK:STDOUT: %addr: %ptr.0b8 = addr_of %.loc17_27.1 +// CHECK:STDOUT: %ConstexprC__carbon_thunk.call: init %empty_tuple.type = call imports.%ConstexprC__carbon_thunk.decl(%.loc17_27.3, %addr) +// CHECK:STDOUT: %.loc17_27.4: init %ConstexprC to %.loc17_27.1 = mark_in_place_init %ConstexprC__carbon_thunk.call +// CHECK:STDOUT: %.loc17_27.5: init %ConstexprC = converted %int_3, %.loc17_27.4 +// CHECK:STDOUT: %.loc17_27.6: ref %ConstexprC = temporary %.loc17_27.1, %.loc17_27.5 +// CHECK:STDOUT: %.loc17_27.7: %ConstexprC = acquire_value %.loc17_27.6 +// CHECK:STDOUT: %.loc17_13: type = splice_block %ConstexprC.ref [concrete = constants.%ConstexprC] { // CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %ConstexprC.ref: type = name_ref ConstexprC, imports.%ConstexprC.decl [concrete = constants.%ConstexprC] // CHECK:STDOUT: } -// CHECK:STDOUT: %c: %ConstexprC = wrapper_binding c, %.loc19_27.7 +// CHECK:STDOUT: %c: %ConstexprC = wrapper_binding c, %.loc17_27.7 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %c.patt: %pattern_type.3cc = value_binding_pattern c [concrete = constants.%c.patt] // CHECK:STDOUT: } // CHECK:STDOUT: %c.ref: %ConstexprC = name_ref c, %c // CHECK:STDOUT: %a.ref: %ConstexprC.elem = name_ref a, @ConstexprC.%field_decl [concrete = @ConstexprC.%field_decl] -// CHECK:STDOUT: %.loc20_11.1: ref %i32 = class_element_access %c.ref, element0 -// CHECK:STDOUT: %.loc20_11.2: %i32 = acquire_value %.loc20_11.1 -// CHECK:STDOUT: %impl.elem0.loc20: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] -// CHECK:STDOUT: %bound_method.loc20_11.1: = bound_method %.loc20_11.2, %impl.elem0.loc20 -// CHECK:STDOUT: %specific_fn.loc20: = specific_function %impl.elem0.loc20, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc20_11.2: = bound_method %.loc20_11.2, %specific_fn.loc20 -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc20_11.2(%.loc20_11.2) +// CHECK:STDOUT: %.loc18_11.1: ref %i32 = class_element_access %c.ref, element0 +// CHECK:STDOUT: %.loc18_11.2: %i32 = acquire_value %.loc18_11.1 +// CHECK:STDOUT: %impl.elem0.loc18: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] +// CHECK:STDOUT: %bound_method.loc18_11.1: = bound_method %.loc18_11.2, %impl.elem0.loc18 +// CHECK:STDOUT: %specific_fn.loc18: = specific_function %impl.elem0.loc18, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc18_11.2: = bound_method %.loc18_11.2, %specific_fn.loc18 +// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc18_11.2(%.loc18_11.2) // CHECK:STDOUT: -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc19_27.6, constants.%Destroy.WithSelf.SelfDestruct.db3 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc19_27.6) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc17_27.6, constants.%Destroy.WithSelf.SelfDestruct.db3 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc17_27.6) // CHECK:STDOUT: return %Int.as.Copy.impl.Op.call // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc19(%self.param: ref %ConstexprC) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc17(%self.param: ref %ConstexprC) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc19(%self.param: ref %ConstexprC) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc17(%self.param: ref %ConstexprC) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl(%self.param) // CHECK:STDOUT: %ConstexprC.cpp_destructor.call: init %empty_tuple.type = call imports.%ConstexprC.cpp_destructor.decl(%self.param) diff --git a/toolchain/check/testdata/interop/cpp/function/import/decayed_param.carbon b/toolchain/check/testdata/interop/cpp/function/import/decayed_param.carbon index b65bb9e7d467..14763fb4904a 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/decayed_param.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/decayed_param.carbon @@ -46,33 +46,22 @@ fn G(n: i32) -> i32; fn F() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_call_params_2.carbon:[[@LINE+4]]:21: error: call argument of type `` is not supported [CppCallArgTypeNotSupported] - // CHECK:STDERR: Cpp.TakesFunction(Cpp.Function); - // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_call_params_2.carbon:[[@LINE+2]]:21-32: error: call argument of type `` is not supported [CppCallArgTypeNotSupported] // CHECK:STDERR: Cpp.TakesFunction(Cpp.Function); var n: array(i32, 42); - // CHECK:STDERR: fail_todo_call_params_2.carbon:[[@LINE+8]]:26: error: no matching function for call to 'TakesFunction' [CppInteropParseError] - // CHECK:STDERR: 25 | Cpp.TakesFunction(&n[0]); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_todo_call_params_2.carbon:[[@LINE-16]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./params.h:3:6: note: candidate function not viable: no known conversion from 'int * _Nonnull' to 'int (*)(int)' for 1st argument [CppInteropParseNote] - // CHECK:STDERR: 3 | void TakesFunction(int f(int)); - // CHECK:STDERR: | ^ ~~~~~~~~~~ + // CHECK:STDERR: fail_todo_call_params_2.carbon:[[@LINE+5]]:3-19: error: no matching function for call to 'TakesFunction' [CppInteropParseError] + // CHECK:STDERR: included from: fail_todo_call_params_2.carbon:[[@LINE-12]]:10 [InCppInclude] + // CHECK:STDERR: ./params.h:3:6: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: ./params.h:3:20-29: note: no known conversion from 'int * _Nonnull' to 'int (*)(int)' for 1st argument [CppInteropParseNoteReason] // CHECK:STDERR: Cpp.TakesFunction(&n[0]); - // CHECK:STDERR: fail_todo_call_params_2.carbon:[[@LINE+11]]:21: error: cannot implicitly convert expression of type `Cpp.nullptr_t` to `` [ConversionFailure] - // CHECK:STDERR: Cpp.TakesFunction(Cpp.nullptr); - // CHECK:STDERR: ^~~~~~~~~~~ - // CHECK:STDERR: fail_todo_call_params_2.carbon:[[@LINE+8]]:21: note: type `Cpp.nullptr_t` does not implement interface `Core.ImplicitAs()` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: Cpp.TakesFunction(Cpp.nullptr); - // CHECK:STDERR: ^~~~~~~~~~~ - // CHECK:STDERR: fail_todo_call_params_2.carbon:[[@LINE-29]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_todo_call_params_2.carbon:[[@LINE+5]]:21-31: error: cannot implicitly convert expression of type `Cpp.nullptr_t` to `` [ConversionFailure] + // CHECK:STDERR: fail_todo_call_params_2.carbon:[[@LINE+4]]:21-31: note: type `Cpp.nullptr_t` does not implement interface `Core.ImplicitAs()` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: included from: fail_todo_call_params_2.carbon:[[@LINE-20]]:10 [InCppInclude] // CHECK:STDERR: ./params.h:3:24: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: void TakesFunction(int f(int)); - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.TakesFunction(Cpp.nullptr); //@dump-sem-ir-end @@ -737,15 +726,15 @@ fn F() { // CHECK:STDOUT: %TakesFunction: %TakesFunction.type = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.0c5: %pattern_type.d94 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.749: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt.0c5 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc16_3.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc14_3.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc16_3.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc14_3.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.2: %Destroy.WithSelf.Op.type.ef016f.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc16_3.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc14_3.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.2: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2 = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.421: %pattern_type.9c3 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.1f9: %pattern_type.9c3 = wrapper_binding_pattern self, %self.param_patt.421 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc16_3.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc14_3.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = struct_value () [concrete] // CHECK:STDOUT: %int_41: Core.IntLiteral = int_value 41 [concrete] // CHECK:STDOUT: %int_40: Core.IntLiteral = int_value 40 [concrete] @@ -787,9 +776,9 @@ fn F() { // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete] // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc16_3.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc14_3.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.3: %Destroy.WithSelf.Op.type.ef016f.3 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.3: type = fn_type @Destroy.WithSelf.SelfDestruct.loc16_3.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.3: type = fn_type @Destroy.WithSelf.SelfDestruct.loc14_3.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.3: %Destroy.WithSelf.SelfDestruct.type.fbceb5.3 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -816,28 +805,28 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc16_3.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc14_3.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d94 = ref_param_pattern [concrete = constants.%self.param_patt.0c5] // CHECK:STDOUT: %self.patt: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.749] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %i32 = ref_param call_param0 // CHECK:STDOUT: %self: ref %i32 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc16_3.1 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc14_3.1 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d94 = ref_param_pattern [concrete = constants.%self.param_patt.0c5] // CHECK:STDOUT: %self.patt: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.749] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %i32 = ref_param call_param0 // CHECK:STDOUT: %self: ref %i32 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc16_3.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.3] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc14_3.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.3] { // CHECK:STDOUT: %self.param_patt: %pattern_type.9c3 = ref_param_pattern [concrete = constants.%self.param_patt.421] // CHECK:STDOUT: %self.patt: %pattern_type.9c3 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.1f9] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %Array.3b5 = ref_param call_param0 // CHECK:STDOUT: %self: ref %Array.3b5 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc16_3.2 [concrete = constants.%Destroy.WithSelf.Op.403171.3] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc14_3.2 [concrete = constants.%Destroy.WithSelf.Op.403171.3] { // CHECK:STDOUT: %self.param_patt: %pattern_type.9c3 = ref_param_pattern [concrete = constants.%self.param_patt.421] // CHECK:STDOUT: %self.patt: %pattern_type.9c3 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.1f9] // CHECK:STDOUT: } { @@ -848,20 +837,20 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Cpp.ref.loc14_3: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %TakesFunction.ref.loc14: %TakesFunction.cpp_overload_set.type = name_ref TakesFunction, imports.%TakesFunction.cpp_overload_set.value [concrete = constants.%TakesFunction.cpp_overload_set.value] -// CHECK:STDOUT: %Cpp.ref.loc14_21: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Cpp.ref.loc12_3: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %TakesFunction.ref.loc12: %TakesFunction.cpp_overload_set.type = name_ref TakesFunction, imports.%TakesFunction.cpp_overload_set.value [concrete = constants.%TakesFunction.cpp_overload_set.value] +// CHECK:STDOUT: %Cpp.ref.loc12_21: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %Function.ref: %Function.cpp_overload_set.type = name_ref Function, imports.%Function.cpp_overload_set.value [concrete = constants.%Function.cpp_overload_set.value] // CHECK:STDOUT: %n.var: ref %Array.3b5 = var_storage %n.var_patt // CHECK:STDOUT: %DefaultOrUnformed.facet: %DefaultOrUnformed.type = facet_value constants.%Array.3b5, (constants.%DefaultOrUnformed.impl_witness.4bc) [concrete = constants.%DefaultOrUnformed.facet] -// CHECK:STDOUT: %.loc16_24.1: %DefaultOrUnformed.type = converted constants.%Array.3b5, %DefaultOrUnformed.facet [concrete = constants.%DefaultOrUnformed.facet] -// CHECK:STDOUT: %as_type: type = facet_access_type %.loc16_24.1 [concrete = constants.%Array.3b5] -// CHECK:STDOUT: %.loc16_24.2: type = converted %.loc16_24.1, %as_type [concrete = constants.%Array.3b5] +// CHECK:STDOUT: %.loc14_24.1: %DefaultOrUnformed.type = converted constants.%Array.3b5, %DefaultOrUnformed.facet [concrete = constants.%DefaultOrUnformed.facet] +// CHECK:STDOUT: %as_type: type = facet_access_type %.loc14_24.1 [concrete = constants.%Array.3b5] +// CHECK:STDOUT: %.loc14_24.2: type = converted %.loc14_24.1, %as_type [concrete = constants.%Array.3b5] // CHECK:STDOUT: -// CHECK:STDOUT: %.loc16_3: ref %Array.3b5 = splice_block %n.var {} -// CHECK:STDOUT: %T.as_type.as.DefaultOrUnformed.impl.Op.call: init %Array.3b5 to %.loc16_3 = call %T.as_type.as.DefaultOrUnformed.impl.Op.specific_fn() +// CHECK:STDOUT: %.loc14_3: ref %Array.3b5 = splice_block %n.var {} +// CHECK:STDOUT: %T.as_type.as.DefaultOrUnformed.impl.Op.call: init %Array.3b5 to %.loc14_3 = call %T.as_type.as.DefaultOrUnformed.impl.Op.specific_fn() // CHECK:STDOUT: assign %n.var, %T.as_type.as.DefaultOrUnformed.impl.Op.call -// CHECK:STDOUT: %.loc16_23: type = splice_block %Array [concrete = constants.%Array.3b5] { +// CHECK:STDOUT: %.loc14_23: type = splice_block %Array [concrete = constants.%Array.3b5] { // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %int_42: Core.IntLiteral = int_value 42 [concrete = constants.%int_42] // CHECK:STDOUT: %Array: type = class_type @Array, @Array(constants.%i32, constants.%int_42) [concrete = constants.%Array.3b5] @@ -871,218 +860,218 @@ fn F() { // CHECK:STDOUT: %n.patt: %pattern_type.9c3 = ref_binding_pattern n [concrete = constants.%n.patt.368] // CHECK:STDOUT: %n.var_patt: %pattern_type.9c3 = var_pattern %n.patt [concrete = constants.%n.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Cpp.ref.loc25: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %TakesFunction.ref.loc25: %TakesFunction.cpp_overload_set.type = name_ref TakesFunction, imports.%TakesFunction.cpp_overload_set.value [concrete = constants.%TakesFunction.cpp_overload_set.value] +// CHECK:STDOUT: %Cpp.ref.loc20: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %TakesFunction.ref.loc20: %TakesFunction.cpp_overload_set.type = name_ref TakesFunction, imports.%TakesFunction.cpp_overload_set.value [concrete = constants.%TakesFunction.cpp_overload_set.value] // CHECK:STDOUT: %n.ref: ref %Array.3b5 = name_ref n, %n // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] // CHECK:STDOUT: %impl.elem0: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc25_24.1: = bound_method %int_0, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %bound_method.loc20_24.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.loc25_24.2: = bound_method %int_0, %specific_fn [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc25_24.2(%int_0) [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc25_24.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc25_24.2: %i32 = converted %int_0, %.loc25_24.1 [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc25_25: ref %i32 = array_index %n.ref, %.loc25_24.2 -// CHECK:STDOUT: %addr: %ptr.a17 = addr_of %.loc25_25 -// CHECK:STDOUT: %Cpp.ref.loc38_3: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %TakesFunction.ref.loc38: %TakesFunction.cpp_overload_set.type = name_ref TakesFunction, imports.%TakesFunction.cpp_overload_set.value [concrete = constants.%TakesFunction.cpp_overload_set.value] -// CHECK:STDOUT: %Cpp.ref.loc38_21: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %bound_method.loc20_24.2: = bound_method %int_0, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc20_24.2(%int_0) [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc20_24.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc20_24.2: %i32 = converted %int_0, %.loc20_24.1 [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc20_25: ref %i32 = array_index %n.ref, %.loc20_24.2 +// CHECK:STDOUT: %addr: %ptr.a17 = addr_of %.loc20_25 +// CHECK:STDOUT: %Cpp.ref.loc27_3: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %TakesFunction.ref.loc27: %TakesFunction.cpp_overload_set.type = name_ref TakesFunction, imports.%TakesFunction.cpp_overload_set.value [concrete = constants.%TakesFunction.cpp_overload_set.value] +// CHECK:STDOUT: %Cpp.ref.loc27_21: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: // CHECK:STDOUT: %nullptr.ref: %Cpp.nullptr_t = name_ref nullptr, %uninit [concrete = constants.%uninit] -// CHECK:STDOUT: %.loc38: %.659 = converted %nullptr.ref, [concrete = ] +// CHECK:STDOUT: %.loc27: %.659 = converted %nullptr.ref, [concrete = ] // CHECK:STDOUT: %TakesFunction.call: init %empty_tuple.type = call imports.%TakesFunction.decl() // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %n.var, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.3 // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%n.var) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc16_3.1(%self.param: ref %i32) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc14_3.1(%self.param: ref %i32) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc16_3.1(%self.param: ref %i32) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc14_3.1(%self.param: ref %i32) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc16_3.1(%self.param: ref %i32) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc14_3.1(%self.param: ref %i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.1(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.1(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc16_3.2(%self.param: ref %Array.3b5) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc14_3.2(%self.param: ref %Array.3b5) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int_41: Core.IntLiteral = int_value 41 [concrete = constants.%int_41] -// CHECK:STDOUT: %.loc16_3.1: ref %i32 = array_index %self.param, %int_41 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.1: = bound_method %.loc16_3.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.1(%.loc16_3.1) +// CHECK:STDOUT: %.loc14_3.1: ref %i32 = array_index %self.param, %int_41 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.1: = bound_method %.loc14_3.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.1(%.loc14_3.1) // CHECK:STDOUT: %int_40: Core.IntLiteral = int_value 40 [concrete = constants.%int_40] -// CHECK:STDOUT: %.loc16_3.2: ref %i32 = array_index %self.param, %int_40 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.2: = bound_method %.loc16_3.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.2(%.loc16_3.2) +// CHECK:STDOUT: %.loc14_3.2: ref %i32 = array_index %self.param, %int_40 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.2: = bound_method %.loc14_3.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.2(%.loc14_3.2) // CHECK:STDOUT: %int_39: Core.IntLiteral = int_value 39 [concrete = constants.%int_39] -// CHECK:STDOUT: %.loc16_3.3: ref %i32 = array_index %self.param, %int_39 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.3: = bound_method %.loc16_3.3, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.3: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.3(%.loc16_3.3) +// CHECK:STDOUT: %.loc14_3.3: ref %i32 = array_index %self.param, %int_39 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.3: = bound_method %.loc14_3.3, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.3: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.3(%.loc14_3.3) // CHECK:STDOUT: %int_38: Core.IntLiteral = int_value 38 [concrete = constants.%int_38] -// CHECK:STDOUT: %.loc16_3.4: ref %i32 = array_index %self.param, %int_38 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.4: = bound_method %.loc16_3.4, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.4: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.4(%.loc16_3.4) +// CHECK:STDOUT: %.loc14_3.4: ref %i32 = array_index %self.param, %int_38 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.4: = bound_method %.loc14_3.4, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.4: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.4(%.loc14_3.4) // CHECK:STDOUT: %int_37: Core.IntLiteral = int_value 37 [concrete = constants.%int_37] -// CHECK:STDOUT: %.loc16_3.5: ref %i32 = array_index %self.param, %int_37 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.5: = bound_method %.loc16_3.5, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.5: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.5(%.loc16_3.5) +// CHECK:STDOUT: %.loc14_3.5: ref %i32 = array_index %self.param, %int_37 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.5: = bound_method %.loc14_3.5, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.5: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.5(%.loc14_3.5) // CHECK:STDOUT: %int_36: Core.IntLiteral = int_value 36 [concrete = constants.%int_36] -// CHECK:STDOUT: %.loc16_3.6: ref %i32 = array_index %self.param, %int_36 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.6: = bound_method %.loc16_3.6, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.6: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.6(%.loc16_3.6) +// CHECK:STDOUT: %.loc14_3.6: ref %i32 = array_index %self.param, %int_36 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.6: = bound_method %.loc14_3.6, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.6: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.6(%.loc14_3.6) // CHECK:STDOUT: %int_35: Core.IntLiteral = int_value 35 [concrete = constants.%int_35] -// CHECK:STDOUT: %.loc16_3.7: ref %i32 = array_index %self.param, %int_35 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.7: = bound_method %.loc16_3.7, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.7: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.7(%.loc16_3.7) +// CHECK:STDOUT: %.loc14_3.7: ref %i32 = array_index %self.param, %int_35 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.7: = bound_method %.loc14_3.7, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.7: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.7(%.loc14_3.7) // CHECK:STDOUT: %int_34: Core.IntLiteral = int_value 34 [concrete = constants.%int_34] -// CHECK:STDOUT: %.loc16_3.8: ref %i32 = array_index %self.param, %int_34 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.8: = bound_method %.loc16_3.8, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.8: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.8(%.loc16_3.8) +// CHECK:STDOUT: %.loc14_3.8: ref %i32 = array_index %self.param, %int_34 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.8: = bound_method %.loc14_3.8, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.8: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.8(%.loc14_3.8) // CHECK:STDOUT: %int_33: Core.IntLiteral = int_value 33 [concrete = constants.%int_33] -// CHECK:STDOUT: %.loc16_3.9: ref %i32 = array_index %self.param, %int_33 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.9: = bound_method %.loc16_3.9, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.9: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.9(%.loc16_3.9) +// CHECK:STDOUT: %.loc14_3.9: ref %i32 = array_index %self.param, %int_33 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.9: = bound_method %.loc14_3.9, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.9: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.9(%.loc14_3.9) // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %.loc16_3.10: ref %i32 = array_index %self.param, %int_32 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.10: = bound_method %.loc16_3.10, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.10: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.10(%.loc16_3.10) +// CHECK:STDOUT: %.loc14_3.10: ref %i32 = array_index %self.param, %int_32 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.10: = bound_method %.loc14_3.10, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.10: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.10(%.loc14_3.10) // CHECK:STDOUT: %int_31: Core.IntLiteral = int_value 31 [concrete = constants.%int_31] -// CHECK:STDOUT: %.loc16_3.11: ref %i32 = array_index %self.param, %int_31 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.11: = bound_method %.loc16_3.11, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.11: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.11(%.loc16_3.11) +// CHECK:STDOUT: %.loc14_3.11: ref %i32 = array_index %self.param, %int_31 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.11: = bound_method %.loc14_3.11, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.11: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.11(%.loc14_3.11) // CHECK:STDOUT: %int_30: Core.IntLiteral = int_value 30 [concrete = constants.%int_30] -// CHECK:STDOUT: %.loc16_3.12: ref %i32 = array_index %self.param, %int_30 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.12: = bound_method %.loc16_3.12, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.12: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.12(%.loc16_3.12) +// CHECK:STDOUT: %.loc14_3.12: ref %i32 = array_index %self.param, %int_30 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.12: = bound_method %.loc14_3.12, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.12: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.12(%.loc14_3.12) // CHECK:STDOUT: %int_29: Core.IntLiteral = int_value 29 [concrete = constants.%int_29] -// CHECK:STDOUT: %.loc16_3.13: ref %i32 = array_index %self.param, %int_29 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.13: = bound_method %.loc16_3.13, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.13: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.13(%.loc16_3.13) +// CHECK:STDOUT: %.loc14_3.13: ref %i32 = array_index %self.param, %int_29 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.13: = bound_method %.loc14_3.13, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.13: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.13(%.loc14_3.13) // CHECK:STDOUT: %int_28: Core.IntLiteral = int_value 28 [concrete = constants.%int_28] -// CHECK:STDOUT: %.loc16_3.14: ref %i32 = array_index %self.param, %int_28 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.14: = bound_method %.loc16_3.14, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.14: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.14(%.loc16_3.14) +// CHECK:STDOUT: %.loc14_3.14: ref %i32 = array_index %self.param, %int_28 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.14: = bound_method %.loc14_3.14, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.14: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.14(%.loc14_3.14) // CHECK:STDOUT: %int_27: Core.IntLiteral = int_value 27 [concrete = constants.%int_27] -// CHECK:STDOUT: %.loc16_3.15: ref %i32 = array_index %self.param, %int_27 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.15: = bound_method %.loc16_3.15, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.15: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.15(%.loc16_3.15) +// CHECK:STDOUT: %.loc14_3.15: ref %i32 = array_index %self.param, %int_27 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.15: = bound_method %.loc14_3.15, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.15: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.15(%.loc14_3.15) // CHECK:STDOUT: %int_26: Core.IntLiteral = int_value 26 [concrete = constants.%int_26] -// CHECK:STDOUT: %.loc16_3.16: ref %i32 = array_index %self.param, %int_26 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.16: = bound_method %.loc16_3.16, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.16: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.16(%.loc16_3.16) +// CHECK:STDOUT: %.loc14_3.16: ref %i32 = array_index %self.param, %int_26 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.16: = bound_method %.loc14_3.16, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.16: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.16(%.loc14_3.16) // CHECK:STDOUT: %int_25: Core.IntLiteral = int_value 25 [concrete = constants.%int_25] -// CHECK:STDOUT: %.loc16_3.17: ref %i32 = array_index %self.param, %int_25 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.17: = bound_method %.loc16_3.17, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.17: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.17(%.loc16_3.17) +// CHECK:STDOUT: %.loc14_3.17: ref %i32 = array_index %self.param, %int_25 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.17: = bound_method %.loc14_3.17, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.17: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.17(%.loc14_3.17) // CHECK:STDOUT: %int_24: Core.IntLiteral = int_value 24 [concrete = constants.%int_24] -// CHECK:STDOUT: %.loc16_3.18: ref %i32 = array_index %self.param, %int_24 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.18: = bound_method %.loc16_3.18, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.18: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.18(%.loc16_3.18) +// CHECK:STDOUT: %.loc14_3.18: ref %i32 = array_index %self.param, %int_24 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.18: = bound_method %.loc14_3.18, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.18: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.18(%.loc14_3.18) // CHECK:STDOUT: %int_23: Core.IntLiteral = int_value 23 [concrete = constants.%int_23] -// CHECK:STDOUT: %.loc16_3.19: ref %i32 = array_index %self.param, %int_23 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.19: = bound_method %.loc16_3.19, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.19: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.19(%.loc16_3.19) +// CHECK:STDOUT: %.loc14_3.19: ref %i32 = array_index %self.param, %int_23 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.19: = bound_method %.loc14_3.19, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.19: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.19(%.loc14_3.19) // CHECK:STDOUT: %int_22: Core.IntLiteral = int_value 22 [concrete = constants.%int_22] -// CHECK:STDOUT: %.loc16_3.20: ref %i32 = array_index %self.param, %int_22 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.20: = bound_method %.loc16_3.20, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.20: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.20(%.loc16_3.20) +// CHECK:STDOUT: %.loc14_3.20: ref %i32 = array_index %self.param, %int_22 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.20: = bound_method %.loc14_3.20, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.20: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.20(%.loc14_3.20) // CHECK:STDOUT: %int_21: Core.IntLiteral = int_value 21 [concrete = constants.%int_21] -// CHECK:STDOUT: %.loc16_3.21: ref %i32 = array_index %self.param, %int_21 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.21: = bound_method %.loc16_3.21, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.21: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.21(%.loc16_3.21) +// CHECK:STDOUT: %.loc14_3.21: ref %i32 = array_index %self.param, %int_21 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.21: = bound_method %.loc14_3.21, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.21: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.21(%.loc14_3.21) // CHECK:STDOUT: %int_20: Core.IntLiteral = int_value 20 [concrete = constants.%int_20] -// CHECK:STDOUT: %.loc16_3.22: ref %i32 = array_index %self.param, %int_20 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.22: = bound_method %.loc16_3.22, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.22: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.22(%.loc16_3.22) +// CHECK:STDOUT: %.loc14_3.22: ref %i32 = array_index %self.param, %int_20 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.22: = bound_method %.loc14_3.22, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.22: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.22(%.loc14_3.22) // CHECK:STDOUT: %int_19: Core.IntLiteral = int_value 19 [concrete = constants.%int_19] -// CHECK:STDOUT: %.loc16_3.23: ref %i32 = array_index %self.param, %int_19 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.23: = bound_method %.loc16_3.23, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.23: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.23(%.loc16_3.23) +// CHECK:STDOUT: %.loc14_3.23: ref %i32 = array_index %self.param, %int_19 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.23: = bound_method %.loc14_3.23, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.23: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.23(%.loc14_3.23) // CHECK:STDOUT: %int_18: Core.IntLiteral = int_value 18 [concrete = constants.%int_18] -// CHECK:STDOUT: %.loc16_3.24: ref %i32 = array_index %self.param, %int_18 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.24: = bound_method %.loc16_3.24, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.24: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.24(%.loc16_3.24) +// CHECK:STDOUT: %.loc14_3.24: ref %i32 = array_index %self.param, %int_18 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.24: = bound_method %.loc14_3.24, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.24: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.24(%.loc14_3.24) // CHECK:STDOUT: %int_17: Core.IntLiteral = int_value 17 [concrete = constants.%int_17] -// CHECK:STDOUT: %.loc16_3.25: ref %i32 = array_index %self.param, %int_17 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.25: = bound_method %.loc16_3.25, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.25: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.25(%.loc16_3.25) +// CHECK:STDOUT: %.loc14_3.25: ref %i32 = array_index %self.param, %int_17 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.25: = bound_method %.loc14_3.25, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.25: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.25(%.loc14_3.25) // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16] -// CHECK:STDOUT: %.loc16_3.26: ref %i32 = array_index %self.param, %int_16 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.26: = bound_method %.loc16_3.26, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.26: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.26(%.loc16_3.26) +// CHECK:STDOUT: %.loc14_3.26: ref %i32 = array_index %self.param, %int_16 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.26: = bound_method %.loc14_3.26, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.26: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.26(%.loc14_3.26) // CHECK:STDOUT: %int_15: Core.IntLiteral = int_value 15 [concrete = constants.%int_15] -// CHECK:STDOUT: %.loc16_3.27: ref %i32 = array_index %self.param, %int_15 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.27: = bound_method %.loc16_3.27, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.27: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.27(%.loc16_3.27) +// CHECK:STDOUT: %.loc14_3.27: ref %i32 = array_index %self.param, %int_15 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.27: = bound_method %.loc14_3.27, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.27: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.27(%.loc14_3.27) // CHECK:STDOUT: %int_14: Core.IntLiteral = int_value 14 [concrete = constants.%int_14] -// CHECK:STDOUT: %.loc16_3.28: ref %i32 = array_index %self.param, %int_14 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.28: = bound_method %.loc16_3.28, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.28: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.28(%.loc16_3.28) +// CHECK:STDOUT: %.loc14_3.28: ref %i32 = array_index %self.param, %int_14 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.28: = bound_method %.loc14_3.28, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.28: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.28(%.loc14_3.28) // CHECK:STDOUT: %int_13: Core.IntLiteral = int_value 13 [concrete = constants.%int_13] -// CHECK:STDOUT: %.loc16_3.29: ref %i32 = array_index %self.param, %int_13 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.29: = bound_method %.loc16_3.29, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.29: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.29(%.loc16_3.29) +// CHECK:STDOUT: %.loc14_3.29: ref %i32 = array_index %self.param, %int_13 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.29: = bound_method %.loc14_3.29, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.29: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.29(%.loc14_3.29) // CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [concrete = constants.%int_12] -// CHECK:STDOUT: %.loc16_3.30: ref %i32 = array_index %self.param, %int_12 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.30: = bound_method %.loc16_3.30, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.30: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.30(%.loc16_3.30) +// CHECK:STDOUT: %.loc14_3.30: ref %i32 = array_index %self.param, %int_12 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.30: = bound_method %.loc14_3.30, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.30: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.30(%.loc14_3.30) // CHECK:STDOUT: %int_11: Core.IntLiteral = int_value 11 [concrete = constants.%int_11] -// CHECK:STDOUT: %.loc16_3.31: ref %i32 = array_index %self.param, %int_11 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.31: = bound_method %.loc16_3.31, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.31: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.31(%.loc16_3.31) +// CHECK:STDOUT: %.loc14_3.31: ref %i32 = array_index %self.param, %int_11 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.31: = bound_method %.loc14_3.31, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.31: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.31(%.loc14_3.31) // CHECK:STDOUT: %int_10: Core.IntLiteral = int_value 10 [concrete = constants.%int_10] -// CHECK:STDOUT: %.loc16_3.32: ref %i32 = array_index %self.param, %int_10 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.32: = bound_method %.loc16_3.32, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.32: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.32(%.loc16_3.32) +// CHECK:STDOUT: %.loc14_3.32: ref %i32 = array_index %self.param, %int_10 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.32: = bound_method %.loc14_3.32, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.32: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.32(%.loc14_3.32) // CHECK:STDOUT: %int_9: Core.IntLiteral = int_value 9 [concrete = constants.%int_9] -// CHECK:STDOUT: %.loc16_3.33: ref %i32 = array_index %self.param, %int_9 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.33: = bound_method %.loc16_3.33, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.33: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.33(%.loc16_3.33) +// CHECK:STDOUT: %.loc14_3.33: ref %i32 = array_index %self.param, %int_9 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.33: = bound_method %.loc14_3.33, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.33: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.33(%.loc14_3.33) // CHECK:STDOUT: %int_8: Core.IntLiteral = int_value 8 [concrete = constants.%int_8] -// CHECK:STDOUT: %.loc16_3.34: ref %i32 = array_index %self.param, %int_8 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.34: = bound_method %.loc16_3.34, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.34: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.34(%.loc16_3.34) +// CHECK:STDOUT: %.loc14_3.34: ref %i32 = array_index %self.param, %int_8 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.34: = bound_method %.loc14_3.34, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.34: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.34(%.loc14_3.34) // CHECK:STDOUT: %int_7: Core.IntLiteral = int_value 7 [concrete = constants.%int_7] -// CHECK:STDOUT: %.loc16_3.35: ref %i32 = array_index %self.param, %int_7 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.35: = bound_method %.loc16_3.35, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.35: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.35(%.loc16_3.35) +// CHECK:STDOUT: %.loc14_3.35: ref %i32 = array_index %self.param, %int_7 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.35: = bound_method %.loc14_3.35, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.35: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.35(%.loc14_3.35) // CHECK:STDOUT: %int_6: Core.IntLiteral = int_value 6 [concrete = constants.%int_6] -// CHECK:STDOUT: %.loc16_3.36: ref %i32 = array_index %self.param, %int_6 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.36: = bound_method %.loc16_3.36, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.36: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.36(%.loc16_3.36) +// CHECK:STDOUT: %.loc14_3.36: ref %i32 = array_index %self.param, %int_6 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.36: = bound_method %.loc14_3.36, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.36: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.36(%.loc14_3.36) // CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [concrete = constants.%int_5] -// CHECK:STDOUT: %.loc16_3.37: ref %i32 = array_index %self.param, %int_5 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.37: = bound_method %.loc16_3.37, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.37: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.37(%.loc16_3.37) +// CHECK:STDOUT: %.loc14_3.37: ref %i32 = array_index %self.param, %int_5 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.37: = bound_method %.loc14_3.37, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.37: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.37(%.loc14_3.37) // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4] -// CHECK:STDOUT: %.loc16_3.38: ref %i32 = array_index %self.param, %int_4 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.38: = bound_method %.loc16_3.38, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.38: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.38(%.loc16_3.38) +// CHECK:STDOUT: %.loc14_3.38: ref %i32 = array_index %self.param, %int_4 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.38: = bound_method %.loc14_3.38, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.38: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.38(%.loc14_3.38) // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3] -// CHECK:STDOUT: %.loc16_3.39: ref %i32 = array_index %self.param, %int_3 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.39: = bound_method %.loc16_3.39, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.39: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.39(%.loc16_3.39) +// CHECK:STDOUT: %.loc14_3.39: ref %i32 = array_index %self.param, %int_3 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.39: = bound_method %.loc14_3.39, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.39: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.39(%.loc14_3.39) // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2] -// CHECK:STDOUT: %.loc16_3.40: ref %i32 = array_index %self.param, %int_2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.40: = bound_method %.loc16_3.40, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.40: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.40(%.loc16_3.40) +// CHECK:STDOUT: %.loc14_3.40: ref %i32 = array_index %self.param, %int_2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.40: = bound_method %.loc14_3.40, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.40: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.40(%.loc14_3.40) // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %.loc16_3.41: ref %i32 = array_index %self.param, %int_1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.41: = bound_method %.loc16_3.41, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.41: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.41(%.loc16_3.41) +// CHECK:STDOUT: %.loc14_3.41: ref %i32 = array_index %self.param, %int_1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.41: = bound_method %.loc14_3.41, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.41: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.41(%.loc14_3.41) // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] -// CHECK:STDOUT: %.loc16_3.42: ref %i32 = array_index %self.param, %int_0 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16_3.42: = bound_method %.loc16_3.42, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16_3.42: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16_3.42(%.loc16_3.42) +// CHECK:STDOUT: %.loc14_3.42: ref %i32 = array_index %self.param, %int_0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc14_3.42: = bound_method %.loc14_3.42, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc14_3.42: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc14_3.42(%.loc14_3.42) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc16_3.2(%self.param: ref %Array.3b5) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc14_3.2(%self.param: ref %Array.3b5) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc16_3.2(%self.param: ref %Array.3b5) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc14_3.2(%self.param: ref %Array.3b5) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.2(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.2(%self.param) diff --git a/toolchain/check/testdata/interop/cpp/function/import/default_arg.carbon b/toolchain/check/testdata/interop/cpp/function/import/default_arg.carbon index fc2ddd276fd4..9d217ce283bd 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/default_arg.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/default_arg.carbon @@ -63,73 +63,52 @@ import Cpp library "functions.h"; fn Call() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+8]]:23: error: no matching function for call to 'GlobalNoReturn' [CppInteropParseError] - // CHECK:STDERR: 16 | Cpp.GlobalNoReturn(1); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE-7]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./functions.h:2:6: note: candidate function not viable: requires at least 2 arguments, but 1 was provided [CppInteropParseNote] - // CHECK:STDERR: 2 | auto GlobalNoReturn(int a, int b, int c = 1, int d = 2) -> void; - // CHECK:STDERR: | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+5]]:3-20: error: no matching function for call to 'GlobalNoReturn' [CppInteropParseError] + // CHECK:STDERR: included from: fail_call_too_few_args.carbon:[[@LINE-5]]:10 [InCppInclude] + // CHECK:STDERR: ./functions.h:2:6: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: ./functions.h:2:21-54: note: requires at least 2 arguments, but 1 was provided [CppInteropParseNoteReason] // CHECK:STDERR: Cpp.GlobalNoReturn(1); - // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+8]]:22: error: no matching function for call to 'GlobalNoReturn' [CppInteropParseError] - // CHECK:STDERR: 26 | Cpp.GlobalNoReturn(); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE-17]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./functions.h:2:6: note: candidate function not viable: requires at least 2 arguments, but 0 were provided [CppInteropParseNote] - // CHECK:STDERR: 2 | auto GlobalNoReturn(int a, int b, int c = 1, int d = 2) -> void; - // CHECK:STDERR: | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+5]]:3-20: error: no matching function for call to 'GlobalNoReturn' [CppInteropParseError] + // CHECK:STDERR: included from: fail_call_too_few_args.carbon:[[@LINE-12]]:10 [InCppInclude] + // CHECK:STDERR: ./functions.h:2:6: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: ./functions.h:2:21-54: note: requires at least 2 arguments, but 0 were provided [CppInteropParseNoteReason] // CHECK:STDERR: Cpp.GlobalNoReturn(); - // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+8]]:24: error: no matching function for call to 'GlobalReturnInt' [CppInteropParseError] - // CHECK:STDERR: 36 | Cpp.GlobalReturnInt(1); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE-27]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./functions.h:3:6: note: candidate function not viable: requires at least 2 arguments, but 1 was provided [CppInteropParseNote] - // CHECK:STDERR: 3 | auto GlobalReturnInt(int a, int b, int c = 1, int d = 2) -> int; - // CHECK:STDERR: | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+5]]:3-21: error: no matching function for call to 'GlobalReturnInt' [CppInteropParseError] + // CHECK:STDERR: included from: fail_call_too_few_args.carbon:[[@LINE-19]]:10 [InCppInclude] + // CHECK:STDERR: ./functions.h:3:6: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: ./functions.h:3:22-55: note: requires at least 2 arguments, but 1 was provided [CppInteropParseNoteReason] // CHECK:STDERR: Cpp.GlobalReturnInt(1); - // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+8]]:23: error: no matching function for call to 'GlobalReturnInt' [CppInteropParseError] - // CHECK:STDERR: 46 | Cpp.GlobalReturnInt(); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE-37]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./functions.h:3:6: note: candidate function not viable: requires at least 2 arguments, but 0 were provided [CppInteropParseNote] - // CHECK:STDERR: 3 | auto GlobalReturnInt(int a, int b, int c = 1, int d = 2) -> int; - // CHECK:STDERR: | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+5]]:3-21: error: no matching function for call to 'GlobalReturnInt' [CppInteropParseError] + // CHECK:STDERR: included from: fail_call_too_few_args.carbon:[[@LINE-26]]:10 [InCppInclude] + // CHECK:STDERR: ./functions.h:3:6: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: ./functions.h:3:22-55: note: requires at least 2 arguments, but 0 were provided [CppInteropParseNoteReason] // CHECK:STDERR: Cpp.GlobalReturnInt(); - // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+8]]:19: error: no matching function for call to 'B' [CppInteropParseError] - // CHECK:STDERR: 56 | ({} as Cpp.X).B(); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE-47]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./functions.h:6:8: note: candidate function not viable: requires at least argument 'a', but no arguments were provided [CppInteropParseNote] - // CHECK:STDERR: 6 | void B(int a, int b = 1); - // CHECK:STDERR: | ^ ~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+5]]:3-17: error: no matching function for call to 'B' [CppInteropParseError] + // CHECK:STDERR: included from: fail_call_too_few_args.carbon:[[@LINE-33]]:10 [InCppInclude] + // CHECK:STDERR: ./functions.h:6:8: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: ./functions.h:6:10-25: note: requires at least argument 'a', but no arguments were provided [CppInteropParseNoteReason] // CHECK:STDERR: ({} as Cpp.X).B(); - // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+8]]:11: error: no matching function for call to 'C' [CppInteropParseError] - // CHECK:STDERR: 66 | Cpp.X.C(); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE-57]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./functions.h:7:15: note: candidate function not viable: requires at least argument 'a', but no arguments were provided [CppInteropParseNote] - // CHECK:STDERR: 7 | static void C(int a, int b = 1); - // CHECK:STDERR: | ^ ~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+5]]:3-9: error: no matching function for call to 'C' [CppInteropParseError] + // CHECK:STDERR: included from: fail_call_too_few_args.carbon:[[@LINE-40]]:10 [InCppInclude] + // CHECK:STDERR: ./functions.h:7:15: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: ./functions.h:7:17-32: note: requires at least argument 'a', but no arguments were provided [CppInteropParseNoteReason] // CHECK:STDERR: Cpp.X.C(); - // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+8]]:19: error: no matching function for call to 'D' [CppInteropParseError] - // CHECK:STDERR: 76 | ({} as Cpp.X).D(); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE-67]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./functions.h:8:8: note: candidate function not viable: requires at least non-object argument 'a', but no arguments were provided [CppInteropParseNote] - // CHECK:STDERR: 8 | void D(this X, int a, int b = 1); - // CHECK:STDERR: | ^ ~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+5]]:3-17: error: no matching function for call to 'D' [CppInteropParseError] + // CHECK:STDERR: included from: fail_call_too_few_args.carbon:[[@LINE-47]]:10 [InCppInclude] + // CHECK:STDERR: ./functions.h:8:8: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: ./functions.h:8:10-33: note: requires at least non-object argument 'a', but no arguments were provided [CppInteropParseNoteReason] // CHECK:STDERR: ({} as Cpp.X).D(); //@dump-sem-ir-end @@ -937,9 +916,9 @@ fn Call() { // CHECK:STDOUT: %self.patt.3ab: %pattern_type.fa7 = wrapper_binding_pattern self, %self.param_patt.a14 [concrete] // CHECK:STDOUT: %X.cpp_destructor.type: type = fn_type @X.cpp_destructor [concrete] // CHECK:STDOUT: %X.cpp_destructor: %X.cpp_destructor.type = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef0: type = fn_type @Destroy.WithSelf.Op.loc56 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef0: type = fn_type @Destroy.WithSelf.Op.loc41 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403: %Destroy.WithSelf.Op.type.ef0 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbc: type = fn_type @Destroy.WithSelf.SelfDestruct.loc56 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbc: type = fn_type @Destroy.WithSelf.SelfDestruct.loc41 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3: %Destroy.WithSelf.SelfDestruct.type.fbc = struct_value () [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.414, %Destroy.WithSelf.SelfDestruct.db3 [concrete] // CHECK:STDOUT: %X.C.cpp_overload_set.type: type = cpp_overload_set_type @X.C.cpp_overload_set [concrete] @@ -970,7 +949,7 @@ fn Call() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl: %Destroy.WithSelf.Op.type.ef0 = fn_decl @Destroy.WithSelf.Op.loc56 [concrete = constants.%Destroy.WithSelf.Op.403] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl: %Destroy.WithSelf.Op.type.ef0 = fn_decl @Destroy.WithSelf.Op.loc41 [concrete = constants.%Destroy.WithSelf.Op.403] { // CHECK:STDOUT: %self.param_patt: %pattern_type.fa7 = ref_param_pattern [concrete = constants.%self.param_patt.a14] // CHECK:STDOUT: %self.patt: %pattern_type.fa7 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.3ab] // CHECK:STDOUT: } { @@ -981,46 +960,46 @@ fn Call() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Call() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Cpp.ref.loc16: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %GlobalNoReturn.ref.loc16: %GlobalNoReturn.cpp_overload_set.type = name_ref GlobalNoReturn, imports.%GlobalNoReturn.cpp_overload_set.value [concrete = constants.%GlobalNoReturn.cpp_overload_set.value] -// CHECK:STDOUT: %int_1.loc16: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %Cpp.ref.loc26: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %GlobalNoReturn.ref.loc26: %GlobalNoReturn.cpp_overload_set.type = name_ref GlobalNoReturn, imports.%GlobalNoReturn.cpp_overload_set.value [concrete = constants.%GlobalNoReturn.cpp_overload_set.value] -// CHECK:STDOUT: %Cpp.ref.loc36: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %GlobalReturnInt.ref.loc36: %GlobalReturnInt.cpp_overload_set.type = name_ref GlobalReturnInt, imports.%GlobalReturnInt.cpp_overload_set.value [concrete = constants.%GlobalReturnInt.cpp_overload_set.value] -// CHECK:STDOUT: %int_1.loc36: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %Cpp.ref.loc46: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %GlobalReturnInt.ref.loc46: %GlobalReturnInt.cpp_overload_set.type = name_ref GlobalReturnInt, imports.%GlobalReturnInt.cpp_overload_set.value [concrete = constants.%GlobalReturnInt.cpp_overload_set.value] -// CHECK:STDOUT: %.loc56_5.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %Cpp.ref.loc56: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %X.ref.loc56: type = name_ref X, imports.%X.decl [concrete = constants.%X] -// CHECK:STDOUT: %.loc56_5.2: ref %X = temporary_storage -// CHECK:STDOUT: %.loc56_5.3: init %X to %.loc56_5.2 = class_init () [concrete = constants.%X.val] -// CHECK:STDOUT: %.loc56_7.1: init %X = converted %.loc56_5.1, %.loc56_5.3 [concrete = constants.%X.val] -// CHECK:STDOUT: %.loc56_7.2: ref %X = temporary %.loc56_5.2, %.loc56_7.1 [concrete = constants.%.414] +// CHECK:STDOUT: %Cpp.ref.loc13: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %GlobalNoReturn.ref.loc13: %GlobalNoReturn.cpp_overload_set.type = name_ref GlobalNoReturn, imports.%GlobalNoReturn.cpp_overload_set.value [concrete = constants.%GlobalNoReturn.cpp_overload_set.value] +// CHECK:STDOUT: %int_1.loc13: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %Cpp.ref.loc20: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %GlobalNoReturn.ref.loc20: %GlobalNoReturn.cpp_overload_set.type = name_ref GlobalNoReturn, imports.%GlobalNoReturn.cpp_overload_set.value [concrete = constants.%GlobalNoReturn.cpp_overload_set.value] +// CHECK:STDOUT: %Cpp.ref.loc27: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %GlobalReturnInt.ref.loc27: %GlobalReturnInt.cpp_overload_set.type = name_ref GlobalReturnInt, imports.%GlobalReturnInt.cpp_overload_set.value [concrete = constants.%GlobalReturnInt.cpp_overload_set.value] +// CHECK:STDOUT: %int_1.loc27: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %Cpp.ref.loc34: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %GlobalReturnInt.ref.loc34: %GlobalReturnInt.cpp_overload_set.type = name_ref GlobalReturnInt, imports.%GlobalReturnInt.cpp_overload_set.value [concrete = constants.%GlobalReturnInt.cpp_overload_set.value] +// CHECK:STDOUT: %.loc41_5.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %Cpp.ref.loc41: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %X.ref.loc41: type = name_ref X, imports.%X.decl [concrete = constants.%X] +// CHECK:STDOUT: %.loc41_5.2: ref %X = temporary_storage +// CHECK:STDOUT: %.loc41_5.3: init %X to %.loc41_5.2 = class_init () [concrete = constants.%X.val] +// CHECK:STDOUT: %.loc41_7.1: init %X = converted %.loc41_5.1, %.loc41_5.3 [concrete = constants.%X.val] +// CHECK:STDOUT: %.loc41_7.2: ref %X = temporary %.loc41_5.2, %.loc41_7.1 [concrete = constants.%.414] // CHECK:STDOUT: %B.ref: %X.B.cpp_overload_set.type = name_ref B, imports.%X.B.cpp_overload_set.value [concrete = constants.%X.B.cpp_overload_set.value] -// CHECK:STDOUT: %bound_method.loc56: = bound_method %.loc56_7.2, %B.ref [concrete = constants.%bound_method.f8c] +// CHECK:STDOUT: %bound_method.loc41: = bound_method %.loc41_7.2, %B.ref [concrete = constants.%bound_method.f8c] // CHECK:STDOUT: -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc56: init %empty_tuple.type = call constants.%Destroy.WithSelf.SelfDestruct.bound(constants.%.414) -// CHECK:STDOUT: %Cpp.ref.loc66: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %X.ref.loc66: type = name_ref X, imports.%X.decl [concrete = constants.%X] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc41: init %empty_tuple.type = call constants.%Destroy.WithSelf.SelfDestruct.bound(constants.%.414) +// CHECK:STDOUT: %Cpp.ref.loc48: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %X.ref.loc48: type = name_ref X, imports.%X.decl [concrete = constants.%X] // CHECK:STDOUT: %C.ref: %X.C.cpp_overload_set.type = name_ref C, imports.%X.C.cpp_overload_set.value [concrete = constants.%X.C.cpp_overload_set.value] -// CHECK:STDOUT: %.loc76_5.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %Cpp.ref.loc76: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %X.ref.loc76: type = name_ref X, imports.%X.decl [concrete = constants.%X] -// CHECK:STDOUT: %.loc76_5.2: ref %X = temporary_storage -// CHECK:STDOUT: %.loc76_5.3: init %X to %.loc76_5.2 = class_init () [concrete = constants.%X.val] -// CHECK:STDOUT: %.loc76_7.1: init %X = converted %.loc76_5.1, %.loc76_5.3 [concrete = constants.%X.val] -// CHECK:STDOUT: %.loc76_7.2: ref %X = temporary %.loc76_5.2, %.loc76_7.1 [concrete = constants.%.414] +// CHECK:STDOUT: %.loc55_5.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %Cpp.ref.loc55: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %X.ref.loc55: type = name_ref X, imports.%X.decl [concrete = constants.%X] +// CHECK:STDOUT: %.loc55_5.2: ref %X = temporary_storage +// CHECK:STDOUT: %.loc55_5.3: init %X to %.loc55_5.2 = class_init () [concrete = constants.%X.val] +// CHECK:STDOUT: %.loc55_7.1: init %X = converted %.loc55_5.1, %.loc55_5.3 [concrete = constants.%X.val] +// CHECK:STDOUT: %.loc55_7.2: ref %X = temporary %.loc55_5.2, %.loc55_7.1 [concrete = constants.%.414] // CHECK:STDOUT: %D.ref: %X.D.cpp_overload_set.type = name_ref D, imports.%X.D.cpp_overload_set.value [concrete = constants.%X.D.cpp_overload_set.value] -// CHECK:STDOUT: %bound_method.loc76: = bound_method %.loc76_7.2, %D.ref [concrete = constants.%bound_method.9a8] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc76: init %empty_tuple.type = call constants.%Destroy.WithSelf.SelfDestruct.bound(constants.%.414) +// CHECK:STDOUT: %bound_method.loc55: = bound_method %.loc55_7.2, %D.ref [concrete = constants.%bound_method.9a8] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc55: init %empty_tuple.type = call constants.%Destroy.WithSelf.SelfDestruct.bound(constants.%.414) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc56(%self.param: ref %X) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc41(%self.param: ref %X) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc56(%self.param: ref %X) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc41(%self.param: ref %X) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl(%self.param) // CHECK:STDOUT: %X.cpp_destructor.call: init %empty_tuple.type = call imports.%X.cpp_destructor.decl(%self.param) diff --git a/toolchain/check/testdata/interop/cpp/function/import/function.carbon b/toolchain/check/testdata/interop/cpp/function/import/function.carbon index 3ceb2fa3d883..ac1a92da5467 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/function.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/function.carbon @@ -37,9 +37,7 @@ library "[[@TEST_NAME]]"; import Cpp library "global.h"; fn MyF() { - // CHECK:STDERR: fail_import_global_use_different_name.carbon:[[@LINE+4]]:3: error: member name `bar` not found in `Cpp` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: Cpp.bar(); - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_import_global_use_different_name.carbon:[[@LINE+2]]:3-9: error: member name `bar` not found in `Cpp` [MemberNameNotFoundInInstScope] // CHECK:STDERR: Cpp.bar(); } @@ -59,9 +57,7 @@ library "[[@TEST_NAME]]"; import Cpp library "special_name.h"; fn MyF() { - // CHECK:STDERR: fail_import_special_name_call_unescaped.carbon:[[@LINE+4]]:3: error: member name `base` not found in `Cpp` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: Cpp.base(); - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_import_special_name_call_unescaped.carbon:[[@LINE+2]]:3-10: error: member name `base` not found in `Cpp` [MemberNameNotFoundInInstScope] // CHECK:STDERR: Cpp.base(); } @@ -85,13 +81,10 @@ library "[[@TEST_NAME]]"; import Cpp library "special_name.h"; fn MyF() { - // CHECK:STDERR: fail_import_special_name_call_escaped_no_match.carbon:[[@LINE+8]]:15: error: no matching function for call to 'base' [CppInteropParseError] - // CHECK:STDERR: 15 | Cpp.r#base(1); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_import_special_name_call_escaped_no_match.carbon:[[@LINE-6]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./special_name.h:2:6: note: candidate function not viable: requires 0 arguments, but 1 was provided [CppInteropParseNote] - // CHECK:STDERR: 2 | auto base() -> void; - // CHECK:STDERR: | ^ + // CHECK:STDERR: fail_import_special_name_call_escaped_no_match.carbon:[[@LINE+5]]:3-12: error: no matching function for call to 'base' [CppInteropParseError] + // CHECK:STDERR: included from: fail_import_special_name_call_escaped_no_match.carbon:[[@LINE-4]]:10 [InCppInclude] + // CHECK:STDERR: ./special_name.h:2:6: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: ./special_name.h:2:10-11: note: requires 0 arguments, but 1 was provided [CppInteropParseNoteReason] // CHECK:STDERR: Cpp.r#base(1); } @@ -133,9 +126,7 @@ import Cpp library "variadic.h"; fn F() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_import_variadic.carbon:[[@LINE+4]]:3: error: semantics TODO: `Unsupported: Variadic function` [SemanticsTodo] - // CHECK:STDERR: Cpp.variadic_foo(8); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_import_variadic.carbon:[[@LINE+2]]:3-21: error: semantics TODO: `Unsupported: Variadic function` [SemanticsTodo] // CHECK:STDERR: Cpp.variadic_foo(8); //@dump-sem-ir-end @@ -148,9 +139,7 @@ fn F() { // --- static.h // TODO: Promote this warning to an error by default. -// CHECK:STDERR: ./static.h:[[@LINE+3]]:13: warning: function 'static_foo' has internal linkage but is not defined [CppInteropParseWarning] -// CHECK:STDERR: 6 | static auto static_foo() -> void; -// CHECK:STDERR: | ^ +// CHECK:STDERR: ./static.h:[[@LINE+1]]:13: warning: function 'static_foo' has internal linkage but is not defined [CppInteropParseWarning] static auto static_foo() -> void; // --- todo_fail_import_static.carbon @@ -161,9 +150,7 @@ import Cpp library "static.h"; fn F() { //@dump-sem-ir-begin - // CHECK:STDERR: todo_fail_import_static.carbon:[[@LINE+4]]:18: note: used here [CppInteropParseNote] - // CHECK:STDERR: 12 | Cpp.static_foo(); - // CHECK:STDERR: | ^ + // CHECK:STDERR: todo_fail_import_static.carbon:[[@LINE+2]]:18: note: used here [CppInteropParseNote] // CHECK:STDERR: Cpp.static_foo(); //@dump-sem-ir-end diff --git a/toolchain/check/testdata/interop/cpp/function/import/function_ptr.carbon b/toolchain/check/testdata/interop/cpp/function/import/function_ptr.carbon index 45204768e274..bcc3ceb4f062 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/function_ptr.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/function_ptr.carbon @@ -9,7 +9,6 @@ // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/import/function_ptr.carbon // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/import/function_ptr.carbon -// CHECK:STDERR: error: calling function with incomplete return type 'Incomplete' [CppInteropParseError] // --- simple_callback.h @@ -147,24 +146,17 @@ fn F() { // --- fail_use_forward_decl.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_use_forward_decl.carbon:[[@LINE+4]]:10: in file included here [InCppInclude] +// CHECK:STDERR: error: calling function with incomplete return type 'Incomplete' [CppInteropParseError] +// CHECK:STDERR: included from: fail_use_forward_decl.carbon:[[@LINE+2]]:10 [InCppInclude] // CHECK:STDERR: ./forward_decl.h:2:7: note: forward declaration of 'Incomplete' [CppInteropParseNote] -// CHECK:STDERR: 2 | class Incomplete; -// CHECK:STDERR: | ^ import Cpp library "forward_decl.h"; fn F() { - // CHECK:STDERR: fail_use_forward_decl.carbon:[[@LINE+13]]:3: note: in thunk for C++ function pointer type used here [InCppFunctionPointerThunk] - // CHECK:STDERR: Cpp.ReturnCallback()(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_use_forward_decl.carbon:[[@LINE+7]]:3-24: note: in thunk for C++ function pointer type used here [InCppFunctionPointerThunk] // CHECK:STDERR: - // CHECK:STDERR: fail_use_forward_decl.carbon:[[@LINE+9]]:3: error: function returns incomplete type `Cpp.Incomplete` [IncompleteTypeInFunctionReturnType] - // CHECK:STDERR: Cpp.ReturnCallback()(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_use_forward_decl.carbon:[[@LINE-10]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_use_forward_decl.carbon:[[@LINE+5]]:3-24: error: function returns incomplete type `Cpp.Incomplete` [IncompleteTypeInFunctionReturnType] + // CHECK:STDERR: included from: fail_use_forward_decl.carbon:[[@LINE-6]]:10 [InCppInclude] // CHECK:STDERR: ./forward_decl.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: class Incomplete; - // CHECK:STDERR: ^ // CHECK:STDERR: note: return type declared here [IncompleteReturnTypeHere] // CHECK:STDERR: Cpp.ReturnCallback()(); @@ -180,9 +172,7 @@ using MyCallbackType = void(*)(int); fn MyCallback(generic arg: i32); fn F() { - // CHECK:STDERR: fail_convert_generic_arg.carbon:[[@LINE+4]]:43: error: semantics TODO: `binding maps to a non-type template parameter` [SemanticsTodo] - // CHECK:STDERR: var unused fn_ptr: Cpp.MyCallbackType = MyCallback; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_convert_generic_arg.carbon:[[@LINE+2]]:43-52: error: semantics TODO: `binding maps to a non-type template parameter` [SemanticsTodo] // CHECK:STDERR: var unused fn_ptr: Cpp.MyCallbackType = MyCallback; } @@ -197,12 +187,8 @@ using MyCallbackType = void(*)(int); fn MyCallback(arg: i32) -> i32; fn F() { - // CHECK:STDERR: fail_convert_type_mismatch.carbon:[[@LINE+7]]:43: error: can't convert exported function pointer to `void (*)(int)` [ExportedFunctionPtrTypeMismatch] - // CHECK:STDERR: var unused fn_ptr: Cpp.MyCallbackType = MyCallback; - // CHECK:STDERR: ^~~~~~~~~~ - // CHECK:STDERR: fail_convert_type_mismatch.carbon:[[@LINE-6]]:1: note: function exported with pointer type `int (*)(int)` [ExportedFromFunction] - // CHECK:STDERR: fn MyCallback(arg: i32) -> i32; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_convert_type_mismatch.carbon:[[@LINE+3]]:43-52: error: can't convert exported function pointer to `void (*)(int)` [ExportedFunctionPtrTypeMismatch] + // CHECK:STDERR: fail_convert_type_mismatch.carbon:[[@LINE-4]]:1-31: note: function exported with pointer type `int (*)(int)` [ExportedFromFunction] // CHECK:STDERR: var unused fn_ptr: Cpp.MyCallbackType = MyCallback; } diff --git a/toolchain/check/testdata/interop/cpp/function/import/inline.carbon b/toolchain/check/testdata/interop/cpp/function/import/inline.carbon index e574d5d81ada..f0c524088fc6 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/inline.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/inline.carbon @@ -37,9 +37,7 @@ fn MyF() { // --- without_definition.h // TODO: Promote this warning to an error by default. -// CHECK:STDERR: ./without_definition.h:[[@LINE+3]]:13: warning: inline function 'inline_without_def' is not defined [CppInteropParseWarning] -// CHECK:STDERR: 6 | inline void inline_without_def(); -// CHECK:STDERR: | ^ +// CHECK:STDERR: ./without_definition.h:[[@LINE+1]]:13: warning: inline function 'inline_without_def' is not defined [CppInteropParseWarning] inline void inline_without_def(); // --- todo_fail_import_without_definition.carbon @@ -50,9 +48,7 @@ import Cpp library "without_definition.h"; fn MyF() { //@dump-sem-ir-begin - // CHECK:STDERR: todo_fail_import_without_definition.carbon:[[@LINE+4]]:26: note: used here [CppInteropParseNote] - // CHECK:STDERR: 12 | Cpp.inline_without_def(); - // CHECK:STDERR: | ^ + // CHECK:STDERR: todo_fail_import_without_definition.carbon:[[@LINE+2]]:26: note: used here [CppInteropParseNote] // CHECK:STDERR: Cpp.inline_without_def(); @@ -135,12 +131,12 @@ fn MyF() { // CHECK:STDOUT: // CHECK:STDOUT: fn @MyF() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Cpp.ref.loc12: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %inline_without_def.ref.loc12: %inline_without_def.cpp_overload_set.type = name_ref inline_without_def, imports.%inline_without_def.cpp_overload_set.value [concrete = constants.%inline_without_def.cpp_overload_set.value] -// CHECK:STDOUT: %inline_without_def.call.loc12: init %empty_tuple.type = call imports.%inline_without_def.decl() -// CHECK:STDOUT: %Cpp.ref.loc15: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %inline_without_def.ref.loc15: %inline_without_def.cpp_overload_set.type = name_ref inline_without_def, imports.%inline_without_def.cpp_overload_set.value [concrete = constants.%inline_without_def.cpp_overload_set.value] -// CHECK:STDOUT: %inline_without_def.call.loc15: init %empty_tuple.type = call imports.%inline_without_def.decl() +// CHECK:STDOUT: %Cpp.ref.loc10: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %inline_without_def.ref.loc10: %inline_without_def.cpp_overload_set.type = name_ref inline_without_def, imports.%inline_without_def.cpp_overload_set.value [concrete = constants.%inline_without_def.cpp_overload_set.value] +// CHECK:STDOUT: %inline_without_def.call.loc10: init %empty_tuple.type = call imports.%inline_without_def.decl() +// CHECK:STDOUT: %Cpp.ref.loc13: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %inline_without_def.ref.loc13: %inline_without_def.cpp_overload_set.type = name_ref inline_without_def, imports.%inline_without_def.cpp_overload_set.value [concrete = constants.%inline_without_def.cpp_overload_set.value] +// CHECK:STDOUT: %inline_without_def.call.loc13: init %empty_tuple.type = call imports.%inline_without_def.decl() // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interop/cpp/function/import/method_ptr.carbon b/toolchain/check/testdata/interop/cpp/function/import/method_ptr.carbon index cc911ff78923..162a6796b570 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/method_ptr.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/method_ptr.carbon @@ -75,22 +75,14 @@ library "[[@TEST_NAME]]"; import Cpp library "method_ptr.h"; fn F(c: Cpp.C) { - // CHECK:STDERR: fail_todo_call_method_ptr.carbon:[[@LINE+18]]:3: error: member name of type `` in compound member access is not an instance member or an interface member [CompoundMemberAccessDoesNotUseBase] - // CHECK:STDERR: c.(Cpp.GetMethodPtr())(42); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_call_method_ptr.carbon:[[@LINE+10]]:3-24: error: member name of type `` in compound member access is not an instance member or an interface member [CompoundMemberAccessDoesNotUseBase] // CHECK:STDERR: - // CHECK:STDERR: fail_todo_call_method_ptr.carbon:[[@LINE+14]]:3: error: semantics TODO: `invoking a C++ member function pointer is unsupported` [SemanticsTodo] - // CHECK:STDERR: c.(Cpp.GetMethodPtr())(42); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_call_method_ptr.carbon:[[@LINE+8]]:3-28: error: semantics TODO: `invoking a C++ member function pointer is unsupported` [SemanticsTodo] // CHECK:STDERR: // CHECK:STDERR: error: called object type 'void (C::*)() const' is not a function or function pointer [CppInteropParseError] - // CHECK:STDERR: fail_todo_call_method_ptr.carbon:[[@LINE+9]]:3: note: in thunk for C++ function pointer type used here [InCppFunctionPointerThunk] - // CHECK:STDERR: c.(Cpp.GetMethodPtr())(42); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_call_method_ptr.carbon:[[@LINE+5]]:3-28: note: in thunk for C++ function pointer type used here [InCppFunctionPointerThunk] // CHECK:STDERR: - // CHECK:STDERR: fail_todo_call_method_ptr.carbon:[[@LINE+5]]:3: error: 1 argument passed to function expecting 0 arguments [CallArgCountMismatch] - // CHECK:STDERR: c.(Cpp.GetMethodPtr())(42); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_call_method_ptr.carbon:[[@LINE+3]]:3-28: error: 1 argument passed to function expecting 0 arguments [CallArgCountMismatch] // CHECK:STDERR: fail_todo_call_method_ptr.carbon: note: calling function declared here [InCallToEntity] // CHECK:STDERR: c.(Cpp.GetMethodPtr())(42); @@ -104,12 +96,8 @@ import Cpp library "method_ptr.h"; fn F(ref c: Cpp.C); fn G() { - // CHECK:STDERR: fail_pass_function_for_method.carbon:[[@LINE+7]]:39: error: can't convert exported function pointer to `void (C::*)(void) const` [ExportedFunctionPtrTypeMismatch] - // CHECK:STDERR: var unused ptr: Cpp.MethodPtrType = F; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_pass_function_for_method.carbon:[[@LINE-6]]:1: note: function exported with pointer type `void (*)(class C &)` [ExportedFromFunction] - // CHECK:STDERR: fn F(ref c: Cpp.C); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_pass_function_for_method.carbon:[[@LINE+3]]:39: error: can't convert exported function pointer to `void (C::*)(void) const` [ExportedFunctionPtrTypeMismatch] + // CHECK:STDERR: fail_pass_function_for_method.carbon:[[@LINE-4]]:1-19: note: function exported with pointer type `void (*)(class C &)` [ExportedFromFunction] // CHECK:STDERR: var unused ptr: Cpp.MethodPtrType = F; } @@ -124,12 +112,8 @@ class C { } fn F() { - // CHECK:STDERR: fail_wrong_parent_type.carbon:[[@LINE+7]]:39: error: can't convert exported member function pointer to `void (C::*)(void) const` [ExportedFunctionPtrTypeMismatch] - // CHECK:STDERR: var unused ptr: Cpp.MethodPtrType = C.Method; - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_wrong_parent_type.carbon:[[@LINE-7]]:3: note: function exported with pointer type `void (Carbon::C::*)(void) const` [ExportedFromFunction] - // CHECK:STDERR: fn Method(self); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_wrong_parent_type.carbon:[[@LINE+3]]:39-46: error: can't convert exported member function pointer to `void (C::*)(void) const` [ExportedFunctionPtrTypeMismatch] + // CHECK:STDERR: fail_wrong_parent_type.carbon:[[@LINE-5]]:3-18: note: function exported with pointer type `void (Carbon::C::*)(void) const` [ExportedFromFunction] // CHECK:STDERR: var unused ptr: Cpp.MethodPtrType = C.Method; } @@ -149,12 +133,8 @@ using MethodPtrType = void(Carbon::C::*)(float) const; fn G() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+7]]:39: error: can't convert exported member function pointer to `void (Carbon::C::*)(float) const` [ExportedFunctionPtrTypeMismatch] - // CHECK:STDERR: var unused ptr: Cpp.MethodPtrType = C.Method; - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE-12]]:3: note: function exported with pointer type `void (Carbon::C::*)(int) const` [ExportedFromFunction] - // CHECK:STDERR: fn Method(self, i: i32); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+3]]:39-46: error: can't convert exported member function pointer to `void (Carbon::C::*)(float) const` [ExportedFunctionPtrTypeMismatch] + // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE-10]]:3-26: note: function exported with pointer type `void (Carbon::C::*)(int) const` [ExportedFromFunction] // CHECK:STDERR: var unused ptr: Cpp.MethodPtrType = C.Method; //@dump-sem-ir-end @@ -481,11 +461,11 @@ fn G() { // CHECK:STDOUT: %ptr.var_patt: %pattern_type.4b7 = var_pattern %ptr.patt [concrete] // CHECK:STDOUT: %self.param_patt.952: %pattern_type.4b7 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.a35: %pattern_type.4b7 = wrapper_binding_pattern self, %self.param_patt.952 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc22 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc18 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc22 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc18 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.3: %Destroy.WithSelf.Op.type.ef016f.3 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.3: type = fn_type @Destroy.WithSelf.SelfDestruct.loc22 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.3: type = fn_type @Destroy.WithSelf.SelfDestruct.loc18 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.3: %Destroy.WithSelf.SelfDestruct.type.fbceb5.3 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -497,14 +477,14 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc22 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.3] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc18 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.3] { // CHECK:STDOUT: %self.param_patt: %pattern_type.4b7 = ref_param_pattern [concrete = constants.%self.param_patt.952] // CHECK:STDOUT: %self.patt: %pattern_type.4b7 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.a35] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %.659 = ref_param call_param0 // CHECK:STDOUT: %self: ref %.659 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.3: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc22 [concrete = constants.%Destroy.WithSelf.Op.403171.3] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.3: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc18 [concrete = constants.%Destroy.WithSelf.Op.403171.3] { // CHECK:STDOUT: %self.param_patt: %pattern_type.4b7 = ref_param_pattern [concrete = constants.%self.param_patt.952] // CHECK:STDOUT: %self.patt: %pattern_type.4b7 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.a35] // CHECK:STDOUT: } { @@ -519,7 +499,7 @@ fn G() { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %Method.ref: %C.Method.type = name_ref Method, @C.%C.Method.decl [concrete = constants.%C.Method] // CHECK:STDOUT: assign %ptr.var, -// CHECK:STDOUT: %.loc22: type = splice_block %MethodPtrType.ref [concrete = constants.%.659] { +// CHECK:STDOUT: %.loc18: type = splice_block %MethodPtrType.ref [concrete = constants.%.659] { // CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %MethodPtrType.ref: type = name_ref MethodPtrType, constants.%.659 [concrete = constants.%.659] // CHECK:STDOUT: } @@ -536,16 +516,16 @@ fn G() { // CHECK:STDOUT: fn @C.Method__carbon_thunk(%self.param: ref %C, %_.param: ref %i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: -// CHECK:STDOUT: %.loc22_40.1: %C = acquire_value %self.param -// CHECK:STDOUT: %.loc22_40.2: %i32 = acquire_value %_.param +// CHECK:STDOUT: %.loc18_40.1: %C = acquire_value %self.param +// CHECK:STDOUT: %.loc18_40.2: %i32 = acquire_value %_.param // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc22(%self.param: ref %.659) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc18(%self.param: ref %.659) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc22(%self.param: ref %.659) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc18(%self.param: ref %.659) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc22(%self.param: ref %.659) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc18(%self.param: ref %.659) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.3(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.3(%self.param) diff --git a/toolchain/check/testdata/interop/cpp/function/import/multiple_too_few_args_calls.carbon b/toolchain/check/testdata/interop/cpp/function/import/multiple_too_few_args_calls.carbon index 7fb305ba8813..c5e50ac26bd8 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/multiple_too_few_args_calls.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/multiple_too_few_args_calls.carbon @@ -22,20 +22,14 @@ void F2(X x); fn Call() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+7]]:10: error: no matching function for call to 'F1' [CppInteropParseError] - // CHECK:STDERR: 19 | Cpp.F1(); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE-9]]:6: note: candidate function not viable: requires single argument 'x', but no arguments were provided [CppInteropParseNote] - // CHECK:STDERR: 6 | void F1(X x); - // CHECK:STDERR: | ^ ~~~ + // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+4]]:3-8: error: no matching function for call to 'F1' [CppInteropParseError] + // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE-7]]:6: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE-8]]:9-11: note: requires single argument 'x', but no arguments were provided [CppInteropParseNoteReason] // CHECK:STDERR: Cpp.F1(); - // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+7]]:10: error: no matching function for call to 'F2' [CppInteropParseError] - // CHECK:STDERR: 27 | Cpp.F2(); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE-16]]:6: note: candidate function not viable: requires single argument 'x', but no arguments were provided [CppInteropParseNote] - // CHECK:STDERR: 7 | void F2(X x); - // CHECK:STDERR: | ^ ~~~ + // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+4]]:3-8: error: no matching function for call to 'F2' [CppInteropParseError] + // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE-11]]:6: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE-12]]:9-11: note: requires single argument 'x', but no arguments were provided [CppInteropParseNoteReason] // CHECK:STDERR: Cpp.F2(); //@dump-sem-ir-end @@ -63,9 +57,9 @@ fn Call() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Call() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Cpp.ref.loc19: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Cpp.ref.loc16: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %F1.ref: %F1.cpp_overload_set.type = name_ref F1, imports.%F1.cpp_overload_set.value [concrete = constants.%F1.cpp_overload_set.value] -// CHECK:STDOUT: %Cpp.ref.loc27: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Cpp.ref.loc21: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %F2.ref: %F2.cpp_overload_set.type = name_ref F2, imports.%F2.cpp_overload_set.value [concrete = constants.%F2.cpp_overload_set.value] // CHECK:STDOUT: // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/interop/cpp/function/import/overloads.carbon b/toolchain/check/testdata/interop/cpp/function/import/overloads.carbon index b8c503d54df9..e7926c11fd13 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/overloads.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/overloads.carbon @@ -140,13 +140,9 @@ import Cpp library "int_literal.h"; fn F() { // TODO: get rid of the second error message here. // i128_max + 1 - // CHECK:STDERR: fail_import_large_int_literal.carbon:[[@LINE+8]]:44: error: integer value 170141183460469231731687303715884105728 too large to fit in a signed C++ integer type; requires 129 bits, but max is 128 [IntTooLargeForCppType] - // CHECK:STDERR: let unused h: i128 = Cpp.int_literal_foo(170141183460469231731687303715884105728); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_large_int_literal.carbon:[[@LINE+4]]:44-82: error: integer value 170141183460469231731687303715884105728 too large to fit in a signed C++ integer type; requires 129 bits, but max is 128 [IntTooLargeForCppType] // CHECK:STDERR: - // CHECK:STDERR: fail_import_large_int_literal.carbon:[[@LINE+4]]:44: error: call argument of type `Core.IntLiteral` is not supported [CppCallArgTypeNotSupported] - // CHECK:STDERR: let unused h: i128 = Cpp.int_literal_foo(170141183460469231731687303715884105728); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_large_int_literal.carbon:[[@LINE+2]]:44-82: error: call argument of type `Core.IntLiteral` is not supported [CppCallArgTypeNotSupported] // CHECK:STDERR: let unused h: i128 = Cpp.int_literal_foo(170141183460469231731687303715884105728); } @@ -178,13 +174,9 @@ library "[[@TEST_NAME]]"; import Cpp library "negative_literal_passed_to_unsigned.h"; fn F() { - // CHECK:STDERR: fail_import_negative_literal_passed_to_unsigned.carbon:[[@LINE+8]]:27: error: negative integer value -1 converted to unsigned type `u32` [NegativeIntInUnsignedType] - // CHECK:STDERR: Cpp.neg_to_unsigned_foo(-1); - // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_import_negative_literal_passed_to_unsigned.carbon:[[@LINE-6]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_negative_literal_passed_to_unsigned.carbon:[[@LINE+4]]:27-28: error: negative integer value -1 converted to unsigned type `u32` [NegativeIntInUnsignedType] + // CHECK:STDERR: included from: fail_import_negative_literal_passed_to_unsigned.carbon:[[@LINE-4]]:10 [InCppInclude] // CHECK:STDERR: ./negative_literal_passed_to_unsigned.h:2:39: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto neg_to_unsigned_foo(unsigned int a) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.neg_to_unsigned_foo(-1); } @@ -211,13 +203,9 @@ library "[[@TEST_NAME]]"; import Cpp library "floating_point_literal.h"; fn F() { - // CHECK:STDERR: fail_import_large_floating_point_literal.carbon:[[@LINE+8]]:25: error: value 18*10^307 too large for floating-point type `f64` [FloatLiteralTooLargeForType] - // CHECK:STDERR: Cpp.float_literal_foo(1.8e+308); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_import_large_floating_point_literal.carbon:[[@LINE-6]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_large_floating_point_literal.carbon:[[@LINE+4]]:25-32: error: value 18*10^307 too large for floating-point type `f64` [FloatLiteralTooLargeForType] + // CHECK:STDERR: included from: fail_import_large_floating_point_literal.carbon:[[@LINE-4]]:10 [InCppInclude] // CHECK:STDERR: ./floating_point_literal.h:3:31: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto float_literal_foo(double a) -> double; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.float_literal_foo(1.8e+308); } @@ -261,68 +249,38 @@ import Cpp library "struct_init.h"; fn MakeThreeFields() -> {.a: i32, .b: i32, .c: i32}; fn ThreeFields(value: {.a: i32, .b: i32, .c: i32}, ref reference: {.a: i32, .b: i32, .c: i32}) { - // 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)` [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] + // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+5]]:23-46: error: cannot implicitly convert expression of type `{.a: Core.IntLiteral, .b: Core.IntLiteral, .c: Core.IntLiteral}` to `Cpp.ThreeFields` [ConversionFailure] + // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+4]]:23-46: note: type `{.a: Core.IntLiteral, .b: Core.IntLiteral, .c: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: included from: fail_todo_struct_init_nonempty.carbon:[[@LINE-7]]:10 [InCppInclude] // CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto PassThreeFields(ThreeFields t) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.PassThreeFields({.a = 1, .b = 2, .c = 3}); - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: Cpp.PassThreeFields(value); - // CHECK:STDERR: ^~~~~ - // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE-24]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+5]]:23-27: error: cannot implicitly convert expression of type `{.a: i32, .b: i32, .c: i32}` to `Cpp.ThreeFields` [ConversionFailure] + // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+4]]:23-27: note: type `{.a: i32, .b: i32, .c: i32}` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: included from: fail_todo_struct_init_nonempty.carbon:[[@LINE-14]]:10 [InCppInclude] // CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto PassThreeFields(ThreeFields t) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.PassThreeFields(value); - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: Cpp.PassThreeFields(reference); - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE-37]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+5]]:23-31: error: cannot implicitly convert expression of type `{.a: i32, .b: i32, .c: i32}` to `Cpp.ThreeFields` [ConversionFailure] + // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+4]]:23-31: note: type `{.a: i32, .b: i32, .c: i32}` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: included from: fail_todo_struct_init_nonempty.carbon:[[@LINE-21]]:10 [InCppInclude] // CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto PassThreeFields(ThreeFields t) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.PassThreeFields(reference); - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: Cpp.PassThreeFields(MakeThreeFields()); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE-50]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+5]]:23-39: error: cannot implicitly convert expression of type `{.a: i32, .b: i32, .c: i32}` to `Cpp.ThreeFields` [ConversionFailure] + // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+4]]:23-39: note: type `{.a: i32, .b: i32, .c: i32}` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: included from: fail_todo_struct_init_nonempty.carbon:[[@LINE-28]]:10 [InCppInclude] // CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto PassThreeFields(ThreeFields t) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.PassThreeFields(MakeThreeFields()); - // 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)` [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] + // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+5]]:23-46: error: cannot implicitly convert expression of type `{.b: Core.IntLiteral, .c: Core.IntLiteral, .a: Core.IntLiteral}` to `Cpp.ThreeFields` [ConversionFailure] + // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+4]]:23-46: note: type `{.b: Core.IntLiteral, .c: Core.IntLiteral, .a: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: included from: fail_todo_struct_init_nonempty.carbon:[[@LINE-35]]:10 [InCppInclude] // CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto PassThreeFields(ThreeFields t) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.PassThreeFields({.b = 1, .c = 2, .a = 3}); } @@ -334,23 +292,17 @@ library "[[@TEST_NAME]]"; import Cpp library "struct_init.h"; fn F() { - // CHECK:STDERR: fail_struct_init_field_mismatch.carbon:[[@LINE+8]]:55: error: no matching function for call to 'PassThreeFields' [CppInteropParseError] - // CHECK:STDERR: 15 | Cpp.PassThreeFields({.a = 1, .b = 2, .c = 3, .d = 4}); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_struct_init_field_mismatch.carbon:[[@LINE-6]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./struct_init.h:10:6: note: candidate function not viable: cannot convert initializer list argument to 'ThreeFields' [CppInteropParseNote] - // CHECK:STDERR: 10 | auto PassThreeFields(ThreeFields t) -> void; - // CHECK:STDERR: | ^ ~~~~~~~~~~~~~ + // CHECK:STDERR: fail_struct_init_field_mismatch.carbon:[[@LINE+5]]:3-21: error: no matching function for call to 'PassThreeFields' [CppInteropParseError] + // CHECK:STDERR: included from: fail_struct_init_field_mismatch.carbon:[[@LINE-4]]:10 [InCppInclude] + // CHECK:STDERR: ./struct_init.h:10:6: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: ./struct_init.h:10:22-34: note: cannot convert initializer list argument to 'ThreeFields' [CppInteropParseNoteReason] // CHECK:STDERR: Cpp.PassThreeFields({.a = 1, .b = 2, .c = 3, .d = 4}); - // CHECK:STDERR: fail_struct_init_field_mismatch.carbon:[[@LINE+8]]:47: error: no matching function for call to 'PassThreeFields' [CppInteropParseError] - // CHECK:STDERR: 25 | Cpp.PassThreeFields({.a = 1, .x = 2, .c = 3}); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_struct_init_field_mismatch.carbon:[[@LINE-16]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./struct_init.h:10:6: note: candidate function not viable: cannot convert initializer list argument to 'ThreeFields' [CppInteropParseNote] - // CHECK:STDERR: 10 | auto PassThreeFields(ThreeFields t) -> void; - // CHECK:STDERR: | ^ ~~~~~~~~~~~~~ + // CHECK:STDERR: fail_struct_init_field_mismatch.carbon:[[@LINE+5]]:3-21: error: no matching function for call to 'PassThreeFields' [CppInteropParseError] + // CHECK:STDERR: included from: fail_struct_init_field_mismatch.carbon:[[@LINE-11]]:10 [InCppInclude] + // CHECK:STDERR: ./struct_init.h:10:6: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: ./struct_init.h:10:22-34: note: cannot convert initializer list argument to 'ThreeFields' [CppInteropParseNoteReason] // CHECK:STDERR: Cpp.PassThreeFields({.a = 1, .x = 2, .c = 3}); } @@ -362,9 +314,7 @@ library "[[@TEST_NAME]]"; import Cpp library "struct_init.h"; fn F() { - // CHECK:STDERR: fail_struct_init_unsupported_field_name.carbon:[[@LINE+4]]:23: error: field name `base` cannot be mapped into C++ [CppCallFieldNameNotSupported] - // CHECK:STDERR: Cpp.PassThreeFields({.base = 1}); - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_struct_init_unsupported_field_name.carbon:[[@LINE+2]]:23-33: error: field name `base` cannot be mapped into C++ [CppCallFieldNameNotSupported] // CHECK:STDERR: Cpp.PassThreeFields({.base = 1}); } @@ -381,55 +331,31 @@ import Cpp library "struct_init.h"; fn MakeEmpty() -> (); 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: Cpp.PassNoFields(()); - // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE-14]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+5]]:20-21: error: cannot implicitly convert expression of type `()` to `Cpp.NoFields` [ConversionFailure] + // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+4]]:20-21: note: type `()` does not implement interface `Core.ImplicitAs(Cpp.NoFields)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: included from: fail_struct_init_from_tuple.carbon:[[@LINE-10]]:10 [InCppInclude] // CHECK:STDERR: ./struct_init.h:4:28: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto PassNoFields(NoFields s) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.PassNoFields(()); - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: Cpp.PassNoFields(value); - // CHECK:STDERR: ^~~~~ - // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE-27]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+5]]:20-24: error: cannot implicitly convert expression of type `()` to `Cpp.NoFields` [ConversionFailure] + // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+4]]:20-24: note: type `()` does not implement interface `Core.ImplicitAs(Cpp.NoFields)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: included from: fail_struct_init_from_tuple.carbon:[[@LINE-17]]:10 [InCppInclude] // CHECK:STDERR: ./struct_init.h:4:28: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto PassNoFields(NoFields s) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.PassNoFields(value); - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: Cpp.PassNoFields(reference); - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE-40]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+5]]:20-28: error: cannot implicitly convert expression of type `()` to `Cpp.NoFields` [ConversionFailure] + // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+4]]:20-28: note: type `()` does not implement interface `Core.ImplicitAs(Cpp.NoFields)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: included from: fail_struct_init_from_tuple.carbon:[[@LINE-24]]:10 [InCppInclude] // CHECK:STDERR: ./struct_init.h:4:28: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto PassNoFields(NoFields s) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.PassNoFields(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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: Cpp.PassNoFields(MakeEmpty()); - // CHECK:STDERR: ^~~~~~~~~~~ - // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE-53]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+5]]:20-30: error: cannot implicitly convert expression of type `()` to `Cpp.NoFields` [ConversionFailure] + // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+4]]:20-30: note: type `()` does not implement interface `Core.ImplicitAs(Cpp.NoFields)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: included from: fail_struct_init_from_tuple.carbon:[[@LINE-31]]:10 [InCppInclude] // CHECK:STDERR: ./struct_init.h:4:28: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto PassNoFields(NoFields s) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.PassNoFields(MakeEmpty()); } @@ -437,55 +363,31 @@ fn Empty(value: (), ref reference: ()) { fn MakeThreeFields() -> (i32, i32, i32); 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)` [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] + // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+5]]:23-31: error: cannot implicitly convert expression of type `(Core.IntLiteral, Core.IntLiteral, Core.IntLiteral)` to `Cpp.ThreeFields` [ConversionFailure] + // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+4]]:23-31: note: type `(Core.IntLiteral, Core.IntLiteral, Core.IntLiteral)` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: included from: fail_struct_init_from_tuple.carbon:[[@LINE-42]]:10 [InCppInclude] // CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto PassThreeFields(ThreeFields t) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.PassThreeFields((1, 2, 3)); - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: Cpp.PassThreeFields(value); - // CHECK:STDERR: ^~~~~ - // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE-83]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+5]]:23-27: error: cannot implicitly convert expression of type `(i32, i32, i32)` to `Cpp.ThreeFields` [ConversionFailure] + // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+4]]:23-27: note: type `(i32, i32, i32)` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: included from: fail_struct_init_from_tuple.carbon:[[@LINE-49]]:10 [InCppInclude] // CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto PassThreeFields(ThreeFields t) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.PassThreeFields(value); - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: Cpp.PassThreeFields(reference); - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE-96]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+5]]:23-31: error: cannot implicitly convert expression of type `(i32, i32, i32)` to `Cpp.ThreeFields` [ConversionFailure] + // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+4]]:23-31: note: type `(i32, i32, i32)` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: included from: fail_struct_init_from_tuple.carbon:[[@LINE-56]]:10 [InCppInclude] // CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto PassThreeFields(ThreeFields t) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.PassThreeFields(reference); - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: Cpp.PassThreeFields(MakeThreeFields()); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE-109]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+5]]:23-39: error: cannot implicitly convert expression of type `(i32, i32, i32)` to `Cpp.ThreeFields` [ConversionFailure] + // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+4]]:23-39: note: type `(i32, i32, i32)` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: included from: fail_struct_init_from_tuple.carbon:[[@LINE-63]]:10 [InCppInclude] // CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto PassThreeFields(ThreeFields t) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.PassThreeFields(MakeThreeFields()); } @@ -508,29 +410,17 @@ import Cpp library "int_from_struct.h"; fn F() { // C++ permits `{}` to be used to initialize an int, but Carbon does not. - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: Cpp.PassInt({}); - // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_int_from_struct.carbon:[[@LINE-11]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_int_from_struct.carbon:[[@LINE+5]]:15-16: error: cannot implicitly convert expression of type `{}` to `i32` [ConversionFailure] + // CHECK:STDERR: fail_int_from_struct.carbon:[[@LINE+4]]:15-16: note: type `{}` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: included from: fail_int_from_struct.carbon:[[@LINE-7]]:10 [InCppInclude] // CHECK:STDERR: ./int_from_struct.h:2:18: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto PassInt(int n) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.PassInt({}); - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: Cpp.PassInt(()); - // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_int_from_struct.carbon:[[@LINE-24]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_int_from_struct.carbon:[[@LINE+5]]:15-16: error: cannot implicitly convert expression of type `()` to `i32` [ConversionFailure] + // CHECK:STDERR: fail_int_from_struct.carbon:[[@LINE+4]]:15-16: note: type `()` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: included from: fail_int_from_struct.carbon:[[@LINE-14]]:10 [InCppInclude] // CHECK:STDERR: ./int_from_struct.h:2:18: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto PassInt(int n) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.PassInt(()); } @@ -545,29 +435,17 @@ fn F() { // C++ overload resolution prefers to convert `{}` to `int` rather than to an // empty struct. So that's the overload we pick, even though we can't call it. - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: Cpp.PassOverloaded({}); - // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_int_from_struct_overloaded.carbon:[[@LINE-12]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_int_from_struct_overloaded.carbon:[[@LINE+5]]:22-23: error: cannot implicitly convert expression of type `{}` to `i32` [ConversionFailure] + // CHECK:STDERR: fail_int_from_struct_overloaded.carbon:[[@LINE+4]]:22-23: note: type `{}` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: included from: fail_int_from_struct_overloaded.carbon:[[@LINE-8]]:10 [InCppInclude] // CHECK:STDERR: ./int_from_struct.h:6:25: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto PassOverloaded(int n) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.PassOverloaded({}); - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: Cpp.PassOverloaded(()); - // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_int_from_struct_overloaded.carbon:[[@LINE-25]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_int_from_struct_overloaded.carbon:[[@LINE+5]]:22-23: error: cannot implicitly convert expression of type `()` to `i32` [ConversionFailure] + // CHECK:STDERR: fail_int_from_struct_overloaded.carbon:[[@LINE+4]]:22-23: note: type `()` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: included from: fail_int_from_struct_overloaded.carbon:[[@LINE-15]]:10 [InCppInclude] // CHECK:STDERR: ./int_from_struct.h:6:25: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto PassOverloaded(int n) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.PassOverloaded(()); } @@ -592,13 +470,10 @@ library "[[@TEST_NAME]]"; import Cpp library "nested_structs.h"; fn F() { - // CHECK:STDERR: fail_pass_nested_structs_inner_field_mismatch.carbon:[[@LINE+8]]:44: error: no matching function for call to 'TakeB' [CppInteropParseError] - // CHECK:STDERR: 15 | Cpp.TakeB({.a = {.x = 1, .z = 2}, .n = 3}); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_pass_nested_structs_inner_field_mismatch.carbon:[[@LINE-6]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./nested_structs.h:11:6: note: candidate function not viable: cannot convert initializer list argument to 'B' [CppInteropParseNote] - // CHECK:STDERR: 11 | void TakeB(B); - // CHECK:STDERR: | ^ ~ + // CHECK:STDERR: fail_pass_nested_structs_inner_field_mismatch.carbon:[[@LINE+5]]:3-11: error: no matching function for call to 'TakeB' [CppInteropParseError] + // CHECK:STDERR: included from: fail_pass_nested_structs_inner_field_mismatch.carbon:[[@LINE-4]]:10 [InCppInclude] + // CHECK:STDERR: ./nested_structs.h:11:6: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: ./nested_structs.h:11:12: note: cannot convert initializer list argument to 'B' [CppInteropParseNoteReason] // CHECK:STDERR: Cpp.TakeB({.a = {.x = 1, .z = 2}, .n = 3}); } @@ -610,16 +485,10 @@ library "[[@TEST_NAME]]"; import Cpp library "nested_structs.h"; 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)` [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] + // CHECK:STDERR: fail_todo_pass_nested_structs.carbon:[[@LINE+5]]:13-43: error: cannot implicitly convert expression of type `{.a: {.x: Core.IntLiteral, .y: Core.IntLiteral}, .n: Core.IntLiteral}` to `Cpp.B` [ConversionFailure] + // CHECK:STDERR: fail_todo_pass_nested_structs.carbon:[[@LINE+4]]:13-43: note: type `{.a: {.x: Core.IntLiteral, .y: Core.IntLiteral}, .n: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.B)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: included from: fail_todo_pass_nested_structs.carbon:[[@LINE-5]]:10 [InCppInclude] // CHECK:STDERR: ./nested_structs.h:11:13: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: void TakeB(B); - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.TakeB({.a = {.x = 1, .y = 2}, .n = 3}); } @@ -653,16 +522,10 @@ library "[[@TEST_NAME]]"; import Cpp library "signedness_change.h"; fn F() { - // CHECK:STDERR: fail_signedness_change_rejected.carbon:[[@LINE+11]]:22: error: cannot implicitly convert expression of type `i32` to `u32` [ConversionFailure] - // CHECK:STDERR: Cpp.signedness_foo(1 as i32); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_signedness_change_rejected.carbon:[[@LINE+8]]:22: note: type `i32` does not implement interface `Core.ImplicitAs(u32)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: Cpp.signedness_foo(1 as i32); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_signedness_change_rejected.carbon:[[@LINE-9]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_signedness_change_rejected.carbon:[[@LINE+5]]:22-29: error: cannot implicitly convert expression of type `i32` to `u32` [ConversionFailure] + // CHECK:STDERR: fail_signedness_change_rejected.carbon:[[@LINE+4]]:22-29: note: type `i32` does not implement interface `Core.ImplicitAs(u32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: included from: fail_signedness_change_rejected.carbon:[[@LINE-5]]:10 [InCppInclude] // CHECK:STDERR: ./signedness_change.h:2:34: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto signedness_foo(unsigned int a) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.signedness_foo(1 as i32); } @@ -678,16 +541,10 @@ library "[[@TEST_NAME]]"; import Cpp library "downsizing_rejected.h"; fn F() { - // CHECK:STDERR: fail_import_downsizing_rejected.carbon:[[@LINE+11]]:22: error: cannot implicitly convert expression of type `i32` to `i16` [ConversionFailure] - // CHECK:STDERR: Cpp.downsizing_foo(1 as i32); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_import_downsizing_rejected.carbon:[[@LINE+8]]:22: note: type `i32` does not implement interface `Core.ImplicitAs(i16)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: Cpp.downsizing_foo(1 as i32); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_import_downsizing_rejected.carbon:[[@LINE-9]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_downsizing_rejected.carbon:[[@LINE+5]]:22-29: error: cannot implicitly convert expression of type `i32` to `i16` [ConversionFailure] + // CHECK:STDERR: fail_import_downsizing_rejected.carbon:[[@LINE+4]]:22-29: note: type `i32` does not implement interface `Core.ImplicitAs(i16)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: included from: fail_import_downsizing_rejected.carbon:[[@LINE-5]]:10 [InCppInclude] // CHECK:STDERR: ./downsizing_rejected.h:2:27: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto downsizing_foo(short a) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.downsizing_foo(1 as i32); } @@ -707,13 +564,10 @@ library "[[@TEST_NAME]]"; import Cpp library "no_viable_function.h"; fn F() { - // CHECK:STDERR: fail_import_no_viable_function.carbon:[[@LINE+8]]:29: error: no matching function for call to 'no_viable_foo' [CppInteropParseError] - // CHECK:STDERR: 15 | Cpp.no_viable_foo(1 as i64); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_import_no_viable_function.carbon:[[@LINE-6]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./no_viable_function.h:2:6: note: candidate function not viable: requires 2 arguments, but 1 was provided [CppInteropParseNote] - // CHECK:STDERR: 2 | auto no_viable_foo(short a, int b) -> void; - // CHECK:STDERR: | ^ ~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_no_viable_function.carbon:[[@LINE+5]]:3-19: error: no matching function for call to 'no_viable_foo' [CppInteropParseError] + // CHECK:STDERR: included from: fail_import_no_viable_function.carbon:[[@LINE-4]]:10 [InCppInclude] + // CHECK:STDERR: ./no_viable_function.h:2:6: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: ./no_viable_function.h:2:20-33: note: requires 2 arguments, but 1 was provided [CppInteropParseNoteReason] // CHECK:STDERR: Cpp.no_viable_foo(1 as i64); } @@ -734,17 +588,10 @@ library "[[@TEST_NAME]]"; import Cpp library "ambiguous_overload.h"; fn F() { - // CHECK:STDERR: fail_import_ambiguous_overload.carbon:[[@LINE+12]]:29: error: call to 'ambiguous_foo' is ambiguous [CppInteropParseError] - // CHECK:STDERR: 19 | Cpp.ambiguous_foo(1 as i64); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_import_ambiguous_overload.carbon:[[@LINE-6]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_ambiguous_overload.carbon:[[@LINE+5]]:3-19: error: call to 'ambiguous_foo' is ambiguous [CppInteropParseError] + // CHECK:STDERR: included from: fail_import_ambiguous_overload.carbon:[[@LINE-4]]:10 [InCppInclude] // CHECK:STDERR: ./ambiguous_overload.h:2:6: note: candidate function [CppInteropParseNote] - // CHECK:STDERR: 2 | auto ambiguous_foo(short a) -> void; - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_import_ambiguous_overload.carbon:[[@LINE-10]]:10: in file included here [InCppInclude] // CHECK:STDERR: ./ambiguous_overload.h:3:6: note: candidate function [CppInteropParseNote] - // CHECK:STDERR: 3 | auto ambiguous_foo(int a) -> void; - // CHECK:STDERR: | ^ // CHECK:STDERR: Cpp.ambiguous_foo(1 as i64); } @@ -765,17 +612,10 @@ library "[[@TEST_NAME]]"; import Cpp library "deleted_function.h"; fn F() { - // CHECK:STDERR: fail_import_deleted_function.carbon:[[@LINE+12]]:27: error: call to deleted function 'deleted_foo' [CppInteropParseError] - // CHECK:STDERR: 19 | Cpp.deleted_foo(1 as i32); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_import_deleted_function.carbon:[[@LINE-6]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_deleted_function.carbon:[[@LINE+5]]:3-17: error: call to deleted function 'deleted_foo' [CppInteropParseError] + // CHECK:STDERR: included from: fail_import_deleted_function.carbon:[[@LINE-4]]:10 [InCppInclude] // CHECK:STDERR: ./deleted_function.h:3:6: note: candidate function has been explicitly deleted [CppInteropParseNote] - // CHECK:STDERR: 3 | auto deleted_foo(int a) -> void = delete; - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_import_deleted_function.carbon:[[@LINE-10]]:10: in file included here [InCppInclude] // CHECK:STDERR: ./deleted_function.h:2:6: note: candidate function [CppInteropParseNote] - // CHECK:STDERR: 2 | auto deleted_foo(short a) -> void; - // CHECK:STDERR: | ^ // CHECK:STDERR: Cpp.deleted_foo(1 as i32); } @@ -793,12 +633,8 @@ interface I {} fn EchoValue[ValueT: I](unused generic value: ValueT) {} fn F() { - // CHECK:STDERR: fail_missing_impl.carbon:[[@LINE+7]]:3: error: cannot convert type `` into type implementing `I` [ConversionFailureTypeToFacet] - // CHECK:STDERR: EchoValue(Cpp.missing_impl_foo); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_missing_impl.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn EchoValue[ValueT: I](unused generic value: ValueT) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_missing_impl.carbon:[[@LINE+3]]:3-33: error: cannot convert type `` into type implementing `I` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_missing_impl.carbon:[[@LINE-4]]:1-55: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: EchoValue(Cpp.missing_impl_foo); } diff --git a/toolchain/check/testdata/interop/cpp/function/import/param_unsupported.carbon b/toolchain/check/testdata/interop/cpp/function/import/param_unsupported.carbon index 0e24477d96c0..08a23c52762d 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/param_unsupported.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/param_unsupported.carbon @@ -26,9 +26,7 @@ import Cpp library "unsupported_primitive_type.h"; fn F() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_import_unsupported_primitive_type.carbon:[[@LINE+4]]:3: error: semantics TODO: `Unsupported: parameter type: _BitInt(23)` [SemanticsTodo] - // CHECK:STDERR: Cpp.foo(11); - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_todo_import_unsupported_primitive_type.carbon:[[@LINE+2]]:3-13: error: semantics TODO: `Unsupported: parameter type: _BitInt(23)` [SemanticsTodo] // CHECK:STDERR: Cpp.foo(11); //@dump-sem-ir-end @@ -50,9 +48,7 @@ import Cpp library "unsupported_primitive_type_among_params.h"; fn F() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_import_unsupported_primitive_type_among_params.carbon:[[@LINE+4]]:3: error: semantics TODO: `Unsupported: parameter type: _BitInt(23)` [SemanticsTodo] - // CHECK:STDERR: Cpp.foo(1, 20); - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_import_unsupported_primitive_type_among_params.carbon:[[@LINE+2]]:3-16: error: semantics TODO: `Unsupported: parameter type: _BitInt(23)` [SemanticsTodo] // CHECK:STDERR: Cpp.foo(1, 20); //@dump-sem-ir-end @@ -74,13 +70,9 @@ import Cpp library "int_param.h"; // This doesn't have a direct type mapping in `getIntTypeForBitwidth`. fn F(x: i512) { - // CHECK:STDERR: fail_large_int.carbon:[[@LINE+8]]:11: error: call argument of type `i512` is not supported [CppCallArgTypeNotSupported] - // CHECK:STDERR: Cpp.foo(x); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_large_int.carbon:[[@LINE+4]]:11: error: call argument of type `i512` is not supported [CppCallArgTypeNotSupported] // CHECK:STDERR: - // CHECK:STDERR: min_prelude/parts/int.carbon:10:1: error: semantics TODO: `interop with non-identifier package name` [SemanticsTodo] - // CHECK:STDERR: class Int(N: IntLiteral) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: min_prelude/parts/int.carbon:10:1-26: error: semantics TODO: `interop with non-identifier package name` [SemanticsTodo] // CHECK:STDERR: Cpp.foo(x); } @@ -93,9 +85,7 @@ import Cpp library "int_param.h"; // This doesn't fit as an embedded `IntId` value. fn F(x: i8388608) { - // CHECK:STDERR: fail_very_large_int.carbon:[[@LINE+4]]:11: error: call argument of type `i8388608` is not supported [CppCallArgTypeNotSupported] - // CHECK:STDERR: Cpp.foo(x); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_very_large_int.carbon:[[@LINE+2]]:11: error: call argument of type `i8388608` is not supported [CppCallArgTypeNotSupported] // CHECK:STDERR: Cpp.foo(x); } diff --git a/toolchain/check/testdata/interop/cpp/function/import/pointer.carbon b/toolchain/check/testdata/interop/cpp/function/import/pointer.carbon index 61251e86d3ff..626002955e13 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/pointer.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/pointer.carbon @@ -43,13 +43,10 @@ fn G() -> const Cpp.NonNullableParamS; fn F() { var s: const Cpp.NonNullableParamS = G(); - // CHECK:STDERR: fail_import_non_nullable_pointer_param_using_const_value.carbon:[[@LINE+8]]:32: error: no matching function for call to 'non_nullable_param_foo' [CppInteropParseError] - // CHECK:STDERR: 18 | Cpp.non_nullable_param_foo(&s); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_import_non_nullable_pointer_param_using_const_value.carbon:[[@LINE-9]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./non_nullable_pointer_param.h:4:6: note: candidate function not viable: 1st argument ('const NonNullableParamS * _Nonnull') would lose const qualifier [CppInteropParseNote] - // CHECK:STDERR: 4 | auto non_nullable_param_foo(NonNullableParamS* _Nonnull) -> void; - // CHECK:STDERR: | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_non_nullable_pointer_param_using_const_value.carbon:[[@LINE+5]]:3-28: error: no matching function for call to 'non_nullable_param_foo' [CppInteropParseError] + // CHECK:STDERR: included from: fail_import_non_nullable_pointer_param_using_const_value.carbon:[[@LINE-7]]:10 [InCppInclude] + // CHECK:STDERR: ./non_nullable_pointer_param.h:4:6: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: ./non_nullable_pointer_param.h:4:29-55: note: 1st argument ('const NonNullableParamS * _Nonnull') would lose const qualifier [CppInteropParseNoteReason] // CHECK:STDERR: Cpp.non_nullable_param_foo(&s); } @@ -417,12 +414,8 @@ import Cpp library "deduced_pointer_param.h"; fn F() { // This could return a null pointer, so should not be given the type `Cpp.DeducedPointerS*`. - // CHECK:STDERR: fail_import_deduced_pointer_param_as_optional_pointer.carbon:[[@LINE+7]]:40: error: cannot implicitly convert expression of type `Core.Optional(Cpp.DeducedPointerS* as Core.OptionalStorage)` to `Cpp.DeducedPointerS*` [ConversionFailure] - // CHECK:STDERR: let unused a: Cpp.DeducedPointerS* = Cpp.Indirect({} as Cpp.DeducedPointerS); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_deduced_pointer_param_as_optional_pointer.carbon:[[@LINE+4]]:40: note: type `Core.Optional(Cpp.DeducedPointerS* as Core.OptionalStorage)` does not implement interface `Core.ImplicitAs(Cpp.DeducedPointerS*)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let unused a: Cpp.DeducedPointerS* = Cpp.Indirect({} as Cpp.DeducedPointerS); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_deduced_pointer_param_as_optional_pointer.carbon:[[@LINE+3]]:40-78: error: cannot implicitly convert expression of type `Core.Optional(Cpp.DeducedPointerS* as Core.OptionalStorage)` to `Cpp.DeducedPointerS*` [ConversionFailure] + // CHECK:STDERR: fail_import_deduced_pointer_param_as_optional_pointer.carbon:[[@LINE+2]]:40-78: note: type `Core.Optional(Cpp.DeducedPointerS* as Core.OptionalStorage)` does not implement interface `Core.ImplicitAs(Cpp.DeducedPointerS*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused a: Cpp.DeducedPointerS* = Cpp.Indirect({} as Cpp.DeducedPointerS); } diff --git a/toolchain/check/testdata/interop/cpp/function/import/reference.carbon b/toolchain/check/testdata/interop/cpp/function/import/reference.carbon index 44b3f04e5efe..49e52c92fef5 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/reference.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/reference.carbon @@ -44,45 +44,33 @@ fn F() { //@dump-sem-ir-begin var v: Cpp.S; let s: Cpp.S = v; - // CHECK:STDERR: fail_param_lvalue_ref.carbon:[[@LINE+8]]:20: error: no matching function for call to 'TakesLValue' [CppInteropParseError] - // CHECK:STDERR: 18 | Cpp.TakesLValue(s); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_param_lvalue_ref.carbon:[[@LINE-9]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./param_lvalue_ref.h:5:6: note: candidate function not viable: 1st argument ('const S') would lose const qualifier [CppInteropParseNote] - // CHECK:STDERR: 5 | auto TakesLValue(S&) -> void; - // CHECK:STDERR: | ^ ~~ + // CHECK:STDERR: fail_param_lvalue_ref.carbon:[[@LINE+5]]:3-17: error: no matching function for call to 'TakesLValue' [CppInteropParseError] + // CHECK:STDERR: included from: fail_param_lvalue_ref.carbon:[[@LINE-7]]:10 [InCppInclude] + // CHECK:STDERR: ./param_lvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: ./param_lvalue_ref.h:5:18-19: note: 1st argument ('const S') would lose const qualifier [CppInteropParseNoteReason] // CHECK:STDERR: Cpp.TakesLValue(s); - // CHECK:STDERR: fail_param_lvalue_ref.carbon:[[@LINE+8]]:35: error: no matching function for call to 'TakesLValue' [CppInteropParseError] - // CHECK:STDERR: 28 | Cpp.TakesLValue(s as const Cpp.S); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_param_lvalue_ref.carbon:[[@LINE-19]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./param_lvalue_ref.h:5:6: note: candidate function not viable: 1st argument ('const S') would lose const qualifier [CppInteropParseNote] - // CHECK:STDERR: 5 | auto TakesLValue(S&) -> void; - // CHECK:STDERR: | ^ ~~ + // CHECK:STDERR: fail_param_lvalue_ref.carbon:[[@LINE+5]]:3-17: error: no matching function for call to 'TakesLValue' [CppInteropParseError] + // CHECK:STDERR: included from: fail_param_lvalue_ref.carbon:[[@LINE-14]]:10 [InCppInclude] + // CHECK:STDERR: ./param_lvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: ./param_lvalue_ref.h:5:18-19: note: 1st argument ('const S') would lose const qualifier [CppInteropParseNoteReason] // CHECK:STDERR: Cpp.TakesLValue(s as const Cpp.S); var t: Cpp.T; - // CHECK:STDERR: fail_param_lvalue_ref.carbon:[[@LINE+8]]:20: error: no matching function for call to 'TakesLValue' [CppInteropParseError] - // CHECK:STDERR: 39 | Cpp.TakesLValue(t); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_param_lvalue_ref.carbon:[[@LINE-30]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./param_lvalue_ref.h:5:6: note: candidate function not viable: no known conversion from 'T' to 'S &' for 1st argument [CppInteropParseNote] - // CHECK:STDERR: 5 | auto TakesLValue(S&) -> void; - // CHECK:STDERR: | ^ ~~ + // CHECK:STDERR: fail_param_lvalue_ref.carbon:[[@LINE+5]]:3-17: error: no matching function for call to 'TakesLValue' [CppInteropParseError] + // CHECK:STDERR: included from: fail_param_lvalue_ref.carbon:[[@LINE-22]]:10 [InCppInclude] + // CHECK:STDERR: ./param_lvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: ./param_lvalue_ref.h:5:18-19: note: no known conversion from 'T' to 'S &' for 1st argument [CppInteropParseNoteReason] // CHECK:STDERR: Cpp.TakesLValue(t); var u: Cpp.S; - // CHECK:STDERR: fail_param_lvalue_ref.carbon:[[@LINE+8]]:35: error: no matching function for call to 'TakesLValue' [CppInteropParseError] - // CHECK:STDERR: 50 | Cpp.TakesLValue(u as const Cpp.S); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_param_lvalue_ref.carbon:[[@LINE-41]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./param_lvalue_ref.h:5:6: note: candidate function not viable: 1st argument ('const S') would lose const qualifier [CppInteropParseNote] - // CHECK:STDERR: 5 | auto TakesLValue(S&) -> void; - // CHECK:STDERR: | ^ ~~ + // CHECK:STDERR: fail_param_lvalue_ref.carbon:[[@LINE+5]]:3-17: error: no matching function for call to 'TakesLValue' [CppInteropParseError] + // CHECK:STDERR: included from: fail_param_lvalue_ref.carbon:[[@LINE-30]]:10 [InCppInclude] + // CHECK:STDERR: ./param_lvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: ./param_lvalue_ref.h:5:18-19: note: 1st argument ('const S') would lose const qualifier [CppInteropParseNoteReason] // CHECK:STDERR: Cpp.TakesLValue(u as const Cpp.S); //@dump-sem-ir-end @@ -135,13 +123,10 @@ import Cpp library "param_rvalue_ref.h"; fn F() { let s: Cpp.S = {}; - // CHECK:STDERR: fail_param_value_arg_for_rvalue_ref.carbon:[[@LINE+8]]:20: error: no matching function for call to 'TakesRValue' [CppInteropParseError] - // CHECK:STDERR: 16 | Cpp.TakesRValue(s); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_param_value_arg_for_rvalue_ref.carbon:[[@LINE-7]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./param_rvalue_ref.h:5:6: note: candidate function not viable: 1st argument ('const S') would lose const qualifier [CppInteropParseNote] - // CHECK:STDERR: 5 | auto TakesRValue(S&&) -> void; - // CHECK:STDERR: | ^ ~~~ + // CHECK:STDERR: fail_param_value_arg_for_rvalue_ref.carbon:[[@LINE+5]]:3-17: error: no matching function for call to 'TakesRValue' [CppInteropParseError] + // CHECK:STDERR: included from: fail_param_value_arg_for_rvalue_ref.carbon:[[@LINE-5]]:10 [InCppInclude] + // CHECK:STDERR: ./param_rvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: ./param_rvalue_ref.h:5:18-20: note: 1st argument ('const S') would lose const qualifier [CppInteropParseNoteReason] // CHECK:STDERR: Cpp.TakesRValue(s); } @@ -155,34 +140,25 @@ import Cpp library "param_rvalue_ref.h"; fn F() { //@dump-sem-ir-begin var s: Cpp.S; - // CHECK:STDERR: fail_param_rvalue_ref.carbon:[[@LINE+8]]:20: error: no matching function for call to 'TakesRValue' [CppInteropParseError] - // CHECK:STDERR: 17 | Cpp.TakesRValue(s); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_param_rvalue_ref.carbon:[[@LINE-8]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./param_rvalue_ref.h:5:6: note: candidate function not viable: expects an rvalue for 1st argument [CppInteropParseNote] - // CHECK:STDERR: 5 | auto TakesRValue(S&&) -> void; - // CHECK:STDERR: | ^ ~~~ + // CHECK:STDERR: fail_param_rvalue_ref.carbon:[[@LINE+5]]:3-17: error: no matching function for call to 'TakesRValue' [CppInteropParseError] + // CHECK:STDERR: included from: fail_param_rvalue_ref.carbon:[[@LINE-6]]:10 [InCppInclude] + // CHECK:STDERR: ./param_rvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: ./param_rvalue_ref.h:5:18-20: note: expects an rvalue for 1st argument [CppInteropParseNoteReason] // CHECK:STDERR: Cpp.TakesRValue(s); var t: Cpp.T; - // CHECK:STDERR: fail_param_rvalue_ref.carbon:[[@LINE+8]]:20: error: no matching function for call to 'TakesRValue' [CppInteropParseError] - // CHECK:STDERR: 28 | Cpp.TakesRValue(t); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_param_rvalue_ref.carbon:[[@LINE-19]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./param_rvalue_ref.h:5:6: note: candidate function not viable: no known conversion from 'T' to 'S' for 1st argument [CppInteropParseNote] - // CHECK:STDERR: 5 | auto TakesRValue(S&&) -> void; - // CHECK:STDERR: | ^ ~~~ + // CHECK:STDERR: fail_param_rvalue_ref.carbon:[[@LINE+5]]:3-17: error: no matching function for call to 'TakesRValue' [CppInteropParseError] + // CHECK:STDERR: included from: fail_param_rvalue_ref.carbon:[[@LINE-14]]:10 [InCppInclude] + // CHECK:STDERR: ./param_rvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: ./param_rvalue_ref.h:5:18-20: note: no known conversion from 'T' to 'S' for 1st argument [CppInteropParseNoteReason] // CHECK:STDERR: Cpp.TakesRValue(t); - // CHECK:STDERR: fail_param_rvalue_ref.carbon:[[@LINE+8]]:47: error: no matching function for call to 'TakesRValue' [CppInteropParseError] - // CHECK:STDERR: 38 | Cpp.TakesRValue(({} as Cpp.S) as const Cpp.S); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_param_rvalue_ref.carbon:[[@LINE-29]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./param_rvalue_ref.h:5:6: note: candidate function not viable: 1st argument ('const S') would lose const qualifier [CppInteropParseNote] - // CHECK:STDERR: 5 | auto TakesRValue(S&&) -> void; - // CHECK:STDERR: | ^ ~~~ + // CHECK:STDERR: fail_param_rvalue_ref.carbon:[[@LINE+5]]:3-17: error: no matching function for call to 'TakesRValue' [CppInteropParseError] + // CHECK:STDERR: included from: fail_param_rvalue_ref.carbon:[[@LINE-21]]:10 [InCppInclude] + // CHECK:STDERR: ./param_rvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: ./param_rvalue_ref.h:5:18-20: note: 1st argument ('const S') would lose const qualifier [CppInteropParseNoteReason] // CHECK:STDERR: Cpp.TakesRValue(({} as Cpp.S) as const Cpp.S); //@dump-sem-ir-end @@ -237,13 +213,10 @@ import Cpp library "param_const_lvalue_ref.h"; fn F() { var t: Cpp.T; - // CHECK:STDERR: fail_call_param_const_lvalue_ref_with_wrong_type.carbon:[[@LINE+8]]:25: error: no matching function for call to 'TakesConstLValue' [CppInteropParseError] - // CHECK:STDERR: 16 | Cpp.TakesConstLValue(t); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_call_param_const_lvalue_ref_with_wrong_type.carbon:[[@LINE-7]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./param_const_lvalue_ref.h:5:6: note: candidate function not viable: no known conversion from 'T' to 'const S' for 1st argument [CppInteropParseNote] - // CHECK:STDERR: 5 | auto TakesConstLValue(const S&) -> void; - // CHECK:STDERR: | ^ ~~~~~~~~ + // CHECK:STDERR: fail_call_param_const_lvalue_ref_with_wrong_type.carbon:[[@LINE+5]]:3-22: error: no matching function for call to 'TakesConstLValue' [CppInteropParseError] + // CHECK:STDERR: included from: fail_call_param_const_lvalue_ref_with_wrong_type.carbon:[[@LINE-5]]:10 [InCppInclude] + // CHECK:STDERR: ./param_const_lvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: ./param_const_lvalue_ref.h:5:23-30: note: no known conversion from 'T' to 'const S' for 1st argument [CppInteropParseNoteReason] // CHECK:STDERR: Cpp.TakesConstLValue(t); } @@ -296,24 +269,18 @@ import Cpp library "param_const_rvalue_ref.h"; fn F() { //@dump-sem-ir-begin var s: Cpp.S; - // CHECK:STDERR: fail_param_lvalue_ref_arg_const_rvalue_ref.carbon:[[@LINE+8]]:25: error: no matching function for call to 'TakesConstRValue' [CppInteropParseError] - // CHECK:STDERR: 17 | Cpp.TakesConstRValue(s); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_param_lvalue_ref_arg_const_rvalue_ref.carbon:[[@LINE-8]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./param_const_rvalue_ref.h:5:6: note: candidate function not viable: expects an rvalue for 1st argument [CppInteropParseNote] - // CHECK:STDERR: 5 | auto TakesConstRValue(const S&&) -> void; - // CHECK:STDERR: | ^ ~~~~~~~~~ + // CHECK:STDERR: fail_param_lvalue_ref_arg_const_rvalue_ref.carbon:[[@LINE+5]]:3-22: error: no matching function for call to 'TakesConstRValue' [CppInteropParseError] + // CHECK:STDERR: included from: fail_param_lvalue_ref_arg_const_rvalue_ref.carbon:[[@LINE-6]]:10 [InCppInclude] + // CHECK:STDERR: ./param_const_rvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: ./param_const_rvalue_ref.h:5:23-31: note: expects an rvalue for 1st argument [CppInteropParseNoteReason] // CHECK:STDERR: Cpp.TakesConstRValue(s); var t: Cpp.T; - // CHECK:STDERR: fail_param_lvalue_ref_arg_const_rvalue_ref.carbon:[[@LINE+8]]:25: error: no matching function for call to 'TakesConstRValue' [CppInteropParseError] - // CHECK:STDERR: 28 | Cpp.TakesConstRValue(t); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_param_lvalue_ref_arg_const_rvalue_ref.carbon:[[@LINE-19]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./param_const_rvalue_ref.h:5:6: note: candidate function not viable: no known conversion from 'T' to 'const S' for 1st argument [CppInteropParseNote] - // CHECK:STDERR: 5 | auto TakesConstRValue(const S&&) -> void; - // CHECK:STDERR: | ^ ~~~~~~~~~ + // CHECK:STDERR: fail_param_lvalue_ref_arg_const_rvalue_ref.carbon:[[@LINE+5]]:3-22: error: no matching function for call to 'TakesConstRValue' [CppInteropParseError] + // CHECK:STDERR: included from: fail_param_lvalue_ref_arg_const_rvalue_ref.carbon:[[@LINE-14]]:10 [InCppInclude] + // CHECK:STDERR: ./param_const_rvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: ./param_const_rvalue_ref.h:5:23-31: note: no known conversion from 'T' to 'const S' for 1st argument [CppInteropParseNoteReason] // CHECK:STDERR: Cpp.TakesConstRValue(t); //@dump-sem-ir-end @@ -392,12 +359,8 @@ library "[[@TEST_NAME]]"; import Cpp library "return_const_lvalue_ref.h"; 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let unused ref s: Cpp.S = Cpp.ReturnConstLValue(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_call_return_const_lvalue_ref_const_correctness.carbon:[[@LINE+3]]:29-51: error: cannot implicitly convert expression of type `const Cpp.S` to `Cpp.S` [ConversionFailure] + // CHECK:STDERR: fail_call_return_const_lvalue_ref_const_correctness.carbon:[[@LINE+2]]:29-51: note: type `const Cpp.S` does not implement interface `Core.ImplicitAs(Cpp.S)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused ref s: Cpp.S = Cpp.ReturnConstLValue(); } @@ -471,12 +434,8 @@ template void TakeAnything_ExpectConstLRef_ByRef(T&&) { '''; fn PassConstRef(ref x: const XByRef) { - // CHECK:STDERR: fail_todo_forwarding_reference_by_ref.carbon:[[@LINE+7]]:42: error: `ref` tag is not an argument to a `ref` parameter [RefTagNoRefParam] - // CHECK:STDERR: Cpp.TakeAnything_ExpectConstLRef_ByRef(ref x); - // CHECK:STDERR: ^~~~~ - // CHECK:STDERR: fail_todo_forwarding_reference_by_ref.carbon:[[@LINE-9]]:65: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: template void TakeAnything_ExpectConstLRef_ByRef(T&&) { - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_todo_forwarding_reference_by_ref.carbon:[[@LINE+3]]:42-46: error: `ref` tag is not an argument to a `ref` parameter [RefTagNoRefParam] + // CHECK:STDERR: fail_todo_forwarding_reference_by_ref.carbon:[[@LINE-7]]:65: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: Cpp.TakeAnything_ExpectConstLRef_ByRef(ref x); } @@ -613,17 +572,17 @@ fn PassConstRef(ref x: const XByRef) { // CHECK:STDOUT: %self.patt.a18: %pattern_type.0f5 = wrapper_binding_pattern self, %self.param_patt.63c [concrete] // CHECK:STDOUT: %S.cpp_destructor.type: type = fn_type @S.cpp_destructor [concrete] // CHECK:STDOUT: %S.cpp_destructor: %S.cpp_destructor.type = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc41 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc32 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.1: %Destroy.WithSelf.Op.type.ef016f.1 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1: type = fn_type @Destroy.WithSelf.SelfDestruct.loc41 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1: type = fn_type @Destroy.WithSelf.SelfDestruct.loc32 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.1: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1 = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.0e6: %pattern_type.5f6 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.eb3: %pattern_type.5f6 = wrapper_binding_pattern self, %self.param_patt.0e6 [concrete] // CHECK:STDOUT: %T.cpp_destructor.type: type = fn_type @T.cpp_destructor [concrete] // CHECK:STDOUT: %T.cpp_destructor: %T.cpp_destructor.type = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc30 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc24 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.2: %Destroy.WithSelf.Op.type.ef016f.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc30 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc24 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.2: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -652,14 +611,14 @@ fn PassConstRef(ref x: const XByRef) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc41 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc32 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.0f5 = ref_param_pattern [concrete = constants.%self.param_patt.63c] // CHECK:STDOUT: %self.patt: %pattern_type.0f5 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.a18] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %S = ref_param call_param0 // CHECK:STDOUT: %self: ref %S = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc30 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc24 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.5f6 = ref_param_pattern [concrete = constants.%self.param_patt.0e6] // CHECK:STDOUT: %self.patt: %pattern_type.5f6 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.eb3] // CHECK:STDOUT: } { @@ -698,28 +657,28 @@ fn PassConstRef(ref x: const XByRef) { // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %s.patt: %pattern_type.0f5 = value_binding_pattern s [concrete = constants.%s.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Cpp.ref.loc18: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %TakesLValue.ref.loc18: %TakesLValue.cpp_overload_set.type = name_ref TakesLValue, imports.%TakesLValue.cpp_overload_set.value [concrete = constants.%TakesLValue.cpp_overload_set.value] -// CHECK:STDOUT: %s.ref.loc18: %S = name_ref s, %s -// CHECK:STDOUT: %Cpp.ref.loc28_3: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %TakesLValue.ref.loc28: %TakesLValue.cpp_overload_set.type = name_ref TakesLValue, imports.%TakesLValue.cpp_overload_set.value [concrete = constants.%TakesLValue.cpp_overload_set.value] -// CHECK:STDOUT: %s.ref.loc28: %S = name_ref s, %s -// CHECK:STDOUT: %Cpp.ref.loc28_30: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %S.ref.loc28: type = name_ref S, imports.%S.decl [concrete = constants.%S] -// CHECK:STDOUT: %const.loc28: type = const_type %S.ref.loc28 [concrete = constants.%const] -// CHECK:STDOUT: %.loc28_21.1: %const = as_compatible %s.ref.loc28 -// CHECK:STDOUT: %.loc28_21.2: %const = converted %s.ref.loc28, %.loc28_21.1 +// CHECK:STDOUT: %Cpp.ref.loc15: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %TakesLValue.ref.loc15: %TakesLValue.cpp_overload_set.type = name_ref TakesLValue, imports.%TakesLValue.cpp_overload_set.value [concrete = constants.%TakesLValue.cpp_overload_set.value] +// CHECK:STDOUT: %s.ref.loc15: %S = name_ref s, %s +// CHECK:STDOUT: %Cpp.ref.loc22_3: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %TakesLValue.ref.loc22: %TakesLValue.cpp_overload_set.type = name_ref TakesLValue, imports.%TakesLValue.cpp_overload_set.value [concrete = constants.%TakesLValue.cpp_overload_set.value] +// CHECK:STDOUT: %s.ref.loc22: %S = name_ref s, %s +// CHECK:STDOUT: %Cpp.ref.loc22_30: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %S.ref.loc22: type = name_ref S, imports.%S.decl [concrete = constants.%S] +// CHECK:STDOUT: %const.loc22: type = const_type %S.ref.loc22 [concrete = constants.%const] +// CHECK:STDOUT: %.loc22_21.1: %const = as_compatible %s.ref.loc22 +// CHECK:STDOUT: %.loc22_21.2: %const = converted %s.ref.loc22, %.loc22_21.1 // CHECK:STDOUT: %t.var: ref %T.ed0 = var_storage %t.var_patt -// CHECK:STDOUT: %DefaultOrUnformed.facet.loc30: %DefaultOrUnformed.type = facet_value constants.%T.ed0, (constants.%DefaultOrUnformed.impl_witness.307) [concrete = constants.%DefaultOrUnformed.facet.d8b] -// CHECK:STDOUT: %.loc30_15.1: %DefaultOrUnformed.type = converted constants.%T.ed0, %DefaultOrUnformed.facet.loc30 [concrete = constants.%DefaultOrUnformed.facet.d8b] -// CHECK:STDOUT: %as_type.loc30: type = facet_access_type %.loc30_15.1 [concrete = constants.%T.ed0] -// CHECK:STDOUT: %.loc30_15.2: type = converted %.loc30_15.1, %as_type.loc30 [concrete = constants.%T.ed0] +// CHECK:STDOUT: %DefaultOrUnformed.facet.loc24: %DefaultOrUnformed.type = facet_value constants.%T.ed0, (constants.%DefaultOrUnformed.impl_witness.307) [concrete = constants.%DefaultOrUnformed.facet.d8b] +// CHECK:STDOUT: %.loc24_15.1: %DefaultOrUnformed.type = converted constants.%T.ed0, %DefaultOrUnformed.facet.loc24 [concrete = constants.%DefaultOrUnformed.facet.d8b] +// CHECK:STDOUT: %as_type.loc24: type = facet_access_type %.loc24_15.1 [concrete = constants.%T.ed0] +// CHECK:STDOUT: %.loc24_15.2: type = converted %.loc24_15.1, %as_type.loc24 [concrete = constants.%T.ed0] // CHECK:STDOUT: -// CHECK:STDOUT: %.loc30_3: ref %T.ed0 = splice_block %t.var {} -// CHECK:STDOUT: %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc30: init %T.ed0 to %.loc30_3 = call %T.as_type.as.DefaultOrUnformed.impl.Op.specific_fn.2() -// CHECK:STDOUT: assign %t.var, %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc30 -// CHECK:STDOUT: %.loc30_13: type = splice_block %T.ref [concrete = constants.%T.ed0] { -// CHECK:STDOUT: %Cpp.ref.loc30: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %.loc24_3: ref %T.ed0 = splice_block %t.var {} +// CHECK:STDOUT: %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc24: init %T.ed0 to %.loc24_3 = call %T.as_type.as.DefaultOrUnformed.impl.Op.specific_fn.2() +// CHECK:STDOUT: assign %t.var, %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc24 +// CHECK:STDOUT: %.loc24_13: type = splice_block %T.ref [concrete = constants.%T.ed0] { +// CHECK:STDOUT: %Cpp.ref.loc24: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %T.ref: type = name_ref T, imports.%T.decl [concrete = constants.%T.ed0] // CHECK:STDOUT: } // CHECK:STDOUT: %t: ref %T.ed0 = wrapper_binding t, %t.var @@ -727,56 +686,56 @@ fn PassConstRef(ref x: const XByRef) { // CHECK:STDOUT: %t.patt: %pattern_type.5f6 = ref_binding_pattern t [concrete = constants.%t.patt] // CHECK:STDOUT: %t.var_patt: %pattern_type.5f6 = var_pattern %t.patt [concrete = constants.%t.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Cpp.ref.loc39: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %TakesLValue.ref.loc39: %TakesLValue.cpp_overload_set.type = name_ref TakesLValue, imports.%TakesLValue.cpp_overload_set.value [concrete = constants.%TakesLValue.cpp_overload_set.value] +// CHECK:STDOUT: %Cpp.ref.loc30: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %TakesLValue.ref.loc30: %TakesLValue.cpp_overload_set.type = name_ref TakesLValue, imports.%TakesLValue.cpp_overload_set.value [concrete = constants.%TakesLValue.cpp_overload_set.value] // CHECK:STDOUT: %t.ref: ref %T.ed0 = name_ref t, %t // CHECK:STDOUT: %u.var: ref %S = var_storage %u.var_patt -// CHECK:STDOUT: %DefaultOrUnformed.facet.loc41: %DefaultOrUnformed.type = facet_value constants.%S, (constants.%DefaultOrUnformed.impl_witness.e4a) [concrete = constants.%DefaultOrUnformed.facet.cbb] -// CHECK:STDOUT: %.loc41_15.1: %DefaultOrUnformed.type = converted constants.%S, %DefaultOrUnformed.facet.loc41 [concrete = constants.%DefaultOrUnformed.facet.cbb] -// CHECK:STDOUT: %as_type.loc41: type = facet_access_type %.loc41_15.1 [concrete = constants.%S] -// CHECK:STDOUT: %.loc41_15.2: type = converted %.loc41_15.1, %as_type.loc41 [concrete = constants.%S] +// CHECK:STDOUT: %DefaultOrUnformed.facet.loc32: %DefaultOrUnformed.type = facet_value constants.%S, (constants.%DefaultOrUnformed.impl_witness.e4a) [concrete = constants.%DefaultOrUnformed.facet.cbb] +// CHECK:STDOUT: %.loc32_15.1: %DefaultOrUnformed.type = converted constants.%S, %DefaultOrUnformed.facet.loc32 [concrete = constants.%DefaultOrUnformed.facet.cbb] +// CHECK:STDOUT: %as_type.loc32: type = facet_access_type %.loc32_15.1 [concrete = constants.%S] +// CHECK:STDOUT: %.loc32_15.2: type = converted %.loc32_15.1, %as_type.loc32 [concrete = constants.%S] // CHECK:STDOUT: -// CHECK:STDOUT: %.loc41_3: ref %S = splice_block %u.var {} -// CHECK:STDOUT: %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc41: init %S to %.loc41_3 = call %T.as_type.as.DefaultOrUnformed.impl.Op.specific_fn.3() -// CHECK:STDOUT: assign %u.var, %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc41 -// CHECK:STDOUT: %.loc41_13: type = splice_block %S.ref.loc41 [concrete = constants.%S] { -// CHECK:STDOUT: %Cpp.ref.loc41: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %S.ref.loc41: type = name_ref S, imports.%S.decl [concrete = constants.%S] +// CHECK:STDOUT: %.loc32_3: ref %S = splice_block %u.var {} +// CHECK:STDOUT: %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc32: init %S to %.loc32_3 = call %T.as_type.as.DefaultOrUnformed.impl.Op.specific_fn.3() +// CHECK:STDOUT: assign %u.var, %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc32 +// CHECK:STDOUT: %.loc32_13: type = splice_block %S.ref.loc32 [concrete = constants.%S] { +// CHECK:STDOUT: %Cpp.ref.loc32: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %S.ref.loc32: type = name_ref S, imports.%S.decl [concrete = constants.%S] // CHECK:STDOUT: } // CHECK:STDOUT: %u: ref %S = wrapper_binding u, %u.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %u.patt: %pattern_type.0f5 = ref_binding_pattern u [concrete = constants.%u.patt] // CHECK:STDOUT: %u.var_patt: %pattern_type.0f5 = var_pattern %u.patt [concrete = constants.%u.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Cpp.ref.loc50_3: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %TakesLValue.ref.loc50: %TakesLValue.cpp_overload_set.type = name_ref TakesLValue, imports.%TakesLValue.cpp_overload_set.value [concrete = constants.%TakesLValue.cpp_overload_set.value] +// CHECK:STDOUT: %Cpp.ref.loc38_3: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %TakesLValue.ref.loc38: %TakesLValue.cpp_overload_set.type = name_ref TakesLValue, imports.%TakesLValue.cpp_overload_set.value [concrete = constants.%TakesLValue.cpp_overload_set.value] // CHECK:STDOUT: %u.ref: ref %S = name_ref u, %u -// CHECK:STDOUT: %Cpp.ref.loc50_30: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %S.ref.loc50: type = name_ref S, imports.%S.decl [concrete = constants.%S] -// CHECK:STDOUT: %const.loc50: type = const_type %S.ref.loc50 [concrete = constants.%const] -// CHECK:STDOUT: %.loc50_21.1: ref %const = as_compatible %u.ref -// CHECK:STDOUT: %.loc50_21.2: ref %const = converted %u.ref, %.loc50_21.1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc41: = bound_method %u.var, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc41: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc41(%u.var) -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc30: = bound_method %t.var, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc30: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc30(%t.var) +// CHECK:STDOUT: %Cpp.ref.loc38_30: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %S.ref.loc38: type = name_ref S, imports.%S.decl [concrete = constants.%S] +// CHECK:STDOUT: %const.loc38: type = const_type %S.ref.loc38 [concrete = constants.%const] +// CHECK:STDOUT: %.loc38_21.1: ref %const = as_compatible %u.ref +// CHECK:STDOUT: %.loc38_21.2: ref %const = converted %u.ref, %.loc38_21.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc32: = bound_method %u.var, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc32: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc32(%u.var) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc24: = bound_method %t.var, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc24: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc24(%t.var) // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc8: = bound_method %v.var, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc8: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc8(%v.var) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc41(%self.param: ref %S) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc32(%self.param: ref %S) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc41(%self.param: ref %S) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc32(%self.param: ref %S) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.1(%self.param) // CHECK:STDOUT: %S.cpp_destructor.call: init %empty_tuple.type = call imports.%S.cpp_destructor.decl(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc30(%self.param: ref %T.ed0) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc24(%self.param: ref %T.ed0) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc30(%self.param: ref %T.ed0) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc24(%self.param: ref %T.ed0) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.2(%self.param) // CHECK:STDOUT: %T.cpp_destructor.call: init %empty_tuple.type = call imports.%T.cpp_destructor.decl(%self.param) @@ -871,9 +830,9 @@ fn PassConstRef(ref x: const XByRef) { // CHECK:STDOUT: %self.patt.eb3: %pattern_type.5f6 = wrapper_binding_pattern self, %self.param_patt.0e6 [concrete] // CHECK:STDOUT: %T.cpp_destructor.type: type = fn_type @T.cpp_destructor [concrete] // CHECK:STDOUT: %T.cpp_destructor: %T.cpp_destructor.type = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc19 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc16 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.1: %Destroy.WithSelf.Op.type.ef016f.1 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1: type = fn_type @Destroy.WithSelf.SelfDestruct.loc19 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1: type = fn_type @Destroy.WithSelf.SelfDestruct.loc16 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.1: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1 = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.63c: %pattern_type.0f5 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.a18: %pattern_type.0f5 = wrapper_binding_pattern self, %self.param_patt.63c [concrete] @@ -910,7 +869,7 @@ fn PassConstRef(ref x: const XByRef) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc19 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc16 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.5f6 = ref_param_pattern [concrete = constants.%self.param_patt.0e6] // CHECK:STDOUT: %self.patt: %pattern_type.5f6 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.eb3] // CHECK:STDOUT: } { @@ -946,20 +905,20 @@ fn PassConstRef(ref x: const XByRef) { // CHECK:STDOUT: %s.patt: %pattern_type.0f5 = ref_binding_pattern s [concrete = constants.%s.patt] // CHECK:STDOUT: %s.var_patt: %pattern_type.0f5 = var_pattern %s.patt [concrete = constants.%s.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Cpp.ref.loc17: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %TakesRValue.ref.loc17: %TakesRValue.cpp_overload_set.type = name_ref TakesRValue, imports.%TakesRValue.cpp_overload_set.value [concrete = constants.%TakesRValue.cpp_overload_set.value] +// CHECK:STDOUT: %Cpp.ref.loc14: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %TakesRValue.ref.loc14: %TakesRValue.cpp_overload_set.type = name_ref TakesRValue, imports.%TakesRValue.cpp_overload_set.value [concrete = constants.%TakesRValue.cpp_overload_set.value] // CHECK:STDOUT: %s.ref: ref %S = name_ref s, %s // CHECK:STDOUT: %t.var: ref %T.ed0 = var_storage %t.var_patt -// CHECK:STDOUT: %DefaultOrUnformed.facet.loc19: %DefaultOrUnformed.type = facet_value constants.%T.ed0, (constants.%DefaultOrUnformed.impl_witness.307) [concrete = constants.%DefaultOrUnformed.facet.d8b] -// CHECK:STDOUT: %.loc19_15.1: %DefaultOrUnformed.type = converted constants.%T.ed0, %DefaultOrUnformed.facet.loc19 [concrete = constants.%DefaultOrUnformed.facet.d8b] -// CHECK:STDOUT: %as_type.loc19: type = facet_access_type %.loc19_15.1 [concrete = constants.%T.ed0] -// CHECK:STDOUT: %.loc19_15.2: type = converted %.loc19_15.1, %as_type.loc19 [concrete = constants.%T.ed0] +// CHECK:STDOUT: %DefaultOrUnformed.facet.loc16: %DefaultOrUnformed.type = facet_value constants.%T.ed0, (constants.%DefaultOrUnformed.impl_witness.307) [concrete = constants.%DefaultOrUnformed.facet.d8b] +// CHECK:STDOUT: %.loc16_15.1: %DefaultOrUnformed.type = converted constants.%T.ed0, %DefaultOrUnformed.facet.loc16 [concrete = constants.%DefaultOrUnformed.facet.d8b] +// CHECK:STDOUT: %as_type.loc16: type = facet_access_type %.loc16_15.1 [concrete = constants.%T.ed0] +// CHECK:STDOUT: %.loc16_15.2: type = converted %.loc16_15.1, %as_type.loc16 [concrete = constants.%T.ed0] // CHECK:STDOUT: -// CHECK:STDOUT: %.loc19_3: ref %T.ed0 = splice_block %t.var {} -// CHECK:STDOUT: %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc19: init %T.ed0 to %.loc19_3 = call %T.as_type.as.DefaultOrUnformed.impl.Op.specific_fn.2() -// CHECK:STDOUT: assign %t.var, %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc19 -// CHECK:STDOUT: %.loc19_13: type = splice_block %T.ref [concrete = constants.%T.ed0] { -// CHECK:STDOUT: %Cpp.ref.loc19: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %.loc16_3: ref %T.ed0 = splice_block %t.var {} +// CHECK:STDOUT: %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc16: init %T.ed0 to %.loc16_3 = call %T.as_type.as.DefaultOrUnformed.impl.Op.specific_fn.2() +// CHECK:STDOUT: assign %t.var, %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc16 +// CHECK:STDOUT: %.loc16_13: type = splice_block %T.ref [concrete = constants.%T.ed0] { +// CHECK:STDOUT: %Cpp.ref.loc16: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %T.ref: type = name_ref T, imports.%T.decl [concrete = constants.%T.ed0] // CHECK:STDOUT: } // CHECK:STDOUT: %t: ref %T.ed0 = wrapper_binding t, %t.var @@ -967,32 +926,32 @@ fn PassConstRef(ref x: const XByRef) { // CHECK:STDOUT: %t.patt: %pattern_type.5f6 = ref_binding_pattern t [concrete = constants.%t.patt] // CHECK:STDOUT: %t.var_patt: %pattern_type.5f6 = var_pattern %t.patt [concrete = constants.%t.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Cpp.ref.loc28: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %TakesRValue.ref.loc28: %TakesRValue.cpp_overload_set.type = name_ref TakesRValue, imports.%TakesRValue.cpp_overload_set.value [concrete = constants.%TakesRValue.cpp_overload_set.value] +// CHECK:STDOUT: %Cpp.ref.loc22: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %TakesRValue.ref.loc22: %TakesRValue.cpp_overload_set.type = name_ref TakesRValue, imports.%TakesRValue.cpp_overload_set.value [concrete = constants.%TakesRValue.cpp_overload_set.value] // CHECK:STDOUT: %t.ref: ref %T.ed0 = name_ref t, %t -// CHECK:STDOUT: %Cpp.ref.loc38_3: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %TakesRValue.ref.loc38: %TakesRValue.cpp_overload_set.type = name_ref TakesRValue, imports.%TakesRValue.cpp_overload_set.value [concrete = constants.%TakesRValue.cpp_overload_set.value] -// CHECK:STDOUT: %.loc38_21.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct.a40] -// CHECK:STDOUT: %Cpp.ref.loc38_26: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %S.ref.loc38_29: type = name_ref S, imports.%S.decl [concrete = constants.%S] -// CHECK:STDOUT: %.loc38_21.2: ref %S = temporary_storage -// CHECK:STDOUT: %.loc38_21.3: init %S to %.loc38_21.2 = class_init () [concrete = constants.%S.val] -// CHECK:STDOUT: %.loc38_23: init %S = converted %.loc38_21.1, %.loc38_21.3 [concrete = constants.%S.val] -// CHECK:STDOUT: %Cpp.ref.loc38_42: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %S.ref.loc38_45: type = name_ref S, imports.%S.decl [concrete = constants.%S] -// CHECK:STDOUT: %const: type = const_type %S.ref.loc38_45 [concrete = constants.%const] -// CHECK:STDOUT: %.loc38_33.1: init %const = as_compatible %.loc38_23 [concrete = constants.%empty_struct.674] -// CHECK:STDOUT: %.loc38_33.2: init %const = converted %.loc38_23, %.loc38_33.1 [concrete = constants.%empty_struct.674] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc19: = bound_method %t.var, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc19: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc19(%t.var) +// CHECK:STDOUT: %Cpp.ref.loc29_3: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %TakesRValue.ref.loc29: %TakesRValue.cpp_overload_set.type = name_ref TakesRValue, imports.%TakesRValue.cpp_overload_set.value [concrete = constants.%TakesRValue.cpp_overload_set.value] +// CHECK:STDOUT: %.loc29_21.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct.a40] +// CHECK:STDOUT: %Cpp.ref.loc29_26: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %S.ref.loc29_29: type = name_ref S, imports.%S.decl [concrete = constants.%S] +// CHECK:STDOUT: %.loc29_21.2: ref %S = temporary_storage +// CHECK:STDOUT: %.loc29_21.3: init %S to %.loc29_21.2 = class_init () [concrete = constants.%S.val] +// CHECK:STDOUT: %.loc29_23: init %S = converted %.loc29_21.1, %.loc29_21.3 [concrete = constants.%S.val] +// CHECK:STDOUT: %Cpp.ref.loc29_42: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %S.ref.loc29_45: type = name_ref S, imports.%S.decl [concrete = constants.%S] +// CHECK:STDOUT: %const: type = const_type %S.ref.loc29_45 [concrete = constants.%const] +// CHECK:STDOUT: %.loc29_33.1: init %const = as_compatible %.loc29_23 [concrete = constants.%empty_struct.674] +// CHECK:STDOUT: %.loc29_33.2: init %const = converted %.loc29_23, %.loc29_33.1 [concrete = constants.%empty_struct.674] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16: = bound_method %t.var, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16(%t.var) // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc8: = bound_method %s.var, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc8: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc8(%s.var) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc19(%self.param: ref %T.ed0) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc16(%self.param: ref %T.ed0) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc19(%self.param: ref %T.ed0) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc16(%self.param: ref %T.ed0) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.1(%self.param) // CHECK:STDOUT: %T.cpp_destructor.call: init %empty_tuple.type = call imports.%T.cpp_destructor.decl(%self.param) @@ -1323,9 +1282,9 @@ fn PassConstRef(ref x: const XByRef) { // CHECK:STDOUT: %self.patt.eb3: %pattern_type.5f6 = wrapper_binding_pattern self, %self.param_patt.0e6 [concrete] // CHECK:STDOUT: %T.cpp_destructor.type: type = fn_type @T.cpp_destructor [concrete] // CHECK:STDOUT: %T.cpp_destructor: %T.cpp_destructor.type = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc19 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc16 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.1: %Destroy.WithSelf.Op.type.ef016f.1 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1: type = fn_type @Destroy.WithSelf.SelfDestruct.loc19 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1: type = fn_type @Destroy.WithSelf.SelfDestruct.loc16 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.1: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1 = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.63c: %pattern_type.0f5 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.a18: %pattern_type.0f5 = wrapper_binding_pattern self, %self.param_patt.63c [concrete] @@ -1362,7 +1321,7 @@ fn PassConstRef(ref x: const XByRef) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc19 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc16 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.5f6 = ref_param_pattern [concrete = constants.%self.param_patt.0e6] // CHECK:STDOUT: %self.patt: %pattern_type.5f6 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.eb3] // CHECK:STDOUT: } { @@ -1398,20 +1357,20 @@ fn PassConstRef(ref x: const XByRef) { // CHECK:STDOUT: %s.patt: %pattern_type.0f5 = ref_binding_pattern s [concrete = constants.%s.patt] // CHECK:STDOUT: %s.var_patt: %pattern_type.0f5 = var_pattern %s.patt [concrete = constants.%s.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Cpp.ref.loc17: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %TakesConstRValue.ref.loc17: %TakesConstRValue.cpp_overload_set.type = name_ref TakesConstRValue, imports.%TakesConstRValue.cpp_overload_set.value [concrete = constants.%TakesConstRValue.cpp_overload_set.value] +// CHECK:STDOUT: %Cpp.ref.loc14: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %TakesConstRValue.ref.loc14: %TakesConstRValue.cpp_overload_set.type = name_ref TakesConstRValue, imports.%TakesConstRValue.cpp_overload_set.value [concrete = constants.%TakesConstRValue.cpp_overload_set.value] // CHECK:STDOUT: %s.ref: ref %S = name_ref s, %s // CHECK:STDOUT: %t.var: ref %T.ed0 = var_storage %t.var_patt -// CHECK:STDOUT: %DefaultOrUnformed.facet.loc19: %DefaultOrUnformed.type = facet_value constants.%T.ed0, (constants.%DefaultOrUnformed.impl_witness.307) [concrete = constants.%DefaultOrUnformed.facet.d8b] -// CHECK:STDOUT: %.loc19_15.1: %DefaultOrUnformed.type = converted constants.%T.ed0, %DefaultOrUnformed.facet.loc19 [concrete = constants.%DefaultOrUnformed.facet.d8b] -// CHECK:STDOUT: %as_type.loc19: type = facet_access_type %.loc19_15.1 [concrete = constants.%T.ed0] -// CHECK:STDOUT: %.loc19_15.2: type = converted %.loc19_15.1, %as_type.loc19 [concrete = constants.%T.ed0] +// CHECK:STDOUT: %DefaultOrUnformed.facet.loc16: %DefaultOrUnformed.type = facet_value constants.%T.ed0, (constants.%DefaultOrUnformed.impl_witness.307) [concrete = constants.%DefaultOrUnformed.facet.d8b] +// CHECK:STDOUT: %.loc16_15.1: %DefaultOrUnformed.type = converted constants.%T.ed0, %DefaultOrUnformed.facet.loc16 [concrete = constants.%DefaultOrUnformed.facet.d8b] +// CHECK:STDOUT: %as_type.loc16: type = facet_access_type %.loc16_15.1 [concrete = constants.%T.ed0] +// CHECK:STDOUT: %.loc16_15.2: type = converted %.loc16_15.1, %as_type.loc16 [concrete = constants.%T.ed0] // CHECK:STDOUT: -// CHECK:STDOUT: %.loc19_3: ref %T.ed0 = splice_block %t.var {} -// CHECK:STDOUT: %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc19: init %T.ed0 to %.loc19_3 = call %T.as_type.as.DefaultOrUnformed.impl.Op.specific_fn.2() -// CHECK:STDOUT: assign %t.var, %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc19 -// CHECK:STDOUT: %.loc19_13: type = splice_block %T.ref [concrete = constants.%T.ed0] { -// CHECK:STDOUT: %Cpp.ref.loc19: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %.loc16_3: ref %T.ed0 = splice_block %t.var {} +// CHECK:STDOUT: %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc16: init %T.ed0 to %.loc16_3 = call %T.as_type.as.DefaultOrUnformed.impl.Op.specific_fn.2() +// CHECK:STDOUT: assign %t.var, %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc16 +// CHECK:STDOUT: %.loc16_13: type = splice_block %T.ref [concrete = constants.%T.ed0] { +// CHECK:STDOUT: %Cpp.ref.loc16: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %T.ref: type = name_ref T, imports.%T.decl [concrete = constants.%T.ed0] // CHECK:STDOUT: } // CHECK:STDOUT: %t: ref %T.ed0 = wrapper_binding t, %t.var @@ -1419,19 +1378,19 @@ fn PassConstRef(ref x: const XByRef) { // CHECK:STDOUT: %t.patt: %pattern_type.5f6 = ref_binding_pattern t [concrete = constants.%t.patt] // CHECK:STDOUT: %t.var_patt: %pattern_type.5f6 = var_pattern %t.patt [concrete = constants.%t.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Cpp.ref.loc28: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %TakesConstRValue.ref.loc28: %TakesConstRValue.cpp_overload_set.type = name_ref TakesConstRValue, imports.%TakesConstRValue.cpp_overload_set.value [concrete = constants.%TakesConstRValue.cpp_overload_set.value] +// CHECK:STDOUT: %Cpp.ref.loc22: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %TakesConstRValue.ref.loc22: %TakesConstRValue.cpp_overload_set.type = name_ref TakesConstRValue, imports.%TakesConstRValue.cpp_overload_set.value [concrete = constants.%TakesConstRValue.cpp_overload_set.value] // CHECK:STDOUT: %t.ref: ref %T.ed0 = name_ref t, %t -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc19: = bound_method %t.var, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc19: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc19(%t.var) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc16: = bound_method %t.var, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc16: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc16(%t.var) // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc8: = bound_method %s.var, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc8: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc8(%s.var) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc19(%self.param: ref %T.ed0) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc16(%self.param: ref %T.ed0) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc19(%self.param: ref %T.ed0) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc16(%self.param: ref %T.ed0) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.1(%self.param) // CHECK:STDOUT: %T.cpp_destructor.call: init %empty_tuple.type = call imports.%T.cpp_destructor.decl(%self.param) diff --git a/toolchain/check/testdata/interop/cpp/function/import/return.carbon b/toolchain/check/testdata/interop/cpp/function/import/return.carbon index fb7d4b125700..e8e7d6118951 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/return.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/return.carbon @@ -48,9 +48,7 @@ auto UndeducedReturn(); '''; fn Call() { - // CHECK:STDERR: fail_return_undeduced_auto.carbon:[[@LINE+4]]:3: error: semantics TODO: `Unsupported: return type: auto` [SemanticsTodo] - // CHECK:STDERR: Cpp.UndeducedReturn(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_return_undeduced_auto.carbon:[[@LINE+2]]:3-23: error: semantics TODO: `Unsupported: return type: auto` [SemanticsTodo] // CHECK:STDERR: Cpp.UndeducedReturn(); } diff --git a/toolchain/check/testdata/interop/cpp/function/import/struct.carbon b/toolchain/check/testdata/interop/cpp/function/import/struct.carbon index e1407fe1a208..30f80ff7b39d 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/struct.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/struct.carbon @@ -25,57 +25,29 @@ auto foo2(ForwardDeclaredStruct) -> void; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+8]]:10: in file included here [InCppInclude] -// CHECK:STDERR: ./decl_value_param_type.h:4:6: error: argument type 'ForwardDeclaredStruct' is incomplete [CppInteropParseError] -// CHECK:STDERR: 4 | auto foo1(ForwardDeclaredStruct) -> void; -// CHECK:STDERR: | ^~~~ -// CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+4]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE+3]]:10 [InCppInclude] +// CHECK:STDERR: ./decl_value_param_type.h:4:6-9: error: argument type 'ForwardDeclaredStruct' is incomplete [CppInteropParseError] // CHECK:STDERR: ./decl_value_param_type.h:2:8: note: forward declaration of 'ForwardDeclaredStruct' [CppInteropParseNote] -// CHECK:STDERR: 2 | struct ForwardDeclaredStruct; -// CHECK:STDERR: | ^ import Cpp library "decl_value_param_type.h"; fn F(p: Cpp.ForwardDeclaredStruct*) { - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+12]]:3: note: in thunk for C++ function used here [InCppThunk] - // CHECK:STDERR: Cpp.foo1(*p); - // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+5]]:3-14: note: in thunk for C++ function used here [InCppThunk] // CHECK:STDERR: - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE-7]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./decl_value_param_type.h:5:6: error: argument type 'ForwardDeclaredStruct' is incomplete [CppInteropParseError] - // CHECK:STDERR: 5 | auto foo2(ForwardDeclaredStruct) -> void; - // CHECK:STDERR: | ^~~~ - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE-11]]:10: in file included here [InCppInclude] + // CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE-5]]:10 [InCppInclude] + // CHECK:STDERR: ./decl_value_param_type.h:5:6-9: error: argument type 'ForwardDeclaredStruct' is incomplete [CppInteropParseError] // CHECK:STDERR: ./decl_value_param_type.h:2:8: note: forward declaration of 'ForwardDeclaredStruct' [CppInteropParseNote] - // CHECK:STDERR: 2 | struct ForwardDeclaredStruct; - // CHECK:STDERR: | ^ Cpp.foo1(*p); - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+28]]:3: note: in thunk for C++ function used here [InCppThunk] - // CHECK:STDERR: Cpp.foo2(*p); - // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+12]]:3-14: note: in thunk for C++ function used here [InCppThunk] // CHECK:STDERR: - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE-5]]:12: error: forming value of incomplete type `Cpp.ForwardDeclaredStruct` [IncompleteTypeInValueConversion] - // CHECK:STDERR: Cpp.foo1(*p); - // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE-23]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE-3]]:12-13: error: forming value of incomplete type `Cpp.ForwardDeclaredStruct` [IncompleteTypeInValueConversion] + // CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE-12]]:10 [InCppInclude] // CHECK:STDERR: ./decl_value_param_type.h:2:8: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: struct ForwardDeclaredStruct; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE-27]]:10: in file included here [InCppInclude] // CHECK:STDERR: ./decl_value_param_type.h:4:32: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto foo1(ForwardDeclaredStruct) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+12]]:12: error: forming value of incomplete type `Cpp.ForwardDeclaredStruct` [IncompleteTypeInValueConversion] - // CHECK:STDERR: Cpp.foo2(*p); - // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE-35]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+5]]:12-13: error: forming value of incomplete type `Cpp.ForwardDeclaredStruct` [IncompleteTypeInValueConversion] + // CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE-17]]:10 [InCppInclude] // CHECK:STDERR: ./decl_value_param_type.h:2:8: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: struct ForwardDeclaredStruct; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE-39]]:10: in file included here [InCppInclude] // CHECK:STDERR: ./decl_value_param_type.h:5:32: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto foo2(ForwardDeclaredStruct) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.foo2(*p); } @@ -118,25 +90,15 @@ auto foo_non_copyable(NonCopyableStruct) -> void; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_non_copyable_param_type.carbon:[[@LINE+12]]:10: in file included here [InCppInclude] -// CHECK:STDERR: ./non_copyable_param_type.h:6:6: error: call to deleted constructor of 'NonCopyableStruct' [CppInteropParseError] -// CHECK:STDERR: 6 | auto foo_non_copyable(NonCopyableStruct) -> void; -// CHECK:STDERR: | ^~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_import_non_copyable_param_type.carbon:[[@LINE+8]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_import_non_copyable_param_type.carbon:[[@LINE+4]]:10 [InCppInclude] +// CHECK:STDERR: ./non_copyable_param_type.h:6:6-21: error: call to deleted constructor of 'NonCopyableStruct' [CppInteropParseError] // CHECK:STDERR: ./non_copyable_param_type.h:3:3: note: 'NonCopyableStruct' has been explicitly marked deleted here [CppInteropParseNote] -// CHECK:STDERR: 3 | NonCopyableStruct(const NonCopyableStruct&) = delete; -// CHECK:STDERR: | ^ -// CHECK:STDERR: fail_import_non_copyable_param_type.carbon:[[@LINE+4]]:10: in file included here [InCppInclude] // CHECK:STDERR: ./non_copyable_param_type.h:6:40: note: passing argument to parameter here [CppInteropParseNote] -// CHECK:STDERR: 6 | auto foo_non_copyable(NonCopyableStruct) -> void; -// CHECK:STDERR: | ^ import Cpp library "non_copyable_param_type.h"; fn F(s: Cpp.NonCopyableStruct) { //@dump-sem-ir-begin - // CHECK:STDERR: fail_import_non_copyable_param_type.carbon:[[@LINE+4]]:3: note: in thunk for C++ function used here [InCppThunk] - // CHECK:STDERR: Cpp.foo_non_copyable(s); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_non_copyable_param_type.carbon:[[@LINE+2]]:3-25: note: in thunk for C++ function used here [InCppThunk] // CHECK:STDERR: Cpp.foo_non_copyable(s); //@dump-sem-ir-end @@ -321,13 +283,9 @@ library "[[@TEST_NAME]]"; import Cpp library "incomplete.h"; fn F() { - // CHECK:STDERR: fail_import_incomplete.carbon:[[@LINE+8]]:3: error: member access into incomplete class `Cpp.IncompleteStruct` [QualifiedExprInIncompleteClassScope] - // CHECK:STDERR: Cpp.IncompleteStruct.foo(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_incomplete.carbon:[[@LINE-6]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_incomplete.carbon:[[@LINE+4]]:3-26: error: member access into incomplete class `Cpp.IncompleteStruct` [QualifiedExprInIncompleteClassScope] + // CHECK:STDERR: included from: fail_import_incomplete.carbon:[[@LINE-4]]:10 [InCppInclude] // CHECK:STDERR: ./incomplete.h:2:8: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: struct IncompleteStruct; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.IncompleteStruct.foo(); } @@ -391,36 +349,19 @@ auto foo_decl_value_return() -> DeclValueReturnStruct; library "[[@TEST_NAME]]"; // TODO: We should only produce one error here. -// CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+12]]:10: in file included here [InCppInclude] -// CHECK:STDERR: ./decl_value_return_type.h:4:6: error: calling 'foo_decl_value_return' with incomplete return type 'DeclValueReturnStruct' [CppInteropParseError] -// CHECK:STDERR: 4 | auto foo_decl_value_return() -> DeclValueReturnStruct; -// CHECK:STDERR: | ^~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+8]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_import_decl_value_return_type.carbon:[[@LINE+4]]:10 [InCppInclude] +// CHECK:STDERR: ./decl_value_return_type.h:4:6-26: error: calling 'foo_decl_value_return' with incomplete return type 'DeclValueReturnStruct' [CppInteropParseError] // CHECK:STDERR: ./decl_value_return_type.h:4:6: note: 'foo_decl_value_return' declared here [CppInteropParseNote] -// CHECK:STDERR: 4 | auto foo_decl_value_return() -> DeclValueReturnStruct; -// CHECK:STDERR: | ^ -// CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+4]]:10: in file included here [InCppInclude] // CHECK:STDERR: ./decl_value_return_type.h:2:8: note: forward declaration of 'DeclValueReturnStruct' [CppInteropParseNote] -// CHECK:STDERR: 2 | struct DeclValueReturnStruct; -// CHECK:STDERR: | ^ import Cpp library "decl_value_return_type.h"; fn F() { - // CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+16]]:3: note: in thunk for C++ function used here [InCppThunk] - // CHECK:STDERR: Cpp.foo_decl_value_return(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+7]]:3-29: note: in thunk for C++ function used here [InCppThunk] // CHECK:STDERR: - // CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+12]]:3: error: function returns incomplete type `Cpp.DeclValueReturnStruct` [IncompleteTypeInFunctionReturnType] - // CHECK:STDERR: Cpp.foo_decl_value_return(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE-10]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+5]]:3-29: error: function returns incomplete type `Cpp.DeclValueReturnStruct` [IncompleteTypeInFunctionReturnType] + // CHECK:STDERR: included from: fail_import_decl_value_return_type.carbon:[[@LINE-6]]:10 [InCppInclude] // CHECK:STDERR: ./decl_value_return_type.h:2:8: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: struct DeclValueReturnStruct; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE-14]]:10: in file included here [InCppInclude] // CHECK:STDERR: ./decl_value_return_type.h:4:33: note: return type declared here [IncompleteReturnTypeHere] - // CHECK:STDERR: auto foo_decl_value_return() -> DeclValueReturnStruct; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.foo_decl_value_return(); } @@ -559,7 +500,7 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%s.param: %NonCopyableStruct) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Cpp.ref.loc24: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Cpp.ref.loc14: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %foo_non_copyable.ref: %foo_non_copyable.cpp_overload_set.type = name_ref foo_non_copyable, imports.%foo_non_copyable.cpp_overload_set.value [concrete = constants.%foo_non_copyable.cpp_overload_set.value] // CHECK:STDOUT: %s.ref: %NonCopyableStruct = name_ref s, %s // CHECK:STDOUT: %foo_non_copyable.call: init %empty_tuple.type = call imports.%foo_non_copyable.decl(%s.ref) diff --git a/toolchain/check/testdata/interop/cpp/function/import/template.carbon b/toolchain/check/testdata/interop/cpp/function/import/template.carbon index ecdd2c68a34d..7b6b429277e9 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/template.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/template.carbon @@ -87,12 +87,9 @@ template void fn_arg_not_template_arg_f(); fn Call() { // We treat this as a function argument, even though that makes the call fail. - // CHECK:STDERR: fail_function_arg_not_template_arg.carbon:[[@LINE+7]]:34: error: no matching function for call to 'fn_arg_not_template_arg_f' [CppInteropParseError] - // CHECK:STDERR: 17 | Cpp.fn_arg_not_template_arg_f(1); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_function_arg_not_template_arg.carbon:[[@LINE-8]]:22: note: candidate function template not viable: requires 0 arguments, but 1 was provided [CppInteropParseNote] - // CHECK:STDERR: 5 | template void fn_arg_not_template_arg_f(); - // CHECK:STDERR: | ^ + // CHECK:STDERR: fail_function_arg_not_template_arg.carbon:[[@LINE+4]]:3-31: error: no matching function for call to 'fn_arg_not_template_arg_f' [CppInteropParseError] + // CHECK:STDERR: fail_function_arg_not_template_arg.carbon:[[@LINE-6]]:22: note: candidate function template not viable [CppInteropParseNote] + // CHECK:STDERR: fail_function_arg_not_template_arg.carbon:[[@LINE-7]]:47-48: note: requires 0 arguments, but 1 was provided [CppInteropParseNoteReason] // CHECK:STDERR: Cpp.fn_arg_not_template_arg_f(1); } diff --git a/toolchain/check/testdata/interop/cpp/function/import/union.carbon b/toolchain/check/testdata/interop/cpp/function/import/union.carbon index 5f85c8030334..6fd3060a679e 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/union.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/union.carbon @@ -25,57 +25,29 @@ auto foo2(ForwardDeclaredUnion) -> void; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+8]]:10: in file included here [InCppInclude] -// CHECK:STDERR: ./decl_value_param_type.h:4:6: error: argument type 'ForwardDeclaredUnion' is incomplete [CppInteropParseError] -// CHECK:STDERR: 4 | auto foo1(ForwardDeclaredUnion) -> void; -// CHECK:STDERR: | ^~~~ -// CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+4]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE+3]]:10 [InCppInclude] +// CHECK:STDERR: ./decl_value_param_type.h:4:6-9: error: argument type 'ForwardDeclaredUnion' is incomplete [CppInteropParseError] // CHECK:STDERR: ./decl_value_param_type.h:2:7: note: forward declaration of 'ForwardDeclaredUnion' [CppInteropParseNote] -// CHECK:STDERR: 2 | union ForwardDeclaredUnion; -// CHECK:STDERR: | ^ import Cpp library "decl_value_param_type.h"; fn F(p: Cpp.ForwardDeclaredUnion*) { - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+12]]:3: note: in thunk for C++ function used here [InCppThunk] - // CHECK:STDERR: Cpp.foo1(*p); - // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+5]]:3-14: note: in thunk for C++ function used here [InCppThunk] // CHECK:STDERR: - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE-7]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./decl_value_param_type.h:5:6: error: argument type 'ForwardDeclaredUnion' is incomplete [CppInteropParseError] - // CHECK:STDERR: 5 | auto foo2(ForwardDeclaredUnion) -> void; - // CHECK:STDERR: | ^~~~ - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE-11]]:10: in file included here [InCppInclude] + // CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE-5]]:10 [InCppInclude] + // CHECK:STDERR: ./decl_value_param_type.h:5:6-9: error: argument type 'ForwardDeclaredUnion' is incomplete [CppInteropParseError] // CHECK:STDERR: ./decl_value_param_type.h:2:7: note: forward declaration of 'ForwardDeclaredUnion' [CppInteropParseNote] - // CHECK:STDERR: 2 | union ForwardDeclaredUnion; - // CHECK:STDERR: | ^ Cpp.foo1(*p); - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+28]]:3: note: in thunk for C++ function used here [InCppThunk] - // CHECK:STDERR: Cpp.foo2(*p); - // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+12]]:3-14: note: in thunk for C++ function used here [InCppThunk] // CHECK:STDERR: - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE-5]]:12: error: forming value of incomplete type `Cpp.ForwardDeclaredUnion` [IncompleteTypeInValueConversion] - // CHECK:STDERR: Cpp.foo1(*p); - // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE-23]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE-3]]:12-13: error: forming value of incomplete type `Cpp.ForwardDeclaredUnion` [IncompleteTypeInValueConversion] + // CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE-12]]:10 [InCppInclude] // CHECK:STDERR: ./decl_value_param_type.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: union ForwardDeclaredUnion; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE-27]]:10: in file included here [InCppInclude] // CHECK:STDERR: ./decl_value_param_type.h:4:31: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto foo1(ForwardDeclaredUnion) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+12]]:12: error: forming value of incomplete type `Cpp.ForwardDeclaredUnion` [IncompleteTypeInValueConversion] - // CHECK:STDERR: Cpp.foo2(*p); - // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE-35]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+5]]:12-13: error: forming value of incomplete type `Cpp.ForwardDeclaredUnion` [IncompleteTypeInValueConversion] + // CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE-17]]:10 [InCppInclude] // CHECK:STDERR: ./decl_value_param_type.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: union ForwardDeclaredUnion; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE-39]]:10: in file included here [InCppInclude] // CHECK:STDERR: ./decl_value_param_type.h:5:31: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto foo2(ForwardDeclaredUnion) -> void; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.foo2(*p); } @@ -282,13 +254,9 @@ library "[[@TEST_NAME]]"; import Cpp library "incomplete.h"; fn F() { - // CHECK:STDERR: fail_import_incomplete.carbon:[[@LINE+8]]:3: error: member access into incomplete class `Cpp.IncompleteUnion` [QualifiedExprInIncompleteClassScope] - // CHECK:STDERR: Cpp.IncompleteUnion.foo(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_incomplete.carbon:[[@LINE-6]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_incomplete.carbon:[[@LINE+4]]:3-25: error: member access into incomplete class `Cpp.IncompleteUnion` [QualifiedExprInIncompleteClassScope] + // CHECK:STDERR: included from: fail_import_incomplete.carbon:[[@LINE-4]]:10 [InCppInclude] // CHECK:STDERR: ./incomplete.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: union IncompleteUnion; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.IncompleteUnion.foo(); } @@ -351,36 +319,19 @@ auto foo_decl_value_return() -> DeclValueReturnUnion; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+12]]:10: in file included here [InCppInclude] -// CHECK:STDERR: ./decl_value_return_type.h:4:6: error: calling 'foo_decl_value_return' with incomplete return type 'DeclValueReturnUnion' [CppInteropParseError] -// CHECK:STDERR: 4 | auto foo_decl_value_return() -> DeclValueReturnUnion; -// CHECK:STDERR: | ^~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+8]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_import_decl_value_return_type.carbon:[[@LINE+4]]:10 [InCppInclude] +// CHECK:STDERR: ./decl_value_return_type.h:4:6-26: error: calling 'foo_decl_value_return' with incomplete return type 'DeclValueReturnUnion' [CppInteropParseError] // CHECK:STDERR: ./decl_value_return_type.h:4:6: note: 'foo_decl_value_return' declared here [CppInteropParseNote] -// CHECK:STDERR: 4 | auto foo_decl_value_return() -> DeclValueReturnUnion; -// CHECK:STDERR: | ^ -// CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+4]]:10: in file included here [InCppInclude] // CHECK:STDERR: ./decl_value_return_type.h:2:7: note: forward declaration of 'DeclValueReturnUnion' [CppInteropParseNote] -// CHECK:STDERR: 2 | union DeclValueReturnUnion; -// CHECK:STDERR: | ^ import Cpp library "decl_value_return_type.h"; fn F() { - // CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+16]]:3: note: in thunk for C++ function used here [InCppThunk] - // CHECK:STDERR: Cpp.foo_decl_value_return(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+7]]:3-29: note: in thunk for C++ function used here [InCppThunk] // CHECK:STDERR: - // CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+12]]:3: error: function returns incomplete type `Cpp.DeclValueReturnUnion` [IncompleteTypeInFunctionReturnType] - // CHECK:STDERR: Cpp.foo_decl_value_return(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE-10]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+5]]:3-29: error: function returns incomplete type `Cpp.DeclValueReturnUnion` [IncompleteTypeInFunctionReturnType] + // CHECK:STDERR: included from: fail_import_decl_value_return_type.carbon:[[@LINE-6]]:10 [InCppInclude] // CHECK:STDERR: ./decl_value_return_type.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: union DeclValueReturnUnion; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE-14]]:10: in file included here [InCppInclude] // CHECK:STDERR: ./decl_value_return_type.h:4:33: note: return type declared here [IncompleteReturnTypeHere] - // CHECK:STDERR: auto foo_decl_value_return() -> DeclValueReturnUnion; - // CHECK:STDERR: ^ // CHECK:STDERR: Cpp.foo_decl_value_return(); } diff --git a/toolchain/check/testdata/interop/cpp/impls/as.carbon b/toolchain/check/testdata/interop/cpp/impls/as.carbon index 55900ccd858a..eeda5dbffe2c 100644 --- a/toolchain/check/testdata/interop/cpp/impls/as.carbon +++ b/toolchain/check/testdata/interop/cpp/impls/as.carbon @@ -112,12 +112,8 @@ import Cpp library "conversions.h"; fn ConstructorExplicit(s: Cpp.Source) { //@dump-sem-ir-begin - // CHECK:STDERR: fail_conditionally_explicit_implicit.carbon:[[@LINE+7]]:42: error: cannot implicitly convert expression of type `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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let _: Cpp.ConditionallyExplicitTrue = s; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_conditionally_explicit_implicit.carbon:[[@LINE+3]]:42: error: cannot implicitly convert expression of type `Source` to `Cpp.ConditionallyExplicit` [ConversionFailure] + // CHECK:STDERR: fail_conditionally_explicit_implicit.carbon:[[@LINE+2]]:42: note: type `Cpp.Source` does not implement interface `Core.ImplicitAs(Cpp.ConditionallyExplicit)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: Cpp.ConditionallyExplicitTrue = s; //@dump-sem-ir-end @@ -631,9 +627,9 @@ fn ConversionExplicit(s: Cpp.ConditionallyExplicitFalse) { // CHECK:STDOUT: %self.patt.48a: %pattern_type.b72 = wrapper_binding_pattern self, %self.param_patt.581 [concrete] // CHECK:STDOUT: %Dest.cpp_destructor.type: type = fn_type @Dest.cpp_destructor [concrete] // CHECK:STDOUT: %Dest.cpp_destructor: %Dest.cpp_destructor.type = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef0: type = fn_type @Destroy.WithSelf.Op.loc21 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef0: type = fn_type @Destroy.WithSelf.Op.loc17 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403: %Destroy.WithSelf.Op.type.ef0 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbc: type = fn_type @Destroy.WithSelf.SelfDestruct.loc21 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbc: type = fn_type @Destroy.WithSelf.SelfDestruct.loc17 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3: %Destroy.WithSelf.SelfDestruct.type.fbc = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -662,7 +658,7 @@ fn ConversionExplicit(s: Cpp.ConditionallyExplicitFalse) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl: %Destroy.WithSelf.Op.type.ef0 = fn_decl @Destroy.WithSelf.Op.loc21 [concrete = constants.%Destroy.WithSelf.Op.403] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl: %Destroy.WithSelf.Op.type.ef0 = fn_decl @Destroy.WithSelf.Op.loc17 [concrete = constants.%Destroy.WithSelf.Op.403] { // CHECK:STDOUT: %self.param_patt: %pattern_type.b72 = ref_param_pattern [concrete = constants.%self.param_patt.581] // CHECK:STDOUT: %self.patt: %pattern_type.b72 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.48a] // CHECK:STDOUT: } { @@ -674,9 +670,9 @@ fn ConversionExplicit(s: Cpp.ConditionallyExplicitFalse) { // CHECK:STDOUT: fn @ConstructorExplicit(%s.param: %Source) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %s.ref: %Source = name_ref s, %s -// CHECK:STDOUT: %.loc15_42: %ConditionallyExplicit.9d4 = converted %s.ref, [concrete = ] -// CHECK:STDOUT: %.loc15_13: type = splice_block %ConditionallyExplicitTrue.ref [concrete = constants.%ConditionallyExplicit.9d4] { -// CHECK:STDOUT: %Cpp.ref.loc15: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %.loc11_42: %ConditionallyExplicit.9d4 = converted %s.ref, [concrete = ] +// CHECK:STDOUT: %.loc11_13: type = splice_block %ConditionallyExplicitTrue.ref [concrete = constants.%ConditionallyExplicit.9d4] { +// CHECK:STDOUT: %Cpp.ref.loc11: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %ConditionallyExplicitTrue.ref: type = name_ref ConditionallyExplicitTrue, imports.%ConditionallyExplicit.decl.6ab [concrete = constants.%ConditionallyExplicit.9d4] // CHECK:STDOUT: } // CHECK:STDOUT: %_: %ConditionallyExplicit.9d4 = wrapper_binding _, [concrete = ] @@ -689,30 +685,30 @@ fn ConversionExplicit(s: Cpp.ConditionallyExplicitFalse) { // CHECK:STDOUT: fn @ConversionExplicit(%s.param: %ConditionallyExplicit.3cd) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %s.ref: %ConditionallyExplicit.3cd = name_ref s, %s -// CHECK:STDOUT: %.loc21_21.1: ref %Dest.980 = temporary_storage -// CHECK:STDOUT: %addr: %ptr.ca8 = addr_of %.loc21_21.1 +// CHECK:STDOUT: %.loc17_21.1: ref %Dest.980 = temporary_storage +// CHECK:STDOUT: %addr: %ptr.ca8 = addr_of %.loc17_21.1 // CHECK:STDOUT: %Dest__carbon_thunk.call: init %empty_tuple.type = call imports.%Dest__carbon_thunk.decl(%s.ref, %addr) -// CHECK:STDOUT: %.loc21_21.2: init %Dest.980 to %.loc21_21.1 = mark_in_place_init %Dest__carbon_thunk.call -// CHECK:STDOUT: %.loc21_21.3: init %Dest.980 = converted %s.ref, %.loc21_21.2 -// CHECK:STDOUT: %.loc21_21.4: ref %Dest.980 = temporary %.loc21_21.1, %.loc21_21.3 -// CHECK:STDOUT: %.loc21_21.5: %Dest.980 = acquire_value %.loc21_21.4 -// CHECK:STDOUT: %.loc21_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] { -// CHECK:STDOUT: %Cpp.ref.loc21: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %.loc17_21.2: init %Dest.980 to %.loc17_21.1 = mark_in_place_init %Dest__carbon_thunk.call +// CHECK:STDOUT: %.loc17_21.3: init %Dest.980 = converted %s.ref, %.loc17_21.2 +// CHECK:STDOUT: %.loc17_21.4: ref %Dest.980 = temporary %.loc17_21.1, %.loc17_21.3 +// CHECK:STDOUT: %.loc17_21.5: %Dest.980 = acquire_value %.loc17_21.4 +// CHECK:STDOUT: %.loc17_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] { +// CHECK:STDOUT: %Cpp.ref.loc17: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %Dest.ref: type = name_ref Dest, imports.%Dest.decl [concrete = constants.%Dest.980] // CHECK:STDOUT: } -// CHECK:STDOUT: %_: %Dest.980 = wrapper_binding _, %.loc21_21.5 +// CHECK:STDOUT: %_: %Dest.980 = wrapper_binding _, %.loc17_21.5 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %_.patt: %pattern_type.b72 = value_binding_pattern _ [concrete = constants.%_.patt.664] // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc21_21.4, constants.%Destroy.WithSelf.SelfDestruct.db3 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc21_21.4) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc17_21.4, constants.%Destroy.WithSelf.SelfDestruct.db3 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc17_21.4) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc21(%self.param: ref %Dest.980) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc17(%self.param: ref %Dest.980) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc21(%self.param: ref %Dest.980) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc17(%self.param: ref %Dest.980) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl(%self.param) // CHECK:STDOUT: %Dest.cpp_destructor.call: init %empty_tuple.type = call imports.%Dest.cpp_destructor.decl(%self.param) diff --git a/toolchain/check/testdata/interop/cpp/impls/copy.carbon b/toolchain/check/testdata/interop/cpp/impls/copy.carbon index 9a6271dd0083..0d45c29eaead 100644 --- a/toolchain/check/testdata/interop/cpp/impls/copy.carbon +++ b/toolchain/check/testdata/interop/cpp/impls/copy.carbon @@ -83,87 +83,59 @@ library "[[@TEST_NAME]]"; import Cpp library "types.h"; fn CopyDeletedCopy(c: Cpp.DeletedCopy) -> Cpp.DeletedCopy { - // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+8]]:10: error: attempt to use a deleted function [CppInteropParseError] - // CHECK:STDERR: 15 | return c; - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE-6]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+4]]:10: error: attempt to use a deleted function [CppInteropParseError] + // CHECK:STDERR: included from: fail_copy_noncopyable.carbon:[[@LINE-4]]:10 [InCppInclude] // CHECK:STDERR: ./types.h:14:3: note: 'DeletedCopy' has been explicitly marked deleted here [CppInteropParseNote] - // CHECK:STDERR: 14 | DeletedCopy(const DeletedCopy&) = delete; - // CHECK:STDERR: | ^ // CHECK:STDERR: return c; } fn CopyMoveOnly(c: Cpp.MoveOnly) -> Cpp.MoveOnly { - // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+8]]:10: error: attempt to use a deleted function [CppInteropParseError] - // CHECK:STDERR: 27 | return c; - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE-18]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+4]]:10: error: attempt to use a deleted function [CppInteropParseError] + // CHECK:STDERR: included from: fail_copy_noncopyable.carbon:[[@LINE-12]]:10 [InCppInclude] // CHECK:STDERR: ./types.h:19:3: note: copy constructor is implicitly deleted because 'MoveOnly' has a user-declared move constructor [CppInteropParseNote] - // CHECK:STDERR: 19 | MoveOnly(MoveOnly&&); - // CHECK:STDERR: | ^ // CHECK:STDERR: return c; } fn CopyDeletedMove(c: Cpp.DeletedMove) -> Cpp.DeletedMove { - // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+8]]:10: error: attempt to use a deleted function [CppInteropParseError] - // CHECK:STDERR: 39 | return c; - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE-30]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+4]]:10: error: attempt to use a deleted function [CppInteropParseError] + // CHECK:STDERR: included from: fail_copy_noncopyable.carbon:[[@LINE-20]]:10 [InCppInclude] // CHECK:STDERR: ./types.h:24:3: note: copy constructor is implicitly deleted because 'DeletedMove' has a user-declared move constructor [CppInteropParseNote] - // CHECK:STDERR: 24 | DeletedMove(DeletedMove&&) = delete; - // CHECK:STDERR: | ^ // CHECK:STDERR: return c; } fn CopyNonConstCopy(c: Cpp.NonConstCopy) -> Cpp.NonConstCopy { // TODO: List candidates here. - // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+7]]:10: error: cannot copy value of type `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` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return c; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+3]]:10: error: cannot copy value of type `NonConstCopy` [CopyOfUncopyableType] + // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+2]]:10: note: type `Cpp.NonConstCopy` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return c; } fn CopyAmbiguousCopy(c: Cpp.AmbiguousCopy) -> Cpp.AmbiguousCopy { // TODO: List candidates here. - // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+7]]:10: error: cannot copy value of type `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` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return c; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+3]]:10: error: cannot copy value of type `AmbiguousCopy` [CopyOfUncopyableType] + // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+2]]:10: note: type `Cpp.AmbiguousCopy` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return c; } fn CopyPrivateCopy(c: Cpp.PrivateCopy) -> Cpp.PrivateCopy { // TODO: Note is missing location. - // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+8]]:10: error: cannot access private member `PrivateCopy` of type `Cpp.PrivateCopy` [ClassInvalidMemberAccess] - // CHECK:STDERR: return c; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE-67]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+4]]:10: error: cannot access private member `PrivateCopy` of type `Cpp.PrivateCopy` [ClassInvalidMemberAccess] + // CHECK:STDERR: included from: fail_copy_noncopyable.carbon:[[@LINE-45]]:10 [InCppInclude] // CHECK:STDERR: ./types.h:40:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: PrivateCopy(const PrivateCopy&); - // CHECK:STDERR: ^ // CHECK:STDERR: return c; } fn CopyProtectedCopy(c: Cpp.ProtectedCopy) -> Cpp.ProtectedCopy { // TODO: Note is missing location. - // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+8]]:10: error: cannot access protected member `ProtectedCopy` of type `Cpp.ProtectedCopy` [ClassInvalidMemberAccess] - // CHECK:STDERR: return c; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE-80]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+4]]:10: error: cannot access protected member `ProtectedCopy` of type `Cpp.ProtectedCopy` [ClassInvalidMemberAccess] + // CHECK:STDERR: included from: fail_copy_noncopyable.carbon:[[@LINE-54]]:10 [InCppInclude] // CHECK:STDERR: ./types.h:45:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: ProtectedCopy(const ProtectedCopy&); - // CHECK:STDERR: ^ // CHECK:STDERR: return c; } diff --git a/toolchain/check/testdata/interop/cpp/impls/cpp_range_for_iterate.carbon b/toolchain/check/testdata/interop/cpp/impls/cpp_range_for_iterate.carbon index b689d5a44f95..05781a82e69c 100644 --- a/toolchain/check/testdata/interop/cpp/impls/cpp_range_for_iterate.carbon +++ b/toolchain/check/testdata/interop/cpp/impls/cpp_range_for_iterate.carbon @@ -149,27 +149,15 @@ namespace N { class MutableRange { struct Iterator {}; public: - // CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE+11]]:34: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: friend auto begin(MutableRange&) -> Iterator; - // CHECK:STDERR: ^ - // CHECK:STDERR: cpp_range_for_iterate.carbon:10:3: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: fn Begin(self) -> Iterator; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: cpp_range_for_iterate.carbon:21:33: note: initializing generic parameter `R` declared here [InitializingGenericParam] - // CHECK:STDERR: fn AssertIsRange(unused generic R: IsRange where .Result = true) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE+5]]:34: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: cpp_range_for_iterate.carbon:10:3-29: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: cpp_range_for_iterate.carbon:21:33-63: note: initializing generic parameter `R` declared here [InitializingGenericParam] // CHECK:STDERR: // CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon: error: value expression passed to reference parameter [ValueForRefParam] friend auto begin(MutableRange&) -> Iterator; - // CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE+10]]:32: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: friend auto end(MutableRange&) -> Iterator; - // CHECK:STDERR: ^ - // CHECK:STDERR: cpp_range_for_iterate.carbon:11:3: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: fn End(self) -> Sentinel; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: cpp_range_for_iterate.carbon:21:33: note: initializing generic parameter `R` declared here [InitializingGenericParam] - // CHECK:STDERR: fn AssertIsRange(unused generic R: IsRange where .Result = true) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE+4]]:32: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: cpp_range_for_iterate.carbon:11:3-27: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: cpp_range_for_iterate.carbon:21:33-63: note: initializing generic parameter `R` declared here [InitializingGenericParam] // CHECK:STDERR: friend auto end(MutableRange&) -> Iterator; }; @@ -210,9 +198,7 @@ import Cpp inline '''c++ namespace N { class MutableRangeWithSentinel { struct Iterator { - // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+5]]:31: error: unknown type name 'ValueType' [CppInteropParseError] - // CHECK:STDERR: 14 | auto operator*() const -> ValueType&; - // CHECK:STDERR: | ^ + // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+3]]:31: error: unknown type name 'ValueType' [CppInteropParseError] // CHECK:STDERR: // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon: error: value expression passed to reference parameter [ValueForRefParam] auto operator*() const -> ValueType&; @@ -224,27 +210,15 @@ class MutableRangeWithSentinel { friend auto operator!=(Sentinel, Iterator) -> bool; }; public: - // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+11]]:46: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: friend auto begin(MutableRangeWithSentinel&) -> Iterator; - // CHECK:STDERR: ^ - // CHECK:STDERR: cpp_range_for_iterate.carbon:10:3: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: fn Begin(self) -> Iterator; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: cpp_range_for_iterate.carbon:21:33: note: initializing generic parameter `R` declared here [InitializingGenericParam] - // CHECK:STDERR: fn AssertIsRange(unused generic R: IsRange where .Result = true) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+5]]:46: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: cpp_range_for_iterate.carbon:10:3-29: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: cpp_range_for_iterate.carbon:21:33-63: note: initializing generic parameter `R` declared here [InitializingGenericParam] // CHECK:STDERR: // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon: error: value expression passed to reference parameter [ValueForRefParam] friend auto begin(MutableRangeWithSentinel&) -> Iterator; - // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+10]]:44: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: friend auto end(MutableRangeWithSentinel&) -> Sentinel; - // CHECK:STDERR: ^ - // CHECK:STDERR: cpp_range_for_iterate.carbon:11:3: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: fn End(self) -> Sentinel; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: cpp_range_for_iterate.carbon:21:33: note: initializing generic parameter `R` declared here [InitializingGenericParam] - // CHECK:STDERR: fn AssertIsRange(unused generic R: IsRange where .Result = true) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+4]]:44: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: cpp_range_for_iterate.carbon:11:3-27: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: cpp_range_for_iterate.carbon:21:33-63: note: initializing generic parameter `R` declared here [InitializingGenericParam] // CHECK:STDERR: friend auto end(MutableRangeWithSentinel&) -> Sentinel; }; @@ -267,27 +241,15 @@ class MutableAndConstRange { struct Iterator {}; struct ConstIterator {}; public: - // CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE+11]]:42: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: friend auto begin(MutableAndConstRange&) -> Iterator; - // CHECK:STDERR: ^ - // CHECK:STDERR: cpp_range_for_iterate.carbon:10:3: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: fn Begin(self) -> Iterator; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: cpp_range_for_iterate.carbon:21:33: note: initializing generic parameter `R` declared here [InitializingGenericParam] - // CHECK:STDERR: fn AssertIsRange(unused generic R: IsRange where .Result = true) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE+5]]:42: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: cpp_range_for_iterate.carbon:10:3-29: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: cpp_range_for_iterate.carbon:21:33-63: note: initializing generic parameter `R` declared here [InitializingGenericParam] // CHECK:STDERR: // CHECK:STDERR: fail_todo_adl_overloads.carbon: error: value expression passed to reference parameter [ValueForRefParam] friend auto begin(MutableAndConstRange&) -> Iterator; - // CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE+10]]:40: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: friend auto end(MutableAndConstRange&) -> Iterator; - // CHECK:STDERR: ^ - // CHECK:STDERR: cpp_range_for_iterate.carbon:11:3: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: fn End(self) -> Sentinel; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: cpp_range_for_iterate.carbon:21:33: note: initializing generic parameter `R` declared here [InitializingGenericParam] - // CHECK:STDERR: fn AssertIsRange(unused generic R: IsRange where .Result = true) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE+4]]:40: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: cpp_range_for_iterate.carbon:11:3-27: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: cpp_range_for_iterate.carbon:21:33-63: note: initializing generic parameter `R` declared here [InitializingGenericParam] // CHECK:STDERR: friend auto end(MutableAndConstRange&) -> Iterator; @@ -386,48 +348,24 @@ struct EndFunctionDeleted { '''; fn Test() { - // CHECK:STDERR: fail_deleted.carbon:[[@LINE+10]]:47: error: attempt to use a deleted function [CppInteropParseError] - // CHECK:STDERR: 38 | Core.AssertIsNotRange(Cpp.BeginMethodDeleted); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_deleted.carbon:[[@LINE-24]]:8: note: 'begin' has been explicitly marked deleted here [CppInteropParseNote] - // CHECK:STDERR: 7 | auto begin() = delete; - // CHECK:STDERR: | ^ - // CHECK:STDERR: cpp_range_for_iterate.carbon:22:36: note: initializing generic parameter `S` declared here [InitializingGenericParam] - // CHECK:STDERR: fn AssertIsNotRange(unused generic S: IsRange where .Result = false) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_deleted.carbon:[[@LINE+4]]:47: error: attempt to use a deleted function [CppInteropParseError] + // CHECK:STDERR: fail_deleted.carbon:[[@LINE-22]]:8: note: 'begin' has been explicitly marked deleted here [CppInteropParseNote] + // CHECK:STDERR: cpp_range_for_iterate.carbon:22:36-67: note: initializing generic parameter `S` declared here [InitializingGenericParam] // CHECK:STDERR: Core.AssertIsNotRange(Cpp.BeginMethodDeleted); - // CHECK:STDERR: fail_deleted.carbon:[[@LINE+10]]:45: error: attempt to use a deleted function [CppInteropParseError] - // CHECK:STDERR: 49 | Core.AssertIsNotRange(Cpp.EndMethodDeleted); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_deleted.carbon:[[@LINE-29]]:8: note: 'end' has been explicitly marked deleted here [CppInteropParseNote] - // CHECK:STDERR: 13 | auto end() = delete; - // CHECK:STDERR: | ^ - // CHECK:STDERR: cpp_range_for_iterate.carbon:22:36: note: initializing generic parameter `S` declared here [InitializingGenericParam] - // CHECK:STDERR: fn AssertIsNotRange(unused generic S: IsRange where .Result = false) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_deleted.carbon:[[@LINE+4]]:45: error: attempt to use a deleted function [CppInteropParseError] + // CHECK:STDERR: fail_deleted.carbon:[[@LINE-21]]:8: note: 'end' has been explicitly marked deleted here [CppInteropParseNote] + // CHECK:STDERR: cpp_range_for_iterate.carbon:22:36-67: note: initializing generic parameter `S` declared here [InitializingGenericParam] // CHECK:STDERR: Core.AssertIsNotRange(Cpp.EndMethodDeleted); - // CHECK:STDERR: fail_deleted.carbon:[[@LINE+10]]:49: error: call to deleted function 'begin' [CppInteropParseError] - // CHECK:STDERR: 60 | Core.AssertIsNotRange(Cpp.BeginFunctionDeleted); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_deleted.carbon:[[@LINE-36]]:15: note: candidate function has been explicitly deleted [CppInteropParseNote] - // CHECK:STDERR: 17 | friend auto begin(const BeginFunctionDeleted&) = delete; - // CHECK:STDERR: | ^ - // CHECK:STDERR: cpp_range_for_iterate.carbon:22:36: note: initializing generic parameter `S` declared here [InitializingGenericParam] - // CHECK:STDERR: fn AssertIsNotRange(unused generic S: IsRange where .Result = false) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_deleted.carbon:[[@LINE+4]]:49: error: call to deleted function 'begin' [CppInteropParseError] + // CHECK:STDERR: fail_deleted.carbon:[[@LINE-22]]:15: note: candidate function has been explicitly deleted [CppInteropParseNote] + // CHECK:STDERR: cpp_range_for_iterate.carbon:22:36-67: note: initializing generic parameter `S` declared here [InitializingGenericParam] // CHECK:STDERR: Core.AssertIsNotRange(Cpp.BeginFunctionDeleted); - // CHECK:STDERR: fail_deleted.carbon:[[@LINE+10]]:47: error: call to deleted function 'end' [CppInteropParseError] - // CHECK:STDERR: 71 | Core.AssertIsNotRange(Cpp.EndFunctionDeleted); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_deleted.carbon:[[@LINE-41]]:15: note: candidate function has been explicitly deleted [CppInteropParseNote] - // CHECK:STDERR: 23 | friend auto end(const EndFunctionDeleted&) = delete; - // CHECK:STDERR: | ^ - // CHECK:STDERR: cpp_range_for_iterate.carbon:22:36: note: initializing generic parameter `S` declared here [InitializingGenericParam] - // CHECK:STDERR: fn AssertIsNotRange(unused generic S: IsRange where .Result = false) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_deleted.carbon:[[@LINE+4]]:47: error: call to deleted function 'end' [CppInteropParseError] + // CHECK:STDERR: fail_deleted.carbon:[[@LINE-21]]:15: note: candidate function has been explicitly deleted [CppInteropParseNote] + // CHECK:STDERR: cpp_range_for_iterate.carbon:22:36-67: note: initializing generic parameter `S` declared here [InitializingGenericParam] // CHECK:STDERR: Core.AssertIsNotRange(Cpp.EndFunctionDeleted); } diff --git a/toolchain/check/testdata/interop/cpp/impls/destroy.carbon b/toolchain/check/testdata/interop/cpp/impls/destroy.carbon index 00f4b6be5988..2e0cad081237 100644 --- a/toolchain/check/testdata/interop/cpp/impls/destroy.carbon +++ b/toolchain/check/testdata/interop/cpp/impls/destroy.carbon @@ -77,13 +77,9 @@ class Derived { fn DestroyClassWithProtectedBaseDestructor() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_destroy_protected_base_destructor.carbon:[[@LINE+8]]:3: error: cannot access protected member `` of type `Cpp.ProtectedDestructor` [ClassInvalidMemberAccess] - // CHECK:STDERR: var unused a: Derived = {.base = {}}; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_destroy_protected_base_destructor.carbon:[[@LINE-11]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_todo_destroy_protected_base_destructor.carbon:[[@LINE+4]]:3-23: error: cannot access protected member `` of type `Cpp.ProtectedDestructor` [ClassInvalidMemberAccess] + // CHECK:STDERR: included from: fail_todo_destroy_protected_base_destructor.carbon:[[@LINE-9]]:10 [InCppInclude] // CHECK:STDERR: ./types.h:33:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: ~ProtectedDestructor(); - // CHECK:STDERR: ^ // CHECK:STDERR: var unused a: Derived = {.base = {}}; //@dump-sem-ir-end @@ -102,13 +98,9 @@ class Derived { fn DestroyClassWithPrivateBaseDestructor() { //@dump-sem-ir-begin // TODO: We should not allow this, as the destructor of the base class is private. - // CHECK:STDERR: fail_destroy_private_base_destructor.carbon:[[@LINE+8]]:3: error: cannot access private member `` of type `Cpp.PrivateDestructor` [ClassInvalidMemberAccess] - // CHECK:STDERR: var unused a: Derived = {.base = {}}; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_destroy_private_base_destructor.carbon:[[@LINE-12]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_destroy_private_base_destructor.carbon:[[@LINE+4]]:3-23: error: cannot access private member `` of type `Cpp.PrivateDestructor` [ClassInvalidMemberAccess] + // CHECK:STDERR: included from: fail_destroy_private_base_destructor.carbon:[[@LINE-10]]:10 [InCppInclude] // CHECK:STDERR: ./types.h:28:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: ~PrivateDestructor(); - // CHECK:STDERR: ^ // CHECK:STDERR: var unused a: Derived = {.base = {}}; //@dump-sem-ir-end @@ -121,61 +113,36 @@ library "[[@TEST_NAME]]"; import Cpp library "types.h"; fn AmbiguousDestroy() { - // 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: fail_destroy_nondestroyable.carbon:[[@LINE+7]]:17-39: error: binding pattern has incomplete type `AmbiguousDestructor` in name binding declaration [IncompleteTypeInBindingDecl] + // CHECK:STDERR: included from: fail_destroy_nondestroyable.carbon:[[@LINE-4]]:10 [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 = {}; } 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-30]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+4]]:3: error: attempt to use a deleted function [CppInteropParseError] + // CHECK:STDERR: included from: fail_destroy_nondestroyable.carbon:[[@LINE-15]]:10 [InCppInclude] // CHECK:STDERR: ./types.h:23:3: note: '~DeletedDestructor' has been explicitly marked deleted here [CppInteropParseNote] - // CHECK:STDERR: 23 | ~DeletedDestructor() = delete; - // CHECK:STDERR: | ^ // CHECK:STDERR: var unused a: Cpp.DeletedDestructor = {}; } 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-42]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+4]]:3-37: error: cannot access private member `` of type `Cpp.PrivateDestructor` [ClassInvalidMemberAccess] + // CHECK:STDERR: included from: fail_destroy_nondestroyable.carbon:[[@LINE-23]]:10 [InCppInclude] // CHECK:STDERR: ./types.h:28:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: ~PrivateDestructor(); - // CHECK:STDERR: ^ // CHECK:STDERR: var unused a: Cpp.PrivateDestructor = {}; } 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-54]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+4]]:3-39: error: cannot access protected member `` of type `Cpp.ProtectedDestructor` [ClassInvalidMemberAccess] + // CHECK:STDERR: included from: fail_destroy_nondestroyable.carbon:[[@LINE-31]]:10 [InCppInclude] // CHECK:STDERR: ./types.h:33:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: ~ProtectedDestructor(); - // CHECK:STDERR: ^ // CHECK:STDERR: var unused a: Cpp.ProtectedDestructor = {}; } @@ -213,13 +180,9 @@ class AdaptNoDestroy { fn Make() -> AdaptNoDestroy; fn F() { - // CHECK:STDERR: fail_no_destroy.carbon:[[@LINE+8]]:3: error: attempt to use a deleted function [CppInteropParseError] - // CHECK:STDERR: 21 | var _: AdaptNoDestroy = Make(); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_no_destroy.carbon:[[@LINE-12]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_no_destroy.carbon:[[@LINE+4]]:3: error: attempt to use a deleted function [CppInteropParseError] + // CHECK:STDERR: included from: fail_no_destroy.carbon:[[@LINE-10]]:10 [InCppInclude] // CHECK:STDERR: ./types.h:23:3: note: '~DeletedDestructor' has been explicitly marked deleted here [CppInteropParseNote] - // CHECK:STDERR: 23 | ~DeletedDestructor() = delete; - // CHECK:STDERR: | ^ // CHECK:STDERR: var _: AdaptNoDestroy = Make(); } @@ -457,24 +420,24 @@ fn F() { // CHECK:STDOUT: %self.patt.26a: %pattern_type.b4a = wrapper_binding_pattern self, %self.param_patt.446 [concrete] // CHECK:STDOUT: %ProtectedDestructor.cpp_destructor.type: type = fn_type @ProtectedDestructor.cpp_destructor [concrete] // CHECK:STDOUT: %ProtectedDestructor.cpp_destructor: %ProtectedDestructor.cpp_destructor.type = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc20_3.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc16_3.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.1: %Destroy.WithSelf.Op.type.ef016f.1 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1: type = fn_type @Destroy.WithSelf.SelfDestruct.loc20_3.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1: type = fn_type @Destroy.WithSelf.SelfDestruct.loc16_3.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.1: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1 = struct_value () [concrete] // CHECK:STDOUT: %pattern_type.237: type = pattern_type %struct_type.base.454 [concrete] // CHECK:STDOUT: %self.param_patt.2b9: %pattern_type.237 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.caa: %pattern_type.237 = wrapper_binding_pattern self, %self.param_patt.2b9 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc20_3.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc16_3.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc20_3.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc16_3.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.2: %Destroy.WithSelf.Op.type.ef016f.2 = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.a2b: %pattern_type.746 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.d8a: %pattern_type.746 = wrapper_binding_pattern self, %self.param_patt.a2b [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc20_3.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc16_3.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc20_3.3 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc16_3.3 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.3: %Destroy.WithSelf.Op.type.ef016f.3 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.3: type = fn_type @Destroy.WithSelf.SelfDestruct.loc20_3.3 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.3: type = fn_type @Destroy.WithSelf.SelfDestruct.loc16_3.3 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.3: %Destroy.WithSelf.SelfDestruct.type.fbceb5.3 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -487,35 +450,35 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc20_3.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc16_3.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.b4a = ref_param_pattern [concrete = constants.%self.param_patt.446] // CHECK:STDOUT: %self.patt: %pattern_type.b4a = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.26a] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %ProtectedDestructor = ref_param call_param0 // CHECK:STDOUT: %self: ref %ProtectedDestructor = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc20_3.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc16_3.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.237 = ref_param_pattern [concrete = constants.%self.param_patt.2b9] // CHECK:STDOUT: %self.patt: %pattern_type.237 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.caa] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %struct_type.base.454 = ref_param call_param0 // CHECK:STDOUT: %self: ref %struct_type.base.454 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc20_3.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc16_3.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.237 = ref_param_pattern [concrete = constants.%self.param_patt.2b9] // CHECK:STDOUT: %self.patt: %pattern_type.237 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.caa] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %struct_type.base.454 = ref_param call_param0 // CHECK:STDOUT: %self: ref %struct_type.base.454 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc20_3.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc16_3.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.746 = ref_param_pattern [concrete = constants.%self.param_patt.a2b] // CHECK:STDOUT: %self.patt: %pattern_type.746 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.d8a] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %Derived = ref_param call_param0 // CHECK:STDOUT: %self: ref %Derived = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.3: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc20_3.3 [concrete = constants.%Destroy.WithSelf.Op.403171.3] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.3: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc16_3.3 [concrete = constants.%Destroy.WithSelf.Op.403171.3] { // CHECK:STDOUT: %self.param_patt: %pattern_type.746 = ref_param_pattern [concrete = constants.%self.param_patt.a2b] // CHECK:STDOUT: %self.patt: %pattern_type.746 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.d8a] // CHECK:STDOUT: } { @@ -527,15 +490,15 @@ fn F() { // CHECK:STDOUT: fn @DestroyClassWithProtectedBaseDestructor() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.var: ref %Derived = var_storage %a.var_patt -// CHECK:STDOUT: %.loc20_37.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct.a40] -// CHECK:STDOUT: %.loc20_38.1: %struct_type.base.f5e = struct_literal (%.loc20_37.1) [concrete = constants.%struct] -// CHECK:STDOUT: %.loc20_38.2: ref %.a6c = class_element_access %a.var, element0 -// CHECK:STDOUT: %.loc20_37.2: init %.a6c to %.loc20_38.2 = class_init () [concrete = constants.%empty_struct.ec1] -// CHECK:STDOUT: %.loc20_38.3: init %.a6c = converted %.loc20_37.1, %.loc20_37.2 [concrete = constants.%empty_struct.ec1] -// CHECK:STDOUT: %.loc20_38.4: init %ProtectedDestructor = as_compatible %.loc20_38.3 [concrete = constants.%ProtectedDestructor.val] -// CHECK:STDOUT: %.loc20_38.5: init %Derived to %a.var = class_init (%.loc20_38.4) [concrete = constants.%Derived.val] -// CHECK:STDOUT: %.loc20_3: init %Derived = converted %.loc20_38.1, %.loc20_38.5 [concrete = constants.%Derived.val] -// CHECK:STDOUT: assign %a.var, %.loc20_3 +// CHECK:STDOUT: %.loc16_37.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct.a40] +// CHECK:STDOUT: %.loc16_38.1: %struct_type.base.f5e = struct_literal (%.loc16_37.1) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc16_38.2: ref %.a6c = class_element_access %a.var, element0 +// CHECK:STDOUT: %.loc16_37.2: init %.a6c to %.loc16_38.2 = class_init () [concrete = constants.%empty_struct.ec1] +// CHECK:STDOUT: %.loc16_38.3: init %.a6c = converted %.loc16_37.1, %.loc16_37.2 [concrete = constants.%empty_struct.ec1] +// CHECK:STDOUT: %.loc16_38.4: init %ProtectedDestructor = as_compatible %.loc16_38.3 [concrete = constants.%ProtectedDestructor.val] +// CHECK:STDOUT: %.loc16_38.5: init %Derived to %a.var = class_init (%.loc16_38.4) [concrete = constants.%Derived.val] +// CHECK:STDOUT: %.loc16_3: init %Derived = converted %.loc16_38.1, %.loc16_38.5 [concrete = constants.%Derived.val] +// CHECK:STDOUT: assign %a.var, %.loc16_3 // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl [concrete = constants.%Derived] // CHECK:STDOUT: %a: ref %Derived = wrapper_binding a, %a.var // CHECK:STDOUT: name_binding_decl { @@ -547,44 +510,44 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc20_3.1(%self.param: ref %ProtectedDestructor) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc16_3.1(%self.param: ref %ProtectedDestructor) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc20_3.1(%self.param: ref %ProtectedDestructor) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc16_3.1(%self.param: ref %ProtectedDestructor) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.1(%self.param) // CHECK:STDOUT: %ProtectedDestructor.cpp_destructor.call: init %empty_tuple.type = call imports.%ProtectedDestructor.cpp_destructor.decl(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc20_3.1(%self.param: ref %struct_type.base.454) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc16_3.1(%self.param: ref %struct_type.base.454) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc20: ref %ProtectedDestructor = struct_access %self.param, element0 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc20, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc20) +// CHECK:STDOUT: %.loc16: ref %ProtectedDestructor = struct_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc16, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc16) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc20_3.2(%self.param: ref %struct_type.base.454) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc16_3.2(%self.param: ref %struct_type.base.454) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc20_3.2(%self.param: ref %struct_type.base.454) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc16_3.2(%self.param: ref %struct_type.base.454) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.2(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.1(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc20_3.2(%self.param: ref %Derived) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc16_3.2(%self.param: ref %Derived) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %base.ref: %Derived.elem = name_ref base, @Derived.%.loc7 [concrete = @Derived.%.loc7] -// CHECK:STDOUT: %.loc20: ref %ProtectedDestructor = class_element_access %self.param, element0 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc20, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc20) +// CHECK:STDOUT: %.loc16: ref %ProtectedDestructor = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc16, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc16) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc20_3.3(%self.param: ref %Derived) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc16_3.3(%self.param: ref %Derived) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc20_3.3(%self.param: ref %Derived) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc16_3.3(%self.param: ref %Derived) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.3(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.2(%self.param) @@ -616,24 +579,24 @@ fn F() { // CHECK:STDOUT: %self.patt.7ec: %pattern_type.af2 = wrapper_binding_pattern self, %self.param_patt.bd1 [concrete] // CHECK:STDOUT: %PrivateDestructor.cpp_destructor.type: type = fn_type @PrivateDestructor.cpp_destructor [concrete] // CHECK:STDOUT: %PrivateDestructor.cpp_destructor: %PrivateDestructor.cpp_destructor.type = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc21_3.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc17_3.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.1: %Destroy.WithSelf.Op.type.ef016f.1 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1: type = fn_type @Destroy.WithSelf.SelfDestruct.loc21_3.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1: type = fn_type @Destroy.WithSelf.SelfDestruct.loc17_3.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.1: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1 = struct_value () [concrete] // CHECK:STDOUT: %pattern_type.9c9: type = pattern_type %struct_type.base.9aa [concrete] // CHECK:STDOUT: %self.param_patt.a59: %pattern_type.9c9 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.078: %pattern_type.9c9 = wrapper_binding_pattern self, %self.param_patt.a59 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc21_3.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc17_3.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc21_3.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc17_3.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.2: %Destroy.WithSelf.Op.type.ef016f.2 = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.a2b: %pattern_type.746 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.d8a: %pattern_type.746 = wrapper_binding_pattern self, %self.param_patt.a2b [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc21_3.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc17_3.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc21_3.3 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc17_3.3 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.3: %Destroy.WithSelf.Op.type.ef016f.3 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.3: type = fn_type @Destroy.WithSelf.SelfDestruct.loc21_3.3 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.3: type = fn_type @Destroy.WithSelf.SelfDestruct.loc17_3.3 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.3: %Destroy.WithSelf.SelfDestruct.type.fbceb5.3 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -646,35 +609,35 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc21_3.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc17_3.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.af2 = ref_param_pattern [concrete = constants.%self.param_patt.bd1] // CHECK:STDOUT: %self.patt: %pattern_type.af2 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.7ec] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %PrivateDestructor = ref_param call_param0 // CHECK:STDOUT: %self: ref %PrivateDestructor = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc21_3.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc17_3.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.9c9 = ref_param_pattern [concrete = constants.%self.param_patt.a59] // CHECK:STDOUT: %self.patt: %pattern_type.9c9 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.078] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %struct_type.base.9aa = ref_param call_param0 // CHECK:STDOUT: %self: ref %struct_type.base.9aa = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc21_3.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc17_3.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.9c9 = ref_param_pattern [concrete = constants.%self.param_patt.a59] // CHECK:STDOUT: %self.patt: %pattern_type.9c9 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.078] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %struct_type.base.9aa = ref_param call_param0 // CHECK:STDOUT: %self: ref %struct_type.base.9aa = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc21_3.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc17_3.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.746 = ref_param_pattern [concrete = constants.%self.param_patt.a2b] // CHECK:STDOUT: %self.patt: %pattern_type.746 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.d8a] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %Derived = ref_param call_param0 // CHECK:STDOUT: %self: ref %Derived = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.3: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc21_3.3 [concrete = constants.%Destroy.WithSelf.Op.403171.3] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.3: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc17_3.3 [concrete = constants.%Destroy.WithSelf.Op.403171.3] { // CHECK:STDOUT: %self.param_patt: %pattern_type.746 = ref_param_pattern [concrete = constants.%self.param_patt.a2b] // CHECK:STDOUT: %self.patt: %pattern_type.746 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.d8a] // CHECK:STDOUT: } { @@ -686,15 +649,15 @@ fn F() { // CHECK:STDOUT: fn @DestroyClassWithPrivateBaseDestructor() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.var: ref %Derived = var_storage %a.var_patt -// CHECK:STDOUT: %.loc21_37.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct.a40] -// CHECK:STDOUT: %.loc21_38.1: %struct_type.base.f5e = struct_literal (%.loc21_37.1) [concrete = constants.%struct] -// CHECK:STDOUT: %.loc21_38.2: ref %.c73 = class_element_access %a.var, element0 -// CHECK:STDOUT: %.loc21_37.2: init %.c73 to %.loc21_38.2 = class_init () [concrete = constants.%empty_struct.d8b] -// CHECK:STDOUT: %.loc21_38.3: init %.c73 = converted %.loc21_37.1, %.loc21_37.2 [concrete = constants.%empty_struct.d8b] -// CHECK:STDOUT: %.loc21_38.4: init %PrivateDestructor = as_compatible %.loc21_38.3 [concrete = constants.%PrivateDestructor.val] -// CHECK:STDOUT: %.loc21_38.5: init %Derived to %a.var = class_init (%.loc21_38.4) [concrete = constants.%Derived.val] -// CHECK:STDOUT: %.loc21_3: init %Derived = converted %.loc21_38.1, %.loc21_38.5 [concrete = constants.%Derived.val] -// CHECK:STDOUT: assign %a.var, %.loc21_3 +// CHECK:STDOUT: %.loc17_37.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct.a40] +// CHECK:STDOUT: %.loc17_38.1: %struct_type.base.f5e = struct_literal (%.loc17_37.1) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc17_38.2: ref %.c73 = class_element_access %a.var, element0 +// CHECK:STDOUT: %.loc17_37.2: init %.c73 to %.loc17_38.2 = class_init () [concrete = constants.%empty_struct.d8b] +// CHECK:STDOUT: %.loc17_38.3: init %.c73 = converted %.loc17_37.1, %.loc17_37.2 [concrete = constants.%empty_struct.d8b] +// CHECK:STDOUT: %.loc17_38.4: init %PrivateDestructor = as_compatible %.loc17_38.3 [concrete = constants.%PrivateDestructor.val] +// CHECK:STDOUT: %.loc17_38.5: init %Derived to %a.var = class_init (%.loc17_38.4) [concrete = constants.%Derived.val] +// CHECK:STDOUT: %.loc17_3: init %Derived = converted %.loc17_38.1, %.loc17_38.5 [concrete = constants.%Derived.val] +// CHECK:STDOUT: assign %a.var, %.loc17_3 // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl [concrete = constants.%Derived] // CHECK:STDOUT: %a: ref %Derived = wrapper_binding a, %a.var // CHECK:STDOUT: name_binding_decl { @@ -706,44 +669,44 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc21_3.1(%self.param: ref %PrivateDestructor) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc17_3.1(%self.param: ref %PrivateDestructor) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc21_3.1(%self.param: ref %PrivateDestructor) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc17_3.1(%self.param: ref %PrivateDestructor) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.1(%self.param) // CHECK:STDOUT: %PrivateDestructor.cpp_destructor.call: init %empty_tuple.type = call imports.%PrivateDestructor.cpp_destructor.decl(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc21_3.1(%self.param: ref %struct_type.base.9aa) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc17_3.1(%self.param: ref %struct_type.base.9aa) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc21: ref %PrivateDestructor = struct_access %self.param, element0 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc21, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc21) +// CHECK:STDOUT: %.loc17: ref %PrivateDestructor = struct_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc17, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc17) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc21_3.2(%self.param: ref %struct_type.base.9aa) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc17_3.2(%self.param: ref %struct_type.base.9aa) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc21_3.2(%self.param: ref %struct_type.base.9aa) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc17_3.2(%self.param: ref %struct_type.base.9aa) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.2(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.1(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc21_3.2(%self.param: ref %Derived) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc17_3.2(%self.param: ref %Derived) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %base.ref: %Derived.elem = name_ref base, @Derived.%.loc7 [concrete = @Derived.%.loc7] -// CHECK:STDOUT: %.loc21: ref %PrivateDestructor = class_element_access %self.param, element0 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc21, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc21) +// CHECK:STDOUT: %.loc17: ref %PrivateDestructor = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc17, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc17) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc21_3.3(%self.param: ref %Derived) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc17_3.3(%self.param: ref %Derived) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc21_3.3(%self.param: ref %Derived) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc17_3.3(%self.param: ref %Derived) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.3(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.2(%self.param) diff --git a/toolchain/check/testdata/interop/cpp/impls/implicit_as.carbon b/toolchain/check/testdata/interop/cpp/impls/implicit_as.carbon index ed370d6c2190..397fc1586cd8 100644 --- a/toolchain/check/testdata/interop/cpp/impls/implicit_as.carbon +++ b/toolchain/check/testdata/interop/cpp/impls/implicit_as.carbon @@ -92,12 +92,8 @@ import Cpp library "implicit_conversions.h"; fn NonConstConversionTest(s: Cpp.NonConstConversion) { //@dump-sem-ir-begin - // CHECK:STDERR: fail_expr_category.carbon:[[@LINE+7]]:21: error: cannot implicitly convert expression of type `NonConstConversion` to `Cpp.Dest` [ConversionFailure] - // CHECK:STDERR: let _: Cpp.Dest = s; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_expr_category.carbon:[[@LINE+4]]:21: note: type `Cpp.NonConstConversion` does not implement interface `Core.ImplicitAs(Cpp.Dest)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let _: Cpp.Dest = s; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_expr_category.carbon:[[@LINE+3]]:21: error: cannot implicitly convert expression of type `NonConstConversion` to `Cpp.Dest` [ConversionFailure] + // CHECK:STDERR: fail_expr_category.carbon:[[@LINE+2]]:21: note: type `Cpp.NonConstConversion` does not implement interface `Core.ImplicitAs(Cpp.Dest)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: Cpp.Dest = s; //@dump-sem-ir-end @@ -111,13 +107,9 @@ import Cpp library "implicit_conversions.h"; fn InaccessibleConstructorTest(s: Cpp.Source) { //@dump-sem-ir-begin - // CHECK:STDERR: fail_access.carbon:[[@LINE+8]]:40: error: cannot access private member `InaccessibleConstructor` of type `Cpp.InaccessibleConstructor` [ClassInvalidMemberAccess] - // CHECK:STDERR: let _: Cpp.InaccessibleConstructor = s; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_access.carbon:[[@LINE-7]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_access.carbon:[[@LINE+4]]:40: error: cannot access private member `InaccessibleConstructor` of type `Cpp.InaccessibleConstructor` [ClassInvalidMemberAccess] + // CHECK:STDERR: included from: fail_access.carbon:[[@LINE-5]]:10 [InCppInclude] // CHECK:STDERR: ./implicit_conversions.h:21:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: InaccessibleConstructor(Source); - // CHECK:STDERR: ^ // CHECK:STDERR: let _: Cpp.InaccessibleConstructor = s; //@dump-sem-ir-end @@ -125,13 +117,9 @@ fn InaccessibleConstructorTest(s: Cpp.Source) { fn InaccessibleConversionTest(s: Cpp.InaccessibleConversion) { //@dump-sem-ir-begin - // CHECK:STDERR: fail_access.carbon:[[@LINE+8]]:21: error: cannot access private member `` of type `Cpp.InaccessibleConversion` [ClassInvalidMemberAccess] - // CHECK:STDERR: let _: Cpp.Dest = s; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_access.carbon:[[@LINE-21]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_access.carbon:[[@LINE+4]]:21: error: cannot access private member `` of type `Cpp.InaccessibleConversion` [ClassInvalidMemberAccess] + // CHECK:STDERR: included from: fail_access.carbon:[[@LINE-15]]:10 [InCppInclude] // CHECK:STDERR: ./implicit_conversions.h:26:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: operator Dest() const; - // CHECK:STDERR: ^ // CHECK:STDERR: let _: Cpp.Dest = s; //@dump-sem-ir-end @@ -145,12 +133,8 @@ import Cpp library "implicit_conversions.h"; fn DeletedConstructorTest(s: Cpp.Source) { //@dump-sem-ir-begin - // CHECK:STDERR: fail_deleted.carbon:[[@LINE+7]]:35: error: cannot implicitly convert expression of type `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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let _: Cpp.DeletedConstructor = s; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_deleted.carbon:[[@LINE+3]]:35: error: cannot implicitly convert expression of type `Source` to `Cpp.DeletedConstructor` [ConversionFailure] + // CHECK:STDERR: fail_deleted.carbon:[[@LINE+2]]:35: note: type `Cpp.Source` does not implement interface `Core.ImplicitAs(Cpp.DeletedConstructor)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: Cpp.DeletedConstructor = s; //@dump-sem-ir-end @@ -158,12 +142,8 @@ fn DeletedConstructorTest(s: Cpp.Source) { fn DeletedConversionTest(s: Cpp.DeletedConversion) { //@dump-sem-ir-begin - // CHECK:STDERR: fail_deleted.carbon:[[@LINE+7]]:21: error: cannot implicitly convert expression of type `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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let _: Cpp.Dest = s; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_deleted.carbon:[[@LINE+3]]:21: error: cannot implicitly convert expression of type `DeletedConversion` to `Cpp.Dest` [ConversionFailure] + // CHECK:STDERR: fail_deleted.carbon:[[@LINE+2]]:21: note: type `Cpp.DeletedConversion` does not implement interface `Core.ImplicitAs(Cpp.Dest)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: Cpp.Dest = s; //@dump-sem-ir-end @@ -177,12 +157,8 @@ import Cpp library "implicit_conversions.h"; fn ExplicitConstructorTest(s: Cpp.Source) { //@dump-sem-ir-begin - // CHECK:STDERR: fail_explicit.carbon:[[@LINE+7]]:36: error: cannot implicitly convert expression of type `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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let _: Cpp.ExplicitConstructor = s; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_explicit.carbon:[[@LINE+3]]:36: error: cannot implicitly convert expression of type `Source` to `Cpp.ExplicitConstructor` [ConversionFailure] + // CHECK:STDERR: fail_explicit.carbon:[[@LINE+2]]:36: note: type `Cpp.Source` does not implement interface `Core.ImplicitAs(Cpp.ExplicitConstructor)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: Cpp.ExplicitConstructor = s; //@dump-sem-ir-end @@ -190,12 +166,8 @@ fn ExplicitConstructorTest(s: Cpp.Source) { fn ExplicitConversionTest(s: Cpp.ExplicitConversion) { //@dump-sem-ir-begin - // CHECK:STDERR: fail_explicit.carbon:[[@LINE+7]]:21: error: cannot implicitly convert expression of type `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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let _: Cpp.Dest = s; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_explicit.carbon:[[@LINE+3]]:21: error: cannot implicitly convert expression of type `ExplicitConversion` to `Cpp.Dest` [ConversionFailure] + // CHECK:STDERR: fail_explicit.carbon:[[@LINE+2]]:21: note: type `Cpp.ExplicitConversion` does not implement interface `Core.ImplicitAs(Cpp.Dest)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: Cpp.Dest = s; //@dump-sem-ir-end @@ -221,16 +193,10 @@ import Cpp library "implicit_conversions.h"; fn IntConstructorTest(u: u32) { //@dump-sem-ir-begin - // 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)` [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] + // CHECK:STDERR: fail_no_u32_to_int_conversion_in_carbon.carbon:[[@LINE+5]]:31: error: cannot implicitly convert expression of type `u32` to `i32` [ConversionFailure] + // CHECK:STDERR: fail_no_u32_to_int_conversion_in_carbon.carbon:[[@LINE+4]]:31: note: type `u32` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: included from: fail_no_u32_to_int_conversion_in_carbon.carbon:[[@LINE-6]]:10 [InCppInclude] // CHECK:STDERR: ./implicit_conversions.h:38:21: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: IntConstructor(int); - // CHECK:STDERR: ^ // CHECK:STDERR: let _: Cpp.IntConstructor = u; //@dump-sem-ir-end @@ -300,28 +266,16 @@ import Cpp library "aggregate.h"; fn InitFromTuple() { //@dump-sem-ir-begin - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let _: Cpp.Aggregate = (); - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_todo_aggregate_from_tuple.carbon:[[@LINE+3]]:26-27: error: cannot implicitly convert expression of type `()` to `Cpp.Aggregate` [ConversionFailure] + // CHECK:STDERR: fail_todo_aggregate_from_tuple.carbon:[[@LINE+2]]:26-27: note: type `()` does not implement interface `Core.ImplicitAs(Cpp.Aggregate)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: Cpp.Aggregate = (); - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let _: Cpp.Aggregate = (1,); - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_todo_aggregate_from_tuple.carbon:[[@LINE+3]]:26-29: error: cannot implicitly convert expression of type `(Core.IntLiteral,)` to `Cpp.Aggregate` [ConversionFailure] + // CHECK:STDERR: fail_todo_aggregate_from_tuple.carbon:[[@LINE+2]]:26-29: note: type `(Core.IntLiteral,)` does not implement interface `Core.ImplicitAs(Cpp.Aggregate)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: Cpp.Aggregate = (1,); - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let _: Cpp.Aggregate = (1, 2); - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_todo_aggregate_from_tuple.carbon:[[@LINE+3]]:26-31: error: cannot implicitly convert expression of type `(Core.IntLiteral, Core.IntLiteral)` to `Cpp.Aggregate` [ConversionFailure] + // CHECK:STDERR: fail_todo_aggregate_from_tuple.carbon:[[@LINE+2]]:26-31: note: type `(Core.IntLiteral, Core.IntLiteral)` does not implement interface `Core.ImplicitAs(Cpp.Aggregate)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: Cpp.Aggregate = (1, 2); //@dump-sem-ir-end @@ -335,28 +289,16 @@ import Cpp library "aggregate.h"; fn InitFromStruct() { //@dump-sem-ir-begin - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let _: Cpp.Aggregate = {}; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_todo_aggregate_from_struct.carbon:[[@LINE+3]]:26-27: error: cannot implicitly convert expression of type `{}` to `Cpp.Aggregate` [ConversionFailure] + // CHECK:STDERR: fail_todo_aggregate_from_struct.carbon:[[@LINE+2]]:26-27: note: type `{}` does not implement interface `Core.ImplicitAs(Cpp.Aggregate)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: Cpp.Aggregate = {}; - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let _: Cpp.Aggregate = {.x = 1}; - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_todo_aggregate_from_struct.carbon:[[@LINE+3]]:26-33: error: cannot implicitly convert expression of type `{.x: Core.IntLiteral}` to `Cpp.Aggregate` [ConversionFailure] + // CHECK:STDERR: fail_todo_aggregate_from_struct.carbon:[[@LINE+2]]:26-33: note: type `{.x: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.Aggregate)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: Cpp.Aggregate = {.x = 1}; - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let _: Cpp.Aggregate = {.x = 1, .y = 2}; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_aggregate_from_struct.carbon:[[@LINE+3]]:26-41: error: cannot implicitly convert expression of type `{.x: Core.IntLiteral, .y: Core.IntLiteral}` to `Cpp.Aggregate` [ConversionFailure] + // CHECK:STDERR: fail_todo_aggregate_from_struct.carbon:[[@LINE+2]]:26-41: 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}; //@dump-sem-ir-end @@ -384,28 +326,16 @@ import Cpp library "aggregate.h"; fn InitFromStruct() { //@dump-sem-ir-begin - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let _: Cpp.NonAggregate = {}; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_non_aggregate_from_struct.carbon:[[@LINE+3]]:29-30: error: cannot implicitly convert expression of type `{}` to `Cpp.NonAggregate` [ConversionFailure] + // CHECK:STDERR: fail_non_aggregate_from_struct.carbon:[[@LINE+2]]:29-30: note: type `{}` does not implement interface `Core.ImplicitAs(Cpp.NonAggregate)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: Cpp.NonAggregate = {}; - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let _: Cpp.NonAggregate = {.x = 1}; - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_non_aggregate_from_struct.carbon:[[@LINE+3]]:29-36: error: cannot implicitly convert expression of type `{.x: Core.IntLiteral}` to `Cpp.NonAggregate` [ConversionFailure] + // CHECK:STDERR: fail_non_aggregate_from_struct.carbon:[[@LINE+2]]:29-36: note: type `{.x: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.NonAggregate)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: Cpp.NonAggregate = {.x = 1}; - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let _: Cpp.NonAggregate = {.x = 1, .y = 2}; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_non_aggregate_from_struct.carbon:[[@LINE+3]]:29-44: error: cannot implicitly convert expression of type `{.x: Core.IntLiteral, .y: Core.IntLiteral}` to `Cpp.NonAggregate` [ConversionFailure] + // CHECK:STDERR: fail_non_aggregate_from_struct.carbon:[[@LINE+2]]:29-44: 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}; //@dump-sem-ir-end @@ -624,9 +554,9 @@ fn InitFromStruct() { // CHECK:STDOUT: fn @NonConstConversionTest(%s.param: %NonConstConversion) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %s.ref: %NonConstConversion = name_ref s, %s -// CHECK:STDOUT: %.loc15_21: %Dest.980 = converted %s.ref, [concrete = ] -// CHECK:STDOUT: %.loc15_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] { -// CHECK:STDOUT: %Cpp.ref.loc15: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %.loc11_21: %Dest.980 = converted %s.ref, [concrete = ] +// CHECK:STDOUT: %.loc11_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] { +// CHECK:STDOUT: %Cpp.ref.loc11: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %Dest.ref: type = name_ref Dest, imports.%Dest.decl [concrete = constants.%Dest.980] // CHECK:STDOUT: } // CHECK:STDOUT: %_: %Dest.980 = wrapper_binding _, [concrete = ] @@ -653,9 +583,9 @@ fn InitFromStruct() { // CHECK:STDOUT: %self.patt.2ae: %pattern_type.824 = wrapper_binding_pattern self, %self.param_patt.244 [concrete] // CHECK:STDOUT: %InaccessibleConstructor.cpp_destructor.type: type = fn_type @InaccessibleConstructor.cpp_destructor [concrete] // CHECK:STDOUT: %InaccessibleConstructor.cpp_destructor: %InaccessibleConstructor.cpp_destructor.type = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc16 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc12 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.1: %Destroy.WithSelf.Op.type.ef016f.1 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1: type = fn_type @Destroy.WithSelf.SelfDestruct.loc16 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1: type = fn_type @Destroy.WithSelf.SelfDestruct.loc12 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.1: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1 = struct_value () [concrete] // CHECK:STDOUT: %InaccessibleConversion: type = class_type @InaccessibleConversion [concrete] // CHECK:STDOUT: %Dest: type = class_type @Dest [concrete] @@ -668,9 +598,9 @@ fn InitFromStruct() { // CHECK:STDOUT: %self.patt.48a: %pattern_type.b72 = wrapper_binding_pattern self, %self.param_patt.581 [concrete] // CHECK:STDOUT: %Dest.cpp_destructor.type: type = fn_type @Dest.cpp_destructor [concrete] // CHECK:STDOUT: %Dest.cpp_destructor: %Dest.cpp_destructor.type = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc30 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc22 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.2: %Destroy.WithSelf.Op.type.ef016f.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc30 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc22 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.2: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -709,14 +639,14 @@ fn InitFromStruct() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc16 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc12 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.824 = ref_param_pattern [concrete = constants.%self.param_patt.244] // CHECK:STDOUT: %self.patt: %pattern_type.824 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.2ae] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %InaccessibleConstructor = ref_param call_param0 // CHECK:STDOUT: %self: ref %InaccessibleConstructor = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc30 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc22 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.b72 = ref_param_pattern [concrete = constants.%self.param_patt.581] // CHECK:STDOUT: %self.patt: %pattern_type.b72 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.48a] // CHECK:STDOUT: } { @@ -728,32 +658,32 @@ fn InitFromStruct() { // CHECK:STDOUT: fn @InaccessibleConstructorTest(%s.param: %Source) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %s.ref: %Source = name_ref s, %s -// CHECK:STDOUT: %.loc16_40.1: ref %InaccessibleConstructor = temporary_storage -// CHECK:STDOUT: %.loc16_40.2: ref %Source = value_as_ref %s.ref -// CHECK:STDOUT: %addr.loc16_40.1: %ptr.5f6 = addr_of %.loc16_40.2 -// CHECK:STDOUT: %addr.loc16_40.2: %ptr.859 = addr_of %.loc16_40.1 -// CHECK:STDOUT: %InaccessibleConstructor__carbon_thunk.call: init %empty_tuple.type = call imports.%InaccessibleConstructor__carbon_thunk.decl(%addr.loc16_40.1, %addr.loc16_40.2) -// CHECK:STDOUT: %.loc16_40.3: init %InaccessibleConstructor to %.loc16_40.1 = mark_in_place_init %InaccessibleConstructor__carbon_thunk.call -// CHECK:STDOUT: %.loc16_40.4: init %InaccessibleConstructor = converted %s.ref, %.loc16_40.3 -// CHECK:STDOUT: %.loc16_40.5: ref %InaccessibleConstructor = temporary %.loc16_40.1, %.loc16_40.4 -// CHECK:STDOUT: %.loc16_40.6: %InaccessibleConstructor = acquire_value %.loc16_40.5 -// CHECK:STDOUT: %.loc16_13: type = splice_block %InaccessibleConstructor.ref [concrete = constants.%InaccessibleConstructor] { -// CHECK:STDOUT: %Cpp.ref.loc16: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %.loc12_40.1: ref %InaccessibleConstructor = temporary_storage +// CHECK:STDOUT: %.loc12_40.2: ref %Source = value_as_ref %s.ref +// CHECK:STDOUT: %addr.loc12_40.1: %ptr.5f6 = addr_of %.loc12_40.2 +// CHECK:STDOUT: %addr.loc12_40.2: %ptr.859 = addr_of %.loc12_40.1 +// CHECK:STDOUT: %InaccessibleConstructor__carbon_thunk.call: init %empty_tuple.type = call imports.%InaccessibleConstructor__carbon_thunk.decl(%addr.loc12_40.1, %addr.loc12_40.2) +// CHECK:STDOUT: %.loc12_40.3: init %InaccessibleConstructor to %.loc12_40.1 = mark_in_place_init %InaccessibleConstructor__carbon_thunk.call +// CHECK:STDOUT: %.loc12_40.4: init %InaccessibleConstructor = converted %s.ref, %.loc12_40.3 +// CHECK:STDOUT: %.loc12_40.5: ref %InaccessibleConstructor = temporary %.loc12_40.1, %.loc12_40.4 +// CHECK:STDOUT: %.loc12_40.6: %InaccessibleConstructor = acquire_value %.loc12_40.5 +// CHECK:STDOUT: %.loc12_13: type = splice_block %InaccessibleConstructor.ref [concrete = constants.%InaccessibleConstructor] { +// CHECK:STDOUT: %Cpp.ref.loc12: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %InaccessibleConstructor.ref: type = name_ref InaccessibleConstructor, imports.%InaccessibleConstructor.decl [concrete = constants.%InaccessibleConstructor] // CHECK:STDOUT: } -// CHECK:STDOUT: %_: %InaccessibleConstructor = wrapper_binding _, %.loc16_40.6 +// CHECK:STDOUT: %_: %InaccessibleConstructor = wrapper_binding _, %.loc12_40.6 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %_.patt: %pattern_type.824 = value_binding_pattern _ [concrete = constants.%_.patt.f1f] // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc16_40.5, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc16_40.5) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc12_40.5, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc12_40.5) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc16(%self.param: ref %InaccessibleConstructor) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc12(%self.param: ref %InaccessibleConstructor) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc16(%self.param: ref %InaccessibleConstructor) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc12(%self.param: ref %InaccessibleConstructor) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.1(%self.param) // CHECK:STDOUT: %InaccessibleConstructor.cpp_destructor.call: init %empty_tuple.type = call imports.%InaccessibleConstructor.cpp_destructor.decl(%self.param) @@ -763,30 +693,30 @@ fn InitFromStruct() { // CHECK:STDOUT: fn @InaccessibleConversionTest(%s.param: %InaccessibleConversion) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %s.ref: %InaccessibleConversion = name_ref s, %s -// CHECK:STDOUT: %.loc30_21.1: ref %Dest = temporary_storage -// CHECK:STDOUT: %addr: %ptr.ca8 = addr_of %.loc30_21.1 +// CHECK:STDOUT: %.loc22_21.1: ref %Dest = temporary_storage +// CHECK:STDOUT: %addr: %ptr.ca8 = addr_of %.loc22_21.1 // CHECK:STDOUT: %Dest__carbon_thunk.call: init %empty_tuple.type = call imports.%Dest__carbon_thunk.decl(%s.ref, %addr) -// CHECK:STDOUT: %.loc30_21.2: init %Dest to %.loc30_21.1 = mark_in_place_init %Dest__carbon_thunk.call -// CHECK:STDOUT: %.loc30_21.3: init %Dest = converted %s.ref, %.loc30_21.2 -// CHECK:STDOUT: %.loc30_21.4: ref %Dest = temporary %.loc30_21.1, %.loc30_21.3 -// CHECK:STDOUT: %.loc30_21.5: %Dest = acquire_value %.loc30_21.4 -// CHECK:STDOUT: %.loc30_13: type = splice_block %Dest.ref [concrete = constants.%Dest] { -// CHECK:STDOUT: %Cpp.ref.loc30: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %.loc22_21.2: init %Dest to %.loc22_21.1 = mark_in_place_init %Dest__carbon_thunk.call +// CHECK:STDOUT: %.loc22_21.3: init %Dest = converted %s.ref, %.loc22_21.2 +// CHECK:STDOUT: %.loc22_21.4: ref %Dest = temporary %.loc22_21.1, %.loc22_21.3 +// CHECK:STDOUT: %.loc22_21.5: %Dest = acquire_value %.loc22_21.4 +// CHECK:STDOUT: %.loc22_13: type = splice_block %Dest.ref [concrete = constants.%Dest] { +// CHECK:STDOUT: %Cpp.ref.loc22: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %Dest.ref: type = name_ref Dest, imports.%Dest.decl [concrete = constants.%Dest] // CHECK:STDOUT: } -// CHECK:STDOUT: %_: %Dest = wrapper_binding _, %.loc30_21.5 +// CHECK:STDOUT: %_: %Dest = wrapper_binding _, %.loc22_21.5 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %_.patt: %pattern_type.b72 = value_binding_pattern _ [concrete = constants.%_.patt.664] // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc30_21.4, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc30_21.4) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc22_21.4, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc22_21.4) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc30(%self.param: ref %Dest) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc22(%self.param: ref %Dest) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc30(%self.param: ref %Dest) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc22(%self.param: ref %Dest) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.2(%self.param) // CHECK:STDOUT: %Dest.cpp_destructor.call: init %empty_tuple.type = call imports.%Dest.cpp_destructor.decl(%self.param) @@ -824,9 +754,9 @@ fn InitFromStruct() { // CHECK:STDOUT: fn @DeletedConstructorTest(%s.param: %Source) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %s.ref: %Source = name_ref s, %s -// CHECK:STDOUT: %.loc15_35: %DeletedConstructor = converted %s.ref, [concrete = ] -// CHECK:STDOUT: %.loc15_13: type = splice_block %DeletedConstructor.ref [concrete = constants.%DeletedConstructor] { -// CHECK:STDOUT: %Cpp.ref.loc15: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %.loc11_35: %DeletedConstructor = converted %s.ref, [concrete = ] +// CHECK:STDOUT: %.loc11_13: type = splice_block %DeletedConstructor.ref [concrete = constants.%DeletedConstructor] { +// CHECK:STDOUT: %Cpp.ref.loc11: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %DeletedConstructor.ref: type = name_ref DeletedConstructor, imports.%DeletedConstructor.decl [concrete = constants.%DeletedConstructor] // CHECK:STDOUT: } // CHECK:STDOUT: %_: %DeletedConstructor = wrapper_binding _, [concrete = ] @@ -839,9 +769,9 @@ fn InitFromStruct() { // CHECK:STDOUT: fn @DeletedConversionTest(%s.param: %DeletedConversion) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %s.ref: %DeletedConversion = name_ref s, %s -// CHECK:STDOUT: %.loc28_21: %Dest.980 = converted %s.ref, [concrete = ] -// CHECK:STDOUT: %.loc28_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] { -// CHECK:STDOUT: %Cpp.ref.loc28: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %.loc20_21: %Dest.980 = converted %s.ref, [concrete = ] +// CHECK:STDOUT: %.loc20_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] { +// CHECK:STDOUT: %Cpp.ref.loc20: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %Dest.ref: type = name_ref Dest, imports.%Dest.decl [concrete = constants.%Dest.980] // CHECK:STDOUT: } // CHECK:STDOUT: %_: %Dest.980 = wrapper_binding _, [concrete = ] @@ -882,9 +812,9 @@ fn InitFromStruct() { // CHECK:STDOUT: fn @ExplicitConstructorTest(%s.param: %Source) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %s.ref: %Source = name_ref s, %s -// CHECK:STDOUT: %.loc15_36: %ExplicitConstructor = converted %s.ref, [concrete = ] -// CHECK:STDOUT: %.loc15_13: type = splice_block %ExplicitConstructor.ref [concrete = constants.%ExplicitConstructor] { -// CHECK:STDOUT: %Cpp.ref.loc15: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %.loc11_36: %ExplicitConstructor = converted %s.ref, [concrete = ] +// CHECK:STDOUT: %.loc11_13: type = splice_block %ExplicitConstructor.ref [concrete = constants.%ExplicitConstructor] { +// CHECK:STDOUT: %Cpp.ref.loc11: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %ExplicitConstructor.ref: type = name_ref ExplicitConstructor, imports.%ExplicitConstructor.decl [concrete = constants.%ExplicitConstructor] // CHECK:STDOUT: } // CHECK:STDOUT: %_: %ExplicitConstructor = wrapper_binding _, [concrete = ] @@ -897,9 +827,9 @@ fn InitFromStruct() { // CHECK:STDOUT: fn @ExplicitConversionTest(%s.param: %ExplicitConversion) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %s.ref: %ExplicitConversion = name_ref s, %s -// CHECK:STDOUT: %.loc28_21: %Dest.980 = converted %s.ref, [concrete = ] -// CHECK:STDOUT: %.loc28_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] { -// CHECK:STDOUT: %Cpp.ref.loc28: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %.loc20_21: %Dest.980 = converted %s.ref, [concrete = ] +// CHECK:STDOUT: %.loc20_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] { +// CHECK:STDOUT: %Cpp.ref.loc20: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %Dest.ref: type = name_ref Dest, imports.%Dest.decl [concrete = constants.%Dest.980] // CHECK:STDOUT: } // CHECK:STDOUT: %_: %Dest.980 = wrapper_binding _, [concrete = ] @@ -1011,9 +941,9 @@ fn InitFromStruct() { // CHECK:STDOUT: %self.patt.f11: %pattern_type.c4e = wrapper_binding_pattern self, %self.param_patt.ab8 [concrete] // CHECK:STDOUT: %IntConstructor.cpp_destructor.type: type = fn_type @IntConstructor.cpp_destructor [concrete] // CHECK:STDOUT: %IntConstructor.cpp_destructor: %IntConstructor.cpp_destructor.type = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef0: type = fn_type @Destroy.WithSelf.Op.loc19 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef0: type = fn_type @Destroy.WithSelf.Op.loc13 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403: %Destroy.WithSelf.Op.type.ef0 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbc: type = fn_type @Destroy.WithSelf.SelfDestruct.loc19 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbc: type = fn_type @Destroy.WithSelf.SelfDestruct.loc13 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3: %Destroy.WithSelf.SelfDestruct.type.fbc = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1036,7 +966,7 @@ fn InitFromStruct() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl: %Destroy.WithSelf.Op.type.ef0 = fn_decl @Destroy.WithSelf.Op.loc19 [concrete = constants.%Destroy.WithSelf.Op.403] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl: %Destroy.WithSelf.Op.type.ef0 = fn_decl @Destroy.WithSelf.Op.loc13 [concrete = constants.%Destroy.WithSelf.Op.403] { // CHECK:STDOUT: %self.param_patt: %pattern_type.c4e = ref_param_pattern [concrete = constants.%self.param_patt.ab8] // CHECK:STDOUT: %self.patt: %pattern_type.c4e = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.f11] // CHECK:STDOUT: } { @@ -1048,31 +978,31 @@ fn InitFromStruct() { // CHECK:STDOUT: fn @IntConstructorTest(%u.param: %u32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %u.ref: %u32 = name_ref u, %u -// CHECK:STDOUT: %.loc19_31.1: ref %IntConstructor = temporary_storage -// CHECK:STDOUT: %.loc19_31.2: %i32 = converted %u.ref, [concrete = ] -// CHECK:STDOUT: %addr: %ptr.100 = addr_of %.loc19_31.1 +// CHECK:STDOUT: %.loc13_31.1: ref %IntConstructor = temporary_storage +// CHECK:STDOUT: %.loc13_31.2: %i32 = converted %u.ref, [concrete = ] +// CHECK:STDOUT: %addr: %ptr.100 = addr_of %.loc13_31.1 // CHECK:STDOUT: %IntConstructor__carbon_thunk.call: init %empty_tuple.type = call imports.%IntConstructor__carbon_thunk.decl(, %addr) -// CHECK:STDOUT: %.loc19_31.3: init %IntConstructor to %.loc19_31.1 = mark_in_place_init %IntConstructor__carbon_thunk.call -// CHECK:STDOUT: %.loc19_31.4: init %IntConstructor = converted %u.ref, %.loc19_31.3 -// CHECK:STDOUT: %.loc19_31.5: ref %IntConstructor = temporary %.loc19_31.1, %.loc19_31.4 -// CHECK:STDOUT: %.loc19_31.6: %IntConstructor = acquire_value %.loc19_31.5 -// CHECK:STDOUT: %.loc19_13: type = splice_block %IntConstructor.ref [concrete = constants.%IntConstructor] { +// CHECK:STDOUT: %.loc13_31.3: init %IntConstructor to %.loc13_31.1 = mark_in_place_init %IntConstructor__carbon_thunk.call +// CHECK:STDOUT: %.loc13_31.4: init %IntConstructor = converted %u.ref, %.loc13_31.3 +// CHECK:STDOUT: %.loc13_31.5: ref %IntConstructor = temporary %.loc13_31.1, %.loc13_31.4 +// CHECK:STDOUT: %.loc13_31.6: %IntConstructor = acquire_value %.loc13_31.5 +// CHECK:STDOUT: %.loc13_13: type = splice_block %IntConstructor.ref [concrete = constants.%IntConstructor] { // CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %IntConstructor.ref: type = name_ref IntConstructor, imports.%IntConstructor.decl [concrete = constants.%IntConstructor] // CHECK:STDOUT: } -// CHECK:STDOUT: %_: %IntConstructor = wrapper_binding _, %.loc19_31.6 +// CHECK:STDOUT: %_: %IntConstructor = wrapper_binding _, %.loc13_31.6 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %_.patt: %pattern_type.c4e = value_binding_pattern _ [concrete = constants.%_.patt.151] // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc19_31.5, constants.%Destroy.WithSelf.SelfDestruct.db3 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc19_31.5) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc13_31.5, constants.%Destroy.WithSelf.SelfDestruct.db3 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc13_31.5) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc19(%self.param: ref %IntConstructor) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc13(%self.param: ref %IntConstructor) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc19(%self.param: ref %IntConstructor) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc13(%self.param: ref %IntConstructor) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl(%self.param) // CHECK:STDOUT: %IntConstructor.cpp_destructor.call: init %empty_tuple.type = call imports.%IntConstructor.cpp_destructor.decl(%self.param) @@ -1444,8 +1374,19 @@ fn InitFromStruct() { // CHECK:STDOUT: // CHECK:STDOUT: fn @InitFromTuple() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_27.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc15_27.2: %Aggregate = converted %.loc15_27.1, [concrete = ] +// CHECK:STDOUT: %.loc11_27.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc11_27.2: %Aggregate = converted %.loc11_27.1, [concrete = ] +// CHECK:STDOUT: %.loc11_13: type = splice_block %Aggregate.ref.loc11 [concrete = constants.%Aggregate] { +// CHECK:STDOUT: %Cpp.ref.loc11: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Aggregate.ref.loc11: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate] +// CHECK:STDOUT: } +// CHECK:STDOUT: %_.loc11: %Aggregate = wrapper_binding _, [concrete = ] +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %_.patt.loc11: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt] +// CHECK:STDOUT: } +// CHECK:STDOUT: %int_1.loc15: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %.loc15_29.1: %tuple.type.985 = tuple_literal (%int_1.loc15) [concrete = constants.%tuple.378] +// CHECK:STDOUT: %.loc15_29.2: %Aggregate = converted %.loc15_29.1, [concrete = ] // CHECK:STDOUT: %.loc15_13: type = splice_block %Aggregate.ref.loc15 [concrete = constants.%Aggregate] { // CHECK:STDOUT: %Cpp.ref.loc15: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %Aggregate.ref.loc15: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate] @@ -1454,28 +1395,17 @@ fn InitFromStruct() { // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %_.patt.loc15: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %int_1.loc23: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %.loc23_29.1: %tuple.type.985 = tuple_literal (%int_1.loc23) [concrete = constants.%tuple.378] -// CHECK:STDOUT: %.loc23_29.2: %Aggregate = converted %.loc23_29.1, [concrete = ] -// CHECK:STDOUT: %.loc23_13: type = splice_block %Aggregate.ref.loc23 [concrete = constants.%Aggregate] { -// CHECK:STDOUT: %Cpp.ref.loc23: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %Aggregate.ref.loc23: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate] -// CHECK:STDOUT: } -// CHECK:STDOUT: %_.loc23: %Aggregate = wrapper_binding _, [concrete = ] -// CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %_.patt.loc23: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt] -// CHECK:STDOUT: } -// CHECK:STDOUT: %int_1.loc31: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %int_1.loc19: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2] -// CHECK:STDOUT: %.loc31_31.1: %tuple.type.f94 = tuple_literal (%int_1.loc31, %int_2) [concrete = constants.%tuple.ad8] -// CHECK:STDOUT: %.loc31_31.2: %Aggregate = converted %.loc31_31.1, [concrete = ] -// CHECK:STDOUT: %.loc31_13: type = splice_block %Aggregate.ref.loc31 [concrete = constants.%Aggregate] { -// CHECK:STDOUT: %Cpp.ref.loc31: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %Aggregate.ref.loc31: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate] +// CHECK:STDOUT: %.loc19_31.1: %tuple.type.f94 = tuple_literal (%int_1.loc19, %int_2) [concrete = constants.%tuple.ad8] +// CHECK:STDOUT: %.loc19_31.2: %Aggregate = converted %.loc19_31.1, [concrete = ] +// CHECK:STDOUT: %.loc19_13: type = splice_block %Aggregate.ref.loc19 [concrete = constants.%Aggregate] { +// CHECK:STDOUT: %Cpp.ref.loc19: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Aggregate.ref.loc19: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate] // CHECK:STDOUT: } -// CHECK:STDOUT: %_.loc31: %Aggregate = wrapper_binding _, [concrete = ] +// CHECK:STDOUT: %_.loc19: %Aggregate = wrapper_binding _, [concrete = ] // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %_.patt.loc31: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt] +// CHECK:STDOUT: %_.patt.loc19: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: } @@ -1507,8 +1437,19 @@ fn InitFromStruct() { // CHECK:STDOUT: // CHECK:STDOUT: fn @InitFromStruct() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_27.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc15_27.2: %Aggregate = converted %.loc15_27.1, [concrete = ] +// CHECK:STDOUT: %.loc11_27.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc11_27.2: %Aggregate = converted %.loc11_27.1, [concrete = ] +// CHECK:STDOUT: %.loc11_13: type = splice_block %Aggregate.ref.loc11 [concrete = constants.%Aggregate] { +// CHECK:STDOUT: %Cpp.ref.loc11: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Aggregate.ref.loc11: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate] +// CHECK:STDOUT: } +// CHECK:STDOUT: %_.loc11: %Aggregate = wrapper_binding _, [concrete = ] +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %_.patt.loc11: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt] +// CHECK:STDOUT: } +// CHECK:STDOUT: %int_1.loc15: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %.loc15_33.1: %struct_type.x = struct_literal (%int_1.loc15) [concrete = constants.%struct.147] +// CHECK:STDOUT: %.loc15_33.2: %Aggregate = converted %.loc15_33.1, [concrete = ] // CHECK:STDOUT: %.loc15_13: type = splice_block %Aggregate.ref.loc15 [concrete = constants.%Aggregate] { // CHECK:STDOUT: %Cpp.ref.loc15: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %Aggregate.ref.loc15: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate] @@ -1517,28 +1458,17 @@ fn InitFromStruct() { // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %_.patt.loc15: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %int_1.loc23: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %.loc23_33.1: %struct_type.x = struct_literal (%int_1.loc23) [concrete = constants.%struct.147] -// CHECK:STDOUT: %.loc23_33.2: %Aggregate = converted %.loc23_33.1, [concrete = ] -// CHECK:STDOUT: %.loc23_13: type = splice_block %Aggregate.ref.loc23 [concrete = constants.%Aggregate] { -// CHECK:STDOUT: %Cpp.ref.loc23: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %Aggregate.ref.loc23: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate] -// CHECK:STDOUT: } -// CHECK:STDOUT: %_.loc23: %Aggregate = wrapper_binding _, [concrete = ] -// CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %_.patt.loc23: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt] -// CHECK:STDOUT: } -// CHECK:STDOUT: %int_1.loc31: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %int_1.loc19: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2] -// CHECK:STDOUT: %.loc31_41.1: %struct_type.x.y = struct_literal (%int_1.loc31, %int_2) [concrete = constants.%struct.004] -// CHECK:STDOUT: %.loc31_41.2: %Aggregate = converted %.loc31_41.1, [concrete = ] -// CHECK:STDOUT: %.loc31_13: type = splice_block %Aggregate.ref.loc31 [concrete = constants.%Aggregate] { -// CHECK:STDOUT: %Cpp.ref.loc31: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %Aggregate.ref.loc31: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate] +// CHECK:STDOUT: %.loc19_41.1: %struct_type.x.y = struct_literal (%int_1.loc19, %int_2) [concrete = constants.%struct.004] +// CHECK:STDOUT: %.loc19_41.2: %Aggregate = converted %.loc19_41.1, [concrete = ] +// CHECK:STDOUT: %.loc19_13: type = splice_block %Aggregate.ref.loc19 [concrete = constants.%Aggregate] { +// CHECK:STDOUT: %Cpp.ref.loc19: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Aggregate.ref.loc19: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate] // CHECK:STDOUT: } -// CHECK:STDOUT: %_.loc31: %Aggregate = wrapper_binding _, [concrete = ] +// CHECK:STDOUT: %_.loc19: %Aggregate = wrapper_binding _, [concrete = ] // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %_.patt.loc31: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt] +// CHECK:STDOUT: %_.patt.loc19: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: } @@ -1754,8 +1684,19 @@ fn InitFromStruct() { // CHECK:STDOUT: // CHECK:STDOUT: fn @InitFromStruct() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_30.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc15_30.2: %NonAggregate = converted %.loc15_30.1, [concrete = ] +// CHECK:STDOUT: %.loc11_30.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc11_30.2: %NonAggregate = converted %.loc11_30.1, [concrete = ] +// CHECK:STDOUT: %.loc11_13: type = splice_block %NonAggregate.ref.loc11 [concrete = constants.%NonAggregate] { +// CHECK:STDOUT: %Cpp.ref.loc11: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %NonAggregate.ref.loc11: type = name_ref NonAggregate, imports.%NonAggregate.decl [concrete = constants.%NonAggregate] +// CHECK:STDOUT: } +// CHECK:STDOUT: %_.loc11: %NonAggregate = wrapper_binding _, [concrete = ] +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %_.patt.loc11: %pattern_type.273 = value_binding_pattern _ [concrete = constants.%_.patt] +// CHECK:STDOUT: } +// CHECK:STDOUT: %int_1.loc15: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %.loc15_36.1: %struct_type.x = struct_literal (%int_1.loc15) [concrete = constants.%struct.147] +// CHECK:STDOUT: %.loc15_36.2: %NonAggregate = converted %.loc15_36.1, [concrete = ] // CHECK:STDOUT: %.loc15_13: type = splice_block %NonAggregate.ref.loc15 [concrete = constants.%NonAggregate] { // CHECK:STDOUT: %Cpp.ref.loc15: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %NonAggregate.ref.loc15: type = name_ref NonAggregate, imports.%NonAggregate.decl [concrete = constants.%NonAggregate] @@ -1764,28 +1705,17 @@ fn InitFromStruct() { // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %_.patt.loc15: %pattern_type.273 = value_binding_pattern _ [concrete = constants.%_.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %int_1.loc23: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %.loc23_36.1: %struct_type.x = struct_literal (%int_1.loc23) [concrete = constants.%struct.147] -// CHECK:STDOUT: %.loc23_36.2: %NonAggregate = converted %.loc23_36.1, [concrete = ] -// CHECK:STDOUT: %.loc23_13: type = splice_block %NonAggregate.ref.loc23 [concrete = constants.%NonAggregate] { -// CHECK:STDOUT: %Cpp.ref.loc23: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %NonAggregate.ref.loc23: type = name_ref NonAggregate, imports.%NonAggregate.decl [concrete = constants.%NonAggregate] -// CHECK:STDOUT: } -// CHECK:STDOUT: %_.loc23: %NonAggregate = wrapper_binding _, [concrete = ] -// CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %_.patt.loc23: %pattern_type.273 = value_binding_pattern _ [concrete = constants.%_.patt] -// CHECK:STDOUT: } -// CHECK:STDOUT: %int_1.loc31: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %int_1.loc19: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2] -// CHECK:STDOUT: %.loc31_44.1: %struct_type.x.y = struct_literal (%int_1.loc31, %int_2) [concrete = constants.%struct.004] -// CHECK:STDOUT: %.loc31_44.2: %NonAggregate = converted %.loc31_44.1, [concrete = ] -// CHECK:STDOUT: %.loc31_13: type = splice_block %NonAggregate.ref.loc31 [concrete = constants.%NonAggregate] { -// CHECK:STDOUT: %Cpp.ref.loc31: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %NonAggregate.ref.loc31: type = name_ref NonAggregate, imports.%NonAggregate.decl [concrete = constants.%NonAggregate] +// CHECK:STDOUT: %.loc19_44.1: %struct_type.x.y = struct_literal (%int_1.loc19, %int_2) [concrete = constants.%struct.004] +// CHECK:STDOUT: %.loc19_44.2: %NonAggregate = converted %.loc19_44.1, [concrete = ] +// CHECK:STDOUT: %.loc19_13: type = splice_block %NonAggregate.ref.loc19 [concrete = constants.%NonAggregate] { +// CHECK:STDOUT: %Cpp.ref.loc19: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %NonAggregate.ref.loc19: type = name_ref NonAggregate, imports.%NonAggregate.decl [concrete = constants.%NonAggregate] // CHECK:STDOUT: } -// CHECK:STDOUT: %_.loc31: %NonAggregate = wrapper_binding _, [concrete = ] +// CHECK:STDOUT: %_.loc19: %NonAggregate = wrapper_binding _, [concrete = ] // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %_.patt.loc31: %pattern_type.273 = value_binding_pattern _ [concrete = constants.%_.patt] +// CHECK:STDOUT: %_.patt.loc19: %pattern_type.273 = value_binding_pattern _ [concrete = constants.%_.patt] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/interop/cpp/macros/invalid.carbon b/toolchain/check/testdata/interop/cpp/macros/invalid.carbon index 6792db395768..0c04c37e2e1a 100644 --- a/toolchain/check/testdata/interop/cpp/macros/invalid.carbon +++ b/toolchain/check/testdata/interop/cpp/macros/invalid.carbon @@ -15,9 +15,7 @@ library "[[@TEST_NAME]]"; import Cpp inline ''' -// CHECK:STDERR: fail_macro_with_error.carbon:[[@LINE+4]]:1: error: unknown type name 'error' [CppInteropParseError] -// CHECK:STDERR: 9 | error has_error; -// CHECK:STDERR: | ^ +// CHECK:STDERR: fail_macro_with_error.carbon:[[@LINE+2]]:1: error: unknown type name 'error' [CppInteropParseError] // CHECK:STDERR: error has_error; #define macro_with_error has_error.member @@ -25,16 +23,10 @@ error has_error; fn F() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_macro_with_error.carbon:[[@LINE+11]]:3: error: failed to parse macro Cpp.macro_with_error to a valid constant expression [InCppMacroEvaluation] - // CHECK:STDERR: Cpp.macro_with_error; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_macro_with_error.carbon:[[@LINE+8]]:3: note: in `Cpp` name lookup for `macro_with_error` [InCppNameLookup] - // CHECK:STDERR: Cpp.macro_with_error; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_macro_with_error.carbon:[[@LINE+5]]:3-22: error: failed to parse macro Cpp.macro_with_error to a valid constant expression [InCppMacroEvaluation] + // CHECK:STDERR: fail_macro_with_error.carbon:[[@LINE+4]]:3-22: note: in `Cpp` name lookup for `macro_with_error` [InCppNameLookup] // CHECK:STDERR: - // CHECK:STDERR: fail_macro_with_error.carbon:[[@LINE+4]]:3: error: member name `macro_with_error` not found in `Cpp` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: Cpp.macro_with_error; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_macro_with_error.carbon:[[@LINE+2]]:3-22: error: member name `macro_with_error` not found in `Cpp` [MemberNameNotFoundInInstScope] // CHECK:STDERR: Cpp.macro_with_error; //@dump-sem-ir-end diff --git a/toolchain/check/testdata/interop/cpp/macros/macros.carbon b/toolchain/check/testdata/interop/cpp/macros/macros.carbon index 36089f6cf307..af8796a12600 100644 --- a/toolchain/check/testdata/interop/cpp/macros/macros.carbon +++ b/toolchain/check/testdata/interop/cpp/macros/macros.carbon @@ -41,7 +41,7 @@ fn F() { } // --- bad_suffix.h -// CHECK:STDERR: ./bad_suffix.h:[[@LINE+1]]:24: in expansion of macro defined here [InCppMacroExpansion] +// CHECK:STDERR: expanded from macro defined at: ./bad_suffix.h:[[@LINE+1]]:24 [InCppMacroExpansion] #define CONFIG_VALUE 42f // --- fail_import_bad_suffix.carbon @@ -51,31 +51,19 @@ library "[[@TEST_NAME]]"; import Cpp library "bad_suffix.h"; fn F() { - // CHECK:STDERR: fail_import_bad_suffix.carbon:[[@LINE+20]]:6: error: invalid digit 'f' in decimal constant [CppInteropParseError] - // CHECK:STDERR: 27 | Cpp.CONFIG_VALUE; - // CHECK:STDERR: | ^ - // CHECK:STDERR: 2 | #define CONFIG_VALUE 42f - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_import_bad_suffix.carbon:[[@LINE+15]]:3: note: in `Cpp` name lookup for `CONFIG_VALUE` [InCppNameLookup] - // CHECK:STDERR: Cpp.CONFIG_VALUE; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_bad_suffix.carbon:[[@LINE+8]]:6: error: invalid digit 'f' in decimal constant [CppInteropParseError] + // CHECK:STDERR: fail_import_bad_suffix.carbon:[[@LINE+7]]:3-18: note: in `Cpp` name lookup for `CONFIG_VALUE` [InCppNameLookup] // CHECK:STDERR: - // CHECK:STDERR: fail_import_bad_suffix.carbon:[[@LINE+11]]:3: error: failed to parse macro Cpp.CONFIG_VALUE to a valid constant expression [InCppMacroEvaluation] - // CHECK:STDERR: Cpp.CONFIG_VALUE; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_bad_suffix.carbon:[[@LINE+8]]:3: note: in `Cpp` name lookup for `CONFIG_VALUE` [InCppNameLookup] - // CHECK:STDERR: Cpp.CONFIG_VALUE; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_bad_suffix.carbon:[[@LINE+5]]:3-18: error: failed to parse macro Cpp.CONFIG_VALUE to a valid constant expression [InCppMacroEvaluation] + // CHECK:STDERR: fail_import_bad_suffix.carbon:[[@LINE+4]]:3-18: note: in `Cpp` name lookup for `CONFIG_VALUE` [InCppNameLookup] // CHECK:STDERR: - // CHECK:STDERR: fail_import_bad_suffix.carbon:[[@LINE+4]]:3: error: member name `CONFIG_VALUE` not found in `Cpp` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: Cpp.CONFIG_VALUE; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_bad_suffix.carbon:[[@LINE+2]]:3-18: error: member name `CONFIG_VALUE` not found in `Cpp` [MemberNameNotFoundInInstScope] // CHECK:STDERR: Cpp.CONFIG_VALUE; } // --- integer_literal_too_big.h -// CHECK:STDERR: ./integer_literal_too_big.h:[[@LINE+1]]:22: in expansion of macro defined here [InCppMacroExpansion] +// CHECK:STDERR: expanded from macro defined at: ./integer_literal_too_big.h:[[@LINE+1]]:22 [InCppMacroExpansion] #define CONFIG_VALUE 18446744073709551616 // --- fail_import_integer_literal_too_big.carbon @@ -85,14 +73,8 @@ library "[[@TEST_NAME]]"; import Cpp library "integer_literal_too_big.h"; fn F() { - // CHECK:STDERR: fail_import_integer_literal_too_big.carbon:[[@LINE+9]]:6: error: integer literal is too large to be represented in any integer type [CppInteropParseError] - // CHECK:STDERR: 16 | Cpp.CONFIG_VALUE; - // CHECK:STDERR: | ^ - // CHECK:STDERR: 2 | #define CONFIG_VALUE 18446744073709551616 - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_import_integer_literal_too_big.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `CONFIG_VALUE` [InCppNameLookup] - // CHECK:STDERR: Cpp.CONFIG_VALUE; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_integer_literal_too_big.carbon:[[@LINE+3]]:6: error: integer literal is too large to be represented in any integer type [CppInteropParseError] + // CHECK:STDERR: fail_import_integer_literal_too_big.carbon:[[@LINE+2]]:3-18: note: in `Cpp` name lookup for `CONFIG_VALUE` [InCppNameLookup] // CHECK:STDERR: Cpp.CONFIG_VALUE; } @@ -104,9 +86,7 @@ library "[[@TEST_NAME]]"; import Cpp library "integer_literal_replacement_token.h"; fn F() { - // CHECK:STDERR: fail_assign_to_object_like_macro.carbon:[[@LINE+4]]:3: error: expression is not assignable [AssignmentToNonAssignable] - // CHECK:STDERR: Cpp.CONFIG_VALUE = 3; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_assign_to_object_like_macro.carbon:[[@LINE+2]]:3-18: error: expression is not assignable [AssignmentToNonAssignable] // CHECK:STDERR: Cpp.CONFIG_VALUE = 3; } @@ -126,9 +106,7 @@ import Cpp library "macro_in_nested_scope.h"; fn F() { let unused a: i32 = Cpp.CONFIG_VALUE; - // CHECK:STDERR: fail_import_macro_in_nested_scope.carbon:[[@LINE+4]]:23: error: member name `CONFIG_VALUE` not found in `Cpp.N` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: let unused b: i32 = Cpp.N.CONFIG_VALUE; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_macro_in_nested_scope.carbon:[[@LINE+2]]:23-40: error: member name `CONFIG_VALUE` not found in `Cpp.N` [MemberNameNotFoundInInstScope] // CHECK:STDERR: let unused b: i32 = Cpp.N.CONFIG_VALUE; } @@ -168,16 +146,10 @@ import Cpp library "no_replacement_token.h"; fn F() { // TODO: Get rid of the second error. - // CHECK:STDERR: fail_import_no_replacement_token.carbon:[[@LINE+11]]:3: error: semantics TODO: `Unsupported: macro with 0 replacement tokens` [SemanticsTodo] - // CHECK:STDERR: Cpp.MACRO_NAME; - // CHECK:STDERR: ^~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_no_replacement_token.carbon:[[@LINE+8]]:3: note: in `Cpp` name lookup for `MACRO_NAME` [InCppNameLookup] - // CHECK:STDERR: Cpp.MACRO_NAME; - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_no_replacement_token.carbon:[[@LINE+5]]:3-16: error: semantics TODO: `Unsupported: macro with 0 replacement tokens` [SemanticsTodo] + // CHECK:STDERR: fail_import_no_replacement_token.carbon:[[@LINE+4]]:3-16: note: in `Cpp` name lookup for `MACRO_NAME` [InCppNameLookup] // CHECK:STDERR: - // CHECK:STDERR: fail_import_no_replacement_token.carbon:[[@LINE+4]]:3: error: member name `MACRO_NAME` not found in `Cpp` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: Cpp.MACRO_NAME; - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_no_replacement_token.carbon:[[@LINE+2]]:3-16: error: member name `MACRO_NAME` not found in `Cpp` [MemberNameNotFoundInInstScope] // CHECK:STDERR: Cpp.MACRO_NAME; } @@ -292,40 +264,22 @@ library "[[@TEST_NAME]]"; import Cpp library "unsupported_string_literal_types.h"; fn F() { - // CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+11]]:2: error: semantics TODO: `Unsupported: string literal type: const char16_t[6]` [SemanticsTodo] - // CHECK:STDERR: Cpp.Utf16Greeting; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+8]]:2: note: in `Cpp` name lookup for `Utf16Greeting` [InCppNameLookup] - // CHECK:STDERR: Cpp.Utf16Greeting; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+5]]:2-18: error: semantics TODO: `Unsupported: string literal type: const char16_t[6]` [SemanticsTodo] + // CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+4]]:2-18: note: in `Cpp` name lookup for `Utf16Greeting` [InCppNameLookup] // CHECK:STDERR: - // CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+4]]:2: error: member name `Utf16Greeting` not found in `Cpp` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: Cpp.Utf16Greeting; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+2]]:2-18: error: member name `Utf16Greeting` not found in `Cpp` [MemberNameNotFoundInInstScope] // CHECK:STDERR: Cpp.Utf16Greeting; - // CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+11]]:2: error: semantics TODO: `Unsupported: string literal type: const char32_t[6]` [SemanticsTodo] - // CHECK:STDERR: Cpp.Utf32Greeting; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+8]]:2: note: in `Cpp` name lookup for `Utf32Greeting` [InCppNameLookup] - // CHECK:STDERR: Cpp.Utf32Greeting; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+5]]:2-18: error: semantics TODO: `Unsupported: string literal type: const char32_t[6]` [SemanticsTodo] + // CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+4]]:2-18: note: in `Cpp` name lookup for `Utf32Greeting` [InCppNameLookup] // CHECK:STDERR: - // CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+4]]:2: error: member name `Utf32Greeting` not found in `Cpp` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: Cpp.Utf32Greeting; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+2]]:2-18: error: member name `Utf32Greeting` not found in `Cpp` [MemberNameNotFoundInInstScope] // CHECK:STDERR: Cpp.Utf32Greeting; - // CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+11]]:2: error: semantics TODO: `Unsupported: string literal type: const wchar_t[6]` [SemanticsTodo] - // CHECK:STDERR: Cpp.WideGreeting; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+8]]:2: note: in `Cpp` name lookup for `WideGreeting` [InCppNameLookup] - // CHECK:STDERR: Cpp.WideGreeting; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+5]]:2-17: error: semantics TODO: `Unsupported: string literal type: const wchar_t[6]` [SemanticsTodo] + // CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+4]]:2-17: note: in `Cpp` name lookup for `WideGreeting` [InCppNameLookup] // CHECK:STDERR: - // CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+4]]:2: error: member name `WideGreeting` not found in `Cpp` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: Cpp.WideGreeting; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+2]]:2-17: error: member name `WideGreeting` not found in `Cpp` [MemberNameNotFoundInInstScope] // CHECK:STDERR: Cpp.WideGreeting; } @@ -339,16 +293,10 @@ import Cpp inline ''' '''; fn F() { - // CHECK:STDERR: fail_bad_string.carbon:[[@LINE+11]]:2: error: failed to parse macro Cpp.BadString to a valid constant expression [InCppMacroEvaluation] - // CHECK:STDERR: Cpp.BadString; - // CHECK:STDERR: ^~~~~~~~~~~~~ - // CHECK:STDERR: fail_bad_string.carbon:[[@LINE+8]]:2: note: in `Cpp` name lookup for `BadString` [InCppNameLookup] - // CHECK:STDERR: Cpp.BadString; - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_bad_string.carbon:[[@LINE+5]]:2-14: error: failed to parse macro Cpp.BadString to a valid constant expression [InCppMacroEvaluation] + // CHECK:STDERR: fail_bad_string.carbon:[[@LINE+4]]:2-14: note: in `Cpp` name lookup for `BadString` [InCppNameLookup] // CHECK:STDERR: - // CHECK:STDERR: fail_bad_string.carbon:[[@LINE+4]]:2: error: member name `BadString` not found in `Cpp` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: Cpp.BadString; - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_bad_string.carbon:[[@LINE+2]]:2-14: error: member name `BadString` not found in `Cpp` [MemberNameNotFoundInInstScope] // CHECK:STDERR: Cpp.BadString; } @@ -382,16 +330,10 @@ library "[[@TEST_NAME]]"; import Cpp library "unsupported_floating_point_literal_macro.h"; fn F() { - // CHECK:STDERR: fail_import_unsupported_floating_point_literal_macro.carbon:[[@LINE+11]]:3: error: semantics TODO: `Unsupported: macro evaluated to a constant of type: long double` [SemanticsTodo] - // CHECK:STDERR: Cpp.MyLongDouble; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_unsupported_floating_point_literal_macro.carbon:[[@LINE+8]]:3: note: in `Cpp` name lookup for `MyLongDouble` [InCppNameLookup] - // CHECK:STDERR: Cpp.MyLongDouble; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_unsupported_floating_point_literal_macro.carbon:[[@LINE+5]]:3-18: error: semantics TODO: `Unsupported: macro evaluated to a constant of type: long double` [SemanticsTodo] + // CHECK:STDERR: fail_import_unsupported_floating_point_literal_macro.carbon:[[@LINE+4]]:3-18: note: in `Cpp` name lookup for `MyLongDouble` [InCppNameLookup] // CHECK:STDERR: - // CHECK:STDERR: fail_import_unsupported_floating_point_literal_macro.carbon:[[@LINE+4]]:3: error: member name `MyLongDouble` not found in `Cpp` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: Cpp.MyLongDouble; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_unsupported_floating_point_literal_macro.carbon:[[@LINE+2]]:3-18: error: member name `MyLongDouble` not found in `Cpp` [MemberNameNotFoundInInstScope] // CHECK:STDERR: Cpp.MyLongDouble; } @@ -403,9 +345,7 @@ library "[[@TEST_NAME]]"; import Cpp library "floating_point_literal_macro.h"; fn F() { - // CHECK:STDERR: fail_import_assign_to_float.carbon:[[@LINE+4]]:3: error: expression is not assignable [AssignmentToNonAssignable] - // CHECK:STDERR: Cpp.MyDouble = 1.0; - // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_import_assign_to_float.carbon:[[@LINE+2]]:3-14: error: expression is not assignable [AssignmentToNonAssignable] // CHECK:STDERR: Cpp.MyDouble = 1.0; } @@ -458,7 +398,7 @@ fn F() { // --- multiple_characters.h -// CHECK:STDERR: ./multiple_characters.h:[[@LINE+1]]:24: in expansion of macro defined here [InCppMacroExpansion] +// CHECK:STDERR: expanded from macro defined at: ./multiple_characters.h:[[@LINE+1]]:24 [InCppMacroExpansion] #define MULTIPLE_CHARS 'AB' // --- import_multiple_characters.carbon @@ -468,14 +408,8 @@ library "[[@TEST_NAME]]"; import Cpp library "multiple_characters.h"; fn F() { - // CHECK:STDERR: import_multiple_characters.carbon:[[@LINE+9]]:25: warning: multi-character character constant [CppInteropParseWarning] - // CHECK:STDERR: 16 | let unused a: i32 = Cpp.MULTIPLE_CHARS; - // CHECK:STDERR: | ^ - // CHECK:STDERR: 3 | #define MULTIPLE_CHARS 'AB' - // CHECK:STDERR: | ^ - // CHECK:STDERR: import_multiple_characters.carbon:[[@LINE+4]]:22: note: in `Cpp` name lookup for `MULTIPLE_CHARS` [InCppNameLookup] - // CHECK:STDERR: let unused a: i32 = Cpp.MULTIPLE_CHARS; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: import_multiple_characters.carbon:[[@LINE+3]]:25: warning: multi-character character constant [CppInteropParseWarning] + // CHECK:STDERR: import_multiple_characters.carbon:[[@LINE+2]]:22-39: note: in `Cpp` name lookup for `MULTIPLE_CHARS` [InCppNameLookup] // CHECK:STDERR: let unused a: i32 = Cpp.MULTIPLE_CHARS; } @@ -493,40 +427,22 @@ library "[[@TEST_NAME]]"; import Cpp library "unsupported_character_literal_types.h"; fn F() { - // CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+11]]:23: error: semantics TODO: `Unsupported: macro evaluated to a constant of type: char16_t` [SemanticsTodo] - // CHECK:STDERR: let unused a: char = Cpp.M_UTF16_CHAR; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+8]]:23: note: in `Cpp` name lookup for `M_UTF16_CHAR` [InCppNameLookup] - // CHECK:STDERR: let unused a: char = Cpp.M_UTF16_CHAR; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+5]]:23-38: error: semantics TODO: `Unsupported: macro evaluated to a constant of type: char16_t` [SemanticsTodo] + // CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+4]]:23-38: note: in `Cpp` name lookup for `M_UTF16_CHAR` [InCppNameLookup] // CHECK:STDERR: - // CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+4]]:23: error: member name `M_UTF16_CHAR` not found in `Cpp` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: let unused a: char = Cpp.M_UTF16_CHAR; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+2]]:23-38: error: member name `M_UTF16_CHAR` not found in `Cpp` [MemberNameNotFoundInInstScope] // CHECK:STDERR: let unused a: char = Cpp.M_UTF16_CHAR; - // CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+11]]:23: error: semantics TODO: `Unsupported: macro evaluated to a constant of type: char32_t` [SemanticsTodo] - // CHECK:STDERR: let unused b: char = Cpp.M_UTF32_CHAR; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+8]]:23: note: in `Cpp` name lookup for `M_UTF32_CHAR` [InCppNameLookup] - // CHECK:STDERR: let unused b: char = Cpp.M_UTF32_CHAR; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+5]]:23-38: error: semantics TODO: `Unsupported: macro evaluated to a constant of type: char32_t` [SemanticsTodo] + // CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+4]]:23-38: note: in `Cpp` name lookup for `M_UTF32_CHAR` [InCppNameLookup] // CHECK:STDERR: - // CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+4]]:23: error: member name `M_UTF32_CHAR` not found in `Cpp` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: let unused b: char = Cpp.M_UTF32_CHAR; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+2]]:23-38: error: member name `M_UTF32_CHAR` not found in `Cpp` [MemberNameNotFoundInInstScope] // CHECK:STDERR: let unused b: char = Cpp.M_UTF32_CHAR; - // CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+11]]:23: error: semantics TODO: `Unsupported: macro evaluated to a constant of type: wchar_t` [SemanticsTodo] - // CHECK:STDERR: let unused c: char = Cpp.M_WIDE_CHAR; - // CHECK:STDERR: ^~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+8]]:23: note: in `Cpp` name lookup for `M_WIDE_CHAR` [InCppNameLookup] - // CHECK:STDERR: let unused c: char = Cpp.M_WIDE_CHAR; - // CHECK:STDERR: ^~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+5]]:23-37: error: semantics TODO: `Unsupported: macro evaluated to a constant of type: wchar_t` [SemanticsTodo] + // CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+4]]:23-37: note: in `Cpp` name lookup for `M_WIDE_CHAR` [InCppNameLookup] // CHECK:STDERR: - // CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+4]]:23: error: member name `M_WIDE_CHAR` not found in `Cpp` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: let unused c: char = Cpp.M_WIDE_CHAR; - // CHECK:STDERR: ^~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+2]]:23-37: error: member name `M_WIDE_CHAR` not found in `Cpp` [MemberNameNotFoundInInstScope] // CHECK:STDERR: let unused c: char = Cpp.M_WIDE_CHAR; } @@ -538,9 +454,7 @@ library "[[@TEST_NAME]]"; import Cpp library "character_literals.h"; fn F() { - // CHECK:STDERR: fail_assign_to_character_literals.carbon:[[@LINE+4]]:2: error: expression is not assignable [AssignmentToNonAssignable] - // CHECK:STDERR: Cpp.M_LOWERCASE = 'b'; - // CHECK:STDERR: ^~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_assign_to_character_literals.carbon:[[@LINE+2]]:2-16: error: expression is not assignable [AssignmentToNonAssignable] // CHECK:STDERR: Cpp.M_LOWERCASE = 'b'; } @@ -592,9 +506,7 @@ library "[[@TEST_NAME]]"; import Cpp library "boolean_literal_macro.h"; fn F() { - // CHECK:STDERR: fail_assign_to_boolean_literal_macro.carbon:[[@LINE+4]]:2: error: expression is not assignable [AssignmentToNonAssignable] - // CHECK:STDERR: Cpp.M_TRUE = false; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_assign_to_boolean_literal_macro.carbon:[[@LINE+2]]:2-11: error: expression is not assignable [AssignmentToNonAssignable] // CHECK:STDERR: Cpp.M_TRUE = false; } @@ -738,9 +650,7 @@ library "[[@TEST_NAME]]"; import Cpp library "macro_undefined.h"; fn F() { - // CHECK:STDERR: fail_macro_undefined.carbon:[[@LINE+4]]:23: error: member name `UNDEF_VALUE` not found in `Cpp` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: let unused a: i32 = Cpp.UNDEF_VALUE; - // CHECK:STDERR: ^~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_macro_undefined.carbon:[[@LINE+2]]:23-37: error: member name `UNDEF_VALUE` not found in `Cpp` [MemberNameNotFoundInInstScope] // CHECK:STDERR: let unused a: i32 = Cpp.UNDEF_VALUE; } @@ -773,14 +683,9 @@ fn F() { library "[[@TEST_NAME]]"; -// CHECK:STDERR: import_macro_defined_twice.carbon:[[@LINE+9]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: import_macro_defined_twice.carbon:[[@LINE+4]]:10 [InCppInclude] // CHECK:STDERR: ./macro_defined_twice.h:3:9: warning: 'TWICE_DEF' macro redefined [CppInteropParseWarning] -// CHECK:STDERR: 3 | #define TWICE_DEF 2 -// CHECK:STDERR: | ^ -// CHECK:STDERR: import_macro_defined_twice.carbon:[[@LINE+5]]:10: in file included here [InCppInclude] // CHECK:STDERR: ./macro_defined_twice.h:2:9: note: previous definition is here [CppInteropParseNote] -// CHECK:STDERR: 2 | #define TWICE_DEF 1 -// CHECK:STDERR: | ^ // CHECK:STDERR: import Cpp library "macro_defined_twice.h"; @@ -805,9 +710,7 @@ library "[[@TEST_NAME]]"; import Cpp library "function_like_macros.h"; fn F() { - // CHECK:STDERR: fail_todo_import_function_like_macros.carbon:[[@LINE+4]]:23: error: member name `MAX` not found in `Cpp` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: let unused a: i32 = Cpp.MAX(1,2); - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_todo_import_function_like_macros.carbon:[[@LINE+2]]:23-29: error: member name `MAX` not found in `Cpp` [MemberNameNotFoundInInstScope] // CHECK:STDERR: let unused a: i32 = Cpp.MAX(1,2); } @@ -827,9 +730,7 @@ library "[[@TEST_NAME]]"; import Cpp library "predefined_macros.h"; fn F() { - // CHECK:STDERR: fail_todo_import_predefined_macros.carbon:[[@LINE+4]]:30: error: member name `__LINE__` not found in `Cpp` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: let unused line_num: i32 = Cpp.__LINE__; - // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_import_predefined_macros.carbon:[[@LINE+2]]:30-41: error: member name `__LINE__` not found in `Cpp` [MemberNameNotFoundInInstScope] // CHECK:STDERR: let unused line_num: i32 = Cpp.__LINE__; } @@ -854,9 +755,7 @@ library "[[@TEST_NAME]]"; import Cpp library "header_guard_macros.h"; fn F() { - // CHECK:STDERR: fail_import_header_guard_macros.carbon:[[@LINE+4]]:3: error: member name `HEADER_GUARD_MACRO_H_` not found in `Cpp` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: Cpp.HEADER_GUARD_MACRO_H_; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_header_guard_macros.carbon:[[@LINE+2]]:3-27: error: member name `HEADER_GUARD_MACRO_H_` not found in `Cpp` [MemberNameNotFoundInInstScope] // CHECK:STDERR: Cpp.HEADER_GUARD_MACRO_H_; } @@ -934,19 +833,11 @@ Struct s; '''; fn F() { - // CHECK:STDERR: fail_todo_assign_array.carbon:[[@LINE+14]]:3: error: semantics TODO: `lvalue path contains an array type` [SemanticsTodo] - // CHECK:STDERR: Cpp.m = 2; - // CHECK:STDERR: ^~~~~ - // CHECK:STDERR: fail_todo_assign_array.carbon:[[@LINE+11]]:3: note: in `Cpp` name lookup for `m` [InCppNameLookup] - // CHECK:STDERR: Cpp.m = 2; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_todo_assign_array.carbon:[[@LINE+6]]:3-7: error: semantics TODO: `lvalue path contains an array type` [SemanticsTodo] + // CHECK:STDERR: fail_todo_assign_array.carbon:[[@LINE+5]]:3-7: note: in `Cpp` name lookup for `m` [InCppNameLookup] // CHECK:STDERR: - // CHECK:STDERR: fail_todo_assign_array.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Core.IntLiteral` to `array(i32, 3)` [ConversionFailure] - // CHECK:STDERR: Cpp.m = 2; - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_todo_assign_array.carbon:[[@LINE+4]]:3: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(array(i32, 3))` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: Cpp.m = 2; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_todo_assign_array.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `Core.IntLiteral` to `array(i32, 3)` [ConversionFailure] + // CHECK:STDERR: fail_todo_assign_array.carbon:[[@LINE+2]]:3-11: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(array(i32, 3))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: Cpp.m = 2; } @@ -964,16 +855,10 @@ struct DerivedB : BaseA {} b_obj; '''; fn F() { - // CHECK:STDERR: fail_todo_assign_base_class_member.carbon:[[@LINE+11]]:3: error: semantics TODO: `lvalue path contains a base class subobject` [SemanticsTodo] - // CHECK:STDERR: Cpp.m = 2; - // CHECK:STDERR: ^~~~~ - // CHECK:STDERR: fail_todo_assign_base_class_member.carbon:[[@LINE+8]]:3: note: in `Cpp` name lookup for `m` [InCppNameLookup] - // CHECK:STDERR: Cpp.m = 2; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_todo_assign_base_class_member.carbon:[[@LINE+5]]:3-7: error: semantics TODO: `lvalue path contains a base class subobject` [SemanticsTodo] + // CHECK:STDERR: fail_todo_assign_base_class_member.carbon:[[@LINE+4]]:3-7: note: in `Cpp` name lookup for `m` [InCppNameLookup] // CHECK:STDERR: - // CHECK:STDERR: fail_todo_assign_base_class_member.carbon:[[@LINE+4]]:3: error: member name `m` not found in `Cpp` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: Cpp.m = 2; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_todo_assign_base_class_member.carbon:[[@LINE+2]]:3-7: error: member name `m` not found in `Cpp` [MemberNameNotFoundInInstScope] // CHECK:STDERR: Cpp.m = 2; } @@ -2283,7 +2168,7 @@ let _: C(1) = {} as C(Cpp.COUNT); // CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: // CHECK:STDOUT: %TWICE_DEF.ref: %i32 = name_ref TWICE_DEF, constants.%int_2 [concrete = constants.%int_2] -// CHECK:STDOUT: %i32.loc17: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc12: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %a: %i32 = wrapper_binding a, %TWICE_DEF.ref // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %a.patt: %pattern_type.d94 = value_binding_pattern a [concrete = constants.%a.patt] diff --git a/toolchain/check/testdata/interop/cpp/namespace/import.carbon b/toolchain/check/testdata/interop/cpp/namespace/import.carbon index d408fc25bda3..bd8bbdbe55d5 100644 --- a/toolchain/check/testdata/interop/cpp/namespace/import.carbon +++ b/toolchain/check/testdata/interop/cpp/namespace/import.carbon @@ -40,9 +40,7 @@ library "[[@TEST_NAME]]"; import Cpp library "single.h"; fn MyF() { - // CHECK:STDERR: fail_import_namespace_wrong_member_name.carbon:[[@LINE+4]]:3: error: member name `not_foo` not found in `Cpp.my_namespace` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: Cpp.my_namespace.not_foo(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_namespace_wrong_member_name.carbon:[[@LINE+2]]:3-26: error: member name `not_foo` not found in `Cpp.my_namespace` [MemberNameNotFoundInInstScope] // CHECK:STDERR: Cpp.my_namespace.not_foo(); } @@ -54,9 +52,7 @@ library "[[@TEST_NAME]]"; import Cpp library "single.h"; fn MyF() { - // CHECK:STDERR: fail_import_namespace_wrong_name.carbon:[[@LINE+4]]:3: error: member name `not_my_namespace` not found in `Cpp` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: Cpp.not_my_namespace.foo(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_namespace_wrong_name.carbon:[[@LINE+2]]:3-22: error: member name `not_my_namespace` not found in `Cpp` [MemberNameNotFoundInInstScope] // CHECK:STDERR: Cpp.not_my_namespace.foo(); } @@ -132,24 +128,15 @@ fn MyF() { // file split. // TODO: Pass a location into Clang when performing C++ name lookup so that // its error has a location attached. - // CHECK:STDERR: fail_import_inline_ambiguity.carbon:[[@LINE+13]]:3: error: name `error` not found [NameNotFound] - // CHECK:STDERR: error; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_import_inline_ambiguity.carbon:[[@LINE+6]]:3-7: error: name `error` not found [NameNotFound] // CHECK:STDERR: // CHECK:STDERR: error: reference to 'N' is ambiguous [CppInteropParseError] - // CHECK:STDERR: fail_import_inline_ambiguity.carbon:[[@LINE-13]]:10: in file included here [InCppInclude] + // CHECK:STDERR: included from: fail_import_inline_ambiguity.carbon:[[@LINE-11]]:10 [InCppInclude] // CHECK:STDERR: ./inline_ambiguity.h:2:11: note: candidate found by name lookup is 'N' [CppInteropParseNote] - // CHECK:STDERR: 2 | namespace N { void foo(); } - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_import_inline_ambiguity.carbon:[[@LINE-17]]:10: in file included here [InCppInclude] // CHECK:STDERR: ./inline_ambiguity.h:3:30: note: candidate found by name lookup is '(anonymous namespace)::N' [CppInteropParseNote] - // CHECK:STDERR: 3 | inline namespace { namespace N {} } - // CHECK:STDERR: | ^ error; - // CHECK:STDERR: fail_import_inline_ambiguity.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `N` [InCppNameLookup] - // CHECK:STDERR: Cpp.N.foo(); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_import_inline_ambiguity.carbon:[[@LINE+2]]:3-7: note: in `Cpp` name lookup for `N` [InCppNameLookup] // CHECK:STDERR: Cpp.N.foo(); } @@ -191,9 +178,7 @@ library "[[@TEST_NAME]]"; import Cpp library "special_name.h"; fn MyF() { - // CHECK:STDERR: fail_import_special_name_call_unescpaed.carbon:[[@LINE+4]]:3: error: member name `base` not found in `Cpp` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: Cpp.base.foo(); - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_import_special_name_call_unescpaed.carbon:[[@LINE+2]]:3-10: error: member name `base` not found in `Cpp` [MemberNameNotFoundInInstScope] // CHECK:STDERR: Cpp.base.foo(); } @@ -256,12 +241,10 @@ fn CallFoo() { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_indirect_namespace_no_import.carbon:[[@LINE+8]]:1: in import [InImport] -// CHECK:STDERR: namespace_alias.carbon:4:1: error: semantics TODO: `indirect import of C++ declaration with no direct Cpp import` [SemanticsTodo] -// CHECK:STDERR: import Cpp library "single.h"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: imported from: fail_indirect_namespace_no_import.carbon:[[@LINE+6]]:1 [InImport] +// CHECK:STDERR: namespace_alias.carbon:4:1-30: error: semantics TODO: `indirect import of C++ declaration with no direct Cpp import` [SemanticsTodo] // CHECK:STDERR: -// CHECK:STDERR: fail_indirect_namespace_no_import.carbon:[[@LINE+3]]:1: in import [InImport] +// CHECK:STDERR: imported from: fail_indirect_namespace_no_import.carbon:[[@LINE+3]]:1 [InImport] // CHECK:STDERR: namespace_alias.carbon: error: semantics TODO: `indirect import of C++ declaration with no direct Cpp import` [SemanticsTodo] // CHECK:STDERR: import library "namespace_alias"; @@ -269,15 +252,11 @@ import library "namespace_alias"; fn F() { // Imports are not implicitly re-exported, so lookup is expected to fail, // regardless of whether a lookup was performed in the imported file. - // CHECK:STDERR: fail_indirect_namespace_no_import.carbon:[[@LINE+4]]:3: error: member name `foo` not found in `Cpp.my_namespace` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: MyNamespaceAlias.foo(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_indirect_namespace_no_import.carbon:[[@LINE+2]]:3-22: error: member name `foo` not found in `Cpp.my_namespace` [MemberNameNotFoundInInstScope] // CHECK:STDERR: MyNamespaceAlias.foo(); - // CHECK:STDERR: fail_indirect_namespace_no_import.carbon:[[@LINE+4]]:3: error: member name `bar` not found in `Cpp.my_namespace` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: MyNamespaceAlias.bar(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_indirect_namespace_no_import.carbon:[[@LINE+2]]:3-22: error: member name `bar` not found in `Cpp.my_namespace` [MemberNameNotFoundInInstScope] // CHECK:STDERR: MyNamespaceAlias.bar(); } @@ -286,7 +265,7 @@ fn F() { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_indirect_namespace_no_local_decl.carbon:[[@LINE+3]]:1: in import [InImport] +// CHECK:STDERR: imported from: fail_indirect_namespace_no_local_decl.carbon:[[@LINE+3]]:1 [InImport] // CHECK:STDERR: namespace_alias.carbon: error: semantics TODO: `use of imported C++ declaration with no corresponding local import` [SemanticsTodo] // CHECK:STDERR: import library "namespace_alias"; @@ -295,15 +274,11 @@ import Cpp; fn F() { // Imports are not implicitly re-exported, so name lookup is expected to // fail, regardless of whether a lookup was performed in the imported file. - // CHECK:STDERR: fail_indirect_namespace_no_local_decl.carbon:[[@LINE+4]]:3: error: member name `foo` not found in `Cpp.my_namespace` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: MyNamespaceAlias.foo(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_indirect_namespace_no_local_decl.carbon:[[@LINE+2]]:3-22: error: member name `foo` not found in `Cpp.my_namespace` [MemberNameNotFoundInInstScope] // CHECK:STDERR: MyNamespaceAlias.foo(); - // CHECK:STDERR: fail_indirect_namespace_no_local_decl.carbon:[[@LINE+4]]:3: error: member name `bar` not found in `Cpp.my_namespace` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: MyNamespaceAlias.bar(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_indirect_namespace_no_local_decl.carbon:[[@LINE+2]]:3-22: error: member name `bar` not found in `Cpp.my_namespace` [MemberNameNotFoundInInstScope] // CHECK:STDERR: MyNamespaceAlias.bar(); } @@ -337,9 +312,7 @@ namespace my_namespace { fn F() { // Cpp imports are not implicitly re-exported, so name lookup is expected to // fail. - // CHECK:STDERR: fail_indirect_namespace_different_contents_invalid.carbon:[[@LINE+4]]:3: error: member name `foo` not found in `Cpp.my_namespace` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: MyNamespaceAlias.foo(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_indirect_namespace_different_contents_invalid.carbon:[[@LINE+2]]:3-22: error: member name `foo` not found in `Cpp.my_namespace` [MemberNameNotFoundInInstScope] // CHECK:STDERR: MyNamespaceAlias.foo(); } diff --git a/toolchain/check/testdata/interop/cpp/namespace/lookup_after_failure.carbon b/toolchain/check/testdata/interop/cpp/namespace/lookup_after_failure.carbon index 397df727f836..70d71239dea8 100644 --- a/toolchain/check/testdata/interop/cpp/namespace/lookup_after_failure.carbon +++ b/toolchain/check/testdata/interop/cpp/namespace/lookup_after_failure.carbon @@ -28,24 +28,16 @@ using namespace Carbon::N; // Unqualified lookups search `Carbon` and `Carbon::N` (failing there without // triggering typo correction) and resolve to `Fallback`. -// CHECK:STDERR: fail_negative_lookup_via_using_directive.carbon:[[@LINE+3]]:9: error: name `LaterFn` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: int a = LaterFn(); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_negative_lookup_via_using_directive.carbon:[[@LINE+1]]:9: error: name `LaterFn` used before it was declared [NameUseBeforeDecl] int a = LaterFn(); int b = LaterNestedFn(); '''; -// CHECK:STDERR: fail_negative_lookup_via_using_directive.carbon:[[@LINE+7]]:4: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: fn LaterFn() -> i32 { return 3; } -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_negative_lookup_via_using_directive.carbon:[[@LINE+3]]:4-10: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: -// CHECK:STDERR: fail_negative_lookup_via_using_directive.carbon:[[@LINE-7]]:9: error: name `LaterNestedFn` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: int b = LaterNestedFn(); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_negative_lookup_via_using_directive.carbon:[[@LINE-5]]:9: error: name `LaterNestedFn` used before it was declared [NameUseBeforeDecl] fn LaterFn() -> i32 { return 3; } -// CHECK:STDERR: fail_negative_lookup_via_using_directive.carbon:[[@LINE+4]]:6: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: fn N.LaterNestedFn() -> i32 { return 4; } -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_negative_lookup_via_using_directive.carbon:[[@LINE+2]]:6-18: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: fn N.LaterNestedFn() -> i32 { return 4; } @@ -71,36 +63,24 @@ inline Cpp ''' Carbon::ExportedType* p1 = nullptr; void TestTypoInCarbon() { - // CHECK:STDERR: fail_typo_in_carbon_namespace.carbon:[[@LINE+4]]:11: error: no member named 'NoSuchDecl' in namespace 'Carbon' [CppInteropParseError] - // CHECK:STDERR: 19 | Carbon::NoSuchDecl(); - // CHECK:STDERR: | ^~~~~~~~~~ + // CHECK:STDERR: fail_typo_in_carbon_namespace.carbon:[[@LINE+2]]:11-20: error: no member named 'NoSuchDecl' in namespace 'Carbon' [CppInteropParseError] // CHECK:STDERR: Carbon::NoSuchDecl(); - // CHECK:STDERR: fail_typo_in_carbon_namespace.carbon:[[@LINE+8]]:11: error: no type named 'ExportedTyp' in namespace 'Carbon'; did you mean 'ExportedType'? [CppInteropParseError] - // CHECK:STDERR: 28 | Carbon::ExportedTyp* p_typo = p1; - // CHECK:STDERR: | ~~~~~~~~^~~~~~~~~~~ - // CHECK:STDERR: | ExportedType - // CHECK:STDERR: fail_typo_in_carbon_namespace.carbon:[[@LINE-19]]:20: note: 'ExportedType' declared here [CppInteropParseNote] - // CHECK:STDERR: 5 | class ExportedType { - // CHECK:STDERR: | ^ + // CHECK:STDERR: fail_typo_in_carbon_namespace.carbon:[[@LINE+4]]:11: error: no type named 'ExportedTyp' in namespace 'Carbon'; did you mean 'ExportedType'? [CppInteropParseError] + // CHECK:STDERR: fail_typo_in_carbon_namespace.carbon:[[@LINE+3]]:11-21: note: replace with `ExportedType` [CppInteropFixItReplacement] + // CHECK:STDERR: fail_typo_in_carbon_namespace.carbon:[[@LINE-15]]:20: note: 'ExportedType' declared here [CppInteropParseNote] // CHECK:STDERR: Carbon::ExportedTyp* p_typo = p1; - // CHECK:STDERR: fail_typo_in_carbon_namespace.carbon:[[@LINE+7]]:11: error: no member named 'LaterDeclared' in namespace 'Carbon' [CppInteropParseError] - // CHECK:STDERR: 36 | Carbon::LaterDeclared(); - // CHECK:STDERR: | ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_typo_in_carbon_namespace.carbon:[[@LINE+3]]:11-23: error: no member named 'LaterDeclared' in namespace 'Carbon' [CppInteropParseError] // CHECK:STDERR: - // CHECK:STDERR: fail_typo_in_carbon_namespace.carbon:[[@LINE+3]]:11: error: name `LaterDeclared` used before it was declared [NameUseBeforeDecl] - // CHECK:STDERR: Carbon::LaterDeclared(); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_typo_in_carbon_namespace.carbon:[[@LINE+1]]:11: error: name `LaterDeclared` used before it was declared [NameUseBeforeDecl] Carbon::LaterDeclared(); Carbon::EarlyFn(); Carbon::ExportedType* p2 = p1; } '''; -// CHECK:STDERR: fail_typo_in_carbon_namespace.carbon:[[@LINE+4]]:4: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: fn LaterDeclared() -> i32 { return 42; } -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_typo_in_carbon_namespace.carbon:[[@LINE+2]]:4-16: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: fn LaterDeclared() -> i32 { return 42; } @@ -126,21 +106,15 @@ fn Nested.EarlyFn() {} inline Cpp ''' void TestTypoInNested() { - // CHECK:STDERR: fail_typo_in_nested_namespace.carbon:[[@LINE+7]]:19: error: no member named 'LaterInNested' in namespace 'Carbon::Nested' [CppInteropParseError] - // CHECK:STDERR: 17 | Carbon::Nested::LaterInNested(); - // CHECK:STDERR: | ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_typo_in_nested_namespace.carbon:[[@LINE+3]]:19-31: error: no member named 'LaterInNested' in namespace 'Carbon::Nested' [CppInteropParseError] // CHECK:STDERR: - // CHECK:STDERR: fail_typo_in_nested_namespace.carbon:[[@LINE+3]]:19: error: name `LaterInNested` used before it was declared [NameUseBeforeDecl] - // CHECK:STDERR: Carbon::Nested::LaterInNested(); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_typo_in_nested_namespace.carbon:[[@LINE+1]]:19: error: name `LaterInNested` used before it was declared [NameUseBeforeDecl] Carbon::Nested::LaterInNested(); Carbon::Nested::EarlyFn(); } '''; -// CHECK:STDERR: fail_typo_in_nested_namespace.carbon:[[@LINE+4]]:11: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: fn Nested.LaterInNested() {} -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_typo_in_nested_namespace.carbon:[[@LINE+2]]:11-23: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: fn Nested.LaterInNested() {} @@ -165,9 +139,7 @@ class MyClass { inline Cpp ''' void TestTypoInClass() { Carbon::MyClass::StaticMethod1(); - // CHECK:STDERR: fail_typo_in_carbon_class.carbon:[[@LINE+4]]:20: error: no member named 'NoSuchMember' in 'Carbon::MyClass' [CppInteropParseError] - // CHECK:STDERR: 19 | Carbon::MyClass::NoSuchMember(); - // CHECK:STDERR: | ^~~~~~~~~~~~ + // CHECK:STDERR: fail_typo_in_carbon_class.carbon:[[@LINE+2]]:20-31: error: no member named 'NoSuchMember' in 'Carbon::MyClass' [CppInteropParseError] // CHECK:STDERR: Carbon::MyClass::NoSuchMember(); Carbon::MyClass::StaticMethod1(); diff --git a/toolchain/check/testdata/interop/cpp/namespace/roundtrip.carbon b/toolchain/check/testdata/interop/cpp/namespace/roundtrip.carbon index ff4841fd04ec..1c5a0d2f020f 100644 --- a/toolchain/check/testdata/interop/cpp/namespace/roundtrip.carbon +++ b/toolchain/check/testdata/interop/cpp/namespace/roundtrip.carbon @@ -68,9 +68,7 @@ void F(); void G() { // This is not found because it looks for the identifier `Cpp`, not the keyword `Cpp`. - // CHECK:STDERR: fail_carbon_cpp.carbon:[[@LINE+4]]:11: error: no member named 'Cpp' in namespace 'Carbon' [CppInteropParseError] - // CHECK:STDERR: 14 | Carbon::Cpp::F(); - // CHECK:STDERR: | ~~~~~~~~^ + // CHECK:STDERR: fail_carbon_cpp.carbon:[[@LINE+2]]:11: error: no member named 'Cpp' in namespace 'Carbon' [CppInteropParseError] // CHECK:STDERR: Carbon::Cpp::F(); } @@ -87,13 +85,9 @@ inline Cpp ''' void FRaw(); void GRaw() { - // CHECK:STDERR: fail_carbon_raw_cpp.carbon:[[@LINE+8]]:16: error: semantics TODO: `interop with translation unit decl` [SemanticsTodo] - // CHECK:STDERR: Carbon::Cpp::FRaw(); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_carbon_raw_cpp.carbon:[[@LINE+4]]:16: error: semantics TODO: `interop with translation unit decl` [SemanticsTodo] // CHECK:STDERR: - // CHECK:STDERR: fail_carbon_raw_cpp.carbon:[[@LINE+4]]:11: error: no member named 'Cpp' in namespace 'Carbon' [CppInteropParseError] - // CHECK:STDERR: 19 | Carbon::Cpp::FRaw(); - // CHECK:STDERR: | ~~~~~~~~^ + // CHECK:STDERR: fail_carbon_raw_cpp.carbon:[[@LINE+2]]:11: error: no member named 'Cpp' in namespace 'Carbon' [CppInteropParseError] // CHECK:STDERR: Carbon::Cpp::FRaw(); } diff --git a/toolchain/check/testdata/interop/cpp/operators/builtin_candidates.carbon b/toolchain/check/testdata/interop/cpp/operators/builtin_candidates.carbon index d97a6329f27b..ac95e3fd4470 100644 --- a/toolchain/check/testdata/interop/cpp/operators/builtin_candidates.carbon +++ b/toolchain/check/testdata/interop/cpp/operators/builtin_candidates.carbon @@ -51,24 +51,16 @@ enum class EC { e1, e2, e3 }; '''; fn TestEnumClass(a: Cpp.EC, b: Cpp.EC) { - // CHECK:STDERR: fail_enum_class_bitwise_operators.carbon:[[@LINE+4]]:19: error: cannot access member of interface `Core.BitAndWith(Cpp.EC)` in type `Cpp.EC` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: Cpp.EC = a & b; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_enum_class_bitwise_operators.carbon:[[@LINE+2]]:19-23: error: cannot access member of interface `Core.BitAndWith(Cpp.EC)` in type `Cpp.EC` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: Cpp.EC = a & b; - // CHECK:STDERR: fail_enum_class_bitwise_operators.carbon:[[@LINE+4]]:19: error: cannot access member of interface `Core.BitOrWith(Cpp.EC)` in type `Cpp.EC` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: Cpp.EC = a | b; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_enum_class_bitwise_operators.carbon:[[@LINE+2]]:19-23: error: cannot access member of interface `Core.BitOrWith(Cpp.EC)` in type `Cpp.EC` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: Cpp.EC = a | b; - // CHECK:STDERR: fail_enum_class_bitwise_operators.carbon:[[@LINE+4]]:19: error: cannot access member of interface `Core.BitXorWith(Cpp.EC)` in type `Cpp.EC` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: Cpp.EC = a ^ b; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_enum_class_bitwise_operators.carbon:[[@LINE+2]]:19-23: error: cannot access member of interface `Core.BitXorWith(Cpp.EC)` in type `Cpp.EC` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: Cpp.EC = a ^ b; - // CHECK:STDERR: fail_enum_class_bitwise_operators.carbon:[[@LINE+4]]:19: error: cannot access member of interface `Core.BitComplement` in type `Cpp.EC` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: Cpp.EC = ^a; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_enum_class_bitwise_operators.carbon:[[@LINE+2]]:19-20: error: cannot access member of interface `Core.BitComplement` in type `Cpp.EC` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: Cpp.EC = ^a; } @@ -145,163 +137,105 @@ struct ConvertibleToFloat { fn TestInteger(a: Cpp.ConvertibleToInt, b: Cpp.ConvertibleToInt) { // Test arithmetic. - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+4]]:16: error: cannot access member of interface `Core.AddWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: i32 = a + b; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.AddWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: i32 = a + b; - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+4]]:16: error: cannot access member of interface `Core.SubWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: i32 = a - b; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.SubWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: i32 = a - b; - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+4]]:16: error: cannot access member of interface `Core.MulWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: i32 = a * b; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.MulWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: i32 = a * b; - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+4]]:16: error: cannot access member of interface `Core.DivWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: i32 = a / b; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.DivWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: i32 = a / b; - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+4]]:16: error: cannot access member of interface `Core.ModWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: i32 = a % b; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.ModWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: i32 = a % b; // Test bitwise. - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+4]]:16: error: cannot access member of interface `Core.BitAndWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: i32 = a & b; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.BitAndWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: i32 = a & b; - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+4]]:16: error: cannot access member of interface `Core.BitOrWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: i32 = a | b; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.BitOrWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: i32 = a | b; - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+4]]:16: error: cannot access member of interface `Core.BitXorWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: i32 = a ^ b; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.BitXorWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: i32 = a ^ b; - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+4]]:16: error: cannot access member of interface `Core.LeftShiftWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: i32 = a << b; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-21: error: cannot access member of interface `Core.LeftShiftWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: i32 = a << b; - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+4]]:16: error: cannot access member of interface `Core.RightShiftWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: i32 = a >> b; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-21: error: cannot access member of interface `Core.RightShiftWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: i32 = a >> b; // Test comparison. - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+4]]:18: error: cannot access member of interface `Core.EqWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: bool = (a == b); - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.EqWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: bool = (a == b); - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+4]]:18: error: cannot access member of interface `Core.EqWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: bool = (a != b); - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.EqWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: bool = (a != b); - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+4]]:18: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: bool = (a < b); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: bool = (a < b); - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+4]]:18: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: bool = (a <= b); - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: bool = (a <= b); - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+4]]:18: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: bool = (a > b); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: bool = (a > b); - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+4]]:18: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: bool = (a >= b); - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: bool = (a >= b); // Test unary. - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+4]]:16: error: cannot access member of interface `Core.Negate` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: i32 = -a; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-17: error: cannot access member of interface `Core.Negate` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: i32 = -a; - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+4]]:16: error: cannot access member of interface `Core.BitComplement` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: i32 = ^a; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-17: error: cannot access member of interface `Core.BitComplement` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: i32 = ^a; } fn TestFloat(a: Cpp.ConvertibleToFloat, b: Cpp.ConvertibleToFloat) { // Test arithmetic. - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+4]]:16: error: cannot access member of interface `Core.AddWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: f32 = a + b; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.AddWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: f32 = a + b; - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+4]]:16: error: cannot access member of interface `Core.SubWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: f32 = a - b; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.SubWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: f32 = a - b; - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+4]]:16: error: cannot access member of interface `Core.MulWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: f32 = a * b; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.MulWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: f32 = a * b; - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+4]]:16: error: cannot access member of interface `Core.DivWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: f32 = a / b; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.DivWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: f32 = a / b; // Test comparison. - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+4]]:18: error: cannot access member of interface `Core.EqWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: bool = (a == b); - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.EqWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: bool = (a == b); - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+4]]:18: error: cannot access member of interface `Core.EqWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: bool = (a != b); - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.EqWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: bool = (a != b); - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+4]]:18: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: bool = (a < b); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: bool = (a < b); - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+4]]:18: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: bool = (a <= b); - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: bool = (a <= b); - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+4]]:18: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: bool = (a > b); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: bool = (a > b); - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+4]]:18: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: bool = (a >= b); - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: bool = (a >= b); // Test unary. - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+4]]:16: error: cannot access member of interface `Core.Negate` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let _: f32 = -a; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-17: error: cannot access member of interface `Core.Negate` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let _: f32 = -a; } diff --git a/toolchain/check/testdata/interop/cpp/operators/deref.carbon b/toolchain/check/testdata/interop/cpp/operators/deref.carbon index c57b502403ce..cda39133a7c0 100644 --- a/toolchain/check/testdata/interop/cpp/operators/deref.carbon +++ b/toolchain/check/testdata/interop/cpp/operators/deref.carbon @@ -62,9 +62,7 @@ public: '''; fn TestDerefPass(var int_ptr: Cpp.MultiDeref) -> ref i32 { - // CHECK:STDERR: fail_todo_multi_deref.carbon:[[@LINE+4]]:10: error: semantics TODO: `operator* overload sets not implemented yet` [SemanticsTodo] - // CHECK:STDERR: return int_ptr.(Core.CppUnsafeDeref.Op)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_multi_deref.carbon:[[@LINE+2]]:10-41: error: semantics TODO: `operator* overload sets not implemented yet` [SemanticsTodo] // CHECK:STDERR: return int_ptr.(Core.CppUnsafeDeref.Op)(); } @@ -91,9 +89,7 @@ public: '''; fn TestDerefPass(var int_ptr: Cpp.MaybeDeref(i32)) -> ref i32 { - // CHECK:STDERR: fail_todo_maybe_deref.carbon:[[@LINE+4]]:10: error: semantics TODO: `operator* overload sets not implemented yet` [SemanticsTodo] - // CHECK:STDERR: return int_ptr.(Core.CppUnsafeDeref.Op)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_maybe_deref.carbon:[[@LINE+2]]:10-41: error: semantics TODO: `operator* overload sets not implemented yet` [SemanticsTodo] // CHECK:STDERR: return int_ptr.(Core.CppUnsafeDeref.Op)(); } @@ -107,9 +103,7 @@ class NotAPtr {}; '''; fn TestDerefFail(not_ptr: Cpp.NotAPtr) { - // CHECK:STDERR: fail_not_a_ptr.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Core.CppUnsafeDeref` in type `Cpp.NotAPtr` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: not_ptr.(Core.CppUnsafeDeref.Op)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_not_a_ptr.carbon:[[@LINE+2]]:3-34: error: cannot access member of interface `Core.CppUnsafeDeref` in type `Cpp.NotAPtr` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: not_ptr.(Core.CppUnsafeDeref.Op)(); } diff --git a/toolchain/check/testdata/interop/cpp/operators/eq_with.carbon b/toolchain/check/testdata/interop/cpp/operators/eq_with.carbon index 54ddf340ff7b..efd5a2d74fe6 100644 --- a/toolchain/check/testdata/interop/cpp/operators/eq_with.carbon +++ b/toolchain/check/testdata/interop/cpp/operators/eq_with.carbon @@ -93,15 +93,9 @@ library "[[@TEST_NAME]]"; import Cpp inline '''c++ struct NeqBoolish { auto operator==(NeqBoolish) const -> bool; - // CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+9]]:8: error: cannot implicitly convert expression of type `i32` to `bool` [ConversionFailure] - // CHECK:STDERR: auto operator!=(NeqBoolish) const -> int; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+6]]:8: note: type `i32` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: auto operator!=(NeqBoolish) const -> int; - // CHECK:STDERR: ^ - // CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:14:3: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: default fn NotEqual(self, other: Other) -> bool { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+3]]:8: error: cannot implicitly convert expression of type `i32` to `bool` [ConversionFailure] + // CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+2]]:8: note: type `i32` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:14:3-51: note: while building thunk to match the signature of this function [ThunkSignature] auto operator!=(NeqBoolish) const -> int; }; @@ -120,48 +114,22 @@ struct BothBoolish { }; '''; -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+43]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+17]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-18]]:8: error: cannot implicitly convert expression of type `Core.Optional(i32* as Core.OptionalStorage)` to `bool` [ConversionFailure] -// CHECK:STDERR: auto operator==(EqBoolish) const -> int*; -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-21]]:8: note: type `Core.Optional(i32* as Core.OptionalStorage)` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: auto operator==(EqBoolish) const -> int*; -// CHECK:STDERR: ^ -// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:13:3: note: while building thunk to match the signature of this function [ThunkSignature] -// CHECK:STDERR: fn Equal(self, other: Other) -> bool; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+30]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-16]]:8: error: cannot implicitly convert expression of type `Core.Optional(i32* as Core.OptionalStorage)` to `bool` [ConversionFailure] +// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-17]]:8: note: type `Core.Optional(i32* as Core.OptionalStorage)` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:13:3-39: note: while building thunk to match the signature of this function [ThunkSignature] +// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+12]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-22]]:8: error: cannot implicitly convert expression of type `Cpp.Result` to `bool` [ConversionFailure] -// CHECK:STDERR: auto operator==(BothBoolish) const -> Result; -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-25]]:8: note: type `Cpp.Result` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: auto operator==(BothBoolish) const -> Result; -// CHECK:STDERR: ^ -// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:13:3: note: while building thunk to match the signature of this function [ThunkSignature] -// CHECK:STDERR: fn Equal(self, other: Other) -> bool; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+17]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-12]]:8: error: cannot implicitly convert expression of type `Cpp.Result` to `bool` [ConversionFailure] +// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-13]]:8: note: type `Cpp.Result` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:13:3-39: note: while building thunk to match the signature of this function [ThunkSignature] +// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+7]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-34]]:8: error: cannot implicitly convert expression of type `Cpp.Result` to `bool` [ConversionFailure] -// CHECK:STDERR: auto operator!=(BothBoolish) const -> Result; -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-37]]:8: note: type `Cpp.Result` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: auto operator!=(BothBoolish) const -> Result; -// CHECK:STDERR: ^ -// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:14:3: note: while building thunk to match the signature of this function [ThunkSignature] -// CHECK:STDERR: default fn NotEqual(self, other: Other) -> bool { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+4]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-16]]:8: error: cannot implicitly convert expression of type `Cpp.Result` to `bool` [ConversionFailure] +// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-17]]:8: note: type `Cpp.Result` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:14:3-51: note: while building thunk to match the signature of this function [ThunkSignature] +// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+2]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { x == y; @@ -200,29 +168,19 @@ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { } fn Test(default_eq_only: Cpp.DefaultEqOnly, - // CHECK:STDERR: fail_todo_comparison_rewrites.carbon:[[@LINE+4]]:33: error: member name `DefaultSpaceshipOnly` not found in `Cpp` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: default_spaceship_only: Cpp.DefaultSpaceshipOnly, - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_comparison_rewrites.carbon:[[@LINE+2]]:33-56: error: member name `DefaultSpaceshipOnly` not found in `Cpp` [MemberNameNotFoundInInstScope] // CHECK:STDERR: default_spaceship_only: Cpp.DefaultSpaceshipOnly, only_eq_declared: Cpp.OnlyEqDeclared) { - // CHECK:STDERR: fail_todo_comparison_rewrites.carbon:[[@LINE+7]]:3: error: semantics TODO: `Rewriting operator!= using operator== is not supported` [SemanticsTodo] - // CHECK:STDERR: EqWith(default_eq_only, default_eq_only); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_comparison_rewrites.carbon:[[@LINE-15]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_comparison_rewrites.carbon:[[@LINE+3]]:3-42: error: semantics TODO: `Rewriting operator!= using operator== is not supported` [SemanticsTodo] + // CHECK:STDERR: fail_todo_comparison_rewrites.carbon:[[@LINE-11]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: EqWith(default_eq_only, default_eq_only); EqWith(default_spaceship_only, default_spaceship_only); - // CHECK:STDERR: fail_todo_comparison_rewrites.carbon:[[@LINE+7]]:3: error: semantics TODO: `Rewriting operator!= using operator== is not supported` [SemanticsTodo] - // CHECK:STDERR: EqWith(only_eq_declared, only_eq_declared); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_comparison_rewrites.carbon:[[@LINE-26]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_comparison_rewrites.carbon:[[@LINE+3]]:3-44: error: semantics TODO: `Rewriting operator!= using operator== is not supported` [SemanticsTodo] + // CHECK:STDERR: fail_todo_comparison_rewrites.carbon:[[@LINE-18]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: EqWith(only_eq_declared, only_eq_declared); } @@ -277,82 +235,46 @@ fn Test(only_neq: Cpp.OnlyNeq, deleted_neq: Cpp.DeletedNeq, non_const_eq: Cpp.NonConstEq, a2: Cpp.A2, b2: Cpp.B2) { - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:3: error: cannot convert type `Cpp.OnlyNeq` into type implementing `Core.EqWith(Cpp.OnlyNeq)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: EqWith(only_neq, only_neq); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-15]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-28: error: cannot convert type `Cpp.OnlyNeq` into type implementing `Core.EqWith(Cpp.OnlyNeq)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-13]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: EqWith(only_neq, only_neq); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+8]]:10: error: name `only_non_default_spaceship` not found [NameNotFound] - // CHECK:STDERR: EqWith(only_non_default_spaceship, only_non_default_spaceship); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+4]]:10-35: error: name `only_non_default_spaceship` not found [NameNotFound] // CHECK:STDERR: - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+4]]:38: error: name `only_non_default_spaceship` not found [NameNotFound] - // CHECK:STDERR: EqWith(only_non_default_spaceship, only_non_default_spaceship); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+2]]:38-63: error: name `only_non_default_spaceship` not found [NameNotFound] // CHECK:STDERR: EqWith(only_non_default_spaceship, only_non_default_spaceship); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:3: error: cannot convert type `Cpp.NoRelevantMembers` into type implementing `Core.EqWith(Cpp.NoRelevantMembers)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: EqWith(no_relevant_members, no_relevant_members); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-34]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-50: error: cannot convert type `Cpp.NoRelevantMembers` into type implementing `Core.EqWith(Cpp.NoRelevantMembers)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-24]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: EqWith(no_relevant_members, no_relevant_members); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:3: error: cannot convert type `Cpp.EqReturnsVoid` into type implementing `Core.EqWith(Cpp.EqReturnsVoid)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: EqWith(eq_returns_void, eq_returns_void); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-43]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-42: error: cannot convert type `Cpp.EqReturnsVoid` into type implementing `Core.EqWith(Cpp.EqReturnsVoid)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-29]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: EqWith(eq_returns_void, eq_returns_void); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:3: error: cannot convert type `Cpp.NeqReturnsVoid` into type implementing `Core.EqWith(Cpp.NeqReturnsVoid)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: EqWith(neq_returns_void, neq_returns_void); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-52]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-44: error: cannot convert type `Cpp.NeqReturnsVoid` into type implementing `Core.EqWith(Cpp.NeqReturnsVoid)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-34]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: EqWith(neq_returns_void, neq_returns_void); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+13]]:34: error: overload resolution selected deleted operator '!=' [CppInteropParseError] - // CHECK:STDERR: 109 | EqWith(deleted_neq, deleted_neq); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-77]]:8: note: candidate function [CppInteropParseNote] - // CHECK:STDERR: 22 | auto operator==(DeletedNeq) const -> bool; - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-79]]:8: note: candidate function has been explicitly deleted [CppInteropParseNote] - // CHECK:STDERR: 23 | auto operator!=(DeletedNeq) const -> bool = delete; - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-67]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+5]]:34: error: overload resolution selected deleted operator '!=' [CppInteropParseError] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-55]]:8: note: candidate function [CppInteropParseNote] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-55]]:8: note: candidate function has been explicitly deleted [CppInteropParseNote] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-41]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: EqWith(deleted_neq, deleted_neq); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:3: error: semantics TODO: `Rewriting operator!= using operator== is not supported` [SemanticsTodo] - // CHECK:STDERR: EqWith(non_const_eq, non_const_eq); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-76]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-36: error: semantics TODO: `Rewriting operator!= using operator== is not supported` [SemanticsTodo] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-46]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: EqWith(non_const_eq, non_const_eq); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:3: error: cannot convert type `Cpp.A2` into type implementing `Core.EqWith(Cpp.B2)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: EqWith(a2, b2); - // CHECK:STDERR: ^~~~~~~~~~~~~~ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-85]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-16: error: cannot convert type `Cpp.A2` into type implementing `Core.EqWith(Cpp.B2)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-51]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: EqWith(a2, b2); } diff --git a/toolchain/check/testdata/interop/cpp/operators/operators.carbon b/toolchain/check/testdata/interop/cpp/operators/operators.carbon index a2c3aebdb80e..e887b74c3858 100644 --- a/toolchain/check/testdata/interop/cpp/operators/operators.carbon +++ b/toolchain/check/testdata/interop/cpp/operators/operators.carbon @@ -69,18 +69,12 @@ import Cpp library "prefix_inc_and_dec.h"; fn F() { var prefix: Cpp.Prefix = Cpp.Prefix.Prefix(); - // CHECK:STDERR: fail_prefix_calling_postfix.carbon:[[@LINE+8]]:9: error: expected `;` after expression statement [ExpectedExprSemi] - // CHECK:STDERR: prefix++; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_prefix_calling_postfix.carbon:[[@LINE+4]]:9-10: error: expected `;` after expression statement [ExpectedExprSemi] // CHECK:STDERR: - // CHECK:STDERR: fail_prefix_calling_postfix.carbon:[[@LINE+4]]:3: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] - // CHECK:STDERR: prefix++; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_prefix_calling_postfix.carbon:[[@LINE+2]]:3-11: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: prefix++; - // CHECK:STDERR: fail_prefix_calling_postfix.carbon:[[@LINE+4]]:9: error: expected `;` after expression statement [ExpectedExprSemi] - // CHECK:STDERR: prefix--; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_prefix_calling_postfix.carbon:[[@LINE+2]]:9-10: error: expected `;` after expression statement [ExpectedExprSemi] // CHECK:STDERR: prefix--; } @@ -99,14 +93,10 @@ import Cpp library "postfix_inc_and_dec.h"; fn F() { var postfix: Cpp.Postfix = Cpp.Postfix.Postfix(); - // CHECK:STDERR: fail_postfix_calling_prefix.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Core.Inc` in type `Cpp.Postfix` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: ++postfix; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_postfix_calling_prefix.carbon:[[@LINE+2]]:3-11: error: cannot access member of interface `Core.Inc` in type `Cpp.Postfix` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: ++postfix; - // CHECK:STDERR: fail_postfix_calling_prefix.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Core.Dec` in type `Cpp.Postfix` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: --postfix; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_postfix_calling_prefix.carbon:[[@LINE+2]]:3-11: error: cannot access member of interface `Core.Dec` in type `Cpp.Postfix` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: --postfix; } @@ -221,12 +211,8 @@ fn F() { var c: Cpp.BinaryC = {}; // Simple assignment. - // CHECK:STDERR: fail_todo_import_assignment.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Core.IntLiteral` to `Cpp.BinaryC` [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.BinaryC)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: c = 42; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_todo_import_assignment.carbon:[[@LINE+3]]:3-8: error: cannot implicitly convert expression of type `Core.IntLiteral` to `Cpp.BinaryC` [ConversionFailure] + // CHECK:STDERR: fail_todo_import_assignment.carbon:[[@LINE+2]]:3-8: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(Cpp.BinaryC)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: c = 42; } @@ -256,14 +242,10 @@ import Cpp library "binary_operators.h"; fn F() { let c1: Cpp.BinaryC = Cpp.BinaryC.BinaryC(); // TODO: Include a list of non-viable candidate operators with this diagnostic. - // CHECK:STDERR: fail_call_with_wrong_type.carbon:[[@LINE+4]]:32: error: cannot access member of interface `Core.AddWith(Core.IntLiteral)` in type `Cpp.BinaryC` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let unused c2: Cpp.BinaryC = c1 + 5; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_call_with_wrong_type.carbon:[[@LINE+2]]:32-37: error: cannot access member of interface `Core.AddWith(Core.IntLiteral)` in type `Cpp.BinaryC` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let unused c2: Cpp.BinaryC = c1 + 5; - // CHECK:STDERR: fail_call_with_wrong_type.carbon:[[@LINE+4]]:32: error: cannot access member of interface `Core.AddWith(Cpp.BinaryC)` in type `Core.IntLiteral` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let unused c3: Cpp.BinaryC = 6 + c1; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_call_with_wrong_type.carbon:[[@LINE+2]]:32-37: error: cannot access member of interface `Core.AddWith(Cpp.BinaryC)` in type `Core.IntLiteral` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let unused c3: Cpp.BinaryC = 6 + c1; } @@ -283,15 +265,9 @@ void operator+(AmbiguousC, short); '''; fn Test(c: Cpp.AmbiguousC) { - // CHECK:STDERR: fail_ambiguous.carbon:[[@LINE+10]]:5: error: use of overloaded operator '+' is ambiguous (with operand types 'const AmbiguousC' and 'int') [CppInteropParseError] - // CHECK:STDERR: 21 | c + 1; - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_ambiguous.carbon:[[@LINE-8]]:6: note: candidate function [CppInteropParseNote] - // CHECK:STDERR: 6 | void operator+(AmbiguousC, char); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_ambiguous.carbon:[[@LINE-10]]:6: note: candidate function [CppInteropParseNote] - // CHECK:STDERR: 7 | void operator+(AmbiguousC, short); - // CHECK:STDERR: | ^ + // CHECK:STDERR: fail_ambiguous.carbon:[[@LINE+4]]:5: error: use of overloaded operator '+' is ambiguous (with operand types 'const AmbiguousC' and 'int') [CppInteropParseError] + // CHECK:STDERR: fail_ambiguous.carbon:[[@LINE-6]]:6: note: candidate function [CppInteropParseNote] + // CHECK:STDERR: fail_ambiguous.carbon:[[@LINE-6]]:6: note: candidate function [CppInteropParseNote] // CHECK:STDERR: c + 1; } @@ -307,15 +283,10 @@ void operator+(DeletedC, void*) = delete; '''; fn Test(c: Cpp.DeletedC) { - // CHECK:STDERR: fail_deleted.carbon:[[@LINE+10]]:5: error: overload resolution selected deleted operator '+' [CppInteropParseError] - // CHECK:STDERR: 21 | c + 1; - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_deleted.carbon:[[@LINE-8]]:6: note: candidate function has been explicitly deleted [CppInteropParseNote] - // CHECK:STDERR: 6 | void operator+(DeletedC, int) = delete; - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_deleted.carbon:[[@LINE-10]]:6: note: candidate function not viable: no known conversion from 'int' to 'void *' for 2nd argument [CppInteropParseNote] - // CHECK:STDERR: 7 | void operator+(DeletedC, void*) = delete; - // CHECK:STDERR: | ^ ~~~~~ + // CHECK:STDERR: fail_deleted.carbon:[[@LINE+5]]:5: error: overload resolution selected deleted operator '+' [CppInteropParseError] + // CHECK:STDERR: fail_deleted.carbon:[[@LINE-6]]:6: note: candidate function has been explicitly deleted [CppInteropParseNote] + // CHECK:STDERR: fail_deleted.carbon:[[@LINE-6]]:6: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: fail_deleted.carbon:[[@LINE-7]]:26-30: note: no known conversion from 'int' to 'void *' for 2nd argument [CppInteropParseNoteReason] // CHECK:STDERR: c + 1; } @@ -346,16 +317,12 @@ fn F() { let unused greater_than: bool = c1 > c2; // Rewrite. - // CHECK:STDERR: fail_todo_rewrite_spaceship.carbon:[[@LINE+4]]:32: error: semantics TODO: `Rewriting operator< using operator<=> is not supported` [SemanticsTodo] - // CHECK:STDERR: let unused less_than: bool = c1 < c2; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_todo_rewrite_spaceship.carbon:[[@LINE+2]]:32-38: error: semantics TODO: `Rewriting operator< using operator<=> is not supported` [SemanticsTodo] // CHECK:STDERR: let unused less_than: bool = c1 < c2; // Rewrite. - // CHECK:STDERR: fail_todo_rewrite_spaceship.carbon:[[@LINE+4]]:44: error: semantics TODO: `Rewriting operator>= using operator<=> is not supported` [SemanticsTodo] - // CHECK:STDERR: let unused greater_than_or_equal: bool = c1 >= c2; - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_todo_rewrite_spaceship.carbon:[[@LINE+2]]:44-51: error: semantics TODO: `Rewriting operator>= using operator<=> is not supported` [SemanticsTodo] // CHECK:STDERR: let unused greater_than_or_equal: bool = c1 >= c2; @@ -379,15 +346,9 @@ auto operator<(CDel lhs, BaseDel rhs) -> bool; fn F(c: Cpp.CDel) -> bool { // Note that we mention `operator '<=>'` in the diagnostic. - // CHECK:STDERR: fail_rewrite_deleted.carbon:[[@LINE+10]]:12: error: overload resolution selected deleted operator '<=>' [CppInteropParseError] - // CHECK:STDERR: 25 | return c < c; - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_rewrite_deleted.carbon:[[@LINE-9]]:6: note: candidate function has been explicitly deleted [CppInteropParseNote] - // CHECK:STDERR: 9 | auto operator<=>(CDel lhs, CDel rhs) -> std::strong_ordering = delete; - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_rewrite_deleted.carbon:[[@LINE-11]]:6: note: candidate function [CppInteropParseNote] - // CHECK:STDERR: 10 | auto operator<(CDel lhs, BaseDel rhs) -> bool; - // CHECK:STDERR: | ^ + // CHECK:STDERR: fail_rewrite_deleted.carbon:[[@LINE+4]]:12: error: overload resolution selected deleted operator '<=>' [CppInteropParseError] + // CHECK:STDERR: fail_rewrite_deleted.carbon:[[@LINE-7]]:6: note: candidate function has been explicitly deleted [CppInteropParseNote] + // CHECK:STDERR: fail_rewrite_deleted.carbon:[[@LINE-7]]:6: note: candidate function [CppInteropParseNote] // CHECK:STDERR: return c < c; } @@ -415,9 +376,7 @@ fn F() { let unused equal: bool = c1 == c2; // Rewrite. - // CHECK:STDERR: fail_todo_rewrite_equal.carbon:[[@LINE+4]]:32: error: semantics TODO: `Rewriting operator!= using operator== is not supported` [SemanticsTodo] - // CHECK:STDERR: let unused not_equal: bool = c1 != c2; - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_todo_rewrite_equal.carbon:[[@LINE+2]]:32-39: error: semantics TODO: `Rewriting operator!= using operator== is not supported` [SemanticsTodo] // CHECK:STDERR: let unused not_equal: bool = c1 != c2; //@dump-sem-ir-end @@ -489,9 +448,7 @@ import Cpp library "plus_with_string_view_conversion.h"; fn F() { let s1: str = "hello"; let s2: str = "world"; - // CHECK:STDERR: fail_todo_import_plus_with_string_view_conversion.carbon:[[@LINE+4]]:46: error: cannot access member of interface `Core.AddWith(str)` in type `str` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let unused c: Cpp.StringViewConvertibleC = s1 + s2; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_todo_import_plus_with_string_view_conversion.carbon:[[@LINE+2]]:46-52: error: cannot access member of interface `Core.AddWith(str)` in type `str` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let unused c: Cpp.StringViewConvertibleC = s1 + s2; } @@ -536,47 +493,31 @@ fn F() { var c: Cpp.UnsupportedUnaryC = Cpp.UnsupportedUnaryC.UnsupportedUnaryC(); // Arithmetic. - // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+12]]:37: error: expected expression [ExpectedExpr] - // CHECK:STDERR: let plus: Cpp.UnsupportedUnaryC = +c; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+6]]:37: error: expected expression [ExpectedExpr] // CHECK:STDERR: - // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+8]]:37: error: whitespace missing after binary operator [BinaryOperatorRequiresWhitespace] - // CHECK:STDERR: let plus: Cpp.UnsupportedUnaryC = +c; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+4]]:37: error: whitespace missing after binary operator [BinaryOperatorRequiresWhitespace] // CHECK:STDERR: - // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+4]]:37: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] - // CHECK:STDERR: let plus: Cpp.UnsupportedUnaryC = +c; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+2]]:37: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: let plus: Cpp.UnsupportedUnaryC = +c; // Increment and Decrement. - // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+4]]:4: error: expected `;` after expression statement [ExpectedExprSemi] - // CHECK:STDERR: c++; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+2]]:4-5: error: expected `;` after expression statement [ExpectedExprSemi] // CHECK:STDERR: c++; - // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+4]]:4: error: expected `;` after expression statement [ExpectedExprSemi] - // CHECK:STDERR: c--; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+2]]:4-5: error: expected `;` after expression statement [ExpectedExprSemi] // CHECK:STDERR: c--; // Bitwise. - // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+8]]:42: error: expected expression [ExpectedExpr] - // CHECK:STDERR: let not_value: Cpp.UnsupportedUnaryC = ~c; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+4]]:42: error: expected expression [ExpectedExpr] // CHECK:STDERR: - // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+4]]:42: error: `let` declarations must end with a `;` [ExpectedDeclSemi] - // CHECK:STDERR: let not_value: Cpp.UnsupportedUnaryC = ~c; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+2]]:42: error: `let` declarations must end with a `;` [ExpectedDeclSemi] // CHECK:STDERR: let not_value: Cpp.UnsupportedUnaryC = ~c; // Logical. - // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+4]]:51: error: `let` declarations must end with a `;` [ExpectedDeclSemi] - // CHECK:STDERR: let not_result: Cpp.UnsupportedUnaryC = operator!(c1); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+2]]:51: error: `let` declarations must end with a `;` [ExpectedDeclSemi] // CHECK:STDERR: let not_result: Cpp.UnsupportedUnaryC = operator!(c1); @@ -611,42 +552,24 @@ fn F() { var c1: Cpp.UnsupportedBinaryC = Cpp.UnsupportedBinaryC.UnsupportedBinaryC(); // Logical. - // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+16]]:44: error: name `operator` not found [NameNotFound] - // CHECK:STDERR: let and_result: Cpp.UnsupportedBinaryC = operator&&(c1, c2); - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+8]]:44-51: error: name `operator` not found [NameNotFound] // CHECK:STDERR: - // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+12]]:52: error: whitespace missing around binary operator [BinaryOperatorRequiresWhitespace] - // CHECK:STDERR: let and_result: Cpp.UnsupportedBinaryC = operator&&(c1, c2); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+6]]:52: error: whitespace missing around binary operator [BinaryOperatorRequiresWhitespace] // CHECK:STDERR: - // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+8]]:59: error: name `c2` not found [NameNotFound] - // CHECK:STDERR: let and_result: Cpp.UnsupportedBinaryC = operator&&(c1, c2); - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+4]]:59-60: error: name `c2` not found [NameNotFound] // CHECK:STDERR: - // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+4]]:53: error: cannot take the address of non-reference expression [AddrOfNonRef] - // CHECK:STDERR: let and_result: Cpp.UnsupportedBinaryC = operator&&(c1, c2); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+2]]:53: error: cannot take the address of non-reference expression [AddrOfNonRef] // CHECK:STDERR: let and_result: Cpp.UnsupportedBinaryC = operator&&(c1, c2); - // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+20]]:43: error: name `operator` not found [NameNotFound] - // CHECK:STDERR: let or_result: Cpp.UnsupportedBinaryC = operator||(c1, c2); - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+10]]:43-50: error: name `operator` not found [NameNotFound] // CHECK:STDERR: - // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+16]]:51: error: whitespace missing around binary operator [BinaryOperatorRequiresWhitespace] - // CHECK:STDERR: let or_result: Cpp.UnsupportedBinaryC = operator||(c1, c2); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+8]]:51: error: whitespace missing around binary operator [BinaryOperatorRequiresWhitespace] // CHECK:STDERR: - // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+12]]:52: error: expected expression [ExpectedExpr] - // CHECK:STDERR: let or_result: Cpp.UnsupportedBinaryC = operator||(c1, c2); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+6]]:52: error: expected expression [ExpectedExpr] // CHECK:STDERR: - // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+8]]:52: error: whitespace missing around binary operator [BinaryOperatorRequiresWhitespace] - // CHECK:STDERR: let or_result: Cpp.UnsupportedBinaryC = operator||(c1, c2); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+4]]:52: error: whitespace missing around binary operator [BinaryOperatorRequiresWhitespace] // CHECK:STDERR: - // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+4]]:52: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] - // CHECK:STDERR: let or_result: Cpp.UnsupportedBinaryC = operator||(c1, c2); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+2]]:52: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: let or_result: Cpp.UnsupportedBinaryC = operator||(c1, c2); } @@ -731,9 +654,7 @@ fn F() { //@dump-sem-ir-begin let c1: Cpp.GlobalOpN.C = Cpp.GlobalOpN.C.C(); let c2: Cpp.GlobalOpN.C = Cpp.GlobalOpN.C.C(); - // CHECK:STDERR: fail_todo_import_operands_in_namespace_operator_in_global.carbon:[[@LINE+4]]:36: error: cannot access member of interface `Core.AddWith(Cpp.GlobalOpN.C)` in type `Cpp.GlobalOpN.C` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let unused c3: Cpp.GlobalOpN.C = c1 + c2; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_todo_import_operands_in_namespace_operator_in_global.carbon:[[@LINE+2]]:36-42: error: cannot access member of interface `Core.AddWith(Cpp.GlobalOpN.C)` in type `Cpp.GlobalOpN.C` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let unused c3: Cpp.GlobalOpN.C = c1 + c2; //@dump-sem-ir-end @@ -840,9 +761,7 @@ import Cpp library "not_found.h"; fn F() { let c1: Cpp.NoOperators = Cpp.NoOperators.NoOperators(); let c2: Cpp.NoOperators = Cpp.NoOperators.NoOperators(); - // CHECK:STDERR: fail_import_not_found.carbon:[[@LINE+4]]:36: error: cannot access member of interface `Core.AddWith(Cpp.NoOperators)` in type `Cpp.NoOperators` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: let unused c3: Cpp.NoOperators = c1 + c2; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_import_not_found.carbon:[[@LINE+2]]:36-42: error: cannot access member of interface `Core.AddWith(Cpp.NoOperators)` in type `Cpp.NoOperators` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let unused c3: Cpp.NoOperators = c1 + c2; } @@ -865,13 +784,9 @@ library "[[@TEST_NAME]]"; import Cpp library "incomplete.h"; fn F() { - // CHECK:STDERR: fail_import_incomplete_unary.carbon:[[@LINE+8]]:34: error: looking up a C++ operator with incomplete operand type `Cpp.Incomplete` [IncompleteOperandTypeInCppOperatorLookup] - // CHECK:STDERR: let unused result_unary: i32 = -*Cpp.CreateIncomplete(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_incomplete_unary.carbon:[[@LINE-6]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_incomplete_unary.carbon:[[@LINE+4]]:34-57: error: looking up a C++ operator with incomplete operand type `Cpp.Incomplete` [IncompleteOperandTypeInCppOperatorLookup] + // CHECK:STDERR: included from: fail_import_incomplete_unary.carbon:[[@LINE-4]]:10 [InCppInclude] // CHECK:STDERR: ./incomplete.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: class Incomplete; - // CHECK:STDERR: ^ // CHECK:STDERR: let unused result_unary: i32 = -*Cpp.CreateIncomplete(); } @@ -884,13 +799,9 @@ import Cpp library "incomplete.h"; fn F() { var complete: Cpp.Complete = Cpp.Complete.Complete(); - // CHECK:STDERR: fail_import_incomplete_binary.carbon:[[@LINE+8]]:35: error: looking up a C++ operator with incomplete operand type `Cpp.Incomplete` [IncompleteOperandTypeInCppOperatorLookup] - // CHECK:STDERR: let unused result_binary: i32 = complete + *Cpp.CreateIncomplete(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_incomplete_binary.carbon:[[@LINE-7]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_import_incomplete_binary.carbon:[[@LINE+4]]:35-68: error: looking up a C++ operator with incomplete operand type `Cpp.Incomplete` [IncompleteOperandTypeInCppOperatorLookup] + // CHECK:STDERR: included from: fail_import_incomplete_binary.carbon:[[@LINE-5]]:10 [InCppInclude] // CHECK:STDERR: ./incomplete.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: class Incomplete; - // CHECK:STDERR: ^ // CHECK:STDERR: let unused result_binary: i32 = complete + *Cpp.CreateIncomplete(); } @@ -914,12 +825,8 @@ fn CreateIncomplete() -> Incomplete*; fn F() { var complete: Cpp.CompleteCpp = Cpp.CompleteCpp.CompleteCpp(); - // CHECK:STDERR: fail_incomplete_operand_carbon_type.carbon:[[@LINE+7]]:28: error: looking up a C++ operator with incomplete operand type `Incomplete` [IncompleteOperandTypeInCppOperatorLookup] - // CHECK:STDERR: let unused result: i32 = *CreateIncomplete() + complete; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_incomplete_operand_carbon_type.carbon:[[@LINE-8]]:1: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: class Incomplete; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_incomplete_operand_carbon_type.carbon:[[@LINE+3]]:28-57: error: looking up a C++ operator with incomplete operand type `Incomplete` [IncompleteOperandTypeInCppOperatorLookup] + // CHECK:STDERR: fail_incomplete_operand_carbon_type.carbon:[[@LINE-6]]:1-17: note: class was forward declared here [ClassForwardDeclaredHere] // CHECK:STDERR: let unused result: i32 = *CreateIncomplete() + complete; } @@ -953,9 +860,7 @@ library "[[@TEST_NAME]]"; import Cpp inline ''' template struct FailTemplateB {}; template struct FailTemplateA { - // CHECK:STDERR: fail_indirect_template_instantiation_error.carbon:[[@LINE+3]]:19: error: type 'int' cannot be used prior to '::' because it has no members [CppInteropParseError] - // CHECK:STDERR: 10 | friend typename T::error operator+(FailTemplateB, FailTemplateB); - // CHECK:STDERR: | ^ + // CHECK:STDERR: fail_indirect_template_instantiation_error.carbon:[[@LINE+1]]:19: error: type 'int' cannot be used prior to '::' because it has no members [CppInteropParseError] friend typename T::error operator+(FailTemplateB, FailTemplateB); }; @@ -963,13 +868,9 @@ using FailTemplateX = FailTemplateB>; '''; fn F(x: Cpp.FailTemplateX) -> i32 { - // CHECK:STDERR: fail_indirect_template_instantiation_error.carbon:[[@LINE+8]]:12: note: in instantiation of template class 'FailTemplateA' requested here [CppInteropParseNote] - // CHECK:STDERR: 25 | return x + x; - // CHECK:STDERR: | ^ + // CHECK:STDERR: fail_indirect_template_instantiation_error.carbon:[[@LINE+4]]:12: note: in instantiation of template class 'FailTemplateA' requested here [CppInteropParseNote] // CHECK:STDERR: - // CHECK:STDERR: fail_indirect_template_instantiation_error.carbon:[[@LINE+4]]:10: error: cannot access member of interface `Core.AddWith(Cpp.FailTemplateB)` in type `Cpp.FailTemplateB` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: return x + x; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_indirect_template_instantiation_error.carbon:[[@LINE+2]]:10-14: error: cannot access member of interface `Core.AddWith(Cpp.FailTemplateB)` in type `Cpp.FailTemplateB` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: return x + x; } @@ -2229,11 +2130,11 @@ fn F() { // CHECK:STDOUT: %operator_LessEqual__carbon_thunk: %operator_LessEqual__carbon_thunk.type = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.40d: %pattern_type.831 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.560: %pattern_type.831 = wrapper_binding_pattern self, %self.param_patt.40d [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfc: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc36 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfc: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc32 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01: %Destroy.WithSelf.SubobjectDestroy.type.dfc = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc36 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc32 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.1: %Destroy.WithSelf.Op.type.ef016f.1 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1: type = fn_type @Destroy.WithSelf.SelfDestruct.loc36 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1: type = fn_type @Destroy.WithSelf.SelfDestruct.loc32 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.1: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1 = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.e2f: %pattern_type.bbc = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.790: %pattern_type.bbc = wrapper_binding_pattern self, %self.param_patt.e2f [concrete] @@ -2275,14 +2176,14 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl: %Destroy.WithSelf.SubobjectDestroy.type.dfc = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc36 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl: %Destroy.WithSelf.SubobjectDestroy.type.dfc = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc32 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01] { // CHECK:STDOUT: %self.param_patt: %pattern_type.831 = ref_param_pattern [concrete = constants.%self.param_patt.40d] // CHECK:STDOUT: %self.patt: %pattern_type.831 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.560] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref bool = ref_param call_param0 // CHECK:STDOUT: %self: ref bool = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc36 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc32 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.831 = ref_param_pattern [concrete = constants.%self.param_patt.40d] // CHECK:STDOUT: %self.patt: %pattern_type.831 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.560] // CHECK:STDOUT: } { @@ -2355,41 +2256,41 @@ fn F() { // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %greater_than.patt: %pattern_type.831 = value_binding_pattern greater_than [concrete = constants.%greater_than.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %c1.ref.loc26: ref %C = name_ref c1, %c1 -// CHECK:STDOUT: %c2.ref.loc26: ref %C = name_ref c2, %c2 -// CHECK:STDOUT: %.loc26: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %c1.ref.loc24: ref %C = name_ref c1, %c1 +// CHECK:STDOUT: %c2.ref.loc24: ref %C = name_ref c2, %c2 +// CHECK:STDOUT: %.loc24: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %less_than: bool = wrapper_binding less_than, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %less_than.patt: %pattern_type.831 = value_binding_pattern less_than [concrete = constants.%less_than.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %c1.ref.loc33: ref %C = name_ref c1, %c1 -// CHECK:STDOUT: %c2.ref.loc33: ref %C = name_ref c2, %c2 -// CHECK:STDOUT: %.loc33: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %c1.ref.loc29: ref %C = name_ref c1, %c1 +// CHECK:STDOUT: %c2.ref.loc29: ref %C = name_ref c2, %c2 +// CHECK:STDOUT: %.loc29: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %greater_than_or_equal: bool = wrapper_binding greater_than_or_equal, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %greater_than_or_equal.patt: %pattern_type.831 = value_binding_pattern greater_than_or_equal [concrete = constants.%greater_than_or_equal.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %c1.ref.loc36: ref %C = name_ref c1, %c1 -// CHECK:STDOUT: %c2.ref.loc36: ref %C = name_ref c2, %c2 -// CHECK:STDOUT: %.loc36_41.1: %C = acquire_value %c1.ref.loc36 -// CHECK:STDOUT: %.loc36_47.1: %C = acquire_value %c2.ref.loc36 -// CHECK:STDOUT: %.loc36_41.2: ref %C = value_as_ref %.loc36_41.1 -// CHECK:STDOUT: %addr.loc36_44.1: %ptr.0a2 = addr_of %.loc36_41.2 -// CHECK:STDOUT: %.loc36_47.2: ref %C = value_as_ref %.loc36_47.1 -// CHECK:STDOUT: %addr.loc36_44.2: %ptr.0a2 = addr_of %.loc36_47.2 -// CHECK:STDOUT: %.loc36_44.1: ref bool = temporary_storage -// CHECK:STDOUT: %addr.loc36_44.3: %ptr.bb2 = addr_of %.loc36_44.1 -// CHECK:STDOUT: %operator_LessEqual__carbon_thunk.call: init %empty_tuple.type = call imports.%operator_LessEqual__carbon_thunk.decl(%addr.loc36_44.1, %addr.loc36_44.2, %addr.loc36_44.3) -// CHECK:STDOUT: %.loc36_44.2: init bool to %.loc36_44.1 = mark_in_place_init %operator_LessEqual__carbon_thunk.call -// CHECK:STDOUT: %.loc36_44.3: ref bool = temporary %.loc36_44.1, %.loc36_44.2 -// CHECK:STDOUT: %.loc36_44.4: bool = acquire_value %.loc36_44.3 -// CHECK:STDOUT: %.loc36_34: type = type_literal bool [concrete = bool] -// CHECK:STDOUT: %less_than_or_equal: bool = wrapper_binding less_than_or_equal, %.loc36_44.4 +// CHECK:STDOUT: %c1.ref.loc32: ref %C = name_ref c1, %c1 +// CHECK:STDOUT: %c2.ref.loc32: ref %C = name_ref c2, %c2 +// CHECK:STDOUT: %.loc32_41.1: %C = acquire_value %c1.ref.loc32 +// CHECK:STDOUT: %.loc32_47.1: %C = acquire_value %c2.ref.loc32 +// CHECK:STDOUT: %.loc32_41.2: ref %C = value_as_ref %.loc32_41.1 +// CHECK:STDOUT: %addr.loc32_44.1: %ptr.0a2 = addr_of %.loc32_41.2 +// CHECK:STDOUT: %.loc32_47.2: ref %C = value_as_ref %.loc32_47.1 +// CHECK:STDOUT: %addr.loc32_44.2: %ptr.0a2 = addr_of %.loc32_47.2 +// CHECK:STDOUT: %.loc32_44.1: ref bool = temporary_storage +// CHECK:STDOUT: %addr.loc32_44.3: %ptr.bb2 = addr_of %.loc32_44.1 +// CHECK:STDOUT: %operator_LessEqual__carbon_thunk.call: init %empty_tuple.type = call imports.%operator_LessEqual__carbon_thunk.decl(%addr.loc32_44.1, %addr.loc32_44.2, %addr.loc32_44.3) +// CHECK:STDOUT: %.loc32_44.2: init bool to %.loc32_44.1 = mark_in_place_init %operator_LessEqual__carbon_thunk.call +// CHECK:STDOUT: %.loc32_44.3: ref bool = temporary %.loc32_44.1, %.loc32_44.2 +// CHECK:STDOUT: %.loc32_44.4: bool = acquire_value %.loc32_44.3 +// CHECK:STDOUT: %.loc32_34: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %less_than_or_equal: bool = wrapper_binding less_than_or_equal, %.loc32_44.4 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %less_than_or_equal.patt: %pattern_type.831 = value_binding_pattern less_than_or_equal [concrete = constants.%less_than_or_equal.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc36: = bound_method %.loc36_44.3, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc36: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc36(%.loc36_44.3) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc32: = bound_method %.loc32_44.3, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc32: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc32(%.loc32_44.3) // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc19: = bound_method %.loc19_38.3, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc19: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc19(%.loc19_38.3) // CHECK:STDOUT: @@ -2400,11 +2301,11 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc36(%self.param: ref bool) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc32(%self.param: ref bool) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc36(%self.param: ref bool) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc32(%self.param: ref bool) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc36(%self.param: ref bool) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc32(%self.param: ref bool) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.1(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl(%self.param) @@ -2565,9 +2466,9 @@ fn F() { // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %equal.patt: %pattern_type.831 = value_binding_pattern equal [concrete = constants.%equal.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %c1.ref.loc23: ref %EqualC = name_ref c1, %c1 -// CHECK:STDOUT: %c2.ref.loc23: ref %EqualC = name_ref c2, %c2 -// CHECK:STDOUT: %.loc23: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %c1.ref.loc21: ref %EqualC = name_ref c1, %c1 +// CHECK:STDOUT: %c2.ref.loc21: ref %EqualC = name_ref c2, %c2 +// CHECK:STDOUT: %.loc21: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %not_equal: bool = wrapper_binding not_equal, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %not_equal.patt: %pattern_type.831 = value_binding_pattern not_equal [concrete = constants.%not_equal.patt] @@ -3072,10 +2973,10 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: %c1.ref: %C = name_ref c1, %c1 // CHECK:STDOUT: %c2.ref: %C = name_ref c2, %c2 -// CHECK:STDOUT: %.loc14: type = splice_block %C.ref.loc14 [concrete = constants.%C] { -// CHECK:STDOUT: %Cpp.ref.loc14: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %GlobalOpN.ref.loc14: = name_ref GlobalOpN, imports.%GlobalOpN [concrete = imports.%GlobalOpN] -// CHECK:STDOUT: %C.ref.loc14: type = name_ref C, imports.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %.loc12: type = splice_block %C.ref.loc12 [concrete = constants.%C] { +// CHECK:STDOUT: %Cpp.ref.loc12: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %GlobalOpN.ref.loc12: = name_ref GlobalOpN, imports.%GlobalOpN [concrete = imports.%GlobalOpN] +// CHECK:STDOUT: %C.ref.loc12: type = name_ref C, imports.%C.decl [concrete = constants.%C] // CHECK:STDOUT: } // CHECK:STDOUT: %c3: %C = wrapper_binding c3, [concrete = ] // CHECK:STDOUT: name_binding_decl { diff --git a/toolchain/check/testdata/interop/cpp/operators/ordered_with.carbon b/toolchain/check/testdata/interop/cpp/operators/ordered_with.carbon index 1be030f0820a..a3f1470e2cab 100644 --- a/toolchain/check/testdata/interop/cpp/operators/ordered_with.carbon +++ b/toolchain/check/testdata/interop/cpp/operators/ordered_with.carbon @@ -118,15 +118,9 @@ library "[[@TEST_NAME]]"; import Cpp inline '''c++ struct LessReturnsBoolish { - // CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+9]]:8: error: cannot implicitly convert expression of type `i32` to `bool` [ConversionFailure] - // CHECK:STDERR: auto operator<(LessReturnsBoolish) const -> int; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+6]]:8: note: type `i32` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: auto operator<(LessReturnsBoolish) const -> int; - // CHECK:STDERR: ^ - // CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:28:3: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: fn Less(self, other: Other) -> bool; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+3]]:8: error: cannot implicitly convert expression of type `i32` to `bool` [ConversionFailure] + // CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+2]]:8: note: type `i32` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:28:3-38: note: while building thunk to match the signature of this function [ThunkSignature] auto operator<(LessReturnsBoolish) const -> int; auto operator<=(LessReturnsBoolish) const -> bool; auto operator>(LessReturnsBoolish) const -> bool; @@ -167,87 +161,37 @@ struct AllReturnBoolish { }; '''; -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+82]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+32]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-36]]:8: error: cannot implicitly convert expression of type `Core.Optional(i32* as Core.OptionalStorage)` to `bool` [ConversionFailure] -// CHECK:STDERR: auto operator<=(LessEqualReturnsBoolish) const -> int*; -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-39]]:8: note: type `Core.Optional(i32* as Core.OptionalStorage)` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: auto operator<=(LessEqualReturnsBoolish) const -> int*; -// CHECK:STDERR: ^ -// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:29:3: note: while building thunk to match the signature of this function [ThunkSignature] -// CHECK:STDERR: fn LessOrEquivalent(self, other: Other) -> bool; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+69]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-34]]:8: error: cannot implicitly convert expression of type `Core.Optional(i32* as Core.OptionalStorage)` to `bool` [ConversionFailure] +// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-35]]:8: note: type `Core.Optional(i32* as Core.OptionalStorage)` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:29:3-50: note: while building thunk to match the signature of this function [ThunkSignature] +// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+27]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-39]]:8: error: cannot implicitly convert expression of type `Cpp.Result` to `bool` [ConversionFailure] -// CHECK:STDERR: auto operator>=(GreaterEqualReturnsBoolish) const -> Result; -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-42]]:8: note: type `Cpp.Result` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: auto operator>=(GreaterEqualReturnsBoolish) const -> Result; -// CHECK:STDERR: ^ -// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:31:3: note: while building thunk to match the signature of this function [ThunkSignature] -// CHECK:STDERR: fn GreaterOrEquivalent(self, other: Other) -> bool; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+56]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-29]]:8: error: cannot implicitly convert expression of type `Cpp.Result` to `bool` [ConversionFailure] +// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-30]]:8: note: type `Cpp.Result` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:31:3-53: note: while building thunk to match the signature of this function [ThunkSignature] +// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+22]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-37]]:8: error: cannot implicitly convert expression of type `f64` to `bool` [ConversionFailure] -// CHECK:STDERR: auto operator<(AllReturnBoolish) const -> double; -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-40]]:8: note: type `f64` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: auto operator<(AllReturnBoolish) const -> double; -// CHECK:STDERR: ^ -// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:28:3: note: while building thunk to match the signature of this function [ThunkSignature] -// CHECK:STDERR: fn Less(self, other: Other) -> bool; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+43]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-19]]:8: error: cannot implicitly convert expression of type `f64` to `bool` [ConversionFailure] +// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-20]]:8: note: type `f64` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:28:3-38: note: while building thunk to match the signature of this function [ThunkSignature] +// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+17]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-49]]:8: error: cannot implicitly convert expression of type `f64` to `bool` [ConversionFailure] -// CHECK:STDERR: auto operator<=(AllReturnBoolish) const -> double; -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-52]]:8: note: type `f64` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: auto operator<=(AllReturnBoolish) const -> double; -// CHECK:STDERR: ^ -// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:29:3: note: while building thunk to match the signature of this function [ThunkSignature] -// CHECK:STDERR: fn LessOrEquivalent(self, other: Other) -> bool; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+30]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-23]]:8: error: cannot implicitly convert expression of type `f64` to `bool` [ConversionFailure] +// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-24]]:8: note: type `f64` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:29:3-50: note: while building thunk to match the signature of this function [ThunkSignature] +// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+12]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-61]]:8: error: cannot implicitly convert expression of type `f64` to `bool` [ConversionFailure] -// CHECK:STDERR: auto operator>(AllReturnBoolish) const -> double; -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-64]]:8: note: type `f64` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: auto operator>(AllReturnBoolish) const -> double; -// CHECK:STDERR: ^ -// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:30:3: note: while building thunk to match the signature of this function [ThunkSignature] -// CHECK:STDERR: fn Greater(self, other: Other) -> bool; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+17]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-27]]:8: error: cannot implicitly convert expression of type `f64` to `bool` [ConversionFailure] +// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-28]]:8: note: type `f64` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:30:3-41: note: while building thunk to match the signature of this function [ThunkSignature] +// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+7]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-73]]:8: error: cannot implicitly convert expression of type `f64` to `bool` [ConversionFailure] -// CHECK:STDERR: auto operator>=(AllReturnBoolish) const -> double; -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-76]]:8: note: type `f64` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: auto operator>=(AllReturnBoolish) const -> double; -// CHECK:STDERR: ^ -// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:31:3: note: while building thunk to match the signature of this function [ThunkSignature] -// CHECK:STDERR: fn GreaterOrEquivalent(self, other: Other) -> bool; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+4]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-31]]:8: error: cannot implicitly convert expression of type `f64` to `bool` [ConversionFailure] +// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-32]]:8: note: type `f64` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:31:3-53: note: while building thunk to match the signature of this function [ThunkSignature] +// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+2]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { x < y; @@ -332,57 +276,33 @@ fn Test(missing_less: Cpp.MissingLess, no_relevant_members: Cpp.NoRelevantMembers, less_returns_void: Cpp.LessReturnsVoid, less_non_const: Cpp.LessNonConst) { - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:3: error: cannot convert type `Cpp.MissingLess` into type implementing `Core.OrderedWith(Cpp.MissingLess)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: OrderedWith(missing_less, missing_less); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-17]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-41: error: cannot convert type `Cpp.MissingLess` into type implementing `Core.OrderedWith(Cpp.MissingLess)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-15]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: OrderedWith(missing_less, missing_less); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:3: error: cannot convert type `Cpp.MissingLessEqual` into type implementing `Core.OrderedWith(Cpp.MissingLessEqual)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: OrderedWith(missing_less_equal, missing_less_equal); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-26]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-53: error: cannot convert type `Cpp.MissingLessEqual` into type implementing `Core.OrderedWith(Cpp.MissingLessEqual)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-20]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: OrderedWith(missing_less_equal, missing_less_equal); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:3: error: cannot convert type `Cpp.MissingGreater` into type implementing `Core.OrderedWith(Cpp.MissingGreater)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: OrderedWith(missing_greater, missing_greater); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-35]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-47: error: cannot convert type `Cpp.MissingGreater` into type implementing `Core.OrderedWith(Cpp.MissingGreater)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-25]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: OrderedWith(missing_greater, missing_greater); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:3: error: cannot convert type `Cpp.MissingGreaterEqual` into type implementing `Core.OrderedWith(Cpp.MissingGreaterEqual)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: OrderedWith(missing_greater_equal, missing_greater_equal); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-44]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-59: error: cannot convert type `Cpp.MissingGreaterEqual` into type implementing `Core.OrderedWith(Cpp.MissingGreaterEqual)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-30]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: OrderedWith(missing_greater_equal, missing_greater_equal); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:3: error: cannot convert type `Cpp.NoRelevantMembers` into type implementing `Core.OrderedWith(Cpp.NoRelevantMembers)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: OrderedWith(no_relevant_members, no_relevant_members); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-53]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-55: error: cannot convert type `Cpp.NoRelevantMembers` into type implementing `Core.OrderedWith(Cpp.NoRelevantMembers)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-35]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: OrderedWith(no_relevant_members, no_relevant_members); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:3: error: cannot convert type `Cpp.LessReturnsVoid` into type implementing `Core.OrderedWith(Cpp.LessReturnsVoid)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: OrderedWith(less_returns_void, less_returns_void); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-62]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-51: error: cannot convert type `Cpp.LessReturnsVoid` into type implementing `Core.OrderedWith(Cpp.LessReturnsVoid)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-40]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: OrderedWith(less_returns_void, less_returns_void); diff --git a/toolchain/check/testdata/interop/cpp/operators/spaceship.carbon b/toolchain/check/testdata/interop/cpp/operators/spaceship.carbon index 85dff9d47c92..1f2ffc369b92 100644 --- a/toolchain/check/testdata/interop/cpp/operators/spaceship.carbon +++ b/toolchain/check/testdata/interop/cpp/operators/spaceship.carbon @@ -152,57 +152,31 @@ fn Test(default_spaceship_only: Cpp.DefaultSpaceshipOnly, returns_partial_ordering: Cpp.ReturnsPartialOrdering, cross_type_lhs: Cpp.CrossTypeLhs, cross_type_rhs: Cpp.CrossTypeRhs) { - // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE+7]]:3: error: semantics TODO: `Rewriting operator!= using operator== is not supported` [SemanticsTodo] - // CHECK:STDERR: EqWith(default_spaceship_only, default_spaceship_only); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-25]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE+3]]:3-56: error: semantics TODO: `Rewriting operator!= using operator== is not supported` [SemanticsTodo] + // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-23]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: EqWith(default_spaceship_only, default_spaceship_only); - // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE+7]]:3: error: semantics TODO: `Rewriting operator< using operator<=> is not supported` [SemanticsTodo] - // CHECK:STDERR: OrderedWith(default_spaceship_only, default_spaceship_only); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-27]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE+3]]:3-61: error: semantics TODO: `Rewriting operator< using operator<=> is not supported` [SemanticsTodo] + // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-21]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: OrderedWith(default_spaceship_only, default_spaceship_only); - // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE+7]]:3: error: semantics TODO: `Rewriting operator< using operator<=> is not supported` [SemanticsTodo] - // CHECK:STDERR: OrderedWith(returns_strong_ordering, returns_strong_ordering); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-35]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE+3]]:3-63: error: semantics TODO: `Rewriting operator< using operator<=> is not supported` [SemanticsTodo] + // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-25]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: OrderedWith(returns_strong_ordering, returns_strong_ordering); - // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE+7]]:3: error: semantics TODO: `Rewriting operator< using operator<=> is not supported` [SemanticsTodo] - // CHECK:STDERR: OrderedWith(returns_partial_ordering, returns_partial_ordering); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-43]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE+3]]:3-65: error: semantics TODO: `Rewriting operator< using operator<=> is not supported` [SemanticsTodo] + // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-29]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: OrderedWith(returns_partial_ordering, returns_partial_ordering); - // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE+7]]:3: error: semantics TODO: `Rewriting operator< using operator<=> is not supported` [SemanticsTodo] - // CHECK:STDERR: OrderedWith(cross_type_lhs, cross_type_rhs); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-51]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE+3]]:3-45: error: semantics TODO: `Rewriting operator< using operator<=> is not supported` [SemanticsTodo] + // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-33]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: OrderedWith(cross_type_lhs, cross_type_rhs); - // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE+11]]:3: error: semantics TODO: `Rewriting operator< using operator<=> is not supported` [SemanticsTodo] - // CHECK:STDERR: OrderedWith(cross_type_rhs, cross_type_lhs); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-59]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE+5]]:3-45: error: semantics TODO: `Rewriting operator< using operator<=> is not supported` [SemanticsTodo] + // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-37]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: - // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-52]]:9: warning: binding `returns_weak_ordering` unused [UnusedBinding] - // CHECK:STDERR: returns_weak_ordering: Cpp.ReturnsWeakOrdering, - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-28]]:9-54: warning: binding `returns_weak_ordering` unused [UnusedBinding] // CHECK:STDERR: OrderedWith(cross_type_rhs, cross_type_lhs); } @@ -216,12 +190,8 @@ import Cpp library "three_way_comparable_types.h"; fn EqWith[U: type, T: Core.EqWith(U)](unused x: T, unused y: U) {} fn Test(returns_strong_ordering: Cpp.ReturnsStrongOrdering) { - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:3: error: cannot convert type `Cpp.ReturnsStrongOrdering` into type implementing `Core.EqWith(Cpp.ReturnsStrongOrdering)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: EqWith(returns_strong_ordering, returns_strong_ordering); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn EqWith[U: type, T: Core.EqWith(U)](unused x: T, unused y: U) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-58: error: cannot convert type `Cpp.ReturnsStrongOrdering` into type implementing `Core.EqWith(Cpp.ReturnsStrongOrdering)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-4]]:1-65: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: EqWith(returns_strong_ordering, returns_strong_ordering); } diff --git a/toolchain/check/testdata/interop/cpp/primitive_types/arithmetic.carbon b/toolchain/check/testdata/interop/cpp/primitive_types/arithmetic.carbon index c7f9d3ebf204..bde42bb6cb9c 100644 --- a/toolchain/check/testdata/interop/cpp/primitive_types/arithmetic.carbon +++ b/toolchain/check/testdata/interop/cpp/primitive_types/arithmetic.carbon @@ -52,12 +52,8 @@ import Cpp; fn F() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_unsupported_types.carbon:[[@LINE+7]]:25: error: semantics TODO: `Unsupported: builtin type: long double` [SemanticsTodo] - // CHECK:STDERR: let cpp_long_double : Cpp.long_double = 1.0 as f64; - // CHECK:STDERR: ^~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_unsupported_types.carbon:[[@LINE+4]]:25: note: in `Cpp` name lookup for `long_double` [InCppNameLookup] - // CHECK:STDERR: let cpp_long_double : Cpp.long_double = 1.0 as f64; - // CHECK:STDERR: ^~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_unsupported_types.carbon:[[@LINE+3]]:25-39: error: semantics TODO: `Unsupported: builtin type: long double` [SemanticsTodo] + // CHECK:STDERR: fail_todo_unsupported_types.carbon:[[@LINE+2]]:25-39: note: in `Cpp` name lookup for `long_double` [InCppNameLookup] // CHECK:STDERR: let cpp_long_double : Cpp.long_double = 1.0 as f64; let unused carbon_long_double: f64 = cpp_long_double; @@ -71,9 +67,7 @@ library "[[@TEST_NAME]]"; import Cpp; fn F() { - // CHECK:STDERR: fail_not_builtin.carbon:[[@LINE+4]]:28: error: member name `not_builtin` not found in `Cpp` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: let unused not_builtin : Cpp.not_builtin = 1; - // CHECK:STDERR: ^~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_not_builtin.carbon:[[@LINE+2]]:28-42: error: member name `not_builtin` not found in `Cpp` [MemberNameNotFoundInInstScope] // CHECK:STDERR: let unused not_builtin : Cpp.not_builtin = 1; } @@ -87,9 +81,7 @@ namespace MyNamespace {} '''; fn F() { - // CHECK:STDERR: fail_lookup_in_other_scopes.carbon:[[@LINE+4]]:21: error: member name `long` not found in `Cpp.MyNamespace` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: let unused long : Cpp.MyNamespace.long = 1; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_lookup_in_other_scopes.carbon:[[@LINE+2]]:21-40: error: member name `long` not found in `Cpp.MyNamespace` [MemberNameNotFoundInInstScope] // CHECK:STDERR: let unused long : Cpp.MyNamespace.long = 1; } @@ -501,21 +493,21 @@ fn F() { // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %float: Core.FloatLiteral = float_literal_value 10e-1 [concrete = constants.%float.6da] -// CHECK:STDOUT: %f64.loc15: type = type_literal constants.%f64.761 [concrete = constants.%f64.761] +// CHECK:STDOUT: %f64.loc11: type = type_literal constants.%f64.761 [concrete = constants.%f64.761] // CHECK:STDOUT: %impl.elem0: %.dac = impl_witness_access constants.%As.impl_witness.553, element0 [concrete = constants.%Core.FloatLiteral.as.As.impl.Convert.882] -// CHECK:STDOUT: %bound_method.loc15_47.1: = bound_method %float, %impl.elem0 [concrete = constants.%Core.FloatLiteral.as.As.impl.Convert.bound] +// CHECK:STDOUT: %bound_method.loc11_47.1: = bound_method %float, %impl.elem0 [concrete = constants.%Core.FloatLiteral.as.As.impl.Convert.bound] // CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Core.FloatLiteral.as.As.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.As.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc15_47.2: = bound_method %float, %specific_fn [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.FloatLiteral.as.As.impl.Convert.call: init %f64.761 = call %bound_method.loc15_47.2(%float) [concrete = constants.%float.a71] -// CHECK:STDOUT: %.loc15_47.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.As.impl.Convert.call [concrete = constants.%float.a71] -// CHECK:STDOUT: %.loc15_47.2: %f64.761 = converted %float, %.loc15_47.1 [concrete = constants.%float.a71] +// CHECK:STDOUT: %bound_method.loc11_47.2: = bound_method %float, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.FloatLiteral.as.As.impl.Convert.call: init %f64.761 = call %bound_method.loc11_47.2(%float) [concrete = constants.%float.a71] +// CHECK:STDOUT: %.loc11_47.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.As.impl.Convert.call [concrete = constants.%float.a71] +// CHECK:STDOUT: %.loc11_47.2: %f64.761 = converted %float, %.loc11_47.1 [concrete = constants.%float.a71] // CHECK:STDOUT: // CHECK:STDOUT: %cpp_long_double: = wrapper_binding cpp_long_double, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %cpp_long_double.patt: = value_binding_pattern cpp_long_double [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %cpp_long_double.ref: = name_ref cpp_long_double, %cpp_long_double [concrete = ] -// CHECK:STDOUT: %f64.loc16: type = type_literal constants.%f64.761 [concrete = constants.%f64.761] +// CHECK:STDOUT: %f64.loc12: type = type_literal constants.%f64.761 [concrete = constants.%f64.761] // CHECK:STDOUT: %carbon_long_double: %f64.761 = wrapper_binding carbon_long_double, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %carbon_long_double.patt: %pattern_type.667 = value_binding_pattern carbon_long_double [concrete = constants.%carbon_long_double.patt] diff --git a/toolchain/check/testdata/interop/cpp/primitive_types/array.carbon b/toolchain/check/testdata/interop/cpp/primitive_types/array.carbon index 9d21e6e7b956..8d2a8656e57a 100644 --- a/toolchain/check/testdata/interop/cpp/primitive_types/array.carbon +++ b/toolchain/check/testdata/interop/cpp/primitive_types/array.carbon @@ -63,9 +63,7 @@ library "[[@TEST_NAME]]"; import Cpp; -// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+4]]:1: error: class was forward declared here [ClassForwardDeclaredHere] -// CHECK:STDERR: class C; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+2]]:1-8: error: class was forward declared here [ClassForwardDeclaredHere] // CHECK:STDERR: class C; @@ -73,12 +71,8 @@ fn F() -> array(C, 5)*; inline Cpp ''' void G() { - // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+7]]:33: error: subscript of pointer to incomplete type 'Carbon::C' [CppInteropParseError] - // CHECK:STDERR: 22 | Carbon::C *p = &(*Carbon::F())[0]; - // CHECK:STDERR: | ~~~~~~~~~~~~~~^ - // CHECK:STDERR: fail_incomplete.carbon:[[@LINE-9]]:8: note: forward declaration of 'Carbon::C' [CppInteropParseNote] - // CHECK:STDERR: 9 | class C; - // CHECK:STDERR: | ^ + // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+3]]:33: error: subscript of pointer to incomplete type 'Carbon::C' [CppInteropParseError] + // CHECK:STDERR: fail_incomplete.carbon:[[@LINE-7]]:8: note: forward declaration of 'Carbon::C' [CppInteropParseNote] // CHECK:STDERR: Carbon::C *p = &(*Carbon::F())[0]; } diff --git a/toolchain/check/testdata/interop/cpp/primitive_types/fail_todo_arithmetic_types_unmapped.carbon b/toolchain/check/testdata/interop/cpp/primitive_types/fail_todo_arithmetic_types_unmapped.carbon index 34d147be63a0..b30023220cea 100644 --- a/toolchain/check/testdata/interop/cpp/primitive_types/fail_todo_arithmetic_types_unmapped.carbon +++ b/toolchain/check/testdata/interop/cpp/primitive_types/fail_todo_arithmetic_types_unmapped.carbon @@ -20,8 +20,6 @@ import Cpp inline ''' auto GetWC() -> wchar_t; '''; -// CHECK:STDERR: fail_todo_wide_char_t.carbon:[[@LINE+4]]:32: error: semantics TODO: `Unsupported: return type: wchar_t` [SemanticsTodo] -// CHECK:STDERR: fn CallGetWC() -> u32 { return Cpp.GetWC(); } -// CHECK:STDERR: ^~~~~~~~~~~ +// CHECK:STDERR: fail_todo_wide_char_t.carbon:[[@LINE+2]]:32-42: error: semantics TODO: `Unsupported: return type: wchar_t` [SemanticsTodo] // CHECK:STDERR: fn CallGetWC() -> u32 { return Cpp.GetWC(); } diff --git a/toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.darwin.carbon b/toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.darwin.carbon index ffdfb0a2b14d..f3c072598006 100644 --- a/toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.darwin.carbon +++ b/toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.darwin.carbon @@ -85,12 +85,8 @@ import Cpp; fn F() { let carbon_i64: i64 = 1; - // CHECK:STDERR: fail_implicit_conversion_i64_to_long.carbon:[[@LINE+7]]:35: error: cannot implicitly convert expression of type `i64` to `Cpp.long` [ConversionFailure] - // CHECK:STDERR: let unused cpp_long: Cpp.long = carbon_i64; - // CHECK:STDERR: ^~~~~~~~~~ - // CHECK:STDERR: fail_implicit_conversion_i64_to_long.carbon:[[@LINE+4]]:35: note: type `i64` does not implement interface `Core.ImplicitAs(Cpp.long)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let unused cpp_long: Cpp.long = carbon_i64; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_implicit_conversion_i64_to_long.carbon:[[@LINE+3]]:35-44: error: cannot implicitly convert expression of type `i64` to `Cpp.long` [ConversionFailure] + // CHECK:STDERR: fail_implicit_conversion_i64_to_long.carbon:[[@LINE+2]]:35-44: note: type `i64` does not implement interface `Core.ImplicitAs(Cpp.long)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused cpp_long: Cpp.long = carbon_i64; } @@ -214,14 +210,10 @@ import Cpp; fn ComparisonsHeterogeneousLongAndI128() { let a: Cpp.long = 1; let b: i128 = 1; - // CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_and_i128.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Core.EqWith(i128)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: a == b; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.EqWith(i128)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: a == b; - // CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_and_i128.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Core.EqWith(Cpp.long)` in type `i128` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: b == a; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.EqWith(Cpp.long)` in type `i128` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: b == a; } @@ -322,14 +314,10 @@ fn AssertSameType[T: type](unused a: T, unused b: T) {} fn ArithmeticHeterogeneousLongAndI128() { let x: Cpp.long = 1; let y: i128 = 1; - // CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_and_i128.carbon:[[@LINE+4]]:18: error: cannot access member of interface `Core.AddWith(i128)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: AssertSameType(x + y, y); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.AddWith(i128)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: AssertSameType(x + y, y); - // CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_and_i128.carbon:[[@LINE+4]]:18: error: cannot access member of interface `Core.AddWith(Cpp.long)` in type `i128` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: AssertSameType(y + x, y); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.AddWith(Cpp.long)` in type `i128` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: AssertSameType(y + x, y); } @@ -432,14 +420,10 @@ fn BitWiseHeterogeneousLongAndI128() { let a: Cpp.long = 1; let b: i128 = 1; - // CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_and_i128.carbon:[[@LINE+4]]:18: error: cannot access member of interface `Core.BitAndWith(i128)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: AssertSameType(a & b, b); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.BitAndWith(i128)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: AssertSameType(a & b, b); - // CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_and_i128.carbon:[[@LINE+4]]:18: error: cannot access member of interface `Core.BitAndWith(Cpp.long)` in type `i128` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: AssertSameType(b & a, b); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.BitAndWith(Cpp.long)` in type `i128` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: AssertSameType(b & a, b); } @@ -539,9 +523,7 @@ import Cpp; fn CompoundAssignmentHeterogeneousLongAndI64() { var a: Cpp.long = 1; - // CHECK:STDERR: fail_compound_assignment_heterogeneous_long_and_i64.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Core.AddAssignWith(i64)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: a += (1 as i64); - // CHECK:STDERR: ^~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_compound_assignment_heterogeneous_long_and_i64.carbon:[[@LINE+2]]:3-17: error: cannot access member of interface `Core.AddAssignWith(i64)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: a += (1 as i64); } @@ -599,12 +581,8 @@ fn F() { // For portability reasons, this is not allowed even though `u64` // happens to fit in `unsigned long` on this target. - // CHECK:STDERR: fail_pass_u64_to_ulong.carbon:[[@LINE+7]]:53: error: cannot implicitly convert expression of type `u64` to `Cpp.unsigned_long` [ConversionFailure] - // CHECK:STDERR: let unused cpp_unsigned_long: Cpp.unsigned_long = carbon_u64; - // CHECK:STDERR: ^~~~~~~~~~ - // CHECK:STDERR: fail_pass_u64_to_ulong.carbon:[[@LINE+4]]:53: note: type `u64` does not implement interface `Core.ImplicitAs(Cpp.unsigned_long)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let unused cpp_unsigned_long: Cpp.unsigned_long = carbon_u64; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_pass_u64_to_ulong.carbon:[[@LINE+3]]:53-62: error: cannot implicitly convert expression of type `u64` to `Cpp.unsigned_long` [ConversionFailure] + // CHECK:STDERR: fail_pass_u64_to_ulong.carbon:[[@LINE+2]]:53-62: note: type `u64` does not implement interface `Core.ImplicitAs(Cpp.unsigned_long)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused cpp_unsigned_long: Cpp.unsigned_long = carbon_u64; } diff --git a/toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.llp64.carbon b/toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.llp64.carbon index 744e7a8c4b88..1e7d2fa1a18d 100644 --- a/toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.llp64.carbon +++ b/toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.llp64.carbon @@ -79,12 +79,8 @@ import Cpp; fn F() { let cpp_long: Cpp.long = 1; - // CHECK:STDERR: fail_implicit_conversion_long_to_i32.carbon:[[@LINE+7]]:32: error: cannot implicitly convert expression of type `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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let unused carbon_i32: i32 = cpp_long; - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_implicit_conversion_long_to_i32.carbon:[[@LINE+3]]:32-39: error: cannot implicitly convert expression of type `long` to `i32` [ConversionFailure] + // CHECK:STDERR: fail_implicit_conversion_long_to_i32.carbon:[[@LINE+2]]:32-39: note: type `Cpp.long` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused carbon_i32: i32 = cpp_long; } @@ -195,14 +191,10 @@ import Cpp; fn ComparisonsHeterogeneousLongAndI16() { let a: Cpp.long = 1; let b: i16 = 1; - // CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_and_i16.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Core.EqWith(i16)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: a == b; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_and_i16.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.EqWith(i16)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: a == b; - // CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_and_i16.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Core.EqWith(Cpp.long)` in type `i16` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: b == a; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_and_i16.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.EqWith(Cpp.long)` in type `i16` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: b == a; } @@ -216,14 +208,10 @@ import Cpp; fn ComparisonsHeterogeneousLongAndI128() { let a: Cpp.long = 1; let b: i128 = 1; - // CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_and_i128.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Core.EqWith(i128)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: a == b; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.EqWith(i128)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: a == b; - // CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_and_i128.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Core.EqWith(Cpp.long)` in type `i128` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: b == a; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.EqWith(Cpp.long)` in type `i128` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: b == a; } @@ -325,15 +313,11 @@ fn AssertSameType[T: type](unused a: T, unused b: T) {} fn ArithmeticHeterogeneousLongAndI16() { let x: Cpp.long = 1; let y: i16 = 1; - // CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_and_i16.carbon:[[@LINE+4]]:18: error: cannot access member of interface `Core.AddWith(i16)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: AssertSameType(x + y, x); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_and_i16.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.AddWith(i16)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: AssertSameType(x + y, x); - // CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_and_i16.carbon:[[@LINE+4]]:18: error: cannot access member of interface `Core.AddWith(Cpp.long)` in type `i16` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: AssertSameType(y + x, x); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_and_i16.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.AddWith(Cpp.long)` in type `i16` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: AssertSameType(y + x, x); } @@ -349,15 +333,11 @@ fn AssertSameType[T: type](unused a: T, unused b: T) {} fn ArithmeticHeterogeneousLongAndI128() { let x: Cpp.long = 1; let y: i128 = 1; - // CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_and_i128.carbon:[[@LINE+4]]:18: error: cannot access member of interface `Core.AddWith(i128)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: AssertSameType(x + y, y); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.AddWith(i128)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: AssertSameType(x + y, y); - // CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_and_i128.carbon:[[@LINE+4]]:18: error: cannot access member of interface `Core.AddWith(Cpp.long)` in type `i128` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: AssertSameType(y + x, y); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.AddWith(Cpp.long)` in type `i128` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: AssertSameType(y + x, y); } @@ -461,14 +441,10 @@ fn BitWiseHeterogeneousLongAndI16() { let a: Cpp.long = 1; let b: i16 = 1; - // CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_and_i16.carbon:[[@LINE+4]]:18: error: cannot access member of interface `Core.BitAndWith(i16)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: AssertSameType(a & b, a); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_and_i16.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.BitAndWith(i16)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: AssertSameType(a & b, a); - // CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_and_i16.carbon:[[@LINE+4]]:18: error: cannot access member of interface `Core.BitAndWith(Cpp.long)` in type `i16` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: AssertSameType(b & a, a); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_and_i16.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.BitAndWith(Cpp.long)` in type `i16` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: AssertSameType(b & a, a); } @@ -485,14 +461,10 @@ fn BitWiseHeterogeneousLongAndI128() { let a: Cpp.long = 1; let b: i128 = 1; - // CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_and_i128.carbon:[[@LINE+4]]:18: error: cannot access member of interface `Core.BitAndWith(i128)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: AssertSameType(a & b, b); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.BitAndWith(i128)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: AssertSameType(a & b, b); - // CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_and_i128.carbon:[[@LINE+4]]:18: error: cannot access member of interface `Core.BitAndWith(Cpp.long)` in type `i128` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: AssertSameType(b & a, b); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.BitAndWith(Cpp.long)` in type `i128` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: AssertSameType(b & a, b); } @@ -581,9 +553,7 @@ import Cpp; fn CompoundAssignmentHeterogeneousI16Long() { var a: Cpp.long = 1; - // CHECK:STDERR: fail_todo_compound_assignment_heterogeneous_long_and_i16.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Core.AddAssignWith(i16)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: a += (1 as i16); - // CHECK:STDERR: ^~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_compound_assignment_heterogeneous_long_and_i16.carbon:[[@LINE+2]]:3-17: error: cannot access member of interface `Core.AddAssignWith(i16)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: a += (1 as i16); } @@ -596,9 +566,7 @@ import Cpp; fn CompoundAssignmentHeterogeneousI64Long() { var a: Cpp.long = 1; - // CHECK:STDERR: fail_compound_assignment_heterogeneous_long_and_i64.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Core.AddAssignWith(i64)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: a += (1 as i64); - // CHECK:STDERR: ^~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_compound_assignment_heterogeneous_long_and_i64.carbon:[[@LINE+2]]:3-17: error: cannot access member of interface `Core.AddAssignWith(i64)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: a += (1 as i64); } @@ -656,16 +624,10 @@ fn F() { // For portability reasons, this is not allowed even though `unsigned long` // happens to fit in `u32` on this target. - // CHECK:STDERR: fail_no_ulong_to_u32.carbon:[[@LINE+11]]:25: error: cannot implicitly convert expression of type `unsigned_long` to `u32` [ConversionFailure] - // CHECK:STDERR: let carbon_u32: u32 = cpp_unsigned_long; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_no_ulong_to_u32.carbon:[[@LINE+8]]:25: note: type `Cpp.unsigned_long` does not implement interface `Core.ImplicitAs(u32)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let carbon_u32: u32 = cpp_unsigned_long; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_no_ulong_to_u32.carbon:[[@LINE+5]]:25-41: error: cannot implicitly convert expression of type `unsigned_long` to `u32` [ConversionFailure] + // CHECK:STDERR: fail_no_ulong_to_u32.carbon:[[@LINE+4]]:25-41: note: type `Cpp.unsigned_long` does not implement interface `Core.ImplicitAs(u32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: - // CHECK:STDERR: fail_no_ulong_to_u32.carbon:[[@LINE+4]]:7: warning: binding `carbon_u32` unused [UnusedBinding] - // CHECK:STDERR: let carbon_u32: u32 = cpp_unsigned_long; - // CHECK:STDERR: ^~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_no_ulong_to_u32.carbon:[[@LINE+2]]:7-21: warning: binding `carbon_u32` unused [UnusedBinding] // CHECK:STDERR: let carbon_u32: u32 = cpp_unsigned_long; } diff --git a/toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.lp64.carbon b/toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.lp64.carbon index a15e592dfaa3..136fb32255ae 100644 --- a/toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.lp64.carbon +++ b/toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.lp64.carbon @@ -78,12 +78,8 @@ import Cpp; fn F() { let cpp_long_long: Cpp.long_long = 1; - // CHECK:STDERR: fail_implicit_conversion_long_long_to_i64.carbon:[[@LINE+7]]:32: error: cannot implicitly convert expression of type `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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let unused carbon_i64: i64 = cpp_long_long; - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_implicit_conversion_long_long_to_i64.carbon:[[@LINE+3]]:32-44: error: cannot implicitly convert expression of type `long_long` to `i64` [ConversionFailure] + // CHECK:STDERR: fail_implicit_conversion_long_long_to_i64.carbon:[[@LINE+2]]:32-44: note: type `Cpp.long_long` does not implement interface `Core.ImplicitAs(i64)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused carbon_i64: i64 = cpp_long_long; } @@ -181,14 +177,10 @@ import Cpp; fn ComparisonsHeterogeneousLongLongAndI32() { let a: Cpp.long_long = 1; let b: i32 = 1; - // CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_long_and_i32.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Core.EqWith(i32)` in type `Cpp.long_long` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: a == b; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_long_and_i32.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.EqWith(i32)` in type `Cpp.long_long` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: a == b; - // CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_long_and_i32.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Core.EqWith(Cpp.long_long)` in type `i32` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: b == a; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_long_and_i32.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.EqWith(Cpp.long_long)` in type `i32` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: b == a; } @@ -215,14 +207,10 @@ import Cpp; fn ComparisonsHeterogeneousLongLongAndI256() { let a: Cpp.long_long = 1; let b: i256 = 1; - // CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_long_and_i256.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Core.EqWith(i256)` in type `Cpp.long_long` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: a == b; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_long_and_i256.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.EqWith(i256)` in type `Cpp.long_long` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: a == b; - // CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_long_and_i256.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Core.EqWith(Cpp.long_long)` in type `i256` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: b == a; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_long_and_i256.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.EqWith(Cpp.long_long)` in type `i256` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: b == a; } @@ -307,15 +295,11 @@ fn AssertSameType[T: type](unused a: T, unused b: T) {} fn ArithmeticHeterogeneousLongLongAndI32() { let x: Cpp.long_long = 1; let y: i32 = 1; - // CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_long_and_i32.carbon:[[@LINE+4]]:18: error: cannot access member of interface `Core.AddWith(i32)` in type `Cpp.long_long` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: AssertSameType(x + y, x); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_long_and_i32.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.AddWith(i32)` in type `Cpp.long_long` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: AssertSameType(x + y, x); - // CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_long_and_i32.carbon:[[@LINE+4]]:18: error: cannot access member of interface `Core.AddWith(Cpp.long_long)` in type `i32` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: AssertSameType(y + x, x); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_long_and_i32.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.AddWith(Cpp.long_long)` in type `i32` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: AssertSameType(y + x, x); } @@ -417,14 +401,10 @@ fn BitWiseHeterogeneousLongLongAndI32() { let a: Cpp.long_long = 1; let b: i32 = 1; - // CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_long_and_i32.carbon:[[@LINE+4]]:18: error: cannot access member of interface `Core.BitAndWith(i32)` in type `Cpp.long_long` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: AssertSameType(a & b, a); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_long_and_i32.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.BitAndWith(i32)` in type `Cpp.long_long` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: AssertSameType(a & b, a); - // CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_long_and_i32.carbon:[[@LINE+4]]:18: error: cannot access member of interface `Core.BitAndWith(Cpp.long_long)` in type `i32` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: AssertSameType(b & a, a); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_long_and_i32.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.BitAndWith(Cpp.long_long)` in type `i32` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: AssertSameType(b & a, a); } @@ -529,9 +509,7 @@ import Cpp; fn CompoundAssignmentHeterogeneousLongLongAndI32() { var a: Cpp.long_long = 1; - // CHECK:STDERR: fail_todo_compound_assignment_heterogeneous_long_long_and_i32.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Core.AddAssignWith(i32)` in type `Cpp.long_long` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: a += (1 as i32); - // CHECK:STDERR: ^~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_compound_assignment_heterogeneous_long_long_and_i32.carbon:[[@LINE+2]]:3-17: error: cannot access member of interface `Core.AddAssignWith(i32)` in type `Cpp.long_long` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: a += (1 as i32); } @@ -544,9 +522,7 @@ import Cpp; fn CompoundAssignmentHeterogeneousLongLongAndI128() { var a: Cpp.long_long = 1; - // CHECK:STDERR: fail_compound_assignment_heterogeneous_long_long_and_i128.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Core.AddAssignWith(i128)` in type `Cpp.long_long` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: a += (1 as i128); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_compound_assignment_heterogeneous_long_long_and_i128.carbon:[[@LINE+2]]:3-18: error: cannot access member of interface `Core.AddAssignWith(i128)` in type `Cpp.long_long` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: a += (1 as i128); } @@ -604,16 +580,10 @@ fn F() { // For portability reasons, this is not allowed even though `unsigned long // long` happens to fit in `u64` on this target. - // CHECK:STDERR: fail_pass_ulonglong_to_u64.carbon:[[@LINE+11]]:25: error: cannot implicitly convert expression of type `unsigned_long_long` to `u64` [ConversionFailure] - // CHECK:STDERR: let carbon_u64: u64 = cpp_unsigned_long_long; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_pass_ulonglong_to_u64.carbon:[[@LINE+8]]:25: note: type `Cpp.unsigned_long_long` does not implement interface `Core.ImplicitAs(u64)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let carbon_u64: u64 = cpp_unsigned_long_long; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_pass_ulonglong_to_u64.carbon:[[@LINE+5]]:25-46: error: cannot implicitly convert expression of type `unsigned_long_long` to `u64` [ConversionFailure] + // CHECK:STDERR: fail_pass_ulonglong_to_u64.carbon:[[@LINE+4]]:25-46: note: type `Cpp.unsigned_long_long` does not implement interface `Core.ImplicitAs(u64)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: - // CHECK:STDERR: fail_pass_ulonglong_to_u64.carbon:[[@LINE+4]]:7: warning: binding `carbon_u64` unused [UnusedBinding] - // CHECK:STDERR: let carbon_u64: u64 = cpp_unsigned_long_long; - // CHECK:STDERR: ^~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_pass_ulonglong_to_u64.carbon:[[@LINE+2]]:7-21: warning: binding `carbon_u64` unused [UnusedBinding] // CHECK:STDERR: let carbon_u64: u64 = cpp_unsigned_long_long; } diff --git a/toolchain/check/testdata/interop/cpp/primitive_types/void.carbon b/toolchain/check/testdata/interop/cpp/primitive_types/void.carbon index 3b2ac73a372b..c0b7a3922ee0 100644 --- a/toolchain/check/testdata/interop/cpp/primitive_types/void.carbon +++ b/toolchain/check/testdata/interop/cpp/primitive_types/void.carbon @@ -27,12 +27,8 @@ library "[[@TEST_NAME]]"; import Cpp; fn G() { - // CHECK:STDERR: fail_void_abstract.carbon:[[@LINE+7]]:17: error: binding pattern has abstract type `Cpp.void` in `var` pattern [AbstractTypeInVarPattern] - // CHECK:STDERR: var unused x: Cpp.void; - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: {{.*}}/prelude/types/cpp/void.carbon:24:1: note: class was declared abstract here [ClassAbstractHere] - // CHECK:STDERR: abstract class CppCompat.VoidBase { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_void_abstract.carbon:[[@LINE+3]]:17-24: error: binding pattern has abstract type `Cpp.void` in `var` pattern [AbstractTypeInVarPattern] + // CHECK:STDERR: {{.*}}/prelude/types/cpp/void.carbon:24:1-35: note: class was declared abstract here [ClassAbstractHere] // CHECK:STDERR: var unused x: Cpp.void; } @@ -44,23 +40,17 @@ library "[[@TEST_NAME]]"; import Cpp inline "void F(int);"; fn G(v: Cpp.void) { - // CHECK:STDERR: fail_void_argument.carbon:[[@LINE+7]]:10: error: no matching function for call to 'F' [CppInteropParseError] - // CHECK:STDERR: 14 | Cpp.F(v); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_void_argument.carbon:[[@LINE-6]]:6: note: candidate function not viable: cannot convert argument of incomplete type 'void' to 'int' for 1st argument [CppInteropParseNote] - // CHECK:STDERR: 4 | void F(int); - // CHECK:STDERR: | ^ ~~~ + // CHECK:STDERR: fail_void_argument.carbon:[[@LINE+4]]:3-7: error: no matching function for call to 'F' [CppInteropParseError] + // CHECK:STDERR: fail_void_argument.carbon:[[@LINE-4]]:6: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: fail_void_argument.carbon:[[@LINE-5]]:8-10: note: cannot convert argument of incomplete type 'void' to 'int' for 1st argument [CppInteropParseNoteReason] // CHECK:STDERR: Cpp.F(v); } fn H(p: Cpp.void*) { - // CHECK:STDERR: fail_void_argument.carbon:[[@LINE+7]]:11: error: no matching function for call to 'F' [CppInteropParseError] - // CHECK:STDERR: 25 | Cpp.F(*p); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_void_argument.carbon:[[@LINE-17]]:6: note: candidate function not viable: cannot convert argument of incomplete type 'void' to 'int' for 1st argument [CppInteropParseNote] - // CHECK:STDERR: 4 | void F(int); - // CHECK:STDERR: | ^ ~~~ + // CHECK:STDERR: fail_void_argument.carbon:[[@LINE+4]]:3-7: error: no matching function for call to 'F' [CppInteropParseError] + // CHECK:STDERR: fail_void_argument.carbon:[[@LINE-12]]:6: note: candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: fail_void_argument.carbon:[[@LINE-13]]:8-10: note: cannot convert argument of incomplete type 'void' to 'int' for 1st argument [CppInteropParseNoteReason] // CHECK:STDERR: Cpp.F(*p); } diff --git a/toolchain/check/testdata/interop/cpp/primitive_types/void_pointer.carbon b/toolchain/check/testdata/interop/cpp/primitive_types/void_pointer.carbon index c9dd376a3c5f..09b1282fffab 100644 --- a/toolchain/check/testdata/interop/cpp/primitive_types/void_pointer.carbon +++ b/toolchain/check/testdata/interop/cpp/primitive_types/void_pointer.carbon @@ -76,12 +76,8 @@ struct S {}; fn F(input: Cpp.void*) { //@dump-sem-ir-begin - // CHECK:STDERR: fail_explicit_as_from_void_pointer_to_cpp_class_pointer.carbon:[[@LINE+7]]:26: error: cannot convert expression of type `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*)` [MissingImplInMemberAccessInContext] - // 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+3]]:26-40: error: cannot convert expression of type `void*` to `Cpp.S*` with `as` [ConversionFailure] + // CHECK:STDERR: fail_explicit_as_from_void_pointer_to_cpp_class_pointer.carbon:[[@LINE+2]]:26-40: note: type `Cpp.void*` does not implement interface `Core.As(Cpp.S*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused p: Cpp.S* = input as Cpp.S*; //@dump-sem-ir-end @@ -97,12 +93,8 @@ class C {} fn F(input: Cpp.void*) { //@dump-sem-ir-begin - // CHECK:STDERR: fail_explicit_as_from_void_pointer_to_carbon_class_pointer.carbon:[[@LINE+7]]:22: error: cannot convert expression of type `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*)` [MissingImplInMemberAccessInContext] - // 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+3]]:22-32: error: cannot convert expression of type `void*` to `C*` with `as` [ConversionFailure] + // CHECK:STDERR: fail_explicit_as_from_void_pointer_to_carbon_class_pointer.carbon:[[@LINE+2]]:22-32: note: type `Cpp.void*` does not implement interface `Core.As(C*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused p: C* = input as C*; //@dump-sem-ir-end @@ -406,14 +398,14 @@ fn F(input: Cpp.void*) { // CHECK:STDOUT: fn @F(%input.param: %ptr.00a) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %input.ref: %ptr.00a = name_ref input, %input -// CHECK:STDOUT: %Cpp.ref.loc17_35: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %S.ref.loc17_38: type = name_ref S, imports.%S.decl [concrete = constants.%S] -// CHECK:STDOUT: %ptr.loc17_40: type = ptr_type %S.ref.loc17_38 [concrete = constants.%ptr.037] -// CHECK:STDOUT: %.loc17_32: %ptr.037 = converted %input.ref, [concrete = ] -// CHECK:STDOUT: %.loc17_22: type = splice_block %ptr.loc17_22 [concrete = constants.%ptr.037] { -// CHECK:STDOUT: %Cpp.ref.loc17_17: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %S.ref.loc17_20: type = name_ref S, imports.%S.decl [concrete = constants.%S] -// CHECK:STDOUT: %ptr.loc17_22: type = ptr_type %S.ref.loc17_20 [concrete = constants.%ptr.037] +// CHECK:STDOUT: %Cpp.ref.loc13_35: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %S.ref.loc13_38: type = name_ref S, imports.%S.decl [concrete = constants.%S] +// CHECK:STDOUT: %ptr.loc13_40: type = ptr_type %S.ref.loc13_38 [concrete = constants.%ptr.037] +// CHECK:STDOUT: %.loc13_32: %ptr.037 = converted %input.ref, [concrete = ] +// CHECK:STDOUT: %.loc13_22: type = splice_block %ptr.loc13_22 [concrete = constants.%ptr.037] { +// CHECK:STDOUT: %Cpp.ref.loc13_17: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %S.ref.loc13_20: type = name_ref S, imports.%S.decl [concrete = constants.%S] +// CHECK:STDOUT: %ptr.loc13_22: type = ptr_type %S.ref.loc13_20 [concrete = constants.%ptr.037] // CHECK:STDOUT: } // CHECK:STDOUT: %p: %ptr.037 = wrapper_binding p, [concrete = ] // CHECK:STDOUT: name_binding_decl { @@ -437,12 +429,12 @@ fn F(input: Cpp.void*) { // CHECK:STDOUT: fn @F(%input.param: %ptr.00a) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %input.ref: %ptr.00a = name_ref input, %input -// CHECK:STDOUT: %C.ref.loc17_31: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %ptr.loc17_32: type = ptr_type %C.ref.loc17_31 [concrete = constants.%ptr.6b6] -// CHECK:STDOUT: %.loc17_28: %ptr.6b6 = converted %input.ref, [concrete = ] -// CHECK:STDOUT: %.loc17_18: type = splice_block %ptr.loc17_18 [concrete = constants.%ptr.6b6] { -// CHECK:STDOUT: %C.ref.loc17_17: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %ptr.loc17_18: type = ptr_type %C.ref.loc17_17 [concrete = constants.%ptr.6b6] +// CHECK:STDOUT: %C.ref.loc13_31: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %ptr.loc13_32: type = ptr_type %C.ref.loc13_31 [concrete = constants.%ptr.6b6] +// CHECK:STDOUT: %.loc13_28: %ptr.6b6 = converted %input.ref, [concrete = ] +// CHECK:STDOUT: %.loc13_18: type = splice_block %ptr.loc13_18 [concrete = constants.%ptr.6b6] { +// CHECK:STDOUT: %C.ref.loc13_17: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %ptr.loc13_18: type = ptr_type %C.ref.loc13_17 [concrete = constants.%ptr.6b6] // CHECK:STDOUT: } // CHECK:STDOUT: %p: %ptr.6b6 = wrapper_binding p, [concrete = ] // CHECK:STDOUT: name_binding_decl { diff --git a/toolchain/check/testdata/interop/cpp/range_for.carbon b/toolchain/check/testdata/interop/cpp/range_for.carbon index d023ecad41c9..818b9d32faea 100644 --- a/toolchain/check/testdata/interop/cpp/range_for.carbon +++ b/toolchain/check/testdata/interop/cpp/range_for.carbon @@ -244,32 +244,20 @@ class MutableRange { friend auto operator!=(Iterator, Iterator) -> bool; }; public: - // CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE+6]]:34: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: friend auto begin(MutableRange&) -> Iterator; - // CHECK:STDERR: ^ - // CHECK:STDERR: {{.*}}/prelude/iterate.carbon:41:3: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: fn Begin(self) -> Iterator; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE+2]]:34: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: {{.*}}/prelude/iterate.carbon:41:3-29: note: while building thunk to match the signature of this function [ThunkSignature] friend auto begin(MutableRange&) -> Iterator; friend auto end(MutableRange&) -> Iterator; }; } // namespace N '''; -// CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE+15]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: fn TestIterate[R: Core.Iterate where .ElementType = f64](r: R) { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE+7]]:1-64: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: // CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon: error: value expression passed to reference parameter [ValueForRefParam] -// CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE-10]]:32: note: initializing function parameter [InCallToFunctionParam] -// CHECK:STDERR: friend auto end(MutableRange&) -> Iterator; -// CHECK:STDERR: ^ -// CHECK:STDERR: {{.*}}/prelude/iterate.carbon:42:3: note: while building thunk to match the signature of this function [ThunkSignature] -// CHECK:STDERR: fn End(self) -> Sentinel; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE+4]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: fn TestIterate[R: Core.Iterate where .ElementType = f64](r: R) { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE-8]]:32: note: initializing function parameter [InCallToFunctionParam] +// CHECK:STDERR: {{.*}}/prelude/iterate.carbon:42:3-27: note: while building thunk to match the signature of this function [ThunkSignature] +// CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE+2]]:1-64: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: fn TestIterate[R: Core.Iterate where .ElementType = f64](r: R) { var sum: f64 = 0.0; @@ -368,32 +356,20 @@ class MutableRange { friend auto operator!=(Sentinel, Iterator) -> bool; }; public: - // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+6]]:34: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: friend auto begin(MutableRange&) -> Iterator; - // CHECK:STDERR: ^ - // CHECK:STDERR: {{.*}}/prelude/iterate.carbon:41:3: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: fn Begin(self) -> Iterator; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+2]]:34: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: {{.*}}/prelude/iterate.carbon:41:3-29: note: while building thunk to match the signature of this function [ThunkSignature] friend auto begin(MutableRange&) -> Iterator; friend auto end(MutableRange&) -> Sentinel; }; } '''; -// CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+15]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: fn TestIterate[R: Core.Iterate where .ElementType = Cpp.DiffMutableADL.ValueType](r: R) { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+7]]:1-89: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon: error: value expression passed to reference parameter [ValueForRefParam] -// CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE-10]]:32: note: initializing function parameter [InCallToFunctionParam] -// CHECK:STDERR: friend auto end(MutableRange&) -> Sentinel; -// CHECK:STDERR: ^ -// CHECK:STDERR: {{.*}}/prelude/iterate.carbon:42:3: note: while building thunk to match the signature of this function [ThunkSignature] -// CHECK:STDERR: fn End(self) -> Sentinel; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+4]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: fn TestIterate[R: Core.Iterate where .ElementType = Cpp.DiffMutableADL.ValueType](r: R) { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE-8]]:32: note: initializing function parameter [InCallToFunctionParam] +// CHECK:STDERR: {{.*}}/prelude/iterate.carbon:42:3-27: note: while building thunk to match the signature of this function [ThunkSignature] +// CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+2]]:1-89: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: fn TestIterate[R: Core.Iterate where .ElementType = Cpp.DiffMutableADL.ValueType](r: R) { var sum: Cpp.DiffMutableADL.ValueType = Cpp.DiffMutableADL.ValueType.ValueType(); @@ -406,19 +382,11 @@ fn TestIterate[R: Core.Iterate where .ElementType = Cpp.DiffMutableADL.ValueType } fn TestIterateDriver(var m: Cpp.DiffMutableADL.MutableRange) { - // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+14]]:3: error: semantics TODO: `Rewriting operator== using operator== is not supported` [SemanticsTodo] - // CHECK:STDERR: TestIterate(m); - // CHECK:STDERR: ^~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE-14]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn TestIterate[R: Core.Iterate where .ElementType = Cpp.DiffMutableADL.ValueType](r: R) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+6]]:3-16: error: semantics TODO: `Rewriting operator== using operator== is not supported` [SemanticsTodo] + // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE-12]]:1-89: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: - // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+7]]:3: error: cannot convert type `Cpp.DiffMutableADL.MutableRange` into type implementing `Core.Iterate where .(Core.Iterate.ElementType) = Cpp.DiffMutableADL.ValueType as Core.Destroy & Core.Copy` [ConversionFailureTypeToFacet] - // CHECK:STDERR: TestIterate(m); - // CHECK:STDERR: ^~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE-21]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn TestIterate[R: Core.Iterate where .ElementType = Cpp.DiffMutableADL.ValueType](r: R) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+3]]:3-16: error: cannot convert type `Cpp.DiffMutableADL.MutableRange` into type implementing `Core.Iterate where .(Core.Iterate.ElementType) = Cpp.DiffMutableADL.ValueType as Core.Destroy & Core.Copy` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE-15]]:1-89: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: TestIterate(m); } @@ -427,9 +395,7 @@ fn TestRangeFor(var m: Cpp.DiffMutableADL.MutableRange) { var sum: Cpp.DiffMutableADL.ValueType = Cpp.DiffMutableADL.ValueType.ValueType(); //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+4]]:7: error: cannot access member of interface `Core.Iterate` in type `Cpp.DiffMutableADL.MutableRange` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: for (i: Cpp.DiffMutableADL.ValueType in m) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+2]]:7-44: error: cannot access member of interface `Core.Iterate` in type `Cpp.DiffMutableADL.MutableRange` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: for (i: Cpp.DiffMutableADL.ValueType in m) { sum += i; @@ -463,12 +429,8 @@ class MutableAndConstRange { friend auto operator!=(ConstIterator, ConstIterator) -> bool; }; public: - // CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE+6]]:44: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: friend auto begin(MutableAndConstRange&) -> Iterator; - // CHECK:STDERR: ^ - // CHECK:STDERR: {{.*}}/prelude/iterate.carbon:41:3: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: fn Begin(self) -> Iterator; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE+2]]:44: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: {{.*}}/prelude/iterate.carbon:41:3-29: note: while building thunk to match the signature of this function [ThunkSignature] friend auto begin(MutableAndConstRange&) -> Iterator; friend auto end(MutableAndConstRange&) -> Iterator; @@ -478,20 +440,12 @@ class MutableAndConstRange { } '''; -// CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE+15]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: fn TestIterate[R: Core.Iterate where .ElementType = Cpp.OverloadADL.ValueType](r: R) { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE+7]]:1-86: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: // CHECK:STDERR: fail_todo_adl_overloads.carbon: error: value expression passed to reference parameter [ValueForRefParam] -// CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE-13]]:42: note: initializing function parameter [InCallToFunctionParam] -// CHECK:STDERR: friend auto end(MutableAndConstRange&) -> Iterator; -// CHECK:STDERR: ^ -// CHECK:STDERR: {{.*}}/prelude/iterate.carbon:42:3: note: while building thunk to match the signature of this function [ThunkSignature] -// CHECK:STDERR: fn End(self) -> Sentinel; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE+4]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: fn TestIterate[R: Core.Iterate where .ElementType = Cpp.OverloadADL.ValueType](r: R) { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE-11]]:42: note: initializing function parameter [InCallToFunctionParam] +// CHECK:STDERR: {{.*}}/prelude/iterate.carbon:42:3-27: note: while building thunk to match the signature of this function [ThunkSignature] +// CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE+2]]:1-86: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: fn TestIterate[R: Core.Iterate where .ElementType = Cpp.OverloadADL.ValueType](r: R) { var sum: Cpp.OverloadADL.ValueType = Cpp.OverloadADL.ValueType.ValueType(); @@ -597,160 +551,84 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, var begin_function_deleted: Cpp.BeginFunctionDeleted, var end_function_deleted: Cpp.EndFunctionDeleted) { - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:3: error: cannot convert type `Cpp.NoBeginEnd` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Test(no_begin_end); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-19]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Test[R: Core.Iterate](unused r: R) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-20: error: cannot convert type `Cpp.NoBeginEnd` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-17]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: Test(no_begin_end); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:3: error: cannot convert type `Cpp.NoBeginMethod` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Test(no_begin_method); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-28]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Test[R: Core.Iterate](unused r: R) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-23: error: cannot convert type `Cpp.NoBeginMethod` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-22]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: Test(no_begin_method); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:3: error: cannot convert type `Cpp.NoEndMethod` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Test(no_end_method); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-37]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Test[R: Core.Iterate](unused r: R) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-21: error: cannot convert type `Cpp.NoEndMethod` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-27]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: Test(no_end_method); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:3: error: cannot convert type `Cpp.NoBeginADL` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Test(no_begin_adl); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-46]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Test[R: Core.Iterate](unused r: R) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-20: error: cannot convert type `Cpp.NoBeginADL` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-32]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: Test(no_begin_adl); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:3: error: cannot convert type `Cpp.NoEndADL` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Test(no_end_adl); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-55]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Test[R: Core.Iterate](unused r: R) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-18: error: cannot convert type `Cpp.NoEndADL` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-37]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: Test(no_end_adl); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:3: error: cannot convert type `Cpp.BeginMethodEndADL` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Test(begin_method_end_adl); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-64]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Test[R: Core.Iterate](unused r: R) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-28: error: cannot convert type `Cpp.BeginMethodEndADL` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-42]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: Test(begin_method_end_adl); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:3: error: cannot convert type `Cpp.BeginADLEndMethod` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Test(begin_adl_end_method); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-73]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Test[R: Core.Iterate](unused r: R) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-28: error: cannot convert type `Cpp.BeginADLEndMethod` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-47]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: Test(begin_adl_end_method); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:3: error: cannot convert type `Cpp.BeginFieldEndMethod` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Test(begin_field_end_method); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-82]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Test[R: Core.Iterate](unused r: R) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-30: error: cannot convert type `Cpp.BeginFieldEndMethod` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-52]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: Test(begin_field_end_method); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:3: error: cannot convert type `Cpp.BeginMethodEndField` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Test(begin_method_end_field); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-91]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Test[R: Core.Iterate](unused r: R) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-30: error: cannot convert type `Cpp.BeginMethodEndField` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-57]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: Test(begin_method_end_field); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+17]]:28: error: attempt to use a deleted function [CppInteropParseError] - // CHECK:STDERR: 178 | Test(begin_method_deleted); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-120]]:8: note: 'begin' has been explicitly marked deleted here [CppInteropParseNote] - // CHECK:STDERR: 44 | auto begin() = delete; - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-103]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Test[R: Core.Iterate](unused r: R) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:28: error: attempt to use a deleted function [CppInteropParseError] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-82]]:8: note: 'begin' has been explicitly marked deleted here [CppInteropParseNote] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-63]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:3: error: cannot convert type `Cpp.BeginMethodDeleted` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Test(begin_method_deleted); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-110]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Test[R: Core.Iterate](unused r: R) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-28: error: cannot convert type `Cpp.BeginMethodDeleted` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-66]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: Test(begin_method_deleted); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+17]]:26: error: attempt to use a deleted function [CppInteropParseError] - // CHECK:STDERR: 197 | Test(end_method_deleted); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-133]]:8: note: 'end' has been explicitly marked deleted here [CppInteropParseNote] - // CHECK:STDERR: 50 | auto end() = delete; - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-122]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Test[R: Core.Iterate](unused r: R) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:26: error: attempt to use a deleted function [CppInteropParseError] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-85]]:8: note: 'end' has been explicitly marked deleted here [CppInteropParseNote] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-72]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:3: error: cannot convert type `Cpp.EndMethodDeleted` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Test(end_method_deleted); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-129]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Test[R: Core.Iterate](unused r: R) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-26: error: cannot convert type `Cpp.EndMethodDeleted` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-75]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: Test(end_method_deleted); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+17]]:30: error: call to deleted function 'begin' [CppInteropParseError] - // CHECK:STDERR: 216 | Test(begin_function_deleted); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-148]]:15: note: candidate function has been explicitly deleted [CppInteropParseNote] - // CHECK:STDERR: 54 | friend auto begin(const BeginFunctionDeleted&) = delete; - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-141]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Test[R: Core.Iterate](unused r: R) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:30: error: call to deleted function 'begin' [CppInteropParseError] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-90]]:15: note: candidate function has been explicitly deleted [CppInteropParseNote] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-81]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:3: error: cannot convert type `Cpp.BeginFunctionDeleted` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Test(begin_function_deleted); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-148]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Test[R: Core.Iterate](unused r: R) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-30: error: cannot convert type `Cpp.BeginFunctionDeleted` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-84]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: Test(begin_function_deleted); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+17]]:28: error: call to deleted function 'end' [CppInteropParseError] - // CHECK:STDERR: 235 | Test(end_function_deleted); - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-161]]:15: note: candidate function has been explicitly deleted [CppInteropParseNote] - // CHECK:STDERR: 60 | friend auto end(const EndFunctionDeleted&) = delete; - // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-160]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Test[R: Core.Iterate](unused r: R) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:28: error: call to deleted function 'end' [CppInteropParseError] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-93]]:15: note: candidate function has been explicitly deleted [CppInteropParseNote] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-90]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:3: error: cannot convert type `Cpp.EndFunctionDeleted` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Test(end_function_deleted); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-167]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Test[R: Core.Iterate](unused r: R) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-28: error: cannot convert type `Cpp.EndFunctionDeleted` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-93]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: Test(end_function_deleted); } @@ -3792,11 +3670,11 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [concrete] // CHECK:STDOUT: %f64.761: type = class_type @Float, @Float(%int_64) [concrete] // CHECK:STDOUT: %pattern_type.667: type = pattern_type %f64.761 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc44 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc32 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc44 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc32 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.2: %Destroy.WithSelf.Op.type.ef016f.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc44 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc32 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.2: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.f8f19d.2: = custom_witness (%Destroy.WithSelf.Op.403171.2, %Destroy.WithSelf.SubobjectDestroy.d01daf.2, %Destroy.WithSelf.SelfDestruct.db3fdb.2), @Destroy [concrete] // CHECK:STDOUT: %Float.as.Copy.impl.Op.type.e8d: type = fn_type @Float.as.Copy.impl.Op, @Float.as.Copy.impl(%N.fe9) [symbolic] @@ -3856,48 +3734,48 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %pattern_type.d8c: type = pattern_type %.ecc [concrete] // CHECK:STDOUT: %self.param_patt.5ca: %pattern_type.d8c = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.1f3: %pattern_type.d8c = wrapper_binding_pattern self, %self.param_patt.5ca [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc48_19.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc36_19.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc48_19.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc36_19.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.3: %Destroy.WithSelf.Op.type.ef016f.3 = struct_value () [concrete] // CHECK:STDOUT: %pattern_type.007: type = pattern_type %MaybeUnformed.912 [concrete] // CHECK:STDOUT: %self.param_patt.6cf: %pattern_type.007 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.b4d: %pattern_type.007 = wrapper_binding_pattern self, %self.param_patt.6cf [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc48_19.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc36_19.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.4: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.4: type = fn_type @Destroy.WithSelf.Op.loc48_19.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.4: type = fn_type @Destroy.WithSelf.Op.loc36_19.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.4: %Destroy.WithSelf.Op.type.ef016f.4 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.4: type = fn_type @Destroy.WithSelf.SelfDestruct.loc48_19.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.4: type = fn_type @Destroy.WithSelf.SelfDestruct.loc36_19.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.4: %Destroy.WithSelf.SelfDestruct.type.fbceb5.4 = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.40d: %pattern_type.831 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.560: %pattern_type.831 = wrapper_binding_pattern self, %self.param_patt.40d [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.5: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc48_19.3 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.5: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc36_19.3 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.5: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.5 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.5: type = fn_type @Destroy.WithSelf.Op.loc48_19.3 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.5: type = fn_type @Destroy.WithSelf.Op.loc36_19.3 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.5: %Destroy.WithSelf.Op.type.ef016f.5 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.5: type = fn_type @Destroy.WithSelf.SelfDestruct.loc48_19.3 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.5: type = fn_type @Destroy.WithSelf.SelfDestruct.loc36_19.3 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.5: %Destroy.WithSelf.SelfDestruct.type.fbceb5.5 = struct_value () [concrete] // CHECK:STDOUT: %pattern_type.28d: type = pattern_type %struct_type.value.has_value.82f [concrete] // CHECK:STDOUT: %self.param_patt.f24: %pattern_type.28d = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.396: %pattern_type.28d = wrapper_binding_pattern self, %self.param_patt.f24 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.6: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc48_19.4 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.6: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc36_19.4 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.6: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.6 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.6: type = fn_type @Destroy.WithSelf.Op.loc48_19.4 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.6: type = fn_type @Destroy.WithSelf.Op.loc36_19.4 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.6: %Destroy.WithSelf.Op.type.ef016f.6 = struct_value () [concrete] // CHECK:STDOUT: %pattern_type.ee1: type = pattern_type %DefaultOptionalStorage.6ea [concrete] // CHECK:STDOUT: %self.param_patt.d5d: %pattern_type.ee1 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.aa9: %pattern_type.ee1 = wrapper_binding_pattern self, %self.param_patt.d5d [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.7: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc48_19.5 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.7: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc36_19.5 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.7: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.7 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.7: type = fn_type @Destroy.WithSelf.Op.loc48_19.5 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.7: type = fn_type @Destroy.WithSelf.Op.loc36_19.5 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.7: %Destroy.WithSelf.Op.type.ef016f.7 = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.4ac: %pattern_type.40d = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.1ec: %pattern_type.40d = wrapper_binding_pattern self, %self.param_patt.4ac [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.8: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc48_19.6 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.8: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc36_19.6 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.8: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.8 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.8: type = fn_type @Destroy.WithSelf.Op.loc48_19.6 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.8: type = fn_type @Destroy.WithSelf.Op.loc36_19.6 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.8: %Destroy.WithSelf.Op.type.ef016f.8 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.8: type = fn_type @Destroy.WithSelf.SelfDestruct.loc48_19.6 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.8: type = fn_type @Destroy.WithSelf.SelfDestruct.loc36_19.6 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.8: %Destroy.WithSelf.SelfDestruct.type.fbceb5.8 = struct_value () [concrete] // CHECK:STDOUT: %Destroy.lookup_impl_witness.cb1: = lookup_impl_witness %impl.elem1.2af, @Destroy [symbolic] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.a48: type = fn_type @Destroy.WithSelf.SelfDestruct.1, @Destroy.WithSelf(%impl.elem1.2af) [symbolic] @@ -3914,9 +3792,9 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %End.type: type = fn_type @End [concrete] // CHECK:STDOUT: %End: %End.type = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.902: = custom_witness (%Iterator, %Iterator, %Begin, %End), @CppRangeForIterate [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.9: type = fn_type @Destroy.WithSelf.Op.loc55 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.9: type = fn_type @Destroy.WithSelf.Op.loc43 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.9: %Destroy.WithSelf.Op.type.ef016f.9 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.9: type = fn_type @Destroy.WithSelf.SelfDestruct.loc55 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.9: type = fn_type @Destroy.WithSelf.SelfDestruct.loc43 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.9: %Destroy.WithSelf.SelfDestruct.type.fbceb5.9 = struct_value () [concrete] // CHECK:STDOUT: %Iterator.SubobjectDestroy.type: type = fn_type @Iterator.SubobjectDestroy [concrete] // CHECK:STDOUT: %Iterator.SubobjectDestroy: %Iterator.SubobjectDestroy.type = struct_value () [concrete] @@ -3990,84 +3868,84 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc48_19.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.3] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc36_19.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.3] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d8c = ref_param_pattern [concrete = constants.%self.param_patt.5ca] // CHECK:STDOUT: %self.patt: %pattern_type.d8c = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.1f3] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %.ecc = ref_param call_param0 // CHECK:STDOUT: %self: ref %.ecc = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc48_19.1 [concrete = constants.%Destroy.WithSelf.Op.403171.3] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc36_19.1 [concrete = constants.%Destroy.WithSelf.Op.403171.3] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d8c = ref_param_pattern [concrete = constants.%self.param_patt.5ca] // CHECK:STDOUT: %self.patt: %pattern_type.d8c = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.1f3] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %.ecc = ref_param call_param0 // CHECK:STDOUT: %self: ref %.ecc = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc48_19.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.4] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc36_19.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.4] { // CHECK:STDOUT: %self.param_patt: %pattern_type.007 = ref_param_pattern [concrete = constants.%self.param_patt.6cf] // CHECK:STDOUT: %self.patt: %pattern_type.007 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.b4d] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %MaybeUnformed.912 = ref_param call_param0 // CHECK:STDOUT: %self: ref %MaybeUnformed.912 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.3: %Destroy.WithSelf.Op.type.ef016f.4 = fn_decl @Destroy.WithSelf.Op.loc48_19.2 [concrete = constants.%Destroy.WithSelf.Op.403171.4] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.3: %Destroy.WithSelf.Op.type.ef016f.4 = fn_decl @Destroy.WithSelf.Op.loc36_19.2 [concrete = constants.%Destroy.WithSelf.Op.403171.4] { // CHECK:STDOUT: %self.param_patt: %pattern_type.007 = ref_param_pattern [concrete = constants.%self.param_patt.6cf] // CHECK:STDOUT: %self.patt: %pattern_type.007 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.b4d] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %MaybeUnformed.912 = ref_param call_param0 // CHECK:STDOUT: %self: ref %MaybeUnformed.912 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.4: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.5 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc48_19.3 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.5] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.4: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.5 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc36_19.3 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.5] { // CHECK:STDOUT: %self.param_patt: %pattern_type.831 = ref_param_pattern [concrete = constants.%self.param_patt.40d] // CHECK:STDOUT: %self.patt: %pattern_type.831 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.560] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref bool = ref_param call_param0 // CHECK:STDOUT: %self: ref bool = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.4: %Destroy.WithSelf.Op.type.ef016f.5 = fn_decl @Destroy.WithSelf.Op.loc48_19.3 [concrete = constants.%Destroy.WithSelf.Op.403171.5] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.4: %Destroy.WithSelf.Op.type.ef016f.5 = fn_decl @Destroy.WithSelf.Op.loc36_19.3 [concrete = constants.%Destroy.WithSelf.Op.403171.5] { // CHECK:STDOUT: %self.param_patt: %pattern_type.831 = ref_param_pattern [concrete = constants.%self.param_patt.40d] // CHECK:STDOUT: %self.patt: %pattern_type.831 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.560] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref bool = ref_param call_param0 // CHECK:STDOUT: %self: ref bool = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.5: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.6 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc48_19.4 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.6] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.5: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.6 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc36_19.4 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.6] { // CHECK:STDOUT: %self.param_patt: %pattern_type.28d = ref_param_pattern [concrete = constants.%self.param_patt.f24] // CHECK:STDOUT: %self.patt: %pattern_type.28d = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.396] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %struct_type.value.has_value.82f = ref_param call_param0 // CHECK:STDOUT: %self: ref %struct_type.value.has_value.82f = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.5: %Destroy.WithSelf.Op.type.ef016f.6 = fn_decl @Destroy.WithSelf.Op.loc48_19.4 [concrete = constants.%Destroy.WithSelf.Op.403171.6] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.5: %Destroy.WithSelf.Op.type.ef016f.6 = fn_decl @Destroy.WithSelf.Op.loc36_19.4 [concrete = constants.%Destroy.WithSelf.Op.403171.6] { // CHECK:STDOUT: %self.param_patt: %pattern_type.28d = ref_param_pattern [concrete = constants.%self.param_patt.f24] // CHECK:STDOUT: %self.patt: %pattern_type.28d = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.396] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %struct_type.value.has_value.82f = ref_param call_param0 // CHECK:STDOUT: %self: ref %struct_type.value.has_value.82f = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.6: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.7 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc48_19.5 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.7] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.6: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.7 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc36_19.5 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.7] { // CHECK:STDOUT: %self.param_patt: %pattern_type.ee1 = ref_param_pattern [concrete = constants.%self.param_patt.d5d] // CHECK:STDOUT: %self.patt: %pattern_type.ee1 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.aa9] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %DefaultOptionalStorage.6ea = ref_param call_param0 // CHECK:STDOUT: %self: ref %DefaultOptionalStorage.6ea = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.6: %Destroy.WithSelf.Op.type.ef016f.7 = fn_decl @Destroy.WithSelf.Op.loc48_19.5 [concrete = constants.%Destroy.WithSelf.Op.403171.7] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.6: %Destroy.WithSelf.Op.type.ef016f.7 = fn_decl @Destroy.WithSelf.Op.loc36_19.5 [concrete = constants.%Destroy.WithSelf.Op.403171.7] { // CHECK:STDOUT: %self.param_patt: %pattern_type.ee1 = ref_param_pattern [concrete = constants.%self.param_patt.d5d] // CHECK:STDOUT: %self.patt: %pattern_type.ee1 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.aa9] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %DefaultOptionalStorage.6ea = ref_param call_param0 // CHECK:STDOUT: %self: ref %DefaultOptionalStorage.6ea = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.7: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.8 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc48_19.6 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.8] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.7: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.8 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc36_19.6 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.8] { // CHECK:STDOUT: %self.param_patt: %pattern_type.40d = ref_param_pattern [concrete = constants.%self.param_patt.4ac] // CHECK:STDOUT: %self.patt: %pattern_type.40d = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.1ec] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %Optional.000 = ref_param call_param0 // CHECK:STDOUT: %self: ref %Optional.000 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.7: %Destroy.WithSelf.Op.type.ef016f.8 = fn_decl @Destroy.WithSelf.Op.loc48_19.6 [concrete = constants.%Destroy.WithSelf.Op.403171.8] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.7: %Destroy.WithSelf.Op.type.ef016f.8 = fn_decl @Destroy.WithSelf.Op.loc36_19.6 [concrete = constants.%Destroy.WithSelf.Op.403171.8] { // CHECK:STDOUT: %self.param_patt: %pattern_type.40d = ref_param_pattern [concrete = constants.%self.param_patt.4ac] // CHECK:STDOUT: %self.patt: %pattern_type.40d = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.1ec] // CHECK:STDOUT: } { @@ -4076,193 +3954,193 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @TestIterate(%R.loc44_17.2: %Iterate_where.type.11d) { +// CHECK:STDOUT: generic fn @TestIterate(%R.loc32_17.2: %Iterate_where.type.11d) { // CHECK:STDOUT: // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: %Iterate.lookup_impl_witness: = lookup_impl_witness %R.loc44_17.1, @Iterate [symbolic = %Iterate.lookup_impl_witness (constants.%Iterate.lookup_impl_witness.e7e)] -// CHECK:STDOUT: %Iterate.facet.loc48_19.5: %Iterate.type = facet_value %R.as_type.loc44_61.1, (%Iterate.lookup_impl_witness) [symbolic = %Iterate.facet.loc48_19.5 (constants.%Iterate.facet.a43)] -// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type: type = fn_type @Iterate.WithSelf.NewCursor, @Iterate.WithSelf(%Iterate.facet.loc48_19.5) [symbolic = %Iterate.WithSelf.NewCursor.type (constants.%Iterate.WithSelf.NewCursor.type.248)] -// CHECK:STDOUT: %.loc48_19.19: type = fn_type_with_self_type %Iterate.WithSelf.NewCursor.type, %Iterate.facet.loc48_19.5 [symbolic = %.loc48_19.19 (constants.%.678)] -// CHECK:STDOUT: %impl.elem2.loc48_19.3: @TestIterate.%.loc48_19.19 (%.678) = impl_witness_access %Iterate.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc48_19.3 (constants.%impl.elem2.e3e)] -// CHECK:STDOUT: %specific_impl_fn.loc48_19.4: = specific_impl_function %impl.elem2.loc48_19.3, @Iterate.WithSelf.NewCursor(%Iterate.facet.loc48_19.5) [symbolic = %specific_impl_fn.loc48_19.4 (constants.%specific_impl_fn.0ea)] +// CHECK:STDOUT: %Iterate.lookup_impl_witness: = lookup_impl_witness %R.loc32_17.1, @Iterate [symbolic = %Iterate.lookup_impl_witness (constants.%Iterate.lookup_impl_witness.e7e)] +// CHECK:STDOUT: %Iterate.facet.loc36_19.5: %Iterate.type = facet_value %R.as_type.loc32_61.1, (%Iterate.lookup_impl_witness) [symbolic = %Iterate.facet.loc36_19.5 (constants.%Iterate.facet.a43)] +// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type: type = fn_type @Iterate.WithSelf.NewCursor, @Iterate.WithSelf(%Iterate.facet.loc36_19.5) [symbolic = %Iterate.WithSelf.NewCursor.type (constants.%Iterate.WithSelf.NewCursor.type.248)] +// CHECK:STDOUT: %.loc36_19.19: type = fn_type_with_self_type %Iterate.WithSelf.NewCursor.type, %Iterate.facet.loc36_19.5 [symbolic = %.loc36_19.19 (constants.%.678)] +// CHECK:STDOUT: %impl.elem2.loc36_19.3: @TestIterate.%.loc36_19.19 (%.678) = impl_witness_access %Iterate.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc36_19.3 (constants.%impl.elem2.e3e)] +// CHECK:STDOUT: %specific_impl_fn.loc36_19.4: = specific_impl_function %impl.elem2.loc36_19.3, @Iterate.WithSelf.NewCursor(%Iterate.facet.loc36_19.5) [symbolic = %specific_impl_fn.loc36_19.4 (constants.%specific_impl_fn.0ea)] // CHECK:STDOUT: -// CHECK:STDOUT: %Iterate.WithSelf.Next.type: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.loc48_19.5) [symbolic = %Iterate.WithSelf.Next.type (constants.%Iterate.WithSelf.Next.type.9a9)] -// CHECK:STDOUT: %.loc48_19.20: type = fn_type_with_self_type %Iterate.WithSelf.Next.type, %Iterate.facet.loc48_19.5 [symbolic = %.loc48_19.20 (constants.%.fe7)] -// CHECK:STDOUT: %impl.elem3.loc48_19.2: @TestIterate.%.loc48_19.20 (%.fe7) = impl_witness_access %Iterate.lookup_impl_witness, element3 [symbolic = %impl.elem3.loc48_19.2 (constants.%impl.elem3.ae5)] -// CHECK:STDOUT: %specific_impl_fn.loc48_19.5: = specific_impl_function %impl.elem3.loc48_19.2, @Iterate.WithSelf.Next(%Iterate.facet.loc48_19.5) [symbolic = %specific_impl_fn.loc48_19.5 (constants.%specific_impl_fn.493)] +// CHECK:STDOUT: %Iterate.WithSelf.Next.type: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.loc36_19.5) [symbolic = %Iterate.WithSelf.Next.type (constants.%Iterate.WithSelf.Next.type.9a9)] +// CHECK:STDOUT: %.loc36_19.20: type = fn_type_with_self_type %Iterate.WithSelf.Next.type, %Iterate.facet.loc36_19.5 [symbolic = %.loc36_19.20 (constants.%.fe7)] +// CHECK:STDOUT: %impl.elem3.loc36_19.2: @TestIterate.%.loc36_19.20 (%.fe7) = impl_witness_access %Iterate.lookup_impl_witness, element3 [symbolic = %impl.elem3.loc36_19.2 (constants.%impl.elem3.ae5)] +// CHECK:STDOUT: %specific_impl_fn.loc36_19.5: = specific_impl_function %impl.elem3.loc36_19.2, @Iterate.WithSelf.Next(%Iterate.facet.loc36_19.5) [symbolic = %specific_impl_fn.loc36_19.5 (constants.%specific_impl_fn.493)] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type: type = fn_type @Destroy.WithSelf.SelfDestruct.1, @Destroy.WithSelf(%impl.elem1) [symbolic = %Destroy.WithSelf.SelfDestruct.type (constants.%Destroy.WithSelf.SelfDestruct.type.a48)] -// CHECK:STDOUT: %.loc48_19.21: type = fn_type_with_self_type %Destroy.WithSelf.SelfDestruct.type, %impl.elem1 [symbolic = %.loc48_19.21 (constants.%.421)] +// CHECK:STDOUT: %.loc36_19.21: type = fn_type_with_self_type %Destroy.WithSelf.SelfDestruct.type, %impl.elem1 [symbolic = %.loc36_19.21 (constants.%.421)] // CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %impl.elem1, @Destroy [symbolic = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness.cb1)] -// CHECK:STDOUT: %impl.elem2.loc48_19.4: @TestIterate.%.loc48_19.21 (%.421) = impl_witness_access %Destroy.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc48_19.4 (constants.%impl.elem2.f8d)] -// CHECK:STDOUT: %specific_impl_fn.loc48_19.6: = specific_impl_function %impl.elem2.loc48_19.4, @Destroy.WithSelf.SelfDestruct.1(%impl.elem1) [symbolic = %specific_impl_fn.loc48_19.6 (constants.%specific_impl_fn.6a1)] +// CHECK:STDOUT: %impl.elem2.loc36_19.4: @TestIterate.%.loc36_19.21 (%.421) = impl_witness_access %Destroy.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc36_19.4 (constants.%impl.elem2.f8d)] +// CHECK:STDOUT: %specific_impl_fn.loc36_19.6: = specific_impl_function %impl.elem2.loc36_19.4, @Destroy.WithSelf.SelfDestruct.1(%impl.elem1) [symbolic = %specific_impl_fn.loc36_19.6 (constants.%specific_impl_fn.6a1)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%r.param: @TestIterate.%R.as_type.loc44_61.1 (%R.as_type)) { +// CHECK:STDOUT: fn(%r.param: @TestIterate.%R.as_type.loc32_61.1 (%R.as_type)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %i.patt: %pattern_type.667 = value_binding_pattern i [concrete = constants.%i.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %r.ref: @TestIterate.%R.as_type.loc44_61.1 (%R.as_type) = name_ref r, %r -// CHECK:STDOUT: %impl.elem2.loc48_19.1: @TestIterate.%.loc48_19.19 (%.678) = impl_witness_access constants.%Iterate.lookup_impl_witness.e7e, element2 [symbolic = %impl.elem2.loc48_19.3 (constants.%impl.elem2.e3e)] -// CHECK:STDOUT: %bound_method.loc48_19.1: = bound_method %r.ref, %impl.elem2.loc48_19.1 -// CHECK:STDOUT: %Iterate.facet.loc48_19.1: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.e7e) [symbolic = %Iterate.facet.loc48_19.5 (constants.%Iterate.facet.a43)] -// CHECK:STDOUT: %.loc48_19.1: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc48_19.1 [symbolic = %Iterate.facet.loc48_19.5 (constants.%Iterate.facet.a43)] -// CHECK:STDOUT: %Iterate.facet.loc48_19.2: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.e7e) [symbolic = %Iterate.facet.loc48_19.5 (constants.%Iterate.facet.a43)] -// CHECK:STDOUT: %.loc48_19.2: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc48_19.2 [symbolic = %Iterate.facet.loc48_19.5 (constants.%Iterate.facet.a43)] -// CHECK:STDOUT: %specific_impl_fn.loc48_19.1: = specific_impl_function %impl.elem2.loc48_19.1, @Iterate.WithSelf.NewCursor(constants.%Iterate.facet.a43) [symbolic = %specific_impl_fn.loc48_19.4 (constants.%specific_impl_fn.0ea)] -// CHECK:STDOUT: %bound_method.loc48_19.2: = bound_method %r.ref, %specific_impl_fn.loc48_19.1 +// CHECK:STDOUT: %r.ref: @TestIterate.%R.as_type.loc32_61.1 (%R.as_type) = name_ref r, %r +// CHECK:STDOUT: %impl.elem2.loc36_19.1: @TestIterate.%.loc36_19.19 (%.678) = impl_witness_access constants.%Iterate.lookup_impl_witness.e7e, element2 [symbolic = %impl.elem2.loc36_19.3 (constants.%impl.elem2.e3e)] +// CHECK:STDOUT: %bound_method.loc36_19.1: = bound_method %r.ref, %impl.elem2.loc36_19.1 +// CHECK:STDOUT: %Iterate.facet.loc36_19.1: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.e7e) [symbolic = %Iterate.facet.loc36_19.5 (constants.%Iterate.facet.a43)] +// CHECK:STDOUT: %.loc36_19.1: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc36_19.1 [symbolic = %Iterate.facet.loc36_19.5 (constants.%Iterate.facet.a43)] +// CHECK:STDOUT: %Iterate.facet.loc36_19.2: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.e7e) [symbolic = %Iterate.facet.loc36_19.5 (constants.%Iterate.facet.a43)] +// CHECK:STDOUT: %.loc36_19.2: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc36_19.2 [symbolic = %Iterate.facet.loc36_19.5 (constants.%Iterate.facet.a43)] +// CHECK:STDOUT: %specific_impl_fn.loc36_19.1: = specific_impl_function %impl.elem2.loc36_19.1, @Iterate.WithSelf.NewCursor(constants.%Iterate.facet.a43) [symbolic = %specific_impl_fn.loc36_19.4 (constants.%specific_impl_fn.0ea)] +// CHECK:STDOUT: %bound_method.loc36_19.2: = bound_method %r.ref, %specific_impl_fn.loc36_19.1 // CHECK:STDOUT: %var: ref @TestIterate.%as_type (%as_type.ba7) = var_storage invalid -// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.call: init @TestIterate.%as_type (%as_type.ba7) to %var = call %bound_method.loc48_19.2(%r.ref) +// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.call: init @TestIterate.%as_type (%as_type.ba7) to %var = call %bound_method.loc36_19.2(%r.ref) // CHECK:STDOUT: assign %var, %Iterate.WithSelf.NewCursor.call // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.next: -// CHECK:STDOUT: %impl.elem3.loc48_19.1: @TestIterate.%.loc48_19.20 (%.fe7) = impl_witness_access constants.%Iterate.lookup_impl_witness.e7e, element3 [symbolic = %impl.elem3.loc48_19.2 (constants.%impl.elem3.ae5)] -// CHECK:STDOUT: %bound_method.loc48_19.3: = bound_method %r.ref, %impl.elem3.loc48_19.1 -// CHECK:STDOUT: %Iterate.facet.loc48_19.3: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.e7e) [symbolic = %Iterate.facet.loc48_19.5 (constants.%Iterate.facet.a43)] -// CHECK:STDOUT: %.loc48_19.3: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc48_19.3 [symbolic = %Iterate.facet.loc48_19.5 (constants.%Iterate.facet.a43)] -// CHECK:STDOUT: %Iterate.facet.loc48_19.4: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.e7e) [symbolic = %Iterate.facet.loc48_19.5 (constants.%Iterate.facet.a43)] -// CHECK:STDOUT: %.loc48_19.4: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc48_19.4 [symbolic = %Iterate.facet.loc48_19.5 (constants.%Iterate.facet.a43)] -// CHECK:STDOUT: %.loc48_19.5: %Destroy.type = converted constants.%as_type.ba7, constants.%impl.elem1.2af [symbolic = %impl.elem1 (constants.%impl.elem1.2af)] -// CHECK:STDOUT: %.loc48_19.6: %Destroy.type = converted constants.%as_type.ba7, constants.%impl.elem1.2af [symbolic = %impl.elem1 (constants.%impl.elem1.2af)] -// CHECK:STDOUT: %specific_impl_fn.loc48_19.2: = specific_impl_function %impl.elem3.loc48_19.1, @Iterate.WithSelf.Next(constants.%Iterate.facet.a43) [symbolic = %specific_impl_fn.loc48_19.5 (constants.%specific_impl_fn.493)] -// CHECK:STDOUT: %bound_method.loc48_19.4: = bound_method %r.ref, %specific_impl_fn.loc48_19.2 -// CHECK:STDOUT: %.loc48_19.7: ref %Optional.000 = temporary_storage -// CHECK:STDOUT: %Iterate.WithSelf.Next.call: init %Optional.000 to %.loc48_19.7 = call %bound_method.loc48_19.4(%r.ref, %var) -// CHECK:STDOUT: %.loc48_19.8: ref %Optional.000 = temporary %.loc48_19.7, %Iterate.WithSelf.Next.call -// CHECK:STDOUT: %.loc48_19.9: %Optional.HasValue.type.92f = specific_constant imports.%Core.import_ref.c82, @Optional(constants.%OptionalStorage.facet.d7a) [concrete = constants.%Optional.HasValue.ff5] -// CHECK:STDOUT: %HasValue.ref: %Optional.HasValue.type.92f = name_ref HasValue, %.loc48_19.9 [concrete = constants.%Optional.HasValue.ff5] -// CHECK:STDOUT: %Optional.HasValue.bound: = bound_method %.loc48_19.8, %HasValue.ref +// CHECK:STDOUT: %impl.elem3.loc36_19.1: @TestIterate.%.loc36_19.20 (%.fe7) = impl_witness_access constants.%Iterate.lookup_impl_witness.e7e, element3 [symbolic = %impl.elem3.loc36_19.2 (constants.%impl.elem3.ae5)] +// CHECK:STDOUT: %bound_method.loc36_19.3: = bound_method %r.ref, %impl.elem3.loc36_19.1 +// CHECK:STDOUT: %Iterate.facet.loc36_19.3: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.e7e) [symbolic = %Iterate.facet.loc36_19.5 (constants.%Iterate.facet.a43)] +// CHECK:STDOUT: %.loc36_19.3: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc36_19.3 [symbolic = %Iterate.facet.loc36_19.5 (constants.%Iterate.facet.a43)] +// CHECK:STDOUT: %Iterate.facet.loc36_19.4: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.e7e) [symbolic = %Iterate.facet.loc36_19.5 (constants.%Iterate.facet.a43)] +// CHECK:STDOUT: %.loc36_19.4: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc36_19.4 [symbolic = %Iterate.facet.loc36_19.5 (constants.%Iterate.facet.a43)] +// CHECK:STDOUT: %.loc36_19.5: %Destroy.type = converted constants.%as_type.ba7, constants.%impl.elem1.2af [symbolic = %impl.elem1 (constants.%impl.elem1.2af)] +// CHECK:STDOUT: %.loc36_19.6: %Destroy.type = converted constants.%as_type.ba7, constants.%impl.elem1.2af [symbolic = %impl.elem1 (constants.%impl.elem1.2af)] +// CHECK:STDOUT: %specific_impl_fn.loc36_19.2: = specific_impl_function %impl.elem3.loc36_19.1, @Iterate.WithSelf.Next(constants.%Iterate.facet.a43) [symbolic = %specific_impl_fn.loc36_19.5 (constants.%specific_impl_fn.493)] +// CHECK:STDOUT: %bound_method.loc36_19.4: = bound_method %r.ref, %specific_impl_fn.loc36_19.2 +// CHECK:STDOUT: %.loc36_19.7: ref %Optional.000 = temporary_storage +// CHECK:STDOUT: %Iterate.WithSelf.Next.call: init %Optional.000 to %.loc36_19.7 = call %bound_method.loc36_19.4(%r.ref, %var) +// CHECK:STDOUT: %.loc36_19.8: ref %Optional.000 = temporary %.loc36_19.7, %Iterate.WithSelf.Next.call +// CHECK:STDOUT: %.loc36_19.9: %Optional.HasValue.type.92f = specific_constant imports.%Core.import_ref.c82, @Optional(constants.%OptionalStorage.facet.d7a) [concrete = constants.%Optional.HasValue.ff5] +// CHECK:STDOUT: %HasValue.ref: %Optional.HasValue.type.92f = name_ref HasValue, %.loc36_19.9 [concrete = constants.%Optional.HasValue.ff5] +// CHECK:STDOUT: %Optional.HasValue.bound: = bound_method %.loc36_19.8, %HasValue.ref // CHECK:STDOUT: %Optional.HasValue.specific_fn: = specific_function %HasValue.ref, @Optional.HasValue(constants.%OptionalStorage.facet.d7a) [concrete = constants.%Optional.HasValue.specific_fn.315] -// CHECK:STDOUT: %bound_method.loc48_19.5: = bound_method %.loc48_19.8, %Optional.HasValue.specific_fn -// CHECK:STDOUT: %.loc48_19.10: %Optional.000 = acquire_value %.loc48_19.8 -// CHECK:STDOUT: %Optional.HasValue.call: init bool = call %bound_method.loc48_19.5(%.loc48_19.10) -// CHECK:STDOUT: %.loc48_19.11: bool = value_of_initializer %Optional.HasValue.call -// CHECK:STDOUT: %.loc48_19.12: bool = converted %Optional.HasValue.call, %.loc48_19.11 -// CHECK:STDOUT: if %.loc48_19.12 br !for.body else br !for.done +// CHECK:STDOUT: %bound_method.loc36_19.5: = bound_method %.loc36_19.8, %Optional.HasValue.specific_fn +// CHECK:STDOUT: %.loc36_19.10: %Optional.000 = acquire_value %.loc36_19.8 +// CHECK:STDOUT: %Optional.HasValue.call: init bool = call %bound_method.loc36_19.5(%.loc36_19.10) +// CHECK:STDOUT: %.loc36_19.11: bool = value_of_initializer %Optional.HasValue.call +// CHECK:STDOUT: %.loc36_19.12: bool = converted %Optional.HasValue.call, %.loc36_19.11 +// CHECK:STDOUT: if %.loc36_19.12 br !for.body else br !for.done // CHECK:STDOUT: // CHECK:STDOUT: !for.body: -// CHECK:STDOUT: %.loc48_19.13: %Optional.Get.type.695 = specific_constant imports.%Core.import_ref.29e, @Optional(constants.%OptionalStorage.facet.d7a) [concrete = constants.%Optional.Get.62a] -// CHECK:STDOUT: %Get.ref: %Optional.Get.type.695 = name_ref Get, %.loc48_19.13 [concrete = constants.%Optional.Get.62a] -// CHECK:STDOUT: %Optional.Get.bound: = bound_method %.loc48_19.8, %Get.ref +// CHECK:STDOUT: %.loc36_19.13: %Optional.Get.type.695 = specific_constant imports.%Core.import_ref.29e, @Optional(constants.%OptionalStorage.facet.d7a) [concrete = constants.%Optional.Get.62a] +// CHECK:STDOUT: %Get.ref: %Optional.Get.type.695 = name_ref Get, %.loc36_19.13 [concrete = constants.%Optional.Get.62a] +// CHECK:STDOUT: %Optional.Get.bound: = bound_method %.loc36_19.8, %Get.ref // CHECK:STDOUT: %Optional.Get.specific_fn: = specific_function %Get.ref, @Optional.Get(constants.%OptionalStorage.facet.d7a) [concrete = constants.%Optional.Get.specific_fn.570] -// CHECK:STDOUT: %bound_method.loc48_19.6: = bound_method %.loc48_19.8, %Optional.Get.specific_fn -// CHECK:STDOUT: %.loc48_19.14: %Optional.000 = acquire_value %.loc48_19.8 -// CHECK:STDOUT: %Optional.Get.call: init %f64.761 = call %bound_method.loc48_19.6(%.loc48_19.14) -// CHECK:STDOUT: %.loc48_19.15: %f64.761 = value_of_initializer %Optional.Get.call -// CHECK:STDOUT: %.loc48_19.16: %f64.761 = converted %Optional.Get.call, %.loc48_19.15 -// CHECK:STDOUT: %f64.loc48: type = type_literal constants.%f64.761 [concrete = constants.%f64.761] -// CHECK:STDOUT: %i: %f64.761 = wrapper_binding i, %.loc48_19.16 +// CHECK:STDOUT: %bound_method.loc36_19.6: = bound_method %.loc36_19.8, %Optional.Get.specific_fn +// CHECK:STDOUT: %.loc36_19.14: %Optional.000 = acquire_value %.loc36_19.8 +// CHECK:STDOUT: %Optional.Get.call: init %f64.761 = call %bound_method.loc36_19.6(%.loc36_19.14) +// CHECK:STDOUT: %.loc36_19.15: %f64.761 = value_of_initializer %Optional.Get.call +// CHECK:STDOUT: %.loc36_19.16: %f64.761 = converted %Optional.Get.call, %.loc36_19.15 +// CHECK:STDOUT: %f64.loc36: type = type_literal constants.%f64.761 [concrete = constants.%f64.761] +// CHECK:STDOUT: %i: %f64.761 = wrapper_binding i, %.loc36_19.16 // CHECK:STDOUT: %sum.ref: ref %f64.761 = name_ref sum, %sum // CHECK:STDOUT: %i.ref: %f64.761 = name_ref i, %i -// CHECK:STDOUT: %impl.elem0.loc49: %.48b = impl_witness_access constants.%AddAssignWith.impl_witness.5c7, element0 [concrete = constants.%Float.as.AddAssignWith.impl.Op.e04] -// CHECK:STDOUT: %bound_method.loc49_9.1: = bound_method %sum.ref, %impl.elem0.loc49 -// CHECK:STDOUT: %specific_fn.loc49: = specific_function %impl.elem0.loc49, @Float.as.AddAssignWith.impl.Op(constants.%int_64) [concrete = constants.%Float.as.AddAssignWith.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc49_9.2: = bound_method %sum.ref, %specific_fn.loc49 -// CHECK:STDOUT: %Float.as.AddAssignWith.impl.Op.call: init %empty_tuple.type = call %bound_method.loc49_9.2(%sum.ref, %i.ref) -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc48_19.1: = bound_method %.loc48_19.8, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.8 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc48_19.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc48_19.1(%.loc48_19.8) +// CHECK:STDOUT: %impl.elem0.loc37: %.48b = impl_witness_access constants.%AddAssignWith.impl_witness.5c7, element0 [concrete = constants.%Float.as.AddAssignWith.impl.Op.e04] +// CHECK:STDOUT: %bound_method.loc37_9.1: = bound_method %sum.ref, %impl.elem0.loc37 +// CHECK:STDOUT: %specific_fn.loc37: = specific_function %impl.elem0.loc37, @Float.as.AddAssignWith.impl.Op(constants.%int_64) [concrete = constants.%Float.as.AddAssignWith.impl.Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc37_9.2: = bound_method %sum.ref, %specific_fn.loc37 +// CHECK:STDOUT: %Float.as.AddAssignWith.impl.Op.call: init %empty_tuple.type = call %bound_method.loc37_9.2(%sum.ref, %i.ref) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc36_19.1: = bound_method %.loc36_19.8, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.8 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc36_19.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc36_19.1(%.loc36_19.8) // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.done: -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc48_19.2: = bound_method %.loc48_19.8, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.8 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc48_19.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc48_19.2(%.loc48_19.8) -// CHECK:STDOUT: %impl.elem2.loc48_19.2: @TestIterate.%.loc48_19.21 (%.421) = impl_witness_access constants.%Destroy.lookup_impl_witness.cb1, element2 [symbolic = %impl.elem2.loc48_19.4 (constants.%impl.elem2.f8d)] -// CHECK:STDOUT: %bound_method.loc48_19.7: = bound_method %var, %impl.elem2.loc48_19.2 -// CHECK:STDOUT: %.loc48_19.17: %Destroy.type = converted constants.%as_type.ba7, constants.%impl.elem1.2af [symbolic = %impl.elem1 (constants.%impl.elem1.2af)] -// CHECK:STDOUT: %.loc48_19.18: %Destroy.type = converted constants.%as_type.ba7, constants.%impl.elem1.2af [symbolic = %impl.elem1 (constants.%impl.elem1.2af)] -// CHECK:STDOUT: %specific_impl_fn.loc48_19.3: = specific_impl_function %impl.elem2.loc48_19.2, @Destroy.WithSelf.SelfDestruct.1(constants.%impl.elem1.2af) [symbolic = %specific_impl_fn.loc48_19.6 (constants.%specific_impl_fn.6a1)] -// CHECK:STDOUT: %bound_method.loc48_19.8: = bound_method %var, %specific_impl_fn.loc48_19.3 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc48_19.3: init %empty_tuple.type = call %bound_method.loc48_19.8(%var) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc36_19.2: = bound_method %.loc36_19.8, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.8 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc36_19.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc36_19.2(%.loc36_19.8) +// CHECK:STDOUT: %impl.elem2.loc36_19.2: @TestIterate.%.loc36_19.21 (%.421) = impl_witness_access constants.%Destroy.lookup_impl_witness.cb1, element2 [symbolic = %impl.elem2.loc36_19.4 (constants.%impl.elem2.f8d)] +// CHECK:STDOUT: %bound_method.loc36_19.7: = bound_method %var, %impl.elem2.loc36_19.2 +// CHECK:STDOUT: %.loc36_19.17: %Destroy.type = converted constants.%as_type.ba7, constants.%impl.elem1.2af [symbolic = %impl.elem1 (constants.%impl.elem1.2af)] +// CHECK:STDOUT: %.loc36_19.18: %Destroy.type = converted constants.%as_type.ba7, constants.%impl.elem1.2af [symbolic = %impl.elem1 (constants.%impl.elem1.2af)] +// CHECK:STDOUT: %specific_impl_fn.loc36_19.3: = specific_impl_function %impl.elem2.loc36_19.2, @Destroy.WithSelf.SelfDestruct.1(constants.%impl.elem1.2af) [symbolic = %specific_impl_fn.loc36_19.6 (constants.%specific_impl_fn.6a1)] +// CHECK:STDOUT: %bound_method.loc36_19.8: = bound_method %var, %specific_impl_fn.loc36_19.3 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc36_19.3: init %empty_tuple.type = call %bound_method.loc36_19.8(%var) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc48_19.1(%self.param: ref %.ecc) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc36_19.1(%self.param: ref %.ecc) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc48_19.1(%self.param: ref %.ecc) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc36_19.1(%self.param: ref %.ecc) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc48_19.1(%self.param: ref %.ecc) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc36_19.1(%self.param: ref %.ecc) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.2(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.2(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc48_19.2(%self.param: ref %MaybeUnformed.912) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc36_19.2(%self.param: ref %MaybeUnformed.912) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc48_19.2(%self.param: ref %MaybeUnformed.912) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc36_19.2(%self.param: ref %MaybeUnformed.912) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc48_19.2(%self.param: ref %MaybeUnformed.912) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc36_19.2(%self.param: ref %MaybeUnformed.912) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.3(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.3(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc48_19.3(%self.param: ref bool) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc36_19.3(%self.param: ref bool) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc48_19.3(%self.param: ref bool) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc36_19.3(%self.param: ref bool) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc48_19.3(%self.param: ref bool) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc36_19.3(%self.param: ref bool) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.4(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.4(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc48_19.4(%self.param: ref %struct_type.value.has_value.82f) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc36_19.4(%self.param: ref %struct_type.value.has_value.82f) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc48_19.1: ref bool = struct_access %self.param, element1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc48_19.1: = bound_method %.loc48_19.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.5 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc48_19.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc48_19.1(%.loc48_19.1) -// CHECK:STDOUT: %.loc48_19.2: ref %MaybeUnformed.912 = struct_access %self.param, element0 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc48_19.2: = bound_method %.loc48_19.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.4 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc48_19.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc48_19.2(%.loc48_19.2) +// CHECK:STDOUT: %.loc36_19.1: ref bool = struct_access %self.param, element1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc36_19.1: = bound_method %.loc36_19.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.5 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc36_19.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc36_19.1(%.loc36_19.1) +// CHECK:STDOUT: %.loc36_19.2: ref %MaybeUnformed.912 = struct_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc36_19.2: = bound_method %.loc36_19.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.4 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc36_19.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc36_19.2(%.loc36_19.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc48_19.4(%self.param: ref %struct_type.value.has_value.82f) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc36_19.4(%self.param: ref %struct_type.value.has_value.82f) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc48_19.4(%self.param: ref %struct_type.value.has_value.82f) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc36_19.4(%self.param: ref %struct_type.value.has_value.82f) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.5(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.5(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc48_19.5(%self.param: ref %DefaultOptionalStorage.6ea) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc36_19.5(%self.param: ref %DefaultOptionalStorage.6ea) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %has_value.ref: %DefaultOptionalStorage.elem.b33 = name_ref has_value, imports.%Core.import_ref.e86 [concrete = imports.%field_decl.390] -// CHECK:STDOUT: %.loc48_19.1: ref bool = class_element_access %self.param, element1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc48_19.1: = bound_method %.loc48_19.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.5 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc48_19.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc48_19.1(%.loc48_19.1) +// CHECK:STDOUT: %.loc36_19.1: ref bool = class_element_access %self.param, element1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc36_19.1: = bound_method %.loc36_19.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.5 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc36_19.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc36_19.1(%.loc36_19.1) // CHECK:STDOUT: %value.ref: %DefaultOptionalStorage.elem.9ab = name_ref value, imports.%Core.import_ref.373 [concrete = imports.%field_decl.498] -// CHECK:STDOUT: %.loc48_19.2: ref %MaybeUnformed.912 = class_element_access %self.param, element0 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc48_19.2: = bound_method %.loc48_19.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.4 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc48_19.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc48_19.2(%.loc48_19.2) +// CHECK:STDOUT: %.loc36_19.2: ref %MaybeUnformed.912 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc36_19.2: = bound_method %.loc36_19.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.4 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc36_19.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc36_19.2(%.loc36_19.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc48_19.5(%self.param: ref %DefaultOptionalStorage.6ea) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc36_19.5(%self.param: ref %DefaultOptionalStorage.6ea) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc48_19.5(%self.param: ref %DefaultOptionalStorage.6ea) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc36_19.5(%self.param: ref %DefaultOptionalStorage.6ea) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.6(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.6(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc48_19.6(%self.param: ref %Optional.000) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc36_19.6(%self.param: ref %Optional.000) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc48_19.6(%self.param: ref %Optional.000) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc36_19.6(%self.param: ref %Optional.000) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc48_19.6(%self.param: ref %Optional.000) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc36_19.6(%self.param: ref %Optional.000) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.7(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.7(%self.param) @@ -4277,111 +4155,111 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: } // CHECK:STDOUT: %m.ref: ref %MutableRange = name_ref m, %m // CHECK:STDOUT: %impl.elem2: %.177 = impl_witness_access constants.%Iterate.impl_witness.8eb, element2 [concrete = constants.%T.as_type.as.Iterate.impl.NewCursor.f32] -// CHECK:STDOUT: %bound_method.loc62_19.1: = bound_method %m.ref, %impl.elem2 -// CHECK:STDOUT: %facet_value.loc62_19.1: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableRange, (constants.%custom_witness.902, constants.%custom_witness.e74, constants.%custom_witness.0a8, constants.%custom_witness.491, constants.%custom_witness.068, constants.%custom_witness.f8f19d.2, constants.%Copy.impl_witness.eac, constants.%custom_witness.e74) [concrete = constants.%facet_value.c62] -// CHECK:STDOUT: %.loc62_19.1: %CppRange_where.type.d682d6.1 = converted constants.%MutableRange, %facet_value.loc62_19.1 [concrete = constants.%facet_value.c62] -// CHECK:STDOUT: %facet_value.loc62_19.2: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableRange, (constants.%custom_witness.902, constants.%custom_witness.e74, constants.%custom_witness.0a8, constants.%custom_witness.491, constants.%custom_witness.068, constants.%custom_witness.f8f19d.2, constants.%Copy.impl_witness.eac, constants.%custom_witness.e74) [concrete = constants.%facet_value.c62] -// CHECK:STDOUT: %.loc62_19.2: %CppRange_where.type.d682d6.1 = converted constants.%MutableRange, %facet_value.loc62_19.2 [concrete = constants.%facet_value.c62] -// CHECK:STDOUT: %specific_fn.loc62_19.1: = specific_function %impl.elem2, @T.as_type.as.Iterate.impl.NewCursor(constants.%facet_value.c62) [concrete = constants.%T.as_type.as.Iterate.impl.NewCursor.specific_fn] -// CHECK:STDOUT: %bound_method.loc62_19.2: = bound_method %m.ref, %specific_fn.loc62_19.1 +// CHECK:STDOUT: %bound_method.loc50_19.1: = bound_method %m.ref, %impl.elem2 +// CHECK:STDOUT: %facet_value.loc50_19.1: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableRange, (constants.%custom_witness.902, constants.%custom_witness.e74, constants.%custom_witness.0a8, constants.%custom_witness.491, constants.%custom_witness.068, constants.%custom_witness.f8f19d.2, constants.%Copy.impl_witness.eac, constants.%custom_witness.e74) [concrete = constants.%facet_value.c62] +// CHECK:STDOUT: %.loc50_19.1: %CppRange_where.type.d682d6.1 = converted constants.%MutableRange, %facet_value.loc50_19.1 [concrete = constants.%facet_value.c62] +// CHECK:STDOUT: %facet_value.loc50_19.2: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableRange, (constants.%custom_witness.902, constants.%custom_witness.e74, constants.%custom_witness.0a8, constants.%custom_witness.491, constants.%custom_witness.068, constants.%custom_witness.f8f19d.2, constants.%Copy.impl_witness.eac, constants.%custom_witness.e74) [concrete = constants.%facet_value.c62] +// CHECK:STDOUT: %.loc50_19.2: %CppRange_where.type.d682d6.1 = converted constants.%MutableRange, %facet_value.loc50_19.2 [concrete = constants.%facet_value.c62] +// CHECK:STDOUT: %specific_fn.loc50_19.1: = specific_function %impl.elem2, @T.as_type.as.Iterate.impl.NewCursor(constants.%facet_value.c62) [concrete = constants.%T.as_type.as.Iterate.impl.NewCursor.specific_fn] +// CHECK:STDOUT: %bound_method.loc50_19.2: = bound_method %m.ref, %specific_fn.loc50_19.1 // CHECK:STDOUT: %var: ref %tuple.type.dd0 = var_storage invalid -// CHECK:STDOUT: %.loc62_18.1: %MutableRange = acquire_value %m.ref -// CHECK:STDOUT: %T.as_type.as.Iterate.impl.NewCursor.call: init %tuple.type.dd0 to %var = call %bound_method.loc62_19.2(%.loc62_18.1) +// CHECK:STDOUT: %.loc50_18.1: %MutableRange = acquire_value %m.ref +// CHECK:STDOUT: %T.as_type.as.Iterate.impl.NewCursor.call: init %tuple.type.dd0 to %var = call %bound_method.loc50_19.2(%.loc50_18.1) // CHECK:STDOUT: assign %var, %T.as_type.as.Iterate.impl.NewCursor.call // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.next: // CHECK:STDOUT: %impl.elem3: %.d10 = impl_witness_access constants.%Iterate.impl_witness.8eb, element3 [concrete = constants.%T.as_type.as.Iterate.impl.Next.8a0] -// CHECK:STDOUT: %bound_method.loc62_19.3: = bound_method %m.ref, %impl.elem3 -// CHECK:STDOUT: %facet_value.loc62_19.3: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableRange, (constants.%custom_witness.902, constants.%custom_witness.e74, constants.%custom_witness.0a8, constants.%custom_witness.491, constants.%custom_witness.068, constants.%custom_witness.f8f19d.2, constants.%Copy.impl_witness.eac, constants.%custom_witness.e74) [concrete = constants.%facet_value.c62] -// CHECK:STDOUT: %.loc62_19.3: %CppRange_where.type.d682d6.1 = converted constants.%MutableRange, %facet_value.loc62_19.3 [concrete = constants.%facet_value.c62] -// CHECK:STDOUT: %facet_value.loc62_19.4: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableRange, (constants.%custom_witness.902, constants.%custom_witness.e74, constants.%custom_witness.0a8, constants.%custom_witness.491, constants.%custom_witness.068, constants.%custom_witness.f8f19d.2, constants.%Copy.impl_witness.eac, constants.%custom_witness.e74) [concrete = constants.%facet_value.c62] -// CHECK:STDOUT: %.loc62_19.4: %CppRange_where.type.d682d6.1 = converted constants.%MutableRange, %facet_value.loc62_19.4 [concrete = constants.%facet_value.c62] -// CHECK:STDOUT: %specific_fn.loc62_19.2: = specific_function %impl.elem3, @T.as_type.as.Iterate.impl.Next(constants.%facet_value.c62) [concrete = constants.%T.as_type.as.Iterate.impl.Next.specific_fn] -// CHECK:STDOUT: %bound_method.loc62_19.4: = bound_method %m.ref, %specific_fn.loc62_19.2 -// CHECK:STDOUT: %.loc62_19.5: ref %Optional.000 = temporary_storage -// CHECK:STDOUT: %.loc62_18.2: %MutableRange = acquire_value %m.ref -// CHECK:STDOUT: %T.as_type.as.Iterate.impl.Next.call: init %Optional.000 to %.loc62_19.5 = call %bound_method.loc62_19.4(%.loc62_18.2, %var) -// CHECK:STDOUT: %.loc62_19.6: ref %Optional.000 = temporary %.loc62_19.5, %T.as_type.as.Iterate.impl.Next.call -// CHECK:STDOUT: %.loc62_19.7: %Optional.HasValue.type.92f = specific_constant imports.%Core.import_ref.c82, @Optional(constants.%OptionalStorage.facet.d7a) [concrete = constants.%Optional.HasValue.ff5] -// CHECK:STDOUT: %HasValue.ref: %Optional.HasValue.type.92f = name_ref HasValue, %.loc62_19.7 [concrete = constants.%Optional.HasValue.ff5] -// CHECK:STDOUT: %Optional.HasValue.bound: = bound_method %.loc62_19.6, %HasValue.ref +// CHECK:STDOUT: %bound_method.loc50_19.3: = bound_method %m.ref, %impl.elem3 +// CHECK:STDOUT: %facet_value.loc50_19.3: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableRange, (constants.%custom_witness.902, constants.%custom_witness.e74, constants.%custom_witness.0a8, constants.%custom_witness.491, constants.%custom_witness.068, constants.%custom_witness.f8f19d.2, constants.%Copy.impl_witness.eac, constants.%custom_witness.e74) [concrete = constants.%facet_value.c62] +// CHECK:STDOUT: %.loc50_19.3: %CppRange_where.type.d682d6.1 = converted constants.%MutableRange, %facet_value.loc50_19.3 [concrete = constants.%facet_value.c62] +// CHECK:STDOUT: %facet_value.loc50_19.4: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableRange, (constants.%custom_witness.902, constants.%custom_witness.e74, constants.%custom_witness.0a8, constants.%custom_witness.491, constants.%custom_witness.068, constants.%custom_witness.f8f19d.2, constants.%Copy.impl_witness.eac, constants.%custom_witness.e74) [concrete = constants.%facet_value.c62] +// CHECK:STDOUT: %.loc50_19.4: %CppRange_where.type.d682d6.1 = converted constants.%MutableRange, %facet_value.loc50_19.4 [concrete = constants.%facet_value.c62] +// CHECK:STDOUT: %specific_fn.loc50_19.2: = specific_function %impl.elem3, @T.as_type.as.Iterate.impl.Next(constants.%facet_value.c62) [concrete = constants.%T.as_type.as.Iterate.impl.Next.specific_fn] +// CHECK:STDOUT: %bound_method.loc50_19.4: = bound_method %m.ref, %specific_fn.loc50_19.2 +// CHECK:STDOUT: %.loc50_19.5: ref %Optional.000 = temporary_storage +// CHECK:STDOUT: %.loc50_18.2: %MutableRange = acquire_value %m.ref +// CHECK:STDOUT: %T.as_type.as.Iterate.impl.Next.call: init %Optional.000 to %.loc50_19.5 = call %bound_method.loc50_19.4(%.loc50_18.2, %var) +// CHECK:STDOUT: %.loc50_19.6: ref %Optional.000 = temporary %.loc50_19.5, %T.as_type.as.Iterate.impl.Next.call +// CHECK:STDOUT: %.loc50_19.7: %Optional.HasValue.type.92f = specific_constant imports.%Core.import_ref.c82, @Optional(constants.%OptionalStorage.facet.d7a) [concrete = constants.%Optional.HasValue.ff5] +// CHECK:STDOUT: %HasValue.ref: %Optional.HasValue.type.92f = name_ref HasValue, %.loc50_19.7 [concrete = constants.%Optional.HasValue.ff5] +// CHECK:STDOUT: %Optional.HasValue.bound: = bound_method %.loc50_19.6, %HasValue.ref // CHECK:STDOUT: %Optional.HasValue.specific_fn: = specific_function %HasValue.ref, @Optional.HasValue(constants.%OptionalStorage.facet.d7a) [concrete = constants.%Optional.HasValue.specific_fn.315] -// CHECK:STDOUT: %bound_method.loc62_19.5: = bound_method %.loc62_19.6, %Optional.HasValue.specific_fn -// CHECK:STDOUT: %.loc62_19.8: %Optional.000 = acquire_value %.loc62_19.6 -// CHECK:STDOUT: %Optional.HasValue.call: init bool = call %bound_method.loc62_19.5(%.loc62_19.8) -// CHECK:STDOUT: %.loc62_19.9: bool = value_of_initializer %Optional.HasValue.call -// CHECK:STDOUT: %.loc62_19.10: bool = converted %Optional.HasValue.call, %.loc62_19.9 -// CHECK:STDOUT: if %.loc62_19.10 br !for.body else br !for.done +// CHECK:STDOUT: %bound_method.loc50_19.5: = bound_method %.loc50_19.6, %Optional.HasValue.specific_fn +// CHECK:STDOUT: %.loc50_19.8: %Optional.000 = acquire_value %.loc50_19.6 +// CHECK:STDOUT: %Optional.HasValue.call: init bool = call %bound_method.loc50_19.5(%.loc50_19.8) +// CHECK:STDOUT: %.loc50_19.9: bool = value_of_initializer %Optional.HasValue.call +// CHECK:STDOUT: %.loc50_19.10: bool = converted %Optional.HasValue.call, %.loc50_19.9 +// CHECK:STDOUT: if %.loc50_19.10 br !for.body else br !for.done // CHECK:STDOUT: // CHECK:STDOUT: !for.body: -// CHECK:STDOUT: %.loc62_19.11: %Optional.Get.type.695 = specific_constant imports.%Core.import_ref.29e, @Optional(constants.%OptionalStorage.facet.d7a) [concrete = constants.%Optional.Get.62a] -// CHECK:STDOUT: %Get.ref: %Optional.Get.type.695 = name_ref Get, %.loc62_19.11 [concrete = constants.%Optional.Get.62a] -// CHECK:STDOUT: %Optional.Get.bound: = bound_method %.loc62_19.6, %Get.ref +// CHECK:STDOUT: %.loc50_19.11: %Optional.Get.type.695 = specific_constant imports.%Core.import_ref.29e, @Optional(constants.%OptionalStorage.facet.d7a) [concrete = constants.%Optional.Get.62a] +// CHECK:STDOUT: %Get.ref: %Optional.Get.type.695 = name_ref Get, %.loc50_19.11 [concrete = constants.%Optional.Get.62a] +// CHECK:STDOUT: %Optional.Get.bound: = bound_method %.loc50_19.6, %Get.ref // CHECK:STDOUT: %Optional.Get.specific_fn: = specific_function %Get.ref, @Optional.Get(constants.%OptionalStorage.facet.d7a) [concrete = constants.%Optional.Get.specific_fn.570] -// CHECK:STDOUT: %bound_method.loc62_19.6: = bound_method %.loc62_19.6, %Optional.Get.specific_fn -// CHECK:STDOUT: %.loc62_19.12: %Optional.000 = acquire_value %.loc62_19.6 -// CHECK:STDOUT: %Optional.Get.call: init %f64.761 = call %bound_method.loc62_19.6(%.loc62_19.12) -// CHECK:STDOUT: %.loc62_19.13: %f64.761 = value_of_initializer %Optional.Get.call -// CHECK:STDOUT: %.loc62_19.14: %f64.761 = converted %Optional.Get.call, %.loc62_19.13 -// CHECK:STDOUT: %f64.loc62: type = type_literal constants.%f64.761 [concrete = constants.%f64.761] -// CHECK:STDOUT: %i: %f64.761 = wrapper_binding i, %.loc62_19.14 +// CHECK:STDOUT: %bound_method.loc50_19.6: = bound_method %.loc50_19.6, %Optional.Get.specific_fn +// CHECK:STDOUT: %.loc50_19.12: %Optional.000 = acquire_value %.loc50_19.6 +// CHECK:STDOUT: %Optional.Get.call: init %f64.761 = call %bound_method.loc50_19.6(%.loc50_19.12) +// CHECK:STDOUT: %.loc50_19.13: %f64.761 = value_of_initializer %Optional.Get.call +// CHECK:STDOUT: %.loc50_19.14: %f64.761 = converted %Optional.Get.call, %.loc50_19.13 +// CHECK:STDOUT: %f64.loc50: type = type_literal constants.%f64.761 [concrete = constants.%f64.761] +// CHECK:STDOUT: %i: %f64.761 = wrapper_binding i, %.loc50_19.14 // CHECK:STDOUT: %sum.ref: ref %f64.761 = name_ref sum, %sum // CHECK:STDOUT: %i.ref: %f64.761 = name_ref i, %i -// CHECK:STDOUT: %impl.elem0.loc63: %.48b = impl_witness_access constants.%AddAssignWith.impl_witness.5c7, element0 [concrete = constants.%Float.as.AddAssignWith.impl.Op.e04] -// CHECK:STDOUT: %bound_method.loc63_9.1: = bound_method %sum.ref, %impl.elem0.loc63 -// CHECK:STDOUT: %specific_fn.loc63: = specific_function %impl.elem0.loc63, @Float.as.AddAssignWith.impl.Op(constants.%int_64) [concrete = constants.%Float.as.AddAssignWith.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc63_9.2: = bound_method %sum.ref, %specific_fn.loc63 -// CHECK:STDOUT: %Float.as.AddAssignWith.impl.Op.call: init %empty_tuple.type = call %bound_method.loc63_9.2(%sum.ref, %i.ref) -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc62_19.1: = bound_method %.loc62_19.6, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.8 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc62_19.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc62_19.1(%.loc62_19.6) +// CHECK:STDOUT: %impl.elem0.loc51: %.48b = impl_witness_access constants.%AddAssignWith.impl_witness.5c7, element0 [concrete = constants.%Float.as.AddAssignWith.impl.Op.e04] +// CHECK:STDOUT: %bound_method.loc51_9.1: = bound_method %sum.ref, %impl.elem0.loc51 +// CHECK:STDOUT: %specific_fn.loc51: = specific_function %impl.elem0.loc51, @Float.as.AddAssignWith.impl.Op(constants.%int_64) [concrete = constants.%Float.as.AddAssignWith.impl.Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc51_9.2: = bound_method %sum.ref, %specific_fn.loc51 +// CHECK:STDOUT: %Float.as.AddAssignWith.impl.Op.call: init %empty_tuple.type = call %bound_method.loc51_9.2(%sum.ref, %i.ref) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc50_19.1: = bound_method %.loc50_19.6, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.8 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc50_19.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc50_19.1(%.loc50_19.6) // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.done: -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc62_19.2: = bound_method %.loc62_19.6, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.8 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc62_19.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc62_19.2(%.loc62_19.6) -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc62_19.3: = bound_method %var, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.10 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc62_19.3: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc62_19.3(%var) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc50_19.2: = bound_method %.loc50_19.6, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.8 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc50_19.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc50_19.2(%.loc50_19.6) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc50_19.3: = bound_method %var, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.10 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc50_19.3: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc50_19.3(%var) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @TestIterate(constants.%R) { -// CHECK:STDOUT: %R.patt.loc44_17.2 => constants.%R.patt -// CHECK:STDOUT: %R.loc44_17.1 => constants.%R -// CHECK:STDOUT: %R.as_type.loc44_61.1 => constants.%R.as_type +// CHECK:STDOUT: %R.patt.loc32_17.2 => constants.%R.patt +// CHECK:STDOUT: %R.loc32_17.1 => constants.%R +// CHECK:STDOUT: %R.as_type.loc32_61.1 => constants.%R.as_type // CHECK:STDOUT: %pattern_type => constants.%pattern_type.874 -// CHECK:STDOUT: %r.param_patt.loc44_59.2 => constants.%r.param_patt.ef5 -// CHECK:STDOUT: %r.patt.loc44_59.2 => constants.%r.patt.c43 +// CHECK:STDOUT: %r.param_patt.loc32_59.2 => constants.%r.param_patt.ef5 +// CHECK:STDOUT: %r.patt.loc32_59.2 => constants.%r.patt.c43 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @TestIterate(constants.%facet_value.da8) { -// CHECK:STDOUT: %R.patt.loc44_17.2 => constants.%R.patt -// CHECK:STDOUT: %R.loc44_17.1 => constants.%facet_value.da8 -// CHECK:STDOUT: %R.as_type.loc44_61.1 => constants.%MutableRange +// CHECK:STDOUT: %R.patt.loc32_17.2 => constants.%R.patt +// CHECK:STDOUT: %R.loc32_17.1 => constants.%facet_value.da8 +// CHECK:STDOUT: %R.as_type.loc32_61.1 => constants.%MutableRange // CHECK:STDOUT: %pattern_type => constants.%pattern_type.992 -// CHECK:STDOUT: %r.param_patt.loc44_59.2 => constants.%r.param_patt.aeb -// CHECK:STDOUT: %r.patt.loc44_59.2 => constants.%r.patt.892 +// CHECK:STDOUT: %r.param_patt.loc32_59.2 => constants.%r.param_patt.aeb +// CHECK:STDOUT: %r.patt.loc32_59.2 => constants.%r.patt.892 // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete.loc44 => constants.%complete_type.357 +// CHECK:STDOUT: %require_complete.loc32 => constants.%complete_type.357 // CHECK:STDOUT: %Iterate.lookup_impl_witness => constants.%Iterate.impl_witness.8eb -// CHECK:STDOUT: %Iterate.facet.loc48_19.5 => constants.%Iterate.facet.b38 +// CHECK:STDOUT: %Iterate.facet.loc36_19.5 => constants.%Iterate.facet.b38 // CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type => constants.%Iterate.WithSelf.NewCursor.type.601 -// CHECK:STDOUT: %.loc48_19.19 => constants.%.177 -// CHECK:STDOUT: %impl.elem2.loc48_19.3 => constants.%T.as_type.as.Iterate.impl.NewCursor.f32 -// CHECK:STDOUT: %specific_impl_fn.loc48_19.4 => constants.%T.as_type.as.Iterate.impl.NewCursor.specific_fn +// CHECK:STDOUT: %.loc36_19.19 => constants.%.177 +// CHECK:STDOUT: %impl.elem2.loc36_19.3 => constants.%T.as_type.as.Iterate.impl.NewCursor.f32 +// CHECK:STDOUT: %specific_impl_fn.loc36_19.4 => constants.%T.as_type.as.Iterate.impl.NewCursor.specific_fn // CHECK:STDOUT: %impl.elem1 => constants.%Destroy.facet.f0b // CHECK:STDOUT: %as_type => constants.%tuple.type.dd0 // CHECK:STDOUT: %require_complete.1 => constants.%complete_type.843 // CHECK:STDOUT: %Iterate.WithSelf.Next.type => constants.%Iterate.WithSelf.Next.type.63c -// CHECK:STDOUT: %.loc48_19.20 => constants.%.d10 -// CHECK:STDOUT: %impl.elem3.loc48_19.2 => constants.%T.as_type.as.Iterate.impl.Next.8a0 -// CHECK:STDOUT: %specific_impl_fn.loc48_19.5 => constants.%T.as_type.as.Iterate.impl.Next.specific_fn +// CHECK:STDOUT: %.loc36_19.20 => constants.%.d10 +// CHECK:STDOUT: %impl.elem3.loc36_19.2 => constants.%T.as_type.as.Iterate.impl.Next.8a0 +// CHECK:STDOUT: %specific_impl_fn.loc36_19.5 => constants.%T.as_type.as.Iterate.impl.Next.specific_fn // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type => constants.%Destroy.WithSelf.SelfDestruct.type.1a9 -// CHECK:STDOUT: %.loc48_19.21 => constants.%.4a2 +// CHECK:STDOUT: %.loc36_19.21 => constants.%.4a2 // CHECK:STDOUT: %Destroy.lookup_impl_witness => constants.%custom_witness.f8f19d.9 -// CHECK:STDOUT: %impl.elem2.loc48_19.4 => constants.%Destroy.WithSelf.SelfDestruct.db3fdb.10 -// CHECK:STDOUT: %specific_impl_fn.loc48_19.6 => constants.%Destroy.WithSelf.SelfDestruct.db3fdb.10 +// CHECK:STDOUT: %impl.elem2.loc36_19.4 => constants.%Destroy.WithSelf.SelfDestruct.db3fdb.10 +// CHECK:STDOUT: %specific_impl_fn.loc36_19.6 => constants.%Destroy.WithSelf.SelfDestruct.db3fdb.10 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- adl_returns_different_types.carbon @@ -5090,9 +4968,9 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %.Self.500: %Iterate.type = symbolic_binding .Self [symbolic_self] // CHECK:STDOUT: %ValueType: type = class_type @ValueType [concrete] // CHECK:STDOUT: %pattern_type.d2d: type = pattern_type %ValueType [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc49 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc37 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.2: %Destroy.WithSelf.Op.type.ef016f.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc49 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc37 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.2: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2 = struct_value () [concrete] // CHECK:STDOUT: %ValueType.SubobjectDestroy.type: type = fn_type @ValueType.SubobjectDestroy [concrete] // CHECK:STDOUT: %ValueType.SubobjectDestroy: %ValueType.SubobjectDestroy.type = struct_value () [concrete] @@ -5149,48 +5027,48 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %pattern_type.1d1: type = pattern_type %.dd1 [concrete] // CHECK:STDOUT: %self.param_patt.964: %pattern_type.1d1 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.82f: %pattern_type.1d1 = wrapper_binding_pattern self, %self.param_patt.964 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc53_44.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc41_44.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc53_44.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc41_44.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.3: %Destroy.WithSelf.Op.type.ef016f.3 = struct_value () [concrete] // CHECK:STDOUT: %pattern_type.5da: type = pattern_type %MaybeUnformed.65d [concrete] // CHECK:STDOUT: %self.param_patt.323: %pattern_type.5da = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.b95: %pattern_type.5da = wrapper_binding_pattern self, %self.param_patt.323 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc53_44.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc41_44.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.4: type = fn_type @Destroy.WithSelf.Op.loc53_44.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.4: type = fn_type @Destroy.WithSelf.Op.loc41_44.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.4: %Destroy.WithSelf.Op.type.ef016f.4 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.4: type = fn_type @Destroy.WithSelf.SelfDestruct.loc53_44.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.4: type = fn_type @Destroy.WithSelf.SelfDestruct.loc41_44.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.4: %Destroy.WithSelf.SelfDestruct.type.fbceb5.4 = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.40d: %pattern_type.831 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.560: %pattern_type.831 = wrapper_binding_pattern self, %self.param_patt.40d [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc53_44.3 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc41_44.3 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.4: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.5: type = fn_type @Destroy.WithSelf.Op.loc53_44.3 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.5: type = fn_type @Destroy.WithSelf.Op.loc41_44.3 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.5: %Destroy.WithSelf.Op.type.ef016f.5 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.5: type = fn_type @Destroy.WithSelf.SelfDestruct.loc53_44.3 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.5: type = fn_type @Destroy.WithSelf.SelfDestruct.loc41_44.3 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.5: %Destroy.WithSelf.SelfDestruct.type.fbceb5.5 = struct_value () [concrete] // CHECK:STDOUT: %pattern_type.bef: type = pattern_type %struct_type.value.has_value.afd [concrete] // CHECK:STDOUT: %self.param_patt.5ce: %pattern_type.bef = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.6ba: %pattern_type.bef = wrapper_binding_pattern self, %self.param_patt.5ce [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.5: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc53_44.4 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.5: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc41_44.4 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.5: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.5 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.6: type = fn_type @Destroy.WithSelf.Op.loc53_44.4 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.6: type = fn_type @Destroy.WithSelf.Op.loc41_44.4 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.6: %Destroy.WithSelf.Op.type.ef016f.6 = struct_value () [concrete] // CHECK:STDOUT: %pattern_type.c4b: type = pattern_type %DefaultOptionalStorage.f08 [concrete] // CHECK:STDOUT: %self.param_patt.0a4: %pattern_type.c4b = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.138: %pattern_type.c4b = wrapper_binding_pattern self, %self.param_patt.0a4 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.6: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc53_44.5 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.6: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc41_44.5 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.6: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.6 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.7: type = fn_type @Destroy.WithSelf.Op.loc53_44.5 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.7: type = fn_type @Destroy.WithSelf.Op.loc41_44.5 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.7: %Destroy.WithSelf.Op.type.ef016f.7 = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.8be: %pattern_type.0bb = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.bb8: %pattern_type.0bb = wrapper_binding_pattern self, %self.param_patt.8be [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.7: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc53_44.6 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.7: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc41_44.6 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.7: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.7 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.8: type = fn_type @Destroy.WithSelf.Op.loc53_44.6 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.8: type = fn_type @Destroy.WithSelf.Op.loc41_44.6 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.8: %Destroy.WithSelf.Op.type.ef016f.8 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.8: type = fn_type @Destroy.WithSelf.SelfDestruct.loc53_44.6 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.8: type = fn_type @Destroy.WithSelf.SelfDestruct.loc41_44.6 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.8: %Destroy.WithSelf.SelfDestruct.type.fbceb5.8 = struct_value () [concrete] // CHECK:STDOUT: %Destroy.lookup_impl_witness.696: = lookup_impl_witness %impl.elem1.0e0, @Destroy [symbolic] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.55d: type = fn_type @Destroy.WithSelf.SelfDestruct.1, @Destroy.WithSelf(%impl.elem1.0e0) [symbolic] @@ -5235,84 +5113,84 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc53_44.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc41_44.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.1d1 = ref_param_pattern [concrete = constants.%self.param_patt.964] // CHECK:STDOUT: %self.patt: %pattern_type.1d1 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.82f] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %.dd1 = ref_param call_param0 // CHECK:STDOUT: %self: ref %.dd1 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc53_44.1 [concrete = constants.%Destroy.WithSelf.Op.403171.3] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc41_44.1 [concrete = constants.%Destroy.WithSelf.Op.403171.3] { // CHECK:STDOUT: %self.param_patt: %pattern_type.1d1 = ref_param_pattern [concrete = constants.%self.param_patt.964] // CHECK:STDOUT: %self.patt: %pattern_type.1d1 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.82f] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %.dd1 = ref_param call_param0 // CHECK:STDOUT: %self: ref %.dd1 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc53_44.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.3] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc41_44.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.3] { // CHECK:STDOUT: %self.param_patt: %pattern_type.5da = ref_param_pattern [concrete = constants.%self.param_patt.323] // CHECK:STDOUT: %self.patt: %pattern_type.5da = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.b95] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %MaybeUnformed.65d = ref_param call_param0 // CHECK:STDOUT: %self: ref %MaybeUnformed.65d = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.3: %Destroy.WithSelf.Op.type.ef016f.4 = fn_decl @Destroy.WithSelf.Op.loc53_44.2 [concrete = constants.%Destroy.WithSelf.Op.403171.4] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.3: %Destroy.WithSelf.Op.type.ef016f.4 = fn_decl @Destroy.WithSelf.Op.loc41_44.2 [concrete = constants.%Destroy.WithSelf.Op.403171.4] { // CHECK:STDOUT: %self.param_patt: %pattern_type.5da = ref_param_pattern [concrete = constants.%self.param_patt.323] // CHECK:STDOUT: %self.patt: %pattern_type.5da = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.b95] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %MaybeUnformed.65d = ref_param call_param0 // CHECK:STDOUT: %self: ref %MaybeUnformed.65d = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc53_44.3 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.4] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc41_44.3 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.4] { // CHECK:STDOUT: %self.param_patt: %pattern_type.831 = ref_param_pattern [concrete = constants.%self.param_patt.40d] // CHECK:STDOUT: %self.patt: %pattern_type.831 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.560] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref bool = ref_param call_param0 // CHECK:STDOUT: %self: ref bool = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.4: %Destroy.WithSelf.Op.type.ef016f.5 = fn_decl @Destroy.WithSelf.Op.loc53_44.3 [concrete = constants.%Destroy.WithSelf.Op.403171.5] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.4: %Destroy.WithSelf.Op.type.ef016f.5 = fn_decl @Destroy.WithSelf.Op.loc41_44.3 [concrete = constants.%Destroy.WithSelf.Op.403171.5] { // CHECK:STDOUT: %self.param_patt: %pattern_type.831 = ref_param_pattern [concrete = constants.%self.param_patt.40d] // CHECK:STDOUT: %self.patt: %pattern_type.831 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.560] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref bool = ref_param call_param0 // CHECK:STDOUT: %self: ref bool = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.4: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.5 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc53_44.4 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.5] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.4: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.5 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc41_44.4 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.5] { // CHECK:STDOUT: %self.param_patt: %pattern_type.bef = ref_param_pattern [concrete = constants.%self.param_patt.5ce] // CHECK:STDOUT: %self.patt: %pattern_type.bef = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.6ba] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %struct_type.value.has_value.afd = ref_param call_param0 // CHECK:STDOUT: %self: ref %struct_type.value.has_value.afd = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.5: %Destroy.WithSelf.Op.type.ef016f.6 = fn_decl @Destroy.WithSelf.Op.loc53_44.4 [concrete = constants.%Destroy.WithSelf.Op.403171.6] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.5: %Destroy.WithSelf.Op.type.ef016f.6 = fn_decl @Destroy.WithSelf.Op.loc41_44.4 [concrete = constants.%Destroy.WithSelf.Op.403171.6] { // CHECK:STDOUT: %self.param_patt: %pattern_type.bef = ref_param_pattern [concrete = constants.%self.param_patt.5ce] // CHECK:STDOUT: %self.patt: %pattern_type.bef = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.6ba] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %struct_type.value.has_value.afd = ref_param call_param0 // CHECK:STDOUT: %self: ref %struct_type.value.has_value.afd = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.5: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.6 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc53_44.5 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.6] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.5: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.6 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc41_44.5 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.6] { // CHECK:STDOUT: %self.param_patt: %pattern_type.c4b = ref_param_pattern [concrete = constants.%self.param_patt.0a4] // CHECK:STDOUT: %self.patt: %pattern_type.c4b = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.138] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %DefaultOptionalStorage.f08 = ref_param call_param0 // CHECK:STDOUT: %self: ref %DefaultOptionalStorage.f08 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.6: %Destroy.WithSelf.Op.type.ef016f.7 = fn_decl @Destroy.WithSelf.Op.loc53_44.5 [concrete = constants.%Destroy.WithSelf.Op.403171.7] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.6: %Destroy.WithSelf.Op.type.ef016f.7 = fn_decl @Destroy.WithSelf.Op.loc41_44.5 [concrete = constants.%Destroy.WithSelf.Op.403171.7] { // CHECK:STDOUT: %self.param_patt: %pattern_type.c4b = ref_param_pattern [concrete = constants.%self.param_patt.0a4] // CHECK:STDOUT: %self.patt: %pattern_type.c4b = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.138] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %DefaultOptionalStorage.f08 = ref_param call_param0 // CHECK:STDOUT: %self: ref %DefaultOptionalStorage.f08 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.6: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.7 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc53_44.6 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.7] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.6: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.7 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc41_44.6 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.7] { // CHECK:STDOUT: %self.param_patt: %pattern_type.0bb = ref_param_pattern [concrete = constants.%self.param_patt.8be] // CHECK:STDOUT: %self.patt: %pattern_type.0bb = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.bb8] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %Optional.f5e = ref_param call_param0 // CHECK:STDOUT: %self: ref %Optional.f5e = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.7: %Destroy.WithSelf.Op.type.ef016f.8 = fn_decl @Destroy.WithSelf.Op.loc53_44.6 [concrete = constants.%Destroy.WithSelf.Op.403171.8] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.7: %Destroy.WithSelf.Op.type.ef016f.8 = fn_decl @Destroy.WithSelf.Op.loc41_44.6 [concrete = constants.%Destroy.WithSelf.Op.403171.8] { // CHECK:STDOUT: %self.param_patt: %pattern_type.0bb = ref_param_pattern [concrete = constants.%self.param_patt.8be] // CHECK:STDOUT: %self.patt: %pattern_type.0bb = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.bb8] // CHECK:STDOUT: } { @@ -5321,200 +5199,200 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @TestIterate(%R.loc49_17.2: %Iterate_where.type.9df) { +// CHECK:STDOUT: generic fn @TestIterate(%R.loc37_17.2: %Iterate_where.type.9df) { // CHECK:STDOUT: // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: %Iterate.lookup_impl_witness: = lookup_impl_witness %R.loc49_17.1, @Iterate [symbolic = %Iterate.lookup_impl_witness (constants.%Iterate.lookup_impl_witness.711)] -// CHECK:STDOUT: %Iterate.facet.loc53_44.5: %Iterate.type = facet_value %R.as_type.loc49_86.1, (%Iterate.lookup_impl_witness) [symbolic = %Iterate.facet.loc53_44.5 (constants.%Iterate.facet.04e)] -// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type: type = fn_type @Iterate.WithSelf.NewCursor, @Iterate.WithSelf(%Iterate.facet.loc53_44.5) [symbolic = %Iterate.WithSelf.NewCursor.type (constants.%Iterate.WithSelf.NewCursor.type.f6c)] -// CHECK:STDOUT: %.loc53_44.20: type = fn_type_with_self_type %Iterate.WithSelf.NewCursor.type, %Iterate.facet.loc53_44.5 [symbolic = %.loc53_44.20 (constants.%.2577)] -// CHECK:STDOUT: %impl.elem2.loc53_44.3: @TestIterate.%.loc53_44.20 (%.2577) = impl_witness_access %Iterate.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc53_44.3 (constants.%impl.elem2.f11)] -// CHECK:STDOUT: %specific_impl_fn.loc53_44.4: = specific_impl_function %impl.elem2.loc53_44.3, @Iterate.WithSelf.NewCursor(%Iterate.facet.loc53_44.5) [symbolic = %specific_impl_fn.loc53_44.4 (constants.%specific_impl_fn.d03)] +// CHECK:STDOUT: %Iterate.lookup_impl_witness: = lookup_impl_witness %R.loc37_17.1, @Iterate [symbolic = %Iterate.lookup_impl_witness (constants.%Iterate.lookup_impl_witness.711)] +// CHECK:STDOUT: %Iterate.facet.loc41_44.5: %Iterate.type = facet_value %R.as_type.loc37_86.1, (%Iterate.lookup_impl_witness) [symbolic = %Iterate.facet.loc41_44.5 (constants.%Iterate.facet.04e)] +// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type: type = fn_type @Iterate.WithSelf.NewCursor, @Iterate.WithSelf(%Iterate.facet.loc41_44.5) [symbolic = %Iterate.WithSelf.NewCursor.type (constants.%Iterate.WithSelf.NewCursor.type.f6c)] +// CHECK:STDOUT: %.loc41_44.20: type = fn_type_with_self_type %Iterate.WithSelf.NewCursor.type, %Iterate.facet.loc41_44.5 [symbolic = %.loc41_44.20 (constants.%.2577)] +// CHECK:STDOUT: %impl.elem2.loc41_44.3: @TestIterate.%.loc41_44.20 (%.2577) = impl_witness_access %Iterate.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc41_44.3 (constants.%impl.elem2.f11)] +// CHECK:STDOUT: %specific_impl_fn.loc41_44.4: = specific_impl_function %impl.elem2.loc41_44.3, @Iterate.WithSelf.NewCursor(%Iterate.facet.loc41_44.5) [symbolic = %specific_impl_fn.loc41_44.4 (constants.%specific_impl_fn.d03)] // CHECK:STDOUT: -// CHECK:STDOUT: %Iterate.WithSelf.Next.type: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.loc53_44.5) [symbolic = %Iterate.WithSelf.Next.type (constants.%Iterate.WithSelf.Next.type.d76)] -// CHECK:STDOUT: %.loc53_44.21: type = fn_type_with_self_type %Iterate.WithSelf.Next.type, %Iterate.facet.loc53_44.5 [symbolic = %.loc53_44.21 (constants.%.894)] -// CHECK:STDOUT: %impl.elem3.loc53_44.2: @TestIterate.%.loc53_44.21 (%.894) = impl_witness_access %Iterate.lookup_impl_witness, element3 [symbolic = %impl.elem3.loc53_44.2 (constants.%impl.elem3.eed)] -// CHECK:STDOUT: %specific_impl_fn.loc53_44.5: = specific_impl_function %impl.elem3.loc53_44.2, @Iterate.WithSelf.Next(%Iterate.facet.loc53_44.5) [symbolic = %specific_impl_fn.loc53_44.5 (constants.%specific_impl_fn.303)] +// CHECK:STDOUT: %Iterate.WithSelf.Next.type: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.loc41_44.5) [symbolic = %Iterate.WithSelf.Next.type (constants.%Iterate.WithSelf.Next.type.d76)] +// CHECK:STDOUT: %.loc41_44.21: type = fn_type_with_self_type %Iterate.WithSelf.Next.type, %Iterate.facet.loc41_44.5 [symbolic = %.loc41_44.21 (constants.%.894)] +// CHECK:STDOUT: %impl.elem3.loc41_44.2: @TestIterate.%.loc41_44.21 (%.894) = impl_witness_access %Iterate.lookup_impl_witness, element3 [symbolic = %impl.elem3.loc41_44.2 (constants.%impl.elem3.eed)] +// CHECK:STDOUT: %specific_impl_fn.loc41_44.5: = specific_impl_function %impl.elem3.loc41_44.2, @Iterate.WithSelf.Next(%Iterate.facet.loc41_44.5) [symbolic = %specific_impl_fn.loc41_44.5 (constants.%specific_impl_fn.303)] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type: type = fn_type @Destroy.WithSelf.SelfDestruct.1, @Destroy.WithSelf(%impl.elem1) [symbolic = %Destroy.WithSelf.SelfDestruct.type (constants.%Destroy.WithSelf.SelfDestruct.type.55d)] -// CHECK:STDOUT: %.loc53_44.22: type = fn_type_with_self_type %Destroy.WithSelf.SelfDestruct.type, %impl.elem1 [symbolic = %.loc53_44.22 (constants.%.a44)] +// CHECK:STDOUT: %.loc41_44.22: type = fn_type_with_self_type %Destroy.WithSelf.SelfDestruct.type, %impl.elem1 [symbolic = %.loc41_44.22 (constants.%.a44)] // CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %impl.elem1, @Destroy [symbolic = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness.696)] -// CHECK:STDOUT: %impl.elem2.loc53_44.4: @TestIterate.%.loc53_44.22 (%.a44) = impl_witness_access %Destroy.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc53_44.4 (constants.%impl.elem2.1f1)] -// CHECK:STDOUT: %specific_impl_fn.loc53_44.6: = specific_impl_function %impl.elem2.loc53_44.4, @Destroy.WithSelf.SelfDestruct.1(%impl.elem1) [symbolic = %specific_impl_fn.loc53_44.6 (constants.%specific_impl_fn.cb8)] +// CHECK:STDOUT: %impl.elem2.loc41_44.4: @TestIterate.%.loc41_44.22 (%.a44) = impl_witness_access %Destroy.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc41_44.4 (constants.%impl.elem2.1f1)] +// CHECK:STDOUT: %specific_impl_fn.loc41_44.6: = specific_impl_function %impl.elem2.loc41_44.4, @Destroy.WithSelf.SelfDestruct.1(%impl.elem1) [symbolic = %specific_impl_fn.loc41_44.6 (constants.%specific_impl_fn.cb8)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%r.param: @TestIterate.%R.as_type.loc49_86.1 (%R.as_type)) { +// CHECK:STDOUT: fn(%r.param: @TestIterate.%R.as_type.loc37_86.1 (%R.as_type)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %i.patt: %pattern_type.d2d = value_binding_pattern i [concrete = constants.%i.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %r.ref: @TestIterate.%R.as_type.loc49_86.1 (%R.as_type) = name_ref r, %r -// CHECK:STDOUT: %impl.elem2.loc53_44.1: @TestIterate.%.loc53_44.20 (%.2577) = impl_witness_access constants.%Iterate.lookup_impl_witness.711, element2 [symbolic = %impl.elem2.loc53_44.3 (constants.%impl.elem2.f11)] -// CHECK:STDOUT: %bound_method.loc53_44.1: = bound_method %r.ref, %impl.elem2.loc53_44.1 -// CHECK:STDOUT: %Iterate.facet.loc53_44.1: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.711) [symbolic = %Iterate.facet.loc53_44.5 (constants.%Iterate.facet.04e)] -// CHECK:STDOUT: %.loc53_44.1: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc53_44.1 [symbolic = %Iterate.facet.loc53_44.5 (constants.%Iterate.facet.04e)] -// CHECK:STDOUT: %Iterate.facet.loc53_44.2: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.711) [symbolic = %Iterate.facet.loc53_44.5 (constants.%Iterate.facet.04e)] -// CHECK:STDOUT: %.loc53_44.2: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc53_44.2 [symbolic = %Iterate.facet.loc53_44.5 (constants.%Iterate.facet.04e)] -// CHECK:STDOUT: %specific_impl_fn.loc53_44.1: = specific_impl_function %impl.elem2.loc53_44.1, @Iterate.WithSelf.NewCursor(constants.%Iterate.facet.04e) [symbolic = %specific_impl_fn.loc53_44.4 (constants.%specific_impl_fn.d03)] -// CHECK:STDOUT: %bound_method.loc53_44.2: = bound_method %r.ref, %specific_impl_fn.loc53_44.1 +// CHECK:STDOUT: %r.ref: @TestIterate.%R.as_type.loc37_86.1 (%R.as_type) = name_ref r, %r +// CHECK:STDOUT: %impl.elem2.loc41_44.1: @TestIterate.%.loc41_44.20 (%.2577) = impl_witness_access constants.%Iterate.lookup_impl_witness.711, element2 [symbolic = %impl.elem2.loc41_44.3 (constants.%impl.elem2.f11)] +// CHECK:STDOUT: %bound_method.loc41_44.1: = bound_method %r.ref, %impl.elem2.loc41_44.1 +// CHECK:STDOUT: %Iterate.facet.loc41_44.1: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.711) [symbolic = %Iterate.facet.loc41_44.5 (constants.%Iterate.facet.04e)] +// CHECK:STDOUT: %.loc41_44.1: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc41_44.1 [symbolic = %Iterate.facet.loc41_44.5 (constants.%Iterate.facet.04e)] +// CHECK:STDOUT: %Iterate.facet.loc41_44.2: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.711) [symbolic = %Iterate.facet.loc41_44.5 (constants.%Iterate.facet.04e)] +// CHECK:STDOUT: %.loc41_44.2: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc41_44.2 [symbolic = %Iterate.facet.loc41_44.5 (constants.%Iterate.facet.04e)] +// CHECK:STDOUT: %specific_impl_fn.loc41_44.1: = specific_impl_function %impl.elem2.loc41_44.1, @Iterate.WithSelf.NewCursor(constants.%Iterate.facet.04e) [symbolic = %specific_impl_fn.loc41_44.4 (constants.%specific_impl_fn.d03)] +// CHECK:STDOUT: %bound_method.loc41_44.2: = bound_method %r.ref, %specific_impl_fn.loc41_44.1 // CHECK:STDOUT: %var: ref @TestIterate.%as_type (%as_type.b30) = var_storage invalid -// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.call: init @TestIterate.%as_type (%as_type.b30) to %var = call %bound_method.loc53_44.2(%r.ref) +// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.call: init @TestIterate.%as_type (%as_type.b30) to %var = call %bound_method.loc41_44.2(%r.ref) // CHECK:STDOUT: assign %var, %Iterate.WithSelf.NewCursor.call // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.next: -// CHECK:STDOUT: %impl.elem3.loc53_44.1: @TestIterate.%.loc53_44.21 (%.894) = impl_witness_access constants.%Iterate.lookup_impl_witness.711, element3 [symbolic = %impl.elem3.loc53_44.2 (constants.%impl.elem3.eed)] -// CHECK:STDOUT: %bound_method.loc53_44.3: = bound_method %r.ref, %impl.elem3.loc53_44.1 -// CHECK:STDOUT: %Iterate.facet.loc53_44.3: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.711) [symbolic = %Iterate.facet.loc53_44.5 (constants.%Iterate.facet.04e)] -// CHECK:STDOUT: %.loc53_44.3: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc53_44.3 [symbolic = %Iterate.facet.loc53_44.5 (constants.%Iterate.facet.04e)] -// CHECK:STDOUT: %Iterate.facet.loc53_44.4: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.711) [symbolic = %Iterate.facet.loc53_44.5 (constants.%Iterate.facet.04e)] -// CHECK:STDOUT: %.loc53_44.4: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc53_44.4 [symbolic = %Iterate.facet.loc53_44.5 (constants.%Iterate.facet.04e)] -// CHECK:STDOUT: %.loc53_44.5: %Destroy.type = converted constants.%as_type.b30, constants.%impl.elem1.0e0 [symbolic = %impl.elem1 (constants.%impl.elem1.0e0)] -// CHECK:STDOUT: %.loc53_44.6: %Destroy.type = converted constants.%as_type.b30, constants.%impl.elem1.0e0 [symbolic = %impl.elem1 (constants.%impl.elem1.0e0)] -// CHECK:STDOUT: %specific_impl_fn.loc53_44.2: = specific_impl_function %impl.elem3.loc53_44.1, @Iterate.WithSelf.Next(constants.%Iterate.facet.04e) [symbolic = %specific_impl_fn.loc53_44.5 (constants.%specific_impl_fn.303)] -// CHECK:STDOUT: %bound_method.loc53_44.4: = bound_method %r.ref, %specific_impl_fn.loc53_44.2 -// CHECK:STDOUT: %.loc53_44.7: ref %Optional.f5e = temporary_storage -// CHECK:STDOUT: %Iterate.WithSelf.Next.call: init %Optional.f5e to %.loc53_44.7 = call %bound_method.loc53_44.4(%r.ref, %var) -// CHECK:STDOUT: %.loc53_44.8: ref %Optional.f5e = temporary %.loc53_44.7, %Iterate.WithSelf.Next.call -// CHECK:STDOUT: %.loc53_44.9: %Optional.HasValue.type.a05 = specific_constant imports.%Core.import_ref.c82, @Optional(constants.%OptionalStorage.facet.c95) [concrete = constants.%Optional.HasValue.a9c] -// CHECK:STDOUT: %HasValue.ref: %Optional.HasValue.type.a05 = name_ref HasValue, %.loc53_44.9 [concrete = constants.%Optional.HasValue.a9c] -// CHECK:STDOUT: %Optional.HasValue.bound: = bound_method %.loc53_44.8, %HasValue.ref +// CHECK:STDOUT: %impl.elem3.loc41_44.1: @TestIterate.%.loc41_44.21 (%.894) = impl_witness_access constants.%Iterate.lookup_impl_witness.711, element3 [symbolic = %impl.elem3.loc41_44.2 (constants.%impl.elem3.eed)] +// CHECK:STDOUT: %bound_method.loc41_44.3: = bound_method %r.ref, %impl.elem3.loc41_44.1 +// CHECK:STDOUT: %Iterate.facet.loc41_44.3: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.711) [symbolic = %Iterate.facet.loc41_44.5 (constants.%Iterate.facet.04e)] +// CHECK:STDOUT: %.loc41_44.3: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc41_44.3 [symbolic = %Iterate.facet.loc41_44.5 (constants.%Iterate.facet.04e)] +// CHECK:STDOUT: %Iterate.facet.loc41_44.4: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.711) [symbolic = %Iterate.facet.loc41_44.5 (constants.%Iterate.facet.04e)] +// CHECK:STDOUT: %.loc41_44.4: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc41_44.4 [symbolic = %Iterate.facet.loc41_44.5 (constants.%Iterate.facet.04e)] +// CHECK:STDOUT: %.loc41_44.5: %Destroy.type = converted constants.%as_type.b30, constants.%impl.elem1.0e0 [symbolic = %impl.elem1 (constants.%impl.elem1.0e0)] +// CHECK:STDOUT: %.loc41_44.6: %Destroy.type = converted constants.%as_type.b30, constants.%impl.elem1.0e0 [symbolic = %impl.elem1 (constants.%impl.elem1.0e0)] +// CHECK:STDOUT: %specific_impl_fn.loc41_44.2: = specific_impl_function %impl.elem3.loc41_44.1, @Iterate.WithSelf.Next(constants.%Iterate.facet.04e) [symbolic = %specific_impl_fn.loc41_44.5 (constants.%specific_impl_fn.303)] +// CHECK:STDOUT: %bound_method.loc41_44.4: = bound_method %r.ref, %specific_impl_fn.loc41_44.2 +// CHECK:STDOUT: %.loc41_44.7: ref %Optional.f5e = temporary_storage +// CHECK:STDOUT: %Iterate.WithSelf.Next.call: init %Optional.f5e to %.loc41_44.7 = call %bound_method.loc41_44.4(%r.ref, %var) +// CHECK:STDOUT: %.loc41_44.8: ref %Optional.f5e = temporary %.loc41_44.7, %Iterate.WithSelf.Next.call +// CHECK:STDOUT: %.loc41_44.9: %Optional.HasValue.type.a05 = specific_constant imports.%Core.import_ref.c82, @Optional(constants.%OptionalStorage.facet.c95) [concrete = constants.%Optional.HasValue.a9c] +// CHECK:STDOUT: %HasValue.ref: %Optional.HasValue.type.a05 = name_ref HasValue, %.loc41_44.9 [concrete = constants.%Optional.HasValue.a9c] +// CHECK:STDOUT: %Optional.HasValue.bound: = bound_method %.loc41_44.8, %HasValue.ref // CHECK:STDOUT: %Optional.HasValue.specific_fn: = specific_function %HasValue.ref, @Optional.HasValue(constants.%OptionalStorage.facet.c95) [concrete = constants.%Optional.HasValue.specific_fn] -// CHECK:STDOUT: %bound_method.loc53_44.5: = bound_method %.loc53_44.8, %Optional.HasValue.specific_fn -// CHECK:STDOUT: %.loc53_44.10: %Optional.f5e = acquire_value %.loc53_44.8 -// CHECK:STDOUT: %Optional.HasValue.call: init bool = call %bound_method.loc53_44.5(%.loc53_44.10) -// CHECK:STDOUT: %.loc53_44.11: bool = value_of_initializer %Optional.HasValue.call -// CHECK:STDOUT: %.loc53_44.12: bool = converted %Optional.HasValue.call, %.loc53_44.11 -// CHECK:STDOUT: if %.loc53_44.12 br !for.body else br !for.done +// CHECK:STDOUT: %bound_method.loc41_44.5: = bound_method %.loc41_44.8, %Optional.HasValue.specific_fn +// CHECK:STDOUT: %.loc41_44.10: %Optional.f5e = acquire_value %.loc41_44.8 +// CHECK:STDOUT: %Optional.HasValue.call: init bool = call %bound_method.loc41_44.5(%.loc41_44.10) +// CHECK:STDOUT: %.loc41_44.11: bool = value_of_initializer %Optional.HasValue.call +// CHECK:STDOUT: %.loc41_44.12: bool = converted %Optional.HasValue.call, %.loc41_44.11 +// CHECK:STDOUT: if %.loc41_44.12 br !for.body else br !for.done // CHECK:STDOUT: // CHECK:STDOUT: !for.body: -// CHECK:STDOUT: %.loc53_44.13: %Optional.Get.type.476 = specific_constant imports.%Core.import_ref.29e, @Optional(constants.%OptionalStorage.facet.c95) [concrete = constants.%Optional.Get.60b] -// CHECK:STDOUT: %Get.ref: %Optional.Get.type.476 = name_ref Get, %.loc53_44.13 [concrete = constants.%Optional.Get.60b] -// CHECK:STDOUT: %Optional.Get.bound: = bound_method %.loc53_44.8, %Get.ref +// CHECK:STDOUT: %.loc41_44.13: %Optional.Get.type.476 = specific_constant imports.%Core.import_ref.29e, @Optional(constants.%OptionalStorage.facet.c95) [concrete = constants.%Optional.Get.60b] +// CHECK:STDOUT: %Get.ref: %Optional.Get.type.476 = name_ref Get, %.loc41_44.13 [concrete = constants.%Optional.Get.60b] +// CHECK:STDOUT: %Optional.Get.bound: = bound_method %.loc41_44.8, %Get.ref // CHECK:STDOUT: %Optional.Get.specific_fn: = specific_function %Get.ref, @Optional.Get(constants.%OptionalStorage.facet.c95) [concrete = constants.%Optional.Get.specific_fn] -// CHECK:STDOUT: %bound_method.loc53_44.6: = bound_method %.loc53_44.8, %Optional.Get.specific_fn -// CHECK:STDOUT: %.loc53_44.14: ref %ValueType = temporary_storage -// CHECK:STDOUT: %.loc53_44.15: %Optional.f5e = acquire_value %.loc53_44.8 -// CHECK:STDOUT: %Optional.Get.call: init %ValueType to %.loc53_44.14 = call %bound_method.loc53_44.6(%.loc53_44.15) -// CHECK:STDOUT: %.loc53_44.16: ref %ValueType = temporary %.loc53_44.14, %Optional.Get.call -// CHECK:STDOUT: %.loc53_44.17: %ValueType = acquire_value %.loc53_44.16 -// CHECK:STDOUT: %.loc53_29: type = splice_block %ValueType.ref.loc53 [concrete = constants.%ValueType] { -// CHECK:STDOUT: %Cpp.ref.loc53: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %DiffMutableADL.ref.loc53: = name_ref DiffMutableADL, imports.%DiffMutableADL [concrete = imports.%DiffMutableADL] -// CHECK:STDOUT: %ValueType.ref.loc53: type = name_ref ValueType, imports.%ValueType.decl [concrete = constants.%ValueType] +// CHECK:STDOUT: %bound_method.loc41_44.6: = bound_method %.loc41_44.8, %Optional.Get.specific_fn +// CHECK:STDOUT: %.loc41_44.14: ref %ValueType = temporary_storage +// CHECK:STDOUT: %.loc41_44.15: %Optional.f5e = acquire_value %.loc41_44.8 +// CHECK:STDOUT: %Optional.Get.call: init %ValueType to %.loc41_44.14 = call %bound_method.loc41_44.6(%.loc41_44.15) +// CHECK:STDOUT: %.loc41_44.16: ref %ValueType = temporary %.loc41_44.14, %Optional.Get.call +// CHECK:STDOUT: %.loc41_44.17: %ValueType = acquire_value %.loc41_44.16 +// CHECK:STDOUT: %.loc41_29: type = splice_block %ValueType.ref.loc41 [concrete = constants.%ValueType] { +// CHECK:STDOUT: %Cpp.ref.loc41: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %DiffMutableADL.ref.loc41: = name_ref DiffMutableADL, imports.%DiffMutableADL [concrete = imports.%DiffMutableADL] +// CHECK:STDOUT: %ValueType.ref.loc41: type = name_ref ValueType, imports.%ValueType.decl [concrete = constants.%ValueType] // CHECK:STDOUT: } -// CHECK:STDOUT: %i: %ValueType = wrapper_binding i, %.loc53_44.17 +// CHECK:STDOUT: %i: %ValueType = wrapper_binding i, %.loc41_44.17 // CHECK:STDOUT: %sum.ref: ref %ValueType = name_ref sum, %sum // CHECK:STDOUT: %i.ref: %ValueType = name_ref i, %i -// CHECK:STDOUT: %.loc54_12: ref %ValueType = value_as_ref %i.ref -// CHECK:STDOUT: %addr.loc54: %ptr.9c6 = addr_of %.loc54_12 -// CHECK:STDOUT: %.loc54_9.1: %ptr.5f4 = as_compatible %addr.loc54 -// CHECK:STDOUT: %.loc54_9.2: %ptr.5f4 = converted %addr.loc54, %.loc54_9.1 -// CHECK:STDOUT: %operator_PlusEqual__carbon_thunk.call: ref %ValueType = call imports.%operator_PlusEqual__carbon_thunk.decl(%sum.ref, %.loc54_9.2) -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc53_44.1: = bound_method %.loc53_44.16, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc53_44.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc53_44.1(%.loc53_44.16) -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc53_44.2: = bound_method %.loc53_44.8, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.8 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc53_44.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc53_44.2(%.loc53_44.8) +// CHECK:STDOUT: %.loc42_12: ref %ValueType = value_as_ref %i.ref +// CHECK:STDOUT: %addr.loc42: %ptr.9c6 = addr_of %.loc42_12 +// CHECK:STDOUT: %.loc42_9.1: %ptr.5f4 = as_compatible %addr.loc42 +// CHECK:STDOUT: %.loc42_9.2: %ptr.5f4 = converted %addr.loc42, %.loc42_9.1 +// CHECK:STDOUT: %operator_PlusEqual__carbon_thunk.call: ref %ValueType = call imports.%operator_PlusEqual__carbon_thunk.decl(%sum.ref, %.loc42_9.2) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc41_44.1: = bound_method %.loc41_44.16, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc41_44.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc41_44.1(%.loc41_44.16) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc41_44.2: = bound_method %.loc41_44.8, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.8 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc41_44.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc41_44.2(%.loc41_44.8) // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.done: -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc53_44.3: = bound_method %.loc53_44.8, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.8 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc53_44.3: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc53_44.3(%.loc53_44.8) -// CHECK:STDOUT: %impl.elem2.loc53_44.2: @TestIterate.%.loc53_44.22 (%.a44) = impl_witness_access constants.%Destroy.lookup_impl_witness.696, element2 [symbolic = %impl.elem2.loc53_44.4 (constants.%impl.elem2.1f1)] -// CHECK:STDOUT: %bound_method.loc53_44.7: = bound_method %var, %impl.elem2.loc53_44.2 -// CHECK:STDOUT: %.loc53_44.18: %Destroy.type = converted constants.%as_type.b30, constants.%impl.elem1.0e0 [symbolic = %impl.elem1 (constants.%impl.elem1.0e0)] -// CHECK:STDOUT: %.loc53_44.19: %Destroy.type = converted constants.%as_type.b30, constants.%impl.elem1.0e0 [symbolic = %impl.elem1 (constants.%impl.elem1.0e0)] -// CHECK:STDOUT: %specific_impl_fn.loc53_44.3: = specific_impl_function %impl.elem2.loc53_44.2, @Destroy.WithSelf.SelfDestruct.1(constants.%impl.elem1.0e0) [symbolic = %specific_impl_fn.loc53_44.6 (constants.%specific_impl_fn.cb8)] -// CHECK:STDOUT: %bound_method.loc53_44.8: = bound_method %var, %specific_impl_fn.loc53_44.3 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc53_44.4: init %empty_tuple.type = call %bound_method.loc53_44.8(%var) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc41_44.3: = bound_method %.loc41_44.8, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.8 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc41_44.3: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc41_44.3(%.loc41_44.8) +// CHECK:STDOUT: %impl.elem2.loc41_44.2: @TestIterate.%.loc41_44.22 (%.a44) = impl_witness_access constants.%Destroy.lookup_impl_witness.696, element2 [symbolic = %impl.elem2.loc41_44.4 (constants.%impl.elem2.1f1)] +// CHECK:STDOUT: %bound_method.loc41_44.7: = bound_method %var, %impl.elem2.loc41_44.2 +// CHECK:STDOUT: %.loc41_44.18: %Destroy.type = converted constants.%as_type.b30, constants.%impl.elem1.0e0 [symbolic = %impl.elem1 (constants.%impl.elem1.0e0)] +// CHECK:STDOUT: %.loc41_44.19: %Destroy.type = converted constants.%as_type.b30, constants.%impl.elem1.0e0 [symbolic = %impl.elem1 (constants.%impl.elem1.0e0)] +// CHECK:STDOUT: %specific_impl_fn.loc41_44.3: = specific_impl_function %impl.elem2.loc41_44.2, @Destroy.WithSelf.SelfDestruct.1(constants.%impl.elem1.0e0) [symbolic = %specific_impl_fn.loc41_44.6 (constants.%specific_impl_fn.cb8)] +// CHECK:STDOUT: %bound_method.loc41_44.8: = bound_method %var, %specific_impl_fn.loc41_44.3 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc41_44.4: init %empty_tuple.type = call %bound_method.loc41_44.8(%var) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc53_44.1(%self.param: ref %.dd1) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc41_44.1(%self.param: ref %.dd1) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc53_44.1(%self.param: ref %.dd1) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc41_44.1(%self.param: ref %.dd1) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc53_44.1(%self.param: ref %.dd1) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc41_44.1(%self.param: ref %.dd1) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.2(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.1(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc53_44.2(%self.param: ref %MaybeUnformed.65d) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc41_44.2(%self.param: ref %MaybeUnformed.65d) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc53_44.2(%self.param: ref %MaybeUnformed.65d) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc41_44.2(%self.param: ref %MaybeUnformed.65d) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc53_44.2(%self.param: ref %MaybeUnformed.65d) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc41_44.2(%self.param: ref %MaybeUnformed.65d) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.3(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.2(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc53_44.3(%self.param: ref bool) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc41_44.3(%self.param: ref bool) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc53_44.3(%self.param: ref bool) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc41_44.3(%self.param: ref bool) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc53_44.3(%self.param: ref bool) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc41_44.3(%self.param: ref bool) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.4(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.3(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc53_44.4(%self.param: ref %struct_type.value.has_value.afd) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc41_44.4(%self.param: ref %struct_type.value.has_value.afd) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc53_44.1: ref bool = struct_access %self.param, element1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc53_44.1: = bound_method %.loc53_44.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.5 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc53_44.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc53_44.1(%.loc53_44.1) -// CHECK:STDOUT: %.loc53_44.2: ref %MaybeUnformed.65d = struct_access %self.param, element0 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc53_44.2: = bound_method %.loc53_44.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.4 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc53_44.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc53_44.2(%.loc53_44.2) +// CHECK:STDOUT: %.loc41_44.1: ref bool = struct_access %self.param, element1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc41_44.1: = bound_method %.loc41_44.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.5 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc41_44.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc41_44.1(%.loc41_44.1) +// CHECK:STDOUT: %.loc41_44.2: ref %MaybeUnformed.65d = struct_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc41_44.2: = bound_method %.loc41_44.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.4 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc41_44.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc41_44.2(%.loc41_44.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc53_44.4(%self.param: ref %struct_type.value.has_value.afd) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc41_44.4(%self.param: ref %struct_type.value.has_value.afd) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc53_44.4(%self.param: ref %struct_type.value.has_value.afd) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc41_44.4(%self.param: ref %struct_type.value.has_value.afd) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.5(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.4(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc53_44.5(%self.param: ref %DefaultOptionalStorage.f08) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc41_44.5(%self.param: ref %DefaultOptionalStorage.f08) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %has_value.ref: %DefaultOptionalStorage.elem.9e9 = name_ref has_value, imports.%Core.import_ref.e86 [concrete = imports.%field_decl.390] -// CHECK:STDOUT: %.loc53_44.1: ref bool = class_element_access %self.param, element1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc53_44.1: = bound_method %.loc53_44.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.5 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc53_44.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc53_44.1(%.loc53_44.1) +// CHECK:STDOUT: %.loc41_44.1: ref bool = class_element_access %self.param, element1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc41_44.1: = bound_method %.loc41_44.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.5 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc41_44.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc41_44.1(%.loc41_44.1) // CHECK:STDOUT: %value.ref: %DefaultOptionalStorage.elem.28f = name_ref value, imports.%Core.import_ref.373 [concrete = imports.%field_decl.498] -// CHECK:STDOUT: %.loc53_44.2: ref %MaybeUnformed.65d = class_element_access %self.param, element0 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc53_44.2: = bound_method %.loc53_44.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.4 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc53_44.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc53_44.2(%.loc53_44.2) +// CHECK:STDOUT: %.loc41_44.2: ref %MaybeUnformed.65d = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc41_44.2: = bound_method %.loc41_44.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.4 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc41_44.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc41_44.2(%.loc41_44.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc53_44.5(%self.param: ref %DefaultOptionalStorage.f08) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc41_44.5(%self.param: ref %DefaultOptionalStorage.f08) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc53_44.5(%self.param: ref %DefaultOptionalStorage.f08) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc41_44.5(%self.param: ref %DefaultOptionalStorage.f08) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.6(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.5(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc53_44.6(%self.param: ref %Optional.f5e) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc41_44.6(%self.param: ref %Optional.f5e) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc53_44.6(%self.param: ref %Optional.f5e) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc41_44.6(%self.param: ref %Optional.f5e) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc53_44.6(%self.param: ref %Optional.f5e) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc41_44.6(%self.param: ref %Optional.f5e) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.7(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.6(%self.param) @@ -5538,10 +5416,10 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: // CHECK:STDOUT: !for.body: // CHECK:STDOUT: %Get.ref: = name_ref Get, [concrete = ] -// CHECK:STDOUT: %.loc85: type = splice_block %ValueType.ref.loc85 [concrete = constants.%ValueType] { -// CHECK:STDOUT: %Cpp.ref.loc85: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %DiffMutableADL.ref.loc85: = name_ref DiffMutableADL, imports.%DiffMutableADL [concrete = imports.%DiffMutableADL] -// CHECK:STDOUT: %ValueType.ref.loc85: type = name_ref ValueType, imports.%ValueType.decl [concrete = constants.%ValueType] +// CHECK:STDOUT: %.loc63: type = splice_block %ValueType.ref.loc63 [concrete = constants.%ValueType] { +// CHECK:STDOUT: %Cpp.ref.loc63: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %DiffMutableADL.ref.loc63: = name_ref DiffMutableADL, imports.%DiffMutableADL [concrete = imports.%DiffMutableADL] +// CHECK:STDOUT: %ValueType.ref.loc63: type = name_ref ValueType, imports.%ValueType.decl [concrete = constants.%ValueType] // CHECK:STDOUT: } // CHECK:STDOUT: %i: %ValueType = wrapper_binding i, [concrete = ] // CHECK:STDOUT: %sum.ref: ref %ValueType = name_ref sum, %sum @@ -5553,12 +5431,12 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @TestIterate(constants.%R) { -// CHECK:STDOUT: %R.patt.loc49_17.2 => constants.%R.patt -// CHECK:STDOUT: %R.loc49_17.1 => constants.%R -// CHECK:STDOUT: %R.as_type.loc49_86.1 => constants.%R.as_type +// CHECK:STDOUT: %R.patt.loc37_17.2 => constants.%R.patt +// CHECK:STDOUT: %R.loc37_17.1 => constants.%R +// CHECK:STDOUT: %R.as_type.loc37_86.1 => constants.%R.as_type // CHECK:STDOUT: %pattern_type => constants.%pattern_type.0bc -// CHECK:STDOUT: %r.param_patt.loc49_84.2 => constants.%r.param_patt -// CHECK:STDOUT: %r.patt.loc49_84.2 => constants.%r.patt +// CHECK:STDOUT: %r.param_patt.loc37_84.2 => constants.%r.param_patt +// CHECK:STDOUT: %r.patt.loc37_84.2 => constants.%r.patt // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_todo_adl_overloads.carbon @@ -5620,9 +5498,9 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type.357: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: %pattern_type.e09: type = pattern_type %ValueType [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc56 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc44 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.2: %Destroy.WithSelf.Op.type.ef016f.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc56 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc44 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.2: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2 = struct_value () [concrete] // CHECK:STDOUT: %ValueType.SubobjectDestroy.type: type = fn_type @ValueType.SubobjectDestroy [concrete] // CHECK:STDOUT: %ValueType.SubobjectDestroy: %ValueType.SubobjectDestroy.type = struct_value () [concrete] @@ -5679,48 +5557,48 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %pattern_type.60e: type = pattern_type %.8f3 [concrete] // CHECK:STDOUT: %self.param_patt.61b3: %pattern_type.60e = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.ecc: %pattern_type.60e = wrapper_binding_pattern self, %self.param_patt.61b3 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc60_41.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc48_41.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc60_41.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc48_41.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.3: %Destroy.WithSelf.Op.type.ef016f.3 = struct_value () [concrete] // CHECK:STDOUT: %pattern_type.a8c: type = pattern_type %MaybeUnformed.e45 [concrete] // CHECK:STDOUT: %self.param_patt.6bf: %pattern_type.a8c = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.3f7: %pattern_type.a8c = wrapper_binding_pattern self, %self.param_patt.6bf [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc60_41.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc48_41.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.4: type = fn_type @Destroy.WithSelf.Op.loc60_41.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.4: type = fn_type @Destroy.WithSelf.Op.loc48_41.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.4: %Destroy.WithSelf.Op.type.ef016f.4 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.4: type = fn_type @Destroy.WithSelf.SelfDestruct.loc60_41.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.4: type = fn_type @Destroy.WithSelf.SelfDestruct.loc48_41.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.4: %Destroy.WithSelf.SelfDestruct.type.fbceb5.4 = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.40d: %pattern_type.831 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.560: %pattern_type.831 = wrapper_binding_pattern self, %self.param_patt.40d [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc60_41.3 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc48_41.3 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.4: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.5: type = fn_type @Destroy.WithSelf.Op.loc60_41.3 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.5: type = fn_type @Destroy.WithSelf.Op.loc48_41.3 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.5: %Destroy.WithSelf.Op.type.ef016f.5 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.5: type = fn_type @Destroy.WithSelf.SelfDestruct.loc60_41.3 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.5: type = fn_type @Destroy.WithSelf.SelfDestruct.loc48_41.3 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.5: %Destroy.WithSelf.SelfDestruct.type.fbceb5.5 = struct_value () [concrete] // CHECK:STDOUT: %pattern_type.14e: type = pattern_type %struct_type.value.has_value.70e [concrete] // CHECK:STDOUT: %self.param_patt.2f9: %pattern_type.14e = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.204: %pattern_type.14e = wrapper_binding_pattern self, %self.param_patt.2f9 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.5: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc60_41.4 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.5: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc48_41.4 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.5: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.5 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.6: type = fn_type @Destroy.WithSelf.Op.loc60_41.4 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.6: type = fn_type @Destroy.WithSelf.Op.loc48_41.4 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.6: %Destroy.WithSelf.Op.type.ef016f.6 = struct_value () [concrete] // CHECK:STDOUT: %pattern_type.474: type = pattern_type %DefaultOptionalStorage.8dd [concrete] // CHECK:STDOUT: %self.param_patt.8b7: %pattern_type.474 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.5be: %pattern_type.474 = wrapper_binding_pattern self, %self.param_patt.8b7 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.6: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc60_41.5 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.6: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc48_41.5 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.6: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.6 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.7: type = fn_type @Destroy.WithSelf.Op.loc60_41.5 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.7: type = fn_type @Destroy.WithSelf.Op.loc48_41.5 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.7: %Destroy.WithSelf.Op.type.ef016f.7 = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.8ac: %pattern_type.d0f = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.25e: %pattern_type.d0f = wrapper_binding_pattern self, %self.param_patt.8ac [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.7: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc60_41.6 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.7: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc48_41.6 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.7: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.7 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.8: type = fn_type @Destroy.WithSelf.Op.loc60_41.6 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.8: type = fn_type @Destroy.WithSelf.Op.loc48_41.6 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.8: %Destroy.WithSelf.Op.type.ef016f.8 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.8: type = fn_type @Destroy.WithSelf.SelfDestruct.loc60_41.6 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.8: type = fn_type @Destroy.WithSelf.SelfDestruct.loc48_41.6 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.8: %Destroy.WithSelf.SelfDestruct.type.fbceb5.8 = struct_value () [concrete] // CHECK:STDOUT: %Destroy.lookup_impl_witness.eb0: = lookup_impl_witness %impl.elem1.751, @Destroy [symbolic] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.4ed: type = fn_type @Destroy.WithSelf.SelfDestruct.1, @Destroy.WithSelf(%impl.elem1.751) [symbolic] @@ -5735,9 +5613,9 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %End.type: type = fn_type @End [concrete] // CHECK:STDOUT: %End: %End.type = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.660: = custom_witness (%Iterator, %Iterator, %Begin, %End), @CppRangeForIterate [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.9: type = fn_type @Destroy.WithSelf.Op.loc67 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.9: type = fn_type @Destroy.WithSelf.Op.loc55 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.9: %Destroy.WithSelf.Op.type.ef016f.9 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.9: type = fn_type @Destroy.WithSelf.SelfDestruct.loc67 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.9: type = fn_type @Destroy.WithSelf.SelfDestruct.loc55 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.9: %Destroy.WithSelf.SelfDestruct.type.fbceb5.9 = struct_value () [concrete] // CHECK:STDOUT: %Iterator.SubobjectDestroy.type: type = fn_type @Iterator.SubobjectDestroy [concrete] // CHECK:STDOUT: %Iterator.SubobjectDestroy: %Iterator.SubobjectDestroy.type = struct_value () [concrete] @@ -5823,84 +5701,84 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc60_41.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc48_41.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.60e = ref_param_pattern [concrete = constants.%self.param_patt.61b3] // CHECK:STDOUT: %self.patt: %pattern_type.60e = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.ecc] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %.8f3 = ref_param call_param0 // CHECK:STDOUT: %self: ref %.8f3 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc60_41.1 [concrete = constants.%Destroy.WithSelf.Op.403171.3] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc48_41.1 [concrete = constants.%Destroy.WithSelf.Op.403171.3] { // CHECK:STDOUT: %self.param_patt: %pattern_type.60e = ref_param_pattern [concrete = constants.%self.param_patt.61b3] // CHECK:STDOUT: %self.patt: %pattern_type.60e = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.ecc] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %.8f3 = ref_param call_param0 // CHECK:STDOUT: %self: ref %.8f3 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc60_41.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.3] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc48_41.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.3] { // CHECK:STDOUT: %self.param_patt: %pattern_type.a8c = ref_param_pattern [concrete = constants.%self.param_patt.6bf] // CHECK:STDOUT: %self.patt: %pattern_type.a8c = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.3f7] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %MaybeUnformed.e45 = ref_param call_param0 // CHECK:STDOUT: %self: ref %MaybeUnformed.e45 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.3: %Destroy.WithSelf.Op.type.ef016f.4 = fn_decl @Destroy.WithSelf.Op.loc60_41.2 [concrete = constants.%Destroy.WithSelf.Op.403171.4] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.3: %Destroy.WithSelf.Op.type.ef016f.4 = fn_decl @Destroy.WithSelf.Op.loc48_41.2 [concrete = constants.%Destroy.WithSelf.Op.403171.4] { // CHECK:STDOUT: %self.param_patt: %pattern_type.a8c = ref_param_pattern [concrete = constants.%self.param_patt.6bf] // CHECK:STDOUT: %self.patt: %pattern_type.a8c = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.3f7] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %MaybeUnformed.e45 = ref_param call_param0 // CHECK:STDOUT: %self: ref %MaybeUnformed.e45 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc60_41.3 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.4] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc48_41.3 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.4] { // CHECK:STDOUT: %self.param_patt: %pattern_type.831 = ref_param_pattern [concrete = constants.%self.param_patt.40d] // CHECK:STDOUT: %self.patt: %pattern_type.831 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.560] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref bool = ref_param call_param0 // CHECK:STDOUT: %self: ref bool = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.4: %Destroy.WithSelf.Op.type.ef016f.5 = fn_decl @Destroy.WithSelf.Op.loc60_41.3 [concrete = constants.%Destroy.WithSelf.Op.403171.5] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.4: %Destroy.WithSelf.Op.type.ef016f.5 = fn_decl @Destroy.WithSelf.Op.loc48_41.3 [concrete = constants.%Destroy.WithSelf.Op.403171.5] { // CHECK:STDOUT: %self.param_patt: %pattern_type.831 = ref_param_pattern [concrete = constants.%self.param_patt.40d] // CHECK:STDOUT: %self.patt: %pattern_type.831 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.560] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref bool = ref_param call_param0 // CHECK:STDOUT: %self: ref bool = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.4: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.5 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc60_41.4 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.5] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.4: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.5 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc48_41.4 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.5] { // CHECK:STDOUT: %self.param_patt: %pattern_type.14e = ref_param_pattern [concrete = constants.%self.param_patt.2f9] // CHECK:STDOUT: %self.patt: %pattern_type.14e = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.204] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %struct_type.value.has_value.70e = ref_param call_param0 // CHECK:STDOUT: %self: ref %struct_type.value.has_value.70e = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.5: %Destroy.WithSelf.Op.type.ef016f.6 = fn_decl @Destroy.WithSelf.Op.loc60_41.4 [concrete = constants.%Destroy.WithSelf.Op.403171.6] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.5: %Destroy.WithSelf.Op.type.ef016f.6 = fn_decl @Destroy.WithSelf.Op.loc48_41.4 [concrete = constants.%Destroy.WithSelf.Op.403171.6] { // CHECK:STDOUT: %self.param_patt: %pattern_type.14e = ref_param_pattern [concrete = constants.%self.param_patt.2f9] // CHECK:STDOUT: %self.patt: %pattern_type.14e = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.204] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %struct_type.value.has_value.70e = ref_param call_param0 // CHECK:STDOUT: %self: ref %struct_type.value.has_value.70e = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.5: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.6 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc60_41.5 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.6] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.5: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.6 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc48_41.5 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.6] { // CHECK:STDOUT: %self.param_patt: %pattern_type.474 = ref_param_pattern [concrete = constants.%self.param_patt.8b7] // CHECK:STDOUT: %self.patt: %pattern_type.474 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.5be] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %DefaultOptionalStorage.8dd = ref_param call_param0 // CHECK:STDOUT: %self: ref %DefaultOptionalStorage.8dd = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.6: %Destroy.WithSelf.Op.type.ef016f.7 = fn_decl @Destroy.WithSelf.Op.loc60_41.5 [concrete = constants.%Destroy.WithSelf.Op.403171.7] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.6: %Destroy.WithSelf.Op.type.ef016f.7 = fn_decl @Destroy.WithSelf.Op.loc48_41.5 [concrete = constants.%Destroy.WithSelf.Op.403171.7] { // CHECK:STDOUT: %self.param_patt: %pattern_type.474 = ref_param_pattern [concrete = constants.%self.param_patt.8b7] // CHECK:STDOUT: %self.patt: %pattern_type.474 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.5be] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %DefaultOptionalStorage.8dd = ref_param call_param0 // CHECK:STDOUT: %self: ref %DefaultOptionalStorage.8dd = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.6: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.7 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc60_41.6 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.7] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.6: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.7 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc48_41.6 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.7] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d0f = ref_param_pattern [concrete = constants.%self.param_patt.8ac] // CHECK:STDOUT: %self.patt: %pattern_type.d0f = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.25e] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %Optional.006 = ref_param call_param0 // CHECK:STDOUT: %self: ref %Optional.006 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.7: %Destroy.WithSelf.Op.type.ef016f.8 = fn_decl @Destroy.WithSelf.Op.loc60_41.6 [concrete = constants.%Destroy.WithSelf.Op.403171.8] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.7: %Destroy.WithSelf.Op.type.ef016f.8 = fn_decl @Destroy.WithSelf.Op.loc48_41.6 [concrete = constants.%Destroy.WithSelf.Op.403171.8] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d0f = ref_param_pattern [concrete = constants.%self.param_patt.8ac] // CHECK:STDOUT: %self.patt: %pattern_type.d0f = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.25e] // CHECK:STDOUT: } { @@ -5909,200 +5787,200 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @TestIterate(%R.loc56_17.2: %Iterate_where.type.8b0) { +// CHECK:STDOUT: generic fn @TestIterate(%R.loc44_17.2: %Iterate_where.type.8b0) { // CHECK:STDOUT: // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: %Iterate.lookup_impl_witness: = lookup_impl_witness %R.loc56_17.1, @Iterate [symbolic = %Iterate.lookup_impl_witness (constants.%Iterate.lookup_impl_witness.a99)] -// CHECK:STDOUT: %Iterate.facet.loc60_41.5: %Iterate.type = facet_value %R.as_type.loc56_83.1, (%Iterate.lookup_impl_witness) [symbolic = %Iterate.facet.loc60_41.5 (constants.%Iterate.facet.c55)] -// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type: type = fn_type @Iterate.WithSelf.NewCursor, @Iterate.WithSelf(%Iterate.facet.loc60_41.5) [symbolic = %Iterate.WithSelf.NewCursor.type (constants.%Iterate.WithSelf.NewCursor.type.fb9)] -// CHECK:STDOUT: %.loc60_41.20: type = fn_type_with_self_type %Iterate.WithSelf.NewCursor.type, %Iterate.facet.loc60_41.5 [symbolic = %.loc60_41.20 (constants.%.54f)] -// CHECK:STDOUT: %impl.elem2.loc60_41.3: @TestIterate.%.loc60_41.20 (%.54f) = impl_witness_access %Iterate.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc60_41.3 (constants.%impl.elem2.ff2)] -// CHECK:STDOUT: %specific_impl_fn.loc60_41.4: = specific_impl_function %impl.elem2.loc60_41.3, @Iterate.WithSelf.NewCursor(%Iterate.facet.loc60_41.5) [symbolic = %specific_impl_fn.loc60_41.4 (constants.%specific_impl_fn.541)] +// CHECK:STDOUT: %Iterate.lookup_impl_witness: = lookup_impl_witness %R.loc44_17.1, @Iterate [symbolic = %Iterate.lookup_impl_witness (constants.%Iterate.lookup_impl_witness.a99)] +// CHECK:STDOUT: %Iterate.facet.loc48_41.5: %Iterate.type = facet_value %R.as_type.loc44_83.1, (%Iterate.lookup_impl_witness) [symbolic = %Iterate.facet.loc48_41.5 (constants.%Iterate.facet.c55)] +// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type: type = fn_type @Iterate.WithSelf.NewCursor, @Iterate.WithSelf(%Iterate.facet.loc48_41.5) [symbolic = %Iterate.WithSelf.NewCursor.type (constants.%Iterate.WithSelf.NewCursor.type.fb9)] +// CHECK:STDOUT: %.loc48_41.20: type = fn_type_with_self_type %Iterate.WithSelf.NewCursor.type, %Iterate.facet.loc48_41.5 [symbolic = %.loc48_41.20 (constants.%.54f)] +// CHECK:STDOUT: %impl.elem2.loc48_41.3: @TestIterate.%.loc48_41.20 (%.54f) = impl_witness_access %Iterate.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc48_41.3 (constants.%impl.elem2.ff2)] +// CHECK:STDOUT: %specific_impl_fn.loc48_41.4: = specific_impl_function %impl.elem2.loc48_41.3, @Iterate.WithSelf.NewCursor(%Iterate.facet.loc48_41.5) [symbolic = %specific_impl_fn.loc48_41.4 (constants.%specific_impl_fn.541)] // CHECK:STDOUT: -// CHECK:STDOUT: %Iterate.WithSelf.Next.type: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.loc60_41.5) [symbolic = %Iterate.WithSelf.Next.type (constants.%Iterate.WithSelf.Next.type.5d8)] -// CHECK:STDOUT: %.loc60_41.21: type = fn_type_with_self_type %Iterate.WithSelf.Next.type, %Iterate.facet.loc60_41.5 [symbolic = %.loc60_41.21 (constants.%.216)] -// CHECK:STDOUT: %impl.elem3.loc60_41.2: @TestIterate.%.loc60_41.21 (%.216) = impl_witness_access %Iterate.lookup_impl_witness, element3 [symbolic = %impl.elem3.loc60_41.2 (constants.%impl.elem3.5f1)] -// CHECK:STDOUT: %specific_impl_fn.loc60_41.5: = specific_impl_function %impl.elem3.loc60_41.2, @Iterate.WithSelf.Next(%Iterate.facet.loc60_41.5) [symbolic = %specific_impl_fn.loc60_41.5 (constants.%specific_impl_fn.eaf)] +// CHECK:STDOUT: %Iterate.WithSelf.Next.type: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.loc48_41.5) [symbolic = %Iterate.WithSelf.Next.type (constants.%Iterate.WithSelf.Next.type.5d8)] +// CHECK:STDOUT: %.loc48_41.21: type = fn_type_with_self_type %Iterate.WithSelf.Next.type, %Iterate.facet.loc48_41.5 [symbolic = %.loc48_41.21 (constants.%.216)] +// CHECK:STDOUT: %impl.elem3.loc48_41.2: @TestIterate.%.loc48_41.21 (%.216) = impl_witness_access %Iterate.lookup_impl_witness, element3 [symbolic = %impl.elem3.loc48_41.2 (constants.%impl.elem3.5f1)] +// CHECK:STDOUT: %specific_impl_fn.loc48_41.5: = specific_impl_function %impl.elem3.loc48_41.2, @Iterate.WithSelf.Next(%Iterate.facet.loc48_41.5) [symbolic = %specific_impl_fn.loc48_41.5 (constants.%specific_impl_fn.eaf)] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type: type = fn_type @Destroy.WithSelf.SelfDestruct.1, @Destroy.WithSelf(%impl.elem1) [symbolic = %Destroy.WithSelf.SelfDestruct.type (constants.%Destroy.WithSelf.SelfDestruct.type.4ed)] -// CHECK:STDOUT: %.loc60_41.22: type = fn_type_with_self_type %Destroy.WithSelf.SelfDestruct.type, %impl.elem1 [symbolic = %.loc60_41.22 (constants.%.97d)] +// CHECK:STDOUT: %.loc48_41.22: type = fn_type_with_self_type %Destroy.WithSelf.SelfDestruct.type, %impl.elem1 [symbolic = %.loc48_41.22 (constants.%.97d)] // CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %impl.elem1, @Destroy [symbolic = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness.eb0)] -// CHECK:STDOUT: %impl.elem2.loc60_41.4: @TestIterate.%.loc60_41.22 (%.97d) = impl_witness_access %Destroy.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc60_41.4 (constants.%impl.elem2.f7b)] -// CHECK:STDOUT: %specific_impl_fn.loc60_41.6: = specific_impl_function %impl.elem2.loc60_41.4, @Destroy.WithSelf.SelfDestruct.1(%impl.elem1) [symbolic = %specific_impl_fn.loc60_41.6 (constants.%specific_impl_fn.577)] +// CHECK:STDOUT: %impl.elem2.loc48_41.4: @TestIterate.%.loc48_41.22 (%.97d) = impl_witness_access %Destroy.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc48_41.4 (constants.%impl.elem2.f7b)] +// CHECK:STDOUT: %specific_impl_fn.loc48_41.6: = specific_impl_function %impl.elem2.loc48_41.4, @Destroy.WithSelf.SelfDestruct.1(%impl.elem1) [symbolic = %specific_impl_fn.loc48_41.6 (constants.%specific_impl_fn.577)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%r.param: @TestIterate.%R.as_type.loc56_83.1 (%R.as_type)) { +// CHECK:STDOUT: fn(%r.param: @TestIterate.%R.as_type.loc44_83.1 (%R.as_type)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %i.patt: %pattern_type.e09 = value_binding_pattern i [concrete = constants.%i.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %r.ref: @TestIterate.%R.as_type.loc56_83.1 (%R.as_type) = name_ref r, %r -// CHECK:STDOUT: %impl.elem2.loc60_41.1: @TestIterate.%.loc60_41.20 (%.54f) = impl_witness_access constants.%Iterate.lookup_impl_witness.a99, element2 [symbolic = %impl.elem2.loc60_41.3 (constants.%impl.elem2.ff2)] -// CHECK:STDOUT: %bound_method.loc60_41.1: = bound_method %r.ref, %impl.elem2.loc60_41.1 -// CHECK:STDOUT: %Iterate.facet.loc60_41.1: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.a99) [symbolic = %Iterate.facet.loc60_41.5 (constants.%Iterate.facet.c55)] -// CHECK:STDOUT: %.loc60_41.1: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc60_41.1 [symbolic = %Iterate.facet.loc60_41.5 (constants.%Iterate.facet.c55)] -// CHECK:STDOUT: %Iterate.facet.loc60_41.2: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.a99) [symbolic = %Iterate.facet.loc60_41.5 (constants.%Iterate.facet.c55)] -// CHECK:STDOUT: %.loc60_41.2: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc60_41.2 [symbolic = %Iterate.facet.loc60_41.5 (constants.%Iterate.facet.c55)] -// CHECK:STDOUT: %specific_impl_fn.loc60_41.1: = specific_impl_function %impl.elem2.loc60_41.1, @Iterate.WithSelf.NewCursor(constants.%Iterate.facet.c55) [symbolic = %specific_impl_fn.loc60_41.4 (constants.%specific_impl_fn.541)] -// CHECK:STDOUT: %bound_method.loc60_41.2: = bound_method %r.ref, %specific_impl_fn.loc60_41.1 +// CHECK:STDOUT: %r.ref: @TestIterate.%R.as_type.loc44_83.1 (%R.as_type) = name_ref r, %r +// CHECK:STDOUT: %impl.elem2.loc48_41.1: @TestIterate.%.loc48_41.20 (%.54f) = impl_witness_access constants.%Iterate.lookup_impl_witness.a99, element2 [symbolic = %impl.elem2.loc48_41.3 (constants.%impl.elem2.ff2)] +// CHECK:STDOUT: %bound_method.loc48_41.1: = bound_method %r.ref, %impl.elem2.loc48_41.1 +// CHECK:STDOUT: %Iterate.facet.loc48_41.1: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.a99) [symbolic = %Iterate.facet.loc48_41.5 (constants.%Iterate.facet.c55)] +// CHECK:STDOUT: %.loc48_41.1: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc48_41.1 [symbolic = %Iterate.facet.loc48_41.5 (constants.%Iterate.facet.c55)] +// CHECK:STDOUT: %Iterate.facet.loc48_41.2: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.a99) [symbolic = %Iterate.facet.loc48_41.5 (constants.%Iterate.facet.c55)] +// CHECK:STDOUT: %.loc48_41.2: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc48_41.2 [symbolic = %Iterate.facet.loc48_41.5 (constants.%Iterate.facet.c55)] +// CHECK:STDOUT: %specific_impl_fn.loc48_41.1: = specific_impl_function %impl.elem2.loc48_41.1, @Iterate.WithSelf.NewCursor(constants.%Iterate.facet.c55) [symbolic = %specific_impl_fn.loc48_41.4 (constants.%specific_impl_fn.541)] +// CHECK:STDOUT: %bound_method.loc48_41.2: = bound_method %r.ref, %specific_impl_fn.loc48_41.1 // CHECK:STDOUT: %var: ref @TestIterate.%as_type (%as_type.733) = var_storage invalid -// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.call: init @TestIterate.%as_type (%as_type.733) to %var = call %bound_method.loc60_41.2(%r.ref) +// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.call: init @TestIterate.%as_type (%as_type.733) to %var = call %bound_method.loc48_41.2(%r.ref) // CHECK:STDOUT: assign %var, %Iterate.WithSelf.NewCursor.call // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.next: -// CHECK:STDOUT: %impl.elem3.loc60_41.1: @TestIterate.%.loc60_41.21 (%.216) = impl_witness_access constants.%Iterate.lookup_impl_witness.a99, element3 [symbolic = %impl.elem3.loc60_41.2 (constants.%impl.elem3.5f1)] -// CHECK:STDOUT: %bound_method.loc60_41.3: = bound_method %r.ref, %impl.elem3.loc60_41.1 -// CHECK:STDOUT: %Iterate.facet.loc60_41.3: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.a99) [symbolic = %Iterate.facet.loc60_41.5 (constants.%Iterate.facet.c55)] -// CHECK:STDOUT: %.loc60_41.3: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc60_41.3 [symbolic = %Iterate.facet.loc60_41.5 (constants.%Iterate.facet.c55)] -// CHECK:STDOUT: %Iterate.facet.loc60_41.4: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.a99) [symbolic = %Iterate.facet.loc60_41.5 (constants.%Iterate.facet.c55)] -// CHECK:STDOUT: %.loc60_41.4: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc60_41.4 [symbolic = %Iterate.facet.loc60_41.5 (constants.%Iterate.facet.c55)] -// CHECK:STDOUT: %.loc60_41.5: %Destroy.type = converted constants.%as_type.733, constants.%impl.elem1.751 [symbolic = %impl.elem1 (constants.%impl.elem1.751)] -// CHECK:STDOUT: %.loc60_41.6: %Destroy.type = converted constants.%as_type.733, constants.%impl.elem1.751 [symbolic = %impl.elem1 (constants.%impl.elem1.751)] -// CHECK:STDOUT: %specific_impl_fn.loc60_41.2: = specific_impl_function %impl.elem3.loc60_41.1, @Iterate.WithSelf.Next(constants.%Iterate.facet.c55) [symbolic = %specific_impl_fn.loc60_41.5 (constants.%specific_impl_fn.eaf)] -// CHECK:STDOUT: %bound_method.loc60_41.4: = bound_method %r.ref, %specific_impl_fn.loc60_41.2 -// CHECK:STDOUT: %.loc60_41.7: ref %Optional.006 = temporary_storage -// CHECK:STDOUT: %Iterate.WithSelf.Next.call: init %Optional.006 to %.loc60_41.7 = call %bound_method.loc60_41.4(%r.ref, %var) -// CHECK:STDOUT: %.loc60_41.8: ref %Optional.006 = temporary %.loc60_41.7, %Iterate.WithSelf.Next.call -// CHECK:STDOUT: %.loc60_41.9: %Optional.HasValue.type.06b = specific_constant imports.%Core.import_ref.c82, @Optional(constants.%OptionalStorage.facet.adc) [concrete = constants.%Optional.HasValue.994] -// CHECK:STDOUT: %HasValue.ref: %Optional.HasValue.type.06b = name_ref HasValue, %.loc60_41.9 [concrete = constants.%Optional.HasValue.994] -// CHECK:STDOUT: %Optional.HasValue.bound: = bound_method %.loc60_41.8, %HasValue.ref +// CHECK:STDOUT: %impl.elem3.loc48_41.1: @TestIterate.%.loc48_41.21 (%.216) = impl_witness_access constants.%Iterate.lookup_impl_witness.a99, element3 [symbolic = %impl.elem3.loc48_41.2 (constants.%impl.elem3.5f1)] +// CHECK:STDOUT: %bound_method.loc48_41.3: = bound_method %r.ref, %impl.elem3.loc48_41.1 +// CHECK:STDOUT: %Iterate.facet.loc48_41.3: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.a99) [symbolic = %Iterate.facet.loc48_41.5 (constants.%Iterate.facet.c55)] +// CHECK:STDOUT: %.loc48_41.3: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc48_41.3 [symbolic = %Iterate.facet.loc48_41.5 (constants.%Iterate.facet.c55)] +// CHECK:STDOUT: %Iterate.facet.loc48_41.4: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.a99) [symbolic = %Iterate.facet.loc48_41.5 (constants.%Iterate.facet.c55)] +// CHECK:STDOUT: %.loc48_41.4: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc48_41.4 [symbolic = %Iterate.facet.loc48_41.5 (constants.%Iterate.facet.c55)] +// CHECK:STDOUT: %.loc48_41.5: %Destroy.type = converted constants.%as_type.733, constants.%impl.elem1.751 [symbolic = %impl.elem1 (constants.%impl.elem1.751)] +// CHECK:STDOUT: %.loc48_41.6: %Destroy.type = converted constants.%as_type.733, constants.%impl.elem1.751 [symbolic = %impl.elem1 (constants.%impl.elem1.751)] +// CHECK:STDOUT: %specific_impl_fn.loc48_41.2: = specific_impl_function %impl.elem3.loc48_41.1, @Iterate.WithSelf.Next(constants.%Iterate.facet.c55) [symbolic = %specific_impl_fn.loc48_41.5 (constants.%specific_impl_fn.eaf)] +// CHECK:STDOUT: %bound_method.loc48_41.4: = bound_method %r.ref, %specific_impl_fn.loc48_41.2 +// CHECK:STDOUT: %.loc48_41.7: ref %Optional.006 = temporary_storage +// CHECK:STDOUT: %Iterate.WithSelf.Next.call: init %Optional.006 to %.loc48_41.7 = call %bound_method.loc48_41.4(%r.ref, %var) +// CHECK:STDOUT: %.loc48_41.8: ref %Optional.006 = temporary %.loc48_41.7, %Iterate.WithSelf.Next.call +// CHECK:STDOUT: %.loc48_41.9: %Optional.HasValue.type.06b = specific_constant imports.%Core.import_ref.c82, @Optional(constants.%OptionalStorage.facet.adc) [concrete = constants.%Optional.HasValue.994] +// CHECK:STDOUT: %HasValue.ref: %Optional.HasValue.type.06b = name_ref HasValue, %.loc48_41.9 [concrete = constants.%Optional.HasValue.994] +// CHECK:STDOUT: %Optional.HasValue.bound: = bound_method %.loc48_41.8, %HasValue.ref // CHECK:STDOUT: %Optional.HasValue.specific_fn: = specific_function %HasValue.ref, @Optional.HasValue(constants.%OptionalStorage.facet.adc) [concrete = constants.%Optional.HasValue.specific_fn.c92] -// CHECK:STDOUT: %bound_method.loc60_41.5: = bound_method %.loc60_41.8, %Optional.HasValue.specific_fn -// CHECK:STDOUT: %.loc60_41.10: %Optional.006 = acquire_value %.loc60_41.8 -// CHECK:STDOUT: %Optional.HasValue.call: init bool = call %bound_method.loc60_41.5(%.loc60_41.10) -// CHECK:STDOUT: %.loc60_41.11: bool = value_of_initializer %Optional.HasValue.call -// CHECK:STDOUT: %.loc60_41.12: bool = converted %Optional.HasValue.call, %.loc60_41.11 -// CHECK:STDOUT: if %.loc60_41.12 br !for.body else br !for.done +// CHECK:STDOUT: %bound_method.loc48_41.5: = bound_method %.loc48_41.8, %Optional.HasValue.specific_fn +// CHECK:STDOUT: %.loc48_41.10: %Optional.006 = acquire_value %.loc48_41.8 +// CHECK:STDOUT: %Optional.HasValue.call: init bool = call %bound_method.loc48_41.5(%.loc48_41.10) +// CHECK:STDOUT: %.loc48_41.11: bool = value_of_initializer %Optional.HasValue.call +// CHECK:STDOUT: %.loc48_41.12: bool = converted %Optional.HasValue.call, %.loc48_41.11 +// CHECK:STDOUT: if %.loc48_41.12 br !for.body else br !for.done // CHECK:STDOUT: // CHECK:STDOUT: !for.body: -// CHECK:STDOUT: %.loc60_41.13: %Optional.Get.type.a9b = specific_constant imports.%Core.import_ref.29e, @Optional(constants.%OptionalStorage.facet.adc) [concrete = constants.%Optional.Get.740] -// CHECK:STDOUT: %Get.ref: %Optional.Get.type.a9b = name_ref Get, %.loc60_41.13 [concrete = constants.%Optional.Get.740] -// CHECK:STDOUT: %Optional.Get.bound: = bound_method %.loc60_41.8, %Get.ref +// CHECK:STDOUT: %.loc48_41.13: %Optional.Get.type.a9b = specific_constant imports.%Core.import_ref.29e, @Optional(constants.%OptionalStorage.facet.adc) [concrete = constants.%Optional.Get.740] +// CHECK:STDOUT: %Get.ref: %Optional.Get.type.a9b = name_ref Get, %.loc48_41.13 [concrete = constants.%Optional.Get.740] +// CHECK:STDOUT: %Optional.Get.bound: = bound_method %.loc48_41.8, %Get.ref // CHECK:STDOUT: %Optional.Get.specific_fn: = specific_function %Get.ref, @Optional.Get(constants.%OptionalStorage.facet.adc) [concrete = constants.%Optional.Get.specific_fn.10e] -// CHECK:STDOUT: %bound_method.loc60_41.6: = bound_method %.loc60_41.8, %Optional.Get.specific_fn -// CHECK:STDOUT: %.loc60_41.14: ref %ValueType = temporary_storage -// CHECK:STDOUT: %.loc60_41.15: %Optional.006 = acquire_value %.loc60_41.8 -// CHECK:STDOUT: %Optional.Get.call: init %ValueType to %.loc60_41.14 = call %bound_method.loc60_41.6(%.loc60_41.15) -// CHECK:STDOUT: %.loc60_41.16: ref %ValueType = temporary %.loc60_41.14, %Optional.Get.call -// CHECK:STDOUT: %.loc60_41.17: %ValueType = acquire_value %.loc60_41.16 -// CHECK:STDOUT: %.loc60_26: type = splice_block %ValueType.ref.loc60 [concrete = constants.%ValueType] { -// CHECK:STDOUT: %Cpp.ref.loc60: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %OverloadADL.ref.loc60: = name_ref OverloadADL, imports.%OverloadADL [concrete = imports.%OverloadADL] -// CHECK:STDOUT: %ValueType.ref.loc60: type = name_ref ValueType, imports.%ValueType.decl [concrete = constants.%ValueType] +// CHECK:STDOUT: %bound_method.loc48_41.6: = bound_method %.loc48_41.8, %Optional.Get.specific_fn +// CHECK:STDOUT: %.loc48_41.14: ref %ValueType = temporary_storage +// CHECK:STDOUT: %.loc48_41.15: %Optional.006 = acquire_value %.loc48_41.8 +// CHECK:STDOUT: %Optional.Get.call: init %ValueType to %.loc48_41.14 = call %bound_method.loc48_41.6(%.loc48_41.15) +// CHECK:STDOUT: %.loc48_41.16: ref %ValueType = temporary %.loc48_41.14, %Optional.Get.call +// CHECK:STDOUT: %.loc48_41.17: %ValueType = acquire_value %.loc48_41.16 +// CHECK:STDOUT: %.loc48_26: type = splice_block %ValueType.ref.loc48 [concrete = constants.%ValueType] { +// CHECK:STDOUT: %Cpp.ref.loc48: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %OverloadADL.ref.loc48: = name_ref OverloadADL, imports.%OverloadADL [concrete = imports.%OverloadADL] +// CHECK:STDOUT: %ValueType.ref.loc48: type = name_ref ValueType, imports.%ValueType.decl [concrete = constants.%ValueType] // CHECK:STDOUT: } -// CHECK:STDOUT: %i: %ValueType = wrapper_binding i, %.loc60_41.17 +// CHECK:STDOUT: %i: %ValueType = wrapper_binding i, %.loc48_41.17 // CHECK:STDOUT: %sum.ref: ref %ValueType = name_ref sum, %sum // CHECK:STDOUT: %i.ref: %ValueType = name_ref i, %i -// CHECK:STDOUT: %.loc61_12: ref %ValueType = value_as_ref %i.ref -// CHECK:STDOUT: %addr.loc61: %ptr.6ed = addr_of %.loc61_12 -// CHECK:STDOUT: %.loc61_9.1: %ptr.403 = as_compatible %addr.loc61 -// CHECK:STDOUT: %.loc61_9.2: %ptr.403 = converted %addr.loc61, %.loc61_9.1 -// CHECK:STDOUT: %operator_PlusEqual__carbon_thunk.call: ref %ValueType = call imports.%operator_PlusEqual__carbon_thunk.decl(%sum.ref, %.loc61_9.2) -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc60_41.1: = bound_method %.loc60_41.16, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc60_41.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc60_41.1(%.loc60_41.16) -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc60_41.2: = bound_method %.loc60_41.8, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.8 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc60_41.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc60_41.2(%.loc60_41.8) +// CHECK:STDOUT: %.loc49_12: ref %ValueType = value_as_ref %i.ref +// CHECK:STDOUT: %addr.loc49: %ptr.6ed = addr_of %.loc49_12 +// CHECK:STDOUT: %.loc49_9.1: %ptr.403 = as_compatible %addr.loc49 +// CHECK:STDOUT: %.loc49_9.2: %ptr.403 = converted %addr.loc49, %.loc49_9.1 +// CHECK:STDOUT: %operator_PlusEqual__carbon_thunk.call: ref %ValueType = call imports.%operator_PlusEqual__carbon_thunk.decl(%sum.ref, %.loc49_9.2) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc48_41.1: = bound_method %.loc48_41.16, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc48_41.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc48_41.1(%.loc48_41.16) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc48_41.2: = bound_method %.loc48_41.8, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.8 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc48_41.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc48_41.2(%.loc48_41.8) // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.done: -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc60_41.3: = bound_method %.loc60_41.8, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.8 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc60_41.3: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc60_41.3(%.loc60_41.8) -// CHECK:STDOUT: %impl.elem2.loc60_41.2: @TestIterate.%.loc60_41.22 (%.97d) = impl_witness_access constants.%Destroy.lookup_impl_witness.eb0, element2 [symbolic = %impl.elem2.loc60_41.4 (constants.%impl.elem2.f7b)] -// CHECK:STDOUT: %bound_method.loc60_41.7: = bound_method %var, %impl.elem2.loc60_41.2 -// CHECK:STDOUT: %.loc60_41.18: %Destroy.type = converted constants.%as_type.733, constants.%impl.elem1.751 [symbolic = %impl.elem1 (constants.%impl.elem1.751)] -// CHECK:STDOUT: %.loc60_41.19: %Destroy.type = converted constants.%as_type.733, constants.%impl.elem1.751 [symbolic = %impl.elem1 (constants.%impl.elem1.751)] -// CHECK:STDOUT: %specific_impl_fn.loc60_41.3: = specific_impl_function %impl.elem2.loc60_41.2, @Destroy.WithSelf.SelfDestruct.1(constants.%impl.elem1.751) [symbolic = %specific_impl_fn.loc60_41.6 (constants.%specific_impl_fn.577)] -// CHECK:STDOUT: %bound_method.loc60_41.8: = bound_method %var, %specific_impl_fn.loc60_41.3 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc60_41.4: init %empty_tuple.type = call %bound_method.loc60_41.8(%var) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc48_41.3: = bound_method %.loc48_41.8, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.8 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc48_41.3: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc48_41.3(%.loc48_41.8) +// CHECK:STDOUT: %impl.elem2.loc48_41.2: @TestIterate.%.loc48_41.22 (%.97d) = impl_witness_access constants.%Destroy.lookup_impl_witness.eb0, element2 [symbolic = %impl.elem2.loc48_41.4 (constants.%impl.elem2.f7b)] +// CHECK:STDOUT: %bound_method.loc48_41.7: = bound_method %var, %impl.elem2.loc48_41.2 +// CHECK:STDOUT: %.loc48_41.18: %Destroy.type = converted constants.%as_type.733, constants.%impl.elem1.751 [symbolic = %impl.elem1 (constants.%impl.elem1.751)] +// CHECK:STDOUT: %.loc48_41.19: %Destroy.type = converted constants.%as_type.733, constants.%impl.elem1.751 [symbolic = %impl.elem1 (constants.%impl.elem1.751)] +// CHECK:STDOUT: %specific_impl_fn.loc48_41.3: = specific_impl_function %impl.elem2.loc48_41.2, @Destroy.WithSelf.SelfDestruct.1(constants.%impl.elem1.751) [symbolic = %specific_impl_fn.loc48_41.6 (constants.%specific_impl_fn.577)] +// CHECK:STDOUT: %bound_method.loc48_41.8: = bound_method %var, %specific_impl_fn.loc48_41.3 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc48_41.4: init %empty_tuple.type = call %bound_method.loc48_41.8(%var) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc60_41.1(%self.param: ref %.8f3) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc48_41.1(%self.param: ref %.8f3) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc60_41.1(%self.param: ref %.8f3) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc48_41.1(%self.param: ref %.8f3) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc60_41.1(%self.param: ref %.8f3) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc48_41.1(%self.param: ref %.8f3) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.2(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.1(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc60_41.2(%self.param: ref %MaybeUnformed.e45) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc48_41.2(%self.param: ref %MaybeUnformed.e45) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc60_41.2(%self.param: ref %MaybeUnformed.e45) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc48_41.2(%self.param: ref %MaybeUnformed.e45) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc60_41.2(%self.param: ref %MaybeUnformed.e45) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc48_41.2(%self.param: ref %MaybeUnformed.e45) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.3(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.2(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc60_41.3(%self.param: ref bool) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc48_41.3(%self.param: ref bool) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc60_41.3(%self.param: ref bool) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc48_41.3(%self.param: ref bool) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc60_41.3(%self.param: ref bool) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc48_41.3(%self.param: ref bool) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.4(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.3(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc60_41.4(%self.param: ref %struct_type.value.has_value.70e) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc48_41.4(%self.param: ref %struct_type.value.has_value.70e) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc60_41.1: ref bool = struct_access %self.param, element1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc60_41.1: = bound_method %.loc60_41.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.5 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc60_41.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc60_41.1(%.loc60_41.1) -// CHECK:STDOUT: %.loc60_41.2: ref %MaybeUnformed.e45 = struct_access %self.param, element0 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc60_41.2: = bound_method %.loc60_41.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.4 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc60_41.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc60_41.2(%.loc60_41.2) +// CHECK:STDOUT: %.loc48_41.1: ref bool = struct_access %self.param, element1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc48_41.1: = bound_method %.loc48_41.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.5 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc48_41.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc48_41.1(%.loc48_41.1) +// CHECK:STDOUT: %.loc48_41.2: ref %MaybeUnformed.e45 = struct_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc48_41.2: = bound_method %.loc48_41.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.4 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc48_41.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc48_41.2(%.loc48_41.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc60_41.4(%self.param: ref %struct_type.value.has_value.70e) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc48_41.4(%self.param: ref %struct_type.value.has_value.70e) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc60_41.4(%self.param: ref %struct_type.value.has_value.70e) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc48_41.4(%self.param: ref %struct_type.value.has_value.70e) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.5(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.4(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc60_41.5(%self.param: ref %DefaultOptionalStorage.8dd) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc48_41.5(%self.param: ref %DefaultOptionalStorage.8dd) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %has_value.ref: %DefaultOptionalStorage.elem.e54 = name_ref has_value, imports.%Core.import_ref.e86 [concrete = imports.%field_decl.390] -// CHECK:STDOUT: %.loc60_41.1: ref bool = class_element_access %self.param, element1 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc60_41.1: = bound_method %.loc60_41.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.5 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc60_41.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc60_41.1(%.loc60_41.1) +// CHECK:STDOUT: %.loc48_41.1: ref bool = class_element_access %self.param, element1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc48_41.1: = bound_method %.loc48_41.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.5 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc48_41.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc48_41.1(%.loc48_41.1) // CHECK:STDOUT: %value.ref: %DefaultOptionalStorage.elem.532 = name_ref value, imports.%Core.import_ref.373 [concrete = imports.%field_decl.498] -// CHECK:STDOUT: %.loc60_41.2: ref %MaybeUnformed.e45 = class_element_access %self.param, element0 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc60_41.2: = bound_method %.loc60_41.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.4 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc60_41.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc60_41.2(%.loc60_41.2) +// CHECK:STDOUT: %.loc48_41.2: ref %MaybeUnformed.e45 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc48_41.2: = bound_method %.loc48_41.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.4 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc48_41.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc48_41.2(%.loc48_41.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc60_41.5(%self.param: ref %DefaultOptionalStorage.8dd) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc48_41.5(%self.param: ref %DefaultOptionalStorage.8dd) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc60_41.5(%self.param: ref %DefaultOptionalStorage.8dd) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc48_41.5(%self.param: ref %DefaultOptionalStorage.8dd) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.6(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.5(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc60_41.6(%self.param: ref %Optional.006) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc48_41.6(%self.param: ref %Optional.006) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc60_41.6(%self.param: ref %Optional.006) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc48_41.6(%self.param: ref %Optional.006) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc60_41.6(%self.param: ref %Optional.006) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc48_41.6(%self.param: ref %Optional.006) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.7(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.6(%self.param) @@ -6117,117 +5995,117 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: } // CHECK:STDOUT: %mc.ref: ref %MutableAndConstRange = name_ref mc, %mc // CHECK:STDOUT: %impl.elem2: %.bc1 = impl_witness_access constants.%Iterate.impl_witness.198, element2 [concrete = constants.%T.as_type.as.Iterate.impl.NewCursor.160] -// CHECK:STDOUT: %bound_method.loc74_42.1: = bound_method %mc.ref, %impl.elem2 -// CHECK:STDOUT: %facet_value.loc74_42.1: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableAndConstRange, (constants.%custom_witness.660, constants.%custom_witness.809, constants.%custom_witness.d56, constants.%custom_witness.68a, constants.%custom_witness.edd, constants.%custom_witness.dc3, constants.%custom_witness.1c5, constants.%custom_witness.809) [concrete = constants.%facet_value.24f] -// CHECK:STDOUT: %.loc74_42.1: %CppRange_where.type.d682d6.1 = converted constants.%MutableAndConstRange, %facet_value.loc74_42.1 [concrete = constants.%facet_value.24f] -// CHECK:STDOUT: %facet_value.loc74_42.2: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableAndConstRange, (constants.%custom_witness.660, constants.%custom_witness.809, constants.%custom_witness.d56, constants.%custom_witness.68a, constants.%custom_witness.edd, constants.%custom_witness.dc3, constants.%custom_witness.1c5, constants.%custom_witness.809) [concrete = constants.%facet_value.24f] -// CHECK:STDOUT: %.loc74_42.2: %CppRange_where.type.d682d6.1 = converted constants.%MutableAndConstRange, %facet_value.loc74_42.2 [concrete = constants.%facet_value.24f] -// CHECK:STDOUT: %specific_fn.loc74_42.1: = specific_function %impl.elem2, @T.as_type.as.Iterate.impl.NewCursor(constants.%facet_value.24f) [concrete = constants.%T.as_type.as.Iterate.impl.NewCursor.specific_fn] -// CHECK:STDOUT: %bound_method.loc74_42.2: = bound_method %mc.ref, %specific_fn.loc74_42.1 +// CHECK:STDOUT: %bound_method.loc62_42.1: = bound_method %mc.ref, %impl.elem2 +// CHECK:STDOUT: %facet_value.loc62_42.1: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableAndConstRange, (constants.%custom_witness.660, constants.%custom_witness.809, constants.%custom_witness.d56, constants.%custom_witness.68a, constants.%custom_witness.edd, constants.%custom_witness.dc3, constants.%custom_witness.1c5, constants.%custom_witness.809) [concrete = constants.%facet_value.24f] +// CHECK:STDOUT: %.loc62_42.1: %CppRange_where.type.d682d6.1 = converted constants.%MutableAndConstRange, %facet_value.loc62_42.1 [concrete = constants.%facet_value.24f] +// CHECK:STDOUT: %facet_value.loc62_42.2: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableAndConstRange, (constants.%custom_witness.660, constants.%custom_witness.809, constants.%custom_witness.d56, constants.%custom_witness.68a, constants.%custom_witness.edd, constants.%custom_witness.dc3, constants.%custom_witness.1c5, constants.%custom_witness.809) [concrete = constants.%facet_value.24f] +// CHECK:STDOUT: %.loc62_42.2: %CppRange_where.type.d682d6.1 = converted constants.%MutableAndConstRange, %facet_value.loc62_42.2 [concrete = constants.%facet_value.24f] +// CHECK:STDOUT: %specific_fn.loc62_42.1: = specific_function %impl.elem2, @T.as_type.as.Iterate.impl.NewCursor(constants.%facet_value.24f) [concrete = constants.%T.as_type.as.Iterate.impl.NewCursor.specific_fn] +// CHECK:STDOUT: %bound_method.loc62_42.2: = bound_method %mc.ref, %specific_fn.loc62_42.1 // CHECK:STDOUT: %var: ref %tuple.type.de6 = var_storage invalid -// CHECK:STDOUT: %.loc74_40.1: %MutableAndConstRange = acquire_value %mc.ref -// CHECK:STDOUT: %T.as_type.as.Iterate.impl.NewCursor.call: init %tuple.type.de6 to %var = call %bound_method.loc74_42.2(%.loc74_40.1) +// CHECK:STDOUT: %.loc62_40.1: %MutableAndConstRange = acquire_value %mc.ref +// CHECK:STDOUT: %T.as_type.as.Iterate.impl.NewCursor.call: init %tuple.type.de6 to %var = call %bound_method.loc62_42.2(%.loc62_40.1) // CHECK:STDOUT: assign %var, %T.as_type.as.Iterate.impl.NewCursor.call // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.next: // CHECK:STDOUT: %impl.elem3: %.698 = impl_witness_access constants.%Iterate.impl_witness.198, element3 [concrete = constants.%T.as_type.as.Iterate.impl.Next.ddf] -// CHECK:STDOUT: %bound_method.loc74_42.3: = bound_method %mc.ref, %impl.elem3 -// CHECK:STDOUT: %facet_value.loc74_42.3: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableAndConstRange, (constants.%custom_witness.660, constants.%custom_witness.809, constants.%custom_witness.d56, constants.%custom_witness.68a, constants.%custom_witness.edd, constants.%custom_witness.dc3, constants.%custom_witness.1c5, constants.%custom_witness.809) [concrete = constants.%facet_value.24f] -// CHECK:STDOUT: %.loc74_42.3: %CppRange_where.type.d682d6.1 = converted constants.%MutableAndConstRange, %facet_value.loc74_42.3 [concrete = constants.%facet_value.24f] -// CHECK:STDOUT: %facet_value.loc74_42.4: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableAndConstRange, (constants.%custom_witness.660, constants.%custom_witness.809, constants.%custom_witness.d56, constants.%custom_witness.68a, constants.%custom_witness.edd, constants.%custom_witness.dc3, constants.%custom_witness.1c5, constants.%custom_witness.809) [concrete = constants.%facet_value.24f] -// CHECK:STDOUT: %.loc74_42.4: %CppRange_where.type.d682d6.1 = converted constants.%MutableAndConstRange, %facet_value.loc74_42.4 [concrete = constants.%facet_value.24f] -// CHECK:STDOUT: %specific_fn.loc74_42.2: = specific_function %impl.elem3, @T.as_type.as.Iterate.impl.Next(constants.%facet_value.24f) [concrete = constants.%T.as_type.as.Iterate.impl.Next.specific_fn] -// CHECK:STDOUT: %bound_method.loc74_42.4: = bound_method %mc.ref, %specific_fn.loc74_42.2 -// CHECK:STDOUT: %.loc74_42.5: ref %Optional.006 = temporary_storage -// CHECK:STDOUT: %.loc74_40.2: %MutableAndConstRange = acquire_value %mc.ref -// CHECK:STDOUT: %T.as_type.as.Iterate.impl.Next.call: init %Optional.006 to %.loc74_42.5 = call %bound_method.loc74_42.4(%.loc74_40.2, %var) -// CHECK:STDOUT: %.loc74_42.6: ref %Optional.006 = temporary %.loc74_42.5, %T.as_type.as.Iterate.impl.Next.call -// CHECK:STDOUT: %.loc74_42.7: %Optional.HasValue.type.06b = specific_constant imports.%Core.import_ref.c82, @Optional(constants.%OptionalStorage.facet.adc) [concrete = constants.%Optional.HasValue.994] -// CHECK:STDOUT: %HasValue.ref: %Optional.HasValue.type.06b = name_ref HasValue, %.loc74_42.7 [concrete = constants.%Optional.HasValue.994] -// CHECK:STDOUT: %Optional.HasValue.bound: = bound_method %.loc74_42.6, %HasValue.ref +// CHECK:STDOUT: %bound_method.loc62_42.3: = bound_method %mc.ref, %impl.elem3 +// CHECK:STDOUT: %facet_value.loc62_42.3: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableAndConstRange, (constants.%custom_witness.660, constants.%custom_witness.809, constants.%custom_witness.d56, constants.%custom_witness.68a, constants.%custom_witness.edd, constants.%custom_witness.dc3, constants.%custom_witness.1c5, constants.%custom_witness.809) [concrete = constants.%facet_value.24f] +// CHECK:STDOUT: %.loc62_42.3: %CppRange_where.type.d682d6.1 = converted constants.%MutableAndConstRange, %facet_value.loc62_42.3 [concrete = constants.%facet_value.24f] +// CHECK:STDOUT: %facet_value.loc62_42.4: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableAndConstRange, (constants.%custom_witness.660, constants.%custom_witness.809, constants.%custom_witness.d56, constants.%custom_witness.68a, constants.%custom_witness.edd, constants.%custom_witness.dc3, constants.%custom_witness.1c5, constants.%custom_witness.809) [concrete = constants.%facet_value.24f] +// CHECK:STDOUT: %.loc62_42.4: %CppRange_where.type.d682d6.1 = converted constants.%MutableAndConstRange, %facet_value.loc62_42.4 [concrete = constants.%facet_value.24f] +// CHECK:STDOUT: %specific_fn.loc62_42.2: = specific_function %impl.elem3, @T.as_type.as.Iterate.impl.Next(constants.%facet_value.24f) [concrete = constants.%T.as_type.as.Iterate.impl.Next.specific_fn] +// CHECK:STDOUT: %bound_method.loc62_42.4: = bound_method %mc.ref, %specific_fn.loc62_42.2 +// CHECK:STDOUT: %.loc62_42.5: ref %Optional.006 = temporary_storage +// CHECK:STDOUT: %.loc62_40.2: %MutableAndConstRange = acquire_value %mc.ref +// CHECK:STDOUT: %T.as_type.as.Iterate.impl.Next.call: init %Optional.006 to %.loc62_42.5 = call %bound_method.loc62_42.4(%.loc62_40.2, %var) +// CHECK:STDOUT: %.loc62_42.6: ref %Optional.006 = temporary %.loc62_42.5, %T.as_type.as.Iterate.impl.Next.call +// CHECK:STDOUT: %.loc62_42.7: %Optional.HasValue.type.06b = specific_constant imports.%Core.import_ref.c82, @Optional(constants.%OptionalStorage.facet.adc) [concrete = constants.%Optional.HasValue.994] +// CHECK:STDOUT: %HasValue.ref: %Optional.HasValue.type.06b = name_ref HasValue, %.loc62_42.7 [concrete = constants.%Optional.HasValue.994] +// CHECK:STDOUT: %Optional.HasValue.bound: = bound_method %.loc62_42.6, %HasValue.ref // CHECK:STDOUT: %Optional.HasValue.specific_fn: = specific_function %HasValue.ref, @Optional.HasValue(constants.%OptionalStorage.facet.adc) [concrete = constants.%Optional.HasValue.specific_fn.c92] -// CHECK:STDOUT: %bound_method.loc74_42.5: = bound_method %.loc74_42.6, %Optional.HasValue.specific_fn -// CHECK:STDOUT: %.loc74_42.8: %Optional.006 = acquire_value %.loc74_42.6 -// CHECK:STDOUT: %Optional.HasValue.call: init bool = call %bound_method.loc74_42.5(%.loc74_42.8) -// CHECK:STDOUT: %.loc74_42.9: bool = value_of_initializer %Optional.HasValue.call -// CHECK:STDOUT: %.loc74_42.10: bool = converted %Optional.HasValue.call, %.loc74_42.9 -// CHECK:STDOUT: if %.loc74_42.10 br !for.body else br !for.done +// CHECK:STDOUT: %bound_method.loc62_42.5: = bound_method %.loc62_42.6, %Optional.HasValue.specific_fn +// CHECK:STDOUT: %.loc62_42.8: %Optional.006 = acquire_value %.loc62_42.6 +// CHECK:STDOUT: %Optional.HasValue.call: init bool = call %bound_method.loc62_42.5(%.loc62_42.8) +// CHECK:STDOUT: %.loc62_42.9: bool = value_of_initializer %Optional.HasValue.call +// CHECK:STDOUT: %.loc62_42.10: bool = converted %Optional.HasValue.call, %.loc62_42.9 +// CHECK:STDOUT: if %.loc62_42.10 br !for.body else br !for.done // CHECK:STDOUT: // CHECK:STDOUT: !for.body: -// CHECK:STDOUT: %.loc74_42.11: %Optional.Get.type.a9b = specific_constant imports.%Core.import_ref.29e, @Optional(constants.%OptionalStorage.facet.adc) [concrete = constants.%Optional.Get.740] -// CHECK:STDOUT: %Get.ref: %Optional.Get.type.a9b = name_ref Get, %.loc74_42.11 [concrete = constants.%Optional.Get.740] -// CHECK:STDOUT: %Optional.Get.bound: = bound_method %.loc74_42.6, %Get.ref +// CHECK:STDOUT: %.loc62_42.11: %Optional.Get.type.a9b = specific_constant imports.%Core.import_ref.29e, @Optional(constants.%OptionalStorage.facet.adc) [concrete = constants.%Optional.Get.740] +// CHECK:STDOUT: %Get.ref: %Optional.Get.type.a9b = name_ref Get, %.loc62_42.11 [concrete = constants.%Optional.Get.740] +// CHECK:STDOUT: %Optional.Get.bound: = bound_method %.loc62_42.6, %Get.ref // CHECK:STDOUT: %Optional.Get.specific_fn: = specific_function %Get.ref, @Optional.Get(constants.%OptionalStorage.facet.adc) [concrete = constants.%Optional.Get.specific_fn.10e] -// CHECK:STDOUT: %bound_method.loc74_42.6: = bound_method %.loc74_42.6, %Optional.Get.specific_fn -// CHECK:STDOUT: %.loc74_42.12: ref %ValueType = temporary_storage -// CHECK:STDOUT: %.loc74_42.13: %Optional.006 = acquire_value %.loc74_42.6 -// CHECK:STDOUT: %Optional.Get.call: init %ValueType to %.loc74_42.12 = call %bound_method.loc74_42.6(%.loc74_42.13) -// CHECK:STDOUT: %.loc74_42.14: ref %ValueType = temporary %.loc74_42.12, %Optional.Get.call -// CHECK:STDOUT: %.loc74_42.15: %ValueType = acquire_value %.loc74_42.14 -// CHECK:STDOUT: %.loc74_26: type = splice_block %ValueType.ref.loc74 [concrete = constants.%ValueType] { -// CHECK:STDOUT: %Cpp.ref.loc74: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %OverloadADL.ref.loc74: = name_ref OverloadADL, imports.%OverloadADL [concrete = imports.%OverloadADL] -// CHECK:STDOUT: %ValueType.ref.loc74: type = name_ref ValueType, imports.%ValueType.decl [concrete = constants.%ValueType] +// CHECK:STDOUT: %bound_method.loc62_42.6: = bound_method %.loc62_42.6, %Optional.Get.specific_fn +// CHECK:STDOUT: %.loc62_42.12: ref %ValueType = temporary_storage +// CHECK:STDOUT: %.loc62_42.13: %Optional.006 = acquire_value %.loc62_42.6 +// CHECK:STDOUT: %Optional.Get.call: init %ValueType to %.loc62_42.12 = call %bound_method.loc62_42.6(%.loc62_42.13) +// CHECK:STDOUT: %.loc62_42.14: ref %ValueType = temporary %.loc62_42.12, %Optional.Get.call +// CHECK:STDOUT: %.loc62_42.15: %ValueType = acquire_value %.loc62_42.14 +// CHECK:STDOUT: %.loc62_26: type = splice_block %ValueType.ref.loc62 [concrete = constants.%ValueType] { +// CHECK:STDOUT: %Cpp.ref.loc62: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %OverloadADL.ref.loc62: = name_ref OverloadADL, imports.%OverloadADL [concrete = imports.%OverloadADL] +// CHECK:STDOUT: %ValueType.ref.loc62: type = name_ref ValueType, imports.%ValueType.decl [concrete = constants.%ValueType] // CHECK:STDOUT: } -// CHECK:STDOUT: %i: %ValueType = wrapper_binding i, %.loc74_42.15 +// CHECK:STDOUT: %i: %ValueType = wrapper_binding i, %.loc62_42.15 // CHECK:STDOUT: %sum.ref: ref %ValueType = name_ref sum, %sum // CHECK:STDOUT: %i.ref: %ValueType = name_ref i, %i -// CHECK:STDOUT: %.loc75_12: ref %ValueType = value_as_ref %i.ref -// CHECK:STDOUT: %addr.loc75: %ptr.6ed = addr_of %.loc75_12 -// CHECK:STDOUT: %.loc75_9.1: %ptr.403 = as_compatible %addr.loc75 -// CHECK:STDOUT: %.loc75_9.2: %ptr.403 = converted %addr.loc75, %.loc75_9.1 -// CHECK:STDOUT: %operator_PlusEqual__carbon_thunk.call: ref %ValueType = call imports.%operator_PlusEqual__carbon_thunk.decl(%sum.ref, %.loc75_9.2) -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc74_42.1: = bound_method %.loc74_42.14, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc74_42.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc74_42.1(%.loc74_42.14) -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc74_42.2: = bound_method %.loc74_42.6, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.8 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc74_42.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc74_42.2(%.loc74_42.6) +// CHECK:STDOUT: %.loc63_12: ref %ValueType = value_as_ref %i.ref +// CHECK:STDOUT: %addr.loc63: %ptr.6ed = addr_of %.loc63_12 +// CHECK:STDOUT: %.loc63_9.1: %ptr.403 = as_compatible %addr.loc63 +// CHECK:STDOUT: %.loc63_9.2: %ptr.403 = converted %addr.loc63, %.loc63_9.1 +// CHECK:STDOUT: %operator_PlusEqual__carbon_thunk.call: ref %ValueType = call imports.%operator_PlusEqual__carbon_thunk.decl(%sum.ref, %.loc63_9.2) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc62_42.1: = bound_method %.loc62_42.14, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc62_42.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc62_42.1(%.loc62_42.14) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc62_42.2: = bound_method %.loc62_42.6, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.8 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc62_42.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc62_42.2(%.loc62_42.6) // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.done: -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc74_42.3: = bound_method %.loc74_42.6, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.8 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc74_42.3: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc74_42.3(%.loc74_42.6) -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc74_42.4: = bound_method %var, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.10 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc74_42.4: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc74_42.4(%var) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc62_42.3: = bound_method %.loc62_42.6, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.8 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc62_42.3: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc62_42.3(%.loc62_42.6) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc62_42.4: = bound_method %var, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.10 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc62_42.4: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc62_42.4(%var) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @TestIterate(constants.%R) { -// CHECK:STDOUT: %R.patt.loc56_17.2 => constants.%R.patt -// CHECK:STDOUT: %R.loc56_17.1 => constants.%R -// CHECK:STDOUT: %R.as_type.loc56_83.1 => constants.%R.as_type +// CHECK:STDOUT: %R.patt.loc44_17.2 => constants.%R.patt +// CHECK:STDOUT: %R.loc44_17.1 => constants.%R +// CHECK:STDOUT: %R.as_type.loc44_83.1 => constants.%R.as_type // CHECK:STDOUT: %pattern_type => constants.%pattern_type.611 -// CHECK:STDOUT: %r.param_patt.loc56_81.2 => constants.%r.param_patt.e64 -// CHECK:STDOUT: %r.patt.loc56_81.2 => constants.%r.patt.dcb +// CHECK:STDOUT: %r.param_patt.loc44_81.2 => constants.%r.param_patt.e64 +// CHECK:STDOUT: %r.patt.loc44_81.2 => constants.%r.patt.dcb // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @TestIterate(constants.%facet_value.fc8) { -// CHECK:STDOUT: %R.patt.loc56_17.2 => constants.%R.patt -// CHECK:STDOUT: %R.loc56_17.1 => constants.%facet_value.fc8 -// CHECK:STDOUT: %R.as_type.loc56_83.1 => constants.%MutableAndConstRange +// CHECK:STDOUT: %R.patt.loc44_17.2 => constants.%R.patt +// CHECK:STDOUT: %R.loc44_17.1 => constants.%facet_value.fc8 +// CHECK:STDOUT: %R.as_type.loc44_83.1 => constants.%MutableAndConstRange // CHECK:STDOUT: %pattern_type => constants.%pattern_type.fdb -// CHECK:STDOUT: %r.param_patt.loc56_81.2 => constants.%r.param_patt.3a6 -// CHECK:STDOUT: %r.patt.loc56_81.2 => constants.%r.patt.403 +// CHECK:STDOUT: %r.param_patt.loc44_81.2 => constants.%r.param_patt.3a6 +// CHECK:STDOUT: %r.patt.loc44_81.2 => constants.%r.patt.403 // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete.loc56 => constants.%complete_type.357 +// CHECK:STDOUT: %require_complete.loc44 => constants.%complete_type.357 // CHECK:STDOUT: %Iterate.lookup_impl_witness => constants.%Iterate.impl_witness.198 -// CHECK:STDOUT: %Iterate.facet.loc60_41.5 => constants.%Iterate.facet.b30 +// CHECK:STDOUT: %Iterate.facet.loc48_41.5 => constants.%Iterate.facet.b30 // CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type => constants.%Iterate.WithSelf.NewCursor.type.b5a -// CHECK:STDOUT: %.loc60_41.20 => constants.%.bc1 -// CHECK:STDOUT: %impl.elem2.loc60_41.3 => constants.%T.as_type.as.Iterate.impl.NewCursor.160 -// CHECK:STDOUT: %specific_impl_fn.loc60_41.4 => constants.%T.as_type.as.Iterate.impl.NewCursor.specific_fn +// CHECK:STDOUT: %.loc48_41.20 => constants.%.bc1 +// CHECK:STDOUT: %impl.elem2.loc48_41.3 => constants.%T.as_type.as.Iterate.impl.NewCursor.160 +// CHECK:STDOUT: %specific_impl_fn.loc48_41.4 => constants.%T.as_type.as.Iterate.impl.NewCursor.specific_fn // CHECK:STDOUT: %impl.elem1 => constants.%Destroy.facet.c9a // CHECK:STDOUT: %as_type => constants.%tuple.type.de6 // CHECK:STDOUT: %require_complete.1 => constants.%complete_type.95d // CHECK:STDOUT: %Iterate.WithSelf.Next.type => constants.%Iterate.WithSelf.Next.type.3b0 -// CHECK:STDOUT: %.loc60_41.21 => constants.%.698 -// CHECK:STDOUT: %impl.elem3.loc60_41.2 => constants.%T.as_type.as.Iterate.impl.Next.ddf -// CHECK:STDOUT: %specific_impl_fn.loc60_41.5 => constants.%T.as_type.as.Iterate.impl.Next.specific_fn +// CHECK:STDOUT: %.loc48_41.21 => constants.%.698 +// CHECK:STDOUT: %impl.elem3.loc48_41.2 => constants.%T.as_type.as.Iterate.impl.Next.ddf +// CHECK:STDOUT: %specific_impl_fn.loc48_41.5 => constants.%T.as_type.as.Iterate.impl.Next.specific_fn // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type => constants.%Destroy.WithSelf.SelfDestruct.type.235 -// CHECK:STDOUT: %.loc60_41.22 => constants.%.a38 +// CHECK:STDOUT: %.loc48_41.22 => constants.%.a38 // CHECK:STDOUT: %Destroy.lookup_impl_witness => constants.%custom_witness.f8f19d.8 -// CHECK:STDOUT: %impl.elem2.loc60_41.4 => constants.%Destroy.WithSelf.SelfDestruct.db3fdb.10 -// CHECK:STDOUT: %specific_impl_fn.loc60_41.6 => constants.%Destroy.WithSelf.SelfDestruct.db3fdb.10 +// CHECK:STDOUT: %impl.elem2.loc48_41.4 => constants.%Destroy.WithSelf.SelfDestruct.db3fdb.10 +// CHECK:STDOUT: %specific_impl_fn.loc48_41.6 => constants.%Destroy.WithSelf.SelfDestruct.db3fdb.10 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interop/cpp/template/argument_count.carbon b/toolchain/check/testdata/interop/cpp/template/argument_count.carbon index 634e78599e60..2581b25727c7 100644 --- a/toolchain/check/testdata/interop/cpp/template/argument_count.carbon +++ b/toolchain/check/testdata/interop/cpp/template/argument_count.carbon @@ -45,13 +45,9 @@ library "[[@TEST_NAME]]"; import Cpp library "templates.h"; -// CHECK:STDERR: fail_too_few_arguments.carbon:[[@LINE+8]]:26: error: too few template arguments for class template 'TwoTypes' [CppInteropParseError] -// CHECK:STDERR: 14 | var x: Cpp.TwoTypes(Cpp.A); -// CHECK:STDERR: | ^ -// CHECK:STDERR: fail_too_few_arguments.carbon:[[@LINE-5]]:10: in file included here [InCppInclude] +// CHECK:STDERR: fail_too_few_arguments.carbon:[[@LINE+4]]:26: error: too few template arguments for class template 'TwoTypes' [CppInteropParseError] +// CHECK:STDERR: included from: fail_too_few_arguments.carbon:[[@LINE-3]]:10 [InCppInclude] // CHECK:STDERR: ./templates.h:5:41: note: template is declared here [CppInteropParseNote] -// CHECK:STDERR: 5 | template struct TwoTypes {}; -// CHECK:STDERR: | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ // CHECK:STDERR: var x: Cpp.TwoTypes(Cpp.A); @@ -61,13 +57,9 @@ library "[[@TEST_NAME]]"; import Cpp library "templates.h"; -// CHECK:STDERR: fail_too_many_arguments.carbon:[[@LINE+8]]:40: error: too many template arguments for class template 'TwoTypes' [CppInteropParseError] -// CHECK:STDERR: 14 | var x: Cpp.TwoTypes(Cpp.A, Cpp.A, Cpp.A); -// CHECK:STDERR: | ~~^ -// CHECK:STDERR: fail_too_many_arguments.carbon:[[@LINE-5]]:10: in file included here [InCppInclude] +// CHECK:STDERR: fail_too_many_arguments.carbon:[[@LINE+4]]:38-40: error: too many template arguments for class template 'TwoTypes' [CppInteropParseError] +// CHECK:STDERR: included from: fail_too_many_arguments.carbon:[[@LINE-3]]:10 [InCppInclude] // CHECK:STDERR: ./templates.h:5:41: note: template is declared here [CppInteropParseNote] -// CHECK:STDERR: 5 | template struct TwoTypes {}; -// CHECK:STDERR: | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ // CHECK:STDERR: var x: Cpp.TwoTypes(Cpp.A, Cpp.A, Cpp.A); @@ -98,23 +90,15 @@ library "[[@TEST_NAME]]"; import Cpp library "templates.h"; -// CHECK:STDERR: fail_fixed_size_pack_wrong_size.carbon:[[@LINE+8]]:57: error: too few template arguments for class template 'Inner' [CppInteropParseError] -// CHECK:STDERR: 14 | var too_few: Cpp.FixedSizePack(Cpp.A, Cpp.A).Inner(Cpp.B); -// CHECK:STDERR: | ^ -// CHECK:STDERR: fail_fixed_size_pack_wrong_size.carbon:[[@LINE-5]]:10: in file included here [InCppInclude] +// CHECK:STDERR: fail_fixed_size_pack_wrong_size.carbon:[[@LINE+4]]:57: error: too few template arguments for class template 'Inner' [CppInteropParseError] +// CHECK:STDERR: included from: fail_fixed_size_pack_wrong_size.carbon:[[@LINE-3]]:10 [InCppInclude] // CHECK:STDERR: ./templates.h:15:33: note: template is declared here [CppInteropParseNote] -// CHECK:STDERR: 15 | template ...U> struct Inner {}; -// CHECK:STDERR: | ~~~~~~~~~~~~~~~~~~~~~~ ^ // CHECK:STDERR: var too_few: Cpp.FixedSizePack(Cpp.A, Cpp.A).Inner(Cpp.B); -// CHECK:STDERR: fail_fixed_size_pack_wrong_size.carbon:[[@LINE+8]]:72: error: too many template arguments for class template 'Inner' [CppInteropParseError] -// CHECK:STDERR: 24 | var too_many: Cpp.FixedSizePack(Cpp.A, Cpp.A).Inner(Cpp.B, Cpp.B, Cpp.B); -// CHECK:STDERR: | ~~^ -// CHECK:STDERR: fail_fixed_size_pack_wrong_size.carbon:[[@LINE-15]]:10: in file included here [InCppInclude] +// CHECK:STDERR: fail_fixed_size_pack_wrong_size.carbon:[[@LINE+4]]:70-72: error: too many template arguments for class template 'Inner' [CppInteropParseError] +// CHECK:STDERR: included from: fail_fixed_size_pack_wrong_size.carbon:[[@LINE-9]]:10 [InCppInclude] // CHECK:STDERR: ./templates.h:15:33: note: template is declared here [CppInteropParseNote] -// CHECK:STDERR: 15 | template ...U> struct Inner {}; -// CHECK:STDERR: | ~~~~~~~~~~~~~~~~~~~~~~ ^ // CHECK:STDERR: var too_many: Cpp.FixedSizePack(Cpp.A, Cpp.A).Inner(Cpp.B, Cpp.B, Cpp.B); 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 b7f7275291d3..2baa309b3ede 100644 --- a/toolchain/check/testdata/interop/cpp/template/non_type_param.carbon +++ b/toolchain/check/testdata/interop/cpp/template/non_type_param.carbon @@ -41,12 +41,8 @@ library "[[@TEST_NAME]]"; 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)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var s: Cpp.Simple(456) = Cpp.MakeSimple123(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_int_param_mismatch.carbon:[[@LINE+3]]:1-22: error: cannot implicitly convert expression of type `Cpp.Simple` to `Cpp.Simple` [ConversionFailure] +// CHECK:STDERR: fail_int_param_mismatch.carbon:[[@LINE+2]]:1-22: note: type `Cpp.Simple` does not implement interface `Core.ImplicitAs(Cpp.Simple)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var s: Cpp.Simple(456) = Cpp.MakeSimple123(); @@ -139,12 +135,8 @@ library "[[@TEST_NAME]]"; 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)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var x: Cpp.TwoNonType(1, Cpp.A) = {}; -// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: fail_type_argument.carbon:[[@LINE+3]]:26-30: error: cannot implicitly convert expression of type `type` to `i32` [ConversionFailure] +// CHECK:STDERR: fail_type_argument.carbon:[[@LINE+2]]:26-30: note: type `type` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var x: Cpp.TwoNonType(1, Cpp.A) = {}; @@ -156,12 +148,8 @@ import Cpp library "templates.h"; 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)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var x: Cpp.TwoNonType(1, &n) = {}; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+3]]:26-27: error: cannot implicitly convert expression of type `i32*` to `i32` [ConversionFailure] +// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+2]]:26-27: note: type `i32*` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var x: Cpp.TwoNonType(1, &n) = {}; diff --git a/toolchain/check/testdata/interop/cpp/template/template_template_param.carbon b/toolchain/check/testdata/interop/cpp/template/template_template_param.carbon index 890bb3997bcb..38c2a90c9e07 100644 --- a/toolchain/check/testdata/interop/cpp/template/template_template_param.carbon +++ b/toolchain/check/testdata/interop/cpp/template/template_template_param.carbon @@ -36,20 +36,11 @@ library "[[@TEST_NAME]]"; import Cpp library "templates.h"; //@dump-sem-ir-begin -// CHECK:STDERR: fail_template_mismatch.carbon:[[@LINE+15]]:35: error: too few template arguments for class template 'C' [CppInteropParseError] -// CHECK:STDERR: 22 | var x: Cpp.TwoTemplates(Cpp.A, Cpp.C); -// CHECK:STDERR: | ^ -// CHECK:STDERR: fail_template_mismatch.carbon:[[@LINE+12]]:35: note: template template argument has different template parameters than its corresponding template template parameter [CppInteropParseNote] -// CHECK:STDERR: 22 | var x: Cpp.TwoTemplates(Cpp.A, Cpp.C); -// CHECK:STDERR: | ^ -// CHECK:STDERR: fail_template_mismatch.carbon:[[@LINE-9]]:10: in file included here [InCppInclude] +// CHECK:STDERR: fail_template_mismatch.carbon:[[@LINE+6]]:35: error: too few template arguments for class template 'C' [CppInteropParseError] +// CHECK:STDERR: fail_template_mismatch.carbon:[[@LINE+5]]:35: note: template template argument has different template parameters than its corresponding template template parameter [CppInteropParseNote] +// CHECK:STDERR: included from: fail_template_mismatch.carbon:[[@LINE-5]]:10 [InCppInclude] // CHECK:STDERR: ./templates.h:6:66: note: previous template template parameter is here [CppInteropParseNote] -// CHECK:STDERR: 6 | template typename, template typename> -// CHECK:STDERR: | ~~~~~~~~~~~~~~~~~~ ^ -// CHECK:STDERR: fail_template_mismatch.carbon:[[@LINE-13]]:10: in file included here [InCppInclude] // CHECK:STDERR: ./templates.h:4:37: note: template is declared here [CppInteropParseNote] -// CHECK:STDERR: 4 | template struct C {}; -// CHECK:STDERR: | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ // CHECK:STDERR: var x: Cpp.TwoTemplates(Cpp.A, Cpp.C); //@dump-sem-ir-end @@ -62,9 +53,7 @@ import Cpp library "templates.h"; class X {} -// CHECK:STDERR: fail_type_argument.carbon:[[@LINE+4]]:32: error: template argument for template template parameter must be a class template or type alias template [CppInteropParseError] -// CHECK:STDERR: 12 | var x: Cpp.TwoTemplates(Cpp.A, X); -// CHECK:STDERR: | ^ +// CHECK:STDERR: fail_type_argument.carbon:[[@LINE+2]]:32: error: template argument for template template parameter must be a class template or type alias template [CppInteropParseError] // CHECK:STDERR: var x: Cpp.TwoTemplates(Cpp.A, X); @@ -74,9 +63,7 @@ library "[[@TEST_NAME]]"; import Cpp library "templates.h"; -// CHECK:STDERR: fail_non_type_argument.carbon:[[@LINE+4]]:32: error: template argument for template template parameter must be a class template or type alias template [CppInteropParseError] -// CHECK:STDERR: 10 | var x: Cpp.TwoTemplates(Cpp.A, true); -// CHECK:STDERR: | ^ +// CHECK:STDERR: fail_non_type_argument.carbon:[[@LINE+2]]:32: error: template argument for template template parameter must be a class template or type alias template [CppInteropParseError] // CHECK:STDERR: var x: Cpp.TwoTemplates(Cpp.A, true); diff --git a/toolchain/check/testdata/interop/cpp/template/type_param.carbon b/toolchain/check/testdata/interop/cpp/template/type_param.carbon index a9eb2313b8da..c4ceddde8e95 100644 --- a/toolchain/check/testdata/interop/cpp/template/type_param.carbon +++ b/toolchain/check/testdata/interop/cpp/template/type_param.carbon @@ -43,12 +43,8 @@ library "[[@TEST_NAME]]"; 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)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var x: Cpp.TwoTypes(Cpp.A, true); -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_non_type_argument.carbon:[[@LINE+3]]:28-31: error: cannot implicitly convert non-type value of type `bool` to `type` [ConversionFailureNonTypeToFacet] +// CHECK:STDERR: fail_non_type_argument.carbon:[[@LINE+2]]:28-31: note: type `bool` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var x: Cpp.TwoTypes(Cpp.A, true); @@ -58,9 +54,7 @@ library "[[@TEST_NAME]]"; import Cpp library "templates.h"; -// CHECK:STDERR: fail_unsupported_type.carbon:[[@LINE+4]]:28: error: semantics TODO: `unsupported type used as template argument` [SemanticsTodo] -// CHECK:STDERR: var x: Cpp.TwoTypes(Cpp.A, {}); -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_unsupported_type.carbon:[[@LINE+2]]:28-29: error: semantics TODO: `unsupported type used as template argument` [SemanticsTodo] // CHECK:STDERR: var x: Cpp.TwoTypes(Cpp.A, {}); diff --git a/toolchain/check/testdata/interop/cpp/var/export/var.carbon b/toolchain/check/testdata/interop/cpp/var/export/var.carbon index 4a6d75e234b2..48d1c11b05d3 100644 --- a/toolchain/check/testdata/interop/cpp/var/export/var.carbon +++ b/toolchain/check/testdata/interop/cpp/var/export/var.carbon @@ -28,17 +28,13 @@ library "[[@TEST_NAME]]"; import Cpp; -// CHECK:STDERR: fail_var_unsupported_type.carbon:[[@LINE+4]]:5: error: semantics TODO: `failed to map Carbon type to C++` [SemanticsTodo] -// CHECK:STDERR: var unsupported_x: () = (); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_var_unsupported_type.carbon:[[@LINE+2]]:5-21: error: semantics TODO: `failed to map Carbon type to C++` [SemanticsTodo] // CHECK:STDERR: var unsupported_x: () = (); inline Cpp ''' void F() { - // CHECK:STDERR: fail_var_unsupported_type.carbon:[[@LINE+4]]:11: error: no member named 'unsupported_x' in namespace 'Carbon' [CppInteropParseError] - // CHECK:STDERR: 17 | Carbon::unsupported_x; - // CHECK:STDERR: | ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_var_unsupported_type.carbon:[[@LINE+2]]:11-23: error: no member named 'unsupported_x' in namespace 'Carbon' [CppInteropParseError] // CHECK:STDERR: Carbon::unsupported_x; } diff --git a/toolchain/check/testdata/interop/cpp/var/import/global.carbon b/toolchain/check/testdata/interop/cpp/var/import/global.carbon index 1ccc9ccd79b2..48ca8f086828 100644 --- a/toolchain/check/testdata/interop/cpp/var/import/global.carbon +++ b/toolchain/check/testdata/interop/cpp/var/import/global.carbon @@ -48,23 +48,15 @@ UnusupportedType unsupported_global; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_unsupported_type.carbon:[[@LINE+4]]:10: in file included here [InCppInclude] +// CHECK:STDERR: included from: fail_import_unsupported_type.carbon:[[@LINE+2]]:10 [InCppInclude] // CHECK:STDERR: ./unsupported_type.h:2:7: error: semantics TODO: `Unsupported: Type declaration: UnusupportedType` [SemanticsTodo] -// CHECK:STDERR: using UnusupportedType = _BitInt(23); -// CHECK:STDERR: ^ import Cpp library "unsupported_type.h"; fn MyF() { - // CHECK:STDERR: fail_import_unsupported_type.carbon:[[@LINE+11]]:21: note: in `Cpp` name lookup for `UnusupportedType` [InCppNameLookup] - // CHECK:STDERR: let unused local: Cpp.UnusupportedType = Cpp.unsupported_global; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_unsupported_type.carbon:[[@LINE+5]]:21-40: note: in `Cpp` name lookup for `UnusupportedType` [InCppNameLookup] // CHECK:STDERR: - // CHECK:STDERR: fail_import_unsupported_type.carbon:[[@LINE+7]]:44: error: semantics TODO: `Unsupported: var type: UnusupportedType` [SemanticsTodo] - // CHECK:STDERR: let unused local: Cpp.UnusupportedType = Cpp.unsupported_global; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_unsupported_type.carbon:[[@LINE+4]]:44: note: in `Cpp` name lookup for `unsupported_global` [InCppNameLookup] - // CHECK:STDERR: let unused local: Cpp.UnusupportedType = Cpp.unsupported_global; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_unsupported_type.carbon:[[@LINE+3]]:44-65: error: semantics TODO: `Unsupported: var type: UnusupportedType` [SemanticsTodo] + // CHECK:STDERR: fail_import_unsupported_type.carbon:[[@LINE+2]]:44-65: note: in `Cpp` name lookup for `unsupported_global` [InCppNameLookup] // CHECK:STDERR: let unused local: Cpp.UnusupportedType = Cpp.unsupported_global; } @@ -220,10 +212,10 @@ fn MyF() { // CHECK:STDOUT: // CHECK:STDOUT: fn @MyF() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Cpp.ref.loc22_44: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Cpp.ref.loc14_44: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %unsupported_global.ref: = name_ref unsupported_global, [concrete = ] // CHECK:STDOUT: %.1: = splice_block [concrete = ] { -// CHECK:STDOUT: %Cpp.ref.loc22_21: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Cpp.ref.loc14_21: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %UnusupportedType.ref: = name_ref UnusupportedType, [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %local: = wrapper_binding local, [concrete = ] diff --git a/toolchain/check/testdata/lambda/lambda.carbon b/toolchain/check/testdata/lambda/lambda.carbon index 6dba840be279..4a080cd30233 100644 --- a/toolchain/check/testdata/lambda/lambda.carbon +++ b/toolchain/check/testdata/lambda/lambda.carbon @@ -143,12 +143,8 @@ fn PassToTemplate[template F: type](f: F) { f(42); } alias id_fn = fn (x: i32) -> i32 { return x; }; fn TestAsTemplateArgument() { - // CHECK:STDERR: fail_todo_as_non_constant_template_argument.carbon:[[@LINE+7]]:3: error: unable to monomorphize specific `PassToTemplate()` [ResolvingSpecificHere] - // CHECK:STDERR: PassToTemplate(id_fn); - // CHECK:STDERR: ^~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_as_non_constant_template_argument.carbon:[[@LINE-8]]:45: note: value of type `` is not callable [CallToNonCallable] - // CHECK:STDERR: fn PassToTemplate[template F: type](f: F) { f(42); } - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_todo_as_non_constant_template_argument.carbon:[[@LINE+3]]:3-16: error: unable to monomorphize specific `PassToTemplate()` [ResolvingSpecificHere] + // CHECK:STDERR: fail_todo_as_non_constant_template_argument.carbon:[[@LINE-6]]:45-49: note: value of type `` is not callable [CallToNonCallable] // CHECK:STDERR: PassToTemplate(id_fn); } @@ -165,28 +161,20 @@ library "[[@TEST_NAME]]"; class C { fn M() { - // CHECK:STDERR: fail_self.carbon:[[@LINE+4]]:17: error: `self` parameter in function expression [SelfParameterInLambda] - // CHECK:STDERR: (fn (unused self: Self) {}); - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_self.carbon:[[@LINE+2]]:17-26: error: `self` parameter in function expression [SelfParameterInLambda] // CHECK:STDERR: (fn (unused self: Self) {}); - // CHECK:STDERR: fail_self.carbon:[[@LINE+4]]:17: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] - // CHECK:STDERR: (fn [unused self: Self]() {}); - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_self.carbon:[[@LINE+2]]:17-26: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] // CHECK:STDERR: (fn [unused self: Self]() {}); } } fn F() { - // CHECK:STDERR: fail_self.carbon:[[@LINE+4]]:15: error: `self` parameter in function expression [SelfParameterInLambda] - // CHECK:STDERR: (fn (unused self: i32) {}); - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_self.carbon:[[@LINE+2]]:15-23: error: `self` parameter in function expression [SelfParameterInLambda] // CHECK:STDERR: (fn (unused self: i32) {}); - // CHECK:STDERR: fail_self.carbon:[[@LINE+4]]:30: error: `self` parameter in function expression [SelfParameterInLambda] - // CHECK:STDERR: (fn (unused x: i32, unused self: i32) {}); - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_self.carbon:[[@LINE+2]]:30-38: error: `self` parameter in function expression [SelfParameterInLambda] // CHECK:STDERR: (fn (unused x: i32, unused self: i32) {}); } @@ -195,25 +183,15 @@ fn F() { library "[[@TEST_NAME]]"; fn Outer() -> i32 { - // CHECK:STDERR: fail_return.carbon:[[@LINE+4]]:18: error: missing `return` at end of function with declared return type [MissingReturnStatement] - // CHECK:STDERR: (fn () -> i32 {}); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_return.carbon:[[@LINE+2]]:18: error: missing `return` at end of function with declared return type [MissingReturnStatement] // CHECK:STDERR: (fn () -> i32 {}); - // CHECK:STDERR: fail_return.carbon:[[@LINE+7]]:20: error: cannot implicitly convert expression of type `Core.IntLiteral` to `bool` [ConversionFailure] - // CHECK:STDERR: (fn () -> bool { return 1; }); - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_return.carbon:[[@LINE+4]]:20: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: (fn () -> bool { return 1; }); - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_return.carbon:[[@LINE+3]]:20-28: error: cannot implicitly convert expression of type `Core.IntLiteral` to `bool` [ConversionFailure] + // CHECK:STDERR: fail_return.carbon:[[@LINE+2]]:20-28: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: (fn () -> bool { return 1; }); - // CHECK:STDERR: fail_return.carbon:[[@LINE+7]]:12: error: no return expression should be provided in this context [ReturnStatementDisallowExpr] - // CHECK:STDERR: (fn () { return 1; }); - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_return.carbon:[[@LINE+4]]:4: note: there was no return type provided [ReturnTypeOmittedNote] - // CHECK:STDERR: (fn () { return 1; }); - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_return.carbon:[[@LINE+3]]:12-20: error: no return expression should be provided in this context [ReturnStatementDisallowExpr] + // CHECK:STDERR: fail_return.carbon:[[@LINE+2]]:4-10: note: there was no return type provided [ReturnTypeOmittedNote] // CHECK:STDERR: (fn () { return 1; }); @@ -224,22 +202,14 @@ fn Outer() -> i32 { library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: fail_unused.carbon:[[@LINE+7]]:8: warning: binding `x` unused [UnusedBinding] - // CHECK:STDERR: (fn (x: i32, unused y: i32) -> i32 { - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_unused.carbon:[[@LINE+3]]:8-13: warning: binding `x` unused [UnusedBinding] // CHECK:STDERR: - // CHECK:STDERR: fail_unused.carbon:[[@LINE+3]]:23: error: variable `y` marked `unused` but used [UnusedButUsed] - // CHECK:STDERR: (fn (x: i32, unused y: i32) -> i32 { - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_unused.carbon:[[@LINE+1]]:23-28: error: variable `y` marked `unused` but used [UnusedButUsed] (fn (x: i32, unused y: i32) -> i32 { let z: i32 = 1; - // CHECK:STDERR: fail_unused.carbon:[[@LINE+8]]:12: note: usage here [UnusedButUsedHere] - // CHECK:STDERR: return y; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_unused.carbon:[[@LINE+4]]:12: note: usage here [UnusedButUsedHere] // CHECK:STDERR: - // CHECK:STDERR: fail_unused.carbon:[[@LINE-5]]:9: warning: binding `z` unused [UnusedBinding] - // CHECK:STDERR: let z: i32 = 1; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_unused.carbon:[[@LINE-3]]:9-14: warning: binding `z` unused [UnusedBinding] // CHECK:STDERR: return y; }); @@ -251,16 +221,12 @@ library "[[@TEST_NAME]]"; fn F() { while (true) { (fn () { - // CHECK:STDERR: fail_break_continue.carbon:[[@LINE+4]]:7: error: `break` can only be used in a loop [BreakOutsideLoop] - // CHECK:STDERR: break; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_break_continue.carbon:[[@LINE+2]]:7-11: error: `break` can only be used in a loop [BreakOutsideLoop] // CHECK:STDERR: break; }); (fn () { - // CHECK:STDERR: fail_break_continue.carbon:[[@LINE+4]]:7: error: `continue` can only be used in a loop [ContinueOutsideLoop] - // CHECK:STDERR: continue; - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_break_continue.carbon:[[@LINE+2]]:7-14: error: `continue` can only be used in a loop [ContinueOutsideLoop] // CHECK:STDERR: continue; }); @@ -272,12 +238,8 @@ fn F() { library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: fail_default_values.carbon:[[@LINE+7]]:34: error: this pattern is missing a required default value. [RequiredPatternDefaultValueMissing] - // CHECK:STDERR: (fn (unused x: i32 = 1, unused y: i32) {}); - // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_default_values.carbon:[[@LINE+4]]:15: note: all patterns to the right of this first pattern with a default value must also specify a default value. [RequiredPatternDefaultValueFirstDefault] - // CHECK:STDERR: (fn (unused x: i32 = 1, unused y: i32) {}); - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_default_values.carbon:[[@LINE+3]]:34-39: error: this pattern is missing a required default value. [RequiredPatternDefaultValueMissing] + // CHECK:STDERR: fail_default_values.carbon:[[@LINE+2]]:15-20: note: all patterns to the right of this first pattern with a default value must also specify a default value. [RequiredPatternDefaultValueFirstDefault] // CHECK:STDERR: (fn (unused x: i32 = 1, unused y: i32) {}); } @@ -288,24 +250,14 @@ library "[[@TEST_NAME]]"; class Incomplete; fn F() { - // CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE+7]]:15: error: parameter has incomplete type `Incomplete` in function definition [IncompleteTypeInFunctionParam] - // CHECK:STDERR: (fn (unused x: Incomplete) {}); - // CHECK:STDERR: ^~~~~~~~~~~~~ - // CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE-6]]:1: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: class Incomplete; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE+3]]:15-27: error: parameter has incomplete type `Incomplete` in function definition [IncompleteTypeInFunctionParam] + // CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE-4]]:1-17: note: class was forward declared here [ClassForwardDeclaredHere] // CHECK:STDERR: (fn (unused x: Incomplete) {}); - // CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE+11]]:10: error: function returns incomplete type `Incomplete` [IncompleteTypeInFunctionReturnType] - // CHECK:STDERR: (fn () -> Incomplete {}); - // CHECK:STDERR: ^~~~~~~~~~~~~ - // CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE-14]]:1: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: class Incomplete; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE+5]]:10-22: error: function returns incomplete type `Incomplete` [IncompleteTypeInFunctionReturnType] + // CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE-8]]:1-17: note: class was forward declared here [ClassForwardDeclaredHere] // CHECK:STDERR: - // CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE+4]]:25: error: missing `return` at end of function with declared return type [MissingReturnStatement] - // CHECK:STDERR: (fn () -> Incomplete {}); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE+2]]:25: error: missing `return` at end of function with declared return type [MissingReturnStatement] // CHECK:STDERR: (fn () -> Incomplete {}); } @@ -314,12 +266,8 @@ fn F() { library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: fail_conversion.carbon:[[@LINE+7]]:16: error: cannot implicitly convert expression of type `` to `i32` [ConversionFailure] - // CHECK:STDERR: let _: i32 = fn () {}; - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_conversion.carbon:[[@LINE+4]]:16: note: type `` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let _: i32 = fn () {}; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_conversion.carbon:[[@LINE+3]]:16-22: error: cannot implicitly convert expression of type `` to `i32` [ConversionFailure] + // CHECK:STDERR: fail_conversion.carbon:[[@LINE+2]]:16-22: note: type `` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: i32 = fn () {}; } @@ -328,14 +276,10 @@ fn F() { library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: fail_todo_positional_params.carbon:[[@LINE+4]]:4: error: semantics TODO: `function with positional parameters` [SemanticsTodo] - // CHECK:STDERR: (fn {}); - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_todo_positional_params.carbon:[[@LINE+2]]:4-7: error: semantics TODO: `function with positional parameters` [SemanticsTodo] // CHECK:STDERR: (fn {}); - // CHECK:STDERR: fail_todo_positional_params.carbon:[[@LINE+4]]:4: error: semantics TODO: `function with positional parameters` [SemanticsTodo] - // CHECK:STDERR: (fn -> i32 { return 0; }); - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_todo_positional_params.carbon:[[@LINE+2]]:4-14: error: semantics TODO: `function with positional parameters` [SemanticsTodo] // CHECK:STDERR: (fn -> i32 { return 0; }); } @@ -344,9 +288,7 @@ fn F() { library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: fail_todo_terse_body.carbon:[[@LINE+4]]:4: error: semantics TODO: `terse lambda body` [SemanticsTodo] - // CHECK:STDERR: (fn (x: i32) => x); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_terse_body.carbon:[[@LINE+2]]:4-19: error: semantics TODO: `terse lambda body` [SemanticsTodo] // CHECK:STDERR: (fn (x: i32) => x); } diff --git a/toolchain/check/testdata/let/compile_time_bindings.carbon b/toolchain/check/testdata/let/compile_time_bindings.carbon index 94cbc988fc9a..fa56e839688d 100644 --- a/toolchain/check/testdata/let/compile_time_bindings.carbon +++ b/toolchain/check/testdata/let/compile_time_bindings.carbon @@ -22,9 +22,7 @@ library "[[@TEST_NAME]]"; class C { fn F() -> () { return x; } - // CHECK:STDERR: fail_let_after.carbon:[[@LINE+4]]:15: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] - // CHECK:STDERR: let generic x: () = (); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_let_after.carbon:[[@LINE+2]]:15-19: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] // CHECK:STDERR: let generic x: () = (); } @@ -34,9 +32,7 @@ class C { library "[[@TEST_NAME]]"; class C { - // CHECK:STDERR: fail_let_before.carbon:[[@LINE+4]]:15: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] - // CHECK:STDERR: let generic x: () = (); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_let_before.carbon:[[@LINE+2]]:15-19: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] // CHECK:STDERR: let generic x: () = (); fn F() -> () { return x; } @@ -47,9 +43,7 @@ class C { library "[[@TEST_NAME]]"; class C { - // CHECK:STDERR: fail_multiple_lets.carbon:[[@LINE+4]]:15: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] - // CHECK:STDERR: let generic a: () = (); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_multiple_lets.carbon:[[@LINE+2]]:15-19: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] // CHECK:STDERR: let generic a: () = (); fn F(generic b: ((),)) { @@ -60,13 +54,9 @@ class C { var unused c1: ((), ()) = c; var unused d1: ((), (), ()) = d; } - // CHECK:STDERR: fail_multiple_lets.carbon:[[@LINE+8]]:15: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] - // CHECK:STDERR: let generic d: ((), (), ()) = ((), (), ()); - // CHECK:STDERR: ^~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_multiple_lets.carbon:[[@LINE+4]]:15-29: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] // CHECK:STDERR: - // CHECK:STDERR: fail_multiple_lets.carbon:[[@LINE-11]]:17: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] - // CHECK:STDERR: let generic c: ((), ()) = ((), ()); - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_multiple_lets.carbon:[[@LINE-9]]:17-27: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] // CHECK:STDERR: let generic d: ((), (), ()) = ((), (), ()); } @@ -77,13 +67,9 @@ library "[[@TEST_NAME]]"; class C { fn F() -> () { return x; } - // CHECK:STDERR: fail_invalid_let_after.carbon:[[@LINE+8]]:15: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] - // CHECK:STDERR: let generic x: (); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_invalid_let_after.carbon:[[@LINE+4]]:15-19: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] // CHECK:STDERR: - // CHECK:STDERR: fail_invalid_let_after.carbon:[[@LINE+4]]:20: error: expected `=`; `let` declaration must have an initializer [ExpectedInitializerAfterLet] - // CHECK:STDERR: let generic x: (); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_invalid_let_after.carbon:[[@LINE+2]]:20: error: expected `=`; `let` declaration must have an initializer [ExpectedInitializerAfterLet] // CHECK:STDERR: let generic x: (); } @@ -93,9 +79,7 @@ class C { library "[[@TEST_NAME]]"; fn F() -> i32 { - // CHECK:STDERR: fail_todo_use_in_function.carbon:[[@LINE+4]]:15: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] - // CHECK:STDERR: let generic Zero: i32 = 0; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_todo_use_in_function.carbon:[[@LINE+2]]:15-23: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] // CHECK:STDERR: let generic Zero: i32 = 0; return Zero; @@ -107,9 +91,7 @@ library "[[@TEST_NAME]]"; fn F() -> i32 { if (true) { - // CHECK:STDERR: fail_todo_use_in_block.carbon:[[@LINE+4]]:17: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] - // CHECK:STDERR: let generic Zero: i32 = 0; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_todo_use_in_block.carbon:[[@LINE+2]]:17-25: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] // CHECK:STDERR: let generic Zero: i32 = 0; return Zero; @@ -131,14 +113,10 @@ interface I { library "[[@TEST_NAME]]"; class I { - // CHECK:STDERR: fail_return_in_class.carbon:[[@LINE+4]]:15: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] - // CHECK:STDERR: let generic T: type = i32; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_return_in_class.carbon:[[@LINE+2]]:15-21: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] // CHECK:STDERR: let generic T: type = i32; - // CHECK:STDERR: fail_return_in_class.carbon:[[@LINE+4]]:13: error: cannot evaluate type expression [TypeExprEvaluationFailure] - // CHECK:STDERR: fn F() -> T; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_return_in_class.carbon:[[@LINE+2]]:13: error: cannot evaluate type expression [TypeExprEvaluationFailure] // CHECK:STDERR: fn F() -> T; } @@ -147,14 +125,10 @@ class I { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_return_in_package_scope.carbon:[[@LINE+4]]:13: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] -// CHECK:STDERR: let generic T: type = i32; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_return_in_package_scope.carbon:[[@LINE+2]]:13-19: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] // CHECK:STDERR: let generic T: type = i32; -// CHECK:STDERR: fail_return_in_package_scope.carbon:[[@LINE+4]]:11: error: cannot evaluate type expression [TypeExprEvaluationFailure] -// CHECK:STDERR: fn F() -> T; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_return_in_package_scope.carbon:[[@LINE+2]]:11: error: cannot evaluate type expression [TypeExprEvaluationFailure] // CHECK:STDERR: fn F() -> T; @@ -165,9 +139,7 @@ library "[[@TEST_NAME]]"; interface Empty {} impl i32 as Empty { - // CHECK:STDERR: fail_use_in_impl.carbon:[[@LINE+4]]:15: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] - // CHECK:STDERR: let generic Zero: i32 = 0; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_use_in_impl.carbon:[[@LINE+2]]:15-23: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] // CHECK:STDERR: let generic Zero: i32 = 0; } @@ -218,15 +190,15 @@ impl i32 as Empty { // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0 // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10_24.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_24.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc10_24.2: %empty_tuple.type = converted %.loc10_24.1, %empty_tuple [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc10_19.1: type = splice_block %.loc10_19.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc8_24.2: %empty_tuple.type = converted %.loc8_24.1, %empty_tuple [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_19.1: type = splice_block %.loc8_19.3 [concrete = constants.%empty_tuple.type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc10_19.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc10_19.3: type = converted %.loc10_19.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc8_19.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_19.3: type = converted %.loc8_19.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %x: %empty_tuple.type = wrapper_binding x, %.loc10_24.2 +// CHECK:STDOUT: %x: %empty_tuple.type = wrapper_binding x, %.loc8_24.2 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %x.patt: %pattern_type = value_binding_pattern x [concrete = constants.%x.patt] // CHECK:STDOUT: } @@ -283,25 +255,25 @@ impl i32 as Empty { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %.loc9_24.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc7_24.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc9_24.2: %empty_tuple.type = converted %.loc9_24.1, %empty_tuple [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc9_19.1: type = splice_block %.loc9_19.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc7_24.2: %empty_tuple.type = converted %.loc7_24.1, %empty_tuple [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc7_19.1: type = splice_block %.loc7_19.3 [concrete = constants.%empty_tuple.type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc9_19.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc9_19.3: type = converted %.loc9_19.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc7_19.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc7_19.3: type = converted %.loc7_19.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %x: %empty_tuple.type = wrapper_binding x, %.loc9_24.2 +// CHECK:STDOUT: %x: %empty_tuple.type = wrapper_binding x, %.loc7_24.2 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %x.patt: %pattern_type = value_binding_pattern x [concrete = constants.%x.patt] // CHECK:STDOUT: } // CHECK:STDOUT: %C.F.decl: %C.F.type = fn_decl @C.F [concrete = constants.%C.F] { // CHECK:STDOUT: %return.param_patt: %pattern_type = out_param_pattern [concrete = constants.%return.param_patt] -// CHECK:STDOUT: %return.patt: %pattern_type = return_slot_pattern %return.param_patt, %.loc10_14.2 [concrete = constants.%return.patt] +// CHECK:STDOUT: %return.patt: %pattern_type = return_slot_pattern %return.param_patt, %.loc8_14.2 [concrete = constants.%return.patt] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc10_14.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc10_14.2: type = converted %.loc10_14.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc10_14.3: Core.Form = init_form %.loc10_14.2 [concrete = constants.%.262] +// CHECK:STDOUT: %.loc8_14.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_14.2: type = converted %.loc8_14.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc8_14.3: Core.Form = init_form %.loc8_14.2 [concrete = constants.%.262] // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0 // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param // CHECK:STDOUT: } @@ -317,9 +289,9 @@ impl i32 as Empty { // CHECK:STDOUT: fn @C.F() -> out %return.param: %empty_tuple.type { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %x.ref: %empty_tuple.type = name_ref x, @C.%x -// CHECK:STDOUT: %.loc10_25: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc10_26: init %empty_tuple.type = converted %x.ref, %.loc10_25 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: return %.loc10_26 +// CHECK:STDOUT: %.loc8_25: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_26: init %empty_tuple.type = converted %x.ref, %.loc8_25 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: return %.loc8_26 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_multiple_lets.carbon @@ -348,54 +320,54 @@ impl i32 as Empty { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %.loc9_24.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %empty_tuple.loc9: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc9_24.2: %empty_tuple.type = converted %.loc9_24.1, %empty_tuple.loc9 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc9_19.1: type = splice_block %.loc9_19.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.Self.frozen.loc9: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc9_19.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc9_19.3: type = converted %.loc9_19.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc7_24.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %empty_tuple.loc7: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc7_24.2: %empty_tuple.type = converted %.loc7_24.1, %empty_tuple.loc7 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc7_19.1: type = splice_block %.loc7_19.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.Self.frozen.loc7: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc7_19.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc7_19.3: type = converted %.loc7_19.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %a: %empty_tuple.type = wrapper_binding a, %.loc9_24.2 +// CHECK:STDOUT: %a: %empty_tuple.type = wrapper_binding a, %.loc7_24.2 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %a.patt: %pattern_type.cb1 = value_binding_pattern a [concrete = constants.%a.patt] // CHECK:STDOUT: } // CHECK:STDOUT: %C.F.decl: %C.F.type = fn_decl @C.F [concrete = constants.%C.F] { -// CHECK:STDOUT: %b.patt.loc10_17.1: %pattern_type.559 = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc10_17.2 (constants.%b.patt)] +// CHECK:STDOUT: %b.patt.loc8_17.1: %pattern_type.559 = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc8_17.2 (constants.%b.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc10_23.1: type = splice_block %.loc10_23.4 [concrete = constants.%tuple.type.9fb] { +// CHECK:STDOUT: %.loc8_23.1: type = splice_block %.loc8_23.4 [concrete = constants.%tuple.type.9fb] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc10_21: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc10_23.2: %tuple.type.9fb = tuple_literal (%.loc10_21) [concrete = constants.%tuple.f41] -// CHECK:STDOUT: %.loc10_23.3: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc10_23.4: type = converted %.loc10_23.2, constants.%tuple.type.9fb [concrete = constants.%tuple.type.9fb] +// CHECK:STDOUT: %.loc8_21: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_23.2: %tuple.type.9fb = tuple_literal (%.loc8_21) [concrete = constants.%tuple.f41] +// CHECK:STDOUT: %.loc8_23.3: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc8_23.4: type = converted %.loc8_23.2, constants.%tuple.type.9fb [concrete = constants.%tuple.type.9fb] // CHECK:STDOUT: } -// CHECK:STDOUT: %b.loc10_17.2: %tuple.type.9fb = symbolic_binding b, 0 [symbolic = %b.loc10_17.1 (constants.%b)] +// CHECK:STDOUT: %b.loc8_17.2: %tuple.type.9fb = symbolic_binding b, 0 [symbolic = %b.loc8_17.1 (constants.%b)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc26_35: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc26_39: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc26_43: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc26_44.1: %tuple.type.2d5 = tuple_literal (%.loc26_35, %.loc26_39, %.loc26_43) [concrete = constants.%tuple.7e4] -// CHECK:STDOUT: %empty_tuple.loc26_35: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc26_44.2: %empty_tuple.type = converted %.loc26_35, %empty_tuple.loc26_35 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %empty_tuple.loc26_39: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc26_44.3: %empty_tuple.type = converted %.loc26_39, %empty_tuple.loc26_39 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %empty_tuple.loc26_43: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc26_44.4: %empty_tuple.type = converted %.loc26_43, %empty_tuple.loc26_43 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %tuple: %tuple.type.2d5 = tuple_value (%.loc26_44.2, %.loc26_44.3, %.loc26_44.4) [concrete = constants.%tuple.7e4] -// CHECK:STDOUT: %.loc26_44.5: %tuple.type.2d5 = converted %.loc26_44.1, %tuple [concrete = constants.%tuple.7e4] -// CHECK:STDOUT: %.loc26_29.1: type = splice_block %.loc26_29.6 [concrete = constants.%tuple.type.2d5] { -// CHECK:STDOUT: %.Self.frozen.loc26: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc26_20: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc26_24: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc26_28: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc26_29.2: %tuple.type.2d5 = tuple_literal (%.loc26_20, %.loc26_24, %.loc26_28) [concrete = constants.%tuple.7e4] -// CHECK:STDOUT: %.loc26_29.3: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc26_29.4: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc26_29.5: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc26_29.6: type = converted %.loc26_29.2, constants.%tuple.type.2d5 [concrete = constants.%tuple.type.2d5] +// CHECK:STDOUT: %.loc20_35: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc20_39: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc20_43: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc20_44.1: %tuple.type.2d5 = tuple_literal (%.loc20_35, %.loc20_39, %.loc20_43) [concrete = constants.%tuple.7e4] +// CHECK:STDOUT: %empty_tuple.loc20_35: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc20_44.2: %empty_tuple.type = converted %.loc20_35, %empty_tuple.loc20_35 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %empty_tuple.loc20_39: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc20_44.3: %empty_tuple.type = converted %.loc20_39, %empty_tuple.loc20_39 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %empty_tuple.loc20_43: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc20_44.4: %empty_tuple.type = converted %.loc20_43, %empty_tuple.loc20_43 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %tuple: %tuple.type.2d5 = tuple_value (%.loc20_44.2, %.loc20_44.3, %.loc20_44.4) [concrete = constants.%tuple.7e4] +// CHECK:STDOUT: %.loc20_44.5: %tuple.type.2d5 = converted %.loc20_44.1, %tuple [concrete = constants.%tuple.7e4] +// CHECK:STDOUT: %.loc20_29.1: type = splice_block %.loc20_29.6 [concrete = constants.%tuple.type.2d5] { +// CHECK:STDOUT: %.Self.frozen.loc20: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc20_20: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc20_24: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc20_28: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc20_29.2: %tuple.type.2d5 = tuple_literal (%.loc20_20, %.loc20_24, %.loc20_28) [concrete = constants.%tuple.7e4] +// CHECK:STDOUT: %.loc20_29.3: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc20_29.4: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc20_29.5: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc20_29.6: type = converted %.loc20_29.2, constants.%tuple.type.2d5 [concrete = constants.%tuple.type.2d5] // CHECK:STDOUT: } -// CHECK:STDOUT: %d: %tuple.type.2d5 = wrapper_binding d, %.loc26_44.5 +// CHECK:STDOUT: %d: %tuple.type.2d5 = wrapper_binding d, %.loc20_44.5 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %d.patt: %pattern_type.8c1 = value_binding_pattern d [concrete = constants.%d.patt] // CHECK:STDOUT: } @@ -409,16 +381,16 @@ impl i32 as Empty { // CHECK:STDOUT: .d = %d // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @C.F(%b.loc10_17.2: %tuple.type.9fb) { -// CHECK:STDOUT: %b.patt.loc10_17.2: %pattern_type.559 = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc10_17.2 (constants.%b.patt)] -// CHECK:STDOUT: %b.loc10_17.1: %tuple.type.9fb = symbolic_binding b, 0 [symbolic = %b.loc10_17.1 (constants.%b)] +// CHECK:STDOUT: generic fn @C.F(%b.loc8_17.2: %tuple.type.9fb) { +// CHECK:STDOUT: %b.patt.loc8_17.2: %pattern_type.559 = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc8_17.2 (constants.%b.patt)] +// CHECK:STDOUT: %b.loc8_17.1: %tuple.type.9fb = symbolic_binding b, 0 [symbolic = %b.loc8_17.1 (constants.%b)] // CHECK:STDOUT: // CHECK:STDOUT: fn(); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @C.F(constants.%b) { -// CHECK:STDOUT: %b.patt.loc10_17.2 => constants.%b.patt -// CHECK:STDOUT: %b.loc10_17.1 => constants.%b +// CHECK:STDOUT: %b.patt.loc8_17.2 => constants.%b.patt +// CHECK:STDOUT: %b.loc8_17.1 => constants.%b // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_invalid_let_after.carbon @@ -475,12 +447,12 @@ impl i32 as Empty { // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: .F = %C.F.decl -// CHECK:STDOUT: .x = .inst{{[0-9A-F]+}}.loc14_16 +// CHECK:STDOUT: .x = .inst{{[0-9A-F]+}}.loc10_16 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @C.F() -> out %return.param: %empty_tuple.type { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %x.ref: %empty_tuple.type = name_ref x, .inst{{[0-9A-F]+}}.loc14_16 +// CHECK:STDOUT: %x.ref: %empty_tuple.type = name_ref x, .inst{{[0-9A-F]+}}.loc10_16 // CHECK:STDOUT: %.loc5_25: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple] // CHECK:STDOUT: %.loc5_26: init %empty_tuple.type = converted %x.ref, %.loc5_25 [concrete = constants.%empty_tuple] // CHECK:STDOUT: return %.loc5_26 @@ -639,9 +611,9 @@ impl i32 as Empty { // CHECK:STDOUT: // CHECK:STDOUT: class @I { // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc9_18.1: type = splice_block %.loc9_18.2 [concrete = type] { +// CHECK:STDOUT: %.loc7_18.1: type = splice_block %.loc7_18.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc9_18.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc7_18.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } // CHECK:STDOUT: %T: type = wrapper_binding T, %i32 // CHECK:STDOUT: name_binding_decl { @@ -695,9 +667,9 @@ impl i32 as Empty { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %.loc8_16.1: type = splice_block %.loc8_16.2 [concrete = type] { +// CHECK:STDOUT: %.loc6_16.1: type = splice_block %.loc6_16.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc8_16.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc6_16.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } // CHECK:STDOUT: %T: type = wrapper_binding T, @__global_init.%i32 // CHECK:STDOUT: name_binding_decl { @@ -795,17 +767,17 @@ impl i32 as Empty { // CHECK:STDOUT: impl @i32.as.Empty.impl: %i32.loc6 as %Empty.ref { // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] // CHECK:STDOUT: %impl.elem0: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc11_27.1: = bound_method %int_0, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %bound_method.loc9_27.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.loc11_27.2: = bound_method %int_0, %specific_fn [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc11_27.2(%int_0) [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc11_27.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc11_27.2: %i32 = converted %int_0, %.loc11_27.1 [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc11_21: type = splice_block %i32.loc11 [concrete = constants.%i32] { +// CHECK:STDOUT: %bound_method.loc9_27.2: = bound_method %int_0, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc9_27.2(%int_0) [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc9_27.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc9_27.2: %i32 = converted %int_0, %.loc9_27.1 [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc9_21: type = splice_block %i32.loc9 [concrete = constants.%i32] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %i32.loc11: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc9: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: } -// CHECK:STDOUT: %Zero: %i32 = wrapper_binding Zero, %.loc11_27.2 +// CHECK:STDOUT: %Zero: %i32 = wrapper_binding Zero, %.loc9_27.2 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %Zero.patt: %pattern_type.d94 = value_binding_pattern Zero [concrete = constants.%Zero.patt] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/let/convert.carbon b/toolchain/check/testdata/let/convert.carbon index 62d0cf59bc68..d6a6d0141154 100644 --- a/toolchain/check/testdata/let/convert.carbon +++ b/toolchain/check/testdata/let/convert.carbon @@ -30,16 +30,10 @@ library "[[@TEST_NAME]]"; fn G() { var a: i32 = 0; let unused n: i32 = a; - // CHECK:STDERR: fail_let_bound_to_ref_not_mutable.carbon:[[@LINE+11]]:3: error: expression is not assignable [AssignmentToNonAssignable] - // CHECK:STDERR: n = 1; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_let_bound_to_ref_not_mutable.carbon:[[@LINE+5]]:3: error: expression is not assignable [AssignmentToNonAssignable] // CHECK:STDERR: - // CHECK:STDERR: fail_let_bound_to_ref_not_mutable.carbon:[[@LINE-5]]:14: error: variable `n` marked `unused` but used [UnusedButUsed] - // CHECK:STDERR: let unused n: i32 = a; - // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_let_bound_to_ref_not_mutable.carbon:[[@LINE+4]]:3: note: usage here [UnusedButUsedHere] - // CHECK:STDERR: n = 1; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_let_bound_to_ref_not_mutable.carbon:[[@LINE-3]]:14-19: error: variable `n` marked `unused` but used [UnusedButUsed] + // CHECK:STDERR: fail_let_bound_to_ref_not_mutable.carbon:[[@LINE+2]]:3: note: usage here [UnusedButUsedHere] // CHECK:STDERR: n = 1; } diff --git a/toolchain/check/testdata/let/fail_duplicate_decl.carbon b/toolchain/check/testdata/let/fail_duplicate_decl.carbon index 00a71230ef54..8906ce46077d 100644 --- a/toolchain/check/testdata/let/fail_duplicate_decl.carbon +++ b/toolchain/check/testdata/let/fail_duplicate_decl.carbon @@ -14,12 +14,8 @@ fn F() { let unused a: i32 = 1; - // CHECK:STDERR: fail_duplicate_decl.carbon:[[@LINE+7]]:14: error: duplicate name `a` being declared in the same scope [NameDeclDuplicate] - // CHECK:STDERR: let unused a: i32 = 2; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_duplicate_decl.carbon:[[@LINE-4]]:14: note: name is previously declared here [NameDeclPrevious] - // CHECK:STDERR: let unused a: i32 = 1; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_duplicate_decl.carbon:[[@LINE+3]]:14: error: duplicate name `a` being declared in the same scope [NameDeclDuplicate] + // CHECK:STDERR: fail_duplicate_decl.carbon:[[@LINE-2]]:14-19: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: let unused a: i32 = 2; } @@ -98,17 +94,17 @@ fn F() { // CHECK:STDOUT: %a.patt.loc16: %pattern_type.d94 = value_binding_pattern a [concrete = constants.%a.patt.4135b0.1] // CHECK:STDOUT: } // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %impl.elem0.loc24: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc24_23.1: = bound_method %int_2, %impl.elem0.loc24 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6] -// CHECK:STDOUT: %specific_fn.loc24: = specific_function %impl.elem0.loc24, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc24_23.2: = bound_method %int_2, %specific_fn.loc24 [concrete = constants.%bound_method.a55] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc24: init %i32 = call %bound_method.loc24_23.2(%int_2) [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc24_23.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc24 [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc24_23.2: %i32 = converted %int_2, %.loc24_23.1 [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %i32.loc24: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %a.loc24: %i32 = wrapper_binding a, %.loc24_23.2 +// CHECK:STDOUT: %impl.elem0.loc20: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc20_23.1: = bound_method %int_2, %impl.elem0.loc20 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6] +// CHECK:STDOUT: %specific_fn.loc20: = specific_function %impl.elem0.loc20, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc20_23.2: = bound_method %int_2, %specific_fn.loc20 [concrete = constants.%bound_method.a55] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc20: init %i32 = call %bound_method.loc20_23.2(%int_2) [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc20_23.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc20 [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc20_23.2: %i32 = converted %int_2, %.loc20_23.1 [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %i32.loc20: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %a.loc20: %i32 = wrapper_binding a, %.loc20_23.2 // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %a.patt.loc24: %pattern_type.d94 = value_binding_pattern a [concrete = constants.%a.patt.4135b0.2] +// CHECK:STDOUT: %a.patt.loc20: %pattern_type.d94 = value_binding_pattern a [concrete = constants.%a.patt.4135b0.2] // CHECK:STDOUT: } // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/let/fail_generic.carbon b/toolchain/check/testdata/let/fail_generic.carbon index b25acf836f40..ec776232a745 100644 --- a/toolchain/check/testdata/let/fail_generic.carbon +++ b/toolchain/check/testdata/let/fail_generic.carbon @@ -14,9 +14,7 @@ // TODO: Should this be valid? fn F(unused a: i32) -> i32 { - // CHECK:STDERR: fail_generic.carbon:[[@LINE+4]]:15: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] - // CHECK:STDERR: let generic T: type = i32; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_generic.carbon:[[@LINE+2]]:15-21: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] // CHECK:STDERR: let generic T: type = i32; let x: T = 5; diff --git a/toolchain/check/testdata/let/fail_generic_import.carbon b/toolchain/check/testdata/let/fail_generic_import.carbon index 620bba77f52c..6d4939177ade 100644 --- a/toolchain/check/testdata/let/fail_generic_import.carbon +++ b/toolchain/check/testdata/let/fail_generic_import.carbon @@ -16,9 +16,7 @@ package Implicit; -// CHECK:STDERR: fail_implicit.carbon:[[@LINE+4]]:13: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] -// CHECK:STDERR: let generic T: type = i32; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_implicit.carbon:[[@LINE+2]]:13-19: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] // CHECK:STDERR: let generic T: type = i32; @@ -27,9 +25,7 @@ let generic T: type = i32; impl package Implicit; // TODO: Should this be valid? -// CHECK:STDERR: fail_implicit.impl.carbon:[[@LINE+4]]:8: error: cannot evaluate type expression [TypeExprEvaluationFailure] -// CHECK:STDERR: let a: T = 0; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_implicit.impl.carbon:[[@LINE+2]]:8: error: cannot evaluate type expression [TypeExprEvaluationFailure] // CHECK:STDERR: let a: T = 0; @@ -61,9 +57,9 @@ let a: T = 0; // CHECK:STDOUT: .T = %T // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %.loc8_16.1: type = splice_block %.loc8_16.2 [concrete = type] { +// CHECK:STDOUT: %.loc6_16.1: type = splice_block %.loc6_16.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc8_16.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc6_16.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } // CHECK:STDOUT: %T: type = wrapper_binding T, @__global_init.%i32 // CHECK:STDOUT: name_binding_decl { diff --git a/toolchain/check/testdata/let/fail_missing_value.carbon b/toolchain/check/testdata/let/fail_missing_value.carbon index be632b95ae5b..bcd6162d3c54 100644 --- a/toolchain/check/testdata/let/fail_missing_value.carbon +++ b/toolchain/check/testdata/let/fail_missing_value.carbon @@ -12,16 +12,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/let/fail_missing_value.carbon -// CHECK:STDERR: fail_missing_value.carbon:[[@LINE+4]]:11: error: expected `=`; `let` declaration must have an initializer [ExpectedInitializerAfterLet] -// CHECK:STDERR: let n: i32; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_missing_value.carbon:[[@LINE+2]]:11: error: expected `=`; `let` declaration must have an initializer [ExpectedInitializerAfterLet] // CHECK:STDERR: let n: i32; fn F() { - // CHECK:STDERR: fail_missing_value.carbon:[[@LINE+4]]:20: error: expected `=`; `let` declaration must have an initializer [ExpectedInitializerAfterLet] - // CHECK:STDERR: let unused n: i32; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_missing_value.carbon:[[@LINE+2]]:20: error: expected `=`; `let` declaration must have an initializer [ExpectedInitializerAfterLet] // CHECK:STDERR: let unused n: i32; } @@ -53,7 +49,7 @@ fn F() { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { // CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .n = .inst{{[0-9A-F]+}}.loc19_6 +// CHECK:STDOUT: .n = .inst{{[0-9A-F]+}}.loc17_6 // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core diff --git a/toolchain/check/testdata/let/fail_modifiers.carbon b/toolchain/check/testdata/let/fail_modifiers.carbon index aec65b29bb1c..cb4826e114d2 100644 --- a/toolchain/check/testdata/let/fail_modifiers.carbon +++ b/toolchain/check/testdata/let/fail_modifiers.carbon @@ -12,79 +12,47 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/let/fail_modifiers.carbon -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `protected` not allowed; requires class scope [ModifierProtectedNotAllowed] -// CHECK:STDERR: protected let b: i32 = 1; -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-9: error: `protected` not allowed; requires class scope [ModifierProtectedNotAllowed] // CHECK:STDERR: protected let b: i32 = 1; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `default` not allowed; requires interface scope [ModifierRequiresInterface] -// CHECK:STDERR: default let c: i32 = 1; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-7: error: `default` not allowed; requires interface scope [ModifierRequiresInterface] // CHECK:STDERR: default let c: i32 = 1; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `final` not allowed; requires interface scope [ModifierRequiresInterface] -// CHECK:STDERR: final let d: i32 = 1; -// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-5: error: `final` not allowed; requires interface scope [ModifierRequiresInterface] // CHECK:STDERR: final let d: i32 = 1; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `virtual` not allowed on `let` declaration [ModifierNotAllowedOnDeclaration] -// CHECK:STDERR: virtual let e: i32 = 1; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-7: error: `virtual` not allowed on `let` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: virtual let e: i32 = 1; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+11]]:9: error: `final` not allowed on declaration with `default` [ModifierNotAllowedWith] -// CHECK:STDERR: default final let f: i32 = 1; -// CHECK:STDERR: ^~~~~ -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+8]]:1: note: `default` previously appeared here [ModifierPrevious] -// CHECK:STDERR: default final let f: i32 = 1; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+5]]:9-13: error: `final` not allowed on declaration with `default` [ModifierNotAllowedWith] +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1-7: note: `default` previously appeared here [ModifierPrevious] // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `default` not allowed; requires interface scope [ModifierRequiresInterface] -// CHECK:STDERR: default final let f: i32 = 1; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-7: error: `default` not allowed; requires interface scope [ModifierRequiresInterface] // CHECK:STDERR: default final let f: i32 = 1; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+11]]:9: error: `default` repeated on declaration [ModifierRepeated] -// CHECK:STDERR: default default let g: i32 = 1; -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+8]]:1: note: `default` previously appeared here [ModifierPrevious] -// CHECK:STDERR: default default let g: i32 = 1; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+5]]:9-15: error: `default` repeated on declaration [ModifierRepeated] +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1-7: note: `default` previously appeared here [ModifierPrevious] // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `default` not allowed; requires interface scope [ModifierRequiresInterface] -// CHECK:STDERR: default default let g: i32 = 1; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-7: error: `default` not allowed; requires interface scope [ModifierRequiresInterface] // CHECK:STDERR: default default let g: i32 = 1; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+11]]:11: error: `private` not allowed on declaration with `protected` [ModifierNotAllowedWith] -// CHECK:STDERR: protected private let h: i32 = 1; -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+8]]:1: note: `protected` previously appeared here [ModifierPrevious] -// CHECK:STDERR: protected private let h: i32 = 1; -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+5]]:11-17: error: `private` not allowed on declaration with `protected` [ModifierNotAllowedWith] +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1-9: note: `protected` previously appeared here [ModifierPrevious] // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `protected` not allowed; requires class scope [ModifierProtectedNotAllowed] -// CHECK:STDERR: protected private let h: i32 = 1; -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-9: error: `protected` not allowed; requires class scope [ModifierProtectedNotAllowed] // CHECK:STDERR: protected private let h: i32 = 1; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+11]]:11: error: `protected` repeated on declaration [ModifierRepeated] -// CHECK:STDERR: protected protected let i: i32 = 1; -// CHECK:STDERR: ^~~~~~~~~ -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+8]]:1: note: `protected` previously appeared here [ModifierPrevious] -// CHECK:STDERR: protected protected let i: i32 = 1; -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+5]]:11-19: error: `protected` repeated on declaration [ModifierRepeated] +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1-9: note: `protected` previously appeared here [ModifierPrevious] // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `protected` not allowed; requires class scope [ModifierProtectedNotAllowed] -// CHECK:STDERR: protected protected let i: i32 = 1; -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-9: error: `protected` not allowed; requires class scope [ModifierProtectedNotAllowed] // CHECK:STDERR: protected protected let i: i32 = 1; @@ -150,99 +118,99 @@ protected protected let i: i32 = 1; // CHECK:STDOUT: .i [protected] = %i // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %impl.elem0.loc19: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc19_24.1: = bound_method @__global_init.%int_1.loc19, %impl.elem0.loc19 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc19: = specific_function %impl.elem0.loc19, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc19_24.2: = bound_method @__global_init.%int_1.loc19, %specific_fn.loc19 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc19: init %i32 = call %bound_method.loc19_24.2(@__global_init.%int_1.loc19) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc19_24.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc19 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc19_24.2: %i32 = converted @__global_init.%int_1.loc19, %.loc19_24.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %i32.loc19: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %b: %i32 = wrapper_binding b, %.loc19_24.2 +// CHECK:STDOUT: %impl.elem0.loc17: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc17_24.1: = bound_method @__global_init.%int_1.loc17, %impl.elem0.loc17 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc17: = specific_function %impl.elem0.loc17, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc17_24.2: = bound_method @__global_init.%int_1.loc17, %specific_fn.loc17 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc17: init %i32 = call %bound_method.loc17_24.2(@__global_init.%int_1.loc17) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc17_24.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc17 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc17_24.2: %i32 = converted @__global_init.%int_1.loc17, %.loc17_24.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %i32.loc17: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %b: %i32 = wrapper_binding b, %.loc17_24.2 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %b.patt: %pattern_type.d94 = value_binding_pattern b [concrete = constants.%b.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %impl.elem0.loc25: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc25_22.1: = bound_method @__global_init.%int_1.loc25, %impl.elem0.loc25 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc25: = specific_function %impl.elem0.loc25, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc25_22.2: = bound_method @__global_init.%int_1.loc25, %specific_fn.loc25 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc25: init %i32 = call %bound_method.loc25_22.2(@__global_init.%int_1.loc25) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc25_22.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc25 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc25_22.2: %i32 = converted @__global_init.%int_1.loc25, %.loc25_22.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %i32.loc25: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %c: %i32 = wrapper_binding c, %.loc25_22.2 +// CHECK:STDOUT: %impl.elem0.loc21: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc21_22.1: = bound_method @__global_init.%int_1.loc21, %impl.elem0.loc21 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc21: = specific_function %impl.elem0.loc21, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc21_22.2: = bound_method @__global_init.%int_1.loc21, %specific_fn.loc21 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc21: init %i32 = call %bound_method.loc21_22.2(@__global_init.%int_1.loc21) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc21_22.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc21 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc21_22.2: %i32 = converted @__global_init.%int_1.loc21, %.loc21_22.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %i32.loc21: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %c: %i32 = wrapper_binding c, %.loc21_22.2 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %c.patt: %pattern_type.d94 = value_binding_pattern c [concrete = constants.%c.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %impl.elem0.loc31: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc31_20.1: = bound_method @__global_init.%int_1.loc31, %impl.elem0.loc31 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc31: = specific_function %impl.elem0.loc31, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc31_20.2: = bound_method @__global_init.%int_1.loc31, %specific_fn.loc31 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc31: init %i32 = call %bound_method.loc31_20.2(@__global_init.%int_1.loc31) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc31_20.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc31 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc31_20.2: %i32 = converted @__global_init.%int_1.loc31, %.loc31_20.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %i32.loc31: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %d: %i32 = wrapper_binding d, %.loc31_20.2 +// CHECK:STDOUT: %impl.elem0.loc25: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc25_20.1: = bound_method @__global_init.%int_1.loc25, %impl.elem0.loc25 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc25: = specific_function %impl.elem0.loc25, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc25_20.2: = bound_method @__global_init.%int_1.loc25, %specific_fn.loc25 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc25: init %i32 = call %bound_method.loc25_20.2(@__global_init.%int_1.loc25) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc25_20.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc25 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc25_20.2: %i32 = converted @__global_init.%int_1.loc25, %.loc25_20.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %i32.loc25: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %d: %i32 = wrapper_binding d, %.loc25_20.2 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %d.patt: %pattern_type.d94 = value_binding_pattern d [concrete = constants.%d.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %impl.elem0.loc37: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc37_22.1: = bound_method @__global_init.%int_1.loc37, %impl.elem0.loc37 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc37: = specific_function %impl.elem0.loc37, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc37_22.2: = bound_method @__global_init.%int_1.loc37, %specific_fn.loc37 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc37: init %i32 = call %bound_method.loc37_22.2(@__global_init.%int_1.loc37) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc37_22.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc37 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc37_22.2: %i32 = converted @__global_init.%int_1.loc37, %.loc37_22.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %i32.loc37: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %e: %i32 = wrapper_binding e, %.loc37_22.2 +// CHECK:STDOUT: %impl.elem0.loc29: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc29_22.1: = bound_method @__global_init.%int_1.loc29, %impl.elem0.loc29 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc29: = specific_function %impl.elem0.loc29, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc29_22.2: = bound_method @__global_init.%int_1.loc29, %specific_fn.loc29 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc29: init %i32 = call %bound_method.loc29_22.2(@__global_init.%int_1.loc29) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc29_22.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc29 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc29_22.2: %i32 = converted @__global_init.%int_1.loc29, %.loc29_22.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %i32.loc29: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %e: %i32 = wrapper_binding e, %.loc29_22.2 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %e.patt: %pattern_type.d94 = value_binding_pattern e [concrete = constants.%e.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %impl.elem0.loc50: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc50_28.1: = bound_method @__global_init.%int_1.loc50, %impl.elem0.loc50 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc50: = specific_function %impl.elem0.loc50, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc50_28.2: = bound_method @__global_init.%int_1.loc50, %specific_fn.loc50 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc50: init %i32 = call %bound_method.loc50_28.2(@__global_init.%int_1.loc50) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc50_28.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc50 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc50_28.2: %i32 = converted @__global_init.%int_1.loc50, %.loc50_28.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %i32.loc50: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %f: %i32 = wrapper_binding f, %.loc50_28.2 +// CHECK:STDOUT: %impl.elem0.loc36: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc36_28.1: = bound_method @__global_init.%int_1.loc36, %impl.elem0.loc36 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc36: = specific_function %impl.elem0.loc36, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc36_28.2: = bound_method @__global_init.%int_1.loc36, %specific_fn.loc36 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc36: init %i32 = call %bound_method.loc36_28.2(@__global_init.%int_1.loc36) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc36_28.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc36 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc36_28.2: %i32 = converted @__global_init.%int_1.loc36, %.loc36_28.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %i32.loc36: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %f: %i32 = wrapper_binding f, %.loc36_28.2 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %f.patt: %pattern_type.d94 = value_binding_pattern f [concrete = constants.%f.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %impl.elem0.loc63: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc63_30.1: = bound_method @__global_init.%int_1.loc63, %impl.elem0.loc63 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc63: = specific_function %impl.elem0.loc63, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc63_30.2: = bound_method @__global_init.%int_1.loc63, %specific_fn.loc63 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc63: init %i32 = call %bound_method.loc63_30.2(@__global_init.%int_1.loc63) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc63_30.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc63 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc63_30.2: %i32 = converted @__global_init.%int_1.loc63, %.loc63_30.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %i32.loc63: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %g: %i32 = wrapper_binding g, %.loc63_30.2 +// CHECK:STDOUT: %impl.elem0.loc43: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc43_30.1: = bound_method @__global_init.%int_1.loc43, %impl.elem0.loc43 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc43: = specific_function %impl.elem0.loc43, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc43_30.2: = bound_method @__global_init.%int_1.loc43, %specific_fn.loc43 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc43: init %i32 = call %bound_method.loc43_30.2(@__global_init.%int_1.loc43) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc43_30.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc43 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc43_30.2: %i32 = converted @__global_init.%int_1.loc43, %.loc43_30.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %i32.loc43: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %g: %i32 = wrapper_binding g, %.loc43_30.2 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %g.patt: %pattern_type.d94 = value_binding_pattern g [concrete = constants.%g.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %impl.elem0.loc76: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc76_32.1: = bound_method @__global_init.%int_1.loc76, %impl.elem0.loc76 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc76: = specific_function %impl.elem0.loc76, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc76_32.2: = bound_method @__global_init.%int_1.loc76, %specific_fn.loc76 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc76: init %i32 = call %bound_method.loc76_32.2(@__global_init.%int_1.loc76) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc76_32.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc76 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc76_32.2: %i32 = converted @__global_init.%int_1.loc76, %.loc76_32.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %i32.loc76: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %h: %i32 = wrapper_binding h, %.loc76_32.2 +// CHECK:STDOUT: %impl.elem0.loc50: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc50_32.1: = bound_method @__global_init.%int_1.loc50, %impl.elem0.loc50 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc50: = specific_function %impl.elem0.loc50, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc50_32.2: = bound_method @__global_init.%int_1.loc50, %specific_fn.loc50 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc50: init %i32 = call %bound_method.loc50_32.2(@__global_init.%int_1.loc50) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc50_32.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc50 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc50_32.2: %i32 = converted @__global_init.%int_1.loc50, %.loc50_32.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %i32.loc50: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %h: %i32 = wrapper_binding h, %.loc50_32.2 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %h.patt: %pattern_type.d94 = value_binding_pattern h [concrete = constants.%h.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %impl.elem0.loc89: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc89_34.1: = bound_method @__global_init.%int_1.loc89, %impl.elem0.loc89 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc89: = specific_function %impl.elem0.loc89, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc89_34.2: = bound_method @__global_init.%int_1.loc89, %specific_fn.loc89 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc89: init %i32 = call %bound_method.loc89_34.2(@__global_init.%int_1.loc89) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc89_34.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc89 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc89_34.2: %i32 = converted @__global_init.%int_1.loc89, %.loc89_34.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %i32.loc89: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %i: %i32 = wrapper_binding i, %.loc89_34.2 +// CHECK:STDOUT: %impl.elem0.loc57: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc57_34.1: = bound_method @__global_init.%int_1.loc57, %impl.elem0.loc57 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc57: = specific_function %impl.elem0.loc57, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc57_34.2: = bound_method @__global_init.%int_1.loc57, %specific_fn.loc57 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc57: init %i32 = call %bound_method.loc57_34.2(@__global_init.%int_1.loc57) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc57_34.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc57 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc57_34.2: %i32 = converted @__global_init.%int_1.loc57, %.loc57_34.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %i32.loc57: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i: %i32 = wrapper_binding i, %.loc57_34.2 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %i.patt: %pattern_type.d94 = value_binding_pattern i [concrete = constants.%i.patt] // CHECK:STDOUT: } @@ -250,14 +218,14 @@ protected protected let i: i32 = 1; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int_1.loc19: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_1.loc17: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_1.loc21: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] // CHECK:STDOUT: %int_1.loc25: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %int_1.loc31: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %int_1.loc37: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_1.loc29: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_1.loc36: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_1.loc43: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] // CHECK:STDOUT: %int_1.loc50: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %int_1.loc63: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %int_1.loc76: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %int_1.loc89: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_1.loc57: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/let/fail_use_in_init.carbon b/toolchain/check/testdata/let/fail_use_in_init.carbon index 75896a329f33..38820ce3a9ce 100644 --- a/toolchain/check/testdata/let/fail_use_in_init.carbon +++ b/toolchain/check/testdata/let/fail_use_in_init.carbon @@ -13,16 +13,10 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/let/fail_use_in_init.carbon fn F() { - // CHECK:STDERR: fail_use_in_init.carbon:[[@LINE+11]]:23: error: `a` used before initialization [UsedBeforeInitialization] - // CHECK:STDERR: let unused a: i32 = a; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_use_in_init.carbon:[[@LINE+5]]:23: error: `a` used before initialization [UsedBeforeInitialization] // CHECK:STDERR: - // CHECK:STDERR: fail_use_in_init.carbon:[[@LINE+7]]:14: error: variable `a` marked `unused` but used [UnusedButUsed] - // CHECK:STDERR: let unused a: i32 = a; - // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_use_in_init.carbon:[[@LINE+4]]:23: note: usage here [UnusedButUsedHere] - // CHECK:STDERR: let unused a: i32 = a; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_use_in_init.carbon:[[@LINE+3]]:14-19: error: variable `a` marked `unused` but used [UnusedButUsed] + // CHECK:STDERR: fail_use_in_init.carbon:[[@LINE+2]]:23: note: usage here [UnusedButUsedHere] // CHECK:STDERR: let unused a: i32 = a; } diff --git a/toolchain/check/testdata/let/form.carbon b/toolchain/check/testdata/let/form.carbon index a313bf6e2336..9a1c65a01c58 100644 --- a/toolchain/check/testdata/let/form.carbon +++ b/toolchain/check/testdata/let/form.carbon @@ -13,15 +13,9 @@ // --- fail_todo_form_binding.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_todo_form_binding.carbon:[[@LINE+11]]:9: error: cannot implicitly convert expression of type `()` to `Core.Form` [ConversionFailure] -// CHECK:STDERR: let x:? () = (); -// CHECK:STDERR: ^~ -// CHECK:STDERR: fail_todo_form_binding.carbon:[[@LINE+8]]:9: note: type `()` does not implement interface `Core.ImplicitAs(Core.Form)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: let x:? () = (); -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_todo_form_binding.carbon:[[@LINE+5]]:9-10: error: cannot implicitly convert expression of type `()` to `Core.Form` [ConversionFailure] +// CHECK:STDERR: fail_todo_form_binding.carbon:[[@LINE+4]]:9-10: note: type `()` does not implement interface `Core.ImplicitAs(Core.Form)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_form_binding.carbon:[[@LINE+4]]:5: error: semantics TODO: `support local form bindings` [SemanticsTodo] -// CHECK:STDERR: let x:? () = (); -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_todo_form_binding.carbon:[[@LINE+2]]:5-10: error: semantics TODO: `support local form bindings` [SemanticsTodo] // CHECK:STDERR: let x:? () = (); diff --git a/toolchain/check/testdata/let/generic.carbon b/toolchain/check/testdata/let/generic.carbon index 83af9c994f01..c4662ec36652 100644 --- a/toolchain/check/testdata/let/generic.carbon +++ b/toolchain/check/testdata/let/generic.carbon @@ -16,9 +16,7 @@ library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: fail_todo_type.carbon:[[@LINE+4]]:15: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] - // CHECK:STDERR: let generic T: type = i32; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_todo_type.carbon:[[@LINE+2]]:15-21: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] // CHECK:STDERR: let generic T: type = i32; var p: T*; @@ -29,9 +27,7 @@ fn F() { library "[[@TEST_NAME]]"; fn F(a: i32) -> i32 { - // CHECK:STDERR: fail_todo_assignment.carbon:[[@LINE+4]]:15: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] - // CHECK:STDERR: let generic T: type = i32; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_todo_assignment.carbon:[[@LINE+2]]:15-21: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] // CHECK:STDERR: let generic T: type = i32; let x: T = 5; diff --git a/toolchain/check/testdata/let/generic_import.carbon b/toolchain/check/testdata/let/generic_import.carbon index a68fef7a09ed..ad5b2267aef7 100644 --- a/toolchain/check/testdata/let/generic_import.carbon +++ b/toolchain/check/testdata/let/generic_import.carbon @@ -16,9 +16,7 @@ package Implicit; -// CHECK:STDERR: fail_implicit.carbon:[[@LINE+4]]:13: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] -// CHECK:STDERR: let generic T: type = i32; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_implicit.carbon:[[@LINE+2]]:13-19: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] // CHECK:STDERR: let generic T: type = i32; @@ -26,14 +24,10 @@ let generic T: type = i32; impl package Implicit; -// CHECK:STDERR: fail_implicit.impl.carbon:[[@LINE+4]]:8: error: cannot evaluate type expression [TypeExprEvaluationFailure] -// CHECK:STDERR: var a: T*; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_implicit.impl.carbon:[[@LINE+2]]:8-9: error: cannot evaluate type expression [TypeExprEvaluationFailure] // CHECK:STDERR: var a: T*; -// CHECK:STDERR: fail_implicit.impl.carbon:[[@LINE+4]]:8: error: cannot evaluate type expression [TypeExprEvaluationFailure] -// CHECK:STDERR: var b: T = *a; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_implicit.impl.carbon:[[@LINE+2]]:8: error: cannot evaluate type expression [TypeExprEvaluationFailure] // CHECK:STDERR: var b: T = *a; @@ -65,9 +59,9 @@ var b: T = *a; // CHECK:STDOUT: .T = %T // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %.loc8_16.1: type = splice_block %.loc8_16.2 [concrete = type] { +// CHECK:STDOUT: %.loc6_16.1: type = splice_block %.loc6_16.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc8_16.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc6_16.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } // CHECK:STDOUT: %T: type = wrapper_binding T, @__global_init.%i32 // CHECK:STDOUT: name_binding_decl { @@ -106,8 +100,8 @@ var b: T = *a; // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %a.var: ref = var_storage %a.var_patt [concrete = ] -// CHECK:STDOUT: %.loc8: type = splice_block %ptr [concrete = ] { -// CHECK:STDOUT: %T.ref.loc8: type = name_ref T, imports.%Implicit.T +// CHECK:STDOUT: %.loc6: type = splice_block %ptr [concrete = ] { +// CHECK:STDOUT: %T.ref.loc6: type = name_ref T, imports.%Implicit.T // CHECK:STDOUT: %ptr: type = ptr_type [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %a: = wrapper_binding a, [concrete = ] @@ -116,7 +110,7 @@ var b: T = *a; // CHECK:STDOUT: %a.var_patt: = var_pattern %a.patt [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %b.var: ref = var_storage %b.var_patt [concrete = ] -// CHECK:STDOUT: %T.ref.loc13: type = name_ref T, imports.%Implicit.T +// CHECK:STDOUT: %T.ref.loc9: type = name_ref T, imports.%Implicit.T // CHECK:STDOUT: %b: = wrapper_binding b, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %b.patt: = ref_binding_pattern b [concrete = ] @@ -128,7 +122,7 @@ var b: T = *a; // CHECK:STDOUT: !entry: // CHECK:STDOUT: assign file.%a.var, // CHECK:STDOUT: %a.ref: = name_ref a, file.%a [concrete = ] -// CHECK:STDOUT: %.loc13: ref = deref [concrete = ] +// CHECK:STDOUT: %.loc9: ref = deref [concrete = ] // CHECK:STDOUT: assign file.%b.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/let/import_access.carbon b/toolchain/check/testdata/let/import_access.carbon index 0c345a062ff3..141f71bafcb8 100644 --- a/toolchain/check/testdata/let/import_access.carbon +++ b/toolchain/check/testdata/let/import_access.carbon @@ -38,9 +38,7 @@ package Test library "[[@TEST_NAME]]"; import library "def"; -// CHECK:STDERR: fail_local_def.carbon:[[@LINE+4]]:14: error: name `v` not found [NameNotFound] -// CHECK:STDERR: let v2: () = v; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_local_def.carbon:[[@LINE+2]]:14: error: name `v` not found [NameNotFound] // CHECK:STDERR: let v2: () = v; @@ -50,9 +48,7 @@ package Other library "[[@TEST_NAME]]"; import Test library "def"; -// CHECK:STDERR: fail_other_def.carbon:[[@LINE+4]]:14: error: member name `v` not found in `Test` [MemberNameNotFoundInInstScope] -// CHECK:STDERR: let v2: () = Test.v; -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_other_def.carbon:[[@LINE+2]]:14-19: error: member name `v` not found in `Test` [MemberNameNotFoundInInstScope] // CHECK:STDERR: let v2: () = Test.v; @@ -141,9 +137,9 @@ let v2: () = Test.v; // CHECK:STDOUT: .v = // CHECK:STDOUT: } // CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: %.loc10_10.1: type = splice_block %.loc10_10.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc10_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc10_10.3: type = converted %.loc10_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc8_10.1: type = splice_block %.loc8_10.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc8_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_10.3: type = converted %.loc8_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %v2: %empty_tuple.type = wrapper_binding v2, [concrete = ] // CHECK:STDOUT: name_binding_decl { @@ -180,9 +176,9 @@ let v2: () = Test.v; // CHECK:STDOUT: .v2 = %v2 // CHECK:STDOUT: } // CHECK:STDOUT: %Test.import = import Test -// CHECK:STDOUT: %.loc10_10.1: type = splice_block %.loc10_10.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc10_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc10_10.3: type = converted %.loc10_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc8_10.1: type = splice_block %.loc8_10.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc8_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_10.3: type = converted %.loc8_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %v2: %empty_tuple.type = wrapper_binding v2, [concrete = ] // CHECK:STDOUT: name_binding_decl { diff --git a/toolchain/check/testdata/let/local.carbon b/toolchain/check/testdata/let/local.carbon index e75ebc0df460..f15d26c94144 100644 --- a/toolchain/check/testdata/let/local.carbon +++ b/toolchain/check/testdata/let/local.carbon @@ -29,9 +29,7 @@ fn F(_: C) {} fn CallF() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_symbolic.carbon:[[@LINE+4]]:15: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] - // CHECK:STDERR: let generic c: C = {}; - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_todo_symbolic.carbon:[[@LINE+2]]:15-18: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] // CHECK:STDERR: let generic c: C = {}; F(c); diff --git a/toolchain/check/testdata/let/ref.carbon b/toolchain/check/testdata/let/ref.carbon index da4d0850e65f..43e984ac711d 100644 --- a/toolchain/check/testdata/let/ref.carbon +++ b/toolchain/check/testdata/let/ref.carbon @@ -27,9 +27,7 @@ fn F(a: i32) { library "[[@TEST_NAME]]"; fn F(a: i32) { - // CHECK:STDERR: fail_ref_to_value.carbon:[[@LINE+4]]:27: error: cannot bind durable reference to non-reference value of type `i32` [ConversionFailureNonRefToRef] - // CHECK:STDERR: let unused ref b: i32 = a; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_ref_to_value.carbon:[[@LINE+2]]:27: error: cannot bind durable reference to non-reference value of type `i32` [ConversionFailureNonRefToRef] // CHECK:STDERR: let unused ref b: i32 = a; } @@ -41,9 +39,7 @@ library "[[@TEST_NAME]]"; fn G() -> i32; fn F() { - // CHECK:STDERR: fail_ref_to_temporary.carbon:[[@LINE+4]]:27: error: cannot bind durable reference to non-reference value of type `i32` [ConversionFailureNonRefToRef] - // CHECK:STDERR: let unused ref a: i32 = G(); - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_ref_to_temporary.carbon:[[@LINE+2]]:27-29: error: cannot bind durable reference to non-reference value of type `i32` [ConversionFailureNonRefToRef] // CHECK:STDERR: let unused ref a: i32 = G(); } diff --git a/toolchain/check/testdata/main_run/fail_mismatch_params.carbon b/toolchain/check/testdata/main_run/fail_mismatch_params.carbon index 49131f37b492..8d3d55aba1b0 100644 --- a/toolchain/check/testdata/main_run/fail_mismatch_params.carbon +++ b/toolchain/check/testdata/main_run/fail_mismatch_params.carbon @@ -14,9 +14,7 @@ library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_argc.carbon:[[@LINE+4]]:1: error: invalid parameters for `Main.Run` function; expected `()` or `(argc: i32, argv: Core.Optional(char*)*)` [InvalidMainRunParameters] -// CHECK:STDERR: fn Run(unused n: i64) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_argc.carbon:[[@LINE+2]]:1-23: error: invalid parameters for `Main.Run` function; expected `()` or `(argc: i32, argv: Core.Optional(char*)*)` [InvalidMainRunParameters] // CHECK:STDERR: fn Run(unused n: i64) {} @@ -24,9 +22,7 @@ fn Run(unused n: i64) {} library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_argv.carbon:[[@LINE+4]]:1: error: invalid parameters for `Main.Run` function; expected `()` or `(argc: i32, argv: Core.Optional(char*)*)` [InvalidMainRunParameters] -// CHECK:STDERR: fn Run(unused n: i32, unused p: i32) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_argv.carbon:[[@LINE+2]]:1-38: error: invalid parameters for `Main.Run` function; expected `()` or `(argc: i32, argv: Core.Optional(char*)*)` [InvalidMainRunParameters] // CHECK:STDERR: fn Run(unused n: i32, unused p: i32) {} @@ -34,8 +30,6 @@ fn Run(unused n: i32, unused p: i32) {} library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_many_params.carbon:[[@LINE+4]]:1: error: invalid parameters for `Main.Run` function; expected `()` or `(argc: i32, argv: Core.Optional(char*)*)` [InvalidMainRunParameters] -// CHECK:STDERR: fn Run(unused n: i32, unused p: i32*, unused q: i32*) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_too_many_params.carbon:[[@LINE+2]]:1-55: error: invalid parameters for `Main.Run` function; expected `()` or `(argc: i32, argv: Core.Optional(char*)*)` [InvalidMainRunParameters] // CHECK:STDERR: fn Run(unused n: i32, unused p: i32*, unused q: i32*) {} diff --git a/toolchain/check/testdata/main_run/fail_mismatch_return.carbon b/toolchain/check/testdata/main_run/fail_mismatch_return.carbon index 51aea86ebb94..9256b578c8b3 100644 --- a/toolchain/check/testdata/main_run/fail_mismatch_return.carbon +++ b/toolchain/check/testdata/main_run/fail_mismatch_return.carbon @@ -10,9 +10,7 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/main_run/fail_mismatch_return.carbon -// CHECK:STDERR: fail_mismatch_return.carbon:[[@LINE+4]]:1: error: invalid return type for `Main.Run` function; expected `fn (...)` or `fn (...) -> i32` [InvalidMainRunReturnType] -// CHECK:STDERR: fn Run() -> f64 { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_mismatch_return.carbon:[[@LINE+2]]:1-17: error: invalid return type for `Main.Run` function; expected `fn (...)` or `fn (...) -> i32` [InvalidMainRunReturnType] // CHECK:STDERR: fn Run() -> f64 { return 0.0; diff --git a/toolchain/check/testdata/main_run/fail_mismatch_return_auto.carbon b/toolchain/check/testdata/main_run/fail_mismatch_return_auto.carbon index 1e2e9b107f3e..e4759512e5c5 100644 --- a/toolchain/check/testdata/main_run/fail_mismatch_return_auto.carbon +++ b/toolchain/check/testdata/main_run/fail_mismatch_return_auto.carbon @@ -10,9 +10,7 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/main_run/fail_mismatch_return_auto.carbon -// CHECK:STDERR: fail_mismatch_return_auto.carbon:[[@LINE+4]]:1: error: invalid return type for `Main.Run` function; expected `fn (...)` or `fn (...) -> i32` [InvalidMainRunReturnType] -// CHECK:STDERR: fn Run() -> auto { -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_mismatch_return_auto.carbon:[[@LINE+2]]:1-18: error: invalid return type for `Main.Run` function; expected `fn (...)` or `fn (...) -> i32` [InvalidMainRunReturnType] // CHECK:STDERR: fn Run() -> auto { return 0.0; diff --git a/toolchain/check/testdata/match_first/basic.carbon b/toolchain/check/testdata/match_first/basic.carbon index d1ae585a1a65..15aeafa81c25 100644 --- a/toolchain/check/testdata/match_first/basic.carbon +++ b/toolchain/check/testdata/match_first/basic.carbon @@ -54,12 +54,8 @@ library "[[@TEST_NAME]]"; interface Z {} match_first { - // CHECK:STDERR: fail_final_inside.carbon:[[@LINE+7]]:3: error: `final impl` in `match_first` block [FinalImplInMatchFirst] - // CHECK:STDERR: final impl () as Z {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_final_inside.carbon:[[@LINE-4]]:1: note: the `match_first` block can be modified as `final` instead [FinalImplInMatchFirstNote] - // CHECK:STDERR: match_first { - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_final_inside.carbon:[[@LINE+3]]:3-22: error: `final impl` in `match_first` block [FinalImplInMatchFirst] + // CHECK:STDERR: fail_final_inside.carbon:[[@LINE-2]]:1-13: note: the `match_first` block can be modified as `final` instead [FinalImplInMatchFirstNote] // CHECK:STDERR: final impl () as Z {} } @@ -69,9 +65,7 @@ library "[[@TEST_NAME]]"; interface Z {} -// CHECK:STDERR: fail_final_redecl.carbon:[[@LINE+4]]:1: error: impl declared but not defined [ImplMissingDefinition] -// CHECK:STDERR: final impl () as Z; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_final_redecl.carbon:[[@LINE+2]]:1-19: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: final impl () as Z; match_first { @@ -91,9 +85,7 @@ match_first { // This is not seen as a redecl of the `final impl`. It's not valid to write // an `impl` in `match_first` that overlaps a `final impl`, but we already // have a diagnostic. - // CHECK:STDERR: fail_final_redecl_defined_once.carbon:[[@LINE+4]]:3: error: impl declared but not defined [ImplMissingDefinition] - // CHECK:STDERR: impl () as Z; - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_final_redecl_defined_once.carbon:[[@LINE+2]]:3-15: error: impl declared but not defined [ImplMissingDefinition] // CHECK:STDERR: impl () as Z; } @@ -108,12 +100,8 @@ match_first { // This is not seen as a redecl of the `final impl`. It's not valid to write // an `impl` in `match_first` that overlaps a `final impl`, but we already // have a diagnostic. - // CHECK:STDERR: fail_final_redecl_defined_twice.carbon:[[@LINE+7]]:3: error: `impl` will never be used [ImplFinalOverlapsNonFinal] - // CHECK:STDERR: impl () as Z {} - // CHECK:STDERR: ^~~~~~~~~~~~~~ - // CHECK:STDERR: fail_final_redecl_defined_twice.carbon:[[@LINE-8]]:1: note: `final impl` declared here would always be used instead [ImplFinalOverlapsNonFinalNote] - // CHECK:STDERR: final impl () as Z {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_final_redecl_defined_twice.carbon:[[@LINE+3]]:3-16: error: `impl` will never be used [ImplFinalOverlapsNonFinal] + // CHECK:STDERR: fail_final_redecl_defined_twice.carbon:[[@LINE-6]]:1-20: note: `final impl` declared here would always be used instead [ImplFinalOverlapsNonFinalNote] // CHECK:STDERR: impl () as Z {} } @@ -128,12 +116,8 @@ match_first { // This _is_ seen as a redecl of the `final impl`. It's not valid to write // an `impl` in `match_first` that overlaps a `final impl`, but we already // have a diagnostic. - // CHECK:STDERR: fail_final_final_redecl.carbon:[[@LINE+7]]:3: error: `final impl` in `match_first` block [FinalImplInMatchFirst] - // CHECK:STDERR: final impl () as Z {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_final_final_redecl.carbon:[[@LINE-7]]:1: note: the `match_first` block can be modified as `final` instead [FinalImplInMatchFirstNote] - // CHECK:STDERR: match_first { - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_final_final_redecl.carbon:[[@LINE+3]]:3-22: error: `final impl` in `match_first` block [FinalImplInMatchFirst] + // CHECK:STDERR: fail_final_final_redecl.carbon:[[@LINE-5]]:1-13: note: the `match_first` block can be modified as `final` instead [FinalImplInMatchFirstNote] // CHECK:STDERR: final impl () as Z {} } @@ -201,12 +185,8 @@ interface Z {} impl () as Z {} match_first { - // CHECK:STDERR: fail_redecl_with_definition_after_defined.carbon:[[@LINE+7]]:3: error: redefinition of `impl () as Z` [ImplRedefinition] - // CHECK:STDERR: impl () as Z {} - // CHECK:STDERR: ^~~~~~~~~~~~~~ - // CHECK:STDERR: fail_redecl_with_definition_after_defined.carbon:[[@LINE-5]]:1: note: previous definition was here [ImplPreviousDefinition] - // CHECK:STDERR: impl () as Z {} - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_redecl_with_definition_after_defined.carbon:[[@LINE+3]]:3-16: error: redefinition of `impl () as Z` [ImplRedefinition] + // CHECK:STDERR: fail_redecl_with_definition_after_defined.carbon:[[@LINE-3]]:1-14: note: previous definition was here [ImplPreviousDefinition] // CHECK:STDERR: impl () as Z {} } @@ -238,12 +218,8 @@ library "[[@TEST_NAME]]"; interface Z {} interface Y { - // CHECK:STDERR: fail_inside_interface.carbon:[[@LINE+7]]:3: error: found `match_first` in invalid scope; expected namespace or class [MatchFirstInWrongScope] - // CHECK:STDERR: match_first { - // CHECK:STDERR: ^~~~~~~~~~~~~ - // CHECK:STDERR: fail_inside_interface.carbon:[[@LINE-4]]:1: note: in enclosing scope here [MatchFirstInWrongScopeNote] - // CHECK:STDERR: interface Y { - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_inside_interface.carbon:[[@LINE+3]]:3-15: error: found `match_first` in invalid scope; expected namespace or class [MatchFirstInWrongScope] + // CHECK:STDERR: fail_inside_interface.carbon:[[@LINE-2]]:1-13: note: in enclosing scope here [MatchFirstInWrongScopeNote] // CHECK:STDERR: match_first { impl Self as Z {} @@ -256,12 +232,8 @@ library "[[@TEST_NAME]]"; interface Z {} constraint N { - // CHECK:STDERR: fail_inside_constraint.carbon:[[@LINE+7]]:3: error: found `match_first` in invalid scope; expected namespace or class [MatchFirstInWrongScope] - // CHECK:STDERR: match_first { - // CHECK:STDERR: ^~~~~~~~~~~~~ - // CHECK:STDERR: fail_inside_constraint.carbon:[[@LINE-4]]:1: note: in enclosing scope here [MatchFirstInWrongScopeNote] - // CHECK:STDERR: constraint N { - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_inside_constraint.carbon:[[@LINE+3]]:3-15: error: found `match_first` in invalid scope; expected namespace or class [MatchFirstInWrongScope] + // CHECK:STDERR: fail_inside_constraint.carbon:[[@LINE-2]]:1-14: note: in enclosing scope here [MatchFirstInWrongScopeNote] // CHECK:STDERR: match_first { impl Self as Z {} @@ -274,9 +246,7 @@ library "[[@TEST_NAME]]"; interface Z {} match_first { - // CHECK:STDERR: fail_inside_match_first.carbon:[[@LINE+5]]:3: error: found `match_first` in invalid scope; expected namespace or class [MatchFirstInWrongScope] - // CHECK:STDERR: match_first { - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_inside_match_first.carbon:[[@LINE+3]]:3-15: error: found `match_first` in invalid scope; expected namespace or class [MatchFirstInWrongScope] // CHECK:STDERR: fail_inside_match_first.carbon: note: in enclosing scope here [MatchFirstInWrongScopeNote] // CHECK:STDERR: match_first { @@ -291,12 +261,8 @@ interface Z {} match_first { impl () as Z; - // CHECK:STDERR: fail_redecl_in_same_block.carbon:[[@LINE+7]]:3: error: impl declared in `match_first` more than once [ImplInTwoMatchFirst] - // CHECK:STDERR: impl () as Z; - // CHECK:STDERR: ^~~~~~~~~~~~~ - // CHECK:STDERR: fail_redecl_in_same_block.carbon:[[@LINE-4]]:3: note: previous declaration here [ImplInTwoMatchFirstNote] - // CHECK:STDERR: impl () as Z; - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_redecl_in_same_block.carbon:[[@LINE+3]]:3-15: error: impl declared in `match_first` more than once [ImplInTwoMatchFirst] + // CHECK:STDERR: fail_redecl_in_same_block.carbon:[[@LINE-2]]:3-15: note: previous declaration here [ImplInTwoMatchFirstNote] // CHECK:STDERR: impl () as Z; } @@ -309,12 +275,8 @@ interface Z {} match_first { impl () as Z; - // CHECK:STDERR: fail_defined_in_same_block.carbon:[[@LINE+7]]:3: error: impl declared in `match_first` more than once [ImplInTwoMatchFirst] - // CHECK:STDERR: impl () as Z {} - // CHECK:STDERR: ^~~~~~~~~~~~~~ - // CHECK:STDERR: fail_defined_in_same_block.carbon:[[@LINE-4]]:3: note: previous declaration here [ImplInTwoMatchFirstNote] - // CHECK:STDERR: impl () as Z; - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_defined_in_same_block.carbon:[[@LINE+3]]:3-16: error: impl declared in `match_first` more than once [ImplInTwoMatchFirst] + // CHECK:STDERR: fail_defined_in_same_block.carbon:[[@LINE-2]]:3-15: note: previous declaration here [ImplInTwoMatchFirstNote] // CHECK:STDERR: impl () as Z {} } @@ -326,12 +288,8 @@ interface Z {} match_first { impl () as Z {} - // CHECK:STDERR: fail_redecl_after_defined_in_same_block.carbon:[[@LINE+7]]:3: error: impl declared in `match_first` more than once [ImplInTwoMatchFirst] - // CHECK:STDERR: impl () as Z; - // CHECK:STDERR: ^~~~~~~~~~~~~ - // CHECK:STDERR: fail_redecl_after_defined_in_same_block.carbon:[[@LINE-4]]:3: note: previous declaration here [ImplInTwoMatchFirstNote] - // CHECK:STDERR: impl () as Z {} - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_redecl_after_defined_in_same_block.carbon:[[@LINE+3]]:3-15: error: impl declared in `match_first` more than once [ImplInTwoMatchFirst] + // CHECK:STDERR: fail_redecl_after_defined_in_same_block.carbon:[[@LINE-2]]:3-16: note: previous declaration here [ImplInTwoMatchFirstNote] // CHECK:STDERR: impl () as Z; } @@ -345,12 +303,8 @@ impl () as Z {} match_first { impl () as Z; // TODO: This "previous declaration" location is wrong. The redecl came after. - // CHECK:STDERR: fail_two_redecl_in_same_block.carbon:[[@LINE+7]]:3: error: impl declared in `match_first` more than once [ImplInTwoMatchFirst] - // CHECK:STDERR: impl () as Z; - // CHECK:STDERR: ^~~~~~~~~~~~~ - // CHECK:STDERR: fail_two_redecl_in_same_block.carbon:[[@LINE-5]]:3: note: previous declaration here [ImplInTwoMatchFirstNote] - // CHECK:STDERR: impl () as Z; - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_two_redecl_in_same_block.carbon:[[@LINE+3]]:3-15: error: impl declared in `match_first` more than once [ImplInTwoMatchFirst] + // CHECK:STDERR: fail_two_redecl_in_same_block.carbon:[[@LINE-3]]:3-15: note: previous declaration here [ImplInTwoMatchFirstNote] // CHECK:STDERR: impl () as Z; } @@ -364,12 +318,8 @@ match_first { impl () as Z; } match_first { - // CHECK:STDERR: fail_redecl_in_different_block.carbon:[[@LINE+7]]:3: error: impl declared in `match_first` more than once [ImplInTwoMatchFirst] - // CHECK:STDERR: impl () as Z; - // CHECK:STDERR: ^~~~~~~~~~~~~ - // CHECK:STDERR: fail_redecl_in_different_block.carbon:[[@LINE-6]]:3: note: previous declaration here [ImplInTwoMatchFirstNote] - // CHECK:STDERR: impl () as Z; - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_redecl_in_different_block.carbon:[[@LINE+3]]:3-15: error: impl declared in `match_first` more than once [ImplInTwoMatchFirst] + // CHECK:STDERR: fail_redecl_in_different_block.carbon:[[@LINE-4]]:3-15: note: previous declaration here [ImplInTwoMatchFirstNote] // CHECK:STDERR: impl () as Z; } @@ -384,12 +334,8 @@ match_first { impl () as Z {} } match_first { - // CHECK:STDERR: fail_redecl_defined_in_different_block_firset.carbon:[[@LINE+7]]:3: error: impl declared in `match_first` more than once [ImplInTwoMatchFirst] - // CHECK:STDERR: impl () as Z; - // CHECK:STDERR: ^~~~~~~~~~~~~ - // CHECK:STDERR: fail_redecl_defined_in_different_block_firset.carbon:[[@LINE-6]]:3: note: previous declaration here [ImplInTwoMatchFirstNote] - // CHECK:STDERR: impl () as Z {} - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_redecl_defined_in_different_block_firset.carbon:[[@LINE+3]]:3-15: error: impl declared in `match_first` more than once [ImplInTwoMatchFirst] + // CHECK:STDERR: fail_redecl_defined_in_different_block_firset.carbon:[[@LINE-4]]:3-16: note: previous declaration here [ImplInTwoMatchFirstNote] // CHECK:STDERR: impl () as Z; } @@ -403,12 +349,8 @@ match_first { impl () as Z; } match_first { - // CHECK:STDERR: fail_redecl_defined_in_different_block_second.carbon:[[@LINE+7]]:3: error: impl declared in `match_first` more than once [ImplInTwoMatchFirst] - // CHECK:STDERR: impl () as Z {} - // CHECK:STDERR: ^~~~~~~~~~~~~~ - // CHECK:STDERR: fail_redecl_defined_in_different_block_second.carbon:[[@LINE-6]]:3: note: previous declaration here [ImplInTwoMatchFirstNote] - // CHECK:STDERR: impl () as Z; - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_redecl_defined_in_different_block_second.carbon:[[@LINE+3]]:3-16: error: impl declared in `match_first` more than once [ImplInTwoMatchFirst] + // CHECK:STDERR: fail_redecl_defined_in_different_block_second.carbon:[[@LINE-4]]:3-15: note: previous declaration here [ImplInTwoMatchFirstNote] // CHECK:STDERR: impl () as Z {} } diff --git a/toolchain/check/testdata/match_first/prioritization.carbon b/toolchain/check/testdata/match_first/prioritization.carbon index e012811f164d..7ddc44702133 100644 --- a/toolchain/check/testdata/match_first/prioritization.carbon +++ b/toolchain/check/testdata/match_first/prioritization.carbon @@ -34,12 +34,8 @@ interface Y {} interface X {} impl forall [T: Y] T as Z where .Z1 = {.y: type} {} -// CHECK:STDERR: fail_overlap_not_allowed_in_different_match_first.carbon:[[@LINE+7]]:1: error: found non-final `impl` with the same type structure as another non-final `impl` [ImplNonFinalSameTypeStructure] -// CHECK:STDERR: impl forall [T: X] T as Z where .Z1 = {.x: type} {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_overlap_not_allowed_in_different_match_first.carbon:[[@LINE-4]]:1: note: other `impl` here [ImplNonFinalSameTypeStructureNote] -// CHECK:STDERR: impl forall [T: Y] T as Z where .Z1 = {.y: type} {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overlap_not_allowed_in_different_match_first.carbon:[[@LINE+3]]:1-50: error: found non-final `impl` with the same type structure as another non-final `impl` [ImplNonFinalSameTypeStructure] +// CHECK:STDERR: fail_overlap_not_allowed_in_different_match_first.carbon:[[@LINE-2]]:1-50: note: other `impl` here [ImplNonFinalSameTypeStructureNote] // CHECK:STDERR: impl forall [T: X] T as Z where .Z1 = {.x: type} {} @@ -154,9 +150,7 @@ fn F() { impl C as X {} // Since C impls X and Y, the first one in the match_first block // should be selected, which is the .y impl. So this should fail. - // CHECK:STDERR: fail_prioritization_does_not_choose_second_declarared.carbon:[[@LINE+4]]:3: error: struct `{.y: type}` has no field named `x` [StructInitUnexpectedFieldInLiteral] - // CHECK:STDERR: {.x = type} as C.(Z.Z1); - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_prioritization_does_not_choose_second_declarared.carbon:[[@LINE+2]]:3-13: error: struct `{.y: type}` has no field named `x` [StructInitUnexpectedFieldInLiteral] // CHECK:STDERR: {.x = type} as C.(Z.Z1); } @@ -184,9 +178,7 @@ fn F() { impl C as X {} // Since C impls X and Y, the first one in the match_first block // should be selected, which is the .x impl. So this should fail. - // CHECK:STDERR: fail_prioritization_does_not_choose_first_declarared.carbon:[[@LINE+4]]:3: error: struct `{.x: type}` has no field named `y` [StructInitUnexpectedFieldInLiteral] - // CHECK:STDERR: {.y = type} as C.(Z.Z1); - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_prioritization_does_not_choose_first_declarared.carbon:[[@LINE+2]]:3-13: error: struct `{.x: type}` has no field named `y` [StructInitUnexpectedFieldInLiteral] // CHECK:STDERR: {.y = type} as C.(Z.Z1); } @@ -257,9 +249,7 @@ match_first { fn F[U: type where .Self impls X and .Self impls Y]() { // The impls are not final, so we can't use the concrete `.Z1` value provided // by the impls here. This conversion should fail. - // CHECK:STDERR: fail_match_first_does_not_imply_final.carbon:[[@LINE+4]]:3: error: `Core.As` implicitly referenced here, but package `Core` not found [CoreNotFound] - // CHECK:STDERR: {.y = type} as U.(Z.Z1); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_match_first_does_not_imply_final.carbon:[[@LINE+2]]:3-25: error: `Core.As` implicitly referenced here, but package `Core` not found [CoreNotFound] // CHECK:STDERR: {.y = type} as U.(Z.Z1); } @@ -373,9 +363,7 @@ match_first { fn F(generic T: Y) { // This query is not concrete, so the impl will not give a final witness, so // we can't use the rewrite constraint's RHS here. - // CHECK:STDERR: fail_non_final_match_first_is_not_final.carbon:[[@LINE+4]]:3: error: `Core.As` implicitly referenced here, but package `Core` not found [CoreNotFound] - // CHECK:STDERR: {.y = type} as ().(Z(C(T)).Z1); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_non_final_match_first_is_not_final.carbon:[[@LINE+2]]:3-32: error: `Core.As` implicitly referenced here, but package `Core` not found [CoreNotFound] // CHECK:STDERR: {.y = type} as ().(Z(C(T)).Z1); } @@ -437,9 +425,7 @@ final match_first { fn F(generic T: type) { // Could match C(T) later, but doesn't yet. So it's not considered final. - // CHECK:STDERR: fail_final_overlapping_query_in_match_first.carbon:[[@LINE+4]]:3: error: `Core.As` implicitly referenced here, but package `Core` not found [CoreNotFound] - // CHECK:STDERR: {.t = type} as ().(Z(T).Z1); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_final_overlapping_query_in_match_first.carbon:[[@LINE+2]]:3-29: error: `Core.As` implicitly referenced here, but package `Core` not found [CoreNotFound] // CHECK:STDERR: {.t = type} as ().(Z(T).Z1); } @@ -466,9 +452,7 @@ final match_first { fn F(generic T: type) { // Could match C(T) later, but doesn't yet. So it's not considered final. - // CHECK:STDERR: fail_final_overlapping_query_in_match_first_reverse_order.carbon:[[@LINE+4]]:3: error: `Core.As` implicitly referenced here, but package `Core` not found [CoreNotFound] - // CHECK:STDERR: {.t = type} as ().(Z(T).Z1); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_final_overlapping_query_in_match_first_reverse_order.carbon:[[@LINE+2]]:3-29: error: `Core.As` implicitly referenced here, but package `Core` not found [CoreNotFound] // CHECK:STDERR: {.t = type} as ().(Z(T).Z1); } diff --git a/toolchain/check/testdata/named_constraint/basic.carbon b/toolchain/check/testdata/named_constraint/basic.carbon index ed636ca1ccc0..cb60d1cb06ac 100644 --- a/toolchain/check/testdata/named_constraint/basic.carbon +++ b/toolchain/check/testdata/named_constraint/basic.carbon @@ -29,12 +29,8 @@ library "[[@TEST_NAME]]"; class ForwardDeclared; -// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE+7]]:12: error: duplicate name `ForwardDeclared` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: constraint ForwardDeclared {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE-5]]:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: class ForwardDeclared; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE+3]]:12-26: error: duplicate name `ForwardDeclared` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE-3]]:1-22: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: constraint ForwardDeclared {} @@ -43,12 +39,8 @@ library "[[@TEST_NAME]]"; constraint Declared {} -// CHECK:STDERR: fail_defined_twice.carbon:[[@LINE+7]]:1: error: redefinition of `constraint Declared` [RedeclRedef] -// CHECK:STDERR: constraint Declared {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_defined_twice.carbon:[[@LINE-5]]:1: note: previously defined here [RedeclPrevDef] -// CHECK:STDERR: constraint Declared {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_defined_twice.carbon:[[@LINE+3]]:1-21: error: redefinition of `constraint Declared` [RedeclRedef] +// CHECK:STDERR: fail_defined_twice.carbon:[[@LINE-3]]:1-21: note: previously defined here [RedeclPrevDef] // CHECK:STDERR: constraint Declared {} diff --git a/toolchain/check/testdata/named_constraint/extend_name_lookup.carbon b/toolchain/check/testdata/named_constraint/extend_name_lookup.carbon index cd07a9e41f69..3e998e9c9df4 100644 --- a/toolchain/check/testdata/named_constraint/extend_name_lookup.carbon +++ b/toolchain/check/testdata/named_constraint/extend_name_lookup.carbon @@ -42,9 +42,7 @@ constraint W { fn F(generic T: W) { // Does not extend Z. interface Y { fn YF(); } - // CHECK:STDERR: fail_name_lookup_in_constraint_does_not_extend.carbon:[[@LINE+4]]:3: error: member name `ZF` not found in `W` [MemberNameNotFoundInSpecificScope] - // CHECK:STDERR: T.ZF(); - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_name_lookup_in_constraint_does_not_extend.carbon:[[@LINE+2]]:3-6: error: member name `ZF` not found in `W` [MemberNameNotFoundInSpecificScope] // CHECK:STDERR: T.ZF(); } @@ -82,15 +80,11 @@ constraint W { fn F(generic T: type where .Self impls W) { // T does not extend Z. - // CHECK:STDERR: fail_name_lookup_in_facet_type_does_not_extend.carbon:[[@LINE+4]]:3: error: member name `ZF` not found [MemberNameNotFound] - // CHECK:STDERR: T.ZF(); - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_name_lookup_in_facet_type_does_not_extend.carbon:[[@LINE+2]]:3-6: error: member name `ZF` not found [MemberNameNotFound] // CHECK:STDERR: T.ZF(); // T does not extend Y. - // CHECK:STDERR: fail_name_lookup_in_facet_type_does_not_extend.carbon:[[@LINE+4]]:3: error: member name `YF` not found [MemberNameNotFound] - // CHECK:STDERR: T.YF(); - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_name_lookup_in_facet_type_does_not_extend.carbon:[[@LINE+2]]:3-6: error: member name `YF` not found [MemberNameNotFound] // CHECK:STDERR: T.YF(); } diff --git a/toolchain/check/testdata/named_constraint/generic.carbon b/toolchain/check/testdata/named_constraint/generic.carbon index bd3d12628bdd..0e2c88b95d77 100644 --- a/toolchain/check/testdata/named_constraint/generic.carbon +++ b/toolchain/check/testdata/named_constraint/generic.carbon @@ -26,12 +26,8 @@ constraint ForwardDeclaredGeneric(T: type) {} library "[[@TEST_NAME]]"; constraint ForwardDeclaredGeneric(T: ()); -// CHECK:STDERR: fail_mismatched_generic_param_types.carbon:[[@LINE+7]]:35: error: type `` of parameter 1 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] -// CHECK:STDERR: constraint ForwardDeclaredGeneric(T: type) {} -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_mismatched_generic_param_types.carbon:[[@LINE-4]]:35: note: previous declaration's corresponding parameter here [RedeclParamPrevious] -// CHECK:STDERR: constraint ForwardDeclaredGeneric(T: ()); -// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: fail_mismatched_generic_param_types.carbon:[[@LINE+3]]:35-41: error: type `` of parameter 1 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] +// CHECK:STDERR: fail_mismatched_generic_param_types.carbon:[[@LINE-2]]:35-39: note: previous declaration's corresponding parameter here [RedeclParamPrevious] // CHECK:STDERR: constraint ForwardDeclaredGeneric(T: type) {} @@ -39,12 +35,8 @@ constraint ForwardDeclaredGeneric(T: type) {} library "[[@TEST_NAME]]"; constraint ForwardDeclaredGeneric(T: type, U: type); -// CHECK:STDERR: fail_mismatched_generic_param_arity.carbon:[[@LINE+7]]:1: error: redeclaration differs because of parameter count of 1 [RedeclParamCountDiffers] -// CHECK:STDERR: constraint ForwardDeclaredGeneric(T: type) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_mismatched_generic_param_arity.carbon:[[@LINE-4]]:1: note: previously declared with parameter count of 2 [RedeclParamCountPrevious] -// CHECK:STDERR: constraint ForwardDeclaredGeneric(T: type, U: type); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_mismatched_generic_param_arity.carbon:[[@LINE+3]]:1-44: error: redeclaration differs because of parameter count of 1 [RedeclParamCountDiffers] +// CHECK:STDERR: fail_mismatched_generic_param_arity.carbon:[[@LINE-2]]:1-52: note: previously declared with parameter count of 2 [RedeclParamCountPrevious] // CHECK:STDERR: constraint ForwardDeclaredGeneric(T: type) {} @@ -52,12 +44,8 @@ constraint ForwardDeclaredGeneric(T: type) {} library "[[@TEST_NAME]]"; constraint Generic(T: type) {} -// CHECK:STDERR: fail_inside_definition.carbon:[[@LINE+7]]:1: error: redefinition of `constraint Generic` [RedeclRedef] -// CHECK:STDERR: constraint Generic(T: type) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_inside_definition.carbon:[[@LINE-4]]:1: note: previously defined here [RedeclPrevDef] -// CHECK:STDERR: constraint Generic(T: type) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_inside_definition.carbon:[[@LINE+3]]:1-29: error: redefinition of `constraint Generic` [RedeclRedef] +// CHECK:STDERR: fail_inside_definition.carbon:[[@LINE-2]]:1-29: note: previously defined here [RedeclPrevDef] // CHECK:STDERR: constraint Generic(T: type) {} @@ -66,12 +54,8 @@ library "[[@TEST_NAME]]"; constraint Generic(T: type) {} -// CHECK:STDERR: fail_args_count_mismatch.carbon:[[@LINE+7]]:24: error: 2 arguments passed to generic constraint expecting 1 argument [CallArgCountMismatch] -// CHECK:STDERR: fn F(unused generic T: Generic((), ())) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_args_count_mismatch.carbon:[[@LINE-5]]:1: note: calling generic constraint declared here [InCallToEntity] -// CHECK:STDERR: constraint Generic(T: type) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_args_count_mismatch.carbon:[[@LINE+3]]:24-38: error: 2 arguments passed to generic constraint expecting 1 argument [CallArgCountMismatch] +// CHECK:STDERR: fail_args_count_mismatch.carbon:[[@LINE-3]]:1-29: note: calling generic constraint declared here [InCallToEntity] // CHECK:STDERR: fn F(unused generic T: Generic((), ())) {} diff --git a/toolchain/check/testdata/named_constraint/import_constraint_decl.carbon b/toolchain/check/testdata/named_constraint/import_constraint_decl.carbon index 4e7d4ad39b43..4f668208e190 100644 --- a/toolchain/check/testdata/named_constraint/import_constraint_decl.carbon +++ b/toolchain/check/testdata/named_constraint/import_constraint_decl.carbon @@ -39,13 +39,9 @@ library "[[@TEST_NAME]]"; import library "a"; class C {} -// CHECK:STDERR: fail_import_not_identified.carbon:[[@LINE+8]]:1: error: facet type `A` cannot be identified in `impl as` [ImplOfUnidentifiedFacetType] -// CHECK:STDERR: impl C as A; -// CHECK:STDERR: ^~~~~~~~~~~~ -// CHECK:STDERR: fail_import_not_identified.carbon:[[@LINE-6]]:1: in import [InImport] -// CHECK:STDERR: a.carbon:3:1: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere] -// CHECK:STDERR: constraint A; -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_import_not_identified.carbon:[[@LINE+4]]:1-12: error: facet type `A` cannot be identified in `impl as` [ImplOfUnidentifiedFacetType] +// CHECK:STDERR: imported from: fail_import_not_identified.carbon:[[@LINE-4]]:1 [InImport] +// CHECK:STDERR: a.carbon:3:1-13: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere] // CHECK:STDERR: impl C as A; diff --git a/toolchain/check/testdata/named_constraint/incomplete.carbon b/toolchain/check/testdata/named_constraint/incomplete.carbon index 5e74c3b7574e..62fe47fb0a75 100644 --- a/toolchain/check/testdata/named_constraint/incomplete.carbon +++ b/toolchain/check/testdata/named_constraint/incomplete.carbon @@ -19,9 +19,7 @@ interface Z {} // not able to provide any witness for an impl lookup on that facet. constraint N; fn F(generic T: N) { - // CHECK:STDERR: fail_incomplete_constraint_in_impl_lookup.carbon:[[@LINE+4]]:3: error: cannot convert type `T` that implements `N` into type implementing `Z` [ConversionFailureFacetToFacet] - // CHECK:STDERR: T as Z; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_incomplete_constraint_in_impl_lookup.carbon:[[@LINE+2]]:3-8: error: cannot convert type `T` that implements `N` into type implementing `Z` [ConversionFailureFacetToFacet] // CHECK:STDERR: T as Z; } @@ -40,9 +38,7 @@ impl forall [T: N] T as Z {} class C; fn F() { - // CHECK:STDERR: fail_does_not_diagnose_identify_failure_in_deduce.carbon:[[@LINE+4]]:3: error: cannot convert type `C` into type implementing `Z` [ConversionFailureTypeToFacet] - // CHECK:STDERR: C as Z; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_does_not_diagnose_identify_failure_in_deduce.carbon:[[@LINE+2]]:3-8: error: cannot convert type `C` into type implementing `Z` [ConversionFailureTypeToFacet] // CHECK:STDERR: C as Z; } @@ -76,15 +72,9 @@ fn AsZ(unused generic T: Z) {} fn F() { // Converting to facet type `Z` requires `Z` to be identified. - // CHECK:STDERR: fail_impl_lookup_target_not_identified.carbon:[[@LINE+10]]:3: error: facet type `Z` can not be identified [ImplLookupInUnidentifiedFacetType] - // CHECK:STDERR: AsZ(()); - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_impl_lookup_target_not_identified.carbon:[[@LINE-9]]:1: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere] - // CHECK:STDERR: constraint Z; - // CHECK:STDERR: ^~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_lookup_target_not_identified.carbon:[[@LINE-10]]:23: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn AsZ(unused generic T: Z) {} - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_impl_lookup_target_not_identified.carbon:[[@LINE+4]]:3-9: error: facet type `Z` can not be identified [ImplLookupInUnidentifiedFacetType] + // CHECK:STDERR: fail_impl_lookup_target_not_identified.carbon:[[@LINE-7]]:1-13: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere] + // CHECK:STDERR: fail_impl_lookup_target_not_identified.carbon:[[@LINE-6]]:23-26: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: AsZ(()); } @@ -107,22 +97,12 @@ interface Z {} interface X { let XZ: Z; } constraint W { require impls Z; - // CHECK:STDERR: fail_incomplete_self.carbon:[[@LINE+17]]:31: error: function returns incomplete type `W` [IncompleteTypeInFunctionReturnType] - // CHECK:STDERR: require impls X where .XZ = ReturnFacet(Self); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_incomplete_self.carbon:[[@LINE-5]]:1: note: constraint is currently being defined [NamedConstraintIncompleteWithinDefinition] - // CHECK:STDERR: constraint W { - // CHECK:STDERR: ^~~~~~~~~~~~~~ - // CHECK:STDERR: fail_incomplete_self.carbon:[[@LINE-15]]:44: note: return type declared here [IncompleteReturnTypeHere] - // CHECK:STDERR: eval fn ReturnFacet[T: type](generic U: T) -> T; - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_incomplete_self.carbon:[[@LINE+7]]:31-47: error: function returns incomplete type `W` [IncompleteTypeInFunctionReturnType] + // CHECK:STDERR: fail_incomplete_self.carbon:[[@LINE-3]]:1-14: note: constraint is currently being defined [NamedConstraintIncompleteWithinDefinition] + // CHECK:STDERR: fail_incomplete_self.carbon:[[@LINE-11]]:44-47: note: return type declared here [IncompleteReturnTypeHere] // CHECK:STDERR: - // CHECK:STDERR: fail_incomplete_self.carbon:[[@LINE+7]]:31: error: use of undefined generic function [MissingGenericFunctionDefinition] - // CHECK:STDERR: require impls X where .XZ = ReturnFacet(Self); - // CHECK:STDERR: ^~~~~~~~~~~ - // CHECK:STDERR: fail_incomplete_self.carbon:[[@LINE-22]]:1: note: generic function declared here [MissingGenericFunctionDefinitionHere] - // CHECK:STDERR: eval fn ReturnFacet[T: type](generic U: T) -> T; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_incomplete_self.carbon:[[@LINE+3]]:31-41: error: use of undefined generic function [MissingGenericFunctionDefinition] + // CHECK:STDERR: fail_incomplete_self.carbon:[[@LINE-14]]:1-48: note: generic function declared here [MissingGenericFunctionDefinitionHere] // CHECK:STDERR: require impls X where .XZ = ReturnFacet(Self); } diff --git a/toolchain/check/testdata/named_constraint/invalid_members.carbon b/toolchain/check/testdata/named_constraint/invalid_members.carbon index ab6d8e549a4b..7a94adbce848 100644 --- a/toolchain/check/testdata/named_constraint/invalid_members.carbon +++ b/toolchain/check/testdata/named_constraint/invalid_members.carbon @@ -36,13 +36,9 @@ constraint E { // --- fail_todo_invalid_var_template.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_todo_invalid_var_template.carbon:[[@LINE+8]]:1: error: unrecognized declaration introducer [UnrecognizedDecl] -// CHECK:STDERR: template constraint E { -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_todo_invalid_var_template.carbon:[[@LINE+4]]:1-8: error: unrecognized declaration introducer [UnrecognizedDecl] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_invalid_var_template.carbon:[[@LINE+4]]:1: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] -// CHECK:STDERR: template constraint E { -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_todo_invalid_var_template.carbon:[[@LINE+2]]:1-8: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: template constraint E { // TODO: Any var in a constraint is an error. @@ -60,13 +56,9 @@ constraint E { // --- fail_todo_invalid_let_template.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_todo_invalid_let_template.carbon:[[@LINE+8]]:1: error: unrecognized declaration introducer [UnrecognizedDecl] -// CHECK:STDERR: template constraint E { -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_todo_invalid_let_template.carbon:[[@LINE+4]]:1-8: error: unrecognized declaration introducer [UnrecognizedDecl] // CHECK:STDERR: -// CHECK:STDERR: fail_todo_invalid_let_template.carbon:[[@LINE+4]]:1: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] -// CHECK:STDERR: template constraint E { -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_todo_invalid_let_template.carbon:[[@LINE+2]]:1-8: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: template constraint E { // TODO: Any let in a constraint is an error. diff --git a/toolchain/check/testdata/named_constraint/require.carbon b/toolchain/check/testdata/named_constraint/require.carbon index 5f53ad9e6a5c..6c0904497215 100644 --- a/toolchain/check/testdata/named_constraint/require.carbon +++ b/toolchain/check/testdata/named_constraint/require.carbon @@ -102,9 +102,7 @@ constraint Z { fn F(generic T: Z) { // This should fail name lookup since Z does not extend Y. // - // CHECK:STDERR: fail_implicit_self_no_extend_name_lookup_fails.carbon:[[@LINE+4]]:3: error: member name `YY` not found in `Z` [MemberNameNotFoundInSpecificScope] - // CHECK:STDERR: T.YY(); - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_implicit_self_no_extend_name_lookup_fails.carbon:[[@LINE+2]]:3-6: error: member name `YY` not found in `Z` [MemberNameNotFoundInSpecificScope] // CHECK:STDERR: T.YY(); } @@ -123,9 +121,7 @@ constraint Z { fn F(generic T: Z) { // This should fail name lookup since Z does not extend Y. // - // CHECK:STDERR: fail_explicit_self_no_extend_name_lookup_fails.carbon:[[@LINE+4]]:3: error: member name `YY` not found in `Z` [MemberNameNotFoundInSpecificScope] - // CHECK:STDERR: T.YY(); - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_explicit_self_no_extend_name_lookup_fails.carbon:[[@LINE+2]]:3-6: error: member name `YY` not found in `Z` [MemberNameNotFoundInSpecificScope] // CHECK:STDERR: T.YY(); } @@ -161,12 +157,8 @@ constraint Y; //@dump-sem-ir-begin constraint Z { - // CHECK:STDERR: fail_require_impls_incomplete_constraint.carbon:[[@LINE+7]]:17: error: facet type `Y` cannot be identified in `require` declaration [RequireImplsUnidentifiedFacetType] - // CHECK:STDERR: require impls Y; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_require_impls_incomplete_constraint.carbon:[[@LINE-7]]:1: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere] - // CHECK:STDERR: constraint Y; - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_require_impls_incomplete_constraint.carbon:[[@LINE+3]]:17: error: facet type `Y` cannot be identified in `require` declaration [RequireImplsUnidentifiedFacetType] + // CHECK:STDERR: fail_require_impls_incomplete_constraint.carbon:[[@LINE-5]]:1-13: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere] // CHECK:STDERR: require impls Y; } @@ -176,9 +168,7 @@ constraint Z { library "[[@TEST_NAME]]"; constraint Z { - // CHECK:STDERR: fail_require_impls_incomplete_self.carbon:[[@LINE+4]]:17: error: facet type in `require` declaration refers to the named constraint `Z` from within its definition [RequireImplsReferenceCycle] - // CHECK:STDERR: require impls Z; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_require_impls_incomplete_self.carbon:[[@LINE+2]]:17: error: facet type in `require` declaration refers to the named constraint `Z` from within its definition [RequireImplsReferenceCycle] // CHECK:STDERR: require impls Z; } @@ -190,9 +180,7 @@ constraint Z; alias Y = Z; constraint Z { - // CHECK:STDERR: fail_require_impls_incomplete_self_through_alias.carbon:[[@LINE+4]]:17: error: facet type in `require` declaration refers to the named constraint `Z` from within its definition [RequireImplsReferenceCycle] - // CHECK:STDERR: require impls Y; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_require_impls_incomplete_self_through_alias.carbon:[[@LINE+2]]:17: error: facet type in `require` declaration refers to the named constraint `Z` from within its definition [RequireImplsReferenceCycle] // CHECK:STDERR: require impls Y; } @@ -203,9 +191,7 @@ library "[[@TEST_NAME]]"; constraint Z; constraint Z { - // CHECK:STDERR: fail_require_impls_incomplete_self_forward_declared.carbon:[[@LINE+4]]:17: error: facet type in `require` declaration refers to the named constraint `Z` from within its definition [RequireImplsReferenceCycle] - // CHECK:STDERR: require impls Z; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_require_impls_incomplete_self_forward_declared.carbon:[[@LINE+2]]:17: error: facet type in `require` declaration refers to the named constraint `Z` from within its definition [RequireImplsReferenceCycle] // CHECK:STDERR: require impls Z; } @@ -214,9 +200,7 @@ constraint Z { library "[[@TEST_NAME]]"; constraint Z { - // CHECK:STDERR: fail_require_impls_incomplete_self_in_period_self_impls.carbon:[[@LINE+4]]:17: error: facet type in `require` declaration refers to the named constraint `Z` from within its definition [RequireImplsReferenceCycle] - // CHECK:STDERR: require impls type where .Self impls Z; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_require_impls_incomplete_self_in_period_self_impls.carbon:[[@LINE+2]]:17-40: error: facet type in `require` declaration refers to the named constraint `Z` from within its definition [RequireImplsReferenceCycle] // CHECK:STDERR: require impls type where .Self impls Z; } @@ -226,9 +210,7 @@ library "[[@TEST_NAME]]"; class C(T: type); constraint Z { - // CHECK:STDERR: fail_require_impls_incomplete_self_in_class_impls.carbon:[[@LINE+4]]:17: error: facet type in `require` declaration refers to the named constraint `Z` from within its definition [RequireImplsReferenceCycle] - // CHECK:STDERR: require impls type where C(.Self) impls Z; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_require_impls_incomplete_self_in_class_impls.carbon:[[@LINE+2]]:17-43: error: facet type in `require` declaration refers to the named constraint `Z` from within its definition [RequireImplsReferenceCycle] // CHECK:STDERR: require impls type where C(.Self) impls Z; } @@ -239,12 +221,8 @@ library "[[@TEST_NAME]]"; constraint Z; constraint Y { - // CHECK:STDERR: fail_require_impls_incomplete_indirect.carbon:[[@LINE+7]]:17: error: facet type `Z` cannot be identified in `require` declaration [RequireImplsUnidentifiedFacetType] - // CHECK:STDERR: require impls Z; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_require_impls_incomplete_indirect.carbon:[[@LINE-6]]:1: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere] - // CHECK:STDERR: constraint Z; - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_require_impls_incomplete_indirect.carbon:[[@LINE+3]]:17: error: facet type `Z` cannot be identified in `require` declaration [RequireImplsUnidentifiedFacetType] + // CHECK:STDERR: fail_require_impls_incomplete_indirect.carbon:[[@LINE-4]]:1-13: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere] // CHECK:STDERR: require impls Z; } @@ -257,9 +235,7 @@ constraint Z { library "[[@TEST_NAME]]"; constraint Z(T: type) { - // CHECK:STDERR: fail_require_impls_incomplete_self_specific.carbon:[[@LINE+4]]:19: error: facet type in `require` declaration refers to the named constraint `Z` from within its definition [RequireImplsReferenceCycle] - // CHECK:STDERR: require T impls Z(Self); - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_require_impls_incomplete_self_specific.carbon:[[@LINE+2]]:19-25: error: facet type in `require` declaration refers to the named constraint `Z` from within its definition [RequireImplsReferenceCycle] // CHECK:STDERR: require T impls Z(Self); } @@ -277,9 +253,7 @@ constraint Z(T: type) { // it would appear in the type structure used for impl lookup (so inside a // `where` does not count). But they don't. // - // CHECK:STDERR: fail_require_impls_without_self.carbon:[[@LINE+4]]:3: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Y` without a `Self` argument [RequireImplsMissingSelf] - // CHECK:STDERR: require T impls Y where .Y1 = Self; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_require_impls_without_self.carbon:[[@LINE+2]]:3-37: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Y` without a `Self` argument [RequireImplsMissingSelf] // CHECK:STDERR: require T impls Y where .Y1 = Self; } @@ -293,9 +267,7 @@ interface Y(T: type) {} constraint Z(T: type) { // Self is in one interface but not the other. // - // CHECK:STDERR: fail_require_impls_without_self_in_one_interface.carbon:[[@LINE+4]]:3: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Y({})` without a `Self` argument [RequireImplsMissingSelf] - // CHECK:STDERR: require T impls Y(Self) & Y({}); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_require_impls_without_self_in_one_interface.carbon:[[@LINE+2]]:3-34: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Y({})` without a `Self` argument [RequireImplsMissingSelf] // CHECK:STDERR: require T impls Y(Self) & Y({}); } @@ -308,13 +280,9 @@ interface Y(T: type) {} constraint Z(T: type) { // Self does not appear in either interface, we should get an error for each. // - // CHECK:STDERR: fail_require_impls_without_self_in_multiple_interfaces.carbon:[[@LINE+8]]:3: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Y(())` without a `Self` argument [RequireImplsMissingSelf] - // CHECK:STDERR: require T impls Y(()) & Y({}); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_require_impls_without_self_in_multiple_interfaces.carbon:[[@LINE+4]]:3-32: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Y(())` without a `Self` argument [RequireImplsMissingSelf] // CHECK:STDERR: - // CHECK:STDERR: fail_require_impls_without_self_in_multiple_interfaces.carbon:[[@LINE+4]]:3: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Y({})` without a `Self` argument [RequireImplsMissingSelf] - // CHECK:STDERR: require T impls Y(()) & Y({}); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_require_impls_without_self_in_multiple_interfaces.carbon:[[@LINE+2]]:3-32: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Y({})` without a `Self` argument [RequireImplsMissingSelf] // CHECK:STDERR: require T impls Y(()) & Y({}); } @@ -323,9 +291,7 @@ constraint Z(T: type) { library "[[@TEST_NAME]]"; constraint Z(T: type) { - // CHECK:STDERR: fail_self_impls_self.carbon:[[@LINE+4]]:17: error: `require` declaration constrained by a non-facet type; expected an `interface` or `constraint` name after `impls` [RequireImplsMissingFacetType] - // CHECK:STDERR: require impls Self; - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_self_impls_self.carbon:[[@LINE+2]]:17-20: error: `require` declaration constrained by a non-facet type; expected an `interface` or `constraint` name after `impls` [RequireImplsMissingFacetType] // CHECK:STDERR: require impls Self; } @@ -336,9 +302,7 @@ library "[[@TEST_NAME]]"; class C(T: type) {} constraint Z(T: type) { - // CHECK:STDERR: fail_impls_type.carbon:[[@LINE+4]]:19: error: `require` declaration constrained by a non-facet type; expected an `interface` or `constraint` name after `impls` [RequireImplsMissingFacetType] - // CHECK:STDERR: require T impls C(Self); - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_impls_type.carbon:[[@LINE+2]]:19-25: error: `require` declaration constrained by a non-facet type; expected an `interface` or `constraint` name after `impls` [RequireImplsMissingFacetType] // CHECK:STDERR: require T impls C(Self); } @@ -349,12 +313,8 @@ library "[[@TEST_NAME]]"; interface Y {} 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: require 1 impls Y; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_non_type_impls.carbon:[[@LINE+3]]:11: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: fail_non_type_impls.carbon:[[@LINE+2]]:11: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: require 1 impls Y; } @@ -365,9 +325,7 @@ library "[[@TEST_NAME]]"; interface Y {} constraint Z(T: type) { - // CHECK:STDERR: fail_impls_non_type.carbon:[[@LINE+4]]:17: error: `require` declaration constrained by a non-facet type; expected an `interface` or `constraint` name after `impls` [RequireImplsMissingFacetType] - // CHECK:STDERR: require impls 1; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_impls_non_type.carbon:[[@LINE+2]]:17: error: `require` declaration constrained by a non-facet type; expected an `interface` or `constraint` name after `impls` [RequireImplsMissingFacetType] // CHECK:STDERR: require impls 1; } @@ -416,9 +374,7 @@ fn F() { // N requires () impls Z(Self) which is Z(()) for this query, but it impls // Z({}). // - // CHECK:STDERR: fail_require_different_self.carbon:[[@LINE+4]]:3: error: cannot convert type `()` into type implementing `N` [ConversionFailureTypeToFacet] - // CHECK:STDERR: () as N; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_require_different_self.carbon:[[@LINE+2]]:3-9: error: cannot convert type `()` into type implementing `N` [ConversionFailureTypeToFacet] // CHECK:STDERR: () as N; } @@ -437,9 +393,7 @@ impl () as Z(()) {} fn F() { // N requires () impls Z({}) but it impls Z(()). // - // CHECK:STDERR: fail_require_different_parameter.carbon:[[@LINE+4]]:3: error: cannot convert type `()` into type implementing `N` [ConversionFailureTypeToFacet] - // CHECK:STDERR: () as N; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_require_different_parameter.carbon:[[@LINE+2]]:3-9: error: cannot convert type `()` into type implementing `N` [ConversionFailureTypeToFacet] // CHECK:STDERR: () as N; } @@ -491,9 +445,7 @@ constraint N { // `M(T)` does not make use of the `T`, which is assigned `Self`, so we end up // without any interface specific referencing the `Self` of `N`. // - // CHECK:STDERR: fail_require_different_type_impls_nested_constraint_without_reference_to_outer_self.carbon:[[@LINE+4]]:3: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Z({})` without a `Self` argument [RequireImplsMissingSelf] - // CHECK:STDERR: require {} impls M(Self); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_require_different_type_impls_nested_constraint_without_reference_to_outer_self.carbon:[[@LINE+2]]:3-27: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Z({})` without a `Self` argument [RequireImplsMissingSelf] // CHECK:STDERR: require {} impls M(Self); } @@ -507,9 +459,7 @@ constraint N { // `M(T)` does not make use of the `T`, which is assigned `Self`, so we end up // without any interface specific referencing the `Self` of `N`. // - // CHECK:STDERR: fail_require_different_type_impls_nested_constraint_empty.carbon:[[@LINE+4]]:3: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but no interfaces were found [RequireImplsMissingSelfEmptyFacetType] - // CHECK:STDERR: require {} impls M(Self); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_require_different_type_impls_nested_constraint_empty.carbon:[[@LINE+2]]:3-27: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but no interfaces were found [RequireImplsMissingSelfEmptyFacetType] // CHECK:STDERR: require {} impls M(Self); } @@ -529,9 +479,7 @@ fn F() { // N requires {} impls Z(Self) which is Z(()) for this query, but it impls // Z({}). // - // CHECK:STDERR: fail_require_different_type_impls_different_parameter.carbon:[[@LINE+4]]:3: error: cannot convert type `()` into type implementing `N` [ConversionFailureTypeToFacet] - // CHECK:STDERR: () as N; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_require_different_type_impls_different_parameter.carbon:[[@LINE+2]]:3-9: error: cannot convert type `()` into type implementing `N` [ConversionFailureTypeToFacet] // CHECK:STDERR: () as N; } @@ -587,9 +535,7 @@ constraint N { impl {} as Z(()) where .X = {} {} fn F() { - // CHECK:STDERR: fail_require_with_mismatching_rewrite_constraint.carbon:[[@LINE+4]]:3: error: cannot convert type `()` into type implementing `N` [ConversionFailureTypeToFacet] - // CHECK:STDERR: () as N; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_require_with_mismatching_rewrite_constraint.carbon:[[@LINE+2]]:3-9: error: cannot convert type `()` into type implementing `N` [ConversionFailureTypeToFacet] // CHECK:STDERR: () as N; } @@ -609,9 +555,7 @@ constraint N(T: type) { impl {} as Z(()) where .X = () {} fn F() { - // CHECK:STDERR: fail_require_with_mismatching_rewrite_constraint_period_self.carbon:[[@LINE+4]]:3: error: cannot convert type `()` into type implementing `N({})` [ConversionFailureTypeToFacet] - // CHECK:STDERR: () as N({}); - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_require_with_mismatching_rewrite_constraint_period_self.carbon:[[@LINE+2]]:3-13: error: cannot convert type `()` into type implementing `N({})` [ConversionFailureTypeToFacet] // CHECK:STDERR: () as N({}); } @@ -631,9 +575,7 @@ constraint N { fn F(generic _: N) {} fn G(generic T: Z) { - // CHECK:STDERR: fail_require_with_period_self_impls_not_satisfied.carbon:[[@LINE+4]]:3: error: cannot convert type `T` that implements `Z` into type implementing `N` [ConversionFailureFacetToFacet] - // CHECK:STDERR: T as N; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_require_with_period_self_impls_not_satisfied.carbon:[[@LINE+2]]:3-8: error: cannot convert type `T` that implements `Z` into type implementing `N` [ConversionFailureFacetToFacet] // CHECK:STDERR: T as N; } @@ -673,9 +615,7 @@ constraint N { fn F(generic _: N) {} fn G(generic T: Z) { - // CHECK:STDERR: fail_require_with_specific_period_self_not_satisfied.carbon:[[@LINE+4]]:3: error: cannot convert type `T` that implements `Z` into type implementing `N` [ConversionFailureFacetToFacet] - // CHECK:STDERR: T as N; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_require_with_specific_period_self_not_satisfied.carbon:[[@LINE+2]]:3-8: error: cannot convert type `T` that implements `Z` into type implementing `N` [ConversionFailureFacetToFacet] // CHECK:STDERR: T as N; } @@ -734,9 +674,7 @@ constraint N { // it is not `Self`. Since `Self` is not directly part of the type structure, // we don't accept this require decl. // - // CHECK:STDERR: fail_self_in_compound_member_access_is_not_in_type_structure.carbon:[[@LINE+4]]:3: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Y` without a `Self` argument [RequireImplsMissingSelf] - // CHECK:STDERR: require C.(Z(Self).Z1) impls Y; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_self_in_compound_member_access_is_not_in_type_structure.carbon:[[@LINE+2]]:3-33: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Y` without a `Self` argument [RequireImplsMissingSelf] // CHECK:STDERR: require C.(Z(Self).Z1) impls Y; } @@ -750,9 +688,7 @@ interface Z { } constraint N { - // CHECK:STDERR: fail_rewrite_cycle.carbon:[[@LINE+4]]:17: error: found cycle in facet type constraint for `.(Z.Z2)` [FacetTypeConstraintCycle] - // CHECK:STDERR: require impls Z where .Z1 = .Z2 and .Z2 = .Z1; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_rewrite_cycle.carbon:[[@LINE+2]]:17-47: error: found cycle in facet type constraint for `.(Z.Z2)` [FacetTypeConstraintCycle] // CHECK:STDERR: require impls Z where .Z1 = .Z2 and .Z2 = .Z1; } diff --git a/toolchain/check/testdata/named_constraint/require_invalid_modifiers.carbon b/toolchain/check/testdata/named_constraint/require_invalid_modifiers.carbon index 8a2865d79be0..751a38b0b5d2 100644 --- a/toolchain/check/testdata/named_constraint/require_invalid_modifiers.carbon +++ b/toolchain/check/testdata/named_constraint/require_invalid_modifiers.carbon @@ -16,9 +16,7 @@ library "[[@TEST_NAME]]"; interface Y {} constraint Z { - // CHECK:STDERR: fail_abstract_require.carbon:[[@LINE+4]]:3: error: `abstract` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] - // CHECK:STDERR: abstract require impls Y; - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_abstract_require.carbon:[[@LINE+2]]:3-10: error: `abstract` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: abstract require impls Y; } @@ -29,9 +27,7 @@ library "[[@TEST_NAME]]"; interface Y {} constraint Z { - // CHECK:STDERR: fail_base_require.carbon:[[@LINE+4]]:3: error: `base` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] - // CHECK:STDERR: base require impls Y; - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_base_require.carbon:[[@LINE+2]]:3-6: error: `base` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: base require impls Y; } @@ -42,9 +38,7 @@ library "[[@TEST_NAME]]"; interface Y {} constraint Z { - // CHECK:STDERR: fail_default_require.carbon:[[@LINE+4]]:3: error: `default` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] - // CHECK:STDERR: default require impls Y; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_default_require.carbon:[[@LINE+2]]:3-9: error: `default` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: default require impls Y; } @@ -55,9 +49,7 @@ library "[[@TEST_NAME]]"; interface Y {} constraint Z { - // CHECK:STDERR: fail_extern_require.carbon:[[@LINE+4]]:3: error: `extern` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] - // CHECK:STDERR: extern require impls Y; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_extern_require.carbon:[[@LINE+2]]:3-8: error: `extern` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: extern require impls Y; } @@ -68,9 +60,7 @@ library "[[@TEST_NAME]]"; interface Y {} constraint Z { - // CHECK:STDERR: fail_final_require.carbon:[[@LINE+4]]:3: error: `final` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] - // CHECK:STDERR: final require impls Y; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_final_require.carbon:[[@LINE+2]]:3-7: error: `final` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: final require impls Y; } @@ -81,9 +71,7 @@ library "[[@TEST_NAME]]"; interface Y {} constraint Z { - // CHECK:STDERR: fail_impl_require.carbon:[[@LINE+4]]:3: error: `impl` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] - // CHECK:STDERR: impl require impls Y; - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_impl_require.carbon:[[@LINE+2]]:3-6: error: `impl` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: impl require impls Y; } @@ -94,9 +82,7 @@ library "[[@TEST_NAME]]"; interface Y {} constraint Z { - // CHECK:STDERR: fail_override_require.carbon:[[@LINE+4]]:3: error: `override` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] - // CHECK:STDERR: override require impls Y; - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_override_require.carbon:[[@LINE+2]]:3-10: error: `override` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: override require impls Y; } @@ -107,13 +93,9 @@ library "[[@TEST_NAME]]"; interface Y {} constraint Z { - // CHECK:STDERR: fail_returned_require.carbon:[[@LINE+8]]:3: error: unrecognized declaration introducer [UnrecognizedDecl] - // CHECK:STDERR: returned require impls Y; - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_returned_require.carbon:[[@LINE+4]]:3-10: error: unrecognized declaration introducer [UnrecognizedDecl] // CHECK:STDERR: - // CHECK:STDERR: fail_returned_require.carbon:[[@LINE+4]]:3: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] - // CHECK:STDERR: returned require impls Y; - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_returned_require.carbon:[[@LINE+2]]:3-10: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: returned require impls Y; } @@ -124,9 +106,7 @@ library "[[@TEST_NAME]]"; interface Y {} constraint Z { - // CHECK:STDERR: fail_private_require.carbon:[[@LINE+4]]:3: error: `private` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] - // CHECK:STDERR: private require impls Y; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_private_require.carbon:[[@LINE+2]]:3-9: error: `private` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: private require impls Y; } @@ -137,9 +117,7 @@ library "[[@TEST_NAME]]"; interface Y {} constraint Z { - // CHECK:STDERR: fail_protected_require.carbon:[[@LINE+4]]:3: error: `protected` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] - // CHECK:STDERR: protected require impls Y; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_protected_require.carbon:[[@LINE+2]]:3-11: error: `protected` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: protected require impls Y; } @@ -150,9 +128,7 @@ library "[[@TEST_NAME]]"; interface Y {} constraint Z { - // CHECK:STDERR: fail_override_virtual.carbon:[[@LINE+4]]:3: error: `virtual` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] - // CHECK:STDERR: virtual require impls Y; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_override_virtual.carbon:[[@LINE+2]]:3-9: error: `virtual` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: virtual require impls Y; } diff --git a/toolchain/check/testdata/namespace/fail_conflict_after_merge.carbon b/toolchain/check/testdata/namespace/fail_conflict_after_merge.carbon index fb7aaa376c02..19a2cf8b3dbd 100644 --- a/toolchain/check/testdata/namespace/fail_conflict_after_merge.carbon +++ b/toolchain/check/testdata/namespace/fail_conflict_after_merge.carbon @@ -28,13 +28,9 @@ import library "namespace"; // imported declaration. namespace NS; -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+8]]:4: error: duplicate name `NS` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: fn NS(); -// CHECK:STDERR: ^~ -// CHECK:STDERR: fail_conflict.carbon:[[@LINE-9]]:1: in import [InImport] -// CHECK:STDERR: namespace.carbon:4:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: namespace NS; -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_conflict.carbon:[[@LINE+4]]:4-5: error: duplicate name `NS` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_conflict.carbon:[[@LINE-7]]:1 [InImport] +// CHECK:STDERR: namespace.carbon:4:1-13: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: fn NS(); @@ -42,13 +38,9 @@ fn NS(); // we don't move it. namespace NS; -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+8]]:4: error: duplicate name `NS` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: fn NS(); -// CHECK:STDERR: ^~ -// CHECK:STDERR: fail_conflict.carbon:[[@LINE-23]]:1: in import [InImport] -// CHECK:STDERR: namespace.carbon:4:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: namespace NS; -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_conflict.carbon:[[@LINE+4]]:4-5: error: duplicate name `NS` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_conflict.carbon:[[@LINE-17]]:1 [InImport] +// CHECK:STDERR: namespace.carbon:4:1-13: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: fn NS(); @@ -74,9 +66,9 @@ fn NS(); // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: type: type = facet_type [concrete] -// CHECK:STDOUT: %NS.type.20a02b.1: type = fn_type @NS.loc18 [concrete] +// CHECK:STDOUT: %NS.type.20a02b.1: type = fn_type @NS.loc14 [concrete] // CHECK:STDOUT: %NS.bab1af.1: %NS.type.20a02b.1 = struct_value () [concrete] -// CHECK:STDOUT: %NS.type.20a02b.2: type = fn_type @NS.loc32 [concrete] +// CHECK:STDOUT: %NS.type.20a02b.2: type = fn_type @NS.loc24 [concrete] // CHECK:STDOUT: %NS.bab1af.2: %NS.type.20a02b.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -97,12 +89,12 @@ fn NS(); // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %NS.loc8: = namespace imports.%Example.NS, [concrete] {} -// CHECK:STDOUT: %NS.decl.loc18: %NS.type.20a02b.1 = fn_decl @NS.loc18 [concrete = constants.%NS.bab1af.1] {} {} -// CHECK:STDOUT: %NS.loc22: = namespace imports.%Example.NS, [concrete] {} -// CHECK:STDOUT: %NS.decl.loc32: %NS.type.20a02b.2 = fn_decl @NS.loc32 [concrete = constants.%NS.bab1af.2] {} {} +// CHECK:STDOUT: %NS.decl.loc14: %NS.type.20a02b.1 = fn_decl @NS.loc14 [concrete = constants.%NS.bab1af.1] {} {} +// CHECK:STDOUT: %NS.loc18: = namespace imports.%Example.NS, [concrete] {} +// CHECK:STDOUT: %NS.decl.loc24: %NS.type.20a02b.2 = fn_decl @NS.loc24 [concrete = constants.%NS.bab1af.2] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @NS.loc18(); +// CHECK:STDOUT: fn @NS.loc14(); // CHECK:STDOUT: -// CHECK:STDOUT: fn @NS.loc32(); +// CHECK:STDOUT: fn @NS.loc24(); // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_first.carbon b/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_first.carbon index d55478a1d842..f95c20b8dc42 100644 --- a/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_first.carbon +++ b/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_first.carbon @@ -24,13 +24,9 @@ package Example; import library "namespace"; -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+8]]:4: error: duplicate name `NS` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: fn NS(); -// CHECK:STDERR: ^~ -// CHECK:STDERR: fail_conflict.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: namespace.carbon:4:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: namespace NS; -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_conflict.carbon:[[@LINE+4]]:4-5: error: duplicate name `NS` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_conflict.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: namespace.carbon:4:1-13: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: fn NS(); diff --git a/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_nested.carbon b/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_nested.carbon index b1a6ab14c4b2..17bd0fab2b2d 100644 --- a/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_nested.carbon +++ b/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_nested.carbon @@ -20,21 +20,13 @@ namespace Nested; // --- fail_conflict.carbon import Other; -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+7]]:11: error: duplicate name `Other` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: namespace Other; -// CHECK:STDERR: ^~~~~ -// CHECK:STDERR: fail_conflict.carbon:[[@LINE-4]]:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: import Other; -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_conflict.carbon:[[@LINE+3]]:11-15: error: duplicate name `Other` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_conflict.carbon:[[@LINE-2]]:1-13: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: namespace Other; -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+8]]:10: error: imported packages cannot be used for declarations [QualifiedDeclOutsidePackage] -// CHECK:STDERR: fn Other.Nested.F(); -// CHECK:STDERR: ^~~~~~ -// CHECK:STDERR: fail_conflict.carbon:[[@LINE-12]]:1: in import [InImport] -// CHECK:STDERR: fn.carbon:3:1: note: package imported here [QualifiedDeclOutsidePackageSource] -// CHECK:STDERR: namespace Nested; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_conflict.carbon:[[@LINE+4]]:10-15: error: imported packages cannot be used for declarations [QualifiedDeclOutsidePackage] +// CHECK:STDERR: imported from: fail_conflict.carbon:[[@LINE-6]]:1 [InImport] +// CHECK:STDERR: fn.carbon:3:1-17: note: package imported here [QualifiedDeclOutsidePackageSource] // CHECK:STDERR: fn Other.Nested.F(); diff --git a/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_second.carbon b/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_second.carbon index dfa71af791e8..a26bfb6c82f6 100644 --- a/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_second.carbon +++ b/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_second.carbon @@ -24,23 +24,15 @@ package Example; import library "fn"; -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+8]]:11: error: duplicate name `NS` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: namespace NS; -// CHECK:STDERR: ^~ -// CHECK:STDERR: fail_conflict.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: fn.carbon:4:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: fn NS(); -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_conflict.carbon:[[@LINE+4]]:11-12: error: duplicate name `NS` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_conflict.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: fn.carbon:4:1-8: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: namespace NS; -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+8]]:4: error: name qualifiers are only allowed for entities that provide a scope [QualifiedNameInNonScope] -// CHECK:STDERR: fn NS.Foo(); -// CHECK:STDERR: ^~ -// CHECK:STDERR: fail_conflict.carbon:[[@LINE-15]]:1: in import [InImport] -// CHECK:STDERR: fn.carbon:4:1: note: referenced non-scope entity declared here [QualifiedNameNonScopeEntity] -// CHECK:STDERR: fn NS(); -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_conflict.carbon:[[@LINE+4]]:4-5: error: name qualifiers are only allowed for entities that provide a scope [QualifiedNameInNonScope] +// CHECK:STDERR: imported from: fail_conflict.carbon:[[@LINE-9]]:1 [InImport] +// CHECK:STDERR: fn.carbon:4:1-8: note: referenced non-scope entity declared here [QualifiedNameNonScopeEntity] // CHECK:STDERR: fn NS.Foo(); @@ -95,7 +87,7 @@ fn NS.Foo(); // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: %.loc14: = namespace [concrete] {} +// CHECK:STDOUT: %.loc10: = namespace [concrete] {} // CHECK:STDOUT: %Foo.decl: %Foo.type = fn_decl @Foo [concrete = constants.%Foo] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_first.carbon b/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_first.carbon index a045a6ac6c31..7ba126ba458d 100644 --- a/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_first.carbon +++ b/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_first.carbon @@ -29,14 +29,10 @@ fn NS() {} package Example library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+9]]:1: in import [InImport] -// CHECK:STDERR: fn.carbon:4:1: error: duplicate name `NS` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: fn NS() {} -// CHECK:STDERR: ^~~~~~~~~ -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+5]]:1: in import [InImport] -// CHECK:STDERR: namespace.carbon:4:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: namespace NS; -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: imported from: fail_conflict.carbon:[[@LINE+5]]:1 [InImport] +// CHECK:STDERR: fn.carbon:4:1-9: error: duplicate name `NS` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_conflict.carbon:[[@LINE+3]]:1 [InImport] +// CHECK:STDERR: namespace.carbon:4:1-13: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: import library "namespace"; import library "fn"; diff --git a/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_second.carbon b/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_second.carbon index 7600ada7589e..1770b090879f 100644 --- a/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_second.carbon +++ b/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_second.carbon @@ -29,14 +29,10 @@ fn NS.Foo() {} package Example library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+9]]:1: in import [InImport] -// CHECK:STDERR: namespace.carbon:4:1: error: duplicate name `NS` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: namespace NS; -// CHECK:STDERR: ^~~~~~~~~~~~~ -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+5]]:1: in import [InImport] -// CHECK:STDERR: fn.carbon:4:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: fn NS() {} -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: imported from: fail_conflict.carbon:[[@LINE+5]]:1 [InImport] +// CHECK:STDERR: namespace.carbon:4:1-13: error: duplicate name `NS` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_conflict.carbon:[[@LINE+3]]:1 [InImport] +// CHECK:STDERR: fn.carbon:4:1-9: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: import library "fn"; import library "namespace"; diff --git a/toolchain/check/testdata/namespace/fail_decl_in_alias.carbon b/toolchain/check/testdata/namespace/fail_decl_in_alias.carbon index 3304d1635f59..1ad90bb16dac 100644 --- a/toolchain/check/testdata/namespace/fail_decl_in_alias.carbon +++ b/toolchain/check/testdata/namespace/fail_decl_in_alias.carbon @@ -17,12 +17,8 @@ namespace NS; alias ns = NS; // Aliases can't be used when declaring names. -// CHECK:STDERR: fail_decl_in_alias.carbon:[[@LINE+7]]:4: error: name qualifiers are only allowed for entities that provide a scope [QualifiedNameInNonScope] -// CHECK:STDERR: fn ns.A() -> i32 { return 0; } -// CHECK:STDERR: ^~ -// CHECK:STDERR: fail_decl_in_alias.carbon:[[@LINE-6]]:7: note: referenced non-scope entity declared here [QualifiedNameNonScopeEntity] -// CHECK:STDERR: alias ns = NS; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_decl_in_alias.carbon:[[@LINE+3]]:4-5: error: name qualifiers are only allowed for entities that provide a scope [QualifiedNameInNonScope] +// CHECK:STDERR: fail_decl_in_alias.carbon:[[@LINE-4]]:7-8: note: referenced non-scope entity declared here [QualifiedNameNonScopeEntity] // CHECK:STDERR: fn ns.A() -> i32 { return 0; } @@ -87,7 +83,7 @@ fn ns.A() -> i32 { return 0; } // CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32 [concrete = constants.%return.patt.6fa] // CHECK:STDOUT: } { // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc27_14: Core.Form = init_form %i32 [concrete = constants.%.0b3] +// CHECK:STDOUT: %.loc23_14: Core.Form = init_form %i32 [concrete = constants.%.0b3] // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param0 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } @@ -97,11 +93,11 @@ fn ns.A() -> i32 { return 0; } // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] // CHECK:STDOUT: %impl.elem0: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc27_28.1: = bound_method %int_0, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %bound_method.loc23_28.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.loc27_28.2: = bound_method %int_0, %specific_fn [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc27_28.2(%int_0) [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc27_28: init %i32 = converted %int_0, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_0.753] -// CHECK:STDOUT: return %.loc27_28 +// CHECK:STDOUT: %bound_method.loc23_28.2: = bound_method %int_0, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc23_28.2(%int_0) [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc23_28: init %i32 = converted %int_0, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_0.753] +// CHECK:STDOUT: return %.loc23_28 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/fail_duplicate.carbon b/toolchain/check/testdata/namespace/fail_duplicate.carbon index 91fa2dc0fa77..6c858d67daee 100644 --- a/toolchain/check/testdata/namespace/fail_duplicate.carbon +++ b/toolchain/check/testdata/namespace/fail_duplicate.carbon @@ -17,12 +17,8 @@ namespace Foo; fn Foo.Baz() { } -// CHECK:STDERR: fail_duplicate.carbon:[[@LINE+7]]:1: error: redefinition of `fn Baz` [RedeclRedef] -// CHECK:STDERR: fn Foo.Baz() { -// CHECK:STDERR: ^~~~~~~~~~~~~~ -// CHECK:STDERR: fail_duplicate.carbon:[[@LINE-6]]:1: note: previously defined here [RedeclPrevDef] -// CHECK:STDERR: fn Foo.Baz() { -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_duplicate.carbon:[[@LINE+3]]:1-14: error: redefinition of `fn Baz` [RedeclRedef] +// CHECK:STDERR: fail_duplicate.carbon:[[@LINE-4]]:1-14: note: previously defined here [RedeclPrevDef] // CHECK:STDERR: fn Foo.Baz() { } @@ -33,7 +29,7 @@ fn Foo.Baz() { // CHECK:STDOUT: type: type = facet_type [concrete] // CHECK:STDOUT: %Baz.type.280a69.1: type = fn_type @Baz.loc17 [concrete] // CHECK:STDOUT: %Baz.f49bdd.1: %Baz.type.280a69.1 = struct_value () [concrete] -// CHECK:STDOUT: %Baz.type.280a69.2: type = fn_type @Baz.loc27 [concrete] +// CHECK:STDOUT: %Baz.type.280a69.2: type = fn_type @Baz.loc23 [concrete] // CHECK:STDOUT: %Baz.f49bdd.2: %Baz.type.280a69.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -54,7 +50,7 @@ fn Foo.Baz() { // CHECK:STDOUT: .Baz = %Baz.decl.loc17 // CHECK:STDOUT: } // CHECK:STDOUT: %Baz.decl.loc17: %Baz.type.280a69.1 = fn_decl @Baz.loc17 [concrete = constants.%Baz.f49bdd.1] {} {} -// CHECK:STDOUT: %Baz.decl.loc27: %Baz.type.280a69.2 = fn_decl @Baz.loc27 [concrete = constants.%Baz.f49bdd.2] {} {} +// CHECK:STDOUT: %Baz.decl.loc23: %Baz.type.280a69.2 = fn_decl @Baz.loc23 [concrete = constants.%Baz.f49bdd.2] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Baz.loc17() { @@ -62,7 +58,7 @@ fn Foo.Baz() { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Baz.loc27() { +// CHECK:STDOUT: fn @Baz.loc23() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/namespace/fail_modifiers.carbon b/toolchain/check/testdata/namespace/fail_modifiers.carbon index 93d87c6726e1..4ba570a4fc3a 100644 --- a/toolchain/check/testdata/namespace/fail_modifiers.carbon +++ b/toolchain/check/testdata/namespace/fail_modifiers.carbon @@ -12,50 +12,28 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/namespace/fail_modifiers.carbon -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+33]]:25: error: `base` not allowed on declaration with `abstract` [ModifierNotAllowedWith] -// CHECK:STDERR: private extern abstract base default final namespace A; -// CHECK:STDERR: ^~~~ -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+30]]:16: note: `abstract` previously appeared here [ModifierPrevious] -// CHECK:STDERR: private extern abstract base default final namespace A; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+15]]:25-28: error: `base` not allowed on declaration with `abstract` [ModifierNotAllowedWith] +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+14]]:16-23: note: `abstract` previously appeared here [ModifierPrevious] // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+26]]:30: error: `default` not allowed on declaration with `abstract` [ModifierNotAllowedWith] -// CHECK:STDERR: private extern abstract base default final namespace A; -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+23]]:16: note: `abstract` previously appeared here [ModifierPrevious] -// CHECK:STDERR: private extern abstract base default final namespace A; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+12]]:30-36: error: `default` not allowed on declaration with `abstract` [ModifierNotAllowedWith] +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+11]]:16-23: note: `abstract` previously appeared here [ModifierPrevious] // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+19]]:38: error: `final` not allowed on declaration with `abstract` [ModifierNotAllowedWith] -// CHECK:STDERR: private extern abstract base default final namespace A; -// CHECK:STDERR: ^~~~~ -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+16]]:16: note: `abstract` previously appeared here [ModifierPrevious] -// CHECK:STDERR: private extern abstract base default final namespace A; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+9]]:38-42: error: `final` not allowed on declaration with `abstract` [ModifierNotAllowedWith] +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+8]]:16-23: note: `abstract` previously appeared here [ModifierPrevious] // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+12]]:1: error: `private` not allowed on `namespace` declaration [ModifierNotAllowedOnDeclaration] -// CHECK:STDERR: private extern abstract base default final namespace A; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+6]]:1-7: error: `private` not allowed on `namespace` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+8]]:9: error: `extern` not allowed on `namespace` declaration [ModifierNotAllowedOnDeclaration] -// CHECK:STDERR: private extern abstract base default final namespace A; -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:9-14: error: `extern` not allowed on `namespace` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:16: error: `abstract` not allowed on `namespace` declaration [ModifierNotAllowedOnDeclaration] -// CHECK:STDERR: private extern abstract base default final namespace A; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:16-23: error: `abstract` not allowed on `namespace` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: private extern abstract base default final namespace A; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `impl` not allowed on `namespace` declaration [ModifierNotAllowedOnDeclaration] -// CHECK:STDERR: impl namespace B; -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-4: error: `impl` not allowed on `namespace` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: impl namespace B; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `extern` not allowed on `namespace` declaration [ModifierNotAllowedOnDeclaration] -// CHECK:STDERR: extern namespace C; -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-6: error: `extern` not allowed on `namespace` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: extern namespace C; diff --git a/toolchain/check/testdata/namespace/fail_not_top_level.carbon b/toolchain/check/testdata/namespace/fail_not_top_level.carbon index f2e47c2266c0..2c169ee5e4db 100644 --- a/toolchain/check/testdata/namespace/fail_not_top_level.carbon +++ b/toolchain/check/testdata/namespace/fail_not_top_level.carbon @@ -13,27 +13,21 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/namespace/fail_not_top_level.carbon fn F() { - // CHECK:STDERR: fail_not_top_level.carbon:[[@LINE+4]]:3: error: `namespace` declaration not at top level [NamespaceDeclNotAtTopLevel] - // CHECK:STDERR: namespace N; - // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_not_top_level.carbon:[[@LINE+2]]:3-14: error: `namespace` declaration not at top level [NamespaceDeclNotAtTopLevel] // CHECK:STDERR: namespace N; fn N.F() {} } class C { - // CHECK:STDERR: fail_not_top_level.carbon:[[@LINE+4]]:3: error: `namespace` declaration not at top level [NamespaceDeclNotAtTopLevel] - // CHECK:STDERR: namespace N; - // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_not_top_level.carbon:[[@LINE+2]]:3-14: error: `namespace` declaration not at top level [NamespaceDeclNotAtTopLevel] // CHECK:STDERR: namespace N; fn N.F() {} } interface I { - // CHECK:STDERR: fail_not_top_level.carbon:[[@LINE+4]]:3: error: `namespace` declaration not at top level [NamespaceDeclNotAtTopLevel] - // CHECK:STDERR: namespace N; - // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_not_top_level.carbon:[[@LINE+2]]:3-14: error: `namespace` declaration not at top level [NamespaceDeclNotAtTopLevel] // CHECK:STDERR: namespace N; fn N.I() {} @@ -45,16 +39,16 @@ interface I { // CHECK:STDOUT: type: type = facet_type [concrete] // CHECK:STDOUT: %F.type.eb3: type = fn_type @F.loc15 [concrete] // CHECK:STDOUT: %F.708: %F.type.eb3 = struct_value () [concrete] -// CHECK:STDOUT: %F.type.23e: type = fn_type @F.loc21 [concrete] +// CHECK:STDOUT: %F.type.23e: type = fn_type @F.loc19 [concrete] // CHECK:STDOUT: %F.7e0: %F.type.23e = struct_value () [concrete] // CHECK:STDOUT: %C: type = class_type @C [concrete] -// CHECK:STDOUT: %F.type.4e3: type = fn_type @F.loc30 [concrete] +// CHECK:STDOUT: %F.type.4e3: type = fn_type @F.loc26 [concrete] // CHECK:STDOUT: %F.57d: %F.type.4e3 = struct_value () [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: %I.type.8e7: type = facet_type <@I.loc33> [concrete] +// CHECK:STDOUT: %I.type.8e7: type = facet_type <@I.loc29> [concrete] // CHECK:STDOUT: %Self: %I.type.8e7 = symbolic_binding Self, 0 [symbolic] -// CHECK:STDOUT: %I.type.237: type = fn_type @I.loc39, @I.WithSelf(%Self) [symbolic] +// CHECK:STDOUT: %I.type.237: type = fn_type @I.loc33, @I.WithSelf(%Self) [symbolic] // CHECK:STDOUT: %I: %I.type.237 = struct_value () [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -75,18 +69,18 @@ interface I { // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %F.decl: %F.type.eb3 = fn_decl @F.loc15 [concrete = constants.%F.708] {} {} // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {} -// CHECK:STDOUT: %I.decl: type = interface_decl @I.loc33 [concrete = constants.%I.type.8e7] {} {} +// CHECK:STDOUT: %I.decl: type = interface_decl @I.loc29 [concrete = constants.%I.type.8e7] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: interface @I.loc33 { +// CHECK:STDOUT: interface @I.loc29 { // CHECK:STDOUT: %Self: %I.type.8e7 = symbolic_binding Self, 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %I.WithSelf.decl = interface_with_self_decl @I.loc33 [concrete] +// CHECK:STDOUT: %I.WithSelf.decl = interface_with_self_decl @I.loc29 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !with Self: // CHECK:STDOUT: %N: = namespace [concrete] { // CHECK:STDOUT: .I = %I.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %I.decl: @I.WithSelf.%I.type (%I.type.237) = fn_decl @I.loc39 [symbolic = @I.WithSelf.%I (constants.%I)] {} {} +// CHECK:STDOUT: %I.decl: @I.WithSelf.%I.type (%I.type.237) = fn_decl @I.loc33 [symbolic = @I.WithSelf.%I (constants.%I)] {} {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self @@ -100,7 +94,7 @@ interface I { // CHECK:STDOUT: %N: = namespace [concrete] { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %F.decl: %F.type.4e3 = fn_decl @F.loc30 [concrete = constants.%F.57d] {} {} +// CHECK:STDOUT: %F.decl: %F.type.4e3 = fn_decl @F.loc26 [concrete = constants.%F.57d] {} {} // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: @@ -114,21 +108,21 @@ interface I { // CHECK:STDOUT: %N: = namespace [concrete] { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %F.decl: %F.type.23e = fn_decl @F.loc21 [concrete = constants.%F.7e0] {} {} +// CHECK:STDOUT: %F.decl: %F.type.23e = fn_decl @F.loc19 [concrete = constants.%F.7e0] {} {} // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.loc21() { +// CHECK:STDOUT: fn @F.loc19() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.loc30() { +// CHECK:STDOUT: fn @F.loc26() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @I.loc39(@I.loc33.%Self: %I.type.8e7) { +// CHECK:STDOUT: generic fn @I.loc33(@I.loc29.%Self: %I.type.8e7) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: // CHECK:STDOUT: fn() { @@ -144,5 +138,5 @@ interface I { // CHECK:STDOUT: %I => constants.%I // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @I.loc39(constants.%Self) {} +// CHECK:STDOUT: specific @I.loc33(constants.%Self) {} // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/fail_params.carbon b/toolchain/check/testdata/namespace/fail_params.carbon index 6564c090f308..71d579cdc855 100644 --- a/toolchain/check/testdata/namespace/fail_params.carbon +++ b/toolchain/check/testdata/namespace/fail_params.carbon @@ -12,36 +12,26 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/namespace/fail_params.carbon -// CHECK:STDERR: fail_params.carbon:[[@LINE+4]]:12: error: `namespace` declaration cannot have parameters [UnexpectedDeclNameParams] -// CHECK:STDERR: namespace A(); -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_params.carbon:[[@LINE+2]]:12-13: error: `namespace` declaration cannot have parameters [UnexpectedDeclNameParams] // CHECK:STDERR: namespace A(); // Parameters are ignored for error recovery. fn A.F() {} -// CHECK:STDERR: fail_params.carbon:[[@LINE+4]]:12: error: `namespace` declaration cannot have parameters [UnexpectedDeclNameParams] -// CHECK:STDERR: namespace B(T: type); -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_params.carbon:[[@LINE+2]]:12-20: error: `namespace` declaration cannot have parameters [UnexpectedDeclNameParams] // CHECK:STDERR: namespace B(T: type); interface I(T: type) {} -// CHECK:STDERR: fail_params.carbon:[[@LINE+4]]:12: error: `namespace` declaration cannot have parameters [UnexpectedDeclNameParams] -// CHECK:STDERR: namespace C[T: type](U: I(T)); -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_params.carbon:[[@LINE+2]]:12-20: error: `namespace` declaration cannot have parameters [UnexpectedDeclNameParams] // CHECK:STDERR: namespace C[T: type](U: I(T)); namespace D; -// CHECK:STDERR: fail_params.carbon:[[@LINE+7]]:4: error: redeclaration differs because of parameter list [RedeclParamListDiffers] -// CHECK:STDERR: fn D(unused T: type).F() {} -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_params.carbon:[[@LINE-4]]:1: note: previously declared without parameter list [RedeclParamListPrevious] -// CHECK:STDERR: namespace D; -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_params.carbon:[[@LINE+3]]:4: error: redeclaration differs because of parameter list [RedeclParamListDiffers] +// CHECK:STDERR: fail_params.carbon:[[@LINE-2]]:1-12: note: previously declared without parameter list [RedeclParamListPrevious] // CHECK:STDERR: fn D(unused T: type).F() {} @@ -49,7 +39,7 @@ fn D(unused T: type).F() {} // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: type: type = facet_type [concrete] -// CHECK:STDOUT: %F.type.14e: type = fn_type @F.loc22 [concrete] +// CHECK:STDOUT: %F.type.14e: type = fn_type @F.loc20 [concrete] // CHECK:STDOUT: %F.19f: %F.type.14e = struct_value () [concrete] // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self] // CHECK:STDOUT: %pattern_type.9a5: type = pattern_type type [concrete] @@ -61,7 +51,7 @@ fn D(unused T: type).F() {} // CHECK:STDOUT: %Self: %I.type.184 = symbolic_binding Self, 1 [symbolic] // CHECK:STDOUT: %U: %I.type.184 = symbolic_binding U, 1 [symbolic] // CHECK:STDOUT: %T.67db0b.2: type = symbolic_binding T, 0 [symbolic] -// CHECK:STDOUT: %F.type.eb3: type = fn_type @F.loc46 [concrete] +// CHECK:STDOUT: %F.type.eb3: type = fn_type @F.loc36 [concrete] // CHECK:STDOUT: %F.708: %F.type.eb3 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -83,76 +73,76 @@ fn D(unused T: type).F() {} // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %A: = namespace [concrete] { -// CHECK:STDOUT: .F = %F.decl.loc22 +// CHECK:STDOUT: .F = %F.decl.loc20 // CHECK:STDOUT: } -// CHECK:STDOUT: %F.decl.loc22: %F.type.14e = fn_decl @F.loc22 [concrete = constants.%F.19f] {} {} -// CHECK:STDOUT: %.loc28_16.1: type = splice_block %.loc28_16.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc28: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc28_16.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %F.decl.loc20: %F.type.14e = fn_decl @F.loc20 [concrete = constants.%F.19f] {} {} +// CHECK:STDOUT: %.loc24_16.1: type = splice_block %.loc24_16.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc24: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc24_16.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc28: type = symbolic_binding T, 0 [symbolic = constants.%T.67db0b.1] +// CHECK:STDOUT: %T.loc24: type = symbolic_binding T, 0 [symbolic = constants.%T.67db0b.1] // CHECK:STDOUT: %B: = namespace [concrete] {} // CHECK:STDOUT: %I.decl: %I.type.335 = interface_decl @I [concrete = constants.%I.generic] { -// CHECK:STDOUT: %T.patt.loc30_14.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc30_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc26_14.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc26_14.2 (constants.%T.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc30_16.1: type = splice_block %.loc30_16.2 [concrete = type] { +// CHECK:STDOUT: %.loc26_16.1: type = splice_block %.loc26_16.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc30_16.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc26_16.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc30_14.2: type = symbolic_binding T, 0 [symbolic = %T.loc30_14.1 (constants.%T.67db0b.1)] +// CHECK:STDOUT: %T.loc26_14.2: type = symbolic_binding T, 0 [symbolic = %T.loc26_14.1 (constants.%T.67db0b.1)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc36_16.1: type = splice_block %.loc36_16.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc36_14: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc36_16.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc30_16.1: type = splice_block %.loc30_16.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc30_14: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc30_16.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc36: type = symbolic_binding T, 0 [symbolic = constants.%T.67db0b.1] -// CHECK:STDOUT: %.loc36_28: type = splice_block %I.type [symbolic = constants.%I.type.184] { -// CHECK:STDOUT: %.Self.frozen.loc36_23: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %T.loc30: type = symbolic_binding T, 0 [symbolic = constants.%T.67db0b.1] +// CHECK:STDOUT: %.loc30_28: type = splice_block %I.type [symbolic = constants.%I.type.184] { +// CHECK:STDOUT: %.Self.frozen.loc30_23: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %I.ref: %I.type.335 = name_ref I, %I.decl [concrete = constants.%I.generic] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc36 [symbolic = constants.%T.67db0b.1] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc30 [symbolic = constants.%T.67db0b.1] // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(constants.%T.67db0b.1)> [symbolic = constants.%I.type.184] // CHECK:STDOUT: } // CHECK:STDOUT: %U: %I.type.184 = symbolic_binding U, 1 [symbolic = constants.%U] // CHECK:STDOUT: %C: = namespace [concrete] {} // CHECK:STDOUT: %D: = namespace [concrete] {} -// CHECK:STDOUT: %F.decl.loc46: %F.type.eb3 = fn_decl @F.loc46 [concrete = constants.%F.708] {} { -// CHECK:STDOUT: %.loc46_16.1: type = splice_block %.loc46_16.2 [concrete = type] { +// CHECK:STDOUT: %F.decl.loc36: %F.type.eb3 = fn_decl @F.loc36 [concrete = constants.%F.708] {} { +// CHECK:STDOUT: %.loc36_16.1: type = splice_block %.loc36_16.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc46_16.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc36_16.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc46_14.3: type = symbolic_binding T, 0 [symbolic = %T.loc46_14.2 (constants.%T.67db0b.2)] +// CHECK:STDOUT: %T.loc36_14.3: type = symbolic_binding T, 0 [symbolic = %T.loc36_14.2 (constants.%T.67db0b.2)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @I(%T.loc30_14.2: type) { -// CHECK:STDOUT: %T.patt.loc30_14.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc30_14.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc30_14.1: type = symbolic_binding T, 0 [symbolic = %T.loc30_14.1 (constants.%T.67db0b.1)] +// CHECK:STDOUT: generic interface @I(%T.loc26_14.2: type) { +// CHECK:STDOUT: %T.patt.loc26_14.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc26_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc26_14.1: type = symbolic_binding T, 0 [symbolic = %T.loc26_14.1 (constants.%T.67db0b.1)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T.loc30_14.1)> [symbolic = %I.type (constants.%I.type.184)] -// CHECK:STDOUT: %Self.loc30_22.2: @I.%I.type (%I.type.184) = symbolic_binding Self, 1 [symbolic = %Self.loc30_22.2 (constants.%Self)] +// CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T.loc26_14.1)> [symbolic = %I.type (constants.%I.type.184)] +// CHECK:STDOUT: %Self.loc26_22.2: @I.%I.type (%I.type.184) = symbolic_binding Self, 1 [symbolic = %Self.loc26_22.2 (constants.%Self)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.loc30_22.1: @I.%I.type (%I.type.184) = symbolic_binding Self, 1 [symbolic = %Self.loc30_22.2 (constants.%Self)] +// CHECK:STDOUT: %Self.loc26_22.1: @I.%I.type (%I.type.184) = symbolic_binding Self, 1 [symbolic = %Self.loc26_22.2 (constants.%Self)] // CHECK:STDOUT: %I.WithSelf.decl = interface_with_self_decl @I [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.loc30_22.1 +// CHECK:STDOUT: .Self = %Self.loc26_22.1 // CHECK:STDOUT: witness = () // CHECK:STDOUT: // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.loc22() { +// CHECK:STDOUT: fn @F.loc20() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F.loc46(%T.loc46_14.3: type) { +// CHECK:STDOUT: generic fn @F.loc36(%T.loc36_14.3: type) { // CHECK:STDOUT: %T.patt: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)] -// CHECK:STDOUT: %T.loc46_14.1: type = symbolic_binding T, 0 [symbolic = %T.loc46_14.1 (constants.%T.67db0b.1)] -// CHECK:STDOUT: %T.loc46_14.2: type = symbolic_binding T, 0 [symbolic = %T.loc46_14.2 (constants.%T.67db0b.2)] +// CHECK:STDOUT: %T.loc36_14.1: type = symbolic_binding T, 0 [symbolic = %T.loc36_14.1 (constants.%T.67db0b.1)] +// CHECK:STDOUT: %T.loc36_14.2: type = symbolic_binding T, 0 [symbolic = %T.loc36_14.2 (constants.%T.67db0b.2)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -163,15 +153,15 @@ fn D(unused T: type).F() {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @I(constants.%T.67db0b.1) { -// CHECK:STDOUT: %T.patt.loc30_14.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc30_14.1 => constants.%T.67db0b.1 +// CHECK:STDOUT: %T.patt.loc26_14.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc26_14.1 => constants.%T.67db0b.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @I.WithSelf(constants.%T.67db0b.1, constants.%Self) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.loc46(constants.%T.67db0b.2) { +// CHECK:STDOUT: specific @F.loc36(constants.%T.67db0b.2) { // CHECK:STDOUT: %T.patt => constants.%T.patt -// CHECK:STDOUT: %T.loc46_14.1 => constants.%T.67db0b.2 -// CHECK:STDOUT: %T.loc46_14.2 => constants.%T.67db0b.2 +// CHECK:STDOUT: %T.loc36_14.1 => constants.%T.67db0b.2 +// CHECK:STDOUT: %T.loc36_14.2 => constants.%T.67db0b.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/fail_unresolved_scope.carbon b/toolchain/check/testdata/namespace/fail_unresolved_scope.carbon index 1a25d643473d..bc16f7c81bc5 100644 --- a/toolchain/check/testdata/namespace/fail_unresolved_scope.carbon +++ b/toolchain/check/testdata/namespace/fail_unresolved_scope.carbon @@ -12,9 +12,7 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/namespace/fail_unresolved_scope.carbon -// CHECK:STDERR: fail_unresolved_scope.carbon:[[@LINE+4]]:4: error: name `Foo` not found [NameNotFound] -// CHECK:STDERR: fn Foo.Baz() { -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_unresolved_scope.carbon:[[@LINE+2]]:4-6: error: name `Foo` not found [NameNotFound] // CHECK:STDERR: fn Foo.Baz() { } diff --git a/toolchain/check/testdata/namespace/imported_indirect.carbon b/toolchain/check/testdata/namespace/imported_indirect.carbon index b919a2242519..f5733a471f7d 100644 --- a/toolchain/check/testdata/namespace/imported_indirect.carbon +++ b/toolchain/check/testdata/namespace/imported_indirect.carbon @@ -56,18 +56,12 @@ package Same library "[[@TEST_NAME]]"; import library "b"; -// CHECK:STDERR: fail_named_indirectly_same_package.carbon:[[@LINE+13]]:10: error: function returns incomplete type `A.C` [IncompleteTypeInFunctionReturnType] -// CHECK:STDERR: fn G() { F(); } -// CHECK:STDERR: ^~~ -// CHECK:STDERR: fail_named_indirectly_same_package.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: b.carbon:3:1: in import [InImport] -// CHECK:STDERR: a.carbon:6:1: note: class was forward declared here [ClassForwardDeclaredHere] -// CHECK:STDERR: class A.C; -// CHECK:STDERR: ^~~~~~~~~~ -// CHECK:STDERR: fail_named_indirectly_same_package.carbon:[[@LINE-10]]:1: in import [InImport] -// CHECK:STDERR: b.carbon:7:8: note: return type declared here [IncompleteReturnTypeHere] -// CHECK:STDERR: fn F() -> A.C; -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_named_indirectly_same_package.carbon:[[@LINE+7]]:10-12: error: function returns incomplete type `A.C` [IncompleteTypeInFunctionReturnType] +// CHECK:STDERR: imported from: fail_named_indirectly_same_package.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: imported from: b.carbon:3:1 [InImport] +// CHECK:STDERR: a.carbon:6:1-10: note: class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: imported from: fail_named_indirectly_same_package.carbon:[[@LINE-6]]:1 [InImport] +// CHECK:STDERR: b.carbon:7:8-13: note: return type declared here [IncompleteReturnTypeHere] // CHECK:STDERR: fn G() { F(); } @@ -77,18 +71,12 @@ package Other library "[[@TEST_NAME]]"; import Same library "b"; -// CHECK:STDERR: fail_named_indirectly_different_package.carbon:[[@LINE+13]]:10: error: function returns incomplete type `Same.A.C` [IncompleteTypeInFunctionReturnType] -// CHECK:STDERR: fn G() { Same.F(); } -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_named_indirectly_different_package.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: b.carbon:3:1: in import [InImport] -// CHECK:STDERR: a.carbon:6:1: note: class was forward declared here [ClassForwardDeclaredHere] -// CHECK:STDERR: class A.C; -// CHECK:STDERR: ^~~~~~~~~~ -// CHECK:STDERR: fail_named_indirectly_different_package.carbon:[[@LINE-10]]:1: in import [InImport] -// CHECK:STDERR: b.carbon:7:8: note: return type declared here [IncompleteReturnTypeHere] -// CHECK:STDERR: fn F() -> A.C; -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_named_indirectly_different_package.carbon:[[@LINE+7]]:10-17: error: function returns incomplete type `Same.A.C` [IncompleteTypeInFunctionReturnType] +// CHECK:STDERR: imported from: fail_named_indirectly_different_package.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: imported from: b.carbon:3:1 [InImport] +// CHECK:STDERR: a.carbon:6:1-10: note: class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: imported from: fail_named_indirectly_different_package.carbon:[[@LINE-6]]:1 [InImport] +// CHECK:STDERR: b.carbon:7:8-13: note: return type declared here [IncompleteReturnTypeHere] // CHECK:STDERR: fn G() { Same.F(); } diff --git a/toolchain/check/testdata/namespace/name_poisoning.carbon b/toolchain/check/testdata/namespace/name_poisoning.carbon index 122cd30d461e..803caf666710 100644 --- a/toolchain/check/testdata/namespace/name_poisoning.carbon +++ b/toolchain/check/testdata/namespace/name_poisoning.carbon @@ -46,15 +46,11 @@ namespace N1; // Use `package.N1` and poison `N2.N1`. namespace N2; -// CHECK:STDERR: fail_declare_after_poison.carbon:[[@LINE+3]]:15: error: name `N1` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: alias N2.N3 = N1; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_declare_after_poison.carbon:[[@LINE+1]]:15-16: error: name `N1` used before it was declared [NameUseBeforeDecl] alias N2.N3 = N1; // Failure: N2.N1 declared after it was poisoned. -// CHECK:STDERR: fail_declare_after_poison.carbon:[[@LINE+4]]:14: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: namespace N2.N1; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_declare_after_poison.carbon:[[@LINE+2]]:14-15: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: namespace N2.N1; @@ -68,9 +64,7 @@ namespace N1; namespace N2; alias N2.N3 = N1; -// CHECK:STDERR: fail_use_poison.carbon:[[@LINE+4]]:15: error: member name `N1` not found in `N2` [MemberNameNotFoundInInstScope] -// CHECK:STDERR: alias N2.N4 = N2.N1; -// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: fail_use_poison.carbon:[[@LINE+2]]:15-19: error: member name `N1` not found in `N2` [MemberNameNotFoundInInstScope] // CHECK:STDERR: alias N2.N4 = N2.N1; @@ -82,21 +76,15 @@ namespace N1; // Use `package.N1` and poison `N2.N1`. namespace N2; -// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+3]]:15: error: name `N1` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: alias N2.N3 = N1; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+1]]:15-16: error: name `N1` used before it was declared [NameUseBeforeDecl] alias N2.N3 = N1; // Failure: `N2.N1` declared after it was poisoned. -// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+4]]:14: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: namespace N2.N1; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+2]]:14-15: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: namespace N2.N1; -// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+4]]:15: error: member name `N1` not found in `N2` [MemberNameNotFoundInInstScope] -// CHECK:STDERR: alias N2.N4 = N2.N1; -// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+2]]:15-19: error: member name `N1` not found in `N2` [MemberNameNotFoundInInstScope] // CHECK:STDERR: alias N2.N4 = N2.N1; @@ -105,12 +93,8 @@ alias N2.N4 = N2.N1; namespace N1; namespace N2; -// CHECK:STDERR: fail_alias.carbon:[[@LINE+7]]:15: error: name `N1` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: alias N2.N1 = N1; -// CHECK:STDERR: ^~ -// CHECK:STDERR: fail_alias.carbon:[[@LINE+4]]:10: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: alias N2.N1 = N1; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_alias.carbon:[[@LINE+3]]:15-16: error: name `N1` used before it was declared [NameUseBeforeDecl] +// CHECK:STDERR: fail_alias.carbon:[[@LINE+2]]:10-11: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: alias N2.N1 = N1; @@ -126,30 +110,18 @@ namespace N2.N3.N4; // * `N2.N1` // * `N2.N3.N1` // * `N2.N3.N4.N1` -// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+3]]:21: error: name `N1` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: alias N2.N3.N4.N5 = N1; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+1]]:21-22: error: name `N1` used before it was declared [NameUseBeforeDecl] alias N2.N3.N4.N5 = N1; -// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+7]]:20: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: namespace N2.N3.N4.N1; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+3]]:20-21: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: -// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE-6]]:21: error: name `N1` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: alias N2.N3.N4.N5 = N1; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE-4]]:21-22: error: name `N1` used before it was declared [NameUseBeforeDecl] namespace N2.N3.N4.N1; -// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+7]]:17: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: namespace N2.N3.N1; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+3]]:17-18: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: -// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE-14]]:21: error: name `N1` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: alias N2.N3.N4.N5 = N1; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE-8]]:21-22: error: name `N1` used before it was declared [NameUseBeforeDecl] namespace N2.N3.N1; -// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+4]]:14: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: namespace N2.N1; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+2]]:14-15: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: namespace N2.N1; @@ -174,26 +146,16 @@ library "[[@TEST_NAME]]"; namespace N1; // `N1.N3` poisoned when not found. -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+7]]:15: error: name `N3` not found [NameNotFound] -// CHECK:STDERR: alias N1.N2 = N3; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+3]]:15-16: error: name `N3` not found [NameNotFound] // CHECK:STDERR: -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+3]]:15: error: name `N3` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: alias N1.N2 = N3; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+1]]:15-16: error: name `N3` used before it was declared [NameUseBeforeDecl] alias N1.N2 = N3; // TODO: We should ideally only produce one diagnostic here. -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+7]]:11: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: namespace N3; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+3]]:11-12: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE-7]]:15: error: name `N3` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: alias N1.N2 = N3; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE-5]]:15-16: error: name `N3` used before it was declared [NameUseBeforeDecl] namespace N3; -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+4]]:14: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: namespace N1.N3; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+2]]:14-15: note: declared here [NameUseBeforeDeclNote] // CHECK:STDERR: namespace N1.N3; diff --git a/toolchain/check/testdata/operators/builtin/bit_and.carbon b/toolchain/check/testdata/operators/builtin/bit_and.carbon index 21b1507e3cbf..e8369b473764 100644 --- a/toolchain/check/testdata/operators/builtin/bit_and.carbon +++ b/toolchain/check/testdata/operators/builtin/bit_and.carbon @@ -26,23 +26,15 @@ interface I {} class J {} class K {} -// CHECK:STDERR: fail_bit_and_non_facet_types.carbon:[[@LINE+4]]:10: error: non-facet type `J` combined with `&` operator [FacetTypeRequiredForTypeAndOperator] -// CHECK:STDERR: fn F1[T: I & J](unused t: T) {} -// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: fail_bit_and_non_facet_types.carbon:[[@LINE+2]]:10-14: error: non-facet type `J` combined with `&` operator [FacetTypeRequiredForTypeAndOperator] // CHECK:STDERR: fn F1[T: I & J](unused t: T) {} -// CHECK:STDERR: fail_bit_and_non_facet_types.carbon:[[@LINE+4]]:10: error: non-facet type `J` combined with `&` operator [FacetTypeRequiredForTypeAndOperator] -// CHECK:STDERR: fn F2[T: J & I](unused t: T) {} -// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: fail_bit_and_non_facet_types.carbon:[[@LINE+2]]:10-14: error: non-facet type `J` combined with `&` operator [FacetTypeRequiredForTypeAndOperator] // CHECK:STDERR: fn F2[T: J & I](unused t: T) {} -// CHECK:STDERR: fail_bit_and_non_facet_types.carbon:[[@LINE+8]]:10: error: non-facet type `J` combined with `&` operator [FacetTypeRequiredForTypeAndOperator] -// CHECK:STDERR: fn F3[T: J & K](unused t: T) {} -// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: fail_bit_and_non_facet_types.carbon:[[@LINE+4]]:10-14: error: non-facet type `J` combined with `&` operator [FacetTypeRequiredForTypeAndOperator] // CHECK:STDERR: -// CHECK:STDERR: fail_bit_and_non_facet_types.carbon:[[@LINE+4]]:10: error: non-facet type `K` combined with `&` operator [FacetTypeRequiredForTypeAndOperator] -// CHECK:STDERR: fn F3[T: J & K](unused t: T) {} -// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: fail_bit_and_non_facet_types.carbon:[[@LINE+2]]:10-14: error: non-facet type `K` combined with `&` operator [FacetTypeRequiredForTypeAndOperator] // CHECK:STDERR: fn F3[T: J & K](unused t: T) {} @@ -68,9 +60,7 @@ class J { adapt {}; } fn F() { let a: J = {} as J; let b: J = {} as J; - // CHECK:STDERR: fail_bit_and_values_no_impl.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Core.BitAndWith(J)` in type `J` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: a & b; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_bit_and_values_no_impl.carbon:[[@LINE+2]]:3-7: error: cannot access member of interface `Core.BitAndWith(J)` in type `J` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: a & b; } diff --git a/toolchain/check/testdata/operators/builtin/fail_and_or_not_in_function.carbon b/toolchain/check/testdata/operators/builtin/fail_and_or_not_in_function.carbon index f6ad3bffc31a..806a9ee60d4f 100644 --- a/toolchain/check/testdata/operators/builtin/fail_and_or_not_in_function.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_and_or_not_in_function.carbon @@ -22,9 +22,7 @@ fn F(b: bool) -> type { } // TODO: Short-circuit operators should be permitted outside functions. -// CHECK:STDERR: fail_and.carbon:[[@LINE+4]]:13: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] -// CHECK:STDERR: var and_: F(true and true); -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_and.carbon:[[@LINE+2]]:13-25: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] // CHECK:STDERR: var and_: F(true and true); @@ -32,13 +30,9 @@ var and_: F(true and true); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_and_val.carbon:[[@LINE+8]]:21: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] -// CHECK:STDERR: var and_val: bool = true and true; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_and_val.carbon:[[@LINE+4]]:21-28: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] // CHECK:STDERR: -// CHECK:STDERR: fail_and_val.carbon:[[@LINE+4]]:21: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] -// CHECK:STDERR: var and_val: bool = true and true; -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_and_val.carbon:[[@LINE+2]]:21-33: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] // CHECK:STDERR: var and_val: bool = true and true; @@ -51,9 +45,7 @@ fn F(b: bool) -> type { return if b then i32 else f64; } -// CHECK:STDERR: fail_or.carbon:[[@LINE+4]]:12: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] -// CHECK:STDERR: var or_: F(true or true); -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_or.carbon:[[@LINE+2]]:12-23: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] // CHECK:STDERR: var or_: F(true or true); @@ -61,13 +53,9 @@ var or_: F(true or true); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_or_val.carbon:[[@LINE+8]]:20: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] -// CHECK:STDERR: var or_val: bool = true or true; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_or_val.carbon:[[@LINE+4]]:20-26: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] // CHECK:STDERR: -// CHECK:STDERR: fail_or_val.carbon:[[@LINE+4]]:20: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] -// CHECK:STDERR: var or_val: bool = true or true; -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_or_val.carbon:[[@LINE+2]]:20-31: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] // CHECK:STDERR: var or_val: bool = true or true; @@ -79,9 +67,7 @@ base class C(B: bool) {} fn F() { class B { - // CHECK:STDERR: fail_nested.carbon:[[@LINE+4]]:20: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] - // CHECK:STDERR: extend base: C(true or false); - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_nested.carbon:[[@LINE+2]]:20-32: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] // CHECK:STDERR: extend base: C(true or false); } @@ -201,10 +187,10 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: class @B { // CHECK:STDOUT: %C.ref: %C.type = name_ref C, .inst{{[0-9A-F]+}}.loc4_23 [concrete = constants.%C.generic] -// CHECK:STDOUT: %true.loc12_20: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: %.loc12: bool = not %true.loc12_20 [concrete = constants.%false] -// CHECK:STDOUT: %true.loc12_25: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: if %.loc12 br !or.rhs else br !or.result(%true.loc12_25) +// CHECK:STDOUT: %true.loc10_20: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: %.loc10: bool = not %true.loc10_20 [concrete = constants.%false] +// CHECK:STDOUT: %true.loc10_25: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: if %.loc10 br !or.rhs else br !or.result(%true.loc10_25) // CHECK:STDOUT: complete_type_witness = invalid // CHECK:STDOUT: // CHECK:STDOUT: !members: diff --git a/toolchain/check/testdata/operators/builtin/fail_and_or_partial_constant.carbon b/toolchain/check/testdata/operators/builtin/fail_and_or_partial_constant.carbon index c83fcf6eecf2..54e02c16ceb3 100644 --- a/toolchain/check/testdata/operators/builtin/fail_and_or_partial_constant.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_and_or_partial_constant.carbon @@ -17,14 +17,10 @@ package FailNonConstantResult; fn PartialConstant(x: bool) { - // CHECK:STDERR: fail_non_constant_result.carbon:[[@LINE+4]]:17: error: cannot evaluate type expression [TypeExprEvaluationFailure] - // CHECK:STDERR: var unused a: if true and x then bool else (); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_non_constant_result.carbon:[[@LINE+2]]:17-47: error: cannot evaluate type expression [TypeExprEvaluationFailure] // CHECK:STDERR: var unused a: if true and x then bool else (); - // CHECK:STDERR: fail_non_constant_result.carbon:[[@LINE+4]]:17: error: cannot evaluate type expression [TypeExprEvaluationFailure] - // CHECK:STDERR: var unused b: if false or x then bool else (); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_non_constant_result.carbon:[[@LINE+2]]:17-47: error: cannot evaluate type expression [TypeExprEvaluationFailure] // CHECK:STDERR: var unused b: if false or x then bool else (); } @@ -36,14 +32,10 @@ package FailDespiteKnownResult; fn KnownValueButNonConstantCondition(x: bool) { // We choose not to give these cases constant values, even though we could, // because they notionally involve evaluating a non-constant condition. - // CHECK:STDERR: fail_despite_known_result.carbon:[[@LINE+4]]:17: error: cannot evaluate type expression [TypeExprEvaluationFailure] - // CHECK:STDERR: var unused c: if x and false then bool else (); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_despite_known_result.carbon:[[@LINE+2]]:17-48: error: cannot evaluate type expression [TypeExprEvaluationFailure] // CHECK:STDERR: var unused c: if x and false then bool else (); - // CHECK:STDERR: fail_despite_known_result.carbon:[[@LINE+4]]:17: error: cannot evaluate type expression [TypeExprEvaluationFailure] - // CHECK:STDERR: var unused d: if x or true then bool else (); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_despite_known_result.carbon:[[@LINE+2]]:17-46: error: cannot evaluate type expression [TypeExprEvaluationFailure] // CHECK:STDERR: var unused d: if x or true then bool else (); } @@ -95,35 +87,35 @@ fn KnownValueButNonConstantCondition(x: bool) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.var: ref = var_storage %a.var_patt [concrete = ] // CHECK:STDOUT: assign %a.var, -// CHECK:STDOUT: br !.loc9_20 +// CHECK:STDOUT: br !.loc7_20 // CHECK:STDOUT: -// CHECK:STDOUT: !.loc9_20: -// CHECK:STDOUT: %true.loc9: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: %false.loc9: bool = bool_literal false [concrete = constants.%false] -// CHECK:STDOUT: if %true.loc9 br !and.rhs else br !and.result(%false.loc9) +// CHECK:STDOUT: !.loc7_20: +// CHECK:STDOUT: %true.loc7: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: %false.loc7: bool = bool_literal false [concrete = constants.%false] +// CHECK:STDOUT: if %true.loc7 br !and.rhs else br !and.result(%false.loc7) // CHECK:STDOUT: // CHECK:STDOUT: !and.rhs: -// CHECK:STDOUT: %x.ref.loc9: bool = name_ref x, %x -// CHECK:STDOUT: br !and.result(%x.ref.loc9) +// CHECK:STDOUT: %x.ref.loc7: bool = name_ref x, %x +// CHECK:STDOUT: br !and.result(%x.ref.loc7) // CHECK:STDOUT: // CHECK:STDOUT: !and.result: -// CHECK:STDOUT: %.loc9_25: bool = block_arg !and.result -// CHECK:STDOUT: if %.loc9_25 br !if.expr.then.loc9 else br !if.expr.else.loc9 +// CHECK:STDOUT: %.loc7_25: bool = block_arg !and.result +// CHECK:STDOUT: if %.loc7_25 br !if.expr.then.loc7 else br !if.expr.else.loc7 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc9: -// CHECK:STDOUT: %.loc9_36: type = type_literal bool [concrete = bool] -// CHECK:STDOUT: br !if.expr.result.loc9(%.loc9_36) +// CHECK:STDOUT: !if.expr.then.loc7: +// CHECK:STDOUT: %.loc7_36: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: br !if.expr.result.loc7(%.loc7_36) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc9: -// CHECK:STDOUT: %.loc9_47: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc9_41: type = converted %.loc9_47, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: br !if.expr.result.loc9(%.loc9_41) +// CHECK:STDOUT: !if.expr.else.loc7: +// CHECK:STDOUT: %.loc7_47: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc7_41: type = converted %.loc7_47, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: br !if.expr.result.loc7(%.loc7_41) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc9: -// CHECK:STDOUT: %.loc9_17: type = block_arg !if.expr.result.loc9 -// CHECK:STDOUT: br !.loc9_15 +// CHECK:STDOUT: !if.expr.result.loc7: +// CHECK:STDOUT: %.loc7_17: type = block_arg !if.expr.result.loc7 +// CHECK:STDOUT: br !.loc7_15 // CHECK:STDOUT: -// CHECK:STDOUT: !.loc9_15: +// CHECK:STDOUT: !.loc7_15: // CHECK:STDOUT: %a: = wrapper_binding a, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %a.patt: = ref_binding_pattern a [concrete = ] @@ -131,36 +123,36 @@ fn KnownValueButNonConstantCondition(x: bool) { // CHECK:STDOUT: } // CHECK:STDOUT: %b.var: ref = var_storage %b.var_patt [concrete = ] // CHECK:STDOUT: assign %b.var, -// CHECK:STDOUT: br !.loc14_20 +// CHECK:STDOUT: br !.loc10_20 // CHECK:STDOUT: -// CHECK:STDOUT: !.loc14_20: -// CHECK:STDOUT: %false.loc14: bool = bool_literal false [concrete = constants.%false] -// CHECK:STDOUT: %.loc14_26.1: bool = not %false.loc14 [concrete = constants.%true] -// CHECK:STDOUT: %true.loc14: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: if %.loc14_26.1 br !or.rhs else br !or.result(%true.loc14) +// CHECK:STDOUT: !.loc10_20: +// CHECK:STDOUT: %false.loc10: bool = bool_literal false [concrete = constants.%false] +// CHECK:STDOUT: %.loc10_26.1: bool = not %false.loc10 [concrete = constants.%true] +// CHECK:STDOUT: %true.loc10: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: if %.loc10_26.1 br !or.rhs else br !or.result(%true.loc10) // CHECK:STDOUT: // CHECK:STDOUT: !or.rhs: -// CHECK:STDOUT: %x.ref.loc14: bool = name_ref x, %x -// CHECK:STDOUT: br !or.result(%x.ref.loc14) +// CHECK:STDOUT: %x.ref.loc10: bool = name_ref x, %x +// CHECK:STDOUT: br !or.result(%x.ref.loc10) // CHECK:STDOUT: // CHECK:STDOUT: !or.result: -// CHECK:STDOUT: %.loc14_26.2: bool = block_arg !or.result -// CHECK:STDOUT: if %.loc14_26.2 br !if.expr.then.loc14 else br !if.expr.else.loc14 +// CHECK:STDOUT: %.loc10_26.2: bool = block_arg !or.result +// CHECK:STDOUT: if %.loc10_26.2 br !if.expr.then.loc10 else br !if.expr.else.loc10 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc14: -// CHECK:STDOUT: %.loc14_36: type = type_literal bool [concrete = bool] -// CHECK:STDOUT: br !if.expr.result.loc14(%.loc14_36) +// CHECK:STDOUT: !if.expr.then.loc10: +// CHECK:STDOUT: %.loc10_36: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: br !if.expr.result.loc10(%.loc10_36) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc14: -// CHECK:STDOUT: %.loc14_47: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc14_41: type = converted %.loc14_47, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: br !if.expr.result.loc14(%.loc14_41) +// CHECK:STDOUT: !if.expr.else.loc10: +// CHECK:STDOUT: %.loc10_47: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc10_41: type = converted %.loc10_47, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: br !if.expr.result.loc10(%.loc10_41) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc14: -// CHECK:STDOUT: %.loc14_17: type = block_arg !if.expr.result.loc14 -// CHECK:STDOUT: br !.loc14_15 +// CHECK:STDOUT: !if.expr.result.loc10: +// CHECK:STDOUT: %.loc10_17: type = block_arg !if.expr.result.loc10 +// CHECK:STDOUT: br !.loc10_15 // CHECK:STDOUT: -// CHECK:STDOUT: !.loc14_15: +// CHECK:STDOUT: !.loc10_15: // CHECK:STDOUT: %b: = wrapper_binding b, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %b.patt: = ref_binding_pattern b [concrete = ] @@ -216,35 +208,35 @@ fn KnownValueButNonConstantCondition(x: bool) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %c.var: ref = var_storage %c.var_patt [concrete = ] // CHECK:STDOUT: assign %c.var, -// CHECK:STDOUT: br !.loc11_20 +// CHECK:STDOUT: br !.loc9_20 // CHECK:STDOUT: -// CHECK:STDOUT: !.loc11_20: -// CHECK:STDOUT: %x.ref.loc11: bool = name_ref x, %x -// CHECK:STDOUT: %false.loc11_22: bool = bool_literal false [concrete = constants.%false] -// CHECK:STDOUT: if %x.ref.loc11 br !and.rhs else br !and.result(%false.loc11_22) +// CHECK:STDOUT: !.loc9_20: +// CHECK:STDOUT: %x.ref.loc9: bool = name_ref x, %x +// CHECK:STDOUT: %false.loc9_22: bool = bool_literal false [concrete = constants.%false] +// CHECK:STDOUT: if %x.ref.loc9 br !and.rhs else br !and.result(%false.loc9_22) // CHECK:STDOUT: // CHECK:STDOUT: !and.rhs: -// CHECK:STDOUT: %false.loc11_26: bool = bool_literal false [concrete = constants.%false] -// CHECK:STDOUT: br !and.result(%false.loc11_26) +// CHECK:STDOUT: %false.loc9_26: bool = bool_literal false [concrete = constants.%false] +// CHECK:STDOUT: br !and.result(%false.loc9_26) // CHECK:STDOUT: // CHECK:STDOUT: !and.result: -// CHECK:STDOUT: %.loc11_22: bool = block_arg !and.result -// CHECK:STDOUT: if %.loc11_22 br !if.expr.then.loc11 else br !if.expr.else.loc11 +// CHECK:STDOUT: %.loc9_22: bool = block_arg !and.result +// CHECK:STDOUT: if %.loc9_22 br !if.expr.then.loc9 else br !if.expr.else.loc9 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc11: -// CHECK:STDOUT: %.loc11_37: type = type_literal bool [concrete = bool] -// CHECK:STDOUT: br !if.expr.result.loc11(%.loc11_37) +// CHECK:STDOUT: !if.expr.then.loc9: +// CHECK:STDOUT: %.loc9_37: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: br !if.expr.result.loc9(%.loc9_37) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc11: -// CHECK:STDOUT: %.loc11_48: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc11_42: type = converted %.loc11_48, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: br !if.expr.result.loc11(%.loc11_42) +// CHECK:STDOUT: !if.expr.else.loc9: +// CHECK:STDOUT: %.loc9_48: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc9_42: type = converted %.loc9_48, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: br !if.expr.result.loc9(%.loc9_42) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc11: -// CHECK:STDOUT: %.loc11_17: type = block_arg !if.expr.result.loc11 -// CHECK:STDOUT: br !.loc11_15 +// CHECK:STDOUT: !if.expr.result.loc9: +// CHECK:STDOUT: %.loc9_17: type = block_arg !if.expr.result.loc9 +// CHECK:STDOUT: br !.loc9_15 // CHECK:STDOUT: -// CHECK:STDOUT: !.loc11_15: +// CHECK:STDOUT: !.loc9_15: // CHECK:STDOUT: %c: = wrapper_binding c, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %c.patt: = ref_binding_pattern c [concrete = ] @@ -252,36 +244,36 @@ fn KnownValueButNonConstantCondition(x: bool) { // CHECK:STDOUT: } // CHECK:STDOUT: %d.var: ref = var_storage %d.var_patt [concrete = ] // CHECK:STDOUT: assign %d.var, -// CHECK:STDOUT: br !.loc16_20 +// CHECK:STDOUT: br !.loc12_20 // CHECK:STDOUT: -// CHECK:STDOUT: !.loc16_20: -// CHECK:STDOUT: %x.ref.loc16: bool = name_ref x, %x -// CHECK:STDOUT: %.loc16_22.1: bool = not %x.ref.loc16 -// CHECK:STDOUT: %true.loc16_22: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: if %.loc16_22.1 br !or.rhs else br !or.result(%true.loc16_22) +// CHECK:STDOUT: !.loc12_20: +// CHECK:STDOUT: %x.ref.loc12: bool = name_ref x, %x +// CHECK:STDOUT: %.loc12_22.1: bool = not %x.ref.loc12 +// CHECK:STDOUT: %true.loc12_22: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: if %.loc12_22.1 br !or.rhs else br !or.result(%true.loc12_22) // CHECK:STDOUT: // CHECK:STDOUT: !or.rhs: -// CHECK:STDOUT: %true.loc16_25: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: br !or.result(%true.loc16_25) +// CHECK:STDOUT: %true.loc12_25: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: br !or.result(%true.loc12_25) // CHECK:STDOUT: // CHECK:STDOUT: !or.result: -// CHECK:STDOUT: %.loc16_22.2: bool = block_arg !or.result -// CHECK:STDOUT: if %.loc16_22.2 br !if.expr.then.loc16 else br !if.expr.else.loc16 +// CHECK:STDOUT: %.loc12_22.2: bool = block_arg !or.result +// CHECK:STDOUT: if %.loc12_22.2 br !if.expr.then.loc12 else br !if.expr.else.loc12 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc16: -// CHECK:STDOUT: %.loc16_35: type = type_literal bool [concrete = bool] -// CHECK:STDOUT: br !if.expr.result.loc16(%.loc16_35) +// CHECK:STDOUT: !if.expr.then.loc12: +// CHECK:STDOUT: %.loc12_35: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: br !if.expr.result.loc12(%.loc12_35) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc16: -// CHECK:STDOUT: %.loc16_46: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc16_40: type = converted %.loc16_46, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: br !if.expr.result.loc16(%.loc16_40) +// CHECK:STDOUT: !if.expr.else.loc12: +// CHECK:STDOUT: %.loc12_46: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc12_40: type = converted %.loc12_46, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: br !if.expr.result.loc12(%.loc12_40) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc16: -// CHECK:STDOUT: %.loc16_17: type = block_arg !if.expr.result.loc16 -// CHECK:STDOUT: br !.loc16_15 +// CHECK:STDOUT: !if.expr.result.loc12: +// CHECK:STDOUT: %.loc12_17: type = block_arg !if.expr.result.loc12 +// CHECK:STDOUT: br !.loc12_15 // CHECK:STDOUT: -// CHECK:STDOUT: !.loc16_15: +// CHECK:STDOUT: !.loc12_15: // CHECK:STDOUT: %d: = wrapper_binding d, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %d.patt: = ref_binding_pattern d [concrete = ] diff --git a/toolchain/check/testdata/operators/builtin/fail_assignment_to_error.carbon b/toolchain/check/testdata/operators/builtin/fail_assignment_to_error.carbon index 341c253e913b..1cd66639f789 100644 --- a/toolchain/check/testdata/operators/builtin/fail_assignment_to_error.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_assignment_to_error.carbon @@ -13,14 +13,10 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/builtin/fail_assignment_to_error.carbon fn Main() { - // CHECK:STDERR: fail_assignment_to_error.carbon:[[@LINE+4]]:3: error: name `undeclared` not found [NameNotFound] - // CHECK:STDERR: undeclared = 42; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_assignment_to_error.carbon:[[@LINE+2]]:3-12: error: name `undeclared` not found [NameNotFound] // CHECK:STDERR: undeclared = 42; - // CHECK:STDERR: fail_assignment_to_error.carbon:[[@LINE+4]]:4: error: name `also_undeclared` not found [NameNotFound] - // CHECK:STDERR: *also_undeclared = 42; - // CHECK:STDERR: ^~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_assignment_to_error.carbon:[[@LINE+2]]:4-18: error: name `also_undeclared` not found [NameNotFound] // CHECK:STDERR: *also_undeclared = 42; } @@ -55,12 +51,12 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %undeclared.ref: = name_ref undeclared, [concrete = ] -// CHECK:STDOUT: %int_42.loc20: Core.IntLiteral = int_value 42 [concrete = constants.%int_42] +// CHECK:STDOUT: %int_42.loc18: Core.IntLiteral = int_value 42 [concrete = constants.%int_42] // CHECK:STDOUT: assign %undeclared.ref, // CHECK:STDOUT: %also_undeclared.ref: = name_ref also_undeclared, [concrete = ] -// CHECK:STDOUT: %.loc25: ref = deref [concrete = ] -// CHECK:STDOUT: %int_42.loc25: Core.IntLiteral = int_value 42 [concrete = constants.%int_42] -// CHECK:STDOUT: assign %.loc25, +// CHECK:STDOUT: %.loc21: ref = deref [concrete = ] +// CHECK:STDOUT: %int_42.loc21: Core.IntLiteral = int_value 42 [concrete = constants.%int_42] +// CHECK:STDOUT: assign %.loc21, // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/fail_assignment_to_non_assignable.carbon b/toolchain/check/testdata/operators/builtin/fail_assignment_to_non_assignable.carbon index df0a07064da6..6f543d1993e7 100644 --- a/toolchain/check/testdata/operators/builtin/fail_assignment_to_non_assignable.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_assignment_to_non_assignable.carbon @@ -15,48 +15,32 @@ fn F() -> i32; fn Main() { - // CHECK:STDERR: fail_assignment_to_non_assignable.carbon:[[@LINE+4]]:3: error: expression is not assignable [AssignmentToNonAssignable] - // CHECK:STDERR: 1 = 2; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_assignment_to_non_assignable.carbon:[[@LINE+2]]:3: error: expression is not assignable [AssignmentToNonAssignable] // CHECK:STDERR: 1 = 2; - // CHECK:STDERR: fail_assignment_to_non_assignable.carbon:[[@LINE+4]]:3: error: expression is not assignable [AssignmentToNonAssignable] - // CHECK:STDERR: F() = 1; - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_assignment_to_non_assignable.carbon:[[@LINE+2]]:3-5: error: expression is not assignable [AssignmentToNonAssignable] // CHECK:STDERR: F() = 1; - // CHECK:STDERR: fail_assignment_to_non_assignable.carbon:[[@LINE+4]]:3: error: expression is not assignable [AssignmentToNonAssignable] - // CHECK:STDERR: (1, 2) = (3, 4); - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_assignment_to_non_assignable.carbon:[[@LINE+2]]:3-8: error: expression is not assignable [AssignmentToNonAssignable] // CHECK:STDERR: (1, 2) = (3, 4); var n: i32 = 0; - // CHECK:STDERR: fail_assignment_to_non_assignable.carbon:[[@LINE+4]]:3: error: expression is not assignable [AssignmentToNonAssignable] - // CHECK:STDERR: (n, n) = (1, 2); - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_assignment_to_non_assignable.carbon:[[@LINE+2]]:3-8: error: expression is not assignable [AssignmentToNonAssignable] // CHECK:STDERR: (n, n) = (1, 2); - // CHECK:STDERR: fail_assignment_to_non_assignable.carbon:[[@LINE+4]]:3: error: expression is not assignable [AssignmentToNonAssignable] - // CHECK:STDERR: i32 = i32*; - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_assignment_to_non_assignable.carbon:[[@LINE+2]]:3-5: error: expression is not assignable [AssignmentToNonAssignable] // CHECK:STDERR: i32 = i32*; - // CHECK:STDERR: fail_assignment_to_non_assignable.carbon:[[@LINE+4]]:3: error: expression is not assignable [AssignmentToNonAssignable] - // CHECK:STDERR: {.x = 1, .y = 2} = {.x = 3, .y = 4}; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_assignment_to_non_assignable.carbon:[[@LINE+2]]:3-18: error: expression is not assignable [AssignmentToNonAssignable] // CHECK:STDERR: {.x = 1, .y = 2} = {.x = 3, .y = 4}; - // CHECK:STDERR: fail_assignment_to_non_assignable.carbon:[[@LINE+4]]:3: error: expression is not assignable [AssignmentToNonAssignable] - // CHECK:STDERR: (if true then 1 else 2) = 3; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_assignment_to_non_assignable.carbon:[[@LINE+2]]:3-25: error: expression is not assignable [AssignmentToNonAssignable] // CHECK:STDERR: (if true then 1 else 2) = 3; // Under #911, if expressions are never reference expressions. var a: i32; - // CHECK:STDERR: fail_assignment_to_non_assignable.carbon:[[@LINE+4]]:3: error: expression is not assignable [AssignmentToNonAssignable] - // CHECK:STDERR: (if true then a else a) = 10; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_assignment_to_non_assignable.carbon:[[@LINE+2]]:3-25: error: expression is not assignable [AssignmentToNonAssignable] // CHECK:STDERR: (if true then a else a) = 10; } @@ -155,11 +139,11 @@ fn Main() { // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] // CHECK:STDOUT: %self.param_patt.0c5: %pattern_type.d94 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.749: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt.0c5 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfc: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc56 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfc: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc42 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01: %Destroy.WithSelf.SubobjectDestroy.type.dfc = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef0: type = fn_type @Destroy.WithSelf.Op.loc56 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef0: type = fn_type @Destroy.WithSelf.Op.loc42 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403: %Destroy.WithSelf.Op.type.ef0 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbc: type = fn_type @Destroy.WithSelf.SelfDestruct.loc56 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbc: type = fn_type @Destroy.WithSelf.SelfDestruct.loc42 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3: %Destroy.WithSelf.SelfDestruct.type.fbc = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -189,14 +173,14 @@ fn Main() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl: %Destroy.WithSelf.SubobjectDestroy.type.dfc = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc56 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl: %Destroy.WithSelf.SubobjectDestroy.type.dfc = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc42 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d94 = ref_param_pattern [concrete = constants.%self.param_patt.0c5] // CHECK:STDOUT: %self.patt: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.749] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %i32 = ref_param call_param0 // CHECK:STDOUT: %self: ref %i32 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl: %Destroy.WithSelf.Op.type.ef0 = fn_decl @Destroy.WithSelf.Op.loc56 [concrete = constants.%Destroy.WithSelf.Op.403] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl: %Destroy.WithSelf.Op.type.ef0 = fn_decl @Destroy.WithSelf.Op.loc42 [concrete = constants.%Destroy.WithSelf.Op.403] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d94 = ref_param_pattern [concrete = constants.%self.param_patt.0c5] // CHECK:STDOUT: %self.patt: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.749] // CHECK:STDOUT: } { @@ -228,199 +212,199 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int_1.loc22: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %int_2.loc22: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %impl.elem0.loc22: %.1b2 = impl_witness_access constants.%Copy.impl_witness.0b3, element0 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op] -// CHECK:STDOUT: %bound_method.loc22: = bound_method %int_2.loc22, %impl.elem0.loc22 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op.bound.e21] -// CHECK:STDOUT: %Core.IntLiteral.as.Copy.impl.Op.call.loc22: init Core.IntLiteral = call %bound_method.loc22(%int_2.loc22) [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: assign %int_1.loc22, %Core.IntLiteral.as.Copy.impl.Op.call.loc22 +// CHECK:STDOUT: %int_1.loc20: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_2.loc20: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] +// CHECK:STDOUT: %impl.elem0.loc20: %.1b2 = impl_witness_access constants.%Copy.impl_witness.0b3, element0 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op] +// CHECK:STDOUT: %bound_method.loc20: = bound_method %int_2.loc20, %impl.elem0.loc20 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op.bound.e21] +// CHECK:STDOUT: %Core.IntLiteral.as.Copy.impl.Op.call.loc20: init Core.IntLiteral = call %bound_method.loc20(%int_2.loc20) [concrete = constants.%int_2.ecc] +// CHECK:STDOUT: assign %int_1.loc20, %Core.IntLiteral.as.Copy.impl.Op.call.loc20 // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] // CHECK:STDOUT: %F.call: init %i32 = call %F.ref() -// CHECK:STDOUT: %int_1.loc27: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %impl.elem0.loc27: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc27_7.1: = bound_method %int_1.loc27, %impl.elem0.loc27 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] -// CHECK:STDOUT: %specific_fn.loc27: = specific_function %impl.elem0.loc27, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc27_7.2: = bound_method %int_1.loc27, %specific_fn.loc27 [concrete = constants.%bound_method.3bd] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc27: init %i32 = call %bound_method.loc27_7.2(%int_1.loc27) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc27: init %i32 = converted %int_1.loc27, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc27 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: assign %F.call, %.loc27 -// CHECK:STDOUT: %int_1.loc32: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %int_2.loc32: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %.loc32_8.1: %tuple.type.f94 = tuple_literal (%int_1.loc32, %int_2.loc32) [concrete = constants.%tuple.ad8] -// CHECK:STDOUT: %int_3.loc32: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba] -// CHECK:STDOUT: %int_4.loc32: Core.IntLiteral = int_value 4 [concrete = constants.%int_4] -// CHECK:STDOUT: %.loc32_17.1: %tuple.type.f94 = tuple_literal (%int_3.loc32, %int_4.loc32) [concrete = constants.%tuple.302] -// CHECK:STDOUT: %impl.elem0.loc32_13: %.1b2 = impl_witness_access constants.%Copy.impl_witness.0b3, element0 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op] -// CHECK:STDOUT: %bound_method.loc32_13: = bound_method %int_3.loc32, %impl.elem0.loc32_13 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op.bound.64e] -// CHECK:STDOUT: %Core.IntLiteral.as.Copy.impl.Op.call.loc32_13: init Core.IntLiteral = call %bound_method.loc32_13(%int_3.loc32) [concrete = constants.%int_3.1ba] -// CHECK:STDOUT: %tuple.elem0.loc32: Core.IntLiteral = tuple_access %.loc32_8.1, element0 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %.loc32_17.2: init Core.IntLiteral to %tuple.elem0.loc32 = in_place_init %Core.IntLiteral.as.Copy.impl.Op.call.loc32_13 [concrete = constants.%int_3.1ba] -// CHECK:STDOUT: %impl.elem0.loc32_16: %.1b2 = impl_witness_access constants.%Copy.impl_witness.0b3, element0 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op] -// CHECK:STDOUT: %bound_method.loc32_16: = bound_method %int_4.loc32, %impl.elem0.loc32_16 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op.bound.50f] -// CHECK:STDOUT: %Core.IntLiteral.as.Copy.impl.Op.call.loc32_16: init Core.IntLiteral = call %bound_method.loc32_16(%int_4.loc32) [concrete = constants.%int_4] -// CHECK:STDOUT: %tuple.elem1.loc32: Core.IntLiteral = tuple_access %.loc32_8.1, element1 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %.loc32_17.3: init Core.IntLiteral to %tuple.elem1.loc32 = in_place_init %Core.IntLiteral.as.Copy.impl.Op.call.loc32_16 [concrete = constants.%int_4] -// CHECK:STDOUT: %.loc32_17.4: init %tuple.type.f94 to %.loc32_8.1 = tuple_init (%.loc32_17.2, %.loc32_17.3) [concrete = constants.%tuple.302] -// CHECK:STDOUT: %.loc32_10: init %tuple.type.f94 = converted %.loc32_17.1, %.loc32_17.4 [concrete = constants.%tuple.302] -// CHECK:STDOUT: assign %.loc32_8.1, %.loc32_10 -// CHECK:STDOUT: %tuple.loc32: %tuple.type.f94 = tuple_value (%int_1.loc32, %int_2.loc32) [concrete = constants.%tuple.ad8] -// CHECK:STDOUT: %.loc32_8.2: %tuple.type.f94 = converted %.loc32_8.1, %tuple.loc32 [concrete = constants.%tuple.ad8] +// CHECK:STDOUT: %int_1.loc23: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %impl.elem0.loc23: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc23_7.1: = bound_method %int_1.loc23, %impl.elem0.loc23 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] +// CHECK:STDOUT: %specific_fn.loc23: = specific_function %impl.elem0.loc23, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc23_7.2: = bound_method %int_1.loc23, %specific_fn.loc23 [concrete = constants.%bound_method.3bd] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc23: init %i32 = call %bound_method.loc23_7.2(%int_1.loc23) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc23: init %i32 = converted %int_1.loc23, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc23 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: assign %F.call, %.loc23 +// CHECK:STDOUT: %int_1.loc26: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_2.loc26: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] +// CHECK:STDOUT: %.loc26_8.1: %tuple.type.f94 = tuple_literal (%int_1.loc26, %int_2.loc26) [concrete = constants.%tuple.ad8] +// CHECK:STDOUT: %int_3.loc26: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba] +// CHECK:STDOUT: %int_4.loc26: Core.IntLiteral = int_value 4 [concrete = constants.%int_4] +// CHECK:STDOUT: %.loc26_17.1: %tuple.type.f94 = tuple_literal (%int_3.loc26, %int_4.loc26) [concrete = constants.%tuple.302] +// CHECK:STDOUT: %impl.elem0.loc26_13: %.1b2 = impl_witness_access constants.%Copy.impl_witness.0b3, element0 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op] +// CHECK:STDOUT: %bound_method.loc26_13: = bound_method %int_3.loc26, %impl.elem0.loc26_13 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op.bound.64e] +// CHECK:STDOUT: %Core.IntLiteral.as.Copy.impl.Op.call.loc26_13: init Core.IntLiteral = call %bound_method.loc26_13(%int_3.loc26) [concrete = constants.%int_3.1ba] +// CHECK:STDOUT: %tuple.elem0.loc26: Core.IntLiteral = tuple_access %.loc26_8.1, element0 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %.loc26_17.2: init Core.IntLiteral to %tuple.elem0.loc26 = in_place_init %Core.IntLiteral.as.Copy.impl.Op.call.loc26_13 [concrete = constants.%int_3.1ba] +// CHECK:STDOUT: %impl.elem0.loc26_16: %.1b2 = impl_witness_access constants.%Copy.impl_witness.0b3, element0 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op] +// CHECK:STDOUT: %bound_method.loc26_16: = bound_method %int_4.loc26, %impl.elem0.loc26_16 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op.bound.50f] +// CHECK:STDOUT: %Core.IntLiteral.as.Copy.impl.Op.call.loc26_16: init Core.IntLiteral = call %bound_method.loc26_16(%int_4.loc26) [concrete = constants.%int_4] +// CHECK:STDOUT: %tuple.elem1.loc26: Core.IntLiteral = tuple_access %.loc26_8.1, element1 [concrete = constants.%int_2.ecc] +// CHECK:STDOUT: %.loc26_17.3: init Core.IntLiteral to %tuple.elem1.loc26 = in_place_init %Core.IntLiteral.as.Copy.impl.Op.call.loc26_16 [concrete = constants.%int_4] +// CHECK:STDOUT: %.loc26_17.4: init %tuple.type.f94 to %.loc26_8.1 = tuple_init (%.loc26_17.2, %.loc26_17.3) [concrete = constants.%tuple.302] +// CHECK:STDOUT: %.loc26_10: init %tuple.type.f94 = converted %.loc26_17.1, %.loc26_17.4 [concrete = constants.%tuple.302] +// CHECK:STDOUT: assign %.loc26_8.1, %.loc26_10 +// CHECK:STDOUT: %tuple.loc26: %tuple.type.f94 = tuple_value (%int_1.loc26, %int_2.loc26) [concrete = constants.%tuple.ad8] +// CHECK:STDOUT: %.loc26_8.2: %tuple.type.f94 = converted %.loc26_8.1, %tuple.loc26 [concrete = constants.%tuple.ad8] // CHECK:STDOUT: %n.var: ref %i32 = var_storage %n.var_patt // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] -// CHECK:STDOUT: %impl.elem0.loc33: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc33_3.1: = bound_method %int_0, %impl.elem0.loc33 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] -// CHECK:STDOUT: %specific_fn.loc33: = specific_function %impl.elem0.loc33, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc33_3.2: = bound_method %int_0, %specific_fn.loc33 [concrete = constants.%bound_method.036] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc33: init %i32 = call %bound_method.loc33_3.2(%int_0) [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc33: init %i32 = converted %int_0, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc33 [concrete = constants.%int_0.753] -// CHECK:STDOUT: assign %n.var, %.loc33 -// CHECK:STDOUT: %i32.loc33: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %impl.elem0.loc27: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc27_3.1: = bound_method %int_0, %impl.elem0.loc27 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] +// CHECK:STDOUT: %specific_fn.loc27: = specific_function %impl.elem0.loc27, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc27_3.2: = bound_method %int_0, %specific_fn.loc27 [concrete = constants.%bound_method.036] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc27: init %i32 = call %bound_method.loc27_3.2(%int_0) [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc27: init %i32 = converted %int_0, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc27 [concrete = constants.%int_0.753] +// CHECK:STDOUT: assign %n.var, %.loc27 +// CHECK:STDOUT: %i32.loc27: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %n: ref %i32 = wrapper_binding n, %n.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %n.patt: %pattern_type.d94 = ref_binding_pattern n [concrete = constants.%n.patt] // CHECK:STDOUT: %n.var_patt: %pattern_type.d94 = var_pattern %n.patt [concrete = constants.%n.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %n.ref.loc38_4: ref %i32 = name_ref n, %n -// CHECK:STDOUT: %n.ref.loc38_7: ref %i32 = name_ref n, %n -// CHECK:STDOUT: %.loc38_8.1: %tuple.type.35f = tuple_literal (%n.ref.loc38_4, %n.ref.loc38_7) -// CHECK:STDOUT: %int_1.loc38: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %int_2.loc38: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %.loc38_17.1: %tuple.type.f94 = tuple_literal (%int_1.loc38, %int_2.loc38) [concrete = constants.%tuple.ad8] -// CHECK:STDOUT: %impl.elem0.loc38_17.1: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc38_17.1: = bound_method %int_1.loc38, %impl.elem0.loc38_17.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] -// CHECK:STDOUT: %specific_fn.loc38_17.1: = specific_function %impl.elem0.loc38_17.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc38_17.2: = bound_method %int_1.loc38, %specific_fn.loc38_17.1 [concrete = constants.%bound_method.3bd] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc38_17.1: init %i32 = call %bound_method.loc38_17.2(%int_1.loc38) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc38_17.2: init %i32 = converted %int_1.loc38, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc38_17.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %tuple.elem0.loc38: %i32 = tuple_access %.loc38_8.1, element0 -// CHECK:STDOUT: %.loc38_17.3: init %i32 to %tuple.elem0.loc38 = in_place_init %.loc38_17.2 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %impl.elem0.loc38_17.2: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc38_17.3: = bound_method %int_2.loc38, %impl.elem0.loc38_17.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6] -// CHECK:STDOUT: %specific_fn.loc38_17.2: = specific_function %impl.elem0.loc38_17.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc38_17.4: = bound_method %int_2.loc38, %specific_fn.loc38_17.2 [concrete = constants.%bound_method.a55] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc38_17.2: init %i32 = call %bound_method.loc38_17.4(%int_2.loc38) [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc38_17.4: init %i32 = converted %int_2.loc38, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc38_17.2 [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %tuple.elem1.loc38: %i32 = tuple_access %.loc38_8.1, element1 -// CHECK:STDOUT: %.loc38_17.5: init %i32 to %tuple.elem1.loc38 = in_place_init %.loc38_17.4 [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc38_17.6: init %tuple.type.35f to %.loc38_8.1 = tuple_init (%.loc38_17.3, %.loc38_17.5) [concrete = constants.%tuple.380] -// CHECK:STDOUT: %.loc38_10: init %tuple.type.35f = converted %.loc38_17.1, %.loc38_17.6 [concrete = constants.%tuple.380] -// CHECK:STDOUT: assign %.loc38_8.1, %.loc38_10 -// CHECK:STDOUT: %.loc38_4: %i32 = acquire_value %n.ref.loc38_4 -// CHECK:STDOUT: %.loc38_7: %i32 = acquire_value %n.ref.loc38_7 -// CHECK:STDOUT: %tuple.loc38: %tuple.type.35f = tuple_value (%.loc38_4, %.loc38_7) -// CHECK:STDOUT: %.loc38_8.2: %tuple.type.35f = converted %.loc38_8.1, %tuple.loc38 -// CHECK:STDOUT: %i32.loc43_3: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %i32.loc43_9: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %ptr: type = ptr_type %i32.loc43_9 [concrete = constants.%ptr.a17] -// CHECK:STDOUT: %impl.elem0.loc43: %.cd2 = impl_witness_access constants.%Copy.impl_witness.f3e, element0 [concrete = constants.%type.as.Copy.impl.Op] -// CHECK:STDOUT: %bound_method.loc43: = bound_method %ptr, %impl.elem0.loc43 [concrete = constants.%type.as.Copy.impl.Op.bound] -// CHECK:STDOUT: %type.as.Copy.impl.Op.call: init type = call %bound_method.loc43(%ptr) [concrete = constants.%ptr.a17] -// CHECK:STDOUT: assign %i32.loc43_3, %type.as.Copy.impl.Op.call -// CHECK:STDOUT: %int_1.loc48: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %int_2.loc48: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %.loc48_18.1: %struct_type.x.y = struct_literal (%int_1.loc48, %int_2.loc48) [concrete = constants.%struct.004] -// CHECK:STDOUT: %int_3.loc48: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba] -// CHECK:STDOUT: %int_4.loc48: Core.IntLiteral = int_value 4 [concrete = constants.%int_4] -// CHECK:STDOUT: %.loc48_37.1: %struct_type.x.y = struct_literal (%int_3.loc48, %int_4.loc48) [concrete = constants.%struct.a0d] -// CHECK:STDOUT: %impl.elem0.loc48_28: %.1b2 = impl_witness_access constants.%Copy.impl_witness.0b3, element0 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op] -// CHECK:STDOUT: %bound_method.loc48_28: = bound_method %int_3.loc48, %impl.elem0.loc48_28 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op.bound.64e] -// CHECK:STDOUT: %Core.IntLiteral.as.Copy.impl.Op.call.loc48_28: init Core.IntLiteral = call %bound_method.loc48_28(%int_3.loc48) [concrete = constants.%int_3.1ba] -// CHECK:STDOUT: %.loc48_37.2: Core.IntLiteral = struct_access %.loc48_18.1, element0 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %.loc48_37.3: init Core.IntLiteral to %.loc48_37.2 = in_place_init %Core.IntLiteral.as.Copy.impl.Op.call.loc48_28 [concrete = constants.%int_3.1ba] -// CHECK:STDOUT: %impl.elem0.loc48_36: %.1b2 = impl_witness_access constants.%Copy.impl_witness.0b3, element0 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op] -// CHECK:STDOUT: %bound_method.loc48_36: = bound_method %int_4.loc48, %impl.elem0.loc48_36 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op.bound.50f] -// CHECK:STDOUT: %Core.IntLiteral.as.Copy.impl.Op.call.loc48_36: init Core.IntLiteral = call %bound_method.loc48_36(%int_4.loc48) [concrete = constants.%int_4] -// CHECK:STDOUT: %.loc48_37.4: Core.IntLiteral = struct_access %.loc48_18.1, element1 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %.loc48_37.5: init Core.IntLiteral to %.loc48_37.4 = in_place_init %Core.IntLiteral.as.Copy.impl.Op.call.loc48_36 [concrete = constants.%int_4] -// CHECK:STDOUT: %.loc48_37.6: init %struct_type.x.y to %.loc48_18.1 = struct_init (%.loc48_37.3, %.loc48_37.5) [concrete = constants.%struct.a0d] -// CHECK:STDOUT: %.loc48_20: init %struct_type.x.y = converted %.loc48_37.1, %.loc48_37.6 [concrete = constants.%struct.a0d] -// CHECK:STDOUT: assign %.loc48_18.1, %.loc48_20 -// CHECK:STDOUT: %struct: %struct_type.x.y = struct_value (%int_1.loc48, %int_2.loc48) [concrete = constants.%struct.004] -// CHECK:STDOUT: %.loc48_18.2: %struct_type.x.y = converted %.loc48_18.1, %struct [concrete = constants.%struct.004] -// CHECK:STDOUT: %true.loc53: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: if %true.loc53 br !if.expr.then.loc53 else br !if.expr.else.loc53 +// CHECK:STDOUT: %n.ref.loc30_4: ref %i32 = name_ref n, %n +// CHECK:STDOUT: %n.ref.loc30_7: ref %i32 = name_ref n, %n +// CHECK:STDOUT: %.loc30_8.1: %tuple.type.35f = tuple_literal (%n.ref.loc30_4, %n.ref.loc30_7) +// CHECK:STDOUT: %int_1.loc30: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_2.loc30: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] +// CHECK:STDOUT: %.loc30_17.1: %tuple.type.f94 = tuple_literal (%int_1.loc30, %int_2.loc30) [concrete = constants.%tuple.ad8] +// CHECK:STDOUT: %impl.elem0.loc30_17.1: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc30_17.1: = bound_method %int_1.loc30, %impl.elem0.loc30_17.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] +// CHECK:STDOUT: %specific_fn.loc30_17.1: = specific_function %impl.elem0.loc30_17.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc30_17.2: = bound_method %int_1.loc30, %specific_fn.loc30_17.1 [concrete = constants.%bound_method.3bd] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc30_17.1: init %i32 = call %bound_method.loc30_17.2(%int_1.loc30) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc30_17.2: init %i32 = converted %int_1.loc30, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc30_17.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %tuple.elem0.loc30: %i32 = tuple_access %.loc30_8.1, element0 +// CHECK:STDOUT: %.loc30_17.3: init %i32 to %tuple.elem0.loc30 = in_place_init %.loc30_17.2 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %impl.elem0.loc30_17.2: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc30_17.3: = bound_method %int_2.loc30, %impl.elem0.loc30_17.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6] +// CHECK:STDOUT: %specific_fn.loc30_17.2: = specific_function %impl.elem0.loc30_17.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc30_17.4: = bound_method %int_2.loc30, %specific_fn.loc30_17.2 [concrete = constants.%bound_method.a55] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc30_17.2: init %i32 = call %bound_method.loc30_17.4(%int_2.loc30) [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc30_17.4: init %i32 = converted %int_2.loc30, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc30_17.2 [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %tuple.elem1.loc30: %i32 = tuple_access %.loc30_8.1, element1 +// CHECK:STDOUT: %.loc30_17.5: init %i32 to %tuple.elem1.loc30 = in_place_init %.loc30_17.4 [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc30_17.6: init %tuple.type.35f to %.loc30_8.1 = tuple_init (%.loc30_17.3, %.loc30_17.5) [concrete = constants.%tuple.380] +// CHECK:STDOUT: %.loc30_10: init %tuple.type.35f = converted %.loc30_17.1, %.loc30_17.6 [concrete = constants.%tuple.380] +// CHECK:STDOUT: assign %.loc30_8.1, %.loc30_10 +// CHECK:STDOUT: %.loc30_4: %i32 = acquire_value %n.ref.loc30_4 +// CHECK:STDOUT: %.loc30_7: %i32 = acquire_value %n.ref.loc30_7 +// CHECK:STDOUT: %tuple.loc30: %tuple.type.35f = tuple_value (%.loc30_4, %.loc30_7) +// CHECK:STDOUT: %.loc30_8.2: %tuple.type.35f = converted %.loc30_8.1, %tuple.loc30 +// CHECK:STDOUT: %i32.loc33_3: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc33_9: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %ptr: type = ptr_type %i32.loc33_9 [concrete = constants.%ptr.a17] +// CHECK:STDOUT: %impl.elem0.loc33: %.cd2 = impl_witness_access constants.%Copy.impl_witness.f3e, element0 [concrete = constants.%type.as.Copy.impl.Op] +// CHECK:STDOUT: %bound_method.loc33: = bound_method %ptr, %impl.elem0.loc33 [concrete = constants.%type.as.Copy.impl.Op.bound] +// CHECK:STDOUT: %type.as.Copy.impl.Op.call: init type = call %bound_method.loc33(%ptr) [concrete = constants.%ptr.a17] +// CHECK:STDOUT: assign %i32.loc33_3, %type.as.Copy.impl.Op.call +// CHECK:STDOUT: %int_1.loc36: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_2.loc36: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] +// CHECK:STDOUT: %.loc36_18.1: %struct_type.x.y = struct_literal (%int_1.loc36, %int_2.loc36) [concrete = constants.%struct.004] +// CHECK:STDOUT: %int_3.loc36: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba] +// CHECK:STDOUT: %int_4.loc36: Core.IntLiteral = int_value 4 [concrete = constants.%int_4] +// CHECK:STDOUT: %.loc36_37.1: %struct_type.x.y = struct_literal (%int_3.loc36, %int_4.loc36) [concrete = constants.%struct.a0d] +// CHECK:STDOUT: %impl.elem0.loc36_28: %.1b2 = impl_witness_access constants.%Copy.impl_witness.0b3, element0 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op] +// CHECK:STDOUT: %bound_method.loc36_28: = bound_method %int_3.loc36, %impl.elem0.loc36_28 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op.bound.64e] +// CHECK:STDOUT: %Core.IntLiteral.as.Copy.impl.Op.call.loc36_28: init Core.IntLiteral = call %bound_method.loc36_28(%int_3.loc36) [concrete = constants.%int_3.1ba] +// CHECK:STDOUT: %.loc36_37.2: Core.IntLiteral = struct_access %.loc36_18.1, element0 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %.loc36_37.3: init Core.IntLiteral to %.loc36_37.2 = in_place_init %Core.IntLiteral.as.Copy.impl.Op.call.loc36_28 [concrete = constants.%int_3.1ba] +// CHECK:STDOUT: %impl.elem0.loc36_36: %.1b2 = impl_witness_access constants.%Copy.impl_witness.0b3, element0 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op] +// CHECK:STDOUT: %bound_method.loc36_36: = bound_method %int_4.loc36, %impl.elem0.loc36_36 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op.bound.50f] +// CHECK:STDOUT: %Core.IntLiteral.as.Copy.impl.Op.call.loc36_36: init Core.IntLiteral = call %bound_method.loc36_36(%int_4.loc36) [concrete = constants.%int_4] +// CHECK:STDOUT: %.loc36_37.4: Core.IntLiteral = struct_access %.loc36_18.1, element1 [concrete = constants.%int_2.ecc] +// CHECK:STDOUT: %.loc36_37.5: init Core.IntLiteral to %.loc36_37.4 = in_place_init %Core.IntLiteral.as.Copy.impl.Op.call.loc36_36 [concrete = constants.%int_4] +// CHECK:STDOUT: %.loc36_37.6: init %struct_type.x.y to %.loc36_18.1 = struct_init (%.loc36_37.3, %.loc36_37.5) [concrete = constants.%struct.a0d] +// CHECK:STDOUT: %.loc36_20: init %struct_type.x.y = converted %.loc36_37.1, %.loc36_37.6 [concrete = constants.%struct.a0d] +// CHECK:STDOUT: assign %.loc36_18.1, %.loc36_20 +// CHECK:STDOUT: %struct: %struct_type.x.y = struct_value (%int_1.loc36, %int_2.loc36) [concrete = constants.%struct.004] +// CHECK:STDOUT: %.loc36_18.2: %struct_type.x.y = converted %.loc36_18.1, %struct [concrete = constants.%struct.004] +// CHECK:STDOUT: %true.loc39: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: if %true.loc39 br !if.expr.then.loc39 else br !if.expr.else.loc39 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc53: -// CHECK:STDOUT: %int_1.loc53: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %impl.elem0.loc53_12: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc53_12.1: = bound_method %int_1.loc53, %impl.elem0.loc53_12 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] -// CHECK:STDOUT: %specific_fn.loc53_12: = specific_function %impl.elem0.loc53_12, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc53_12.2: = bound_method %int_1.loc53, %specific_fn.loc53_12 [concrete = constants.%bound_method.3bd] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc53_12: init %i32 = call %bound_method.loc53_12.2(%int_1.loc53) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc53_12.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc53_12 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc53_12.2: %i32 = converted %int_1.loc53, %.loc53_12.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: br !if.expr.result.loc53(%.loc53_12.2) +// CHECK:STDOUT: !if.expr.then.loc39: +// CHECK:STDOUT: %int_1.loc39: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %impl.elem0.loc39_12: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc39_12.1: = bound_method %int_1.loc39, %impl.elem0.loc39_12 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] +// CHECK:STDOUT: %specific_fn.loc39_12: = specific_function %impl.elem0.loc39_12, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc39_12.2: = bound_method %int_1.loc39, %specific_fn.loc39_12 [concrete = constants.%bound_method.3bd] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc39_12: init %i32 = call %bound_method.loc39_12.2(%int_1.loc39) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc39_12.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc39_12 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc39_12.2: %i32 = converted %int_1.loc39, %.loc39_12.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: br !if.expr.result.loc39(%.loc39_12.2) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc53: -// CHECK:STDOUT: %int_2.loc53: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %impl.elem0.loc53_19: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc53_19.1: = bound_method %int_2.loc53, %impl.elem0.loc53_19 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6] -// CHECK:STDOUT: %specific_fn.loc53_19: = specific_function %impl.elem0.loc53_19, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc53_19.2: = bound_method %int_2.loc53, %specific_fn.loc53_19 [concrete = constants.%bound_method.a55] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc53_19: init %i32 = call %bound_method.loc53_19.2(%int_2.loc53) [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc53_19.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc53_19 [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc53_19.2: %i32 = converted %int_2.loc53, %.loc53_19.1 [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: br !if.expr.result.loc53(%.loc53_19.2) +// CHECK:STDOUT: !if.expr.else.loc39: +// CHECK:STDOUT: %int_2.loc39: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] +// CHECK:STDOUT: %impl.elem0.loc39_19: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc39_19.1: = bound_method %int_2.loc39, %impl.elem0.loc39_19 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6] +// CHECK:STDOUT: %specific_fn.loc39_19: = specific_function %impl.elem0.loc39_19, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc39_19.2: = bound_method %int_2.loc39, %specific_fn.loc39_19 [concrete = constants.%bound_method.a55] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc39_19: init %i32 = call %bound_method.loc39_19.2(%int_2.loc39) [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc39_19.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc39_19 [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc39_19.2: %i32 = converted %int_2.loc39, %.loc39_19.1 [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: br !if.expr.result.loc39(%.loc39_19.2) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc53: -// CHECK:STDOUT: %.loc53_4: %i32 = block_arg !if.expr.result.loc53 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %int_3.loc53: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba] -// CHECK:STDOUT: %impl.elem0.loc53_27: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc53_27.1: = bound_method %int_3.loc53, %impl.elem0.loc53_27 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.b3c] -// CHECK:STDOUT: %specific_fn.loc53_27: = specific_function %impl.elem0.loc53_27, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc53_27.2: = bound_method %int_3.loc53, %specific_fn.loc53_27 [concrete = constants.%bound_method.fb0] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc53_27: init %i32 = call %bound_method.loc53_27.2(%int_3.loc53) [concrete = constants.%int_3.9f3] -// CHECK:STDOUT: %.loc53_27: init %i32 = converted %int_3.loc53, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc53_27 [concrete = constants.%int_3.9f3] -// CHECK:STDOUT: assign %.loc53_4, %.loc53_27 +// CHECK:STDOUT: !if.expr.result.loc39: +// CHECK:STDOUT: %.loc39_4: %i32 = block_arg !if.expr.result.loc39 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %int_3.loc39: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba] +// CHECK:STDOUT: %impl.elem0.loc39_27: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc39_27.1: = bound_method %int_3.loc39, %impl.elem0.loc39_27 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.b3c] +// CHECK:STDOUT: %specific_fn.loc39_27: = specific_function %impl.elem0.loc39_27, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc39_27.2: = bound_method %int_3.loc39, %specific_fn.loc39_27 [concrete = constants.%bound_method.fb0] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc39_27: init %i32 = call %bound_method.loc39_27.2(%int_3.loc39) [concrete = constants.%int_3.9f3] +// CHECK:STDOUT: %.loc39_27: init %i32 = converted %int_3.loc39, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc39_27 [concrete = constants.%int_3.9f3] +// CHECK:STDOUT: assign %.loc39_4, %.loc39_27 // CHECK:STDOUT: %a.var: ref %i32 = var_storage %a.var_patt // CHECK:STDOUT: %DefaultOrUnformed.facet: %DefaultOrUnformed.type = facet_value constants.%i32, (constants.%DefaultOrUnformed.impl_witness.29f) [concrete = constants.%DefaultOrUnformed.facet] -// CHECK:STDOUT: %.loc56_13.1: %DefaultOrUnformed.type = converted constants.%i32, %DefaultOrUnformed.facet [concrete = constants.%DefaultOrUnformed.facet] -// CHECK:STDOUT: %as_type: type = facet_access_type %.loc56_13.1 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc56_13.2: type = converted %.loc56_13.1, %as_type [concrete = constants.%i32] +// CHECK:STDOUT: %.loc42_13.1: %DefaultOrUnformed.type = converted constants.%i32, %DefaultOrUnformed.facet [concrete = constants.%DefaultOrUnformed.facet] +// CHECK:STDOUT: %as_type: type = facet_access_type %.loc42_13.1 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc42_13.2: type = converted %.loc42_13.1, %as_type [concrete = constants.%i32] // CHECK:STDOUT: %T.as.DefaultOrUnformed.impl.Op.specific_fn: = specific_function constants.%T.as.DefaultOrUnformed.impl.Op.720, @T.as.DefaultOrUnformed.impl.Op(constants.%i32) [concrete = constants.%T.as.DefaultOrUnformed.impl.Op.specific_fn] // CHECK:STDOUT: %T.as.DefaultOrUnformed.impl.Op.call: init %i32 = call %T.as.DefaultOrUnformed.impl.Op.specific_fn() // CHECK:STDOUT: assign %a.var, %T.as.DefaultOrUnformed.impl.Op.call -// CHECK:STDOUT: %i32.loc56: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc42: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %a: ref %i32 = wrapper_binding a, %a.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %a.patt: %pattern_type.d94 = ref_binding_pattern a [concrete = constants.%a.patt] // CHECK:STDOUT: %a.var_patt: %pattern_type.d94 = var_pattern %a.patt [concrete = constants.%a.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %true.loc61: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: if %true.loc61 br !if.expr.then.loc61 else br !if.expr.else.loc61 +// CHECK:STDOUT: %true.loc45: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: if %true.loc45 br !if.expr.then.loc45 else br !if.expr.else.loc45 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc61: -// CHECK:STDOUT: %a.ref.loc61_17: ref %i32 = name_ref a, %a -// CHECK:STDOUT: %.loc61_17: %i32 = acquire_value %a.ref.loc61_17 -// CHECK:STDOUT: br !if.expr.result.loc61(%.loc61_17) +// CHECK:STDOUT: !if.expr.then.loc45: +// CHECK:STDOUT: %a.ref.loc45_17: ref %i32 = name_ref a, %a +// CHECK:STDOUT: %.loc45_17: %i32 = acquire_value %a.ref.loc45_17 +// CHECK:STDOUT: br !if.expr.result.loc45(%.loc45_17) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc61: -// CHECK:STDOUT: %a.ref.loc61_24: ref %i32 = name_ref a, %a -// CHECK:STDOUT: %.loc61_24: %i32 = acquire_value %a.ref.loc61_24 -// CHECK:STDOUT: br !if.expr.result.loc61(%.loc61_24) +// CHECK:STDOUT: !if.expr.else.loc45: +// CHECK:STDOUT: %a.ref.loc45_24: ref %i32 = name_ref a, %a +// CHECK:STDOUT: %.loc45_24: %i32 = acquire_value %a.ref.loc45_24 +// CHECK:STDOUT: br !if.expr.result.loc45(%.loc45_24) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc61: -// CHECK:STDOUT: %.loc61_4: %i32 = block_arg !if.expr.result.loc61 +// CHECK:STDOUT: !if.expr.result.loc45: +// CHECK:STDOUT: %.loc45_4: %i32 = block_arg !if.expr.result.loc45 // CHECK:STDOUT: %int_10: Core.IntLiteral = int_value 10 [concrete = constants.%int_10.64f] -// CHECK:STDOUT: %impl.elem0.loc61: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc61_27.1: = bound_method %int_10, %impl.elem0.loc61 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.02d] -// CHECK:STDOUT: %specific_fn.loc61: = specific_function %impl.elem0.loc61, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc61_27.2: = bound_method %int_10, %specific_fn.loc61 [concrete = constants.%bound_method.002] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc61: init %i32 = call %bound_method.loc61_27.2(%int_10) [concrete = constants.%int_10.6a3] -// CHECK:STDOUT: %.loc61_27: init %i32 = converted %int_10, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc61 [concrete = constants.%int_10.6a3] -// CHECK:STDOUT: assign %.loc61_4, %.loc61_27 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc56: = bound_method %a.var, constants.%Destroy.WithSelf.SelfDestruct.db3 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc56: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc56(%a.var) -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc33: = bound_method %n.var, constants.%Destroy.WithSelf.SelfDestruct.db3 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc33: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc33(%n.var) +// CHECK:STDOUT: %impl.elem0.loc45: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc45_27.1: = bound_method %int_10, %impl.elem0.loc45 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.02d] +// CHECK:STDOUT: %specific_fn.loc45: = specific_function %impl.elem0.loc45, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc45_27.2: = bound_method %int_10, %specific_fn.loc45 [concrete = constants.%bound_method.002] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc45: init %i32 = call %bound_method.loc45_27.2(%int_10) [concrete = constants.%int_10.6a3] +// CHECK:STDOUT: %.loc45_27: init %i32 = converted %int_10, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc45 [concrete = constants.%int_10.6a3] +// CHECK:STDOUT: assign %.loc45_4, %.loc45_27 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc42: = bound_method %a.var, constants.%Destroy.WithSelf.SelfDestruct.db3 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc42: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc42(%a.var) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc27: = bound_method %n.var, constants.%Destroy.WithSelf.SelfDestruct.db3 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc27: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc27(%n.var) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc56(%self.param: ref %i32) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc42(%self.param: ref %i32) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc56(%self.param: ref %i32) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc42(%self.param: ref %i32) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc56(%self.param: ref %i32) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc42(%self.param: ref %i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl(%self.param) diff --git a/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon b/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon index ab182e866182..c11b1f295168 100644 --- a/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon @@ -16,14 +16,10 @@ fn F() -> i32 { return 0; } fn Main() { var a: i32 = 3; - // CHECK:STDERR: fail_redundant_compound_access.carbon:[[@LINE+4]]:7: error: member name of type `i32` in compound member access is not an instance member or an interface member [CompoundMemberAccessDoesNotUseBase] - // CHECK:STDERR: a = a.(a); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_redundant_compound_access.carbon:[[@LINE+2]]:7-11: error: member name of type `i32` in compound member access is not an instance member or an interface member [CompoundMemberAccessDoesNotUseBase] // CHECK:STDERR: a = a.(a); - // CHECK:STDERR: fail_redundant_compound_access.carbon:[[@LINE+4]]:7: error: member name of type `` in compound member access is not an instance member or an interface member [CompoundMemberAccessDoesNotUseBase] - // CHECK:STDERR: a = a.(F)(); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_redundant_compound_access.carbon:[[@LINE+2]]:7-11: error: member name of type `` in compound member access is not an instance member or an interface member [CompoundMemberAccessDoesNotUseBase] // CHECK:STDERR: a = a.(F)(); } @@ -174,21 +170,21 @@ fn Main() { // CHECK:STDOUT: %a.patt: %pattern_type.d94 = ref_binding_pattern a [concrete = constants.%a.patt] // CHECK:STDOUT: %a.var_patt: %pattern_type.d94 = var_pattern %a.patt [concrete = constants.%a.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.ref.loc23_3: ref %i32 = name_ref a, %a -// CHECK:STDOUT: %a.ref.loc23_7: ref %i32 = name_ref a, %a -// CHECK:STDOUT: %a.ref.loc23_10: ref %i32 = name_ref a, %a -// CHECK:STDOUT: %.loc23: %i32 = acquire_value %a.ref.loc23_10 -// CHECK:STDOUT: %impl.elem0.loc23: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] -// CHECK:STDOUT: %bound_method.loc23_10.1: = bound_method %.loc23, %impl.elem0.loc23 -// CHECK:STDOUT: %specific_fn.loc23: = specific_function %impl.elem0.loc23, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc23_10.2: = bound_method %.loc23, %specific_fn.loc23 -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc23_10.2(%.loc23) -// CHECK:STDOUT: assign %a.ref.loc23_3, %Int.as.Copy.impl.Op.call -// CHECK:STDOUT: %a.ref.loc28_3: ref %i32 = name_ref a, %a -// CHECK:STDOUT: %a.ref.loc28_7: ref %i32 = name_ref a, %a +// CHECK:STDOUT: %a.ref.loc21_3: ref %i32 = name_ref a, %a +// CHECK:STDOUT: %a.ref.loc21_7: ref %i32 = name_ref a, %a +// CHECK:STDOUT: %a.ref.loc21_10: ref %i32 = name_ref a, %a +// CHECK:STDOUT: %.loc21: %i32 = acquire_value %a.ref.loc21_10 +// CHECK:STDOUT: %impl.elem0.loc21: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] +// CHECK:STDOUT: %bound_method.loc21_10.1: = bound_method %.loc21, %impl.elem0.loc21 +// CHECK:STDOUT: %specific_fn.loc21: = specific_function %impl.elem0.loc21, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc21_10.2: = bound_method %.loc21, %specific_fn.loc21 +// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc21_10.2(%.loc21) +// CHECK:STDOUT: assign %a.ref.loc21_3, %Int.as.Copy.impl.Op.call +// CHECK:STDOUT: %a.ref.loc24_3: ref %i32 = name_ref a, %a +// CHECK:STDOUT: %a.ref.loc24_7: ref %i32 = name_ref a, %a // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] // CHECK:STDOUT: %F.call: init %i32 = call %F.ref() -// CHECK:STDOUT: assign %a.ref.loc28_3, %F.call +// CHECK:STDOUT: assign %a.ref.loc24_3, %F.call // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %a.var, constants.%Destroy.WithSelf.SelfDestruct.db3 // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%a.var) // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon b/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon index 064e6d0b1ac6..cd729370d1e1 100644 --- a/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon @@ -13,12 +13,8 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var unused x: bool = not 12; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+3]]:24-29: error: cannot implicitly convert expression of type `Core.IntLiteral` to `bool` [ConversionFailure] + // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+2]]:24-29: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused x: bool = not 12; } @@ -39,11 +35,11 @@ fn Main() { // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] // CHECK:STDOUT: %self.param_patt.40d: %pattern_type.831 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.560: %pattern_type.831 = wrapper_binding_pattern self, %self.param_patt.40d [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfc: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc23 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfc: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc19 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01: %Destroy.WithSelf.SubobjectDestroy.type.dfc = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef0: type = fn_type @Destroy.WithSelf.Op.loc23 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef0: type = fn_type @Destroy.WithSelf.Op.loc19 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403: %Destroy.WithSelf.Op.type.ef0 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbc: type = fn_type @Destroy.WithSelf.SelfDestruct.loc23 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbc: type = fn_type @Destroy.WithSelf.SelfDestruct.loc19 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3: %Destroy.WithSelf.SelfDestruct.type.fbc = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -61,14 +57,14 @@ fn Main() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl: %Destroy.WithSelf.SubobjectDestroy.type.dfc = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc23 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl: %Destroy.WithSelf.SubobjectDestroy.type.dfc = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc19 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01] { // CHECK:STDOUT: %self.param_patt: %pattern_type.831 = ref_param_pattern [concrete = constants.%self.param_patt.40d] // CHECK:STDOUT: %self.patt: %pattern_type.831 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.560] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref bool = ref_param call_param0 // CHECK:STDOUT: %self: ref bool = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl: %Destroy.WithSelf.Op.type.ef0 = fn_decl @Destroy.WithSelf.Op.loc23 [concrete = constants.%Destroy.WithSelf.Op.403] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl: %Destroy.WithSelf.Op.type.ef0 = fn_decl @Destroy.WithSelf.Op.loc19 [concrete = constants.%Destroy.WithSelf.Op.403] { // CHECK:STDOUT: %self.param_patt: %pattern_type.831 = ref_param_pattern [concrete = constants.%self.param_patt.40d] // CHECK:STDOUT: %self.patt: %pattern_type.831 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.560] // CHECK:STDOUT: } { @@ -90,10 +86,10 @@ fn Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %x.var: ref bool = var_storage %x.var_patt // CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [concrete = constants.%int_12] -// CHECK:STDOUT: %.loc23_24.1: bool = converted %int_12, [concrete = ] -// CHECK:STDOUT: %.loc23_24.2: = not [concrete = ] +// CHECK:STDOUT: %.loc19_24.1: bool = converted %int_12, [concrete = ] +// CHECK:STDOUT: %.loc19_24.2: = not [concrete = ] // CHECK:STDOUT: assign %x.var, -// CHECK:STDOUT: %.loc23_17: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc19_17: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %x: ref bool = wrapper_binding x, %x.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %x.patt: %pattern_type.831 = ref_binding_pattern x [concrete = constants.%x.patt] @@ -104,11 +100,11 @@ fn Main() { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc23(%self.param: ref bool) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc19(%self.param: ref bool) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc23(%self.param: ref bool) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc19(%self.param: ref bool) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc23(%self.param: ref bool) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc19(%self.param: ref bool) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl(%self.param) 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 9c8f83a0a036..a9a873ba9269 100644 --- a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon @@ -14,12 +14,8 @@ fn Main() { var a: i32 = 3; - // 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: a = 5.6; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_type_mismatch_assignment.carbon:[[@LINE+3]]:3-9: error: cannot implicitly convert expression of type `Core.FloatLiteral` to `i32` [ConversionFailure] + // CHECK:STDERR: fail_type_mismatch_assignment.carbon:[[@LINE+2]]:3-9: note: type `Core.FloatLiteral` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: a = 5.6; } @@ -127,7 +123,7 @@ fn Main() { // CHECK:STDOUT: } // CHECK:STDOUT: %a.ref: ref %i32 = name_ref a, %a // CHECK:STDOUT: %float: Core.FloatLiteral = float_literal_value 56e-1 [concrete = constants.%float] -// CHECK:STDOUT: %.loc24: %i32 = converted %float, [concrete = ] +// CHECK:STDOUT: %.loc20: %i32 = converted %float, [concrete = ] // CHECK:STDOUT: assign %a.ref, // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %a.var, constants.%Destroy.WithSelf.SelfDestruct.db3 // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%a.var) diff --git a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon index 1a672c2fa972..eb8a869de7e3 100644 --- a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon @@ -15,9 +15,7 @@ fn Main() -> i32 { // The following line has two mismatches, but after the first, it shouldn't // keep erroring. - // CHECK:STDERR: fail_type_mismatch_once.carbon:[[@LINE+4]]:10: error: cannot access member of interface `Core.AddWith(Core.FloatLiteral)` in type `{}` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: return {} + 3.4 + 12; - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_type_mismatch_once.carbon:[[@LINE+2]]:10-17: error: cannot access member of interface `Core.AddWith(Core.FloatLiteral)` in type `{}` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: return {} + 3.4 + 12; } @@ -74,7 +72,7 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> out %return.param: %i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc22: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc20: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: %float: Core.FloatLiteral = float_literal_value 34e-1 [concrete = constants.%float] // CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [concrete = constants.%int_12] // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon b/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon index bfef748b1372..ef63f2b34394 100644 --- a/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon @@ -13,9 +13,7 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon fn Main() -> i32 { - // CHECK:STDERR: fail_unimplemented_op.carbon:[[@LINE+4]]:10: error: cannot access member of interface `Core.AddWith(Core.IntLiteral)` in type `{}` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: return {} + 34; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_unimplemented_op.carbon:[[@LINE+2]]:10-16: error: cannot access member of interface `Core.AddWith(Core.IntLiteral)` in type `{}` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: return {} + 34; } @@ -71,7 +69,7 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> out %return.param: %i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc20: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc18: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: %int_34: Core.IntLiteral = int_value 34 [concrete = constants.%int_34] // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/builtin/ref.carbon b/toolchain/check/testdata/operators/builtin/ref.carbon index 5bab78ecf80e..9144cc0f3332 100644 --- a/toolchain/check/testdata/operators/builtin/ref.carbon +++ b/toolchain/check/testdata/operators/builtin/ref.carbon @@ -17,9 +17,7 @@ library "[[@TEST_NAME]]"; fn F() { var x: () = (); - // CHECK:STDERR: fail_discarded_ref.carbon:[[@LINE+4]]:3: error: `ref` tag is not an argument to a `ref` parameter [RefTagNoRefParam] - // CHECK:STDERR: ref x; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_discarded_ref.carbon:[[@LINE+2]]:3-7: error: `ref` tag is not an argument to a `ref` parameter [RefTagNoRefParam] // CHECK:STDERR: ref x; } @@ -30,14 +28,10 @@ library "[[@TEST_NAME]]"; fn F() { var x: () = (); - // CHECK:STDERR: fail_ref_out_of_place.carbon:[[@LINE+4]]:22: error: `ref` tag is not an argument to a `ref` parameter [RefTagNoRefParam] - // CHECK:STDERR: let unused y: () = ref x; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_ref_out_of_place.carbon:[[@LINE+2]]:22-26: error: `ref` tag is not an argument to a `ref` parameter [RefTagNoRefParam] // CHECK:STDERR: let unused y: () = ref x; - // CHECK:STDERR: fail_ref_out_of_place.carbon:[[@LINE+4]]:23: error: `ref` tag is not an argument to a `ref` parameter [RefTagNoRefParam] - // CHECK:STDERR: let unused z: () = (ref x); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_ref_out_of_place.carbon:[[@LINE+2]]:23-27: error: `ref` tag is not an argument to a `ref` parameter [RefTagNoRefParam] // CHECK:STDERR: let unused z: () = (ref x); } diff --git a/toolchain/check/testdata/operators/overloaded/eq.carbon b/toolchain/check/testdata/operators/overloaded/eq.carbon index dff9733ed162..7023f0009e75 100644 --- a/toolchain/check/testdata/operators/overloaded/eq.carbon +++ b/toolchain/check/testdata/operators/overloaded/eq.carbon @@ -54,17 +54,13 @@ package FailNoImpl; class D {}; fn TestEqual(a: D, b: D) -> bool { - // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+4]]:10: error: cannot access member of interface `Core.EqWith(D)` in type `D` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: return a == b; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+2]]:10-15: error: cannot access member of interface `Core.EqWith(D)` in type `D` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: return a == b; } fn TestNotEqual(a: D, b: D) -> bool { - // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+4]]:10: error: cannot access member of interface `Core.EqWith(D)` in type `D` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: return a != b; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+2]]:10-15: error: cannot access member of interface `Core.EqWith(D)` in type `D` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: return a != b; } @@ -82,17 +78,13 @@ impl C as Core.EqWith(C) { } fn TestRhsBad(a: C, b: D) -> bool { - // CHECK:STDERR: fail_no_impl_for_args.carbon:[[@LINE+4]]:10: error: cannot access member of interface `Core.EqWith(D)` in type `C` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: return a == b; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_no_impl_for_args.carbon:[[@LINE+2]]:10-15: error: cannot access member of interface `Core.EqWith(D)` in type `C` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: return a == b; } fn TestLhsBad(a: D, b: C) -> bool { - // CHECK:STDERR: fail_no_impl_for_args.carbon:[[@LINE+4]]:10: error: cannot access member of interface `Core.EqWith(C)` in type `D` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: return a != b; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_no_impl_for_args.carbon:[[@LINE+2]]:10-15: error: cannot access member of interface `Core.EqWith(C)` in type `D` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: return a != b; } diff --git a/toolchain/check/testdata/operators/overloaded/fail_assign_non_ref.carbon b/toolchain/check/testdata/operators/overloaded/fail_assign_non_ref.carbon index d18f84f8c9e8..60b1e5128307 100644 --- a/toolchain/check/testdata/operators/overloaded/fail_assign_non_ref.carbon +++ b/toolchain/check/testdata/operators/overloaded/fail_assign_non_ref.carbon @@ -24,23 +24,15 @@ impl C as Core.AddAssignWith(C) { } fn TestIncNonRef(a: C) { - // CHECK:STDERR: fail_assign_non_ref.carbon:[[@LINE+7]]:5: error: value expression passed to reference parameter [ValueForRefParam] - // CHECK:STDERR: ++a; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_assign_non_ref.carbon:[[@LINE-10]]:9: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn Op(ref self: C); - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_assign_non_ref.carbon:[[@LINE+3]]:5: error: value expression passed to reference parameter [ValueForRefParam] + // CHECK:STDERR: fail_assign_non_ref.carbon:[[@LINE-8]]:9-19: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: ++a; } fn TestAddAssignNonRef(a: C, b: C) { - // CHECK:STDERR: fail_assign_non_ref.carbon:[[@LINE+7]]:3: error: value expression passed to reference parameter [ValueForRefParam] - // CHECK:STDERR: a += b; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_assign_non_ref.carbon:[[@LINE-18]]:9: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn Op(ref self: C, other: C); - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_assign_non_ref.carbon:[[@LINE+3]]:3: error: value expression passed to reference parameter [ValueForRefParam] + // CHECK:STDERR: fail_assign_non_ref.carbon:[[@LINE-12]]:9-19: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: a += b; } @@ -135,10 +127,10 @@ fn TestAddAssignNonRef(a: C, b: C) { // CHECK:STDOUT: %b.patt: %pattern_type.4a7 = wrapper_binding_pattern b, %b.param_patt [concrete = constants.%b.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %a.param: %C = value_param call_param0 -// CHECK:STDOUT: %C.ref.loc37_27: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %C.ref.loc33_27: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %a: %C = wrapper_binding a, %a.param // CHECK:STDOUT: %b.param: %C = value_param call_param1 -// CHECK:STDOUT: %C.ref.loc37_33: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %C.ref.loc33_33: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %b: %C = wrapper_binding b, %b.param // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/overloaded/fail_error_recovery.carbon b/toolchain/check/testdata/operators/overloaded/fail_error_recovery.carbon index 5a7fa966d190..b30c4ec17f80 100644 --- a/toolchain/check/testdata/operators/overloaded/fail_error_recovery.carbon +++ b/toolchain/check/testdata/operators/overloaded/fail_error_recovery.carbon @@ -16,17 +16,13 @@ // `` doesn't implement an operator. fn F() { - // CHECK:STDERR: fail_error_recovery.carbon:[[@LINE+4]]:3: error: name `undeclared` not found [NameNotFound] - // CHECK:STDERR: undeclared + 1; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_error_recovery.carbon:[[@LINE+2]]:3-12: error: name `undeclared` not found [NameNotFound] // CHECK:STDERR: undeclared + 1; } fn G(n: i32) { - // CHECK:STDERR: fail_error_recovery.carbon:[[@LINE+4]]:7: error: name `undeclared` not found [NameNotFound] - // CHECK:STDERR: n + undeclared; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_error_recovery.carbon:[[@LINE+2]]:7-16: error: name `undeclared` not found [NameNotFound] // CHECK:STDERR: n + undeclared; } diff --git a/toolchain/check/testdata/operators/overloaded/fail_no_impl.carbon b/toolchain/check/testdata/operators/overloaded/fail_no_impl.carbon index 50d5b021618e..1a0e7e54ad1a 100644 --- a/toolchain/check/testdata/operators/overloaded/fail_no_impl.carbon +++ b/toolchain/check/testdata/operators/overloaded/fail_no_impl.carbon @@ -17,31 +17,23 @@ package User; class C {}; fn TestUnary(a: C) -> C { - // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+4]]:10: error: cannot access member of interface `Core.Negate` in type `C` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: return -a; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+2]]:10-11: error: cannot access member of interface `Core.Negate` in type `C` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: return -a; } fn TestBinary(a: C, b: C) -> C { - // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+4]]:10: error: cannot access member of interface `Core.AddWith(C)` in type `C` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: return a + b; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+2]]:10-14: error: cannot access member of interface `Core.AddWith(C)` in type `C` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: return a + b; } fn TestRef(b: C) { var a: C = {}; - // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Core.AddAssignWith(C)` in type `C` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: a += b; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.AddAssignWith(C)` in type `C` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: a += b; - // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Core.Inc` in type `C` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: ++a; - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+2]]:3-5: error: cannot access member of interface `Core.Inc` in type `C` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: ++a; } @@ -82,17 +74,17 @@ fn TestRef(b: C) { // CHECK:STDOUT: %pattern_type.a96: type = pattern_type %empty_struct_type [concrete] // CHECK:STDOUT: %self.param_patt.52f: %pattern_type.a96 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.4b1: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt.52f [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc36_3.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc32_3.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc36_3.1 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc32_3.1 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.1: %Destroy.WithSelf.Op.type.ef016f.1 = struct_value () [concrete] // CHECK:STDOUT: %self.param_patt.26a: %pattern_type.4a7 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.076: %pattern_type.4a7 = wrapper_binding_pattern self, %self.param_patt.26a [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc36_3.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc32_3.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc36_3.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc32_3.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403171.2: %Destroy.WithSelf.Op.type.ef016f.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc36_3.2 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc32_3.2 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.2: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -114,28 +106,28 @@ fn TestRef(b: C) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc36_3.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc32_3.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.a96 = ref_param_pattern [concrete = constants.%self.param_patt.52f] // CHECK:STDOUT: %self.patt: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.4b1] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %empty_struct_type = ref_param call_param0 // CHECK:STDOUT: %self: ref %empty_struct_type = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc36_3.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc32_3.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.a96 = ref_param_pattern [concrete = constants.%self.param_patt.52f] // CHECK:STDOUT: %self.patt: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.4b1] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %empty_struct_type = ref_param call_param0 // CHECK:STDOUT: %self: ref %empty_struct_type = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc36_3.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc32_3.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.4a7 = ref_param_pattern [concrete = constants.%self.param_patt.26a] // CHECK:STDOUT: %self.patt: %pattern_type.4a7 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.076] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %C = ref_param call_param0 // CHECK:STDOUT: %self: ref %C = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc36_3.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc32_3.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.4a7 = ref_param_pattern [concrete = constants.%self.param_patt.26a] // CHECK:STDOUT: %self.patt: %pattern_type.4a7 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.076] // CHECK:STDOUT: } { @@ -174,15 +166,15 @@ fn TestRef(b: C) { // CHECK:STDOUT: %b.param_patt: %pattern_type.4a7 = value_param_pattern [concrete = constants.%b.param_patt] // CHECK:STDOUT: %b.patt: %pattern_type.4a7 = wrapper_binding_pattern b, %b.param_patt [concrete = constants.%b.patt] // CHECK:STDOUT: %return.param_patt: %pattern_type.4a7 = out_param_pattern [concrete = constants.%return.param_patt.415] -// CHECK:STDOUT: %return.patt: %pattern_type.4a7 = return_slot_pattern %return.param_patt, %C.ref.loc27_30 [concrete = constants.%return.patt.340] +// CHECK:STDOUT: %return.patt: %pattern_type.4a7 = return_slot_pattern %return.param_patt, %C.ref.loc25_30 [concrete = constants.%return.patt.340] // CHECK:STDOUT: } { -// CHECK:STDOUT: %C.ref.loc27_30: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc27: Core.Form = init_form %C.ref.loc27_30 [concrete = constants.%.79c] +// CHECK:STDOUT: %C.ref.loc25_30: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %.loc25: Core.Form = init_form %C.ref.loc25_30 [concrete = constants.%.79c] // CHECK:STDOUT: %a.param: %C = value_param call_param0 -// CHECK:STDOUT: %C.ref.loc27_18: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %C.ref.loc25_18: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %a: %C = wrapper_binding a, %a.param // CHECK:STDOUT: %b.param: %C = value_param call_param1 -// CHECK:STDOUT: %C.ref.loc27_24: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %C.ref.loc25_24: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %b: %C = wrapper_binding b, %b.param // CHECK:STDOUT: %return.param: ref %C = out_param call_param2 // CHECK:STDOUT: %return: ref %C = return_slot %return.param @@ -192,7 +184,7 @@ fn TestRef(b: C) { // CHECK:STDOUT: %b.patt: %pattern_type.4a7 = wrapper_binding_pattern b, %b.param_patt [concrete = constants.%b.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %b.param: %C = value_param call_param0 -// CHECK:STDOUT: %C.ref.loc35: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %C.ref.loc31: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %b: %C = wrapper_binding b, %b.param // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -221,40 +213,40 @@ fn TestRef(b: C) { // CHECK:STDOUT: fn @TestRef(%b.param: %C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.var: ref %C = var_storage %a.var_patt -// CHECK:STDOUT: %.loc36_15.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc36_15.2: init %C to %a.var = class_init () [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc36_3: init %C = converted %.loc36_15.1, %.loc36_15.2 [concrete = constants.%C.val] -// CHECK:STDOUT: assign %a.var, %.loc36_3 -// CHECK:STDOUT: %C.ref.loc36: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %.loc32_15.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc32_15.2: init %C to %a.var = class_init () [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc32_3: init %C = converted %.loc32_15.1, %.loc32_15.2 [concrete = constants.%C.val] +// CHECK:STDOUT: assign %a.var, %.loc32_3 +// CHECK:STDOUT: %C.ref.loc32: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %a: ref %C = wrapper_binding a, %a.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %a.patt: %pattern_type.4a7 = ref_binding_pattern a [concrete = constants.%a.patt.28f] // CHECK:STDOUT: %a.var_patt: %pattern_type.4a7 = var_pattern %a.patt [concrete = constants.%a.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.ref.loc41: ref %C = name_ref a, %a +// CHECK:STDOUT: %a.ref.loc35: ref %C = name_ref a, %a // CHECK:STDOUT: %b.ref: %C = name_ref b, %b -// CHECK:STDOUT: %a.ref.loc46: ref %C = name_ref a, %a +// CHECK:STDOUT: %a.ref.loc38: ref %C = name_ref a, %a // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %a.var, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%a.var) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc36_3.1(%self.param: ref %empty_struct_type) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc32_3.1(%self.param: ref %empty_struct_type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc36_3.1(%self.param: ref %empty_struct_type) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc32_3.1(%self.param: ref %empty_struct_type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc36_3.1(%self.param: ref %empty_struct_type) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc32_3.1(%self.param: ref %empty_struct_type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.1(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.1(%self.param) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc36_3.2(%self.param: ref %C) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc32_3.2(%self.param: ref %C) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc36_3.2(%self.param: ref %C) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc32_3.2(%self.param: ref %C) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc36_3.2(%self.param: ref %C) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc32_3.2(%self.param: ref %C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.2(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.2(%self.param) diff --git a/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon b/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon index 660c8e7fad63..4f46c8207265 100644 --- a/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon +++ b/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon @@ -26,9 +26,7 @@ fn Test(a: C, b: D, z: bool) -> C { if (z) { return a + a; } else { - // CHECK:STDERR: fail_no_impl_for_arg.carbon:[[@LINE+4]]:12: error: cannot access member of interface `Core.AddWith(D)` in type `C` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: return a + b; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_no_impl_for_arg.carbon:[[@LINE+2]]:12-16: error: cannot access member of interface `Core.AddWith(D)` in type `C` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: return a + b; } @@ -39,9 +37,7 @@ fn TestAssign(b: D) { a += a; - // CHECK:STDERR: fail_no_impl_for_arg.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Core.AddAssignWith(D)` in type `C` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: a += b; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_no_impl_for_arg.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.AddAssignWith(D)` in type `C` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: a += b; } diff --git a/toolchain/check/testdata/operators/overloaded/index.carbon b/toolchain/check/testdata/operators/overloaded/index.carbon index 7ba9aad24a08..53c441022cb1 100644 --- a/toolchain/check/testdata/operators/overloaded/index.carbon +++ b/toolchain/check/testdata/operators/overloaded/index.carbon @@ -24,9 +24,7 @@ library "[[@TEST_NAME]]"; import Core library "core_wrong_index_with"; -// CHECK:STDERR: fail_wrong_index_with.carbon:[[@LINE+4]]:10: error: value of type `type` is not callable [CallToNonCallable] -// CHECK:STDERR: fn F() { 0[1]; } -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_wrong_index_with.carbon:[[@LINE+2]]:10-13: error: value of type `type` is not callable [CallToNonCallable] // CHECK:STDERR: fn F() { 0[1]; } @@ -34,9 +32,7 @@ fn F() { 0[1]; } library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_missing_index_with.carbon:[[@LINE+4]]:10: error: name `Core.IndexWith` implicitly referenced here, but not found [CoreNameNotFound] -// CHECK:STDERR: fn F() { 0[1]; } -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_missing_index_with.carbon:[[@LINE+2]]:10-13: error: name `Core.IndexWith` implicitly referenced here, but not found [CoreNameNotFound] // CHECK:STDERR: fn F() { 0[1]; } @@ -65,12 +61,8 @@ impl C as Core.IndexWith((), ()) { fn F() { let c: C = {}; - // CHECK:STDERR: fail_wrong_arg_count.carbon:[[@LINE+7]]:3: error: 1 argument passed to generic interface expecting 2 arguments [CallArgCountMismatch] - // CHECK:STDERR: c[()]; - // CHECK:STDERR: ^~~~~ - // CHECK:STDERR: core_wrong_arg_count.carbon:4:1: note: calling generic interface declared here [InCallToEntity] - // CHECK:STDERR: interface IndexWith(SubscriptType: type, ElementType: type) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_wrong_arg_count.carbon:[[@LINE+3]]:3-7: error: 1 argument passed to generic interface expecting 2 arguments [CallArgCountMismatch] + // CHECK:STDERR: core_wrong_arg_count.carbon:4:1-61: note: calling generic interface declared here [InCallToEntity] // CHECK:STDERR: c[()]; } @@ -639,7 +631,7 @@ fn F() { // CHECK:STDOUT: %c.patt: %pattern_type.98b = value_binding_pattern c [concrete = constants.%c.patt] // CHECK:STDOUT: } // CHECK:STDOUT: %c.ref: %C = name_ref c, %c -// CHECK:STDOUT: %.loc23: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc19: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call constants.%Destroy.WithSelf.SelfDestruct.bound(constants.%.115) // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/overloaded/index_with_prelude.carbon b/toolchain/check/testdata/operators/overloaded/index_with_prelude.carbon index d68c13a80488..21d597fde024 100644 --- a/toolchain/check/testdata/operators/overloaded/index_with_prelude.carbon +++ b/toolchain/check/testdata/operators/overloaded/index_with_prelude.carbon @@ -62,9 +62,7 @@ impl C as Core.IndexWith(SubscriptType) where .ElementType = ElementType { } let c: C = {}; -// CHECK:STDERR: fail_invalid_subscript_type.carbon:[[@LINE+4]]:22: error: cannot access member of interface `Core.IndexWith(Core.IntLiteral)` in type `C` that does not implement that interface [MissingImplInMemberAccess] -// CHECK:STDERR: let x: ElementType = c[0]; -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_invalid_subscript_type.carbon:[[@LINE+2]]:22-25: error: cannot access member of interface `Core.IndexWith(Core.IntLiteral)` in type `C` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let x: ElementType = c[0]; @@ -75,9 +73,7 @@ library "[[@TEST_NAME]]"; class C { } let c: C = {}; -// CHECK:STDERR: fail_index_with_not_implemented.carbon:[[@LINE+4]]:14: error: cannot access member of interface `Core.IndexWith(Core.IntLiteral)` in type `C` that does not implement that interface [MissingImplInMemberAccess] -// CHECK:STDERR: let x: i32 = c[0]; -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_index_with_not_implemented.carbon:[[@LINE+2]]:14-17: error: cannot access member of interface `Core.IndexWith(Core.IntLiteral)` in type `C` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: let x: i32 = c[0]; diff --git a/toolchain/check/testdata/operators/overloaded/ordered.carbon b/toolchain/check/testdata/operators/overloaded/ordered.carbon index 169f55ccab9c..5d53b2e9dbfb 100644 --- a/toolchain/check/testdata/operators/overloaded/ordered.carbon +++ b/toolchain/check/testdata/operators/overloaded/ordered.carbon @@ -75,33 +75,25 @@ package FailNoImpl; class D {}; fn TestLess(a: D, b: D) -> bool { - // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+4]]:10: error: cannot access member of interface `Core.OrderedWith(D)` in type `D` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: return a < b; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+2]]:10-14: error: cannot access member of interface `Core.OrderedWith(D)` in type `D` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: return a < b; } fn TestLessEqual(a: D, b: D) -> bool { - // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+4]]:10: error: cannot access member of interface `Core.OrderedWith(D)` in type `D` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: return a <= b; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+2]]:10-15: error: cannot access member of interface `Core.OrderedWith(D)` in type `D` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: return a <= b; } fn TestGreater(a: D, b: D) -> bool { - // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+4]]:10: error: cannot access member of interface `Core.OrderedWith(D)` in type `D` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: return a > b; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+2]]:10-14: error: cannot access member of interface `Core.OrderedWith(D)` in type `D` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: return a > b; } fn TestGreaterEqual(a: D, b: D) -> bool { - // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+4]]:10: error: cannot access member of interface `Core.OrderedWith(D)` in type `D` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: return a >= b; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+2]]:10-15: error: cannot access member of interface `Core.OrderedWith(D)` in type `D` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: return a >= b; } diff --git a/toolchain/check/testdata/operators/overloaded/string_indexing.carbon b/toolchain/check/testdata/operators/overloaded/string_indexing.carbon index e45b9a918926..622bc0f9e85b 100644 --- a/toolchain/check/testdata/operators/overloaded/string_indexing.carbon +++ b/toolchain/check/testdata/operators/overloaded/string_indexing.carbon @@ -14,9 +14,7 @@ library "[[@TEST_NAME]]"; fn TestLiteralNegativeIndex() { - // CHECK:STDERR: fail_literal_negative_index.carbon:[[@LINE+4]]:24: error: index `-1` is negative. [StringAtIndexNegative] - // CHECK:STDERR: let unused c: char = "Test"[-1]; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_literal_negative_index.carbon:[[@LINE+2]]:24-33: error: index `-1` is negative. [StringAtIndexNegative] // CHECK:STDERR: let unused c: char = "Test"[-1]; } @@ -25,9 +23,7 @@ fn TestLiteralNegativeIndex() { library "[[@TEST_NAME]]"; fn TestLiteralOutOfBounds() { - // CHECK:STDERR: fail_literal_out_of_bounds.carbon:[[@LINE+4]]:24: error: string index `4` is out of bounds; string has length 4. [StringAtIndexOutOfBounds] - // CHECK:STDERR: let unused c: char = "Test"[4]; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_literal_out_of_bounds.carbon:[[@LINE+2]]:24-32: error: string index `4` is out of bounds; string has length 4. [StringAtIndexOutOfBounds] // CHECK:STDERR: let unused c: char = "Test"[4]; } @@ -38,9 +34,7 @@ library "[[@TEST_NAME]]"; fn TestWrongType() { class C{} //@dump-sem-ir-begin - // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Core.IndexWith(type)` in type `str` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: "Test"[C]; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+2]]:3-11: error: cannot access member of interface `Core.IndexWith(type)` in type `str` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: "Test"[C]; //@dump-sem-ir-end @@ -49,21 +43,15 @@ fn TestWrongType() { // --- fail_bad_decl.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "string.at" [InvalidBuiltinSignature] -// CHECK:STDERR: fn At(s: str, index: i64) -> i32 = "string.at"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-34: error: invalid signature for builtin function "string.at" [InvalidBuiltinSignature] // CHECK:STDERR: fn At(s: str, index: i64) -> i32 = "string.at"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "string.at" [InvalidBuiltinSignature] -// CHECK:STDERR: fn At2(s: str) -> char = "string.at"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-24: error: invalid signature for builtin function "string.at" [InvalidBuiltinSignature] // CHECK:STDERR: fn At2(s: str) -> char = "string.at"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "string.at" [InvalidBuiltinSignature] -// CHECK:STDERR: fn At3(s: i32, index: i64) -> char = "string.at"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-36: error: invalid signature for builtin function "string.at" [InvalidBuiltinSignature] // CHECK:STDERR: fn At3(s: i32, index: i64) -> char = "string.at"; diff --git a/toolchain/check/testdata/package_expr/not_found.carbon b/toolchain/check/testdata/package_expr/not_found.carbon index ca255115a6f4..bb6c2daaf0d5 100644 --- a/toolchain/check/testdata/package_expr/not_found.carbon +++ b/toolchain/check/testdata/package_expr/not_found.carbon @@ -14,9 +14,7 @@ library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: fail_direct.carbon:[[@LINE+4]]:23: error: member name `x` not found in `Main` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: var unused y: i32 = package.x; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_direct.carbon:[[@LINE+2]]:23-31: error: member name `x` not found in `Main` [MemberNameNotFoundInInstScope] // CHECK:STDERR: var unused y: i32 = package.x; } @@ -27,9 +25,7 @@ library "[[@TEST_NAME]]"; private interface Private {} fn F() { - // CHECK:STDERR: fail_nested.carbon:[[@LINE+4]]:3: error: member name `DoesNotExist` not found in `Private` [MemberNameNotFoundInSpecificScope] - // CHECK:STDERR: package.Private.DoesNotExist; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_nested.carbon:[[@LINE+2]]:3-30: error: member name `DoesNotExist` not found in `Private` [MemberNameNotFoundInSpecificScope] // CHECK:STDERR: package.Private.DoesNotExist; } diff --git a/toolchain/check/testdata/packages/core_name_poisoning.carbon b/toolchain/check/testdata/packages/core_name_poisoning.carbon index ac3010dba7f7..5fdd0e7d7e9e 100644 --- a/toolchain/check/testdata/packages/core_name_poisoning.carbon +++ b/toolchain/check/testdata/packages/core_name_poisoning.carbon @@ -14,9 +14,7 @@ library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_implicitly_poison_core.carbon:[[@LINE+4]]:9: error: `Core.Bool` implicitly referenced here, but package `Core` not found [CoreNotFound] -// CHECK:STDERR: fn F(x: bool); -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_implicitly_poison_core.carbon:[[@LINE+2]]:9-12: error: `Core.Bool` implicitly referenced here, but package `Core` not found [CoreNotFound] // CHECK:STDERR: fn F(x: bool); @@ -27,9 +25,7 @@ class r#Core {} package Core library "[[@TEST_NAME]]"; // This introduces a poisoned name in `Core`. -// CHECK:STDERR: fail_poisoned_core.carbon:[[@LINE+4]]:8: error: name `Core.Int` implicitly referenced here, but not found [CoreNameNotFound] -// CHECK:STDERR: var x: i32; -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_poisoned_core.carbon:[[@LINE+2]]:8-10: error: name `Core.Int` implicitly referenced here, but not found [CoreNameNotFound] // CHECK:STDERR: var x: i32; @@ -40,8 +36,6 @@ library "[[@TEST_NAME]]"; import Core library "poisoned_core"; // This accesses the poisoned name in `Core`. -// CHECK:STDERR: fail_use_poisoned_core.carbon:[[@LINE+4]]:9: error: name `Core.Int` implicitly referenced here, but not found [CoreNameNotFound] -// CHECK:STDERR: fn F(b: i32); -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_use_poisoned_core.carbon:[[@LINE+2]]:9-11: error: name `Core.Int` implicitly referenced here, but not found [CoreNameNotFound] // CHECK:STDERR: fn F(b: i32); diff --git a/toolchain/check/testdata/packages/cross_package_export.carbon b/toolchain/check/testdata/packages/cross_package_export.carbon index 65833e621704..e13d824a804b 100644 --- a/toolchain/check/testdata/packages/cross_package_export.carbon +++ b/toolchain/check/testdata/packages/cross_package_export.carbon @@ -157,20 +157,14 @@ import Other library "conflict"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_conflict_on_export_import.carbon:[[@LINE+8]]:1: in import [InImport] -// CHECK:STDERR: base.carbon:4:1: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: class C { -// CHECK:STDERR: ^~~~~~~~~ -// CHECK:STDERR: fail_conflict_on_export_import.carbon:[[@LINE+4]]:1: in import [InImport] -// CHECK:STDERR: conflict.carbon:4:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: fn C() {} -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: imported from: fail_conflict_on_export_import.carbon:[[@LINE+4]]:1 [InImport] +// CHECK:STDERR: base.carbon:4:1-9: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_conflict_on_export_import.carbon:[[@LINE+2]]:1 [InImport] +// CHECK:STDERR: conflict.carbon:4:1-8: note: name is previously declared here [NameDeclPrevious] import Other library "export_import"; import Other library "conflict"; -// CHECK:STDERR: fail_conflict_on_export_import.carbon:[[@LINE+4]]:11: note: in name lookup for `C` [InNameLookup] -// CHECK:STDERR: alias C = Other.C; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_conflict_on_export_import.carbon:[[@LINE+2]]:11-17: note: in name lookup for `C` [InNameLookup] // CHECK:STDERR: alias C = Other.C; @@ -178,21 +172,15 @@ alias C = Other.C; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_conflict_on_export_name.carbon:[[@LINE+9]]:1: in import [InImport] -// CHECK:STDERR: conflict.carbon:4:1: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: fn C() {} -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_conflict_on_export_name.carbon:[[@LINE+5]]:1: in import [InImport] -// CHECK:STDERR: export_name.carbon:4:1: in import [InImport] -// CHECK:STDERR: base.carbon:4:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: class C { -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: imported from: fail_conflict_on_export_name.carbon:[[@LINE+5]]:1 [InImport] +// CHECK:STDERR: conflict.carbon:4:1-8: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_conflict_on_export_name.carbon:[[@LINE+3]]:1 [InImport] +// CHECK:STDERR: imported from: export_name.carbon:4:1 [InImport] +// CHECK:STDERR: base.carbon:4:1-9: note: name is previously declared here [NameDeclPrevious] import Other library "export_name"; import Other library "conflict"; -// CHECK:STDERR: fail_conflict_on_export_name.carbon:[[@LINE+4]]:11: note: in name lookup for `C` [InNameLookup] -// CHECK:STDERR: alias C = Other.C; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_conflict_on_export_name.carbon:[[@LINE+2]]:11-17: note: in name lookup for `C` [InNameLookup] // CHECK:STDERR: alias C = Other.C; diff --git a/toolchain/check/testdata/packages/cross_package_import.carbon b/toolchain/check/testdata/packages/cross_package_import.carbon index 99a1da383af9..d6e440763f0e 100644 --- a/toolchain/check/testdata/packages/cross_package_import.carbon +++ b/toolchain/check/testdata/packages/cross_package_import.carbon @@ -74,21 +74,15 @@ fn Run() { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_todo_main_use_other_extern.carbon:[[@LINE+8]]:1: in import [InImport] -// CHECK:STDERR: other_fn_extern.carbon:4:1: error: duplicate name `F` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: extern fn F(); -// CHECK:STDERR: ^~~~~~~~~~~~~~ -// CHECK:STDERR: fail_todo_main_use_other_extern.carbon:[[@LINE+4]]:1: in import [InImport] -// CHECK:STDERR: other_fn.carbon:4:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: fn F() {} -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: imported from: fail_todo_main_use_other_extern.carbon:[[@LINE+4]]:1 [InImport] +// CHECK:STDERR: other_fn_extern.carbon:4:1-14: error: duplicate name `F` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_todo_main_use_other_extern.carbon:[[@LINE+2]]:1 [InImport] +// CHECK:STDERR: other_fn.carbon:4:1-8: note: name is previously declared here [NameDeclPrevious] import Other library "other_fn"; import Other library "other_fn_extern"; fn Run() { - // CHECK:STDERR: fail_todo_main_use_other_extern.carbon:[[@LINE+4]]:3: note: in name lookup for `F` [InNameLookup] - // CHECK:STDERR: Other.F(); - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_todo_main_use_other_extern.carbon:[[@LINE+2]]:3-9: note: in name lookup for `F` [InNameLookup] // CHECK:STDERR: Other.F(); } @@ -104,21 +98,15 @@ import Other library "other_fn_conflict"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_main_use_other_ambiguous.carbon:[[@LINE+8]]:1: in import [InImport] -// CHECK:STDERR: other_fn_conflict.carbon:4:1: error: duplicate name `F` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: fn F(unused x: ()) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_main_use_other_ambiguous.carbon:[[@LINE+4]]:1: in import [InImport] -// CHECK:STDERR: other_fn.carbon:4:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: fn F() {} -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: imported from: fail_main_use_other_ambiguous.carbon:[[@LINE+4]]:1 [InImport] +// CHECK:STDERR: other_fn_conflict.carbon:4:1-20: error: duplicate name `F` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_main_use_other_ambiguous.carbon:[[@LINE+2]]:1 [InImport] +// CHECK:STDERR: other_fn.carbon:4:1-8: note: name is previously declared here [NameDeclPrevious] import Other library "other_fn"; import Other library "other_fn_conflict"; fn Run() { - // CHECK:STDERR: fail_main_use_other_ambiguous.carbon:[[@LINE+4]]:3: note: in name lookup for `F` [InNameLookup] - // CHECK:STDERR: Other.F(); - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_main_use_other_ambiguous.carbon:[[@LINE+2]]:3-9: note: in name lookup for `F` [InNameLookup] // CHECK:STDERR: Other.F(); } @@ -128,23 +116,15 @@ fn Run() { library "[[@TEST_NAME]]"; import library "main_other_ns"; -// CHECK:STDERR: fail_main_namespace_conflict.carbon:[[@LINE+8]]:1: error: duplicate name `Other` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: import Other library "other_fn"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_main_namespace_conflict.carbon:[[@LINE-4]]:1: in import [InImport] -// CHECK:STDERR: main_other_ns.carbon:4:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: namespace Other; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_main_namespace_conflict.carbon:[[@LINE+4]]:1-32: error: duplicate name `Other` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_main_namespace_conflict.carbon:[[@LINE-2]]:1 [InImport] +// CHECK:STDERR: main_other_ns.carbon:4:1-16: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: import Other library "other_fn"; -// CHECK:STDERR: fail_main_namespace_conflict.carbon:[[@LINE+8]]:1: error: redeclaration of `fn F` is redundant [RedeclRedundant] -// CHECK:STDERR: fn Other.F() {} -// CHECK:STDERR: ^~~~~~~~~~~~~~ -// CHECK:STDERR: fail_main_namespace_conflict.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: other_fn.carbon:4:1: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: fn F() {} -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_main_namespace_conflict.carbon:[[@LINE+4]]:1-14: error: redeclaration of `fn F` is redundant [RedeclRedundant] +// CHECK:STDERR: imported from: fail_main_namespace_conflict.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: other_fn.carbon:4:1-8: note: previously declared here [RedeclPrevDecl] // CHECK:STDERR: fn Other.F() {} @@ -154,12 +134,8 @@ library "[[@TEST_NAME]]"; import Other library "other_fn"; -// CHECK:STDERR: fail_main_reopen_other.carbon:[[@LINE+7]]:11: error: duplicate name `Other` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: namespace Other; -// CHECK:STDERR: ^~~~~ -// CHECK:STDERR: fail_main_reopen_other.carbon:[[@LINE-5]]:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: import Other library "other_fn"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_main_reopen_other.carbon:[[@LINE+3]]:11-15: error: duplicate name `Other` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_main_reopen_other.carbon:[[@LINE-3]]:1-32: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: namespace Other; @@ -172,12 +148,8 @@ library "[[@TEST_NAME]]"; import Other library "other_fn"; -// CHECK:STDERR: fail_main_reopen_other_nested.carbon:[[@LINE+7]]:11: error: imported packages cannot be used for declarations [QualifiedDeclOutsidePackage] -// CHECK:STDERR: namespace Other.Nested; -// CHECK:STDERR: ^~~~~ -// CHECK:STDERR: fail_main_reopen_other_nested.carbon:[[@LINE-5]]:1: note: package imported here [QualifiedDeclOutsidePackageSource] -// CHECK:STDERR: import Other library "other_fn"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_main_reopen_other_nested.carbon:[[@LINE+3]]:11-15: error: imported packages cannot be used for declarations [QualifiedDeclOutsidePackage] +// CHECK:STDERR: fail_main_reopen_other_nested.carbon:[[@LINE-3]]:1-32: note: package imported here [QualifiedDeclOutsidePackageSource] // CHECK:STDERR: namespace Other.Nested; @@ -190,12 +162,8 @@ library "[[@TEST_NAME]]"; import Other library "other_fn"; -// CHECK:STDERR: fail_main_add_to_other.carbon:[[@LINE+7]]:4: error: imported packages cannot be used for declarations [QualifiedDeclOutsidePackage] -// CHECK:STDERR: fn Other.G() {} -// CHECK:STDERR: ^~~~~ -// CHECK:STDERR: fail_main_add_to_other.carbon:[[@LINE-5]]:1: note: package imported here [QualifiedDeclOutsidePackageSource] -// CHECK:STDERR: import Other library "other_fn"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_main_add_to_other.carbon:[[@LINE+3]]:4-8: error: imported packages cannot be used for declarations [QualifiedDeclOutsidePackage] +// CHECK:STDERR: fail_main_add_to_other.carbon:[[@LINE-3]]:1-32: note: package imported here [QualifiedDeclOutsidePackageSource] // CHECK:STDERR: fn Other.G() {} @@ -205,9 +173,7 @@ library "[[@TEST_NAME]]"; import Other library "other_fn_use"; -// CHECK:STDERR: fail_use_other_fn_use.carbon:[[@LINE+4]]:13: error: member name `F` not found in `Other` [MemberNameNotFoundInInstScope] -// CHECK:STDERR: fn UseF() { Other.F(); } -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_use_other_fn_use.carbon:[[@LINE+2]]:13-19: error: member name `F` not found in `Other` [MemberNameNotFoundInInstScope] // CHECK:STDERR: fn UseF() { Other.F(); } @@ -493,7 +459,7 @@ fn UseF() { Other.F(); } // CHECK:STDOUT: type: type = facet_type [concrete] // CHECK:STDOUT: %F.type.2a8c71.1: type = fn_type @F.1 [concrete] // CHECK:STDOUT: %F.1be9f8.1: %F.type.2a8c71.1 = struct_value () [concrete] -// CHECK:STDOUT: %F.type.2a8c71.2: type = fn_type @F.loc23 [concrete] +// CHECK:STDOUT: %F.type.2a8c71.2: type = fn_type @F.loc15 [concrete] // CHECK:STDOUT: %F.1be9f8.2: %F.type.2a8c71.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -512,12 +478,12 @@ fn UseF() { Other.F(); } // CHECK:STDOUT: } // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %Other.import = import Other -// CHECK:STDOUT: %F.decl: %F.type.2a8c71.2 = fn_decl @F.loc23 [concrete = constants.%F.1be9f8.2] {} {} +// CHECK:STDOUT: %F.decl: %F.type.2a8c71.2 = fn_decl @F.loc15 [concrete = constants.%F.1be9f8.2] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F.1 [from "other_fn.carbon"]; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.loc23() { +// CHECK:STDOUT: fn @F.loc15() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/packages/export_import.carbon b/toolchain/check/testdata/packages/export_import.carbon index dc1a52c00605..705312a42d83 100644 --- a/toolchain/check/testdata/packages/export_import.carbon +++ b/toolchain/check/testdata/packages/export_import.carbon @@ -76,13 +76,9 @@ var c: C = {.x = ()}; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_export_in_impl.impl.carbon:[[@LINE+8]]:1: error: `export` is only allowed in API files [ExportFromImpl] -// CHECK:STDERR: export import library "base"; -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_export_in_impl.impl.carbon:[[@LINE+4]]:1-6: error: `export` is only allowed in API files [ExportFromImpl] // CHECK:STDERR: -// CHECK:STDERR: fail_export_in_impl.impl.carbon:[[@LINE+4]]:1: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] -// CHECK:STDERR: export import library "base"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_export_in_impl.impl.carbon:[[@LINE+2]]:1-29: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: export import library "base"; @@ -152,9 +148,7 @@ library "[[@TEST_NAME]]"; import library "non_export"; -// CHECK:STDERR: fail_use_non_export.carbon:[[@LINE+4]]:15: error: name `C` not found [NameNotFound] -// CHECK:STDERR: alias Local = C; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_use_non_export.carbon:[[@LINE+2]]:15: error: name `C` not found [NameNotFound] // CHECK:STDERR: alias Local = C; @@ -179,14 +173,10 @@ var indirect_c: C = {.x = ()}; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_export_poisoned.carbon:[[@LINE+4]]:11: error: name `Poison` not found [NameNotFound] -// CHECK:STDERR: fn F() -> Poison; -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_export_poisoned.carbon:[[@LINE+2]]:11-16: error: name `Poison` not found [NameNotFound] // CHECK:STDERR: fn F() -> Poison; -// CHECK:STDERR: fail_export_poisoned.carbon:[[@LINE+4]]:1: error: name `Poison` not found [NameNotFound] -// CHECK:STDERR: export Poison; -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_export_poisoned.carbon:[[@LINE+2]]:1-14: error: name `Poison` not found [NameNotFound] // CHECK:STDERR: export Poison; diff --git a/toolchain/check/testdata/packages/export_mixed.carbon b/toolchain/check/testdata/packages/export_mixed.carbon index 5085e9295a06..c10732c0ef37 100644 --- a/toolchain/check/testdata/packages/export_mixed.carbon +++ b/toolchain/check/testdata/packages/export_mixed.carbon @@ -92,9 +92,7 @@ library "[[@TEST_NAME]]"; import library "export_import_then_name"; import library "export_name_then_import"; -// CHECK:STDERR: fail_nonexport_use_both.carbon:[[@LINE+4]]:8: error: name `D` not found [NameNotFound] -// CHECK:STDERR: var d: D = {.y = ()}; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_nonexport_use_both.carbon:[[@LINE+2]]:8: error: name `D` not found [NameNotFound] // CHECK:STDERR: var d: D = {.y = ()}; @@ -482,8 +480,8 @@ var d: D = {.y = ()}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_19: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc11_20: %struct_type.y = struct_literal (%.loc11_19) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc9_19: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc9_20: %struct_type.y = struct_literal (%.loc9_19) [concrete = constants.%struct] // CHECK:STDOUT: assign file.%d.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/packages/export_name.carbon b/toolchain/check/testdata/packages/export_name.carbon index 8cc403143953..d9cdf9038bcb 100644 --- a/toolchain/check/testdata/packages/export_name.carbon +++ b/toolchain/check/testdata/packages/export_name.carbon @@ -91,13 +91,9 @@ library "[[@TEST_NAME]]"; import library "base"; -// CHECK:STDERR: fail_export_ns.carbon:[[@LINE+8]]:1: error: only imported entities are valid for `export` [ExportNotImportedEntity] -// CHECK:STDERR: export NS; -// CHECK:STDERR: ^~~~~~~~~~ -// CHECK:STDERR: fail_export_ns.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: base.carbon:8:1: note: name is declared here [ExportNotImportedEntitySource] -// CHECK:STDERR: namespace NS; -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_export_ns.carbon:[[@LINE+4]]:1-10: error: only imported entities are valid for `export` [ExportNotImportedEntity] +// CHECK:STDERR: imported from: fail_export_ns.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: base.carbon:8:1-13: note: name is declared here [ExportNotImportedEntitySource] // CHECK:STDERR: export NS; @@ -107,12 +103,8 @@ library "[[@TEST_NAME]]"; class Local {} -// CHECK:STDERR: fail_export_decl.carbon:[[@LINE+7]]:1: error: only imported entities are valid for `export` [ExportNotImportedEntity] -// CHECK:STDERR: export Local; -// CHECK:STDERR: ^~~~~~~~~~~~~ -// CHECK:STDERR: fail_export_decl.carbon:[[@LINE-5]]:1: note: name is declared here [ExportNotImportedEntitySource] -// CHECK:STDERR: class Local {} -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_export_decl.carbon:[[@LINE+3]]:1-13: error: only imported entities are valid for `export` [ExportNotImportedEntity] +// CHECK:STDERR: fail_export_decl.carbon:[[@LINE-3]]:1-13: note: name is declared here [ExportNotImportedEntitySource] // CHECK:STDERR: export Local; @@ -122,13 +114,9 @@ library "[[@TEST_NAME]]"; import library "base"; -// CHECK:STDERR: fail_export_member.carbon:[[@LINE+8]]:8: error: name qualifiers are only allowed for entities that provide a scope [QualifiedNameInNonScope] -// CHECK:STDERR: export C.x; -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_export_member.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: base.carbon:4:1: note: referenced non-scope entity declared here [QualifiedNameNonScopeEntity] -// CHECK:STDERR: class C { -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_export_member.carbon:[[@LINE+4]]:8: error: name qualifiers are only allowed for entities that provide a scope [QualifiedNameInNonScope] +// CHECK:STDERR: imported from: fail_export_member.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: base.carbon:4:1-9: note: referenced non-scope entity declared here [QualifiedNameNonScopeEntity] // CHECK:STDERR: export C.x; @@ -158,14 +146,10 @@ library "[[@TEST_NAME]]"; import library "not_reexporting"; -// CHECK:STDERR: fail_use_not_reexporting.carbon:[[@LINE+4]]:15: error: name `C` not found [NameNotFound] -// CHECK:STDERR: alias Local = C; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_use_not_reexporting.carbon:[[@LINE+2]]:15: error: name `C` not found [NameNotFound] // CHECK:STDERR: alias Local = C; -// CHECK:STDERR: fail_use_not_reexporting.carbon:[[@LINE+4]]:17: error: name `NS` not found [NameNotFound] -// CHECK:STDERR: alias NSLocal = NS.NSC; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_use_not_reexporting.carbon:[[@LINE+2]]:17-18: error: name `NS` not found [NameNotFound] // CHECK:STDERR: alias NSLocal = NS.NSC; @@ -176,12 +160,8 @@ library "[[@TEST_NAME]]"; import library "base"; export C; -// CHECK:STDERR: repeat_export.carbon:[[@LINE+7]]:1: warning: `export` matches previous `export` [ExportRedundant] -// CHECK:STDERR: export C; -// CHECK:STDERR: ^~~~~~~~~ -// CHECK:STDERR: repeat_export.carbon:[[@LINE-4]]:1: note: previous `export` here [ExportPrevious] -// CHECK:STDERR: export C; -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: repeat_export.carbon:[[@LINE+3]]:1-9: warning: `export` matches previous `export` [ExportRedundant] +// CHECK:STDERR: repeat_export.carbon:[[@LINE-2]]:1-9: note: previous `export` here [ExportPrevious] // CHECK:STDERR: export C; @@ -199,9 +179,7 @@ library "[[@TEST_NAME]]"; import library "base"; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `private` not allowed on `export` declaration [ModifierNotAllowedOnDeclaration] -// CHECK:STDERR: private export C; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-7: error: `private` not allowed on `export` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: private export C; diff --git a/toolchain/check/testdata/packages/fail_api_not_found.carbon b/toolchain/check/testdata/packages/fail_api_not_found.carbon index a3c044a58811..ffd5223a2202 100644 --- a/toolchain/check/testdata/packages/fail_api_not_found.carbon +++ b/toolchain/check/testdata/packages/fail_api_not_found.carbon @@ -14,25 +14,19 @@ // --- fail_no_api.impl.carbon -// CHECK:STDERR: fail_no_api.impl.carbon:[[@LINE+4]]:1: error: corresponding API for 'Foo' not found [LibraryApiNotFound] -// CHECK:STDERR: impl package Foo; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_no_api.impl.carbon:[[@LINE+2]]:1-17: error: corresponding API for 'Foo' not found [LibraryApiNotFound] // CHECK:STDERR: impl package Foo; // --- fail_no_api_lib.impl.carbon -// CHECK:STDERR: fail_no_api_lib.impl.carbon:[[@LINE+4]]:1: error: corresponding API for 'Foo//no_api_lib' not found [LibraryApiNotFound] -// CHECK:STDERR: impl package Foo library "no_api_lib"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_no_api_lib.impl.carbon:[[@LINE+2]]:1-38: error: corresponding API for 'Foo//no_api_lib' not found [LibraryApiNotFound] // CHECK:STDERR: impl package Foo library "[[@TEST_NAME]]"; // --- fail_no_api_main_lib.impl.carbon -// CHECK:STDERR: fail_no_api_main_lib.impl.carbon:[[@LINE+4]]:1: error: corresponding API for 'Main//no_api_main_lib' not found [LibraryApiNotFound] -// CHECK:STDERR: impl library "no_api_main_lib"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_no_api_main_lib.impl.carbon:[[@LINE+2]]:1-31: error: corresponding API for 'Main//no_api_main_lib' not found [LibraryApiNotFound] // CHECK:STDERR: impl library "[[@TEST_NAME]]"; diff --git a/toolchain/check/testdata/packages/fail_conflict_no_namespaces.carbon b/toolchain/check/testdata/packages/fail_conflict_no_namespaces.carbon index b0fd9c7e28be..75b03e6b4570 100644 --- a/toolchain/check/testdata/packages/fail_conflict_no_namespaces.carbon +++ b/toolchain/check/testdata/packages/fail_conflict_no_namespaces.carbon @@ -28,14 +28,10 @@ var Foo: i32; package Example library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+9]]:1: in import [InImport] -// CHECK:STDERR: var.carbon:4:5: error: duplicate name `Foo` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: var Foo: i32; -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+5]]:1: in import [InImport] -// CHECK:STDERR: fn.carbon:4:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: fn Foo(); -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: imported from: fail_conflict.carbon:[[@LINE+5]]:1 [InImport] +// CHECK:STDERR: var.carbon:4:5-12: error: duplicate name `Foo` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_conflict.carbon:[[@LINE+3]]:1 [InImport] +// CHECK:STDERR: fn.carbon:4:1-9: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: import library "fn"; import library "var"; diff --git a/toolchain/check/testdata/packages/fail_cycle.carbon b/toolchain/check/testdata/packages/fail_cycle.carbon index 954ceb5c7526..52ebf65b495d 100644 --- a/toolchain/check/testdata/packages/fail_cycle.carbon +++ b/toolchain/check/testdata/packages/fail_cycle.carbon @@ -16,9 +16,7 @@ package A; -// CHECK:STDERR: fail_a.carbon:[[@LINE+4]]:1: error: import cannot be used due to a cycle; cycle must be fixed to import [ImportCycleDetected] -// CHECK:STDERR: import B; -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_a.carbon:[[@LINE+2]]:1-9: error: import cannot be used due to a cycle; cycle must be fixed to import [ImportCycleDetected] // CHECK:STDERR: import B; @@ -26,9 +24,7 @@ import B; package B; -// CHECK:STDERR: fail_b.carbon:[[@LINE+4]]:1: error: import cannot be used due to a cycle; cycle must be fixed to import [ImportCycleDetected] -// CHECK:STDERR: import C; -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_b.carbon:[[@LINE+2]]:1-9: error: import cannot be used due to a cycle; cycle must be fixed to import [ImportCycleDetected] // CHECK:STDERR: import C; @@ -36,17 +32,13 @@ import C; package C; -// CHECK:STDERR: fail_c.carbon:[[@LINE+4]]:1: error: import cannot be used due to a cycle; cycle must be fixed to import [ImportCycleDetected] -// CHECK:STDERR: import A; -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_c.carbon:[[@LINE+2]]:1-9: error: import cannot be used due to a cycle; cycle must be fixed to import [ImportCycleDetected] // CHECK:STDERR: import A; // --- fail_c.impl.carbon -// CHECK:STDERR: fail_c.impl.carbon:[[@LINE+4]]:1: error: import cannot be used due to a cycle; cycle must be fixed to import [ImportCycleDetected] -// CHECK:STDERR: impl package C; -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_c.impl.carbon:[[@LINE+2]]:1-15: error: import cannot be used due to a cycle; cycle must be fixed to import [ImportCycleDetected] // CHECK:STDERR: impl package C; @@ -54,9 +46,7 @@ impl package C; package CycleChild; -// CHECK:STDERR: fail_cycle_child.carbon:[[@LINE+4]]:1: error: import cannot be used due to a cycle; cycle must be fixed to import [ImportCycleDetected] -// CHECK:STDERR: import B; -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_cycle_child.carbon:[[@LINE+2]]:1-9: error: import cannot be used due to a cycle; cycle must be fixed to import [ImportCycleDetected] // CHECK:STDERR: import B; diff --git a/toolchain/check/testdata/packages/fail_duplicate_api.carbon b/toolchain/check/testdata/packages/fail_duplicate_api.carbon index cbc89e93919b..7394db4e53c5 100644 --- a/toolchain/check/testdata/packages/fail_duplicate_api.carbon +++ b/toolchain/check/testdata/packages/fail_duplicate_api.carbon @@ -24,9 +24,7 @@ library "lib"; // --- fail_main_lib2.carbon -// CHECK:STDERR: fail_main_lib2.carbon:[[@LINE+4]]:1: error: library's API previously provided by `main_lib1.carbon` [DuplicateLibraryApi] -// CHECK:STDERR: library "lib"; -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_main_lib2.carbon:[[@LINE+2]]:1-14: error: library's API previously provided by `main_lib1.carbon` [DuplicateLibraryApi] // CHECK:STDERR: library "lib"; @@ -36,9 +34,7 @@ package Package; // --- fail_package2.carbon -// CHECK:STDERR: fail_package2.carbon:[[@LINE+4]]:1: error: library's API previously provided by `package1.carbon` [DuplicateLibraryApi] -// CHECK:STDERR: package Package; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_package2.carbon:[[@LINE+2]]:1-16: error: library's API previously provided by `package1.carbon` [DuplicateLibraryApi] // CHECK:STDERR: package Package; @@ -48,9 +44,7 @@ package Package library "lib"; // --- fail_package_lib2.carbon -// CHECK:STDERR: fail_package_lib2.carbon:[[@LINE+4]]:1: error: library's API previously provided by `package_lib1.carbon` [DuplicateLibraryApi] -// CHECK:STDERR: package Package library "lib"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_package_lib2.carbon:[[@LINE+2]]:1-30: error: library's API previously provided by `package_lib1.carbon` [DuplicateLibraryApi] // CHECK:STDERR: package Package library "lib"; diff --git a/toolchain/check/testdata/packages/fail_export_name_member.carbon b/toolchain/check/testdata/packages/fail_export_name_member.carbon index 2f04cbcb1c32..c48a73893b07 100644 --- a/toolchain/check/testdata/packages/fail_export_name_member.carbon +++ b/toolchain/check/testdata/packages/fail_export_name_member.carbon @@ -28,13 +28,9 @@ import library "a"; // TODO: This diagnostic doesn't clearly explain the problem. We should instead // say something like: Only namespace-scope names can be exported. -// CHECK:STDERR: fail_b.carbon:[[@LINE+8]]:8: error: name qualifiers are only allowed for entities that provide a scope [QualifiedNameInNonScope] -// CHECK:STDERR: export C.n; -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_b.carbon:[[@LINE-7]]:1: in import [InImport] -// CHECK:STDERR: a.carbon:4:1: note: referenced non-scope entity declared here [QualifiedNameNonScopeEntity] -// CHECK:STDERR: class C { -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_b.carbon:[[@LINE+4]]:8: error: name qualifiers are only allowed for entities that provide a scope [QualifiedNameInNonScope] +// CHECK:STDERR: imported from: fail_b.carbon:[[@LINE-5]]:1 [InImport] +// CHECK:STDERR: a.carbon:4:1-9: note: referenced non-scope entity declared here [QualifiedNameNonScopeEntity] // CHECK:STDERR: export C.n; diff --git a/toolchain/check/testdata/packages/fail_export_name_params.carbon b/toolchain/check/testdata/packages/fail_export_name_params.carbon index 915f55947290..2d63a830a0a5 100644 --- a/toolchain/check/testdata/packages/fail_export_name_params.carbon +++ b/toolchain/check/testdata/packages/fail_export_name_params.carbon @@ -27,9 +27,7 @@ import library "a"; export C1; -// CHECK:STDERR: fail_b.carbon:[[@LINE+4]]:10: error: `export` declaration cannot have parameters [UnexpectedDeclNameParams] -// CHECK:STDERR: export C2(T: type); -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_b.carbon:[[@LINE+2]]:10-18: error: `export` declaration cannot have parameters [UnexpectedDeclNameParams] // CHECK:STDERR: export C2(T: type); @@ -124,9 +122,9 @@ export C2(T: type); // CHECK:STDOUT: } // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %C1: %C1.type = export C1, imports.%Foo.C1 [concrete = constants.%C1.generic] -// CHECK:STDOUT: %.loc12_14.1: type = splice_block %.loc12_14.2 [concrete = type] { +// CHECK:STDOUT: %.loc10_14.1: type = splice_block %.loc10_14.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc12_14.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc10_14.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic = constants.%T] // CHECK:STDOUT: %C2: %C2.type = export C2, imports.%Foo.C2 [concrete = constants.%C2.generic] diff --git a/toolchain/check/testdata/packages/fail_extension.carbon b/toolchain/check/testdata/packages/fail_extension.carbon index 9913d8b07370..b2e1d587e0f1 100644 --- a/toolchain/check/testdata/packages/fail_extension.carbon +++ b/toolchain/check/testdata/packages/fail_extension.carbon @@ -19,72 +19,54 @@ // --- fail_main_redundant_with_swapped_ext.impl.carbon // CHECK:STDERR: fail_main_redundant_with_swapped_ext.impl.carbon: error: `Main//default` previously provided by `fail_main.incorrect` [DuplicateMainApi] // CHECK:STDERR: -// CHECK:STDERR: fail_main_redundant_with_swapped_ext.impl.carbon: error: file extension of `.carbon` required for api [IncorrectExtension] -// CHECK:STDERR: fail_main_redundant_with_swapped_ext.impl.carbon: note: file extension of `.impl.carbon` only allowed for `impl` [IncorrectExtensionImplNote] +// CHECK:STDERR: fail_main_redundant_with_swapped_ext.impl.carbon: error: file extension of `.carbon` required for api; `.impl.carbon` names an `impl` file [IncorrectExtension] // CHECK:STDERR: // --- fail_main_lib.incorrect -// CHECK:STDERR: fail_main_lib.incorrect:[[@LINE+4]]:1: error: file extension of `.carbon` required for api [IncorrectExtension] -// CHECK:STDERR: library "main_lib"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_main_lib.incorrect:[[@LINE+2]]:1-19: error: file extension of `.carbon` required for api [IncorrectExtension] // CHECK:STDERR: library "[[@TEST_NAME]]"; // --- fail_main_lib.impl.incorrect -// CHECK:STDERR: fail_main_lib.impl.incorrect:[[@LINE+4]]:1: error: file extension of `.impl.carbon` required for `impl` [IncorrectExtension] -// CHECK:STDERR: impl library "main_lib"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_main_lib.impl.incorrect:[[@LINE+2]]:1-24: error: file extension of `.impl.carbon` required for `impl` [IncorrectExtension] // CHECK:STDERR: impl library "[[@TEST_NAME]]"; // --- fail_package.incorrect -// CHECK:STDERR: fail_package.incorrect:[[@LINE+4]]:1: error: file extension of `.carbon` required for api [IncorrectExtension] -// CHECK:STDERR: package Package; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_package.incorrect:[[@LINE+2]]:1-16: error: file extension of `.carbon` required for api [IncorrectExtension] // CHECK:STDERR: package Package; // --- fail_package_impl.incorrect -// CHECK:STDERR: fail_package_impl.incorrect:[[@LINE+4]]:1: error: file extension of `.impl.carbon` required for `impl` [IncorrectExtension] -// CHECK:STDERR: impl package Package; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_package_impl.incorrect:[[@LINE+2]]:1-21: error: file extension of `.impl.carbon` required for `impl` [IncorrectExtension] // CHECK:STDERR: impl package Package; // --- fail_package_lib.incorrect -// CHECK:STDERR: fail_package_lib.incorrect:[[@LINE+4]]:1: error: file extension of `.carbon` required for api [IncorrectExtension] -// CHECK:STDERR: package Package library "package_lib"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_package_lib.incorrect:[[@LINE+2]]:1-38: error: file extension of `.carbon` required for api [IncorrectExtension] // CHECK:STDERR: package Package library "[[@TEST_NAME]]"; // --- fail_package_lib.impl.incorrect -// CHECK:STDERR: fail_package_lib.impl.incorrect:[[@LINE+4]]:1: error: file extension of `.impl.carbon` required for `impl` [IncorrectExtension] -// CHECK:STDERR: impl package Package library "package_lib"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_package_lib.impl.incorrect:[[@LINE+2]]:1-43: error: file extension of `.impl.carbon` required for `impl` [IncorrectExtension] // CHECK:STDERR: impl package Package library "[[@TEST_NAME]]"; // --- fail_swapped_ext.impl.carbon -// CHECK:STDERR: fail_swapped_ext.impl.carbon:[[@LINE+5]]:1: error: file extension of `.carbon` required for api [IncorrectExtension] -// CHECK:STDERR: package SwappedExt; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_swapped_ext.impl.carbon: note: file extension of `.impl.carbon` only allowed for `impl` [IncorrectExtensionImplNote] +// CHECK:STDERR: fail_swapped_ext.impl.carbon:[[@LINE+2]]:1-19: error: file extension of `.carbon` required for api; `.impl.carbon` names an `impl` file [IncorrectExtension] // CHECK:STDERR: package SwappedExt; // --- fail_swapped_ext.carbon -// CHECK:STDERR: fail_swapped_ext.carbon:[[@LINE+4]]:1: error: file extension of `.impl.carbon` required for `impl` [IncorrectExtension] -// CHECK:STDERR: impl package SwappedExt; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_swapped_ext.carbon:[[@LINE+2]]:1-24: error: file extension of `.impl.carbon` required for `impl` [IncorrectExtension] // CHECK:STDERR: impl package SwappedExt; @@ -111,8 +93,8 @@ impl package SwappedExt; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] {} -// CHECK:STDOUT: %default.import.loc6_24.1 = import -// CHECK:STDOUT: %default.import.loc6_24.2 = import +// CHECK:STDOUT: %default.import.loc4_24.1 = import +// CHECK:STDOUT: %default.import.loc4_24.2 = import // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_package.incorrect diff --git a/toolchain/check/testdata/packages/fail_import_default.carbon b/toolchain/check/testdata/packages/fail_import_default.carbon index fcaf3cae99f6..865cf85026ce 100644 --- a/toolchain/check/testdata/packages/fail_import_default.carbon +++ b/toolchain/check/testdata/packages/fail_import_default.carbon @@ -16,9 +16,7 @@ package A; -// CHECK:STDERR: fail_default_api.carbon:[[@LINE+4]]:1: error: file cannot import itself [ImportSelf] -// CHECK:STDERR: import library default; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_default_api.carbon:[[@LINE+2]]:1-23: error: file cannot import itself [ImportSelf] // CHECK:STDERR: import library default; @@ -26,17 +24,13 @@ import library default; impl package A; -// CHECK:STDERR: fail_default.impl.carbon:[[@LINE+4]]:1: error: explicit import of `api` from `impl` file is redundant with implicit import [ExplicitImportApi] -// CHECK:STDERR: import library default; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_default.impl.carbon:[[@LINE+2]]:1-23: error: explicit import of `api` from `impl` file is redundant with implicit import [ExplicitImportApi] // CHECK:STDERR: import library default; // --- fail_main_import_default.carbon -// CHECK:STDERR: fail_main_import_default.carbon:[[@LINE+4]]:1: error: explicit import of `api` from `impl` file is redundant with implicit import [ExplicitImportApi] -// CHECK:STDERR: import library default; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_main_import_default.carbon:[[@LINE+2]]:1-23: error: explicit import of `api` from `impl` file is redundant with implicit import [ExplicitImportApi] // CHECK:STDERR: import library default; @@ -44,9 +38,7 @@ import library default; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_main_lib_import_default.carbon:[[@LINE+4]]:1: error: cannot import `Main//default` [ImportMainDefaultLibrary] -// CHECK:STDERR: import library default; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_main_lib_import_default.carbon:[[@LINE+2]]:1-23: error: cannot import `Main//default` [ImportMainDefaultLibrary] // CHECK:STDERR: import library default; diff --git a/toolchain/check/testdata/packages/fail_import_inline_not_cpp.carbon b/toolchain/check/testdata/packages/fail_import_inline_not_cpp.carbon index d3ee655163da..10e5986a2611 100644 --- a/toolchain/check/testdata/packages/fail_import_inline_not_cpp.carbon +++ b/toolchain/check/testdata/packages/fail_import_inline_not_cpp.carbon @@ -10,8 +10,6 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/packages/fail_import_inline_not_cpp.carbon -// CHECK:STDERR: fail_import_inline_not_cpp.carbon:[[@LINE+4]]:1: error: `inline` import not in package `Cpp` [InlineImportNotCpp] -// CHECK:STDERR: import NotCpp inline "not C++ code"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_import_inline_not_cpp.carbon:[[@LINE+2]]:1-36: error: `inline` import not in package `Cpp` [InlineImportNotCpp] // CHECK:STDERR: import NotCpp inline "not C++ code"; diff --git a/toolchain/check/testdata/packages/fail_import_invalid.carbon b/toolchain/check/testdata/packages/fail_import_invalid.carbon index 96dd529c31a0..399a9284bca1 100644 --- a/toolchain/check/testdata/packages/fail_import_invalid.carbon +++ b/toolchain/check/testdata/packages/fail_import_invalid.carbon @@ -14,15 +14,11 @@ // --- fail_main.carbon -// CHECK:STDERR: fail_main.carbon:[[@LINE+4]]:1: error: imports from the current package must omit the package name [ImportCurrentPackageByName] -// CHECK:STDERR: import Main; -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_main.carbon:[[@LINE+2]]:1-12: error: imports from the current package must omit the package name [ImportCurrentPackageByName] // CHECK:STDERR: import Main; -// CHECK:STDERR: fail_main.carbon:[[@LINE+4]]:1: error: imports from the current package must omit the package name [ImportCurrentPackageByName] -// CHECK:STDERR: import Main library "lib"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_main.carbon:[[@LINE+2]]:1-26: error: imports from the current package must omit the package name [ImportCurrentPackageByName] // CHECK:STDERR: import Main library "lib"; @@ -30,15 +26,11 @@ import Main library "lib"; package NotMain; -// CHECK:STDERR: fail_not_main.carbon:[[@LINE+4]]:1: error: cannot import `Main` from other packages [ImportMainPackage] -// CHECK:STDERR: import Main; -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_not_main.carbon:[[@LINE+2]]:1-12: error: cannot import `Main` from other packages [ImportMainPackage] // CHECK:STDERR: import Main; -// CHECK:STDERR: fail_not_main.carbon:[[@LINE+4]]:1: error: cannot import `Main` from other packages [ImportMainPackage] -// CHECK:STDERR: import Main library "lib"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_not_main.carbon:[[@LINE+2]]:1-26: error: cannot import `Main` from other packages [ImportMainPackage] // CHECK:STDERR: import Main library "lib"; @@ -46,9 +38,7 @@ import Main library "lib"; package This; -// CHECK:STDERR: fail_this.carbon:[[@LINE+4]]:1: error: file cannot import itself [ImportSelf] -// CHECK:STDERR: import This; -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_this.carbon:[[@LINE+2]]:1-12: error: file cannot import itself [ImportSelf] // CHECK:STDERR: import This; @@ -56,9 +46,7 @@ import This; package This library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_this_lib.carbon:[[@LINE+4]]:1: error: file cannot import itself [ImportSelf] -// CHECK:STDERR: import library "this_lib"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_this_lib.carbon:[[@LINE+2]]:1-26: error: file cannot import itself [ImportSelf] // CHECK:STDERR: import library "this_lib"; @@ -70,9 +58,7 @@ package Implicit; impl package Implicit; -// CHECK:STDERR: fail_implicit.impl.carbon:[[@LINE+4]]:1: error: explicit import of `api` from `impl` file is redundant with implicit import [ExplicitImportApi] -// CHECK:STDERR: import Implicit; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_implicit.impl.carbon:[[@LINE+2]]:1-16: error: explicit import of `api` from `impl` file is redundant with implicit import [ExplicitImportApi] // CHECK:STDERR: import Implicit; @@ -84,18 +70,14 @@ package Implicit library "[[@TEST_NAME]]"; impl package Implicit library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_implicit_lib.impl.carbon:[[@LINE+4]]:1: error: explicit import of `api` from `impl` file is redundant with implicit import [ExplicitImportApi] -// CHECK:STDERR: import Implicit library "implicit_lib"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_implicit_lib.impl.carbon:[[@LINE+2]]:1-39: error: explicit import of `api` from `impl` file is redundant with implicit import [ExplicitImportApi] // CHECK:STDERR: import Implicit library "implicit_lib"; // --- fail_not_found.carbon package NotFound; -// CHECK:STDERR: fail_not_found.carbon:[[@LINE+4]]:1: error: imported API 'ImportNotFound' not found [ImportNotFound] -// CHECK:STDERR: import ImportNotFound; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_not_found.carbon:[[@LINE+2]]:1-22: error: imported API 'ImportNotFound' not found [ImportNotFound] // CHECK:STDERR: import ImportNotFound; diff --git a/toolchain/check/testdata/packages/fail_import_repeat.carbon b/toolchain/check/testdata/packages/fail_import_repeat.carbon index 499ee6155b3b..6570866751e3 100644 --- a/toolchain/check/testdata/packages/fail_import_repeat.carbon +++ b/toolchain/check/testdata/packages/fail_import_repeat.carbon @@ -27,32 +27,20 @@ library "[[@TEST_NAME]]"; // --- fail_import.carbon import Api; -// CHECK:STDERR: fail_import.carbon:[[@LINE+7]]:1: error: library imported more than once [RepeatedImport] -// CHECK:STDERR: import Api; -// CHECK:STDERR: ^~~~~~~~~~~ -// CHECK:STDERR: fail_import.carbon:[[@LINE-4]]:1: note: first import here [FirstImported] -// CHECK:STDERR: import Api; -// CHECK:STDERR: ^~~~~~~~~~~ +// CHECK:STDERR: fail_import.carbon:[[@LINE+3]]:1-11: error: library imported more than once [RepeatedImport] +// CHECK:STDERR: fail_import.carbon:[[@LINE-2]]:1-11: note: first import here [FirstImported] // CHECK:STDERR: import Api; import Api library "api_lib"; -// CHECK:STDERR: fail_import.carbon:[[@LINE+7]]:1: error: library imported more than once [RepeatedImport] -// CHECK:STDERR: import Api library "api_lib"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_import.carbon:[[@LINE-4]]:1: note: first import here [FirstImported] -// CHECK:STDERR: import Api library "api_lib"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_import.carbon:[[@LINE+3]]:1-29: error: library imported more than once [RepeatedImport] +// CHECK:STDERR: fail_import.carbon:[[@LINE-2]]:1-29: note: first import here [FirstImported] // CHECK:STDERR: import Api library "api_lib"; import library "main_lib"; -// CHECK:STDERR: fail_import.carbon:[[@LINE+7]]:1: error: library imported more than once [RepeatedImport] -// CHECK:STDERR: import library "main_lib"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_import.carbon:[[@LINE-4]]:1: note: first import here [FirstImported] -// CHECK:STDERR: import library "main_lib"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_import.carbon:[[@LINE+3]]:1-26: error: library imported more than once [RepeatedImport] +// CHECK:STDERR: fail_import.carbon:[[@LINE-2]]:1-26: note: first import here [FirstImported] // CHECK:STDERR: import library "main_lib"; @@ -61,12 +49,8 @@ import library "main_lib"; package Api library "[[@TEST_NAME]]"; import library default; -// CHECK:STDERR: fail_default_import.carbon:[[@LINE+7]]:1: error: library imported more than once [RepeatedImport] -// CHECK:STDERR: import library default; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_default_import.carbon:[[@LINE-4]]:1: note: first import here [FirstImported] -// CHECK:STDERR: import library default; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_default_import.carbon:[[@LINE+3]]:1-23: error: library imported more than once [RepeatedImport] +// CHECK:STDERR: fail_default_import.carbon:[[@LINE-2]]:1-23: note: first import here [FirstImported] // CHECK:STDERR: import library default; diff --git a/toolchain/check/testdata/packages/fail_import_type_error.carbon b/toolchain/check/testdata/packages/fail_import_type_error.carbon index adbe58c44622..703c80ff411c 100644 --- a/toolchain/check/testdata/packages/fail_import_type_error.carbon +++ b/toolchain/check/testdata/packages/fail_import_type_error.carbon @@ -16,24 +16,16 @@ package Implicit; -// CHECK:STDERR: fail_implicit.carbon:[[@LINE+4]]:12: error: name `x` not found [NameNotFound] -// CHECK:STDERR: var a_ref: x; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_implicit.carbon:[[@LINE+2]]:12: error: name `x` not found [NameNotFound] // CHECK:STDERR: var a_ref: x; -// CHECK:STDERR: fail_implicit.carbon:[[@LINE+4]]:18: error: name `x` not found [NameNotFound] -// CHECK:STDERR: var b_ref: {.a = x}; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_implicit.carbon:[[@LINE+2]]:18: error: name `x` not found [NameNotFound] // CHECK:STDERR: var b_ref: {.a = x}; -// CHECK:STDERR: fail_implicit.carbon:[[@LINE+4]]:13: error: name `x` not found [NameNotFound] -// CHECK:STDERR: var c_ref: (x,); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_implicit.carbon:[[@LINE+2]]:13: error: name `x` not found [NameNotFound] // CHECK:STDERR: var c_ref: (x,); -// CHECK:STDERR: fail_implicit.carbon:[[@LINE+4]]:12: error: name `x` not found [NameNotFound] -// CHECK:STDERR: var d_ref: x*; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_implicit.carbon:[[@LINE+2]]:12: error: name `x` not found [NameNotFound] // CHECK:STDERR: var d_ref: x*; @@ -72,7 +64,7 @@ var d: i32 = d_ref; // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %a_ref.var: ref = var_storage %a_ref.var_patt [concrete = ] -// CHECK:STDOUT: %x.ref.loc8: = name_ref x, [concrete = ] +// CHECK:STDOUT: %x.ref.loc6: = name_ref x, [concrete = ] // CHECK:STDOUT: %a_ref: = wrapper_binding a_ref, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %a_ref.patt: = ref_binding_pattern a_ref [concrete = ] @@ -80,8 +72,8 @@ var d: i32 = d_ref; // CHECK:STDOUT: } // CHECK:STDOUT: %b_ref.var: ref = var_storage %b_ref.var_patt [concrete = ] // CHECK:STDOUT: %.1: = splice_block [concrete = ] { -// CHECK:STDOUT: %x.ref.loc13: = name_ref x, [concrete = ] -// CHECK:STDOUT: %.loc13: = struct_literal (%x.ref.loc13) [concrete = ] +// CHECK:STDOUT: %x.ref.loc9: = name_ref x, [concrete = ] +// CHECK:STDOUT: %.loc9: = struct_literal (%x.ref.loc9) [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %b_ref: = wrapper_binding b_ref, [concrete = ] // CHECK:STDOUT: name_binding_decl { @@ -90,8 +82,8 @@ var d: i32 = d_ref; // CHECK:STDOUT: } // CHECK:STDOUT: %c_ref.var: ref = var_storage %c_ref.var_patt [concrete = ] // CHECK:STDOUT: %.2: = splice_block [concrete = ] { -// CHECK:STDOUT: %x.ref.loc18: = name_ref x, [concrete = ] -// CHECK:STDOUT: %.loc18: = tuple_literal (%x.ref.loc18) [concrete = ] +// CHECK:STDOUT: %x.ref.loc12: = name_ref x, [concrete = ] +// CHECK:STDOUT: %.loc12: = tuple_literal (%x.ref.loc12) [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %c_ref: = wrapper_binding c_ref, [concrete = ] // CHECK:STDOUT: name_binding_decl { @@ -99,8 +91,8 @@ var d: i32 = d_ref; // CHECK:STDOUT: %c_ref.var_patt: = var_pattern %c_ref.patt [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %d_ref.var: ref = var_storage %d_ref.var_patt [concrete = ] -// CHECK:STDOUT: %.loc23: type = splice_block %ptr [concrete = ] { -// CHECK:STDOUT: %x.ref.loc23: = name_ref x, [concrete = ] +// CHECK:STDOUT: %.loc15: type = splice_block %ptr [concrete = ] { +// CHECK:STDOUT: %x.ref.loc15: = name_ref x, [concrete = ] // CHECK:STDOUT: %ptr: type = ptr_type [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %d_ref: = wrapper_binding d_ref, [concrete = ] diff --git a/toolchain/check/testdata/packages/fail_modifiers.carbon b/toolchain/check/testdata/packages/fail_modifiers.carbon index e2418acd63dc..27147ca27c02 100644 --- a/toolchain/check/testdata/packages/fail_modifiers.carbon +++ b/toolchain/check/testdata/packages/fail_modifiers.carbon @@ -12,104 +12,70 @@ // --- fail_extend_package.carbon -// CHECK:STDERR: fail_extend_package.carbon:[[@LINE+4]]:1: error: `extend` not allowed on `package` declaration [ModifierNotAllowedOnDeclaration] -// CHECK:STDERR: extend package ExtendPackage; -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_extend_package.carbon:[[@LINE+2]]:1-6: error: `extend` not allowed on `package` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: extend package ExtendPackage; // --- fail_export_package.carbon -// CHECK:STDERR: fail_export_package.carbon:[[@LINE+4]]:1: error: `export` not allowed on `package` declaration [ModifierNotAllowedOnDeclaration] -// CHECK:STDERR: export package ExportPackage; -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_export_package.carbon:[[@LINE+2]]:1-6: error: `export` not allowed on `package` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: export package ExportPackage; // --- fail_final_package.carbon -// CHECK:STDERR: fail_final_package.carbon:[[@LINE+8]]:1: error: library's API previously provided by `fail_extend_package.carbon` [DuplicateLibraryApi] -// CHECK:STDERR: final package ExtendPackage; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_final_package.carbon:[[@LINE+4]]:1-28: error: library's API previously provided by `fail_extend_package.carbon` [DuplicateLibraryApi] // CHECK:STDERR: -// CHECK:STDERR: fail_final_package.carbon:[[@LINE+4]]:1: error: `final` not allowed on `package` declaration [ModifierNotAllowedOnDeclaration] -// CHECK:STDERR: final package ExtendPackage; -// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: fail_final_package.carbon:[[@LINE+2]]:1-5: error: `final` not allowed on `package` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: final package ExtendPackage; // --- fail_virtual_package.carbon -// CHECK:STDERR: fail_virtual_package.carbon:[[@LINE+4]]:1: error: `virtual` not allowed on `package` declaration [ModifierNotAllowedOnDeclaration] -// CHECK:STDERR: virtual package VirtualPackage; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_virtual_package.carbon:[[@LINE+2]]:1-7: error: `virtual` not allowed on `package` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: virtual package VirtualPackage; // --- fail_private_package.carbon -// CHECK:STDERR: fail_private_package.carbon:[[@LINE+4]]:1: error: `private` not allowed on `package` declaration [ModifierNotAllowedOnDeclaration] -// CHECK:STDERR: private package PrivatePackage; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_private_package.carbon:[[@LINE+2]]:1-7: error: `private` not allowed on `package` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: private package PrivatePackage; // --- fail_export_library.carbon -// CHECK:STDERR: fail_export_library.carbon:[[@LINE+4]]:1: error: `export` not allowed on `library` declaration [ModifierNotAllowedOnDeclaration] -// CHECK:STDERR: export library "export_library"; -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_export_library.carbon:[[@LINE+2]]:1-6: error: `export` not allowed on `library` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: export library "export_library"; // --- fail_import_modifiers.carbon -// CHECK:STDERR: fail_import_modifiers.carbon:[[@LINE+8]]:1: error: imported API 'ImplImport' not found [ImportNotFound] -// CHECK:STDERR: impl import ImplImport; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_import_modifiers.carbon:[[@LINE+4]]:1-23: error: imported API 'ImplImport' not found [ImportNotFound] // CHECK:STDERR: -// CHECK:STDERR: fail_import_modifiers.carbon:[[@LINE+4]]:1: error: `impl` not allowed on `import` declaration [ModifierNotAllowedOnDeclaration] -// CHECK:STDERR: impl import ImplImport; -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_import_modifiers.carbon:[[@LINE+2]]:1-4: error: `impl` not allowed on `import` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: impl import ImplImport; -// CHECK:STDERR: fail_import_modifiers.carbon:[[@LINE+8]]:1: error: imported API 'ExtendImport' not found [ImportNotFound] -// CHECK:STDERR: extend import ExtendImport; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_import_modifiers.carbon:[[@LINE+4]]:1-27: error: imported API 'ExtendImport' not found [ImportNotFound] // CHECK:STDERR: -// CHECK:STDERR: fail_import_modifiers.carbon:[[@LINE+4]]:1: error: `extend` not allowed on `import` declaration [ModifierNotAllowedOnDeclaration] -// CHECK:STDERR: extend import ExtendImport; -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_import_modifiers.carbon:[[@LINE+2]]:1-6: error: `extend` not allowed on `import` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: extend import ExtendImport; -// CHECK:STDERR: fail_import_modifiers.carbon:[[@LINE+8]]:1: error: imported API 'VirtualImport' not found [ImportNotFound] -// CHECK:STDERR: virtual import VirtualImport; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_import_modifiers.carbon:[[@LINE+4]]:1-29: error: imported API 'VirtualImport' not found [ImportNotFound] // CHECK:STDERR: -// CHECK:STDERR: fail_import_modifiers.carbon:[[@LINE+4]]:1: error: `virtual` not allowed on `import` declaration [ModifierNotAllowedOnDeclaration] -// CHECK:STDERR: virtual import VirtualImport; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_import_modifiers.carbon:[[@LINE+2]]:1-7: error: `virtual` not allowed on `import` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: virtual import VirtualImport; -// CHECK:STDERR: fail_import_modifiers.carbon:[[@LINE+8]]:1: error: imported API 'BaseImport' not found [ImportNotFound] -// CHECK:STDERR: base import BaseImport; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_import_modifiers.carbon:[[@LINE+4]]:1-23: error: imported API 'BaseImport' not found [ImportNotFound] // CHECK:STDERR: -// CHECK:STDERR: fail_import_modifiers.carbon:[[@LINE+4]]:1: error: `base` not allowed on `import` declaration [ModifierNotAllowedOnDeclaration] -// CHECK:STDERR: base import BaseImport; -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_import_modifiers.carbon:[[@LINE+2]]:1-4: error: `base` not allowed on `import` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: base import BaseImport; -// CHECK:STDERR: fail_import_modifiers.carbon:[[@LINE+8]]:1: error: imported API 'PrivateImport' not found [ImportNotFound] -// CHECK:STDERR: private import PrivateImport; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_import_modifiers.carbon:[[@LINE+4]]:1-29: error: imported API 'PrivateImport' not found [ImportNotFound] // CHECK:STDERR: -// CHECK:STDERR: fail_import_modifiers.carbon:[[@LINE+4]]:1: error: `private` not allowed on `import` declaration [ModifierNotAllowedOnDeclaration] -// CHECK:STDERR: private import PrivateImport; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_import_modifiers.carbon:[[@LINE+2]]:1-7: error: `private` not allowed on `import` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: private import PrivateImport; diff --git a/toolchain/check/testdata/packages/fail_name_with_import_failure.carbon b/toolchain/check/testdata/packages/fail_name_with_import_failure.carbon index afb779dd9b21..f0dc44c5ee4a 100644 --- a/toolchain/check/testdata/packages/fail_name_with_import_failure.carbon +++ b/toolchain/check/testdata/packages/fail_name_with_import_failure.carbon @@ -14,9 +14,7 @@ // --- fail_implicit.impl.carbon -// CHECK:STDERR: fail_implicit.impl.carbon:[[@LINE+4]]:1: error: corresponding API for 'Implicit' not found [LibraryApiNotFound] -// CHECK:STDERR: impl package Implicit; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_implicit.impl.carbon:[[@LINE+2]]:1-22: error: corresponding API for 'Implicit' not found [LibraryApiNotFound] // CHECK:STDERR: impl package Implicit; @@ -41,9 +39,9 @@ var a: () = A(); // CHECK:STDOUT: } // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %a.var: ref %empty_tuple.type = var_storage %a.var_patt [concrete] -// CHECK:STDOUT: %.loc8_9.1: type = splice_block %.loc8_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc8_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_9.3: type = converted %.loc8_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc6_9.1: type = splice_block %.loc6_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc6_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc6_9.3: type = converted %.loc6_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %a: ref %empty_tuple.type = wrapper_binding a, %a.var [concrete = %a.var] // CHECK:STDOUT: name_binding_decl { diff --git a/toolchain/check/testdata/packages/implicit_imports_entities.carbon b/toolchain/check/testdata/packages/implicit_imports_entities.carbon index 07f70825c3f1..cdd54564efef 100644 --- a/toolchain/check/testdata/packages/implicit_imports_entities.carbon +++ b/toolchain/check/testdata/packages/implicit_imports_entities.carbon @@ -135,14 +135,10 @@ import Other library "o1"; // --- fail_import_conflict.impl.carbon -// CHECK:STDERR: fail_import_conflict.impl.carbon:[[@LINE+9]]:1: in import [InImport] -// CHECK:STDERR: import_conflict.carbon:4:1: error: duplicate name `Other` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: import Other library "o1"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_import_conflict.impl.carbon:[[@LINE+5]]:1: in import [InImport] -// CHECK:STDERR: local_other.carbon:4:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: class Other {} -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: imported from: fail_import_conflict.impl.carbon:[[@LINE+5]]:1 [InImport] +// CHECK:STDERR: import_conflict.carbon:4:1-26: error: duplicate name `Other` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_import_conflict.impl.carbon:[[@LINE+3]]:1 [InImport] +// CHECK:STDERR: local_other.carbon:4:1-13: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: impl library "[[@TEST_NAME]]"; @@ -158,14 +154,10 @@ import library "local_other"; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_conflict_reverse.impl.carbon:[[@LINE+9]]:1: error: duplicate name `Other` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: import Other library "o1"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_import_conflict_reverse.impl.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: import_conflict_reverse.carbon:4:1: in import [InImport] -// CHECK:STDERR: local_other.carbon:4:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: class Other {} -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_import_conflict_reverse.impl.carbon:[[@LINE+5]]:1-26: error: duplicate name `Other` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: imported from: fail_import_conflict_reverse.impl.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: imported from: import_conflict_reverse.carbon:4:1 [InImport] +// CHECK:STDERR: local_other.carbon:4:1-13: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: import Other library "o1"; @@ -759,8 +751,8 @@ import Other library "o1"; // CHECK:STDOUT: package: = namespace [concrete] { // CHECK:STDOUT: .Other = imports.%Other // CHECK:STDOUT: } -// CHECK:STDOUT: %default.import.loc11_31.1 = import -// CHECK:STDOUT: %default.import.loc11_31.2 = import +// CHECK:STDOUT: %default.import.loc7_31.1 = import +// CHECK:STDOUT: %default.import.loc7_31.2 = import // CHECK:STDOUT: %Other.import = import Other // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/packages/missing_prelude.carbon b/toolchain/check/testdata/packages/missing_prelude.carbon index 355f369de5f3..7e81b121dcee 100644 --- a/toolchain/check/testdata/packages/missing_prelude.carbon +++ b/toolchain/check/testdata/packages/missing_prelude.carbon @@ -16,9 +16,7 @@ library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_missing_prelude.carbon:[[@LINE+4]]:8: error: `Core.Int` implicitly referenced here, but package `Core` not found [CoreNotFound] -// CHECK:STDERR: var n: i32; -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_missing_prelude.carbon:[[@LINE+2]]:8-10: error: `Core.Int` implicitly referenced here, but package `Core` not found [CoreNotFound] // CHECK:STDERR: var n: i32; @@ -32,9 +30,7 @@ library "[[@TEST_NAME]]"; import Core library "prelude_empty"; -// CHECK:STDERR: fail_missing_prelude_member.carbon:[[@LINE+4]]:8: error: name `Core.Int` implicitly referenced here, but not found [CoreNameNotFound] -// CHECK:STDERR: var n: i32; -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_missing_prelude_member.carbon:[[@LINE+2]]:8-10: error: name `Core.Int` implicitly referenced here, but not found [CoreNameNotFound] // CHECK:STDERR: var n: i32; @@ -57,19 +53,11 @@ library "[[@TEST_NAME]]"; import Core library "prelude_fake_int"; // We don't really care whether this works, but it shouldn't crash or otherwise misbehave. -// CHECK:STDERR: fail_use_fake_int.carbon:[[@LINE+14]]:17: error: cannot implicitly convert non-type value of type `Core.X` to `type` [ConversionFailureNonTypeToFacet] -// CHECK:STDERR: let n: Core.X = i32; -// CHECK:STDERR: ^~~ -// CHECK:STDERR: fail_use_fake_int.carbon:[[@LINE+11]]:17: note: type `Core.X` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: let n: Core.X = i32; -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_use_fake_int.carbon:[[@LINE+6]]:17-19: error: cannot implicitly convert non-type value of type `Core.X` to `type` [ConversionFailureNonTypeToFacet] +// CHECK:STDERR: fail_use_fake_int.carbon:[[@LINE+5]]:17-19: note: type `Core.X` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: -// CHECK:STDERR: fail_use_fake_int.carbon:[[@LINE+7]]:17: error: cannot implicitly convert expression of type `type` to `Core.X` [ConversionFailure] -// CHECK:STDERR: let n: Core.X = i32; -// CHECK:STDERR: ^~~ -// CHECK:STDERR: fail_use_fake_int.carbon:[[@LINE+4]]:17: note: type `type` does not implement interface `Core.ImplicitAs(Core.X)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: let n: Core.X = i32; -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_use_fake_int.carbon:[[@LINE+3]]:17-19: error: cannot implicitly convert expression of type `type` to `Core.X` [ConversionFailure] +// CHECK:STDERR: fail_use_fake_int.carbon:[[@LINE+2]]:17-19: note: type `type` does not implement interface `Core.ImplicitAs(Core.X)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let n: Core.X = i32; @@ -87,19 +75,13 @@ let n: i32 = {}; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_prelude_as_namespace.carbon:[[@LINE+8]]:11: error: `namespace` introducer should be followed by a name [ExpectedDeclName] -// CHECK:STDERR: namespace Core; -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_prelude_as_namespace.carbon:[[@LINE+4]]:11-14: error: `namespace` introducer should be followed by a name [ExpectedDeclName] // CHECK:STDERR: -// CHECK:STDERR: fail_prelude_as_namespace.carbon:[[@LINE+4]]:11: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] -// CHECK:STDERR: namespace Core; -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_prelude_as_namespace.carbon:[[@LINE+2]]:11-14: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: namespace Core; -// CHECK:STDERR: fail_prelude_as_namespace.carbon:[[@LINE+4]]:4: error: `fn` introducer should be followed by a name [ExpectedDeclName] -// CHECK:STDERR: fn Core.Int[T: type](generic N: T) -> {} { return {}; } -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_prelude_as_namespace.carbon:[[@LINE+2]]:4-7: error: `fn` introducer should be followed by a name [ExpectedDeclName] // CHECK:STDERR: fn Core.Int[T: type](generic N: T) -> {} { return {}; } @@ -110,13 +92,9 @@ let n: type = i32; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_prelude_as_class.carbon:[[@LINE+8]]:7: error: `class` introducer should be followed by a name [ExpectedDeclName] -// CHECK:STDERR: class Core { -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_prelude_as_class.carbon:[[@LINE+4]]:7-10: error: `class` introducer should be followed by a name [ExpectedDeclName] // CHECK:STDERR: -// CHECK:STDERR: fail_prelude_as_class.carbon:[[@LINE+4]]:7: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] -// CHECK:STDERR: class Core { -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_prelude_as_class.carbon:[[@LINE+2]]:7-10: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: class Core { fn Int[T: type](generic N: T) -> {} { return {}; } @@ -136,7 +114,7 @@ let n: type = i32; // CHECK:STDOUT: .n = %n // CHECK:STDOUT: } // CHECK:STDOUT: %n.var: ref = var_storage %n.var_patt [concrete = ] -// CHECK:STDOUT: %.loc8: type = type_literal [concrete = ] +// CHECK:STDOUT: %.loc6: type = type_literal [concrete = ] // CHECK:STDOUT: %n: = wrapper_binding n, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %n.patt: = ref_binding_pattern n [concrete = ] @@ -176,7 +154,7 @@ let n: type = i32; // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %n.var: ref = var_storage %n.var_patt [concrete = ] -// CHECK:STDOUT: %.loc10: type = type_literal [concrete = ] +// CHECK:STDOUT: %.loc8: type = type_literal [concrete = ] // CHECK:STDOUT: %n: = wrapper_binding n, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %n.patt: = ref_binding_pattern n [concrete = ] @@ -465,8 +443,8 @@ let n: type = i32; // CHECK:STDOUT: .n = %n // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %.loc21_17: %X = converted @__global_init.%.loc21_17.3, [concrete = ] -// CHECK:STDOUT: %.loc21_12: type = splice_block %X.ref [concrete = constants.%X] { +// CHECK:STDOUT: %.loc13_17: %X = converted @__global_init.%.loc13_17.3, [concrete = ] +// CHECK:STDOUT: %.loc13_12: type = splice_block %X.ref [concrete = constants.%X] { // CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [concrete = imports.%Core] // CHECK:STDOUT: %X.ref: type = name_ref X, imports.%Core.X [concrete = constants.%X] // CHECK:STDOUT: } @@ -532,10 +510,10 @@ let n: type = i32; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Int.specific_fn: = specific_function constants.%Int, @Int(Core.IntLiteral, constants.%int_32) [concrete = constants.%Int.specific_fn] -// CHECK:STDOUT: %.loc21_17.1: ref %X = temporary_storage -// CHECK:STDOUT: %Int.call: init %X to %.loc21_17.1 = call %Int.specific_fn() -// CHECK:STDOUT: %.loc21_17.2: type = converted %Int.call, [concrete = ] -// CHECK:STDOUT: %.loc21_17.3: type = type_literal [concrete = ] +// CHECK:STDOUT: %.loc13_17.1: ref %X = temporary_storage +// CHECK:STDOUT: %Int.call: init %X to %.loc13_17.1 = call %Int.specific_fn() +// CHECK:STDOUT: %.loc13_17.2: type = converted %Int.call, [concrete = ] +// CHECK:STDOUT: %.loc13_17.3: type = type_literal [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/packages/raw_core.carbon b/toolchain/check/testdata/packages/raw_core.carbon index f55885ff4c9c..433f2df33abf 100644 --- a/toolchain/check/testdata/packages/raw_core.carbon +++ b/toolchain/check/testdata/packages/raw_core.carbon @@ -34,15 +34,11 @@ library "[[@TEST_NAME]]"; import r#Core; -// CHECK:STDERR: fail_raw_core_not_core.carbon:[[@LINE+4]]:10: error: member name `F` not found in `Core` [MemberNameNotFoundInInstScope] -// CHECK:STDERR: fn G() { Core.F(); } -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_raw_core_not_core.carbon:[[@LINE+2]]:10-15: error: member name `F` not found in `Core` [MemberNameNotFoundInInstScope] // CHECK:STDERR: fn G() { Core.F(); } -// CHECK:STDERR: fail_raw_core_not_core.carbon:[[@LINE+4]]:10: error: member name `Int` not found in `r#Core` [MemberNameNotFoundInInstScope] -// CHECK:STDERR: fn H() { r#Core.Int(32); } -// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: fail_raw_core_not_core.carbon:[[@LINE+2]]:10-19: error: member name `Int` not found in `r#Core` [MemberNameNotFoundInInstScope] // CHECK:STDERR: fn H() { r#Core.Int(32); } diff --git a/toolchain/check/testdata/packages/restricted_package_names.carbon b/toolchain/check/testdata/packages/restricted_package_names.carbon index 3106413b9c69..b1d1015b2d0f 100644 --- a/toolchain/check/testdata/packages/restricted_package_names.carbon +++ b/toolchain/check/testdata/packages/restricted_package_names.carbon @@ -19,34 +19,26 @@ package main; // --- fail_main.carbon -// CHECK:STDERR: fail_main.carbon:[[@LINE+4]]:1: error: `Main//default` must omit `package` declaration [ExplicitMainPackage] -// CHECK:STDERR: package Main; -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_main.carbon:[[@LINE+2]]:1-13: error: `Main//default` must omit `package` declaration [ExplicitMainPackage] // CHECK:STDERR: package Main; // --- fail_main_impl.carbon -// CHECK:STDERR: fail_main_impl.carbon:[[@LINE+4]]:1: error: `Main//default` must omit `package` declaration [ExplicitMainPackage] -// CHECK:STDERR: impl package Main; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_main_impl.carbon:[[@LINE+2]]:1-18: error: `Main//default` must omit `package` declaration [ExplicitMainPackage] // CHECK:STDERR: impl package Main; // --- fail_raw_main.carbon // `Main` isn't a keyword, so this fails the same way. -// CHECK:STDERR: fail_raw_main.carbon:[[@LINE+4]]:1: error: `Main//default` must omit `package` declaration [ExplicitMainPackage] -// CHECK:STDERR: package r#Main; -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_raw_main.carbon:[[@LINE+2]]:1-15: error: `Main//default` must omit `package` declaration [ExplicitMainPackage] // CHECK:STDERR: package r#Main; // --- fail_main_lib.carbon -// CHECK:STDERR: fail_main_lib.carbon:[[@LINE+4]]:1: error: use `library` declaration in `Main` package libraries [ExplicitMainLibrary] -// CHECK:STDERR: package Main library "main_lib"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_main_lib.carbon:[[@LINE+2]]:1-32: error: use `library` declaration in `Main` package libraries [ExplicitMainLibrary] // CHECK:STDERR: package Main library "[[@TEST_NAME]]"; @@ -57,17 +49,13 @@ package cpp; // --- fail_cpp.carbon -// CHECK:STDERR: fail_cpp.carbon:[[@LINE+4]]:1: error: `Cpp` cannot be used by a `package` declaration [CppPackageDeclaration] -// CHECK:STDERR: package Cpp; -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_cpp.carbon:[[@LINE+2]]:1-12: error: `Cpp` cannot be used by a `package` declaration [CppPackageDeclaration] // CHECK:STDERR: package Cpp; // --- fail_cpp.impl.carbon -// CHECK:STDERR: fail_cpp.impl.carbon:[[@LINE+4]]:1: error: `Cpp` cannot be used by a `package` declaration [CppPackageDeclaration] -// CHECK:STDERR: impl package Cpp; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_cpp.impl.carbon:[[@LINE+2]]:1-17: error: `Cpp` cannot be used by a `package` declaration [CppPackageDeclaration] // CHECK:STDERR: impl package Cpp; @@ -77,9 +65,7 @@ package r#Cpp; // --- fail_cpp_lib.carbon -// CHECK:STDERR: fail_cpp_lib.carbon:[[@LINE+4]]:1: error: `Cpp` cannot be used by a `package` declaration [CppPackageDeclaration] -// CHECK:STDERR: package Cpp library "cpp_lib"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_cpp_lib.carbon:[[@LINE+2]]:1-30: error: `Cpp` cannot be used by a `package` declaration [CppPackageDeclaration] // CHECK:STDERR: package Cpp library "[[@TEST_NAME]]"; diff --git a/toolchain/check/testdata/patterns/expression.carbon b/toolchain/check/testdata/patterns/expression.carbon index 20aa659ba764..48ebedbbea8b 100644 --- a/toolchain/check/testdata/patterns/expression.carbon +++ b/toolchain/check/testdata/patterns/expression.carbon @@ -16,9 +16,7 @@ library "[[@TEST_NAME]]"; // TODO: We should reject this for using a refutable pattern in an irrefutable pattern context. let a: () = (); -// CHECK:STDERR: fail_todo_let.carbon:[[@LINE+4]]:5: error: semantics TODO: `expression pattern` [SemanticsTodo] -// CHECK:STDERR: let a = (); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_todo_let.carbon:[[@LINE+2]]:5: error: semantics TODO: `expression pattern` [SemanticsTodo] // CHECK:STDERR: let a = (); @@ -28,9 +26,7 @@ library "[[@TEST_NAME]]"; // TODO: We should reject this for using a refutable pattern in an irrefutable pattern context. let a: () = (); -// CHECK:STDERR: fail_todo_in_tuple.carbon:[[@LINE+4]]:13: error: semantics TODO: `expression pattern` [SemanticsTodo] -// CHECK:STDERR: let (b: (), a, c: ()) = ((), (), ()); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_todo_in_tuple.carbon:[[@LINE+2]]:13: error: semantics TODO: `expression pattern` [SemanticsTodo] // CHECK:STDERR: let (b: (), a, c: ()) = ((), (), ()); @@ -40,9 +36,7 @@ library "[[@TEST_NAME]]"; // TODO: We should reject this for using a refutable pattern in an irrefutable pattern context. let a: () = (); -// CHECK:STDERR: fail_todo_in_function_param.carbon:[[@LINE+4]]:6: error: semantics TODO: `expression pattern` [SemanticsTodo] -// CHECK:STDERR: fn F(a) {} -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_todo_in_function_param.carbon:[[@LINE+2]]:6: error: semantics TODO: `expression pattern` [SemanticsTodo] // CHECK:STDERR: fn F(a) {} @@ -55,9 +49,7 @@ let a: () = (); // pattern contexts. // Note that this is a parenthesized zero-tuple expression pattern, not a // one-tuple pattern containing a zero-tuple. -// CHECK:STDERR: fail_todo_parens.carbon:[[@LINE+4]]:6: error: semantics TODO: `expression pattern` [SemanticsTodo] -// CHECK:STDERR: let (a) = (); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_todo_parens.carbon:[[@LINE+2]]:6: error: semantics TODO: `expression pattern` [SemanticsTodo] // CHECK:STDERR: let (a) = (); @@ -69,13 +61,9 @@ fn F() { // TODO: Replace this with a valid expression pattern once we support refutable // pattern contexts. //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_control_flow.carbon:[[@LINE+8]]:8: error: semantics TODO: `expression pattern` [SemanticsTodo] - // CHECK:STDERR: let (if true then true else false, true and true) = (true, true); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_control_flow.carbon:[[@LINE+4]]:8-35: error: semantics TODO: `expression pattern` [SemanticsTodo] // CHECK:STDERR: - // CHECK:STDERR: fail_todo_control_flow.carbon:[[@LINE+4]]:38: error: semantics TODO: `expression pattern` [SemanticsTodo] - // CHECK:STDERR: let (if true then true else false, true and true) = (true, true); - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_control_flow.carbon:[[@LINE+2]]:38-50: error: semantics TODO: `expression pattern` [SemanticsTodo] // CHECK:STDERR: let (if true then true else false, true and true) = (true, true); //@dump-sem-ir-end @@ -90,46 +78,46 @@ fn F() { // CHECK:STDOUT: %pattern_type.831: type = pattern_type bool [concrete] // CHECK:STDOUT: %tuple.type: type = tuple_type (bool, bool) [concrete] // CHECK:STDOUT: %pattern_type.860: type = pattern_type %tuple.type [concrete] -// CHECK:STDOUT: %.2f0: %pattern_type.860 = tuple_pattern (@F.%expr_patt.loc16_26, @F.%expr_patt.loc16_43) [concrete] +// CHECK:STDOUT: %.2f0: %pattern_type.860 = tuple_pattern (@F.%expr_patt.loc12_26, @F.%expr_patt.loc12_43) [concrete] // CHECK:STDOUT: %tuple: %tuple.type = tuple_value (%true, %true) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %true.loc16_56: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: %true.loc16_62: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: %.loc16_66: %tuple.type = tuple_literal (%true.loc16_56, %true.loc16_62) [concrete = constants.%tuple] +// CHECK:STDOUT: %true.loc12_56: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: %true.loc12_62: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: %.loc12_66: %tuple.type = tuple_literal (%true.loc12_56, %true.loc12_62) [concrete = constants.%tuple] // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %expr_patt.loc16_26: %pattern_type.831 = expr_pattern %.loc16_8 in [concrete] { -// CHECK:STDOUT: %true.loc16_11: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: if %true.loc16_11 br !if.expr.then else br !if.expr.else +// CHECK:STDOUT: %expr_patt.loc12_26: %pattern_type.831 = expr_pattern %.loc12_8 in [concrete] { +// CHECK:STDOUT: %true.loc12_11: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: if %true.loc12_11 br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: -// CHECK:STDOUT: %true.loc16_21: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: br !if.expr.result(%true.loc16_21) +// CHECK:STDOUT: %true.loc12_21: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: br !if.expr.result(%true.loc12_21) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else: -// CHECK:STDOUT: %false.loc16_31: bool = bool_literal false [concrete = constants.%false] -// CHECK:STDOUT: br !if.expr.result(%false.loc16_31) +// CHECK:STDOUT: %false.loc12_31: bool = bool_literal false [concrete = constants.%false] +// CHECK:STDOUT: br !if.expr.result(%false.loc12_31) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result: -// CHECK:STDOUT: %.loc16_8: bool = block_arg !if.expr.result [concrete = constants.%true] +// CHECK:STDOUT: %.loc12_8: bool = block_arg !if.expr.result [concrete = constants.%true] // CHECK:STDOUT: // CHECK:STDOUT: } -// CHECK:STDOUT: %expr_patt.loc16_43: %pattern_type.831 = expr_pattern %.loc16_43 in [concrete] { -// CHECK:STDOUT: %true.loc16_38: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: %false.loc16_43: bool = bool_literal false [concrete = constants.%false] -// CHECK:STDOUT: if %true.loc16_38 br !and.rhs else br !.loc16(%false.loc16_43) +// CHECK:STDOUT: %expr_patt.loc12_43: %pattern_type.831 = expr_pattern %.loc12_43 in [concrete] { +// CHECK:STDOUT: %true.loc12_38: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: %false.loc12_43: bool = bool_literal false [concrete = constants.%false] +// CHECK:STDOUT: if %true.loc12_38 br !and.rhs else br !.loc12(%false.loc12_43) // CHECK:STDOUT: // CHECK:STDOUT: !and.rhs: -// CHECK:STDOUT: %true.loc16_47: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: br !.loc16(%true.loc16_47) +// CHECK:STDOUT: %true.loc12_47: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: br !.loc12(%true.loc12_47) // CHECK:STDOUT: -// CHECK:STDOUT: !.loc16: -// CHECK:STDOUT: %.loc16_43: bool = block_arg !.loc16 [concrete = constants.%true] +// CHECK:STDOUT: !.loc12: +// CHECK:STDOUT: %.loc12_43: bool = block_arg !.loc12 [concrete = constants.%true] // CHECK:STDOUT: // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc16_51: %pattern_type.860 = tuple_pattern (%expr_patt.loc16_26, %expr_patt.loc16_43) [concrete = constants.%.2f0] +// CHECK:STDOUT: %.loc12_51: %pattern_type.860 = tuple_pattern (%expr_patt.loc12_26, %expr_patt.loc12_43) [concrete = constants.%.2f0] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/patterns/underscore.carbon b/toolchain/check/testdata/patterns/underscore.carbon index 532ff9d16919..8c574afca6d2 100644 --- a/toolchain/check/testdata/patterns/underscore.carbon +++ b/toolchain/check/testdata/patterns/underscore.carbon @@ -56,12 +56,8 @@ library "[[@TEST_NAME]]"; fn F(generic _: type); fn G() { - // CHECK:STDERR: fail_function_generic_undefined.carbon:[[@LINE+7]]:3: error: use of undefined generic function [MissingGenericFunctionDefinition] - // CHECK:STDERR: F({}); - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_function_generic_undefined.carbon:[[@LINE-6]]:1: note: generic function declared here [MissingGenericFunctionDefinitionHere] - // CHECK:STDERR: fn F(generic _: type); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_function_generic_undefined.carbon:[[@LINE+3]]:3: error: use of undefined generic function [MissingGenericFunctionDefinition] + // CHECK:STDERR: fail_function_generic_undefined.carbon:[[@LINE-4]]:1-22: note: generic function declared here [MissingGenericFunctionDefinitionHere] // CHECK:STDERR: F({}); } @@ -79,9 +75,7 @@ fn G[_: type]() {} library "[[@TEST_NAME]]"; class C { - // CHECK:STDERR: fail_class.carbon:[[@LINE+4]]:7: error: expected identifier in field declaration [FieldNamedUnderscore] - // CHECK:STDERR: var _: (); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_class.carbon:[[@LINE+2]]:7-11: error: expected identifier in field declaration [FieldNamedUnderscore] // CHECK:STDERR: var _: (); } @@ -90,17 +84,11 @@ class C { fn F() -> {} { let _: {} = {}; - // CHECK:STDERR: fail_use.carbon:[[@LINE+12]]:10: error: expected expression [ExpectedExpr] - // CHECK:STDERR: return _; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_use.carbon:[[@LINE+6]]:10: error: expected expression [ExpectedExpr] // CHECK:STDERR: - // CHECK:STDERR: fail_use.carbon:[[@LINE+8]]:10: error: `return` statements must end with a `;` [ExpectedStatementSemi] - // CHECK:STDERR: return _; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_use.carbon:[[@LINE+4]]:10: error: `return` statements must end with a `;` [ExpectedStatementSemi] // CHECK:STDERR: - // CHECK:STDERR: fail_use.carbon:[[@LINE+4]]:10: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] - // CHECK:STDERR: return _; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_use.carbon:[[@LINE+2]]:10: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: return _; } @@ -447,8 +435,8 @@ fn F() -> {} { // CHECK:STDOUT: fn @G() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] -// CHECK:STDOUT: %.loc14_6: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc14_7: type = converted %.loc14_6, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc10_6: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc10_7: type = converted %.loc10_6, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %F.specific_fn: = specific_function %F.ref, @F(constants.%empty_struct_type) [concrete = constants.%F.specific_fn] // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn() // CHECK:STDOUT: return @@ -570,9 +558,9 @@ fn F() -> {} { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %field_decl: %C.elem = field_decl _, element0, %.loc9_11.2 in [concrete] { -// CHECK:STDOUT: %.loc9_11.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc9_11.2: type = converted %.loc9_11.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %field_decl: %C.elem = field_decl _, element0, %.loc7_11.2 in [concrete] { +// CHECK:STDOUT: %.loc7_11.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc7_11.2: type = converted %.loc7_11.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%struct_type._ [concrete = constants.%complete_type] // CHECK:STDOUT: complete_type_witness = %complete_type diff --git a/toolchain/check/testdata/patterns/unused.carbon b/toolchain/check/testdata/patterns/unused.carbon index 9b1ca5bf2524..d4d5ff551130 100644 --- a/toolchain/check/testdata/patterns/unused.carbon +++ b/toolchain/check/testdata/patterns/unused.carbon @@ -58,9 +58,7 @@ fn RefParamUnused(unused ref y: i32) { library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: local_let_named_not_used.carbon:[[@LINE+4]]:7: warning: binding `x` unused [UnusedBinding] - // CHECK:STDERR: let x: i32 = 0; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: local_let_named_not_used.carbon:[[@LINE+2]]:7-12: warning: binding `x` unused [UnusedBinding] // CHECK:STDERR: let x: i32 = 0; } @@ -69,9 +67,7 @@ fn F() { library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: local_var_named_not_used.carbon:[[@LINE+4]]:7: warning: binding `a` unused [UnusedBinding] - // CHECK:STDERR: var a: i32 = 0; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: local_var_named_not_used.carbon:[[@LINE+2]]:7-12: warning: binding `a` unused [UnusedBinding] // CHECK:STDERR: var a: i32 = 0; } @@ -82,9 +78,7 @@ library "[[@TEST_NAME]]"; fn F() { var x: i32 = 0; if (true) { - // CHECK:STDERR: local_var_shadowed_not_used.carbon:[[@LINE+4]]:9: warning: binding `x` unused [UnusedBinding] - // CHECK:STDERR: var x: i32 = 1; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: local_var_shadowed_not_used.carbon:[[@LINE+2]]:9-14: warning: binding `x` unused [UnusedBinding] // CHECK:STDERR: var x: i32 = 1; } @@ -94,9 +88,7 @@ fn F() { // --- param_let_named_not_used.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: param_let_named_not_used.carbon:[[@LINE+4]]:6: warning: binding `p` unused [UnusedBinding] -// CHECK:STDERR: fn F(p: i32) { -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: param_let_named_not_used.carbon:[[@LINE+2]]:6-11: warning: binding `p` unused [UnusedBinding] // CHECK:STDERR: fn F(p: i32) { } @@ -104,9 +96,7 @@ fn F(p: i32) { // --- param_ref_named_not_used.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: param_ref_named_not_used.carbon:[[@LINE+4]]:6: warning: binding `y` unused [UnusedBinding] -// CHECK:STDERR: fn F(ref y: i32) { -// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: param_ref_named_not_used.carbon:[[@LINE+2]]:6-15: warning: binding `y` unused [UnusedBinding] // CHECK:STDERR: fn F(ref y: i32) { } @@ -114,13 +104,9 @@ fn F(ref y: i32) { // --- fail_read_from_param_unused_ref.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_read_from_param_unused_ref.carbon:[[@LINE+3]]:26: error: variable `y` marked `unused` but used [UnusedButUsed] -// CHECK:STDERR: fn RefParamUnused(unused ref y: i32) { -// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: fail_read_from_param_unused_ref.carbon:[[@LINE+1]]:26-35: error: variable `y` marked `unused` but used [UnusedButUsed] fn RefParamUnused(unused ref y: i32) { - // CHECK:STDERR: fail_read_from_param_unused_ref.carbon:[[@LINE+4]]:16: note: usage here [UnusedButUsedHere] - // CHECK:STDERR: var _: i32 = y; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_read_from_param_unused_ref.carbon:[[@LINE+2]]:16: note: usage here [UnusedButUsedHere] // CHECK:STDERR: var _: i32 = y; } @@ -129,12 +115,8 @@ fn RefParamUnused(unused ref y: i32) { library "[[@TEST_NAME]]"; fn F() -> i32 { - // CHECK:STDERR: fail_unused_returned_var.carbon:[[@LINE+7]]:23: error: variable `x` marked `unused` but used [UnusedButUsed] - // CHECK:STDERR: returned var unused x: i32 = 0; - // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_unused_returned_var.carbon:[[@LINE+4]]:23: note: usage here [UnusedButUsedHere] - // CHECK:STDERR: returned var unused x: i32 = 0; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_unused_returned_var.carbon:[[@LINE+3]]:23-28: error: variable `x` marked `unused` but used [UnusedButUsed] + // CHECK:STDERR: fail_unused_returned_var.carbon:[[@LINE+2]]:23-28: note: usage here [UnusedButUsedHere] // CHECK:STDERR: returned var unused x: i32 = 0; return var; @@ -145,13 +127,9 @@ library "[[@TEST_NAME]]"; fn F(x: i32) { var _: i32 = x; - // CHECK:STDERR: fail_read_from_unused_local_var.carbon:[[@LINE+3]]:14: error: variable `y` marked `unused` but used [UnusedButUsed] - // CHECK:STDERR: var unused y: i32 = x; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_read_from_unused_local_var.carbon:[[@LINE+1]]:14-19: error: variable `y` marked `unused` but used [UnusedButUsed] var unused y: i32 = x; - // CHECK:STDERR: fail_read_from_unused_local_var.carbon:[[@LINE+4]]:23: note: usage here [UnusedButUsedHere] - // CHECK:STDERR: var unused z: i32 = y; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_read_from_unused_local_var.carbon:[[@LINE+2]]:23: note: usage here [UnusedButUsedHere] // CHECK:STDERR: var unused z: i32 = y; } @@ -161,9 +139,7 @@ library "[[@TEST_NAME]]"; fn F() -> i32 { var x: i32 = 3; - // CHECK:STDERR: fail_todo_match.carbon:[[@LINE+4]]:3: error: semantics TODO: `HandleMatchIntroducer` [SemanticsTodo] - // CHECK:STDERR: match (f(x)) { - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_todo_match.carbon:[[@LINE+2]]:3-7: error: semantics TODO: `HandleMatchIntroducer` [SemanticsTodo] // CHECK:STDERR: match (f(x)) { case unused var (a: i32, b: i32) => { return 0; } @@ -178,9 +154,7 @@ fn F() -> i32 { // --- fail_unused_decl.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unused_decl.carbon:[[@LINE+4]]:13: error: `unused` modifier without a definition [UnusedModifierWithoutDefinition] -// CHECK:STDERR: fn F(unused x: i32); -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_unused_decl.carbon:[[@LINE+2]]:13-18: error: `unused` modifier without a definition [UnusedModifierWithoutDefinition] // CHECK:STDERR: fn F(unused x: i32); @@ -188,9 +162,7 @@ fn F(unused x: i32); library "[[@TEST_NAME]]"; class C { - // CHECK:STDERR: fail_unused_self_decl.carbon:[[@LINE+4]]:15: error: `unused` modifier without a definition [UnusedModifierWithoutDefinition] - // CHECK:STDERR: fn F(unused self); - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_unused_self_decl.carbon:[[@LINE+2]]:15-18: error: `unused` modifier without a definition [UnusedModifierWithoutDefinition] // CHECK:STDERR: fn F(unused self); } @@ -201,20 +173,14 @@ library "[[@TEST_NAME]]"; // The `unused` modifier is rejected without a definition for any implicit // parameter, both a compile-time binding and `self`. -// CHECK:STDERR: fail_unused_implicit_param_decl.carbon:[[@LINE+4]]:13: error: `unused` modifier without a definition [UnusedModifierWithoutDefinition] -// CHECK:STDERR: fn F[unused T: type](); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_unused_implicit_param_decl.carbon:[[@LINE+2]]:13-19: error: `unused` modifier without a definition [UnusedModifierWithoutDefinition] // CHECK:STDERR: fn F[unused T: type](); class C { - // CHECK:STDERR: fail_unused_implicit_param_decl.carbon:[[@LINE+8]]:15: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] - // CHECK:STDERR: fn G[unused self: Self](); - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_unused_implicit_param_decl.carbon:[[@LINE+4]]:15-24: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] // CHECK:STDERR: - // CHECK:STDERR: fail_unused_implicit_param_decl.carbon:[[@LINE+4]]:15: error: `unused` modifier without a definition [UnusedModifierWithoutDefinition] - // CHECK:STDERR: fn G[unused self: Self](); - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_unused_implicit_param_decl.carbon:[[@LINE+2]]:15-24: error: `unused` modifier without a definition [UnusedModifierWithoutDefinition] // CHECK:STDERR: fn G[unused self: Self](); } @@ -223,13 +189,9 @@ class C { library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: fail_multiple_uses_of_unused.carbon:[[@LINE+3]]:14: error: variable `x` marked `unused` but used [UnusedButUsed] - // CHECK:STDERR: var unused x: i32 = 0; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_multiple_uses_of_unused.carbon:[[@LINE+1]]:14-19: error: variable `x` marked `unused` but used [UnusedButUsed] var unused x: i32 = 0; - // CHECK:STDERR: fail_multiple_uses_of_unused.carbon:[[@LINE+4]]:3: note: usage here [UnusedButUsedHere] - // CHECK:STDERR: x; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_multiple_uses_of_unused.carbon:[[@LINE+2]]:3: note: usage here [UnusedButUsedHere] // CHECK:STDERR: x; x; @@ -239,12 +201,8 @@ fn F() { library "[[@TEST_NAME]]"; fn F(x: i32); -// CHECK:STDERR: fail_unused_does_not_affect_redeclaration.carbon:[[@LINE+7]]:13: error: redeclaration differs at parameter 1 [RedeclParamDiffers] -// CHECK:STDERR: fn F(unused y: i32) {} -// CHECK:STDERR: ^~~~~~ -// CHECK:STDERR: fail_unused_does_not_affect_redeclaration.carbon:[[@LINE-4]]:6: note: previous declaration's corresponding parameter here [RedeclParamPrevious] -// CHECK:STDERR: fn F(x: i32); -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_unused_does_not_affect_redeclaration.carbon:[[@LINE+3]]:13-18: error: redeclaration differs at parameter 1 [RedeclParamDiffers] +// CHECK:STDERR: fail_unused_does_not_affect_redeclaration.carbon:[[@LINE-2]]:6-11: note: previous declaration's corresponding parameter here [RedeclParamPrevious] // CHECK:STDERR: fn F(unused y: i32) {} @@ -274,17 +232,13 @@ library "[[@TEST_NAME]]"; fn F(generic T: type); -// CHECK:STDERR: fail_todo_unused_generic.carbon:[[@LINE+4]]:21: error: semantics TODO: `generic redeclaration differs from previous declaration` [SemanticsTodo] -// CHECK:STDERR: fn F(unused generic T: type) {} -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_todo_unused_generic.carbon:[[@LINE+2]]:21-27: error: semantics TODO: `generic redeclaration differs from previous declaration` [SemanticsTodo] // CHECK:STDERR: fn F(unused generic T: type) {} class C(T: type); -// CHECK:STDERR: fail_todo_unused_generic.carbon:[[@LINE+4]]:16: error: semantics TODO: `generic redeclaration differs from previous declaration` [SemanticsTodo] -// CHECK:STDERR: class C(unused T: type) {} -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_todo_unused_generic.carbon:[[@LINE+2]]:16-22: error: semantics TODO: `generic redeclaration differs from previous declaration` [SemanticsTodo] // CHECK:STDERR: class C(unused T: type) {} @@ -292,22 +246,14 @@ class C(unused T: type) {} library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: fail_unused_let_multiple_uses.carbon:[[@LINE+3]]:14: error: variable `x` marked `unused` but used [UnusedButUsed] - // CHECK:STDERR: let unused x: i32 = 0; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_unused_let_multiple_uses.carbon:[[@LINE+1]]:14-19: error: variable `x` marked `unused` but used [UnusedButUsed] let unused x: i32 = 0; - // CHECK:STDERR: fail_unused_let_multiple_uses.carbon:[[@LINE+8]]:16: note: usage here [UnusedButUsedHere] - // CHECK:STDERR: var y: i32 = x; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_unused_let_multiple_uses.carbon:[[@LINE+4]]:16: note: usage here [UnusedButUsedHere] // CHECK:STDERR: - // CHECK:STDERR: fail_unused_let_multiple_uses.carbon:[[@LINE+4]]:7: warning: binding `y` unused [UnusedBinding] - // CHECK:STDERR: var y: i32 = x; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_unused_let_multiple_uses.carbon:[[@LINE+2]]:7-12: warning: binding `y` unused [UnusedBinding] // CHECK:STDERR: var y: i32 = x; - // CHECK:STDERR: fail_unused_let_multiple_uses.carbon:[[@LINE+4]]:7: warning: binding `z` unused [UnusedBinding] - // CHECK:STDERR: var z: i32 = x; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_unused_let_multiple_uses.carbon:[[@LINE+2]]:7-12: warning: binding `z` unused [UnusedBinding] // CHECK:STDERR: var z: i32 = x; } @@ -316,14 +262,10 @@ fn F() { library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: multiple_unused_bindings.carbon:[[@LINE+4]]:7: warning: binding `x` unused [UnusedBinding] - // CHECK:STDERR: var x: i32 = 0; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: multiple_unused_bindings.carbon:[[@LINE+2]]:7-12: warning: binding `x` unused [UnusedBinding] // CHECK:STDERR: var x: i32 = 0; - // CHECK:STDERR: multiple_unused_bindings.carbon:[[@LINE+4]]:7: warning: binding `y` unused [UnusedBinding] - // CHECK:STDERR: var y: i32 = 0; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: multiple_unused_bindings.carbon:[[@LINE+2]]:7-12: warning: binding `y` unused [UnusedBinding] // CHECK:STDERR: var y: i32 = 0; } @@ -332,22 +274,14 @@ fn F() { library "[[@TEST_NAME]]"; fn F() -> i32 { - // CHECK:STDERR: fail_unused_tuple.carbon:[[@LINE+3]]:14: error: variable `a` marked `unused` but used [UnusedButUsed] - // CHECK:STDERR: let unused (a: i32, - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_unused_tuple.carbon:[[@LINE+1]]:14-19: error: variable `a` marked `unused` but used [UnusedButUsed] let unused (a: i32, b: i32) = (1, 2); - // CHECK:STDERR: fail_unused_tuple.carbon:[[@LINE+7]]:15: note: usage here [UnusedButUsedHere] - // CHECK:STDERR: let i: i32 = a; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_unused_tuple.carbon:[[@LINE+3]]:15: note: usage here [UnusedButUsedHere] // CHECK:STDERR: - // CHECK:STDERR: fail_unused_tuple.carbon:[[@LINE-5]]:14: error: variable `b` marked `unused` but used [UnusedButUsed] - // CHECK:STDERR: b: i32) = (1, 2); - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_unused_tuple.carbon:[[@LINE-3]]:14-19: error: variable `b` marked `unused` but used [UnusedButUsed] let i: i32 = a; - // CHECK:STDERR: fail_unused_tuple.carbon:[[@LINE+4]]:22: note: usage here [UnusedButUsedHere] - // CHECK:STDERR: let unused j: i32 = b; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_unused_tuple.carbon:[[@LINE+2]]:22: note: usage here [UnusedButUsedHere] // CHECK:STDERR: let unused j: i32 = b; return i; diff --git a/toolchain/check/testdata/patterns/unused_underscore.carbon b/toolchain/check/testdata/patterns/unused_underscore.carbon index 7ec6394973dd..50094d2712a0 100644 --- a/toolchain/check/testdata/patterns/unused_underscore.carbon +++ b/toolchain/check/testdata/patterns/unused_underscore.carbon @@ -11,15 +11,11 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/patterns/unused_underscore.carbon fn F() { - // CHECK:STDERR: unused_underscore.carbon:[[@LINE+4]]:7: warning: `unused` modifier on pattern without bindings [UnusedPatternNoBindings] - // CHECK:STDERR: var unused _: i32 = 1; - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: unused_underscore.carbon:[[@LINE+2]]:7-19: warning: `unused` modifier on pattern without bindings [UnusedPatternNoBindings] // CHECK:STDERR: var unused _: i32 = 1; - // CHECK:STDERR: unused_underscore.carbon:[[@LINE+4]]:7: warning: `unused` modifier on pattern without bindings [UnusedPatternNoBindings] - // CHECK:STDERR: let unused (_: i32, _: i32) = (1, 1); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: unused_underscore.carbon:[[@LINE+2]]:7-29: warning: `unused` modifier on pattern without bindings [UnusedPatternNoBindings] // CHECK:STDERR: let unused (_: i32, _: i32) = (1, 1); } diff --git a/toolchain/check/testdata/pointer/convert_qualifiers.carbon b/toolchain/check/testdata/pointer/convert_qualifiers.carbon index 7ec928d45657..382283b2df3c 100644 --- a/toolchain/check/testdata/pointer/convert_qualifiers.carbon +++ b/toolchain/check/testdata/pointer/convert_qualifiers.carbon @@ -47,15 +47,9 @@ class X {} 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*)` [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] -// CHECK:STDERR: fn TakeNonConst(p: X*); -// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: fail_removed_qualifiers.carbon:[[@LINE+4]]:38: error: cannot implicitly convert expression of type `const X*` to `X*` [ConversionFailure] +// CHECK:STDERR: fail_removed_qualifiers.carbon:[[@LINE+3]]:38: note: type `const X*` does not implement interface `Core.ImplicitAs(X*)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: fail_removed_qualifiers.carbon:[[@LINE-4]]:17-21: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: fn Const(p: const X*) { TakeNonConst(p); } @@ -71,15 +65,9 @@ fn TakeConstConst(p: const (const X*)*); fn NonConstNonConst(p: X**) { //@dump-sem-ir-begin - // 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*)*)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: TakeConstConst(p); - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_todo_nested_qualifiers.carbon:[[@LINE-12]]:19: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn TakeConstConst(p: const (const X*)*); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_nested_qualifiers.carbon:[[@LINE+4]]:18: error: cannot implicitly convert expression of type `X**` to `const (const X*)*` [ConversionFailure] + // CHECK:STDERR: fail_todo_nested_qualifiers.carbon:[[@LINE+3]]:18: note: type `X**` does not implement interface `Core.ImplicitAs(const (const X*)*)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: fail_todo_nested_qualifiers.carbon:[[@LINE-8]]:19-38: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: TakeConstConst(p); //@dump-sem-ir-end @@ -87,15 +75,9 @@ fn NonConstNonConst(p: X**) { fn ConstNonConst(p: const (X*)*) { //@dump-sem-ir-begin - // 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*)*)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: TakeConstConst(p); - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_todo_nested_qualifiers.carbon:[[@LINE-28]]:19: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn TakeConstConst(p: const (const X*)*); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_nested_qualifiers.carbon:[[@LINE+4]]:18: error: cannot implicitly convert expression of type `const (X*)*` to `const (const X*)*` [ConversionFailure] + // CHECK:STDERR: fail_todo_nested_qualifiers.carbon:[[@LINE+3]]:18: note: type `const (X*)*` does not implement interface `Core.ImplicitAs(const (const X*)*)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: fail_todo_nested_qualifiers.carbon:[[@LINE-18]]:19-38: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: TakeConstConst(p); //@dump-sem-ir-end @@ -109,15 +91,9 @@ class X {} 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**)` [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] -// CHECK:STDERR: fn TakeNonConstConst(p: (const X*)*); -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_nested_added_qualifiers.carbon:[[@LINE+4]]:49: error: cannot implicitly convert expression of type `X**` to `const X**` [ConversionFailure] +// CHECK:STDERR: fail_nested_added_qualifiers.carbon:[[@LINE+3]]:49: note: type `X**` does not implement interface `Core.ImplicitAs(const X**)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: fail_nested_added_qualifiers.carbon:[[@LINE-4]]:22-35: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: fn NonConstNonConst(p: X**) { TakeNonConstConst(p); } @@ -194,7 +170,7 @@ fn NonConstNonConst(p: X**) { TakeNonConstConst(p); } // CHECK:STDOUT: !entry: // CHECK:STDOUT: %TakeConstConst.ref: %TakeConstConst.type = name_ref TakeConstConst, file.%TakeConstConst.decl [concrete = constants.%TakeConstConst] // CHECK:STDOUT: %p.ref: %ptr.9ae = name_ref p, %p -// CHECK:STDOUT: %.loc22: %ptr.b53 = converted %p.ref, [concrete = ] +// CHECK:STDOUT: %.loc16: %ptr.b53 = converted %p.ref, [concrete = ] // CHECK:STDOUT: %TakeConstConst.call: init %empty_tuple.type = call %TakeConstConst.ref() // CHECK:STDOUT: // CHECK:STDOUT: } @@ -203,7 +179,7 @@ fn NonConstNonConst(p: X**) { TakeNonConstConst(p); } // CHECK:STDOUT: !entry: // CHECK:STDOUT: %TakeConstConst.ref: %TakeConstConst.type = name_ref TakeConstConst, file.%TakeConstConst.decl [concrete = constants.%TakeConstConst] // CHECK:STDOUT: %p.ref: %ptr.060 = name_ref p, %p -// CHECK:STDOUT: %.loc38: %ptr.b53 = converted %p.ref, [concrete = ] +// CHECK:STDOUT: %.loc26: %ptr.b53 = converted %p.ref, [concrete = ] // CHECK:STDOUT: %TakeConstConst.call: init %empty_tuple.type = call %TakeConstConst.ref() // CHECK:STDOUT: // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/pointer/fail_address_of_error.carbon b/toolchain/check/testdata/pointer/fail_address_of_error.carbon index 7fe26a95b68f..ef1677c972c0 100644 --- a/toolchain/check/testdata/pointer/fail_address_of_error.carbon +++ b/toolchain/check/testdata/pointer/fail_address_of_error.carbon @@ -13,18 +13,12 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/fail_address_of_error.carbon fn Test() { - // CHECK:STDERR: fail_address_of_error.carbon:[[@LINE+4]]:4: error: name `undeclared` not found [NameNotFound] - // CHECK:STDERR: &undeclared; - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_address_of_error.carbon:[[@LINE+2]]:4-13: error: name `undeclared` not found [NameNotFound] // CHECK:STDERR: &undeclared; - // CHECK:STDERR: fail_address_of_error.carbon:[[@LINE+8]]:6: error: name `undeclared` not found [NameNotFound] - // CHECK:STDERR: &(&undeclared); - // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: fail_address_of_error.carbon:[[@LINE+4]]:6-15: error: name `undeclared` not found [NameNotFound] // CHECK:STDERR: - // CHECK:STDERR: fail_address_of_error.carbon:[[@LINE+4]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] - // CHECK:STDERR: &(&undeclared); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_address_of_error.carbon:[[@LINE+2]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] // CHECK:STDERR: &(&undeclared); } @@ -56,11 +50,11 @@ fn Test() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Test() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %undeclared.ref.loc20: = name_ref undeclared, [concrete = ] -// CHECK:STDOUT: %addr.loc20: = addr_of %undeclared.ref.loc20 [concrete = ] -// CHECK:STDOUT: %undeclared.ref.loc29: = name_ref undeclared, [concrete = ] -// CHECK:STDOUT: %addr.loc29_5: = addr_of %undeclared.ref.loc29 [concrete = ] -// CHECK:STDOUT: %addr.loc29_3: = addr_of [concrete = ] +// CHECK:STDOUT: %undeclared.ref.loc18: = name_ref undeclared, [concrete = ] +// CHECK:STDOUT: %addr.loc18: = addr_of %undeclared.ref.loc18 [concrete = ] +// CHECK:STDOUT: %undeclared.ref.loc23: = name_ref undeclared, [concrete = ] +// CHECK:STDOUT: %addr.loc23_5: = addr_of %undeclared.ref.loc23 [concrete = ] +// CHECK:STDOUT: %addr.loc23_3: = addr_of [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/pointer/fail_address_of_value.carbon b/toolchain/check/testdata/pointer/fail_address_of_value.carbon index 8dcbbed88c2c..efe3d9fffe17 100644 --- a/toolchain/check/testdata/pointer/fail_address_of_value.carbon +++ b/toolchain/check/testdata/pointer/fail_address_of_value.carbon @@ -15,89 +15,61 @@ fn G() -> i32; fn H() -> {.a: i32}; fn AddressOfLiteral() { - // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] - // CHECK:STDERR: &0; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+2]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] // CHECK:STDERR: &0; - // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] - // CHECK:STDERR: &true; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+2]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] // CHECK:STDERR: &true; - // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] - // CHECK:STDERR: &1.0; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+2]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] // CHECK:STDERR: &1.0; - // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] - // CHECK:STDERR: &"Hello"; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+2]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] // CHECK:STDERR: &"Hello"; - // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] - // CHECK:STDERR: &(1, 2); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+2]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] // CHECK:STDERR: &(1, 2); - // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] - // CHECK:STDERR: &{.a = 5}; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+2]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] // CHECK:STDERR: &{.a = 5}; } fn AddressOfOperator() { - // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] - // CHECK:STDERR: &(true and false); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+2]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] // CHECK:STDERR: &(true and false); - // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] - // CHECK:STDERR: &H().a; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+2]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] // CHECK:STDERR: &H().a; - // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] - // CHECK:STDERR: &(not true); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+2]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] // CHECK:STDERR: &(not true); } fn AddressOfCall() { - // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] - // CHECK:STDERR: &G(); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+2]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] // CHECK:STDERR: &G(); } fn AddressOfType() { - // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] - // CHECK:STDERR: &i32; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+2]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] // CHECK:STDERR: &i32; - // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] - // CHECK:STDERR: &(const i32*); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+2]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] // CHECK:STDERR: &(const i32*); } fn AddressOfTupleElementValue() { - // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] - // CHECK:STDERR: &((1, 2).0); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+2]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] // CHECK:STDERR: &((1, 2).0); } fn AddressOfParam(param: i32) { - // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:33: error: cannot take the address of non-reference expression [AddrOfNonRef] - // CHECK:STDERR: var unused param_addr: i32* = ¶m; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+2]]:33: error: cannot take the address of non-reference expression [AddrOfNonRef] // CHECK:STDERR: var unused param_addr: i32* = ¶m; } diff --git a/toolchain/check/testdata/pointer/fail_deref_error.carbon b/toolchain/check/testdata/pointer/fail_deref_error.carbon index db8995385c79..7c1ce55f8047 100644 --- a/toolchain/check/testdata/pointer/fail_deref_error.carbon +++ b/toolchain/check/testdata/pointer/fail_deref_error.carbon @@ -12,14 +12,10 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/fail_deref_error.carbon -// CHECK:STDERR: fail_deref_error.carbon:[[@LINE+4]]:15: error: name `undeclared` not found [NameNotFound] -// CHECK:STDERR: let n: i32 = *undeclared; -// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: fail_deref_error.carbon:[[@LINE+2]]:15-24: error: name `undeclared` not found [NameNotFound] // CHECK:STDERR: let n: i32 = *undeclared; -// CHECK:STDERR: fail_deref_error.carbon:[[@LINE+4]]:15: error: name `undeclared` not found [NameNotFound] -// CHECK:STDERR: let n2: i32 = undeclared->foo; -// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: fail_deref_error.carbon:[[@LINE+2]]:15-24: error: name `undeclared` not found [NameNotFound] // CHECK:STDERR: let n2: i32 = undeclared->foo; @@ -53,12 +49,12 @@ let n2: i32 = undeclared->foo; // CHECK:STDOUT: .n2 = %n2 // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %i32.loc19: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc17: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %n: %i32 = wrapper_binding n, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %n.patt: %pattern_type.d94 = value_binding_pattern n [concrete = constants.%n.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %i32.loc24: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc20: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %n2: %i32 = wrapper_binding n2, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %n2.patt: %pattern_type.d94 = value_binding_pattern n2 [concrete = constants.%n2.patt] @@ -67,10 +63,10 @@ let n2: i32 = undeclared->foo; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %undeclared.ref.loc19: = name_ref undeclared, [concrete = ] -// CHECK:STDOUT: %.loc19: ref = deref [concrete = ] -// CHECK:STDOUT: %undeclared.ref.loc24: = name_ref undeclared, [concrete = ] -// CHECK:STDOUT: %.loc24: ref = deref [concrete = ] +// CHECK:STDOUT: %undeclared.ref.loc17: = name_ref undeclared, [concrete = ] +// CHECK:STDOUT: %.loc17: ref = deref [concrete = ] +// CHECK:STDOUT: %undeclared.ref.loc20: = name_ref undeclared, [concrete = ] +// CHECK:STDOUT: %.loc20: ref = deref [concrete = ] // CHECK:STDOUT: %foo.ref: = name_ref foo, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/pointer/fail_deref_function.carbon b/toolchain/check/testdata/pointer/fail_deref_function.carbon index 278a8639b11b..6c975dd282d0 100644 --- a/toolchain/check/testdata/pointer/fail_deref_function.carbon +++ b/toolchain/check/testdata/pointer/fail_deref_function.carbon @@ -13,14 +13,10 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/fail_deref_function.carbon fn A() { - // CHECK:STDERR: fail_deref_function.carbon:[[@LINE+4]]:3: error: cannot dereference operand of non-pointer type `` [DerefOfNonPointer] - // CHECK:STDERR: *A; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_deref_function.carbon:[[@LINE+2]]:3: error: cannot dereference operand of non-pointer type `` [DerefOfNonPointer] // CHECK:STDERR: *A; - // CHECK:STDERR: fail_deref_function.carbon:[[@LINE+4]]:4: error: cannot apply `->` operator to non-pointer type `` [ArrowOperatorOfNonPointer] - // CHECK:STDERR: A->foo; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_deref_function.carbon:[[@LINE+2]]:4-5: error: cannot apply `->` operator to non-pointer type `` [ArrowOperatorOfNonPointer] // CHECK:STDERR: A->foo; } @@ -51,10 +47,10 @@ fn A() { // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref.loc20: %A.type = name_ref A, file.%A.decl [concrete = constants.%A] -// CHECK:STDOUT: %.loc20: ref = deref %A.ref.loc20 [concrete = ] -// CHECK:STDOUT: %A.ref.loc25: %A.type = name_ref A, file.%A.decl [concrete = constants.%A] -// CHECK:STDOUT: %.loc25: ref = deref %A.ref.loc25 [concrete = ] +// CHECK:STDOUT: %A.ref.loc18: %A.type = name_ref A, file.%A.decl [concrete = constants.%A] +// CHECK:STDOUT: %.loc18: ref = deref %A.ref.loc18 [concrete = ] +// CHECK:STDOUT: %A.ref.loc21: %A.type = name_ref A, file.%A.decl [concrete = constants.%A] +// CHECK:STDOUT: %.loc21: ref = deref %A.ref.loc21 [concrete = ] // CHECK:STDOUT: %foo.ref: = name_ref foo, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/pointer/fail_deref_namespace.carbon b/toolchain/check/testdata/pointer/fail_deref_namespace.carbon index d64733b0ff7c..14a8c3f878e7 100644 --- a/toolchain/check/testdata/pointer/fail_deref_namespace.carbon +++ b/toolchain/check/testdata/pointer/fail_deref_namespace.carbon @@ -15,14 +15,10 @@ namespace A; fn F() { - // CHECK:STDERR: fail_deref_namespace.carbon:[[@LINE+4]]:4: error: expression cannot be used as a value [UseOfNonExprAsValue] - // CHECK:STDERR: *A; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_deref_namespace.carbon:[[@LINE+2]]:4: error: expression cannot be used as a value [UseOfNonExprAsValue] // CHECK:STDERR: *A; - // CHECK:STDERR: fail_deref_namespace.carbon:[[@LINE+4]]:3: error: expression cannot be used as a value [UseOfNonExprAsValue] - // CHECK:STDERR: A->foo; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_deref_namespace.carbon:[[@LINE+2]]:3: error: expression cannot be used as a value [UseOfNonExprAsValue] // CHECK:STDERR: A->foo; } @@ -55,10 +51,10 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref.loc22: = name_ref A, file.%A [concrete = file.%A] -// CHECK:STDOUT: %.loc22: ref = deref [concrete = ] -// CHECK:STDOUT: %A.ref.loc27: = name_ref A, file.%A [concrete = file.%A] -// CHECK:STDOUT: %.loc27: ref = deref [concrete = ] +// CHECK:STDOUT: %A.ref.loc20: = name_ref A, file.%A [concrete = file.%A] +// CHECK:STDOUT: %.loc20: ref = deref [concrete = ] +// CHECK:STDOUT: %A.ref.loc23: = name_ref A, file.%A [concrete = file.%A] +// CHECK:STDOUT: %.loc23: ref = deref [concrete = ] // CHECK:STDOUT: %foo.ref: = name_ref foo, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/pointer/fail_deref_not_pointer.carbon b/toolchain/check/testdata/pointer/fail_deref_not_pointer.carbon index 3e5fe4f0cd49..2cfdb1ad20a5 100644 --- a/toolchain/check/testdata/pointer/fail_deref_not_pointer.carbon +++ b/toolchain/check/testdata/pointer/fail_deref_not_pointer.carbon @@ -13,34 +13,22 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/fail_deref_not_pointer.carbon fn Deref(n: i32) { - // CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+4]]:3: error: cannot dereference operand of non-pointer type `i32` [DerefOfNonPointer] - // CHECK:STDERR: *n; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+2]]:3: error: cannot dereference operand of non-pointer type `i32` [DerefOfNonPointer] // CHECK:STDERR: *n; - // CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+4]]:4: error: cannot apply `->` operator to non-pointer type `i32` [ArrowOperatorOfNonPointer] - // CHECK:STDERR: n->foo; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+2]]:4-5: error: cannot apply `->` operator to non-pointer type `i32` [ArrowOperatorOfNonPointer] // CHECK:STDERR: n->foo; - // CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+4]]:3: error: cannot dereference operand of non-pointer type `()` [DerefOfNonPointer] - // CHECK:STDERR: *(); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+2]]:3: error: cannot dereference operand of non-pointer type `()` [DerefOfNonPointer] // CHECK:STDERR: *(); - // CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+4]]:5: error: cannot apply `->` operator to non-pointer type `()` [ArrowOperatorOfNonPointer] - // CHECK:STDERR: ()->foo; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+2]]:5-6: error: cannot apply `->` operator to non-pointer type `()` [ArrowOperatorOfNonPointer] // CHECK:STDERR: ()->foo; - // CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+4]]:3: error: cannot dereference operand of non-pointer type `{}` [DerefOfNonPointer] - // CHECK:STDERR: *{}; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+2]]:3: error: cannot dereference operand of non-pointer type `{}` [DerefOfNonPointer] // CHECK:STDERR: *{}; - // CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+4]]:5: error: cannot apply `->` operator to non-pointer type `{}` [ArrowOperatorOfNonPointer] - // CHECK:STDERR: {}->foo; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+2]]:5-6: error: cannot apply `->` operator to non-pointer type `{}` [ArrowOperatorOfNonPointer] // CHECK:STDERR: {}->foo; } @@ -91,29 +79,29 @@ fn Deref(n: i32) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Deref(%n.param: %i32) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %n.ref.loc20: %i32 = name_ref n, %n -// CHECK:STDOUT: %.loc20: ref = deref %n.ref.loc20 -// CHECK:STDOUT: %n.ref.loc25: %i32 = name_ref n, %n -// CHECK:STDOUT: %.loc25: ref = deref %n.ref.loc25 -// CHECK:STDOUT: %foo.ref.loc25: = name_ref foo, [concrete = ] -// CHECK:STDOUT: %.loc30_5.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %empty_tuple.loc30: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc30_5.2: %empty_tuple.type = converted %.loc30_5.1, %empty_tuple.loc30 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %n.ref.loc18: %i32 = name_ref n, %n +// CHECK:STDOUT: %.loc18: ref = deref %n.ref.loc18 +// CHECK:STDOUT: %n.ref.loc21: %i32 = name_ref n, %n +// CHECK:STDOUT: %.loc21: ref = deref %n.ref.loc21 +// CHECK:STDOUT: %foo.ref.loc21: = name_ref foo, [concrete = ] +// CHECK:STDOUT: %.loc24_5.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %empty_tuple.loc24: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc24_5.2: %empty_tuple.type = converted %.loc24_5.1, %empty_tuple.loc24 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc24_3: ref = deref %.loc24_5.2 [concrete = ] +// CHECK:STDOUT: %.loc27_4.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %empty_tuple.loc27: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc27_4.2: %empty_tuple.type = converted %.loc27_4.1, %empty_tuple.loc27 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc27_5: ref = deref %.loc27_4.2 [concrete = ] +// CHECK:STDOUT: %foo.ref.loc27: = name_ref foo, [concrete = ] +// CHECK:STDOUT: %.loc30_5.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %empty_struct.loc30: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc30_5.2: %empty_struct_type = converted %.loc30_5.1, %empty_struct.loc30 [concrete = constants.%empty_struct] // CHECK:STDOUT: %.loc30_3: ref = deref %.loc30_5.2 [concrete = ] -// CHECK:STDOUT: %.loc35_4.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %empty_tuple.loc35: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc35_4.2: %empty_tuple.type = converted %.loc35_4.1, %empty_tuple.loc35 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc35_5: ref = deref %.loc35_4.2 [concrete = ] -// CHECK:STDOUT: %foo.ref.loc35: = name_ref foo, [concrete = ] -// CHECK:STDOUT: %.loc40_5.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %empty_struct.loc40: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc40_5.2: %empty_struct_type = converted %.loc40_5.1, %empty_struct.loc40 [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc40_3: ref = deref %.loc40_5.2 [concrete = ] -// CHECK:STDOUT: %.loc45_4.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %empty_struct.loc45: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc45_4.2: %empty_struct_type = converted %.loc45_4.1, %empty_struct.loc45 [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc45_5: ref = deref %.loc45_4.2 [concrete = ] -// CHECK:STDOUT: %foo.ref.loc45: = name_ref foo, [concrete = ] +// CHECK:STDOUT: %.loc33_4.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %empty_struct.loc33: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc33_4.2: %empty_struct_type = converted %.loc33_4.1, %empty_struct.loc33 [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc33_5: ref = deref %.loc33_4.2 [concrete = ] +// CHECK:STDOUT: %foo.ref.loc33: = name_ref foo, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/pointer/fail_deref_type.carbon b/toolchain/check/testdata/pointer/fail_deref_type.carbon index 7f14de967705..b87332d108d8 100644 --- a/toolchain/check/testdata/pointer/fail_deref_type.carbon +++ b/toolchain/check/testdata/pointer/fail_deref_type.carbon @@ -12,17 +12,11 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/fail_deref_type.carbon -// CHECK:STDERR: fail_deref_type.carbon:[[@LINE+7]]:8: error: cannot dereference operand of non-pointer type `type` [DerefOfNonPointer] -// CHECK:STDERR: var p: *i32; -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_deref_type.carbon:[[@LINE+4]]:8: note: to form a pointer type, write the `*` after the pointee type [DerefOfType] -// CHECK:STDERR: var p: *i32; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_deref_type.carbon:[[@LINE+3]]:8: error: cannot dereference operand of non-pointer type `type` [DerefOfNonPointer] +// CHECK:STDERR: fail_deref_type.carbon:[[@LINE+2]]:8: note: to form a pointer type, write the `*` after the pointee type [DerefOfType] // CHECK:STDERR: var p: *i32; -// CHECK:STDERR: fail_deref_type.carbon:[[@LINE+4]]:12: error: cannot apply `->` operator to non-pointer type `type` [ArrowOperatorOfNonPointer] -// CHECK:STDERR: var p2: i32->foo; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_deref_type.carbon:[[@LINE+2]]:12-13: error: cannot apply `->` operator to non-pointer type `type` [ArrowOperatorOfNonPointer] // CHECK:STDERR: var p2: i32->foo; @@ -54,8 +48,8 @@ var p2: i32->foo; // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %p.var: ref = var_storage %p.var_patt [concrete = ] // CHECK:STDOUT: %.1: = splice_block [concrete = ] { -// CHECK:STDOUT: %i32.loc22: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc22: ref = deref %i32.loc22 [concrete = ] +// CHECK:STDOUT: %i32.loc18: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc18: ref = deref %i32.loc18 [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %p: = wrapper_binding p, [concrete = ] // CHECK:STDOUT: name_binding_decl { @@ -64,8 +58,8 @@ var p2: i32->foo; // CHECK:STDOUT: } // CHECK:STDOUT: %p2.var: ref = var_storage %p2.var_patt [concrete = ] // CHECK:STDOUT: %.2: = splice_block [concrete = ] { -// CHECK:STDOUT: %i32.loc27: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc27: ref = deref %i32.loc27 [concrete = ] +// CHECK:STDOUT: %i32.loc21: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc21: ref = deref %i32.loc21 [concrete = ] // CHECK:STDOUT: %foo.ref: = name_ref foo, [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %p2: = wrapper_binding p2, [concrete = ] diff --git a/toolchain/check/testdata/pointer/fail_type_mismatch.carbon b/toolchain/check/testdata/pointer/fail_type_mismatch.carbon index a94ab8a890fc..45204876618a 100644 --- a/toolchain/check/testdata/pointer/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/pointer/fail_type_mismatch.carbon @@ -13,12 +13,8 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/fail_type_mismatch.carbon 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 ({}*))` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return p; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `const {}*` to `const ({}*)` [ConversionFailure] + // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+2]]:3-11: note: type `const {}*` does not implement interface `Core.ImplicitAs(const ({}*))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; } @@ -88,7 +84,7 @@ fn ConstMismatch(p: const {}*) -> const ({}*) { // CHECK:STDOUT: fn @ConstMismatch(%p.param: %ptr.bf9) -> out %return.param: %const.987 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: %ptr.bf9 = name_ref p, %p -// CHECK:STDOUT: %.loc23: %const.987 = converted %p.ref, [concrete = ] +// CHECK:STDOUT: %.loc19: %const.987 = converted %p.ref, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/primitives/float_conversions.carbon b/toolchain/check/testdata/primitives/float_conversions.carbon index d4ec993d5dd7..6a3fa9237acc 100644 --- a/toolchain/check/testdata/primitives/float_conversions.carbon +++ b/toolchain/check/testdata/primitives/float_conversions.carbon @@ -48,21 +48,15 @@ fn F() { // --- fail_int_literal_to_float_lossy.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_int_literal_to_float_lossy.carbon:[[@LINE+4]]:14: error: integer value 123456789 cannot be represented exactly in floating-point type `f32` [IntLossyConversionToFloat] -// CHECK:STDERR: let a: f32 = 123456789; -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_int_literal_to_float_lossy.carbon:[[@LINE+2]]:14-22: error: integer value 123456789 cannot be represented exactly in floating-point type `f32` [IntLossyConversionToFloat] // CHECK:STDERR: let a: f32 = 123456789; -// CHECK:STDERR: fail_int_literal_to_float_lossy.carbon:[[@LINE+4]]:14: error: integer value 100000001 cannot be represented exactly in floating-point type `f32` [IntLossyConversionToFloat] -// CHECK:STDERR: let b: f32 = 100000001; -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_int_literal_to_float_lossy.carbon:[[@LINE+2]]:14-22: error: integer value 100000001 cannot be represented exactly in floating-point type `f32` [IntLossyConversionToFloat] // CHECK:STDERR: let b: f32 = 100000001; -// CHECK:STDERR: fail_int_literal_to_float_lossy.carbon:[[@LINE+4]]:14: error: integer value 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 too large for floating-point type `f32` [IntTooLargeForFloatType] -// CHECK:STDERR: let c: f32 = 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_int_literal_to_float_lossy.carbon:[[@LINE+2]]:14-114: error: integer value 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 too large for floating-point type `f32` [IntTooLargeForFloatType] // CHECK:STDERR: let c: f32 = 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000; @@ -93,21 +87,13 @@ import library "test_helpers"; fn F(f: f32) { // Lossy explicit conversion using `as` not permitted. - // CHECK:STDERR: fail_float_as_int.carbon:[[@LINE+7]]:16: error: cannot convert expression of type `Core.FloatLiteral` to `i32` with `as` [ConversionFailure] - // CHECK:STDERR: let _: i32 = 12.34 as i32; - // CHECK:STDERR: ^~~~~~~~~~~~ - // CHECK:STDERR: fail_float_as_int.carbon:[[@LINE+4]]:16: note: type `Core.FloatLiteral` does not implement interface `Core.As(i32)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let _: i32 = 12.34 as i32; - // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_float_as_int.carbon:[[@LINE+3]]:16-27: error: cannot convert expression of type `Core.FloatLiteral` to `i32` with `as` [ConversionFailure] + // CHECK:STDERR: fail_float_as_int.carbon:[[@LINE+2]]:16-27: note: type `Core.FloatLiteral` does not implement interface `Core.As(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: i32 = 12.34 as i32; - // CHECK:STDERR: fail_float_as_int.carbon:[[@LINE+7]]:16: error: cannot convert expression of type `f32` to `i32` with `as` [ConversionFailure] - // CHECK:STDERR: let _: i32 = f as i32; - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_float_as_int.carbon:[[@LINE+4]]:16: note: type `f32` does not implement interface `Core.As(i32)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let _: i32 = f as i32; - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_float_as_int.carbon:[[@LINE+3]]:16-23: error: cannot convert expression of type `f32` to `i32` with `as` [ConversionFailure] + // CHECK:STDERR: fail_float_as_int.carbon:[[@LINE+2]]:16-23: note: type `f32` does not implement interface `Core.As(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: i32 = f as i32; } @@ -133,12 +119,8 @@ library "[[@TEST_NAME]]"; fn F(x: f64) { // Implicit narrowing conversion (f64 -> f32) is not permitted. - // CHECK:STDERR: fail_float_to_float_narrowing.carbon:[[@LINE+7]]:16: error: cannot implicitly convert expression of type `f64` to `f32` [ConversionFailure] - // CHECK:STDERR: let _: f32 = x; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_float_to_float_narrowing.carbon:[[@LINE+4]]:16: note: type `f64` does not implement interface `Core.ImplicitAs(f32)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: let _: f32 = x; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_float_to_float_narrowing.carbon:[[@LINE+3]]:16: error: cannot implicitly convert expression of type `f64` to `f32` [ConversionFailure] + // CHECK:STDERR: fail_float_to_float_narrowing.carbon:[[@LINE+2]]:16: note: type `f64` does not implement interface `Core.ImplicitAs(f32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: f32 = x; } diff --git a/toolchain/check/testdata/primitives/int_conversions.carbon b/toolchain/check/testdata/primitives/int_conversions.carbon index 063ba084c3ab..d95bed8fc2a6 100644 --- a/toolchain/check/testdata/primitives/int_conversions.carbon +++ b/toolchain/check/testdata/primitives/int_conversions.carbon @@ -28,12 +28,8 @@ library "[[@TEST_NAME]]"; fn TestFailures() { var a: i64 = 1; - // CHECK:STDERR: fail_narrow_i64_to_i32.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `i64` to `i32` [ConversionFailure] - // CHECK:STDERR: var unused b: i32 = a; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_narrow_i64_to_i32.carbon:[[@LINE+4]]:3: note: type `i64` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var unused b: i32 = a; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_narrow_i64_to_i32.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `i64` to `i32` [ConversionFailure] + // CHECK:STDERR: fail_narrow_i64_to_i32.carbon:[[@LINE+2]]:3-19: note: type `i64` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused b: i32 = a; } @@ -44,12 +40,8 @@ library "[[@TEST_NAME]]"; fn TestFailures() { var w: u64 = 1; - // CHECK:STDERR: fail_narrow_u64_to_u32.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `u64` to `u32` [ConversionFailure] - // CHECK:STDERR: var unused x: u32 = w; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_narrow_u64_to_u32.carbon:[[@LINE+4]]:3: note: type `u64` does not implement interface `Core.ImplicitAs(u32)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var unused x: u32 = w; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_narrow_u64_to_u32.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `u64` to `u32` [ConversionFailure] + // CHECK:STDERR: fail_narrow_u64_to_u32.carbon:[[@LINE+2]]:3-19: note: type `u64` does not implement interface `Core.ImplicitAs(u32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused x: u32 = w; } @@ -84,16 +76,10 @@ library "[[@TEST_NAME]]"; fn TestCppCompat() { var a: Core.CppCompat.Long32 = 1; - // CHECK:STDERR: fail_todo_cpp_compat_widen_long32_to_i33.carbon:[[@LINE+11]]:17: error: bit width of integer type literal must be a multiple of 8; use `Core.Int(33)` instead [IntWidthNotMultipleOf8] - // CHECK:STDERR: var unused b: i33 = a; - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_todo_cpp_compat_widen_long32_to_i33.carbon:[[@LINE+5]]:17-19: error: bit width of integer type literal must be a multiple of 8; use `Core.Int(33)` instead [IntWidthNotMultipleOf8] // CHECK:STDERR: - // CHECK:STDERR: fail_todo_cpp_compat_widen_long32_to_i33.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Long32` to `i33` [ConversionFailure] - // CHECK:STDERR: var unused b: i33 = a; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_cpp_compat_widen_long32_to_i33.carbon:[[@LINE+4]]:3: note: type `Core.CppCompat.Long32` does not implement interface `Core.ImplicitAs(i33)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var unused b: i33 = a; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_cpp_compat_widen_long32_to_i33.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `Long32` to `i33` [ConversionFailure] + // CHECK:STDERR: fail_todo_cpp_compat_widen_long32_to_i33.carbon:[[@LINE+2]]:3-19: note: type `Core.CppCompat.Long32` does not implement interface `Core.ImplicitAs(i33)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused b: i33 = a; } @@ -104,16 +90,10 @@ library "[[@TEST_NAME]]"; fn TestCppCompat() { var c: Core.CppCompat.Long64 = 1; - // CHECK:STDERR: fail_todo_cpp_compat_widen_long64_to_i65.carbon:[[@LINE+11]]:17: error: bit width of integer type literal must be a multiple of 8; use `Core.Int(65)` instead [IntWidthNotMultipleOf8] - // CHECK:STDERR: var unused d: i65 = c; - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_todo_cpp_compat_widen_long64_to_i65.carbon:[[@LINE+5]]:17-19: error: bit width of integer type literal must be a multiple of 8; use `Core.Int(65)` instead [IntWidthNotMultipleOf8] // CHECK:STDERR: - // CHECK:STDERR: fail_todo_cpp_compat_widen_long64_to_i65.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Long64` to `i65` [ConversionFailure] - // CHECK:STDERR: var unused d: i65 = c; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_cpp_compat_widen_long64_to_i65.carbon:[[@LINE+4]]:3: note: type `Core.CppCompat.Long64` does not implement interface `Core.ImplicitAs(i65)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var unused d: i65 = c; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_cpp_compat_widen_long64_to_i65.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `Long64` to `i65` [ConversionFailure] + // CHECK:STDERR: fail_todo_cpp_compat_widen_long64_to_i65.carbon:[[@LINE+2]]:3-19: note: type `Core.CppCompat.Long64` does not implement interface `Core.ImplicitAs(i65)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused d: i65 = c; } @@ -124,16 +104,10 @@ library "[[@TEST_NAME]]"; fn TestCppCompat() { var e: Core.CppCompat.LongLong64 = 1; - // CHECK:STDERR: fail_todo_cpp_compat_widen_longlong64_to_i65.carbon:[[@LINE+11]]:17: error: bit width of integer type literal must be a multiple of 8; use `Core.Int(65)` instead [IntWidthNotMultipleOf8] - // CHECK:STDERR: var unused f: i65 = e; - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_todo_cpp_compat_widen_longlong64_to_i65.carbon:[[@LINE+5]]:17-19: error: bit width of integer type literal must be a multiple of 8; use `Core.Int(65)` instead [IntWidthNotMultipleOf8] // CHECK:STDERR: - // CHECK:STDERR: fail_todo_cpp_compat_widen_longlong64_to_i65.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `LongLong64` to `i65` [ConversionFailure] - // CHECK:STDERR: var unused f: i65 = e; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_cpp_compat_widen_longlong64_to_i65.carbon:[[@LINE+4]]:3: note: type `Core.CppCompat.LongLong64` does not implement interface `Core.ImplicitAs(i65)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var unused f: i65 = e; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_cpp_compat_widen_longlong64_to_i65.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `LongLong64` to `i65` [ConversionFailure] + // CHECK:STDERR: fail_todo_cpp_compat_widen_longlong64_to_i65.carbon:[[@LINE+2]]:3-19: note: type `Core.CppCompat.LongLong64` does not implement interface `Core.ImplicitAs(i65)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused f: i65 = e; } @@ -144,16 +118,10 @@ library "[[@TEST_NAME]]"; fn TestCppCompat() { var g: Core.CppCompat.ULong32 = 1; - // CHECK:STDERR: fail_todo_cpp_compat_widen_ulong32_to_u33.carbon:[[@LINE+11]]:17: error: bit width of integer type literal must be a multiple of 8; use `Core.UInt(33)` instead [IntWidthNotMultipleOf8] - // CHECK:STDERR: var unused h: u33 = g; - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_todo_cpp_compat_widen_ulong32_to_u33.carbon:[[@LINE+5]]:17-19: error: bit width of integer type literal must be a multiple of 8; use `Core.UInt(33)` instead [IntWidthNotMultipleOf8] // CHECK:STDERR: - // CHECK:STDERR: fail_todo_cpp_compat_widen_ulong32_to_u33.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `ULong32` to `u33` [ConversionFailure] - // CHECK:STDERR: var unused h: u33 = g; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_cpp_compat_widen_ulong32_to_u33.carbon:[[@LINE+4]]:3: note: type `Core.CppCompat.ULong32` does not implement interface `Core.ImplicitAs(u33)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var unused h: u33 = g; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_cpp_compat_widen_ulong32_to_u33.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `ULong32` to `u33` [ConversionFailure] + // CHECK:STDERR: fail_todo_cpp_compat_widen_ulong32_to_u33.carbon:[[@LINE+2]]:3-19: note: type `Core.CppCompat.ULong32` does not implement interface `Core.ImplicitAs(u33)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused h: u33 = g; } @@ -164,16 +132,10 @@ library "[[@TEST_NAME]]"; fn TestCppCompat() { var i: Core.CppCompat.ULong64 = 1; - // CHECK:STDERR: fail_todo_cpp_compat_widen_ulong64_to_u65.carbon:[[@LINE+11]]:17: error: bit width of integer type literal must be a multiple of 8; use `Core.UInt(65)` instead [IntWidthNotMultipleOf8] - // CHECK:STDERR: var unused j: u65 = i; - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_todo_cpp_compat_widen_ulong64_to_u65.carbon:[[@LINE+5]]:17-19: error: bit width of integer type literal must be a multiple of 8; use `Core.UInt(65)` instead [IntWidthNotMultipleOf8] // CHECK:STDERR: - // CHECK:STDERR: fail_todo_cpp_compat_widen_ulong64_to_u65.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `ULong64` to `u65` [ConversionFailure] - // CHECK:STDERR: var unused j: u65 = i; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_cpp_compat_widen_ulong64_to_u65.carbon:[[@LINE+4]]:3: note: type `Core.CppCompat.ULong64` does not implement interface `Core.ImplicitAs(u65)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var unused j: u65 = i; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_cpp_compat_widen_ulong64_to_u65.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `ULong64` to `u65` [ConversionFailure] + // CHECK:STDERR: fail_todo_cpp_compat_widen_ulong64_to_u65.carbon:[[@LINE+2]]:3-19: note: type `Core.CppCompat.ULong64` does not implement interface `Core.ImplicitAs(u65)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused j: u65 = i; } @@ -184,16 +146,10 @@ library "[[@TEST_NAME]]"; fn TestCppCompat() { var k: Core.CppCompat.ULongLong64 = 1; - // CHECK:STDERR: fail_todo_cpp_compat_widen_ulonglong64_to_u65.carbon:[[@LINE+11]]:17: error: bit width of integer type literal must be a multiple of 8; use `Core.UInt(65)` instead [IntWidthNotMultipleOf8] - // CHECK:STDERR: var unused l: u65 = k; - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_todo_cpp_compat_widen_ulonglong64_to_u65.carbon:[[@LINE+5]]:17-19: error: bit width of integer type literal must be a multiple of 8; use `Core.UInt(65)` instead [IntWidthNotMultipleOf8] // CHECK:STDERR: - // CHECK:STDERR: fail_todo_cpp_compat_widen_ulonglong64_to_u65.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `ULongLong64` to `u65` [ConversionFailure] - // CHECK:STDERR: var unused l: u65 = k; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_cpp_compat_widen_ulonglong64_to_u65.carbon:[[@LINE+4]]:3: note: type `Core.CppCompat.ULongLong64` does not implement interface `Core.ImplicitAs(u65)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var unused l: u65 = k; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_cpp_compat_widen_ulonglong64_to_u65.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `ULongLong64` to `u65` [ConversionFailure] + // CHECK:STDERR: fail_todo_cpp_compat_widen_ulonglong64_to_u65.carbon:[[@LINE+2]]:3-19: note: type `Core.CppCompat.ULongLong64` does not implement interface `Core.ImplicitAs(u65)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused l: u65 = k; } @@ -205,12 +161,8 @@ library "[[@TEST_NAME]]"; fn TestCppCompat() { // Long32 is slightly wider than i32. var a: Core.CppCompat.Long32 = 1; - // CHECK:STDERR: fail_cpp_compat_narrow_long32_to_i32.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Long32` to `i32` [ConversionFailure] - // CHECK:STDERR: var unused b: i32 = a; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_cpp_compat_narrow_long32_to_i32.carbon:[[@LINE+4]]:3: note: type `Core.CppCompat.Long32` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var unused b: i32 = a; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_cpp_compat_narrow_long32_to_i32.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `Long32` to `i32` [ConversionFailure] + // CHECK:STDERR: fail_cpp_compat_narrow_long32_to_i32.carbon:[[@LINE+2]]:3-19: note: type `Core.CppCompat.Long32` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused b: i32 = a; } @@ -222,12 +174,8 @@ library "[[@TEST_NAME]]"; fn TestCppCompat() { // i64 is slightly wider than Long64. var c: i64 = 1; - // CHECK:STDERR: fail_cpp_compat_narrow_i64_to_long64.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `i64` to `Core.CppCompat.Long64` [ConversionFailure] - // CHECK:STDERR: var unused d: Core.CppCompat.Long64 = c; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_cpp_compat_narrow_i64_to_long64.carbon:[[@LINE+4]]:3: note: type `i64` does not implement interface `Core.ImplicitAs(Core.CppCompat.Long64)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var unused d: Core.CppCompat.Long64 = c; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_cpp_compat_narrow_i64_to_long64.carbon:[[@LINE+3]]:3-37: error: cannot implicitly convert expression of type `i64` to `Core.CppCompat.Long64` [ConversionFailure] + // CHECK:STDERR: fail_cpp_compat_narrow_i64_to_long64.carbon:[[@LINE+2]]:3-37: note: type `i64` does not implement interface `Core.ImplicitAs(Core.CppCompat.Long64)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused d: Core.CppCompat.Long64 = c; } @@ -239,12 +187,8 @@ library "[[@TEST_NAME]]"; fn TestCppCompat() { // LongLong64 is slightly wider than i64. var e: Core.CppCompat.LongLong64 = 1; - // CHECK:STDERR: fail_cpp_compat_narrow_longlong64_to_i64.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `LongLong64` to `i64` [ConversionFailure] - // CHECK:STDERR: var unused f: i64 = e; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_cpp_compat_narrow_longlong64_to_i64.carbon:[[@LINE+4]]:3: note: type `Core.CppCompat.LongLong64` does not implement interface `Core.ImplicitAs(i64)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var unused f: i64 = e; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_cpp_compat_narrow_longlong64_to_i64.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `LongLong64` to `i64` [ConversionFailure] + // CHECK:STDERR: fail_cpp_compat_narrow_longlong64_to_i64.carbon:[[@LINE+2]]:3-19: note: type `Core.CppCompat.LongLong64` does not implement interface `Core.ImplicitAs(i64)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused f: i64 = e; } @@ -256,12 +200,8 @@ library "[[@TEST_NAME]]"; fn TestCppCompat() { // ULong32 is slightly wider than u32. var g: Core.CppCompat.ULong32 = 1; - // CHECK:STDERR: fail_cpp_compat_narrow_ulong32_to_u32.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `ULong32` to `u32` [ConversionFailure] - // CHECK:STDERR: var unused h: u32 = g; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_cpp_compat_narrow_ulong32_to_u32.carbon:[[@LINE+4]]:3: note: type `Core.CppCompat.ULong32` does not implement interface `Core.ImplicitAs(u32)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var unused h: u32 = g; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_cpp_compat_narrow_ulong32_to_u32.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `ULong32` to `u32` [ConversionFailure] + // CHECK:STDERR: fail_cpp_compat_narrow_ulong32_to_u32.carbon:[[@LINE+2]]:3-19: note: type `Core.CppCompat.ULong32` does not implement interface `Core.ImplicitAs(u32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused h: u32 = g; } @@ -273,12 +213,8 @@ library "[[@TEST_NAME]]"; fn TestCppCompat() { // u64 is slightly wider than ULong64. var i: u64 = 1; - // CHECK:STDERR: fail_cpp_compat_narrow_u64_to_ulong64.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `u64` to `Core.CppCompat.ULong64` [ConversionFailure] - // CHECK:STDERR: var unused j: Core.CppCompat.ULong64 = i; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_cpp_compat_narrow_u64_to_ulong64.carbon:[[@LINE+4]]:3: note: type `u64` does not implement interface `Core.ImplicitAs(Core.CppCompat.ULong64)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var unused j: Core.CppCompat.ULong64 = i; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_cpp_compat_narrow_u64_to_ulong64.carbon:[[@LINE+3]]:3-38: error: cannot implicitly convert expression of type `u64` to `Core.CppCompat.ULong64` [ConversionFailure] + // CHECK:STDERR: fail_cpp_compat_narrow_u64_to_ulong64.carbon:[[@LINE+2]]:3-38: note: type `u64` does not implement interface `Core.ImplicitAs(Core.CppCompat.ULong64)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused j: Core.CppCompat.ULong64 = i; } @@ -290,12 +226,8 @@ library "[[@TEST_NAME]]"; fn TestCppCompat() { // ULongLong64 is slightly wider than u64. var k: Core.CppCompat.ULongLong64 = 1; - // CHECK:STDERR: fail_cpp_compat_narrow_ulonglong64_to_u64.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `ULongLong64` to `u64` [ConversionFailure] - // CHECK:STDERR: var unused l: u64 = k; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_cpp_compat_narrow_ulonglong64_to_u64.carbon:[[@LINE+4]]:3: note: type `Core.CppCompat.ULongLong64` does not implement interface `Core.ImplicitAs(u64)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var unused l: u64 = k; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_cpp_compat_narrow_ulonglong64_to_u64.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `ULongLong64` to `u64` [ConversionFailure] + // CHECK:STDERR: fail_cpp_compat_narrow_ulonglong64_to_u64.carbon:[[@LINE+2]]:3-19: note: type `Core.CppCompat.ULongLong64` does not implement interface `Core.ImplicitAs(u64)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused l: u64 = k; } @@ -315,12 +247,8 @@ library "[[@TEST_NAME]]"; fn TestMixedSign() { var a: i32 = 1; - // CHECK:STDERR: fail_narrow_sign_change_i32_to_u32.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `i32` to `u32` [ConversionFailure] - // CHECK:STDERR: var unused b: u32 = a; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_narrow_sign_change_i32_to_u32.carbon:[[@LINE+4]]:3: note: type `i32` does not implement interface `Core.ImplicitAs(u32)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var unused b: u32 = a; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_narrow_sign_change_i32_to_u32.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `i32` to `u32` [ConversionFailure] + // CHECK:STDERR: fail_narrow_sign_change_i32_to_u32.carbon:[[@LINE+2]]:3-19: note: type `i32` does not implement interface `Core.ImplicitAs(u32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused b: u32 = a; } @@ -331,12 +259,8 @@ library "[[@TEST_NAME]]"; fn TestMixedSign() { var c: u32 = 1; - // CHECK:STDERR: fail_narrow_sign_change_u32_to_i32.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `u32` to `i32` [ConversionFailure] - // CHECK:STDERR: var unused d: i32 = c; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_narrow_sign_change_u32_to_i32.carbon:[[@LINE+4]]:3: note: type `u32` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var unused d: i32 = c; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_narrow_sign_change_u32_to_i32.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `u32` to `i32` [ConversionFailure] + // CHECK:STDERR: fail_narrow_sign_change_u32_to_i32.carbon:[[@LINE+2]]:3-19: note: type `u32` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused d: i32 = c; } @@ -347,12 +271,8 @@ library "[[@TEST_NAME]]"; fn TestMixedSign() { var g: i32 = 1; - // CHECK:STDERR: fail_narrow_sign_change_i32_to_u64.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `i32` to `u64` [ConversionFailure] - // CHECK:STDERR: var unused h: u64 = g; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_narrow_sign_change_i32_to_u64.carbon:[[@LINE+4]]:3: note: type `i32` does not implement interface `Core.ImplicitAs(u64)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var unused h: u64 = g; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_narrow_sign_change_i32_to_u64.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `i32` to `u64` [ConversionFailure] + // CHECK:STDERR: fail_narrow_sign_change_i32_to_u64.carbon:[[@LINE+2]]:3-19: note: type `i32` does not implement interface `Core.ImplicitAs(u64)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused h: u64 = g; } @@ -377,12 +297,8 @@ library "[[@TEST_NAME]]"; fn TestArbitraryWidth() { var a: Core.Int(33) = 1; - // CHECK:STDERR: fail_narrow_arbitrary_width_i33_to_i32.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `i33` to `i32` [ConversionFailure] - // CHECK:STDERR: var unused b: Core.Int(32) = a; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_narrow_arbitrary_width_i33_to_i32.carbon:[[@LINE+4]]:3: note: type `i33` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var unused b: Core.Int(32) = a; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_narrow_arbitrary_width_i33_to_i32.carbon:[[@LINE+3]]:3-28: error: cannot implicitly convert expression of type `i33` to `i32` [ConversionFailure] + // CHECK:STDERR: fail_narrow_arbitrary_width_i33_to_i32.carbon:[[@LINE+2]]:3-28: note: type `i33` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused b: Core.Int(32) = a; } @@ -393,12 +309,8 @@ library "[[@TEST_NAME]]"; fn TestArbitraryWidth() { var d: Core.UInt(33) = 1; - // CHECK:STDERR: fail_narrow_arbitrary_width_u33_to_u32.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `u33` to `u32` [ConversionFailure] - // CHECK:STDERR: var unused e: Core.UInt(32) = d; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_narrow_arbitrary_width_u33_to_u32.carbon:[[@LINE+4]]:3: note: type `u33` does not implement interface `Core.ImplicitAs(u32)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var unused e: Core.UInt(32) = d; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_narrow_arbitrary_width_u33_to_u32.carbon:[[@LINE+3]]:3-29: error: cannot implicitly convert expression of type `u33` to `u32` [ConversionFailure] + // CHECK:STDERR: fail_narrow_arbitrary_width_u33_to_u32.carbon:[[@LINE+2]]:3-29: note: type `u33` does not implement interface `Core.ImplicitAs(u32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused e: Core.UInt(32) = d; } @@ -409,12 +321,8 @@ library "[[@TEST_NAME]]"; fn TestArbitraryWidth() { var a: Core.Int(33) = 1; - // CHECK:STDERR: fail_narrow_arbitrary_width_i33_to_u34.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `i33` to `u34` [ConversionFailure] - // CHECK:STDERR: var unused g: Core.UInt(34) = a; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_narrow_arbitrary_width_i33_to_u34.carbon:[[@LINE+4]]:3: note: type `i33` does not implement interface `Core.ImplicitAs(u34)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var unused g: Core.UInt(34) = a; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_narrow_arbitrary_width_i33_to_u34.carbon:[[@LINE+3]]:3-29: error: cannot implicitly convert expression of type `i33` to `u34` [ConversionFailure] + // CHECK:STDERR: fail_narrow_arbitrary_width_i33_to_u34.carbon:[[@LINE+2]]:3-29: note: type `i33` does not implement interface `Core.ImplicitAs(u34)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused g: Core.UInt(34) = a; } diff --git a/toolchain/check/testdata/primitives/numeric_literals.carbon b/toolchain/check/testdata/primitives/numeric_literals.carbon index a58967c276c5..f5b169c11893 100644 --- a/toolchain/check/testdata/primitives/numeric_literals.carbon +++ b/toolchain/check/testdata/primitives/numeric_literals.carbon @@ -43,9 +43,7 @@ fn F() { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_overflow_very_large.carbon:[[@LINE+4]]:14: error: integer value 39999999999999999993 too large for type `i32` [IntTooLargeForType] -// CHECK:STDERR: let a: i32 = 39999999999999999993; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow_very_large.carbon:[[@LINE+2]]:14-33: error: integer value 39999999999999999993 too large for type `i32` [IntTooLargeForType] // CHECK:STDERR: let a: i32 = 39999999999999999993; @@ -53,9 +51,7 @@ let a: i32 = 39999999999999999993; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_overflow_boundary.carbon:[[@LINE+4]]:14: error: integer value 2147483648 too large for type `i32` [IntTooLargeForType] -// CHECK:STDERR: let b: i32 = 2_147_483_648; -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow_boundary.carbon:[[@LINE+2]]:14-26: error: integer value 2147483648 too large for type `i32` [IntTooLargeForType] // CHECK:STDERR: let b: i32 = 2_147_483_648; @@ -63,9 +59,7 @@ let b: i32 = 2_147_483_648; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_overflow_boundary_hex.carbon:[[@LINE+4]]:14: error: integer value 2147483648 too large for type `i32` [IntTooLargeForType] -// CHECK:STDERR: let c: i32 = 0x8000_0000; -// CHECK:STDERR: ^~~~~~~~~~~ +// CHECK:STDERR: fail_overflow_boundary_hex.carbon:[[@LINE+2]]:14-24: error: integer value 2147483648 too large for type `i32` [IntTooLargeForType] // CHECK:STDERR: let c: i32 = 0x8000_0000; @@ -92,9 +86,7 @@ let max_rounds_down_hex: f64 = 0x1.FFFFFFFFFFFFF7FFFFFFFFFFp+1023; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_overflow_very_large_mantissa.carbon:[[@LINE+4]]:22: error: value 399999999999999999999999999999999999999999999999999999999999999999999990*10^237 too large for floating-point type `f64` [FloatLiteralTooLargeForType] -// CHECK:STDERR: let too_large: f64 = 39999999999999999999999999999999999999999999999999999999999999999999999.0e238; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow_very_large_mantissa.carbon:[[@LINE+2]]:22-98: error: value 399999999999999999999999999999999999999999999999999999999999999999999990*10^237 too large for floating-point type `f64` [FloatLiteralTooLargeForType] // CHECK:STDERR: let too_large: f64 = 39999999999999999999999999999999999999999999999999999999999999999999999.0e238; @@ -105,21 +97,15 @@ let max_plus_one: f64 = 17976931348623157081452742373170435679807056752584499659 let max_plus_a_bit_hex: f64 = 0x1.FFFFFFFFFFFFF00000000000000000000001p+1023; // The smallest number that would round to having an over-large exponent. -// CHECK:STDERR: fail_overflow_very_large_mantissa.carbon:[[@LINE+4]]:30: error: value 1797693134862315807937289714053034150799341327100378269361737789804449682927647509466490179775872070963302864166928879109465555478519404026306574886715058206819089020007083836762738548458177115317644757302700698555713669596228429148198608349364752927190741684443655107043427115596995080930428801779041744977920*10^-1 too large for floating-point type `f64` [FloatLiteralTooLargeForType] -// CHECK:STDERR: let min_rounds_to_inf: f64 = 179769313486231580793728971405303415079934132710037826936173778980444968292764750946649017977587207096330286416692887910946555547851940402630657488671505820681908902000708383676273854845817711531764475730270069855571366959622842914819860834936475292719074168444365510704342711559699508093042880177904174497792.0; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow_very_large_mantissa.carbon:[[@LINE+2]]:30-340: error: value 1797693134862315807937289714053034150799341327100378269361737789804449682927647509466490179775872070963302864166928879109465555478519404026306574886715058206819089020007083836762738548458177115317644757302700698555713669596228429148198608349364752927190741684443655107043427115596995080930428801779041744977920*10^-1 too large for floating-point type `f64` [FloatLiteralTooLargeForType] // CHECK:STDERR: let min_rounds_to_inf: f64 = 179769313486231580793728971405303415079934132710037826936173778980444968292764750946649017977587207096330286416692887910946555547851940402630657488671505820681908902000708383676273854845817711531764475730270069855571366959622842914819860834936475292719074168444365510704342711559699508093042880177904174497792.0; -// CHECK:STDERR: fail_overflow_very_large_mantissa.carbon:[[@LINE+4]]:41: error: value 179769313486231580793728971405303415079934132710037826936173778980444969*10^237 too large for floating-point type `f64` [FloatLiteralTooLargeForType] -// CHECK:STDERR: let min_rounds_to_inf_rounded_up: f64 = 17976931348623158079372897140530341507993413271003782693617377898044496.9e238; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow_very_large_mantissa.carbon:[[@LINE+2]]:41-117: error: value 179769313486231580793728971405303415079934132710037826936173778980444969*10^237 too large for floating-point type `f64` [FloatLiteralTooLargeForType] // CHECK:STDERR: let min_rounds_to_inf_rounded_up: f64 = 17976931348623158079372897140530341507993413271003782693617377898044496.9e238; -// CHECK:STDERR: fail_overflow_very_large_mantissa.carbon:[[@LINE+4]]:34: error: value 144115188075855864*2^967 too large for floating-point type `f64` [FloatLiteralTooLargeForType] -// CHECK:STDERR: let min_rounds_to_inf_hex: f64 = 0x1.FFFFFFFFFFFFF8p+1023; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow_very_large_mantissa.carbon:[[@LINE+2]]:34-57: error: value 144115188075855864*2^967 too large for floating-point type `f64` [FloatLiteralTooLargeForType] // CHECK:STDERR: let min_rounds_to_inf_hex: f64 = 0x1.FFFFFFFFFFFFF8p+1023; @@ -127,9 +113,7 @@ let min_rounds_to_inf_hex: f64 = 0x1.FFFFFFFFFFFFF8p+1023; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_overflow_very_large_exponent.carbon:[[@LINE+4]]:14: error: value 50*10^39999999999999999992 too large for floating-point type `f64` [FloatLiteralTooLargeForType] -// CHECK:STDERR: let e: f64 = 5.0e39999999999999999993; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow_very_large_exponent.carbon:[[@LINE+2]]:14-37: error: value 50*10^39999999999999999992 too large for floating-point type `f64` [FloatLiteralTooLargeForType] // CHECK:STDERR: let e: f64 = 5.0e39999999999999999993; diff --git a/toolchain/check/testdata/primitives/string_literals.carbon b/toolchain/check/testdata/primitives/string_literals.carbon index 26c208d9b08d..262e3995f4cb 100644 --- a/toolchain/check/testdata/primitives/string_literals.carbon +++ b/toolchain/check/testdata/primitives/string_literals.carbon @@ -15,9 +15,7 @@ library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: fail_no_string.carbon:[[@LINE+4]]:3: error: name `Core.String` implicitly referenced here, but not found [CoreNameNotFound] - // CHECK:STDERR: "hello"; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_no_string.carbon:[[@LINE+2]]:3-9: error: name `Core.String` implicitly referenced here, but not found [CoreNameNotFound] // CHECK:STDERR: "hello"; } @@ -37,9 +35,7 @@ class String { import Core library "unusual_string"; -// CHECK:STDERR: fail_use_unusual_string.carbon:[[@LINE+4]]:14: error: unexpected representation for type `str` [StringLiteralTypeUnexpected] -// CHECK:STDERR: let x: str = "hello"; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_use_unusual_string.carbon:[[@LINE+2]]:14-20: error: unexpected representation for type `str` [StringLiteralTypeUnexpected] // CHECK:STDERR: let x: str = "hello"; @@ -56,12 +52,8 @@ library "[[@TEST_NAME]]"; import Core library "incomplete_string"; fn F() { - // CHECK:STDERR: fail_use_incomplete_string.carbon:[[@LINE+7]]:3: error: type `Core.String` is incomplete [StringLiteralTypeIncomplete] - // CHECK:STDERR: "hello"; - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: incomplete_string.carbon:4:1: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: class String; - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_use_incomplete_string.carbon:[[@LINE+3]]:3-9: error: type `Core.String` is incomplete [StringLiteralTypeIncomplete] + // CHECK:STDERR: incomplete_string.carbon:4:1-13: note: class was forward declared here [ClassForwardDeclaredHere] // CHECK:STDERR: "hello"; } @@ -96,9 +88,7 @@ library "[[@TEST_NAME]]"; import Core library "small_string"; //@dump-sem-ir-begin -// CHECK:STDERR: fail_overfill_small_string.carbon:[[@LINE+4]]:14: error: string literal is too long [StringLiteralTooLong] -// CHECK:STDERR: let x: str = ''' -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_overfill_small_string.carbon:[[@LINE+2]]:14-276: error: string literal is too long [StringLiteralTooLong] // CHECK:STDERR: let x: str = ''' A string so long its size does not fit in `u8`. This results in an error, diff --git a/toolchain/check/testdata/primitives/type_literals.carbon b/toolchain/check/testdata/primitives/type_literals.carbon index d10afea81538..0c90ceb2f044 100644 --- a/toolchain/check/testdata/primitives/type_literals.carbon +++ b/toolchain/check/testdata/primitives/type_literals.carbon @@ -67,152 +67,90 @@ var test_type: type = i32; // --- fail_iN_bad_width.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+4]]:14: error: name `i0` not found [NameNotFound] -// CHECK:STDERR: var test_i0: i0; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+2]]:14-15: error: name `i0` not found [NameNotFound] // CHECK:STDERR: var test_i0: i0; -// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+4]]:14: error: bit width of integer type literal must be a multiple of 8; use `Core.Int(1)` instead [IntWidthNotMultipleOf8] -// CHECK:STDERR: var test_i1: i1; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+2]]:14-15: error: bit width of integer type literal must be a multiple of 8; use `Core.Int(1)` instead [IntWidthNotMultipleOf8] // CHECK:STDERR: var test_i1: i1; -// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+4]]:15: error: bit width of integer type literal must be a multiple of 8; use `Core.Int(15)` instead [IntWidthNotMultipleOf8] -// CHECK:STDERR: var test_i15: i15; -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+2]]:15-17: error: bit width of integer type literal must be a multiple of 8; use `Core.Int(15)` instead [IntWidthNotMultipleOf8] // CHECK:STDERR: var test_i15: i15; -// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+4]]:14: error: bit width of integer type literal must be a multiple of 8; use `Core.Int(4)` instead [IntWidthNotMultipleOf8] -// CHECK:STDERR: var test_i4: i4; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+2]]:14-15: error: bit width of integer type literal must be a multiple of 8; use `Core.Int(4)` instead [IntWidthNotMultipleOf8] // CHECK:STDERR: var test_i4: i4; -// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+4]]:15: error: bit width of integer type literal must be a multiple of 8; use `Core.Int(12)` instead [IntWidthNotMultipleOf8] -// CHECK:STDERR: var test_i12: i12; -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+2]]:15-17: error: bit width of integer type literal must be a multiple of 8; use `Core.Int(12)` instead [IntWidthNotMultipleOf8] // CHECK:STDERR: var test_i12: i12; -// 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: fail_iN_bad_width.carbon:[[@LINE+3]]:23-33: error: binding pattern has incomplete type `i1000000000` in name binding declaration [IncompleteTypeInBindingDecl] +// CHECK:STDERR: min_prelude/parts/int.carbon:11:9-18: note: integer type width of 1000000000 is greater than the maximum supported width of 8388608 [IntWidthTooLarge] // CHECK:STDERR: var test_i1000000000: i1000000000; // TODO: This diagnostic is not very good. -// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+8]]:33: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] -// CHECK:STDERR: var test_i10000000000000000000: i10000000000000000000; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+4]]:33-53: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: -// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+4]]:34: error: found a type literal with a bit width using 20 digits, which is greater than the limit of 18 [TooManyTypeBitWidthDigits] -// CHECK:STDERR: var test_i10000000000000000000: i10000000000000000000; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+2]]:34: error: found a type literal with a bit width using 20 digits, which is greater than the limit of 18 [TooManyTypeBitWidthDigits] // CHECK:STDERR: var test_i10000000000000000000: i10000000000000000000; // --- fail_uN_bad_width.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+4]]:14: error: name `u0` not found [NameNotFound] -// CHECK:STDERR: var test_u0: u0; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+2]]:14-15: error: name `u0` not found [NameNotFound] // CHECK:STDERR: var test_u0: u0; -// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+4]]:14: error: bit width of integer type literal must be a multiple of 8; use `Core.UInt(1)` instead [IntWidthNotMultipleOf8] -// CHECK:STDERR: var test_u1: u1; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+2]]:14-15: error: bit width of integer type literal must be a multiple of 8; use `Core.UInt(1)` instead [IntWidthNotMultipleOf8] // CHECK:STDERR: var test_u1: u1; -// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+4]]:15: error: bit width of integer type literal must be a multiple of 8; use `Core.UInt(15)` instead [IntWidthNotMultipleOf8] -// CHECK:STDERR: var test_u15: u15; -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+2]]:15-17: error: bit width of integer type literal must be a multiple of 8; use `Core.UInt(15)` instead [IntWidthNotMultipleOf8] // CHECK:STDERR: var test_u15: u15; -// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+4]]:14: error: bit width of integer type literal must be a multiple of 8; use `Core.UInt(4)` instead [IntWidthNotMultipleOf8] -// CHECK:STDERR: var test_u4: u4; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+2]]:14-15: error: bit width of integer type literal must be a multiple of 8; use `Core.UInt(4)` instead [IntWidthNotMultipleOf8] // CHECK:STDERR: var test_u4: u4; -// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+4]]:15: error: bit width of integer type literal must be a multiple of 8; use `Core.UInt(12)` instead [IntWidthNotMultipleOf8] -// CHECK:STDERR: var test_u12: u12; -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+2]]:15-17: error: bit width of integer type literal must be a multiple of 8; use `Core.UInt(12)` instead [IntWidthNotMultipleOf8] // CHECK:STDERR: var test_u12: u12; -// 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: fail_uN_bad_width.carbon:[[@LINE+3]]:23-33: error: binding pattern has incomplete type `u1000000000` in name binding declaration [IncompleteTypeInBindingDecl] +// CHECK:STDERR: min_prelude/parts/uint.carbon:11:9-19: note: integer type width of 1000000000 is greater than the maximum supported width of 8388608 [IntWidthTooLarge] // CHECK:STDERR: var test_u1000000000: u1000000000; // TODO: This diagnostic is not very good. -// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+8]]:33: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] -// CHECK:STDERR: var test_u10000000000000000000: u10000000000000000000; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+4]]:33-53: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: -// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+4]]:34: error: found a type literal with a bit width using 20 digits, which is greater than the limit of 18 [TooManyTypeBitWidthDigits] -// CHECK:STDERR: var test_u10000000000000000000: u10000000000000000000; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+2]]:34: error: found a type literal with a bit width using 20 digits, which is greater than the limit of 18 [TooManyTypeBitWidthDigits] // CHECK:STDERR: var test_u10000000000000000000: u10000000000000000000; // --- fail_fN_bad_width.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_fN_bad_width.carbon:[[@LINE+4]]:14: error: name `f0` not found [NameNotFound] -// CHECK:STDERR: var test_f0: f0; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_fN_bad_width.carbon:[[@LINE+2]]:14-15: error: name `f0` not found [NameNotFound] // CHECK:STDERR: var test_f0: f0; -// 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: 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+3]]:14-15: error: binding pattern has incomplete type `f1` in name binding declaration [IncompleteTypeInBindingDecl] +// CHECK:STDERR: min_prelude/parts/float.carbon:12:9-20: note: unsupported floating-point bit width 1 [CompileTimeFloatBitWidth] // 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: fail_fN_bad_width.carbon:[[@LINE+3]]:15-17: error: binding pattern has incomplete type `f15` in name binding declaration [IncompleteTypeInBindingDecl] +// CHECK:STDERR: min_prelude/parts/float.carbon:12:9-20: note: unsupported floating-point bit width 15 [CompileTimeFloatBitWidth] // CHECK:STDERR: var test_f15: f15; // TODO: Decide if we want to expose the x87 80-bit floating point type this way. -// 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: fail_fN_bad_width.carbon:[[@LINE+3]]:15-17: error: binding pattern has incomplete type `f80` in name binding declaration [IncompleteTypeInBindingDecl] +// CHECK:STDERR: min_prelude/parts/float.carbon:12:9-20: note: unsupported floating-point bit width 80 [CompileTimeFloatBitWidth] // CHECK:STDERR: var test_f80: f80; -// 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: fail_fN_bad_width.carbon:[[@LINE+3]]:16-19: error: binding pattern has incomplete type `f100` in name binding declaration [IncompleteTypeInBindingDecl] +// CHECK:STDERR: min_prelude/parts/float.carbon:12:9-20: note: unsupported floating-point bit width 100 [CompileTimeFloatBitWidth] // CHECK:STDERR: var test_f100: f100; -// 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: 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+3]]:23-33: error: binding pattern has incomplete type `f1000000000` in name binding declaration [IncompleteTypeInBindingDecl] +// CHECK:STDERR: min_prelude/parts/float.carbon:12:9-20: note: unsupported floating-point bit width 1000000000 [CompileTimeFloatBitWidth] // 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: fail_fN_bad_width.carbon:[[@LINE+3]]:26-39: error: binding pattern has incomplete type `f1000000000000` in name binding declaration [IncompleteTypeInBindingDecl] +// CHECK:STDERR: min_prelude/parts/float.carbon:12:9-20: note: unsupported floating-point bit width 1000000000000 [CompileTimeFloatBitWidth] // CHECK:STDERR: var test_f1000000000000: f1000000000000; @@ -220,12 +158,8 @@ var test_f1000000000000: f1000000000000; 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)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var x: type = 42; -// CHECK:STDERR: ^~~~~~~~~~~ +// CHECK:STDERR: fail_non_type_as_type.carbon:[[@LINE+3]]:1-11: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] +// CHECK:STDERR: fail_non_type_as_type.carbon:[[@LINE+2]]:1-11: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var x: type = 42; @@ -235,57 +169,33 @@ library "[[@TEST_NAME]]"; // Ensure that type literals get stringified properly. -// 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)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var test_i32: i32 = (); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+3]]:1-17: error: cannot implicitly convert expression of type `()` to `i32` [ConversionFailure] +// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+2]]:1-17: note: type `()` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: 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)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var test_f32: f32 = (); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+3]]:1-17: error: cannot implicitly convert expression of type `()` to `f32` [ConversionFailure] +// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+2]]:1-17: note: type `()` does not implement interface `Core.ImplicitAs(f32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: 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)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var test_u32: u32 = (); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+3]]:1-17: error: cannot implicitly convert expression of type `()` to `u32` [ConversionFailure] +// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+2]]:1-17: note: type `()` does not implement interface `Core.ImplicitAs(u32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: 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)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var test_bool: bool = (); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+3]]:1-19: error: cannot implicitly convert expression of type `()` to `bool` [ConversionFailure] +// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+2]]:1-19: note: type `()` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: 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)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var test_char: char = (); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+3]]:1-19: error: cannot implicitly convert expression of type `()` to `char` [ConversionFailure] +// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+2]]:1-19: note: type `()` does not implement interface `Core.ImplicitAs(char)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: 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)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var test_str: str = (); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+3]]:1-17: error: cannot implicitly convert expression of type `()` to `str` [ConversionFailure] +// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+2]]:1-17: note: type `()` does not implement interface `Core.ImplicitAs(str)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var test_str: str = (); diff --git a/toolchain/check/testdata/return/fail_call_in_type.carbon b/toolchain/check/testdata/return/fail_call_in_type.carbon index 244c024f6045..7c359ab9935b 100644 --- a/toolchain/check/testdata/return/fail_call_in_type.carbon +++ b/toolchain/check/testdata/return/fail_call_in_type.carbon @@ -15,9 +15,7 @@ // TODO: Some variant of this should work, once compile-time function calls are // supported. fn ReturnType() -> type { return i32; } -// CHECK:STDERR: fail_call_in_type.carbon:[[@LINE+4]]:13: error: cannot evaluate type expression [TypeExprEvaluationFailure] -// CHECK:STDERR: fn Six() -> ReturnType() { return 6; } -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_call_in_type.carbon:[[@LINE+2]]:13-24: error: cannot evaluate type expression [TypeExprEvaluationFailure] // CHECK:STDERR: fn Six() -> ReturnType() { return 6; } @@ -82,8 +80,8 @@ fn Six() -> ReturnType() { return 6; } // CHECK:STDOUT: } { // CHECK:STDOUT: %ReturnType.ref: %ReturnType.type = name_ref ReturnType, file.%ReturnType.decl [concrete = constants.%ReturnType] // CHECK:STDOUT: %ReturnType.call: init type = call %ReturnType.ref() -// CHECK:STDOUT: %.loc22_24.1: type = value_of_initializer %ReturnType.call -// CHECK:STDOUT: %.loc22_24.2: type = converted %ReturnType.call, %.loc22_24.1 +// CHECK:STDOUT: %.loc20_24.1: type = value_of_initializer %ReturnType.call +// CHECK:STDOUT: %.loc20_24.2: type = converted %ReturnType.call, %.loc20_24.1 // CHECK:STDOUT: %return: = return_slot // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/return/fail_error_in_type.carbon b/toolchain/check/testdata/return/fail_error_in_type.carbon index d4aa3ea76bbe..29c9795e8b38 100644 --- a/toolchain/check/testdata/return/fail_error_in_type.carbon +++ b/toolchain/check/testdata/return/fail_error_in_type.carbon @@ -12,9 +12,7 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_error_in_type.carbon -// CHECK:STDERR: fail_error_in_type.carbon:[[@LINE+4]]:13: error: name `x` not found [NameNotFound] -// CHECK:STDERR: fn Six() -> x; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_error_in_type.carbon:[[@LINE+2]]:13: error: name `x` not found [NameNotFound] // CHECK:STDERR: fn Six() -> x; diff --git a/toolchain/check/testdata/return/fail_let_in_type.carbon b/toolchain/check/testdata/return/fail_let_in_type.carbon index a8ae19375b52..897866bab309 100644 --- a/toolchain/check/testdata/return/fail_let_in_type.carbon +++ b/toolchain/check/testdata/return/fail_let_in_type.carbon @@ -13,33 +13,23 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_let_in_type.carbon let x: type = i32; -// CHECK:STDERR: fail_let_in_type.carbon:[[@LINE+4]]:13: error: cannot evaluate type expression [TypeExprEvaluationFailure] -// CHECK:STDERR: fn Six() -> x { return 6; } -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_let_in_type.carbon:[[@LINE+2]]:13: error: cannot evaluate type expression [TypeExprEvaluationFailure] // CHECK:STDERR: fn Six() -> x { return 6; } // TODO: This should probably work. -// CHECK:STDERR: fail_let_in_type.carbon:[[@LINE+4]]:13: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] -// CHECK:STDERR: let generic y: type = i32; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_let_in_type.carbon:[[@LINE+2]]:13-19: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] // CHECK:STDERR: let generic y: type = i32; -// CHECK:STDERR: fail_let_in_type.carbon:[[@LINE+4]]:19: error: cannot evaluate type expression [TypeExprEvaluationFailure] -// CHECK:STDERR: fn HalfDozen() -> y { return 6; } -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_let_in_type.carbon:[[@LINE+2]]:19: error: cannot evaluate type expression [TypeExprEvaluationFailure] // CHECK:STDERR: fn HalfDozen() -> y { return 6; } // TODO: This should work. -// CHECK:STDERR: fail_let_in_type.carbon:[[@LINE+4]]:5: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] -// CHECK:STDERR: let template z: type = i32; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_let_in_type.carbon:[[@LINE+2]]:5-20: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] // CHECK:STDERR: let template z: type = i32; -// CHECK:STDERR: fail_let_in_type.carbon:[[@LINE+4]]:28: error: cannot evaluate type expression [TypeExprEvaluationFailure] -// CHECK:STDERR: fn FirstPerfectNumber() -> z { return 6; } -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_let_in_type.carbon:[[@LINE+2]]:28: error: cannot evaluate type expression [TypeExprEvaluationFailure] // CHECK:STDERR: fn FirstPerfectNumber() -> z { return 6; } @@ -96,11 +86,11 @@ fn FirstPerfectNumber() -> z { return 6; } // CHECK:STDOUT: %x.ref: type = name_ref x, file.%x // CHECK:STDOUT: %return: = return_slot // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc27_16.1: type = splice_block %.loc27_16.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc27: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc27_16.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc23_16.1: type = splice_block %.loc23_16.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc23: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc23_16.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %y: type = wrapper_binding y, @__global_init.%i32.loc27 +// CHECK:STDOUT: %y: type = wrapper_binding y, @__global_init.%i32.loc23 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %y.patt: %pattern_type.9a5 = value_binding_pattern y [concrete = constants.%y.patt] // CHECK:STDOUT: } @@ -110,11 +100,11 @@ fn FirstPerfectNumber() -> z { return 6; } // CHECK:STDOUT: %y.ref: type = name_ref y, file.%y // CHECK:STDOUT: %return: = return_slot // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc39_17.1: type = splice_block %.loc39_17.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc39: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc39_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc31_17.1: type = splice_block %.loc31_17.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc31: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc31_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %z: type = wrapper_binding z, @__global_init.%i32.loc39 +// CHECK:STDOUT: %z: type = wrapper_binding z, @__global_init.%i32.loc31 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %z.patt: %pattern_type.9a5 = value_binding_pattern z [concrete = constants.%z.patt] // CHECK:STDOUT: } @@ -147,8 +137,8 @@ fn FirstPerfectNumber() -> z { return 6; } // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %i32.loc15: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %i32.loc27: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %i32.loc39: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc23: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc31: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_missing_return.carbon b/toolchain/check/testdata/return/fail_missing_return.carbon index 233bf7df87e7..51e4aef82afa 100644 --- a/toolchain/check/testdata/return/fail_missing_return.carbon +++ b/toolchain/check/testdata/return/fail_missing_return.carbon @@ -13,9 +13,7 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_missing_return.carbon fn Main() -> i32 { -// CHECK:STDERR: fail_missing_return.carbon:[[@LINE+4]]:1: error: missing `return` at end of function with declared return type [MissingReturnStatement] -// CHECK:STDERR: } -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_missing_return.carbon:[[@LINE+2]]:1: error: missing `return` at end of function with declared return type [MissingReturnStatement] // CHECK:STDERR: } diff --git a/toolchain/check/testdata/return/fail_missing_return_empty_tuple.carbon b/toolchain/check/testdata/return/fail_missing_return_empty_tuple.carbon index 13d9627f4005..fd98863c0cd5 100644 --- a/toolchain/check/testdata/return/fail_missing_return_empty_tuple.carbon +++ b/toolchain/check/testdata/return/fail_missing_return_empty_tuple.carbon @@ -13,9 +13,7 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_missing_return_empty_tuple.carbon fn F() -> () { -// CHECK:STDERR: fail_missing_return_empty_tuple.carbon:[[@LINE+4]]:1: error: missing `return` at end of function with declared return type [MissingReturnStatement] -// CHECK:STDERR: } -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_missing_return_empty_tuple.carbon:[[@LINE+2]]:1: error: missing `return` at end of function with declared return type [MissingReturnStatement] // CHECK:STDERR: } diff --git a/toolchain/check/testdata/return/fail_ref_return.carbon b/toolchain/check/testdata/return/fail_ref_return.carbon index aff1f3c6e9bc..e16a814fa3ef 100644 --- a/toolchain/check/testdata/return/fail_ref_return.carbon +++ b/toolchain/check/testdata/return/fail_ref_return.carbon @@ -11,9 +11,7 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_ref_return.carbon fn F() -> ref i32 { - // CHECK:STDERR: fail_ref_return.carbon:[[@LINE+4]]:3: error: cannot bind durable reference to non-reference value of type `i32` [ConversionFailureNonRefToRef] - // CHECK:STDERR: return 0; - // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_ref_return.carbon:[[@LINE+2]]:3-11: error: cannot bind durable reference to non-reference value of type `i32` [ConversionFailureNonRefToRef] // CHECK:STDERR: return 0; } diff --git a/toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon b/toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon index e45f183c7402..b3ed67e000a8 100644 --- a/toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon +++ b/toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon @@ -13,9 +13,7 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon fn Procedure() -> {} { - // CHECK:STDERR: fail_return_var_no_returned_var.carbon:[[@LINE+4]]:3: error: `return var;` with no `returned var` in scope [ReturnVarWithNoReturnedVar] - // CHECK:STDERR: return var; - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_return_var_no_returned_var.carbon:[[@LINE+2]]:3-13: error: `return var;` with no `returned var` in scope [ReturnVarWithNoReturnedVar] // CHECK:STDERR: return var; } diff --git a/toolchain/check/testdata/return/fail_return_with_returned_var.carbon b/toolchain/check/testdata/return/fail_return_with_returned_var.carbon index 947db9f0c341..6f271c642afc 100644 --- a/toolchain/check/testdata/return/fail_return_with_returned_var.carbon +++ b/toolchain/check/testdata/return/fail_return_with_returned_var.carbon @@ -14,12 +14,8 @@ fn F() -> i32 { returned var v: i32 = 0; - // CHECK:STDERR: fail_return_with_returned_var.carbon:[[@LINE+7]]:3: error: can only `return var;` in the scope of a `returned var` [ReturnExprWithReturnedVar] - // CHECK:STDERR: return 1; - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_return_with_returned_var.carbon:[[@LINE-4]]:16: note: `returned var` was declared here [ReturnedVarHere] - // CHECK:STDERR: returned var v: i32 = 0; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_return_with_returned_var.carbon:[[@LINE+3]]:3-11: error: can only `return var;` in the scope of a `returned var` [ReturnExprWithReturnedVar] + // CHECK:STDERR: fail_return_with_returned_var.carbon:[[@LINE-2]]:16-21: note: `returned var` was declared here [ReturnedVarHere] // CHECK:STDERR: return 1; } @@ -27,12 +23,8 @@ fn F() -> i32 { class C { var a: i32; var b: i32; } fn G() -> C { returned var c: C = {.a = 1, .b = 2}; - // CHECK:STDERR: fail_return_with_returned_var.carbon:[[@LINE+7]]:3: error: can only `return var;` in the scope of a `returned var` [ReturnExprWithReturnedVar] - // CHECK:STDERR: return c; - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_return_with_returned_var.carbon:[[@LINE-4]]:16: note: `returned var` was declared here [ReturnedVarHere] - // CHECK:STDERR: returned var c: C = {.a = 1, .b = 2}; - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_return_with_returned_var.carbon:[[@LINE+3]]:3-11: error: can only `return var;` in the scope of a `returned var` [ReturnExprWithReturnedVar] + // CHECK:STDERR: fail_return_with_returned_var.carbon:[[@LINE-2]]:16-19: note: `returned var` was declared here [ReturnedVarHere] // CHECK:STDERR: return c; } @@ -157,29 +149,29 @@ fn G() -> C { // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {} // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] { // CHECK:STDOUT: %return.param_patt: %pattern_type.98b = out_param_pattern [concrete = constants.%return.param_patt.89a] -// CHECK:STDOUT: %return.patt: %pattern_type.98b = return_slot_pattern %return.param_patt, %C.ref.loc28 [concrete = constants.%return.patt.e4a] +// CHECK:STDOUT: %return.patt: %pattern_type.98b = return_slot_pattern %return.param_patt, %C.ref.loc24 [concrete = constants.%return.patt.e4a] // CHECK:STDOUT: } { -// CHECK:STDOUT: %C.ref.loc28: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc28: Core.Form = init_form %C.ref.loc28 [concrete = constants.%.a44] +// CHECK:STDOUT: %C.ref.loc24: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %.loc24: Core.Form = init_form %C.ref.loc24 [concrete = constants.%.a44] // CHECK:STDOUT: %return.param: ref %C = out_param call_param0 // CHECK:STDOUT: %return: ref %C = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %field_decl.loc27_16: %C.elem = field_decl a, element0, %i32.loc27_18 in [concrete] { -// CHECK:STDOUT: %i32.loc27_18: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %field_decl.loc23_16: %C.elem = field_decl a, element0, %i32.loc23_18 in [concrete] { +// CHECK:STDOUT: %i32.loc23_18: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: } -// CHECK:STDOUT: %field_decl.loc27_28: %C.elem = field_decl b, element1, %i32.loc27_30 in [concrete] { -// CHECK:STDOUT: %i32.loc27_30: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %field_decl.loc23_28: %C.elem = field_decl b, element1, %i32.loc23_30 in [concrete] { +// CHECK:STDOUT: %i32.loc23_30: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%struct_type.a.b.250 [concrete = constants.%complete_type.eb8] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C -// CHECK:STDOUT: .a = %field_decl.loc27_16 -// CHECK:STDOUT: .b = %field_decl.loc27_28 +// CHECK:STDOUT: .a = %field_decl.loc23_16 +// CHECK:STDOUT: .b = %field_decl.loc23_28 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> out %return.param: %i32 { @@ -220,27 +212,27 @@ fn G() -> C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %.loc29_38.1: %struct_type.a.b.cfd = struct_literal (%int_1, %int_2) [concrete = constants.%struct] -// CHECK:STDOUT: %impl.elem0.loc29_38.1: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc29_38.1: = bound_method %int_1, %impl.elem0.loc29_38.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] -// CHECK:STDOUT: %specific_fn.loc29_38.1: = specific_function %impl.elem0.loc29_38.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc29_38.2: = bound_method %int_1, %specific_fn.loc29_38.1 [concrete = constants.%bound_method.3bd] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc29_38.1: init %i32 = call %bound_method.loc29_38.2(%int_1) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc29_38.2: init %i32 = converted %int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc29_38.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc29_38.3: ref %i32 = class_element_access %return.param, element0 -// CHECK:STDOUT: %.loc29_38.4: init %i32 to %.loc29_38.3 = in_place_init %.loc29_38.2 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %impl.elem0.loc29_38.2: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc29_38.3: = bound_method %int_2, %impl.elem0.loc29_38.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6] -// CHECK:STDOUT: %specific_fn.loc29_38.2: = specific_function %impl.elem0.loc29_38.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc29_38.4: = bound_method %int_2, %specific_fn.loc29_38.2 [concrete = constants.%bound_method.a55] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc29_38.2: init %i32 = call %bound_method.loc29_38.4(%int_2) [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc29_38.5: init %i32 = converted %int_2, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc29_38.2 [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc29_38.6: ref %i32 = class_element_access %return.param, element1 -// CHECK:STDOUT: %.loc29_38.7: init %i32 to %.loc29_38.6 = in_place_init %.loc29_38.5 [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc29_38.8: init %C to %return.param = class_init (%.loc29_38.4, %.loc29_38.7) [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc29_12: init %C = converted %.loc29_38.1, %.loc29_38.8 [concrete = constants.%C.val] -// CHECK:STDOUT: assign %return.param, %.loc29_12 -// CHECK:STDOUT: %C.ref.loc29: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %.loc25_38.1: %struct_type.a.b.cfd = struct_literal (%int_1, %int_2) [concrete = constants.%struct] +// CHECK:STDOUT: %impl.elem0.loc25_38.1: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc25_38.1: = bound_method %int_1, %impl.elem0.loc25_38.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] +// CHECK:STDOUT: %specific_fn.loc25_38.1: = specific_function %impl.elem0.loc25_38.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc25_38.2: = bound_method %int_1, %specific_fn.loc25_38.1 [concrete = constants.%bound_method.3bd] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc25_38.1: init %i32 = call %bound_method.loc25_38.2(%int_1) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc25_38.2: init %i32 = converted %int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc25_38.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc25_38.3: ref %i32 = class_element_access %return.param, element0 +// CHECK:STDOUT: %.loc25_38.4: init %i32 to %.loc25_38.3 = in_place_init %.loc25_38.2 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %impl.elem0.loc25_38.2: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc25_38.3: = bound_method %int_2, %impl.elem0.loc25_38.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6] +// CHECK:STDOUT: %specific_fn.loc25_38.2: = specific_function %impl.elem0.loc25_38.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc25_38.4: = bound_method %int_2, %specific_fn.loc25_38.2 [concrete = constants.%bound_method.a55] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc25_38.2: init %i32 = call %bound_method.loc25_38.4(%int_2) [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc25_38.5: init %i32 = converted %int_2, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc25_38.2 [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc25_38.6: ref %i32 = class_element_access %return.param, element1 +// CHECK:STDOUT: %.loc25_38.7: init %i32 to %.loc25_38.6 = in_place_init %.loc25_38.5 [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc25_38.8: init %C to %return.param = class_init (%.loc25_38.4, %.loc25_38.7) [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc25_12: init %C = converted %.loc25_38.1, %.loc25_38.8 [concrete = constants.%C.val] +// CHECK:STDOUT: assign %return.param, %.loc25_12 +// CHECK:STDOUT: %C.ref.loc25: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %c: ref %C = wrapper_binding c, %return.param // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %c.patt: %pattern_type.98b = ref_binding_pattern c [concrete = constants.%c.patt] diff --git a/toolchain/check/testdata/return/fail_returned_var_form.carbon b/toolchain/check/testdata/return/fail_returned_var_form.carbon index 5348cb31853b..12d09424bea0 100644 --- a/toolchain/check/testdata/return/fail_returned_var_form.carbon +++ b/toolchain/check/testdata/return/fail_returned_var_form.carbon @@ -12,12 +12,8 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_returned_var_form.carbon fn Mismatch() -> ref () { - // CHECK:STDERR: fail_returned_var_form.carbon:[[@LINE+7]]:3: error: `returned var` declaration in function with non-initializing return form [ReturnedVarNotInit] - // CHECK:STDERR: returned var v: () = (); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_returned_var_form.carbon:[[@LINE-4]]:18: note: return form declared here [ReturnFormHereNote] - // CHECK:STDERR: fn Mismatch() -> ref () { - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_returned_var_form.carbon:[[@LINE+3]]:3-10: error: `returned var` declaration in function with non-initializing return form [ReturnedVarNotInit] + // CHECK:STDERR: fail_returned_var_form.carbon:[[@LINE-2]]:18-23: note: return form declared here [ReturnFormHereNote] // CHECK:STDERR: returned var v: () = (); return var; diff --git a/toolchain/check/testdata/return/fail_returned_var_no_return_type.carbon b/toolchain/check/testdata/return/fail_returned_var_no_return_type.carbon index 7c1d820d6b01..424fdfcc3608 100644 --- a/toolchain/check/testdata/return/fail_returned_var_no_return_type.carbon +++ b/toolchain/check/testdata/return/fail_returned_var_no_return_type.carbon @@ -17,12 +17,8 @@ library "[[@TEST_NAME]]"; fn Procedure() { - // CHECK:STDERR: fail_procedure_with_returned_var.carbon:[[@LINE+7]]:3: error: cannot declare a `returned var` in this function [ReturnedVarWithNoReturnType] - // CHECK:STDERR: returned var unused v: () = (); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_procedure_with_returned_var.carbon:[[@LINE-4]]:1: note: there was no return type provided [ReturnTypeOmittedNote] - // CHECK:STDERR: fn Procedure() { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_procedure_with_returned_var.carbon:[[@LINE+3]]:3-10: error: cannot declare a `returned var` in this function [ReturnedVarWithNoReturnType] + // CHECK:STDERR: fail_procedure_with_returned_var.carbon:[[@LINE-2]]:1-16: note: there was no return type provided [ReturnTypeOmittedNote] // CHECK:STDERR: returned var unused v: () = (); return; @@ -33,17 +29,11 @@ fn Procedure() { library "[[@TEST_NAME]]"; fn ForgotReturnType() { - // CHECK:STDERR: fail_forgot_return_type.carbon:[[@LINE+7]]:3: error: cannot declare a `returned var` in this function [ReturnedVarWithNoReturnType] - // CHECK:STDERR: returned var unused v: () = (); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_forgot_return_type.carbon:[[@LINE-4]]:1: note: there was no return type provided [ReturnTypeOmittedNote] - // CHECK:STDERR: fn ForgotReturnType() { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_forgot_return_type.carbon:[[@LINE+3]]:3-10: error: cannot declare a `returned var` in this function [ReturnedVarWithNoReturnType] + // CHECK:STDERR: fail_forgot_return_type.carbon:[[@LINE-2]]:1-23: note: there was no return type provided [ReturnTypeOmittedNote] // CHECK:STDERR: returned var unused v: () = (); - // CHECK:STDERR: fail_forgot_return_type.carbon:[[@LINE+4]]:3: error: `return var;` with no `returned var` in scope [ReturnVarWithNoReturnedVar] - // CHECK:STDERR: return var; - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_forgot_return_type.carbon:[[@LINE+2]]:3-13: error: `return var;` with no `returned var` in scope [ReturnVarWithNoReturnedVar] // CHECK:STDERR: return var; } @@ -62,11 +52,11 @@ fn ForgotReturnType() { // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] // CHECK:STDOUT: %self.param_patt.65a: %pattern_type.cb1 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.df1: %pattern_type.cb1 = wrapper_binding_pattern self, %self.param_patt.65a [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfc: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc12 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfc: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc8 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01: %Destroy.WithSelf.SubobjectDestroy.type.dfc = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef0: type = fn_type @Destroy.WithSelf.Op.loc12 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef0: type = fn_type @Destroy.WithSelf.Op.loc8 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403: %Destroy.WithSelf.Op.type.ef0 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbc: type = fn_type @Destroy.WithSelf.SelfDestruct.loc12 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbc: type = fn_type @Destroy.WithSelf.SelfDestruct.loc8 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3: %Destroy.WithSelf.SelfDestruct.type.fbc = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -80,14 +70,14 @@ fn ForgotReturnType() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl: %Destroy.WithSelf.SubobjectDestroy.type.dfc = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc12 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl: %Destroy.WithSelf.SubobjectDestroy.type.dfc = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc8 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01] { // CHECK:STDOUT: %self.param_patt: %pattern_type.cb1 = ref_param_pattern [concrete = constants.%self.param_patt.65a] // CHECK:STDOUT: %self.patt: %pattern_type.cb1 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.df1] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %empty_tuple.type = ref_param call_param0 // CHECK:STDOUT: %self: ref %empty_tuple.type = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl: %Destroy.WithSelf.Op.type.ef0 = fn_decl @Destroy.WithSelf.Op.loc12 [concrete = constants.%Destroy.WithSelf.Op.403] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl: %Destroy.WithSelf.Op.type.ef0 = fn_decl @Destroy.WithSelf.Op.loc8 [concrete = constants.%Destroy.WithSelf.Op.403] { // CHECK:STDOUT: %self.param_patt: %pattern_type.cb1 = ref_param_pattern [concrete = constants.%self.param_patt.65a] // CHECK:STDOUT: %self.patt: %pattern_type.cb1 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.df1] // CHECK:STDOUT: } { @@ -108,13 +98,13 @@ fn ForgotReturnType() { // CHECK:STDOUT: fn @Procedure() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %v.var: ref %empty_tuple.type = var_storage %v.var_patt -// CHECK:STDOUT: %.loc12_32.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc12_32.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc12_12: init %empty_tuple.type = converted %.loc12_32.1, %.loc12_32.2 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: assign %v.var, %.loc12_12 -// CHECK:STDOUT: %.loc12_27.1: type = splice_block %.loc12_27.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc12_27.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc12_27.3: type = converted %.loc12_27.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc8_32.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_32.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_12: init %empty_tuple.type = converted %.loc8_32.1, %.loc8_32.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: assign %v.var, %.loc8_12 +// CHECK:STDOUT: %.loc8_27.1: type = splice_block %.loc8_27.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc8_27.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_27.3: type = converted %.loc8_27.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %v: ref %empty_tuple.type = wrapper_binding v, %v.var // CHECK:STDOUT: name_binding_decl { @@ -126,11 +116,11 @@ fn ForgotReturnType() { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc12(%self.param: ref %empty_tuple.type) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc8(%self.param: ref %empty_tuple.type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc12(%self.param: ref %empty_tuple.type) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc8(%self.param: ref %empty_tuple.type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc12(%self.param: ref %empty_tuple.type) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc8(%self.param: ref %empty_tuple.type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl(%self.param) @@ -151,11 +141,11 @@ fn ForgotReturnType() { // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] // CHECK:STDOUT: %self.param_patt.65a: %pattern_type.cb1 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.df1: %pattern_type.cb1 = wrapper_binding_pattern self, %self.param_patt.65a [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfc: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc12 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfc: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc8 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01: %Destroy.WithSelf.SubobjectDestroy.type.dfc = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef0: type = fn_type @Destroy.WithSelf.Op.loc12 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef0: type = fn_type @Destroy.WithSelf.Op.loc8 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403: %Destroy.WithSelf.Op.type.ef0 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbc: type = fn_type @Destroy.WithSelf.SelfDestruct.loc12 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbc: type = fn_type @Destroy.WithSelf.SelfDestruct.loc8 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3: %Destroy.WithSelf.SelfDestruct.type.fbc = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -169,14 +159,14 @@ fn ForgotReturnType() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl: %Destroy.WithSelf.SubobjectDestroy.type.dfc = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc12 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl: %Destroy.WithSelf.SubobjectDestroy.type.dfc = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc8 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01] { // CHECK:STDOUT: %self.param_patt: %pattern_type.cb1 = ref_param_pattern [concrete = constants.%self.param_patt.65a] // CHECK:STDOUT: %self.patt: %pattern_type.cb1 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.df1] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %empty_tuple.type = ref_param call_param0 // CHECK:STDOUT: %self: ref %empty_tuple.type = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl: %Destroy.WithSelf.Op.type.ef0 = fn_decl @Destroy.WithSelf.Op.loc12 [concrete = constants.%Destroy.WithSelf.Op.403] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl: %Destroy.WithSelf.Op.type.ef0 = fn_decl @Destroy.WithSelf.Op.loc8 [concrete = constants.%Destroy.WithSelf.Op.403] { // CHECK:STDOUT: %self.param_patt: %pattern_type.cb1 = ref_param_pattern [concrete = constants.%self.param_patt.65a] // CHECK:STDOUT: %self.patt: %pattern_type.cb1 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.df1] // CHECK:STDOUT: } { @@ -197,13 +187,13 @@ fn ForgotReturnType() { // CHECK:STDOUT: fn @ForgotReturnType() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %v.var: ref %empty_tuple.type = var_storage %v.var_patt -// CHECK:STDOUT: %.loc12_32.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc12_32.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc12_12: init %empty_tuple.type = converted %.loc12_32.1, %.loc12_32.2 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: assign %v.var, %.loc12_12 -// CHECK:STDOUT: %.loc12_27.1: type = splice_block %.loc12_27.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc12_27.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc12_27.3: type = converted %.loc12_27.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc8_32.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_32.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_12: init %empty_tuple.type = converted %.loc8_32.1, %.loc8_32.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: assign %v.var, %.loc8_12 +// CHECK:STDOUT: %.loc8_27.1: type = splice_block %.loc8_27.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc8_27.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_27.3: type = converted %.loc8_27.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %v: ref %empty_tuple.type = wrapper_binding v, %v.var // CHECK:STDOUT: name_binding_decl { @@ -215,11 +205,11 @@ fn ForgotReturnType() { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc12(%self.param: ref %empty_tuple.type) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc8(%self.param: ref %empty_tuple.type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc12(%self.param: ref %empty_tuple.type) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc8(%self.param: ref %empty_tuple.type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc12(%self.param: ref %empty_tuple.type) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc8(%self.param: ref %empty_tuple.type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl(%self.param) diff --git a/toolchain/check/testdata/return/fail_returned_var_shadow.carbon b/toolchain/check/testdata/return/fail_returned_var_shadow.carbon index 194a340bc75f..10f2a0cdf157 100644 --- a/toolchain/check/testdata/return/fail_returned_var_shadow.carbon +++ b/toolchain/check/testdata/return/fail_returned_var_shadow.carbon @@ -15,12 +15,8 @@ fn SameScope() -> i32 { if (true) { returned var v: i32 = 0; - // CHECK:STDERR: fail_returned_var_shadow.carbon:[[@LINE+7]]:25: error: cannot declare a `returned var` in the scope of another `returned var` [ReturnedVarShadowed] - // CHECK:STDERR: returned var unused w: i32 = 1; - // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_returned_var_shadow.carbon:[[@LINE-4]]:18: note: `returned var` was declared here [ReturnedVarHere] - // CHECK:STDERR: returned var v: i32 = 0; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_returned_var_shadow.carbon:[[@LINE+3]]:25-30: error: cannot declare a `returned var` in the scope of another `returned var` [ReturnedVarShadowed] + // CHECK:STDERR: fail_returned_var_shadow.carbon:[[@LINE-2]]:18-23: note: `returned var` was declared here [ReturnedVarHere] // CHECK:STDERR: returned var unused w: i32 = 1; } @@ -31,12 +27,8 @@ fn DifferentScopes() -> i32 { if (true) { returned var v: i32 = 0; if (true) { - // CHECK:STDERR: fail_returned_var_shadow.carbon:[[@LINE+7]]:27: error: cannot declare a `returned var` in the scope of another `returned var` [ReturnedVarShadowed] - // CHECK:STDERR: returned var unused w: i32 = 1; - // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_returned_var_shadow.carbon:[[@LINE-5]]:18: note: `returned var` was declared here [ReturnedVarHere] - // CHECK:STDERR: returned var v: i32 = 0; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_returned_var_shadow.carbon:[[@LINE+3]]:27-32: error: cannot declare a `returned var` in the scope of another `returned var` [ReturnedVarShadowed] + // CHECK:STDERR: fail_returned_var_shadow.carbon:[[@LINE-3]]:18-23: note: `returned var` was declared here [ReturnedVarHere] // CHECK:STDERR: returned var unused w: i32 = 1; } @@ -88,11 +80,11 @@ fn DifferentScopes() -> i32 { // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] // CHECK:STDOUT: %self.param_patt.0c5: %pattern_type.d94 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.749: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt.0c5 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfc: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc25 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfc: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc21 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01: %Destroy.WithSelf.SubobjectDestroy.type.dfc = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef0: type = fn_type @Destroy.WithSelf.Op.loc25 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef0: type = fn_type @Destroy.WithSelf.Op.loc21 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403: %Destroy.WithSelf.Op.type.ef0 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbc: type = fn_type @Destroy.WithSelf.SelfDestruct.loc25 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbc: type = fn_type @Destroy.WithSelf.SelfDestruct.loc21 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3: %Destroy.WithSelf.SelfDestruct.type.fbc = struct_value () [concrete] // CHECK:STDOUT: %DifferentScopes.type: type = fn_type @DifferentScopes [concrete] // CHECK:STDOUT: %DifferentScopes: %DifferentScopes.type = struct_value () [concrete] @@ -116,14 +108,14 @@ fn DifferentScopes() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl: %Destroy.WithSelf.SubobjectDestroy.type.dfc = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc25 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl: %Destroy.WithSelf.SubobjectDestroy.type.dfc = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc21 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d94 = ref_param_pattern [concrete = constants.%self.param_patt.0c5] // CHECK:STDOUT: %self.patt: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.749] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %i32 = ref_param call_param0 // CHECK:STDOUT: %self: ref %i32 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl: %Destroy.WithSelf.Op.type.ef0 = fn_decl @Destroy.WithSelf.Op.loc25 [concrete = constants.%Destroy.WithSelf.Op.403] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl: %Destroy.WithSelf.Op.type.ef0 = fn_decl @Destroy.WithSelf.Op.loc21 [concrete = constants.%Destroy.WithSelf.Op.403] { // CHECK:STDOUT: %self.param_patt: %pattern_type.d94 = ref_param_pattern [concrete = constants.%self.param_patt.0c5] // CHECK:STDOUT: %self.patt: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.749] // CHECK:STDOUT: } { @@ -150,10 +142,10 @@ fn DifferentScopes() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %DifferentScopes.decl: %DifferentScopes.type = fn_decl @DifferentScopes [concrete = constants.%DifferentScopes] { // CHECK:STDOUT: %return.param_patt: %pattern_type.d94 = out_param_pattern [concrete = constants.%return.param_patt.299] -// CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32.loc30 [concrete = constants.%return.patt.6fa] +// CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32.loc26 [concrete = constants.%return.patt.6fa] // CHECK:STDOUT: } { -// CHECK:STDOUT: %i32.loc30: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc30: Core.Form = init_form %i32.loc30 [concrete = constants.%.0b3] +// CHECK:STDOUT: %i32.loc26: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc26: Core.Form = init_form %i32.loc26 [concrete = constants.%.0b3] // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param0 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } @@ -182,41 +174,41 @@ fn DifferentScopes() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %w.var: ref %i32 = var_storage %w.var_patt // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %impl.elem0.loc25: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc25_14.1: = bound_method %int_1, %impl.elem0.loc25 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] -// CHECK:STDOUT: %specific_fn.loc25: = specific_function %impl.elem0.loc25, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc25_14.2: = bound_method %int_1, %specific_fn.loc25 [concrete = constants.%bound_method.3bd] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc25: init %i32 = call %bound_method.loc25_14.2(%int_1) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc25: init %i32 = converted %int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc25 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: assign %w.var, %.loc25 -// CHECK:STDOUT: %i32.loc25: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %impl.elem0.loc21: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc21_14.1: = bound_method %int_1, %impl.elem0.loc21 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] +// CHECK:STDOUT: %specific_fn.loc21: = specific_function %impl.elem0.loc21, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc21_14.2: = bound_method %int_1, %specific_fn.loc21 [concrete = constants.%bound_method.3bd] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc21: init %i32 = call %bound_method.loc21_14.2(%int_1) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc21: init %i32 = converted %int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc21 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: assign %w.var, %.loc21 +// CHECK:STDOUT: %i32.loc21: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %w: ref %i32 = wrapper_binding w, %w.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %w.patt: %pattern_type.d94 = ref_binding_pattern w [concrete = constants.%w.patt.26cad8.1] // CHECK:STDOUT: %w.var_patt: %pattern_type.d94 = var_pattern %w.patt [concrete = constants.%w.var_patt.4a607a.1] // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc25: = bound_method %w.var, constants.%Destroy.WithSelf.SelfDestruct.db3 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc25: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc25(%w.var) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc21: = bound_method %w.var, constants.%Destroy.WithSelf.SelfDestruct.db3 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc21: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc21(%w.var) // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc17: = bound_method %v.var, constants.%Destroy.WithSelf.SelfDestruct.db3 // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc17: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc17(%v.var) // CHECK:STDOUT: br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.else: -// CHECK:STDOUT: %int_0.loc27: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] -// CHECK:STDOUT: %impl.elem0.loc27: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc27_11.1: = bound_method %int_0.loc27, %impl.elem0.loc27 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] -// CHECK:STDOUT: %specific_fn.loc27: = specific_function %impl.elem0.loc27, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc27_11.2: = bound_method %int_0.loc27, %specific_fn.loc27 [concrete = constants.%bound_method.036] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc27: init %i32 = call %bound_method.loc27_11.2(%int_0.loc27) [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc27: init %i32 = converted %int_0.loc27, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc27 [concrete = constants.%int_0.753] -// CHECK:STDOUT: return %.loc27 +// CHECK:STDOUT: %int_0.loc23: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] +// CHECK:STDOUT: %impl.elem0.loc23: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc23_11.1: = bound_method %int_0.loc23, %impl.elem0.loc23 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] +// CHECK:STDOUT: %specific_fn.loc23: = specific_function %impl.elem0.loc23, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc23_11.2: = bound_method %int_0.loc23, %specific_fn.loc23 [concrete = constants.%bound_method.036] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc23: init %i32 = call %bound_method.loc23_11.2(%int_0.loc23) [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc23: init %i32 = converted %int_0.loc23, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc23 [concrete = constants.%int_0.753] +// CHECK:STDOUT: return %.loc23 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc25(%self.param: ref %i32) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc21(%self.param: ref %i32) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc25(%self.param: ref %i32) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc21(%self.param: ref %i32) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc25(%self.param: ref %i32) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc21(%self.param: ref %i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl(%self.param) @@ -225,61 +217,61 @@ fn DifferentScopes() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @DifferentScopes() -> out %return.param: %i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %true.loc31: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: if %true.loc31 br !if.then.loc31 else br !if.else.loc31 +// CHECK:STDOUT: %true.loc27: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: if %true.loc27 br !if.then.loc27 else br !if.else.loc27 // CHECK:STDOUT: -// CHECK:STDOUT: !if.then.loc31: +// CHECK:STDOUT: !if.then.loc27: // CHECK:STDOUT: %v.var: ref %i32 = var_storage %v.var_patt -// CHECK:STDOUT: %int_0.loc32: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] -// CHECK:STDOUT: %impl.elem0.loc32: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc32_14.1: = bound_method %int_0.loc32, %impl.elem0.loc32 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] -// CHECK:STDOUT: %specific_fn.loc32: = specific_function %impl.elem0.loc32, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc32_14.2: = bound_method %int_0.loc32, %specific_fn.loc32 [concrete = constants.%bound_method.036] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc32: init %i32 = call %bound_method.loc32_14.2(%int_0.loc32) [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc32: init %i32 = converted %int_0.loc32, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc32 [concrete = constants.%int_0.753] -// CHECK:STDOUT: assign %v.var, %.loc32 -// CHECK:STDOUT: %i32.loc32: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %int_0.loc28: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] +// CHECK:STDOUT: %impl.elem0.loc28: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc28_14.1: = bound_method %int_0.loc28, %impl.elem0.loc28 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] +// CHECK:STDOUT: %specific_fn.loc28: = specific_function %impl.elem0.loc28, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc28_14.2: = bound_method %int_0.loc28, %specific_fn.loc28 [concrete = constants.%bound_method.036] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc28: init %i32 = call %bound_method.loc28_14.2(%int_0.loc28) [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc28: init %i32 = converted %int_0.loc28, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc28 [concrete = constants.%int_0.753] +// CHECK:STDOUT: assign %v.var, %.loc28 +// CHECK:STDOUT: %i32.loc28: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %v: ref %i32 = wrapper_binding v, %v.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %v.patt: %pattern_type.d94 = ref_binding_pattern v [concrete = constants.%v.patt] // CHECK:STDOUT: %v.var_patt: %pattern_type.d94 = var_pattern %v.patt [concrete = constants.%v.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %true.loc33: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: if %true.loc33 br !if.then.loc33 else br !if.else.loc33 +// CHECK:STDOUT: %true.loc29: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: if %true.loc29 br !if.then.loc29 else br !if.else.loc29 // CHECK:STDOUT: -// CHECK:STDOUT: !if.then.loc33: +// CHECK:STDOUT: !if.then.loc29: // CHECK:STDOUT: %w.var: ref %i32 = var_storage %w.var_patt // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %impl.elem0.loc41: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc41_16.1: = bound_method %int_1, %impl.elem0.loc41 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] -// CHECK:STDOUT: %specific_fn.loc41: = specific_function %impl.elem0.loc41, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc41_16.2: = bound_method %int_1, %specific_fn.loc41 [concrete = constants.%bound_method.3bd] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc41: init %i32 = call %bound_method.loc41_16.2(%int_1) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc41: init %i32 = converted %int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc41 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: assign %w.var, %.loc41 -// CHECK:STDOUT: %i32.loc41: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %impl.elem0.loc33: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc33_16.1: = bound_method %int_1, %impl.elem0.loc33 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] +// CHECK:STDOUT: %specific_fn.loc33: = specific_function %impl.elem0.loc33, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc33_16.2: = bound_method %int_1, %specific_fn.loc33 [concrete = constants.%bound_method.3bd] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc33: init %i32 = call %bound_method.loc33_16.2(%int_1) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc33: init %i32 = converted %int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc33 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: assign %w.var, %.loc33 +// CHECK:STDOUT: %i32.loc33: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %w: ref %i32 = wrapper_binding w, %w.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %w.patt: %pattern_type.d94 = ref_binding_pattern w [concrete = constants.%w.patt.26cad8.2] // CHECK:STDOUT: %w.var_patt: %pattern_type.d94 = var_pattern %w.patt [concrete = constants.%w.var_patt.4a607a.2] // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc41: = bound_method %w.var, constants.%Destroy.WithSelf.SelfDestruct.db3 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc41: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc41(%w.var) -// CHECK:STDOUT: br !if.else.loc33 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc33: = bound_method %w.var, constants.%Destroy.WithSelf.SelfDestruct.db3 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc33: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc33(%w.var) +// CHECK:STDOUT: br !if.else.loc29 // CHECK:STDOUT: -// CHECK:STDOUT: !if.else.loc33: -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc32: = bound_method %v.var, constants.%Destroy.WithSelf.SelfDestruct.db3 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc32: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc32(%v.var) -// CHECK:STDOUT: br !if.else.loc31 +// CHECK:STDOUT: !if.else.loc29: +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc28: = bound_method %v.var, constants.%Destroy.WithSelf.SelfDestruct.db3 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc28: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc28(%v.var) +// CHECK:STDOUT: br !if.else.loc27 // CHECK:STDOUT: -// CHECK:STDOUT: !if.else.loc31: -// CHECK:STDOUT: %int_0.loc44: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] -// CHECK:STDOUT: %impl.elem0.loc44: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc44_11.1: = bound_method %int_0.loc44, %impl.elem0.loc44 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] -// CHECK:STDOUT: %specific_fn.loc44: = specific_function %impl.elem0.loc44, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc44_11.2: = bound_method %int_0.loc44, %specific_fn.loc44 [concrete = constants.%bound_method.036] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc44: init %i32 = call %bound_method.loc44_11.2(%int_0.loc44) [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc44: init %i32 = converted %int_0.loc44, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc44 [concrete = constants.%int_0.753] -// CHECK:STDOUT: return %.loc44 +// CHECK:STDOUT: !if.else.loc27: +// CHECK:STDOUT: %int_0.loc36: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] +// CHECK:STDOUT: %impl.elem0.loc36: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc36_11.1: = bound_method %int_0.loc36, %impl.elem0.loc36 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] +// CHECK:STDOUT: %specific_fn.loc36: = specific_function %impl.elem0.loc36, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc36_11.2: = bound_method %int_0.loc36, %specific_fn.loc36 [concrete = constants.%bound_method.036] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc36: init %i32 = call %bound_method.loc36_11.2(%int_0.loc36) [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc36: init %i32 = converted %int_0.loc36, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc36 [concrete = constants.%int_0.753] +// CHECK:STDOUT: return %.loc36 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_returned_var_type.carbon b/toolchain/check/testdata/return/fail_returned_var_type.carbon index 92a817eeaee4..4bf2429f7434 100644 --- a/toolchain/check/testdata/return/fail_returned_var_type.carbon +++ b/toolchain/check/testdata/return/fail_returned_var_type.carbon @@ -13,12 +13,8 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_returned_var_type.carbon fn Mismatch() -> i32 { - // CHECK:STDERR: fail_returned_var_type.carbon:[[@LINE+7]]:19: error: type `f64` of `returned var` does not match return type of enclosing function [ReturnedVarWrongType] - // CHECK:STDERR: returned var v: f64 = 0.0; - // CHECK:STDERR: ^~~ - // CHECK:STDERR: fail_returned_var_type.carbon:[[@LINE-4]]:18: note: return type of function is `i32` [ReturnTypeHereNote] - // CHECK:STDERR: fn Mismatch() -> i32 { - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_returned_var_type.carbon:[[@LINE+3]]:19-21: error: type `f64` of `returned var` does not match return type of enclosing function [ReturnedVarWrongType] + // CHECK:STDERR: fail_returned_var_type.carbon:[[@LINE-2]]:18-20: note: return type of function is `i32` [ReturnTypeHereNote] // CHECK:STDERR: returned var v: f64 = 0.0; return var; @@ -66,11 +62,11 @@ fn Mismatch() -> i32 { // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] // CHECK:STDOUT: %self.param_patt.3f8: %pattern_type.667 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.df6: %pattern_type.667 = wrapper_binding_pattern self, %self.param_patt.3f8 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfc: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc23 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfc: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc19 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01: %Destroy.WithSelf.SubobjectDestroy.type.dfc = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef0: type = fn_type @Destroy.WithSelf.Op.loc23 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef0: type = fn_type @Destroy.WithSelf.Op.loc19 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403: %Destroy.WithSelf.Op.type.ef0 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbc: type = fn_type @Destroy.WithSelf.SelfDestruct.loc23 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbc: type = fn_type @Destroy.WithSelf.SelfDestruct.loc19 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3: %Destroy.WithSelf.SelfDestruct.type.fbc = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -92,14 +88,14 @@ fn Mismatch() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl: %Destroy.WithSelf.SubobjectDestroy.type.dfc = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc23 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl: %Destroy.WithSelf.SubobjectDestroy.type.dfc = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc19 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01] { // CHECK:STDOUT: %self.param_patt: %pattern_type.667 = ref_param_pattern [concrete = constants.%self.param_patt.3f8] // CHECK:STDOUT: %self.patt: %pattern_type.667 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.df6] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %f64.761 = ref_param call_param0 // CHECK:STDOUT: %self: ref %f64.761 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl: %Destroy.WithSelf.Op.type.ef0 = fn_decl @Destroy.WithSelf.Op.loc23 [concrete = constants.%Destroy.WithSelf.Op.403] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl: %Destroy.WithSelf.Op.type.ef0 = fn_decl @Destroy.WithSelf.Op.loc19 [concrete = constants.%Destroy.WithSelf.Op.403] { // CHECK:STDOUT: %self.param_patt: %pattern_type.667 = ref_param_pattern [concrete = constants.%self.param_patt.3f8] // CHECK:STDOUT: %self.patt: %pattern_type.667 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.df6] // CHECK:STDOUT: } { @@ -130,29 +126,29 @@ fn Mismatch() -> i32 { // CHECK:STDOUT: %v.var: ref %f64.761 = var_storage %v.var_patt // CHECK:STDOUT: %float: Core.FloatLiteral = float_literal_value 0e-1 [concrete = constants.%float.1f7] // CHECK:STDOUT: %impl.elem0: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] -// CHECK:STDOUT: %bound_method.loc23_12.1: = bound_method %float, %impl.elem0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %bound_method.loc19_12.1: = bound_method %float, %impl.elem0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound] // CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc23_12.2: = bound_method %float, %specific_fn [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call: init %f64.761 = call %bound_method.loc23_12.2(%float) [concrete = constants.%float.73e] -// CHECK:STDOUT: %.loc23_12: init %f64.761 = converted %float, %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%float.73e] -// CHECK:STDOUT: assign %v.var, %.loc23_12 +// CHECK:STDOUT: %bound_method.loc19_12.2: = bound_method %float, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call: init %f64.761 = call %bound_method.loc19_12.2(%float) [concrete = constants.%float.73e] +// CHECK:STDOUT: %.loc19_12: init %f64.761 = converted %float, %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%float.73e] +// CHECK:STDOUT: assign %v.var, %.loc19_12 // CHECK:STDOUT: %f64: type = type_literal constants.%f64.761 [concrete = constants.%f64.761] // CHECK:STDOUT: %v: ref %f64.761 = wrapper_binding v, %v.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %v.patt: %pattern_type.667 = ref_binding_pattern v [concrete = constants.%v.patt] // CHECK:STDOUT: %v.var_patt: %pattern_type.667 = var_pattern %v.patt [concrete = constants.%v.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc23_17: %f64.761 = acquire_value %v +// CHECK:STDOUT: %.loc19_17: %f64.761 = acquire_value %v // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %v.var, constants.%Destroy.WithSelf.SelfDestruct.db3 // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%v.var) -// CHECK:STDOUT: return %.loc23_17 +// CHECK:STDOUT: return %.loc19_17 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc23(%self.param: ref %f64.761) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc19(%self.param: ref %f64.761) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc23(%self.param: ref %f64.761) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc19(%self.param: ref %f64.761) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc23(%self.param: ref %f64.761) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc19(%self.param: ref %f64.761) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl(%self.param) diff --git a/toolchain/check/testdata/return/fail_type_mismatch.carbon b/toolchain/check/testdata/return/fail_type_mismatch.carbon index 53a47faeb70e..d326acf2410e 100644 --- a/toolchain/check/testdata/return/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/return/fail_type_mismatch.carbon @@ -13,12 +13,8 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_type_mismatch.carbon 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: return 1.0; - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+3]]:3-13: error: cannot implicitly convert expression of type `Core.FloatLiteral` to `i32` [ConversionFailure] + // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+2]]:3-13: note: type `Core.FloatLiteral` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return 1.0; } @@ -73,7 +69,7 @@ fn Main() -> i32 { // CHECK:STDOUT: fn @Main() -> out %return.param: %i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %float: Core.FloatLiteral = float_literal_value 10e-1 [concrete = constants.%float] -// CHECK:STDOUT: %.loc23: %i32 = converted %float, [concrete = ] +// CHECK:STDOUT: %.loc19: %i32 = converted %float, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_value_disallowed.carbon b/toolchain/check/testdata/return/fail_value_disallowed.carbon index 3b4ceacd5c1a..21a7a11b5e34 100644 --- a/toolchain/check/testdata/return/fail_value_disallowed.carbon +++ b/toolchain/check/testdata/return/fail_value_disallowed.carbon @@ -13,12 +13,8 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_value_disallowed.carbon fn Main() { - // CHECK:STDERR: fail_value_disallowed.carbon:[[@LINE+7]]:3: error: no return expression should be provided in this context [ReturnStatementDisallowExpr] - // CHECK:STDERR: return 0; - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_value_disallowed.carbon:[[@LINE-4]]:1: note: there was no return type provided [ReturnTypeOmittedNote] - // CHECK:STDERR: fn Main() { - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_value_disallowed.carbon:[[@LINE+3]]:3-11: error: no return expression should be provided in this context [ReturnStatementDisallowExpr] + // CHECK:STDERR: fail_value_disallowed.carbon:[[@LINE-2]]:1-11: note: there was no return type provided [ReturnTypeOmittedNote] // CHECK:STDERR: return 0; } diff --git a/toolchain/check/testdata/return/fail_value_missing.carbon b/toolchain/check/testdata/return/fail_value_missing.carbon index 2cfb5962cccf..329c035289b2 100644 --- a/toolchain/check/testdata/return/fail_value_missing.carbon +++ b/toolchain/check/testdata/return/fail_value_missing.carbon @@ -13,12 +13,8 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_value_missing.carbon fn Main() -> i32 { - // CHECK:STDERR: fail_value_missing.carbon:[[@LINE+7]]:3: error: missing return value [ReturnStatementMissingExpr] - // CHECK:STDERR: return; - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_value_missing.carbon:[[@LINE-4]]:14: note: return type of function is `i32` [ReturnTypeHereNote] - // CHECK:STDERR: fn Main() -> i32 { - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_value_missing.carbon:[[@LINE+3]]:3-9: error: missing return value [ReturnStatementMissingExpr] + // CHECK:STDERR: fail_value_missing.carbon:[[@LINE-2]]:14-16: note: return type of function is `i32` [ReturnTypeHereNote] // CHECK:STDERR: return; } diff --git a/toolchain/check/testdata/return/fail_var_in_type.carbon b/toolchain/check/testdata/return/fail_var_in_type.carbon index 8328f2017a8d..629f5228b27c 100644 --- a/toolchain/check/testdata/return/fail_var_in_type.carbon +++ b/toolchain/check/testdata/return/fail_var_in_type.carbon @@ -13,9 +13,7 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_var_in_type.carbon var x: type = i32; -// CHECK:STDERR: fail_var_in_type.carbon:[[@LINE+4]]:13: error: cannot evaluate type expression [TypeExprEvaluationFailure] -// CHECK:STDERR: fn Six() -> x { return 6; } -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_var_in_type.carbon:[[@LINE+2]]:13: error: cannot evaluate type expression [TypeExprEvaluationFailure] // CHECK:STDERR: fn Six() -> x { return 6; } @@ -74,7 +72,7 @@ fn Six() -> x { return 6; } // CHECK:STDOUT: %return.patt: = return_slot_pattern , [concrete = ] // CHECK:STDOUT: } { // CHECK:STDOUT: %x.ref: ref type = name_ref x, file.%x [concrete = file.%x.var] -// CHECK:STDOUT: %.loc20: type = acquire_value %x.ref +// CHECK:STDOUT: %.loc18: type = acquire_value %x.ref // CHECK:STDOUT: %return: = return_slot // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_access_into_invalid.carbon b/toolchain/check/testdata/struct/fail_access_into_invalid.carbon index 1f8e42a1e7ae..b398c015e567 100644 --- a/toolchain/check/testdata/struct/fail_access_into_invalid.carbon +++ b/toolchain/check/testdata/struct/fail_access_into_invalid.carbon @@ -13,9 +13,7 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_access_into_invalid.carbon -// CHECK:STDERR: fail_access_into_invalid.carbon:[[@LINE+4]]:10: error: name `a` not found [NameNotFound] -// CHECK:STDERR: fn F() { a.b; } -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_access_into_invalid.carbon:[[@LINE+2]]:10: error: name `a` not found [NameNotFound] // CHECK:STDERR: fn F() { a.b; } diff --git a/toolchain/check/testdata/struct/fail_assign_empty.carbon b/toolchain/check/testdata/struct/fail_assign_empty.carbon index 04aacc5e52b1..3319fe8cf076 100644 --- a/toolchain/check/testdata/struct/fail_assign_empty.carbon +++ b/toolchain/check/testdata/struct/fail_assign_empty.carbon @@ -12,9 +12,7 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_assign_empty.carbon -// CHECK:STDERR: fail_assign_empty.carbon:[[@LINE+4]]:20: error: missing value for field `a` in struct initialization [StructInitMissingFieldInLiteral] -// CHECK:STDERR: var x: {.a: i32} = {}; -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_assign_empty.carbon:[[@LINE+2]]:20-21: error: missing value for field `a` in struct initialization [StructInitMissingFieldInLiteral] // CHECK:STDERR: var x: {.a: i32} = {}; @@ -50,7 +48,7 @@ var x: {.a: i32} = {}; // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %x.var: ref %struct_type.a = var_storage %x.var_patt [concrete] -// CHECK:STDOUT: %.loc19: type = splice_block %struct_type.a [concrete = constants.%struct_type.a] { +// CHECK:STDOUT: %.loc17: type = splice_block %struct_type.a [concrete = constants.%struct_type.a] { // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %i32} [concrete = constants.%struct_type.a] // CHECK:STDOUT: } @@ -63,7 +61,7 @@ var x: {.a: i32} = {}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc19: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc17: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_assign_nested.carbon b/toolchain/check/testdata/struct/fail_assign_nested.carbon index 263771de9363..e53cbb29757c 100644 --- a/toolchain/check/testdata/struct/fail_assign_nested.carbon +++ b/toolchain/check/testdata/struct/fail_assign_nested.carbon @@ -12,9 +12,7 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_assign_nested.carbon -// CHECK:STDERR: fail_assign_nested.carbon:[[@LINE+4]]:19: error: struct `{.a: {}}` has no field named `b` [StructInitUnexpectedFieldInLiteral] -// CHECK:STDERR: var x: {.a: {}} = {.b = {}}; -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_assign_nested.carbon:[[@LINE+2]]:19-27: error: struct `{.a: {}}` has no field named `b` [StructInitUnexpectedFieldInLiteral] // CHECK:STDERR: var x: {.a: {}} = {.b = {}}; @@ -37,9 +35,9 @@ var x: {.a: {}} = {.b = {}}; // CHECK:STDOUT: .x = %x // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref %struct_type.a.225 = var_storage %x.var_patt [concrete] -// CHECK:STDOUT: %.loc19_15: type = splice_block %struct_type.a [concrete = constants.%struct_type.a.225] { -// CHECK:STDOUT: %.loc19_14.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc19_14.2: type = converted %.loc19_14.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc17_15: type = splice_block %struct_type.a [concrete = constants.%struct_type.a.225] { +// CHECK:STDOUT: %.loc17_14.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc17_14.2: type = converted %.loc17_14.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %empty_struct_type} [concrete = constants.%struct_type.a.225] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %struct_type.a.225 = wrapper_binding x, %x.var [concrete = %x.var] @@ -51,8 +49,8 @@ var x: {.a: {}} = {.b = {}}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc19_26: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc19_27: %struct_type.b.347 = struct_literal (%.loc19_26) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc17_26: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc17_27: %struct_type.b.347 = struct_literal (%.loc17_26) [concrete = constants.%struct] // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_assign_to_empty.carbon b/toolchain/check/testdata/struct/fail_assign_to_empty.carbon index 56ac49fe2287..28f46ea26190 100644 --- a/toolchain/check/testdata/struct/fail_assign_to_empty.carbon +++ b/toolchain/check/testdata/struct/fail_assign_to_empty.carbon @@ -12,9 +12,7 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_assign_to_empty.carbon -// CHECK:STDERR: fail_assign_to_empty.carbon:[[@LINE+4]]:13: error: struct `{}` has no field named `a` [StructInitUnexpectedFieldInLiteral] -// CHECK:STDERR: var x: {} = {.a = 1}; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_assign_to_empty.carbon:[[@LINE+2]]:13-20: error: struct `{}` has no field named `a` [StructInitUnexpectedFieldInLiteral] // CHECK:STDERR: var x: {} = {.a = 1}; @@ -46,9 +44,9 @@ var x: {} = {.a = 1}; // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %x.var: ref %empty_struct_type = var_storage %x.var_patt [concrete] -// CHECK:STDOUT: %.loc19_9.1: type = splice_block %.loc19_9.3 [concrete = constants.%empty_struct_type] { -// CHECK:STDOUT: %.loc19_9.2: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc19_9.3: type = converted %.loc19_9.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc17_9.1: type = splice_block %.loc17_9.3 [concrete = constants.%empty_struct_type] { +// CHECK:STDOUT: %.loc17_9.2: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc17_9.3: type = converted %.loc17_9.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %empty_struct_type = wrapper_binding x, %x.var [concrete = %x.var] // CHECK:STDOUT: name_binding_decl { @@ -60,7 +58,7 @@ var x: {} = {.a = 1}; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %.loc19: %struct_type.a = struct_literal (%int_1) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc17: %struct_type.a = struct_literal (%int_1) [concrete = constants.%struct] // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_duplicate_name.carbon b/toolchain/check/testdata/struct/fail_duplicate_name.carbon index b957762efe86..90f2c69b91a7 100644 --- a/toolchain/check/testdata/struct/fail_duplicate_name.carbon +++ b/toolchain/check/testdata/struct/fail_duplicate_name.carbon @@ -12,48 +12,28 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_duplicate_name.carbon -// CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+7]]:42: error: duplicated field name `abc` in struct type literal [StructNameDuplicate] -// CHECK:STDERR: fn F() -> {.d: i32, .abc: i32, .e: i32, .abc: i32, .f: i32}; -// CHECK:STDERR: ^~~ -// CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+4]]:22: note: field with the same name here [StructNamePrevious] -// CHECK:STDERR: fn F() -> {.d: i32, .abc: i32, .e: i32, .abc: i32, .f: i32}; -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+3]]:42-44: error: duplicated field name `abc` in struct type literal [StructNameDuplicate] +// CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+2]]:22-24: note: field with the same name here [StructNamePrevious] // CHECK:STDERR: fn F() -> {.d: i32, .abc: i32, .e: i32, .abc: i32, .f: i32}; -// CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+7]]:19: error: duplicated field name `a` in struct type literal [StructNameDuplicate] -// CHECK:STDERR: let v: {.a: i32, .a: i32} = {.a = 1}; -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+4]]:10: note: field with the same name here [StructNamePrevious] -// CHECK:STDERR: let v: {.a: i32, .a: i32} = {.a = 1}; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+3]]:19: error: duplicated field name `a` in struct type literal [StructNameDuplicate] +// CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+2]]:10: note: field with the same name here [StructNamePrevious] // CHECK:STDERR: let v: {.a: i32, .a: i32} = {.a = 1}; -// CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+7]]:26: error: duplicated field name `def` in struct literal [StructNameDuplicate] -// CHECK:STDERR: let w: i32 = {.def = 1, .def = 2}.def; -// CHECK:STDERR: ^~~ -// CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+4]]:16: note: field with the same name here [StructNamePrevious] -// CHECK:STDERR: let w: i32 = {.def = 1, .def = 2}.def; -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+3]]:26-28: error: duplicated field name `def` in struct literal [StructNameDuplicate] +// CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+2]]:16-18: note: field with the same name here [StructNamePrevious] // CHECK:STDERR: let w: i32 = {.def = 1, .def = 2}.def; -// CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+7]]:30: error: duplicated field name `a` in struct literal [StructNameDuplicate] -// CHECK:STDERR: var x: {.a: i32} = {.a = 1, .a = 2}; -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+4]]:22: note: field with the same name here [StructNamePrevious] -// CHECK:STDERR: var x: {.a: i32} = {.a = 1, .a = 2}; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+3]]:30: error: duplicated field name `a` in struct literal [StructNameDuplicate] +// CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+2]]:22: note: field with the same name here [StructNamePrevious] // CHECK:STDERR: var x: {.a: i32} = {.a = 1, .a = 2}; -// CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+7]]:39: error: duplicated field name `b` in struct literal [StructNameDuplicate] -// CHECK:STDERR: var y: {.b: i32, .c: i32} = {.b = 3, .b = 4}; -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+4]]:31: note: field with the same name here [StructNamePrevious] -// CHECK:STDERR: var y: {.b: i32, .c: i32} = {.b = 3, .b = 4}; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+3]]:39: error: duplicated field name `b` in struct literal [StructNameDuplicate] +// CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+2]]:31: note: field with the same name here [StructNamePrevious] // CHECK:STDERR: var y: {.b: i32, .c: i32} = {.b = 3, .b = 4}; @@ -107,29 +87,29 @@ var y: {.b: i32, .c: i32} = {.b = 3, .b = 4}; // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { // CHECK:STDOUT: %return.patt: = return_slot_pattern , [concrete = ] // CHECK:STDOUT: } { -// CHECK:STDOUT: %i32.loc22_16: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %i32.loc22_27: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %i32.loc22_36: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %i32.loc22_47: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %i32.loc22_56: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc18_16: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc18_27: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc18_36: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc18_47: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc18_56: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %return: = return_slot // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = splice_block [concrete = ] { -// CHECK:STDOUT: %i32.loc31_13: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %i32.loc31_22: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc23_13: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc23_22: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %v: = wrapper_binding v, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %v.patt: = value_binding_pattern v [concrete = ] // CHECK:STDOUT: } -// CHECK:STDOUT: %i32.loc40: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc28: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %w: %i32 = wrapper_binding w, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %w.patt: %pattern_type.d94 = value_binding_pattern w [concrete = constants.%w.patt] // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref %struct_type.a.15e = var_storage %x.var_patt [concrete] -// CHECK:STDOUT: %.loc49: type = splice_block %struct_type.a [concrete = constants.%struct_type.a.15e] { -// CHECK:STDOUT: %i32.loc49: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc33: type = splice_block %struct_type.a [concrete = constants.%struct_type.a.15e] { +// CHECK:STDOUT: %i32.loc33: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %i32} [concrete = constants.%struct_type.a.15e] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %struct_type.a.15e = wrapper_binding x, %x.var [concrete = %x.var] @@ -138,9 +118,9 @@ var y: {.b: i32, .c: i32} = {.b = 3, .b = 4}; // CHECK:STDOUT: %x.var_patt: %pattern_type.243 = var_pattern %x.patt [concrete = constants.%x.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %y.var: ref %struct_type.b.c = var_storage %y.var_patt [concrete] -// CHECK:STDOUT: %.loc58: type = splice_block %struct_type.b.c [concrete = constants.%struct_type.b.c] { -// CHECK:STDOUT: %i32.loc58_13: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %i32.loc58_22: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc38: type = splice_block %struct_type.b.c [concrete = constants.%struct_type.b.c] { +// CHECK:STDOUT: %i32.loc38_13: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc38_22: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.b.c: type = struct_type {.b: %i32, .c: %i32} [concrete = constants.%struct_type.b.c] // CHECK:STDOUT: } // CHECK:STDOUT: %y: ref %struct_type.b.c = wrapper_binding y, %y.var [concrete = %y.var] @@ -154,13 +134,13 @@ var y: {.b: i32, .c: i32} = {.b = 3, .b = 4}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int_1.loc31: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %.loc31: %struct_type.a.a6c = struct_literal (%int_1.loc31) [concrete = constants.%struct] -// CHECK:STDOUT: %int_1.loc40: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %int_2.loc40: Core.IntLiteral = int_value 2 [concrete = constants.%int_2] +// CHECK:STDOUT: %int_1.loc23: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %.loc23: %struct_type.a.a6c = struct_literal (%int_1.loc23) [concrete = constants.%struct] +// CHECK:STDOUT: %int_1.loc28: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %int_2.loc28: Core.IntLiteral = int_value 2 [concrete = constants.%int_2] // CHECK:STDOUT: %def.ref: = name_ref def, [concrete = ] -// CHECK:STDOUT: %int_1.loc49: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %int_2.loc49: Core.IntLiteral = int_value 2 [concrete = constants.%int_2] +// CHECK:STDOUT: %int_1.loc33: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %int_2.loc33: Core.IntLiteral = int_value 2 [concrete = constants.%int_2] // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3] // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4] diff --git a/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon b/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon index 416ca9ea5149..a3f4b9b22a1b 100644 --- a/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon +++ b/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon @@ -13,21 +13,15 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_field_name_mismatch.carbon var a: {.a: i32} = {.a = 1 }; -// CHECK:STDERR: fail_field_name_mismatch.carbon:[[@LINE+4]]:29: error: cannot convert from struct type `{.a: i32}` to `{.a: i32, .b: i32}`: missing field `b` in source type [StructInitMissingFieldInConversion] -// CHECK:STDERR: var b: {.a: i32, .b: i32} = a; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_field_name_mismatch.carbon:[[@LINE+2]]:29: error: cannot convert from struct type `{.a: i32}` to `{.a: i32, .b: i32}`: missing field `b` in source type [StructInitMissingFieldInConversion] // CHECK:STDERR: var b: {.a: i32, .b: i32} = a; -// CHECK:STDERR: fail_field_name_mismatch.carbon:[[@LINE+4]]:20: error: struct `{.a: i32}` has no field named `b` [StructInitUnexpectedFieldInLiteral] -// CHECK:STDERR: var x: {.a: i32} = {.b = 1}; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_field_name_mismatch.carbon:[[@LINE+2]]:20-27: error: struct `{.a: i32}` has no field named `b` [StructInitUnexpectedFieldInLiteral] // CHECK:STDERR: var x: {.a: i32} = {.b = 1}; -// CHECK:STDERR: fail_field_name_mismatch.carbon:[[@LINE+4]]:20: error: cannot convert from struct type `{.a: i32}` to `{.b: i32}`: unexpected field `a` in source type [StructInitUnexpectedFieldInConversion] -// CHECK:STDERR: var y: {.b: i32} = x; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_field_name_mismatch.carbon:[[@LINE+2]]:20: error: cannot convert from struct type `{.a: i32}` to `{.b: i32}`: unexpected field `a` in source type [StructInitUnexpectedFieldInConversion] // CHECK:STDERR: var y: {.b: i32} = x; @@ -127,9 +121,9 @@ var y: {.b: i32} = x; // CHECK:STDOUT: %a.var_patt: %pattern_type.243 = var_pattern %a.patt [concrete = constants.%a.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %b.var: ref %struct_type.a.b = var_storage %b.var_patt [concrete] -// CHECK:STDOUT: %.loc20: type = splice_block %struct_type.a.b [concrete = constants.%struct_type.a.b] { -// CHECK:STDOUT: %i32.loc20_13: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %i32.loc20_22: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc18: type = splice_block %struct_type.a.b [concrete = constants.%struct_type.a.b] { +// CHECK:STDOUT: %i32.loc18_13: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc18_22: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.a.b: type = struct_type {.a: %i32, .b: %i32} [concrete = constants.%struct_type.a.b] // CHECK:STDOUT: } // CHECK:STDOUT: %b: ref %struct_type.a.b = wrapper_binding b, %b.var [concrete = %b.var] @@ -138,9 +132,9 @@ var y: {.b: i32} = x; // CHECK:STDOUT: %b.var_patt: %pattern_type.290 = var_pattern %b.patt [concrete = constants.%b.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref %struct_type.a.15e = var_storage %x.var_patt [concrete] -// CHECK:STDOUT: %.loc26: type = splice_block %struct_type.a.loc26 [concrete = constants.%struct_type.a.15e] { -// CHECK:STDOUT: %i32.loc26: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %struct_type.a.loc26: type = struct_type {.a: %i32} [concrete = constants.%struct_type.a.15e] +// CHECK:STDOUT: %.loc22: type = splice_block %struct_type.a.loc22 [concrete = constants.%struct_type.a.15e] { +// CHECK:STDOUT: %i32.loc22: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %struct_type.a.loc22: type = struct_type {.a: %i32} [concrete = constants.%struct_type.a.15e] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %struct_type.a.15e = wrapper_binding x, %x.var [concrete = %x.var] // CHECK:STDOUT: name_binding_decl { @@ -148,8 +142,8 @@ var y: {.b: i32} = x; // CHECK:STDOUT: %x.var_patt: %pattern_type.243 = var_pattern %x.patt [concrete = constants.%x.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %y.var: ref %struct_type.b.5bf = var_storage %y.var_patt [concrete] -// CHECK:STDOUT: %.loc32: type = splice_block %struct_type.b [concrete = constants.%struct_type.b.5bf] { -// CHECK:STDOUT: %i32.loc32: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc26: type = splice_block %struct_type.b [concrete = constants.%struct_type.b.5bf] { +// CHECK:STDOUT: %i32.loc26: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.b: type = struct_type {.b: %i32} [concrete = constants.%struct_type.b.5bf] // CHECK:STDOUT: } // CHECK:STDOUT: %y: ref %struct_type.b.5bf = wrapper_binding y, %y.var [concrete = %y.var] @@ -173,18 +167,18 @@ var y: {.b: i32} = x; // CHECK:STDOUT: %.loc15_1: init %struct_type.a.15e = converted %.loc15_28.1, %.loc15_28.3 [concrete = constants.%struct.570] // CHECK:STDOUT: assign file.%a.var, %.loc15_1 // CHECK:STDOUT: %a.ref: ref %struct_type.a.15e = name_ref a, file.%a [concrete = file.%a.var] -// CHECK:STDOUT: %.loc20_29.1: ref %i32 = struct_access %a.ref, element0 [concrete = constants.%.c96] -// CHECK:STDOUT: %.loc20_29.2: %i32 = acquire_value %.loc20_29.1 -// CHECK:STDOUT: %impl.elem0.loc20: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] -// CHECK:STDOUT: %bound_method.loc20_29.1: = bound_method %.loc20_29.2, %impl.elem0.loc20 -// CHECK:STDOUT: %specific_fn.loc20: = specific_function %impl.elem0.loc20, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc20_29.2: = bound_method %.loc20_29.2, %specific_fn.loc20 -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc20_29.2(%.loc20_29.2) -// CHECK:STDOUT: %.loc20_29.3: ref %i32 = struct_access file.%b.var, element0 [concrete = constants.%.b5f] -// CHECK:STDOUT: %.loc20_29.4: init %i32 to %.loc20_29.3 = in_place_init %Int.as.Copy.impl.Op.call +// CHECK:STDOUT: %.loc18_29.1: ref %i32 = struct_access %a.ref, element0 [concrete = constants.%.c96] +// CHECK:STDOUT: %.loc18_29.2: %i32 = acquire_value %.loc18_29.1 +// CHECK:STDOUT: %impl.elem0.loc18: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] +// CHECK:STDOUT: %bound_method.loc18_29.1: = bound_method %.loc18_29.2, %impl.elem0.loc18 +// CHECK:STDOUT: %specific_fn.loc18: = specific_function %impl.elem0.loc18, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc18_29.2: = bound_method %.loc18_29.2, %specific_fn.loc18 +// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc18_29.2(%.loc18_29.2) +// CHECK:STDOUT: %.loc18_29.3: ref %i32 = struct_access file.%b.var, element0 [concrete = constants.%.b5f] +// CHECK:STDOUT: %.loc18_29.4: init %i32 to %.loc18_29.3 = in_place_init %Int.as.Copy.impl.Op.call // CHECK:STDOUT: assign file.%b.var, -// CHECK:STDOUT: %int_1.loc26: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %.loc26: %struct_type.b.a15 = struct_literal (%int_1.loc26) [concrete = constants.%struct.62b] +// CHECK:STDOUT: %int_1.loc22: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %.loc22: %struct_type.b.a15 = struct_literal (%int_1.loc22) [concrete = constants.%struct.62b] // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: %x.ref: ref %struct_type.a.15e = name_ref x, file.%x [concrete = file.%x.var] // CHECK:STDOUT: assign file.%y.var, diff --git a/toolchain/check/testdata/struct/fail_field_type_mismatch.carbon b/toolchain/check/testdata/struct/fail_field_type_mismatch.carbon index 947ec3cc3b02..34bbe412927d 100644 --- a/toolchain/check/testdata/struct/fail_field_type_mismatch.carbon +++ b/toolchain/check/testdata/struct/fail_field_type_mismatch.carbon @@ -12,9 +12,7 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_field_type_mismatch.carbon -// CHECK:STDERR: fail_field_type_mismatch.carbon:[[@LINE+4]]:20: error: struct `{.a: i32}` has no field named `b` [StructInitUnexpectedFieldInLiteral] -// CHECK:STDERR: var x: {.a: i32} = {.b = 1.0}; -// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: fail_field_type_mismatch.carbon:[[@LINE+2]]:20-29: error: struct `{.a: i32}` has no field named `b` [StructInitUnexpectedFieldInLiteral] // CHECK:STDERR: var x: {.a: i32} = {.b = 1.0}; @@ -51,7 +49,7 @@ var x: {.a: i32} = {.b = 1.0}; // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %x.var: ref %struct_type.a = var_storage %x.var_patt [concrete] -// CHECK:STDOUT: %.loc19: type = splice_block %struct_type.a [concrete = constants.%struct_type.a] { +// CHECK:STDOUT: %.loc17: type = splice_block %struct_type.a [concrete = constants.%struct_type.a] { // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %i32} [concrete = constants.%struct_type.a] // CHECK:STDOUT: } @@ -65,7 +63,7 @@ var x: {.a: i32} = {.b = 1.0}; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %float: Core.FloatLiteral = float_literal_value 10e-1 [concrete = constants.%float] -// CHECK:STDOUT: %.loc19: %struct_type.b = struct_literal (%float) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc17: %struct_type.b = struct_literal (%float) [concrete = constants.%struct] // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_keyword_name.carbon b/toolchain/check/testdata/struct/fail_keyword_name.carbon index 185b0bc1f261..d51d96d256a3 100644 --- a/toolchain/check/testdata/struct/fail_keyword_name.carbon +++ b/toolchain/check/testdata/struct/fail_keyword_name.carbon @@ -10,20 +10,14 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_keyword_name.carbon -// CHECK:STDERR: fail_keyword_name.carbon:[[@LINE+4]]:13: error: expected identifier after `.`; prefix reserved word with `r#` to form a valid identifier [ExpectedIdentifierAfterPeriodOrArrow] -// CHECK:STDERR: fn F() -> {.class: i32}; -// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: fail_keyword_name.carbon:[[@LINE+2]]:13-17: error: expected identifier after `.`; prefix reserved word with `r#` to form a valid identifier [ExpectedIdentifierAfterPeriodOrArrow] // CHECK:STDERR: fn F() -> {.class: i32}; -// CHECK:STDERR: fail_keyword_name.carbon:[[@LINE+4]]:13: error: expected identifier after `.`; prefix reserved word with `r#` to form a valid identifier [ExpectedIdentifierAfterPeriodOrArrow] -// CHECK:STDERR: fn G() -> {.return: i32} { -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_keyword_name.carbon:[[@LINE+2]]:13-18: error: expected identifier after `.`; prefix reserved word with `r#` to form a valid identifier [ExpectedIdentifierAfterPeriodOrArrow] // CHECK:STDERR: fn G() -> {.return: i32} { - // CHECK:STDERR: fail_keyword_name.carbon:[[@LINE+4]]:12: error: expected identifier after `.`; prefix reserved word with `r#` to form a valid identifier [ExpectedIdentifierAfterPeriodOrArrow] - // CHECK:STDERR: return {.return = 5}; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_keyword_name.carbon:[[@LINE+2]]:12-17: error: expected identifier after `.`; prefix reserved word with `r#` to form a valid identifier [ExpectedIdentifierAfterPeriodOrArrow] // CHECK:STDERR: return {.return = 5}; }; diff --git a/toolchain/check/testdata/struct/fail_member_access_type.carbon b/toolchain/check/testdata/struct/fail_member_access_type.carbon index d6679033c0a8..820566610a21 100644 --- a/toolchain/check/testdata/struct/fail_member_access_type.carbon +++ b/toolchain/check/testdata/struct/fail_member_access_type.carbon @@ -13,9 +13,7 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_member_access_type.carbon var x: {.a: f64} = {.a = 4.0}; -// CHECK:STDERR: fail_member_access_type.carbon:[[@LINE+4]]:14: error: type `{.a: f64}` does not have a member `b` [QualifiedExprNameNotFound] -// CHECK:STDERR: var y: i32 = x.b; -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_member_access_type.carbon:[[@LINE+2]]:14-16: error: type `{.a: f64}` does not have a member `b` [QualifiedExprNameNotFound] // CHECK:STDERR: var y: i32 = x.b; diff --git a/toolchain/check/testdata/struct/fail_member_of_function.carbon b/toolchain/check/testdata/struct/fail_member_of_function.carbon index a78864890de4..e92e39b50fa8 100644 --- a/toolchain/check/testdata/struct/fail_member_of_function.carbon +++ b/toolchain/check/testdata/struct/fail_member_of_function.carbon @@ -13,9 +13,7 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_member_of_function.carbon fn A() { - // CHECK:STDERR: fail_member_of_function.carbon:[[@LINE+4]]:3: error: type `` does not support qualified expressions [QualifiedExprUnsupported] - // CHECK:STDERR: A.y; - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_member_of_function.carbon:[[@LINE+2]]:3-5: error: type `` does not support qualified expressions [QualifiedExprUnsupported] // CHECK:STDERR: A.y; } diff --git a/toolchain/check/testdata/struct/fail_nested_incomplete.carbon b/toolchain/check/testdata/struct/fail_nested_incomplete.carbon index 41c0284e4785..e520b5fed16f 100644 --- a/toolchain/check/testdata/struct/fail_nested_incomplete.carbon +++ b/toolchain/check/testdata/struct/fail_nested_incomplete.carbon @@ -14,12 +14,8 @@ class Incomplete; -// CHECK:STDERR: fail_nested_incomplete.carbon:[[@LINE+7]]:8: error: binding pattern has incomplete type `{.a: Incomplete}` in name binding declaration [IncompleteTypeInBindingDecl] -// CHECK:STDERR: var s: {.a: Incomplete}; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_nested_incomplete.carbon:[[@LINE-5]]:1: note: class was forward declared here [ClassForwardDeclaredHere] -// CHECK:STDERR: class Incomplete; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_nested_incomplete.carbon:[[@LINE+3]]:8-23: error: binding pattern has incomplete type `{.a: Incomplete}` in name binding declaration [IncompleteTypeInBindingDecl] +// CHECK:STDERR: fail_nested_incomplete.carbon:[[@LINE-3]]:1-17: note: class was forward declared here [ClassForwardDeclaredHere] // CHECK:STDERR: var s: {.a: Incomplete}; @@ -45,8 +41,8 @@ var p: Incomplete* = &s.a; // CHECK:STDOUT: } // CHECK:STDOUT: %Incomplete.decl: type = class_decl @Incomplete [concrete = constants.%Incomplete] {} {} // CHECK:STDOUT: %s.var: ref = var_storage %s.var_patt [concrete = ] -// CHECK:STDOUT: %.loc24: type = splice_block %struct_type.a [concrete = constants.%struct_type.a] { -// CHECK:STDOUT: %Incomplete.ref.loc24: type = name_ref Incomplete, %Incomplete.decl [concrete = constants.%Incomplete] +// CHECK:STDOUT: %.loc20: type = splice_block %struct_type.a [concrete = constants.%struct_type.a] { +// CHECK:STDOUT: %Incomplete.ref.loc20: type = name_ref Incomplete, %Incomplete.decl [concrete = constants.%Incomplete] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %Incomplete} [concrete = constants.%struct_type.a] // CHECK:STDOUT: } // CHECK:STDOUT: %s: = wrapper_binding s, [concrete = ] @@ -55,9 +51,9 @@ var p: Incomplete* = &s.a; // CHECK:STDOUT: %s.var_patt: = var_pattern %s.patt [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %p.var: ref %ptr = var_storage %p.var_patt [concrete] -// CHECK:STDOUT: %.loc26: type = splice_block %ptr [concrete = constants.%ptr] { -// CHECK:STDOUT: %Incomplete.ref.loc26: type = name_ref Incomplete, %Incomplete.decl [concrete = constants.%Incomplete] -// CHECK:STDOUT: %ptr: type = ptr_type %Incomplete.ref.loc26 [concrete = constants.%ptr] +// CHECK:STDOUT: %.loc22: type = splice_block %ptr [concrete = constants.%ptr] { +// CHECK:STDOUT: %Incomplete.ref.loc22: type = name_ref Incomplete, %Incomplete.decl [concrete = constants.%Incomplete] +// CHECK:STDOUT: %ptr: type = ptr_type %Incomplete.ref.loc22 [concrete = constants.%ptr] // CHECK:STDOUT: } // CHECK:STDOUT: %p: ref %ptr = wrapper_binding p, %p.var [concrete = %p.var] // CHECK:STDOUT: name_binding_decl { diff --git a/toolchain/check/testdata/struct/fail_non_member_access.carbon b/toolchain/check/testdata/struct/fail_non_member_access.carbon index a50fc9d5c688..be219bf7df51 100644 --- a/toolchain/check/testdata/struct/fail_non_member_access.carbon +++ b/toolchain/check/testdata/struct/fail_non_member_access.carbon @@ -13,9 +13,7 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_non_member_access.carbon var x: {.a: i32} = {.a = 4}; -// CHECK:STDERR: fail_non_member_access.carbon:[[@LINE+4]]:14: error: type `{.a: i32}` does not have a member `b` [QualifiedExprNameNotFound] -// CHECK:STDERR: var y: i32 = x.b; -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_non_member_access.carbon:[[@LINE+2]]:14-16: error: type `{.a: i32}` does not have a member `b` [QualifiedExprNameNotFound] // CHECK:STDERR: var y: i32 = x.b; @@ -87,7 +85,7 @@ var y: i32 = x.b; // CHECK:STDOUT: %x.var_patt: %pattern_type.243 = var_pattern %x.patt [concrete = constants.%x.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %y.var: ref %i32 = var_storage %y.var_patt [concrete] -// CHECK:STDOUT: %i32.loc20: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc18: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %y: ref %i32 = wrapper_binding y, %y.var [concrete = %y.var] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %y.patt: %pattern_type.d94 = ref_binding_pattern y [concrete = constants.%y.patt] diff --git a/toolchain/check/testdata/struct/fail_too_few_values.carbon b/toolchain/check/testdata/struct/fail_too_few_values.carbon index 5dd62073860d..62f811df7677 100644 --- a/toolchain/check/testdata/struct/fail_too_few_values.carbon +++ b/toolchain/check/testdata/struct/fail_too_few_values.carbon @@ -12,9 +12,7 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_too_few_values.carbon -// CHECK:STDERR: fail_too_few_values.carbon:[[@LINE+4]]:29: error: missing value for field `b` in struct initialization [StructInitMissingFieldInLiteral] -// CHECK:STDERR: var x: {.a: i32, .b: i32} = {.a = 1}; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_too_few_values.carbon:[[@LINE+2]]:29-36: error: missing value for field `b` in struct initialization [StructInitMissingFieldInLiteral] // CHECK:STDERR: var x: {.a: i32, .b: i32} = {.a = 1}; @@ -72,9 +70,9 @@ var x: {.a: i32, .b: i32} = {.a = 1}; // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %x.var: ref %struct_type.a.b = var_storage %x.var_patt [concrete] -// CHECK:STDOUT: %.loc19: type = splice_block %struct_type.a.b [concrete = constants.%struct_type.a.b] { -// CHECK:STDOUT: %i32.loc19_13: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %i32.loc19_22: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc17: type = splice_block %struct_type.a.b [concrete = constants.%struct_type.a.b] { +// CHECK:STDOUT: %i32.loc17_13: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc17_22: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.a.b: type = struct_type {.a: %i32, .b: %i32} [concrete = constants.%struct_type.a.b] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %struct_type.a.b = wrapper_binding x, %x.var [concrete = %x.var] @@ -87,15 +85,15 @@ var x: {.a: i32, .b: i32} = {.a = 1}; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %.loc19_36.1: %struct_type.a = struct_literal (%int_1) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc17_36.1: %struct_type.a = struct_literal (%int_1) [concrete = constants.%struct] // CHECK:STDOUT: %impl.elem0: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc19_36.1: = bound_method %int_1, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %bound_method.loc17_36.1: = bound_method %int_1, %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.loc19_36.2: = bound_method %int_1, %specific_fn [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc19_36.2(%int_1) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc19_36.2: init %i32 = converted %int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc19_36.3: ref %i32 = struct_access file.%x.var, element0 [concrete = constants.%.082] -// CHECK:STDOUT: %.loc19_36.4: init %i32 to %.loc19_36.3 = in_place_init %.loc19_36.2 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %bound_method.loc17_36.2: = bound_method %int_1, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc17_36.2(%int_1) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc17_36.2: init %i32 = converted %int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc17_36.3: ref %i32 = struct_access file.%x.var, element0 [concrete = constants.%.082] +// CHECK:STDOUT: %.loc17_36.4: init %i32 to %.loc17_36.3 = in_place_init %.loc17_36.2 [concrete = constants.%int_1.68a] // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_type_assign.carbon b/toolchain/check/testdata/struct/fail_type_assign.carbon index a8119c992b06..b593323d295d 100644 --- a/toolchain/check/testdata/struct/fail_type_assign.carbon +++ b/toolchain/check/testdata/struct/fail_type_assign.carbon @@ -12,12 +12,8 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_type_assign.carbon -// 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})` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var x: {.a: i32} = {.a: i32}; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_type_assign.carbon:[[@LINE+3]]:1-16: error: cannot implicitly convert expression of type `type` to `{.a: i32}` [ConversionFailure] +// CHECK:STDERR: fail_type_assign.carbon:[[@LINE+2]]:1-16: note: type `type` does not implement interface `Core.ImplicitAs({.a: i32})` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var x: {.a: i32} = {.a: i32}; @@ -55,7 +51,7 @@ var x: {.a: i32} = {.a: i32}; // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %x.var: ref %struct_type.a = var_storage %x.var_patt [concrete] -// CHECK:STDOUT: %.loc22: type = splice_block %struct_type.a [concrete = constants.%struct_type.a] { +// CHECK:STDOUT: %.loc18: type = splice_block %struct_type.a [concrete = constants.%struct_type.a] { // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %i32} [concrete = constants.%struct_type.a] // CHECK:STDOUT: } @@ -70,7 +66,7 @@ var x: {.a: i32} = {.a: i32}; // CHECK:STDOUT: !entry: // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %i32} [concrete = constants.%struct_type.a] -// CHECK:STDOUT: %.loc22: %struct_type.a = converted %struct_type.a, [concrete = ] +// CHECK:STDOUT: %.loc18: %struct_type.a = converted %struct_type.a, [concrete = ] // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_value_as_type.carbon b/toolchain/check/testdata/struct/fail_value_as_type.carbon index d082da51e30a..a127613757a2 100644 --- a/toolchain/check/testdata/struct/fail_value_as_type.carbon +++ b/toolchain/check/testdata/struct/fail_value_as_type.carbon @@ -12,12 +12,8 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_value_as_type.carbon -// 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)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var x: {.a = 1}; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_value_as_type.carbon:[[@LINE+3]]:8-15: error: cannot implicitly convert non-type value of type `{.a: Core.IntLiteral}` to `type` [ConversionFailureNonTypeToFacet] +// CHECK:STDERR: fail_value_as_type.carbon:[[@LINE+2]]:8-15: note: type `{.a: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var x: {.a = 1}; @@ -50,8 +46,8 @@ var x: {.a = 1}; // CHECK:STDOUT: %x.var: ref = var_storage %x.var_patt [concrete = ] // CHECK:STDOUT: %.1: = splice_block [concrete = ] { // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %.loc22_15.1: %struct_type.a = struct_literal (%int_1) [concrete = constants.%struct] -// CHECK:STDOUT: %.loc22_15.2: type = converted %.loc22_15.1, [concrete = ] +// CHECK:STDOUT: %.loc18_15.1: %struct_type.a = struct_literal (%int_1) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc18_15.2: type = converted %.loc18_15.1, [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %x: = wrapper_binding x, [concrete = ] // CHECK:STDOUT: name_binding_decl { diff --git a/toolchain/check/testdata/struct/import.carbon b/toolchain/check/testdata/struct/import.carbon index 25aacc4d95f3..fb3fa6949c80 100644 --- a/toolchain/check/testdata/struct/import.carbon +++ b/toolchain/check/testdata/struct/import.carbon @@ -34,25 +34,17 @@ var c: C({.a = 1, .b = 2}) = F(); // --- fail_bad_type.impl.carbon impl package Implicit; -// CHECK:STDERR: fail_bad_type.impl.carbon:[[@LINE+8]]:14: error: struct `{.a: i32, .b: i32}` has no field named `c` [StructInitUnexpectedFieldInLiteral] -// CHECK:STDERR: var c_bad: C({.c = 1, .d = 2}) = F(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_bad_type.impl.carbon:[[@LINE-4]]:1: in import [InImport] -// CHECK:STDERR: implicit.carbon:8:9: note: initializing generic parameter `S` declared here [InitializingGenericParam] -// CHECK:STDERR: class C(S: {.a: i32, .b: i32}) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_type.impl.carbon:[[@LINE+4]]:14-29: error: struct `{.a: i32, .b: i32}` has no field named `c` [StructInitUnexpectedFieldInLiteral] +// CHECK:STDERR: imported from: fail_bad_type.impl.carbon:[[@LINE-2]]:1 [InImport] +// CHECK:STDERR: implicit.carbon:8:9-29: note: initializing generic parameter `S` declared here [InitializingGenericParam] // CHECK:STDERR: var c_bad: C({.c = 1, .d = 2}) = F(); // --- fail_bad_value.impl.carbon 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}))` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var c_bad: C({.a = 3, .b = 4}) = F(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_value.impl.carbon:[[@LINE+3]]:1-30: error: cannot implicitly convert expression of type `C({.a = 1, .b = 2})` to `C({.a = 3, .b = 4})` [ConversionFailure] +// CHECK:STDERR: fail_bad_value.impl.carbon:[[@LINE+2]]:1-30: 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(); diff --git a/toolchain/check/testdata/tuple/class_tuples.carbon b/toolchain/check/testdata/tuple/class_tuples.carbon index 6c2e0fcb7ba0..af79313cf6fb 100644 --- a/toolchain/check/testdata/tuple/class_tuples.carbon +++ b/toolchain/check/testdata/tuple/class_tuples.carbon @@ -21,12 +21,8 @@ class D {} var c: C; 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*)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var x: (C*, C*) = (c, d); -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_element_type_mismatch.carbon:[[@LINE+3]]:19-24: error: cannot implicitly convert expression of type `C` to `C*` [ConversionFailure] +// CHECK:STDERR: fail_element_type_mismatch.carbon:[[@LINE+2]]:19-24: note: type `C` does not implement interface `Core.ImplicitAs(C*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var x: (C*, C*) = (c, d); @@ -36,12 +32,8 @@ library "[[@TEST_NAME]]"; class Complete {} class Incomplete; -// CHECK:STDERR: fail_nested_incomplete.carbon:[[@LINE+7]]:8: error: binding pattern has incomplete type `(Complete, Incomplete)` in name binding declaration [IncompleteTypeInBindingDecl] -// CHECK:STDERR: var t: (Complete, Incomplete); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_nested_incomplete.carbon:[[@LINE-5]]:1: note: class was forward declared here [ClassForwardDeclaredHere] -// CHECK:STDERR: class Incomplete; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_nested_incomplete.carbon:[[@LINE+3]]:8-29: error: binding pattern has incomplete type `(Complete, Incomplete)` in name binding declaration [IncompleteTypeInBindingDecl] +// CHECK:STDERR: fail_nested_incomplete.carbon:[[@LINE-3]]:1-17: note: class was forward declared here [ClassForwardDeclaredHere] // CHECK:STDERR: var t: (Complete, Incomplete); @@ -52,12 +44,8 @@ library "[[@TEST_NAME]]"; 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)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var x: (C, ) = (C, ); -// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: fail_type_assign.carbon:[[@LINE+3]]:16-20: error: cannot implicitly convert expression of type `type` to `C` [ConversionFailure] +// CHECK:STDERR: fail_type_assign.carbon:[[@LINE+2]]:16-20: note: type `type` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var x: (C, ) = (C, ); @@ -67,11 +55,7 @@ library "[[@TEST_NAME]]"; class C {} 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)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var x: c; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_value_as_type.carbon:[[@LINE+3]]:8: error: cannot implicitly convert non-type value of type `C` to `type` [ConversionFailureNonTypeToFacet] +// CHECK:STDERR: fail_value_as_type.carbon:[[@LINE+2]]:8: note: type `C` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var x: c; diff --git a/toolchain/check/testdata/tuple/element_access.carbon b/toolchain/check/testdata/tuple/element_access.carbon index 00ee0181b49e..61b0c8975f17 100644 --- a/toolchain/check/testdata/tuple/element_access.carbon +++ b/toolchain/check/testdata/tuple/element_access.carbon @@ -93,9 +93,7 @@ fn Run() -> i32 { library "[[@TEST_NAME]]"; var a: (i32, i32) = (12, 6); -// CHECK:STDERR: fail_access_error.carbon:[[@LINE+4]]:17: error: name `oops` not found [NameNotFound] -// CHECK:STDERR: var b: i32 = a.(oops); -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_access_error.carbon:[[@LINE+2]]:17-20: error: name `oops` not found [NameNotFound] // CHECK:STDERR: var b: i32 = a.(oops); @@ -105,9 +103,7 @@ library "[[@TEST_NAME]]"; fn F() {} fn Run() { - // CHECK:STDERR: fail_empty_access.carbon:[[@LINE+4]]:3: error: tuple element index `0` is past the end of type `()` [TupleIndexOutOfBounds] - // CHECK:STDERR: F().0; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_empty_access.carbon:[[@LINE+2]]:3-7: error: tuple element index `0` is past the end of type `()` [TupleIndexOutOfBounds] // CHECK:STDERR: F().0; } @@ -117,14 +113,10 @@ library "[[@TEST_NAME]]"; var a: (i32,) = (12,); var b: (i32,) = a; -// CHECK:STDERR: fail_large_index.carbon:[[@LINE+4]]:14: error: tuple element index `1` is past the end of type `(i32,)` [TupleIndexOutOfBounds] -// CHECK:STDERR: var c: i32 = b.1; -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_large_index.carbon:[[@LINE+2]]:14-16: error: tuple element index `1` is past the end of type `(i32,)` [TupleIndexOutOfBounds] // CHECK:STDERR: var c: i32 = b.1; -// CHECK:STDERR: fail_large_index.carbon:[[@LINE+4]]:14: error: tuple element index `2147483647` is past the end of type `(i32,)` [TupleIndexOutOfBounds] -// CHECK:STDERR: var d: i32 = b.(0x7FFF_FFFF); -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_large_index.carbon:[[@LINE+2]]:14-28: error: tuple element index `2147483647` is past the end of type `(i32,)` [TupleIndexOutOfBounds] // CHECK:STDERR: var d: i32 = b.(0x7FFF_FFFF); @@ -132,9 +124,7 @@ var d: i32 = b.(0x7FFF_FFFF); library "[[@TEST_NAME]]"; var a: (i32, i32) = (12, 6); -// CHECK:STDERR: fail_negative_indexing.carbon:[[@LINE+4]]:14: error: tuple element index `-10` is past the end of type `(i32, i32)` [TupleIndexOutOfBounds] -// CHECK:STDERR: var b: i32 = a.(-10); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_negative_indexing.carbon:[[@LINE+2]]:14-20: error: tuple element index `-10` is past the end of type `(i32, i32)` [TupleIndexOutOfBounds] // CHECK:STDERR: var b: i32 = a.(-10); @@ -143,16 +133,10 @@ library "[[@TEST_NAME]]"; var a: (i32, i32) = (2, 3); var b: i32 = 0; -// CHECK:STDERR: fail_non_deterministic_type.carbon:[[@LINE+11]]:17: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] -// CHECK:STDERR: var c: i32 = a.(b); -// CHECK:STDERR: ^ -// CHECK:STDERR: min_prelude/parts/int.carbon:27:3: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] -// CHECK:STDERR: fn Convert(self) -> IntLiteral = "int.convert_checked"; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_non_deterministic_type.carbon:[[@LINE+5]]:17: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: min_prelude/parts/int.carbon:27:3-34: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] // CHECK:STDERR: -// CHECK:STDERR: fail_non_deterministic_type.carbon:[[@LINE+4]]:14: error: tuple index must be a constant [TupleIndexNotConstant] -// CHECK:STDERR: var c: i32 = a.(b); -// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: fail_non_deterministic_type.carbon:[[@LINE+2]]:14-18: error: tuple index must be a constant [TupleIndexNotConstant] // CHECK:STDERR: var c: i32 = a.(b); @@ -160,12 +144,8 @@ var c: i32 = a.(b); library "[[@TEST_NAME]]"; 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)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var b: i32 = a.(2.6); -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_non_int_indexing.carbon:[[@LINE+3]]:17-19: error: cannot implicitly convert expression of type `Core.FloatLiteral` to `Core.IntLiteral` [ConversionFailure] +// CHECK:STDERR: fail_non_int_indexing.carbon:[[@LINE+2]]:17-19: note: type `Core.FloatLiteral` does not implement interface `Core.ImplicitAs(Core.IntLiteral)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var b: i32 = a.(2.6); @@ -174,9 +154,7 @@ library "[[@TEST_NAME]]"; fn Main() { var non_tuple: array(i32, 2) = (5, 5); - // CHECK:STDERR: fail_non_tuple_access.carbon:[[@LINE+4]]:27: error: type `array(i32, 2)` does not support tuple indexing; only tuples can be indexed that way [TupleIndexOnANonTupleType] - // CHECK:STDERR: var unused first: i32 = non_tuple.0; - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_non_tuple_access.carbon:[[@LINE+2]]:27-37: error: type `array(i32, 2)` does not support tuple indexing; only tuples can be indexed that way [TupleIndexOnANonTupleType] // CHECK:STDERR: var unused first: i32 = non_tuple.0; } @@ -185,9 +163,7 @@ fn Main() { library "[[@TEST_NAME]]"; var a: (i32, i32) = (12, 6); -// CHECK:STDERR: fail_out_of_bound_access.carbon:[[@LINE+4]]:14: error: tuple element index `2` is past the end of type `(i32, i32)` [TupleIndexOutOfBounds] -// CHECK:STDERR: var b: i32 = a.2; -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_out_of_bound_access.carbon:[[@LINE+2]]:14-16: error: tuple element index `2` is past the end of type `(i32, i32)` [TupleIndexOutOfBounds] // CHECK:STDERR: var b: i32 = a.2; @@ -195,9 +171,7 @@ var b: i32 = a.2; library "[[@TEST_NAME]]"; var a: (i32, i32) = (12, 34); -// CHECK:STDERR: fail_out_of_bound_not_literal.carbon:[[@LINE+4]]:14: error: tuple element index `2` is past the end of type `(i32, i32)` [TupleIndexOutOfBounds] -// CHECK:STDERR: var b: i32 = a.({.index = 2}.index); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_out_of_bound_not_literal.carbon:[[@LINE+2]]:14-35: error: tuple element index `2` is past the end of type `(i32, i32)` [TupleIndexOutOfBounds] // CHECK:STDERR: var b: i32 = a.({.index = 2}.index); diff --git a/toolchain/check/testdata/tuple/import.carbon b/toolchain/check/testdata/tuple/import.carbon index 282ac2432207..a087a39086e6 100644 --- a/toolchain/check/testdata/tuple/import.carbon +++ b/toolchain/check/testdata/tuple/import.carbon @@ -35,13 +35,9 @@ var c: C((1, 2)) = F(); impl package Implicit; -// CHECK:STDERR: fail_bad_type.impl.carbon:[[@LINE+8]]:14: error: cannot initialize tuple of 2 elements from tuple with 3 elements [TupleInitElementCountMismatch] -// CHECK:STDERR: var c_bad: C((1, 2, 3)) = F(); -// CHECK:STDERR: ^~~~~~~~~ -// CHECK:STDERR: fail_bad_type.impl.carbon:[[@LINE-5]]:1: in import [InImport] -// CHECK:STDERR: implicit.carbon:7:9: note: initializing generic parameter `X` declared here [InitializingGenericParam] -// CHECK:STDERR: class C(X: (i32, i32)) {} -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_type.impl.carbon:[[@LINE+4]]:14-22: error: cannot initialize tuple of 2 elements from tuple with 3 elements [TupleInitElementCountMismatch] +// CHECK:STDERR: imported from: fail_bad_type.impl.carbon:[[@LINE-3]]:1 [InImport] +// CHECK:STDERR: implicit.carbon:7:9-21: note: initializing generic parameter `X` declared here [InitializingGenericParam] // CHECK:STDERR: var c_bad: C((1, 2, 3)) = F(); @@ -49,12 +45,8 @@ var c_bad: C((1, 2, 3)) = F(); 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)))` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var c_bad: C((3, 4)) = F(); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_bad_value.impl.carbon:[[@LINE+3]]:1-20: error: cannot implicitly convert expression of type `C((1, 2))` to `C((3, 4))` [ConversionFailure] +// CHECK:STDERR: fail_bad_value.impl.carbon:[[@LINE+2]]:1-20: note: type `C((1, 2))` does not implement interface `Core.ImplicitAs(C((3, 4)))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var c_bad: C((3, 4)) = F(); diff --git a/toolchain/check/testdata/tuple/size_mismatch.carbon b/toolchain/check/testdata/tuple/size_mismatch.carbon index 915671d4242f..4939d4e71f4b 100644 --- a/toolchain/check/testdata/tuple/size_mismatch.carbon +++ b/toolchain/check/testdata/tuple/size_mismatch.carbon @@ -13,35 +13,27 @@ // --- fail_assign_from_empty.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_assign_from_empty.carbon:[[@LINE+4]]:16: error: cannot initialize tuple of 1 element from tuple with 0 elements [TupleInitElementCountMismatch] -// CHECK:STDERR: var x: ((),) = (); -// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_assign_from_empty.carbon:[[@LINE+2]]:16-17: error: cannot initialize tuple of 1 element from tuple with 0 elements [TupleInitElementCountMismatch] // CHECK:STDERR: var x: ((),) = (); // --- fail_assign_to_empty.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_assign_to_empty.carbon:[[@LINE+4]]:13: error: cannot initialize tuple of 0 elements from tuple with 1 element [TupleInitElementCountMismatch] -// CHECK:STDERR: var x: () = ((),); -// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: fail_assign_to_empty.carbon:[[@LINE+2]]:13-17: error: cannot initialize tuple of 0 elements from tuple with 1 element [TupleInitElementCountMismatch] // CHECK:STDERR: var x: () = ((),); // --- fail_assign_nested.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_assign_nested.carbon:[[@LINE+4]]:32: error: cannot initialize tuple of 2 elements from tuple with 3 elements [TupleInitElementCountMismatch] -// CHECK:STDERR: var x: (((), ()), ((), ())) = (((), (), ()), ((), (), ())); -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_assign_nested.carbon:[[@LINE+2]]:32-43: error: cannot initialize tuple of 2 elements from tuple with 3 elements [TupleInitElementCountMismatch] // CHECK:STDERR: var x: (((), ()), ((), ())) = (((), (), ()), ((), (), ())); // --- fail_too_few_elements.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_few_elements.carbon:[[@LINE+4]]:19: error: cannot initialize tuple of 2 elements from tuple with 1 element [TupleInitElementCountMismatch] -// CHECK:STDERR: var x: ((), ()) = ((), ); -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_too_few_elements.carbon:[[@LINE+2]]:19-24: error: cannot initialize tuple of 2 elements from tuple with 1 element [TupleInitElementCountMismatch] // CHECK:STDERR: var x: ((), ()) = ((), ); diff --git a/toolchain/check/testdata/tuple/tuple_pattern.carbon b/toolchain/check/testdata/tuple/tuple_pattern.carbon index 4cf6b558e3e8..a3d2ffbb687f 100644 --- a/toolchain/check/testdata/tuple/tuple_pattern.carbon +++ b/toolchain/check/testdata/tuple/tuple_pattern.carbon @@ -72,9 +72,7 @@ let (x: {}, y: {}) = ({}, {}); library "[[@TEST_NAME]]"; class C { - // CHECK:STDERR: fail_in_class.carbon:[[@LINE+4]]:20: error: found tuple pattern in class `var` decl [FieldWithTuplePattern] - // CHECK:STDERR: var (x: {}, y: {}); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_in_class.carbon:[[@LINE+2]]:20: error: found tuple pattern in class `var` decl [FieldWithTuplePattern] // CHECK:STDERR: var (x: {}, y: {}); } @@ -83,15 +81,11 @@ class C { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_initializer_mismatch.carbon:[[@LINE+4]]:5: error: tuple pattern expects 2 elements, but tuple literal has 1 [TuplePatternSizeDoesntMatchLiteral] -// CHECK:STDERR: let (x: {}, y: {}) = ({},); -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_initializer_mismatch.carbon:[[@LINE+2]]:5-18: error: tuple pattern expects 2 elements, but tuple literal has 1 [TuplePatternSizeDoesntMatchLiteral] // CHECK:STDERR: let (x: {}, y: {}) = ({},); -// CHECK:STDERR: fail_initializer_mismatch.carbon:[[@LINE+4]]:5: error: tuple pattern expects 2 elements, but tuple literal has 3 [TuplePatternSizeDoesntMatchLiteral] -// CHECK:STDERR: let (a: {}, b: {}) = ({}, {}, {}); -// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: fail_initializer_mismatch.carbon:[[@LINE+2]]:5-18: error: tuple pattern expects 2 elements, but tuple literal has 3 [TuplePatternSizeDoesntMatchLiteral] // CHECK:STDERR: let (a: {}, b: {}) = ({}, {}, {}); diff --git a/toolchain/check/testdata/typeof/basics.carbon b/toolchain/check/testdata/typeof/basics.carbon index 1cb970c845a0..3a750d412f99 100644 --- a/toolchain/check/testdata/typeof/basics.carbon +++ b/toolchain/check/testdata/typeof/basics.carbon @@ -61,9 +61,7 @@ fn F(a: bool, b: bool) { library "[[@TEST_NAME]]"; let a: bool = true; -// CHECK:STDERR: fail_todo_control_flow_file_scope.carbon:[[@LINE+4]]:15: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] -// CHECK:STDERR: let b: typeof(a or a) = false; -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_todo_control_flow_file_scope.carbon:[[@LINE+2]]:15-20: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] // CHECK:STDERR: let b: typeof(a or a) = false; @@ -102,12 +100,8 @@ class C {} fn G[T: type](x: T, unused y: typeof(x)) {} fn Call() { - // CHECK:STDERR: fail_generic_mismatch.carbon:[[@LINE+7]]:3: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent] - // CHECK:STDERR: G(true, {} as C); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_generic_mismatch.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn G[T: type](x: T, unused y: typeof(x)) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_generic_mismatch.carbon:[[@LINE+3]]:3-18: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent] + // CHECK:STDERR: fail_generic_mismatch.carbon:[[@LINE-4]]:1-42: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: G(true, {} as C); } @@ -116,9 +110,7 @@ fn Call() { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_undeclared.carbon:[[@LINE+4]]:15: error: name `undeclared` not found [NameNotFound] -// CHECK:STDERR: var x: typeof(undeclared); -// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: fail_undeclared.carbon:[[@LINE+2]]:15-24: error: name `undeclared` not found [NameNotFound] // CHECK:STDERR: var x: typeof(undeclared); diff --git a/toolchain/check/testdata/var/fail_duplicate_decl.carbon b/toolchain/check/testdata/var/fail_duplicate_decl.carbon index c9da412cea4a..b989cda53356 100644 --- a/toolchain/check/testdata/var/fail_duplicate_decl.carbon +++ b/toolchain/check/testdata/var/fail_duplicate_decl.carbon @@ -16,12 +16,8 @@ fn Main() { var unused x: () = (); - // CHECK:STDERR: fail_basic.carbon:[[@LINE+7]]:14: error: duplicate name `x` being declared in the same scope [NameDeclDuplicate] - // CHECK:STDERR: var unused x: () = (); - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_basic.carbon:[[@LINE-4]]:14: note: name is previously declared here [NameDeclPrevious] - // CHECK:STDERR: var unused x: () = (); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_basic.carbon:[[@LINE+3]]:14: error: duplicate name `x` being declared in the same scope [NameDeclDuplicate] + // CHECK:STDERR: fail_basic.carbon:[[@LINE-2]]:14-18: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: var unused x: () = (); } @@ -42,11 +38,11 @@ fn Main() { // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] // CHECK:STDOUT: %self.param_patt.65a: %pattern_type.cb1 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.df1: %pattern_type.cb1 = wrapper_binding_pattern self, %self.param_patt.65a [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfc: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc11 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfc: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc7 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01: %Destroy.WithSelf.SubobjectDestroy.type.dfc = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef0: type = fn_type @Destroy.WithSelf.Op.loc11 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef0: type = fn_type @Destroy.WithSelf.Op.loc7 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403: %Destroy.WithSelf.Op.type.ef0 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbc: type = fn_type @Destroy.WithSelf.SelfDestruct.loc11 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbc: type = fn_type @Destroy.WithSelf.SelfDestruct.loc7 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3: %Destroy.WithSelf.SelfDestruct.type.fbc = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -60,14 +56,14 @@ fn Main() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl: %Destroy.WithSelf.SubobjectDestroy.type.dfc = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc11 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl: %Destroy.WithSelf.SubobjectDestroy.type.dfc = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc7 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01] { // CHECK:STDOUT: %self.param_patt: %pattern_type.cb1 = ref_param_pattern [concrete = constants.%self.param_patt.65a] // CHECK:STDOUT: %self.patt: %pattern_type.cb1 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.df1] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %empty_tuple.type = ref_param call_param0 // CHECK:STDOUT: %self: ref %empty_tuple.type = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl: %Destroy.WithSelf.Op.type.ef0 = fn_decl @Destroy.WithSelf.Op.loc11 [concrete = constants.%Destroy.WithSelf.Op.403] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl: %Destroy.WithSelf.Op.type.ef0 = fn_decl @Destroy.WithSelf.Op.loc7 [concrete = constants.%Destroy.WithSelf.Op.403] { // CHECK:STDOUT: %self.param_patt: %pattern_type.cb1 = ref_param_pattern [concrete = constants.%self.param_patt.65a] // CHECK:STDOUT: %self.patt: %pattern_type.cb1 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.df1] // CHECK:STDOUT: } { @@ -101,32 +97,32 @@ fn Main() { // CHECK:STDOUT: %x.patt.loc3: %pattern_type.cb1 = ref_binding_pattern x [concrete = constants.%x.patt.06838d.1] // CHECK:STDOUT: %x.var_patt.loc3: %pattern_type.cb1 = var_pattern %x.patt.loc3 [concrete = constants.%x.var_patt.28d573.1] // CHECK:STDOUT: } -// CHECK:STDOUT: %x.var.loc11: ref %empty_tuple.type = var_storage %x.var_patt.loc11 -// CHECK:STDOUT: %.loc11_23.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc11_23.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc11_3: init %empty_tuple.type = converted %.loc11_23.1, %.loc11_23.2 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: assign %x.var.loc11, %.loc11_3 -// CHECK:STDOUT: %.loc11_18.1: type = splice_block %.loc11_18.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc11_18.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc11_18.3: type = converted %.loc11_18.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %x.var.loc7: ref %empty_tuple.type = var_storage %x.var_patt.loc7 +// CHECK:STDOUT: %.loc7_23.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc7_23.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc7_3: init %empty_tuple.type = converted %.loc7_23.1, %.loc7_23.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: assign %x.var.loc7, %.loc7_3 +// CHECK:STDOUT: %.loc7_18.1: type = splice_block %.loc7_18.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc7_18.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc7_18.3: type = converted %.loc7_18.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %x.loc11: ref %empty_tuple.type = wrapper_binding x, %x.var.loc11 +// CHECK:STDOUT: %x.loc7: ref %empty_tuple.type = wrapper_binding x, %x.var.loc7 // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %x.patt.loc11: %pattern_type.cb1 = ref_binding_pattern x [concrete = constants.%x.patt.06838d.2] -// CHECK:STDOUT: %x.var_patt.loc11: %pattern_type.cb1 = var_pattern %x.patt.loc11 [concrete = constants.%x.var_patt.28d573.2] +// CHECK:STDOUT: %x.patt.loc7: %pattern_type.cb1 = ref_binding_pattern x [concrete = constants.%x.patt.06838d.2] +// CHECK:STDOUT: %x.var_patt.loc7: %pattern_type.cb1 = var_pattern %x.patt.loc7 [concrete = constants.%x.var_patt.28d573.2] // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc11: = bound_method %x.var.loc11, constants.%Destroy.WithSelf.SelfDestruct.db3 -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc11: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc11(%x.var.loc11) +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc7: = bound_method %x.var.loc7, constants.%Destroy.WithSelf.SelfDestruct.db3 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc7: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc7(%x.var.loc7) // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc3: = bound_method %x.var.loc3, constants.%Destroy.WithSelf.SelfDestruct.db3 // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc3: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc3(%x.var.loc3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc11(%self.param: ref %empty_tuple.type) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc7(%self.param: ref %empty_tuple.type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc11(%self.param: ref %empty_tuple.type) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc7(%self.param: ref %empty_tuple.type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc11(%self.param: ref %empty_tuple.type) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc7(%self.param: ref %empty_tuple.type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl(%self.param) diff --git a/toolchain/check/testdata/var/fail_generic.carbon b/toolchain/check/testdata/var/fail_generic.carbon index 6168a499f692..e37cd55a7117 100644 --- a/toolchain/check/testdata/var/fail_generic.carbon +++ b/toolchain/check/testdata/var/fail_generic.carbon @@ -13,13 +13,9 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/fail_generic.carbon fn Main() { - // CHECK:STDERR: fail_generic.carbon:[[@LINE+8]]:15: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] - // CHECK:STDERR: var generic x: () = (); - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_generic.carbon:[[@LINE+4]]:15-19: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: - // CHECK:STDERR: fail_generic.carbon:[[@LINE+4]]:21: error: found generic binding inside `var` pattern [NonRegularBindingInVarDecl] - // CHECK:STDERR: var generic x: () = (); - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_generic.carbon:[[@LINE+2]]:21: error: found generic binding inside `var` pattern [NonRegularBindingInVarDecl] // CHECK:STDERR: var generic x: () = (); } diff --git a/toolchain/check/testdata/var/fail_init_type_mismatch.carbon b/toolchain/check/testdata/var/fail_init_type_mismatch.carbon index 1588d82a7107..4183cf8b593e 100644 --- a/toolchain/check/testdata/var/fail_init_type_mismatch.carbon +++ b/toolchain/check/testdata/var/fail_init_type_mismatch.carbon @@ -12,12 +12,8 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/fail_init_type_mismatch.carbon -// 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({})` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: var x: {} = (); -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_init_type_mismatch.carbon:[[@LINE+3]]:1-9: error: cannot implicitly convert expression of type `()` to `{}` [ConversionFailure] +// CHECK:STDERR: fail_init_type_mismatch.carbon:[[@LINE+2]]:1-9: note: type `()` does not implement interface `Core.ImplicitAs({})` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var x: {} = (); @@ -52,9 +48,9 @@ var x: {} = (); // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %x.var: ref %empty_struct_type = var_storage %x.var_patt [concrete] -// CHECK:STDOUT: %.loc22_9.1: type = splice_block %.loc22_9.3 [concrete = constants.%empty_struct_type] { -// CHECK:STDOUT: %.loc22_9.2: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc22_9.3: type = converted %.loc22_9.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc18_9.1: type = splice_block %.loc18_9.3 [concrete = constants.%empty_struct_type] { +// CHECK:STDOUT: %.loc18_9.2: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc18_9.3: type = converted %.loc18_9.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %empty_struct_type = wrapper_binding x, %x.var [concrete = %x.var] // CHECK:STDOUT: name_binding_decl { @@ -65,8 +61,8 @@ var x: {} = (); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc22_14: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc22_1: %empty_struct_type = converted %.loc22_14, [concrete = ] +// CHECK:STDOUT: %.loc18_14: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc18_1: %empty_struct_type = converted %.loc18_14, [concrete = ] // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/var/fail_init_with_self.carbon b/toolchain/check/testdata/var/fail_init_with_self.carbon index cb8ce817c659..3e52ef85f6f4 100644 --- a/toolchain/check/testdata/var/fail_init_with_self.carbon +++ b/toolchain/check/testdata/var/fail_init_with_self.carbon @@ -15,16 +15,10 @@ // --- fail_basic.carbon fn Main() { - // CHECK:STDERR: fail_basic.carbon:[[@LINE+11]]:22: error: `x` used before initialization [UsedBeforeInitialization] - // CHECK:STDERR: var unused x: () = x; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_basic.carbon:[[@LINE+5]]:22: error: `x` used before initialization [UsedBeforeInitialization] // CHECK:STDERR: - // CHECK:STDERR: fail_basic.carbon:[[@LINE+7]]:14: error: variable `x` marked `unused` but used [UnusedButUsed] - // CHECK:STDERR: var unused x: () = x; - // CHECK:STDERR: ^~~~~ - // CHECK:STDERR: fail_basic.carbon:[[@LINE+4]]:22: note: usage here [UnusedButUsedHere] - // CHECK:STDERR: var unused x: () = x; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_basic.carbon:[[@LINE+3]]:14-18: error: variable `x` marked `unused` but used [UnusedButUsed] + // CHECK:STDERR: fail_basic.carbon:[[@LINE+2]]:22: note: usage here [UnusedButUsedHere] // CHECK:STDERR: var unused x: () = x; } @@ -43,11 +37,11 @@ fn Main() { // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] // CHECK:STDOUT: %self.param_patt.65a: %pattern_type.cb1 = ref_param_pattern [concrete] // CHECK:STDOUT: %self.patt.df1: %pattern_type.cb1 = wrapper_binding_pattern self, %self.param_patt.65a [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfc: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc14 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfc: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc8 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01: %Destroy.WithSelf.SubobjectDestroy.type.dfc = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef0: type = fn_type @Destroy.WithSelf.Op.loc14 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef0: type = fn_type @Destroy.WithSelf.Op.loc8 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.403: %Destroy.WithSelf.Op.type.ef0 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbc: type = fn_type @Destroy.WithSelf.SelfDestruct.loc14 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbc: type = fn_type @Destroy.WithSelf.SelfDestruct.loc8 [concrete] // CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3: %Destroy.WithSelf.SelfDestruct.type.fbc = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -61,14 +55,14 @@ fn Main() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl: %Destroy.WithSelf.SubobjectDestroy.type.dfc = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc14 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01] { +// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl: %Destroy.WithSelf.SubobjectDestroy.type.dfc = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc8 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01] { // CHECK:STDOUT: %self.param_patt: %pattern_type.cb1 = ref_param_pattern [concrete = constants.%self.param_patt.65a] // CHECK:STDOUT: %self.patt: %pattern_type.cb1 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.df1] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %empty_tuple.type = ref_param call_param0 // CHECK:STDOUT: %self: ref %empty_tuple.type = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl: %Destroy.WithSelf.Op.type.ef0 = fn_decl @Destroy.WithSelf.Op.loc14 [concrete = constants.%Destroy.WithSelf.Op.403] { +// CHECK:STDOUT: %Destroy.WithSelf.Op.decl: %Destroy.WithSelf.Op.type.ef0 = fn_decl @Destroy.WithSelf.Op.loc8 [concrete = constants.%Destroy.WithSelf.Op.403] { // CHECK:STDOUT: %self.param_patt: %pattern_type.cb1 = ref_param_pattern [concrete = constants.%self.param_patt.65a] // CHECK:STDOUT: %self.patt: %pattern_type.cb1 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.df1] // CHECK:STDOUT: } { @@ -91,9 +85,9 @@ fn Main() { // CHECK:STDOUT: %x.var: ref %empty_tuple.type = var_storage %x.var_patt // CHECK:STDOUT: %x.ref: = name_ref x, [concrete = ] // CHECK:STDOUT: assign %x.var, -// CHECK:STDOUT: %.loc14_18.1: type = splice_block %.loc14_18.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc14_18.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc14_18.3: type = converted %.loc14_18.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc8_18.1: type = splice_block %.loc8_18.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc8_18.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_18.3: type = converted %.loc8_18.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %empty_tuple.type = wrapper_binding x, %x.var // CHECK:STDOUT: name_binding_decl { @@ -105,11 +99,11 @@ fn Main() { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc14(%self.param: ref %empty_tuple.type) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc8(%self.param: ref %empty_tuple.type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc14(%self.param: ref %empty_tuple.type) = "no_op"; +// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc8(%self.param: ref %empty_tuple.type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc14(%self.param: ref %empty_tuple.type) { +// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc8(%self.param: ref %empty_tuple.type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl(%self.param) // CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl(%self.param) diff --git a/toolchain/check/testdata/var/fail_lookup_outside_scope.carbon b/toolchain/check/testdata/var/fail_lookup_outside_scope.carbon index afd8f8916029..a983fff32094 100644 --- a/toolchain/check/testdata/var/fail_lookup_outside_scope.carbon +++ b/toolchain/check/testdata/var/fail_lookup_outside_scope.carbon @@ -16,8 +16,6 @@ fn Main() { var unused x: (); } -// CHECK:STDERR: fail_basic.carbon:[[@LINE+4]]:13: error: name `x` not found [NameNotFound] -// CHECK:STDERR: var y: () = x; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_basic.carbon:[[@LINE+2]]:13: error: name `x` not found [NameNotFound] // CHECK:STDERR: var y: () = x; diff --git a/toolchain/check/testdata/var/fail_modifiers.carbon b/toolchain/check/testdata/var/fail_modifiers.carbon index d95431d98bf8..50af15f184fe 100644 --- a/toolchain/check/testdata/var/fail_modifiers.carbon +++ b/toolchain/check/testdata/var/fail_modifiers.carbon @@ -10,36 +10,22 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/fail_modifiers.carbon -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `protected` not allowed; requires class scope [ModifierProtectedNotAllowed] -// CHECK:STDERR: protected var b: () = (); -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-9: error: `protected` not allowed; requires class scope [ModifierProtectedNotAllowed] // CHECK:STDERR: protected var b: () = (); -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:9: error: `protected` not allowed on declaration with `private` [ModifierNotAllowedWith] -// CHECK:STDERR: private protected var c: () = (); -// CHECK:STDERR: ^~~~~~~~~ -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: note: `private` previously appeared here [ModifierPrevious] -// CHECK:STDERR: private protected var c: () = (); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+3]]:9-17: error: `protected` not allowed on declaration with `private` [ModifierNotAllowedWith] +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-7: note: `private` previously appeared here [ModifierPrevious] // CHECK:STDERR: private protected var c: () = (); -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+11]]:11: error: `protected` repeated on declaration [ModifierRepeated] -// CHECK:STDERR: protected protected var d: () = (); -// CHECK:STDERR: ^~~~~~~~~ -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+8]]:1: note: `protected` previously appeared here [ModifierPrevious] -// CHECK:STDERR: protected protected var d: () = (); -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+5]]:11-19: error: `protected` repeated on declaration [ModifierRepeated] +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1-9: note: `protected` previously appeared here [ModifierPrevious] // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `protected` not allowed; requires class scope [ModifierProtectedNotAllowed] -// CHECK:STDERR: protected protected var d: () = (); -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-9: error: `protected` not allowed; requires class scope [ModifierProtectedNotAllowed] // CHECK:STDERR: protected protected var d: () = (); -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `abstract` not allowed on `var` declaration [ModifierNotAllowedOnDeclaration] -// CHECK:STDERR: abstract var e: () = (); -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-8: error: `abstract` not allowed on `var` declaration [ModifierNotAllowedOnDeclaration] // CHECK:STDERR: abstract var e: () = (); diff --git a/toolchain/check/testdata/var/fail_namespace_conflict.carbon b/toolchain/check/testdata/var/fail_namespace_conflict.carbon index b00d6f6ecc78..fc19dbff494b 100644 --- a/toolchain/check/testdata/var/fail_namespace_conflict.carbon +++ b/toolchain/check/testdata/var/fail_namespace_conflict.carbon @@ -12,20 +12,12 @@ namespace A; -// CHECK:STDERR: fail_namespace_conflict.carbon:[[@LINE+7]]:5: error: duplicate name `A` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: var A: (); -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_namespace_conflict.carbon:[[@LINE-5]]:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: namespace A; -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_namespace_conflict.carbon:[[@LINE+3]]:5: error: duplicate name `A` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_namespace_conflict.carbon:[[@LINE-3]]:1-12: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: var A: (); -// CHECK:STDERR: fail_namespace_conflict.carbon:[[@LINE+7]]:5: error: duplicate name `A` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: var A: () = (); -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_namespace_conflict.carbon:[[@LINE-14]]:1: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: namespace A; -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_namespace_conflict.carbon:[[@LINE+3]]:5: error: duplicate name `A` being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_namespace_conflict.carbon:[[@LINE-8]]:1-12: note: name is previously declared here [NameDeclPrevious] // CHECK:STDERR: var A: () = (); diff --git a/toolchain/check/testdata/var/fail_not_copyable.carbon b/toolchain/check/testdata/var/fail_not_copyable.carbon index cd92f822cbcd..b1ae9bc915d7 100644 --- a/toolchain/check/testdata/var/fail_not_copyable.carbon +++ b/toolchain/check/testdata/var/fail_not_copyable.carbon @@ -15,12 +15,8 @@ class X { fn F(x: X) { // TODO: Decide on rules for when classes are copyable. - // 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` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var unused y: X = x; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_not_copyable.carbon:[[@LINE+3]]:21: error: cannot copy value of type `X` [CopyOfUncopyableType] + // CHECK:STDERR: fail_not_copyable.carbon:[[@LINE+2]]:21: note: type `X` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused y: X = x; } diff --git a/toolchain/check/testdata/var/fail_storage_is_literal.carbon b/toolchain/check/testdata/var/fail_storage_is_literal.carbon index f1633ea22c51..68938d34036a 100644 --- a/toolchain/check/testdata/var/fail_storage_is_literal.carbon +++ b/toolchain/check/testdata/var/fail_storage_is_literal.carbon @@ -13,12 +13,8 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/fail_storage_is_literal.carbon 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: var unused x: 1 = 1; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_storage_is_literal.carbon:[[@LINE+3]]:17: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: fail_storage_is_literal.carbon:[[@LINE+2]]:17: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused x: 1 = 1; } @@ -58,11 +54,11 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %x.var: ref = var_storage %x.var_patt [concrete = ] -// CHECK:STDOUT: %int_1.loc23_21: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %int_1.loc19_21: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: %.1: = splice_block [concrete = ] { -// CHECK:STDOUT: %int_1.loc23_17: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %.loc23: type = converted %int_1.loc23_17, [concrete = ] +// CHECK:STDOUT: %int_1.loc19_17: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %.loc19: type = converted %int_1.loc19_17, [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %x: = wrapper_binding x, [concrete = ] // CHECK:STDOUT: name_binding_decl { diff --git a/toolchain/check/testdata/var/fail_todo_control_flow_init.carbon b/toolchain/check/testdata/var/fail_todo_control_flow_init.carbon index b536b4db874f..63f8582a1122 100644 --- a/toolchain/check/testdata/var/fail_todo_control_flow_init.carbon +++ b/toolchain/check/testdata/var/fail_todo_control_flow_init.carbon @@ -16,17 +16,11 @@ library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_if_true.carbon:[[@LINE+12]]:13: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] -// CHECK:STDERR: var x: () = if true then () else (); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_if_true.carbon:[[@LINE+6]]:13-19: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] // CHECK:STDERR: -// CHECK:STDERR: fail_if_true.carbon:[[@LINE+8]]:21: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] -// CHECK:STDERR: var x: () = if true then () else (); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_if_true.carbon:[[@LINE+4]]:21-27: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] // CHECK:STDERR: -// CHECK:STDERR: fail_if_true.carbon:[[@LINE+4]]:13: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] -// CHECK:STDERR: var x: () = if true then () else (); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_if_true.carbon:[[@LINE+2]]:13-35: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] // CHECK:STDERR: var x: () = if true then () else (); @@ -34,17 +28,11 @@ var x: () = if true then () else (); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_if_false.carbon:[[@LINE+12]]:14: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] -// CHECK:STDERR: var x2: () = if false then () else (); -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_if_false.carbon:[[@LINE+6]]:14-21: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] // CHECK:STDERR: -// CHECK:STDERR: fail_if_false.carbon:[[@LINE+8]]:23: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] -// CHECK:STDERR: var x2: () = if false then () else (); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_if_false.carbon:[[@LINE+4]]:23-29: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] // CHECK:STDERR: -// CHECK:STDERR: fail_if_false.carbon:[[@LINE+4]]:14: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] -// CHECK:STDERR: var x2: () = if false then () else (); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_if_false.carbon:[[@LINE+2]]:14-37: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] // CHECK:STDERR: var x2: () = if false then () else (); @@ -52,13 +40,9 @@ var x2: () = if false then () else (); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_true_or_false.carbon:[[@LINE+8]]:15: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] -// CHECK:STDERR: var y: bool = true or false; -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_true_or_false.carbon:[[@LINE+4]]:15-21: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] // CHECK:STDERR: -// CHECK:STDERR: fail_true_or_false.carbon:[[@LINE+4]]:15: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] -// CHECK:STDERR: var y: bool = true or false; -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_true_or_false.carbon:[[@LINE+2]]:15-27: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] // CHECK:STDERR: var y: bool = true or false; @@ -66,13 +50,9 @@ var y: bool = true or false; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_false_or_true.carbon:[[@LINE+8]]:16: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] -// CHECK:STDERR: var y2: bool = false or true; -// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_false_or_true.carbon:[[@LINE+4]]:16-23: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] // CHECK:STDERR: -// CHECK:STDERR: fail_false_or_true.carbon:[[@LINE+4]]:16: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] -// CHECK:STDERR: var y2: bool = false or true; -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_false_or_true.carbon:[[@LINE+2]]:16-28: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] // CHECK:STDERR: var y2: bool = false or true; diff --git a/toolchain/check/testdata/var/import_access.carbon b/toolchain/check/testdata/var/import_access.carbon index 83b23d469cd7..6edc9c5684a8 100644 --- a/toolchain/check/testdata/var/import_access.carbon +++ b/toolchain/check/testdata/var/import_access.carbon @@ -38,9 +38,7 @@ package Test library "[[@TEST_NAME]]"; import library "def"; -// CHECK:STDERR: fail_local_def.carbon:[[@LINE+4]]:14: error: name `v` not found [NameNotFound] -// CHECK:STDERR: var v2: () = v; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_local_def.carbon:[[@LINE+2]]:14: error: name `v` not found [NameNotFound] // CHECK:STDERR: var v2: () = v; @@ -50,9 +48,7 @@ package Other library "[[@TEST_NAME]]"; import Test library "def"; -// CHECK:STDERR: fail_other_def.carbon:[[@LINE+4]]:14: error: member name `v` not found in `Test` [MemberNameNotFoundInInstScope] -// CHECK:STDERR: var v2: () = Test.v; -// CHECK:STDERR: ^~~~~~ +// CHECK:STDERR: fail_other_def.carbon:[[@LINE+2]]:14-19: error: member name `v` not found in `Test` [MemberNameNotFoundInInstScope] // CHECK:STDERR: var v2: () = Test.v; @@ -156,9 +152,9 @@ var v2: () = Test.v; // CHECK:STDOUT: } // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %v2.var: ref %empty_tuple.type = var_storage %v2.var_patt [concrete] -// CHECK:STDOUT: %.loc10_10.1: type = splice_block %.loc10_10.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc10_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc10_10.3: type = converted %.loc10_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc8_10.1: type = splice_block %.loc8_10.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc8_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_10.3: type = converted %.loc8_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %v2: ref %empty_tuple.type = wrapper_binding v2, %v2.var [concrete = %v2.var] // CHECK:STDOUT: name_binding_decl { @@ -199,9 +195,9 @@ var v2: () = Test.v; // CHECK:STDOUT: } // CHECK:STDOUT: %Test.import = import Test // CHECK:STDOUT: %v2.var: ref %empty_tuple.type = var_storage %v2.var_patt [concrete] -// CHECK:STDOUT: %.loc10_10.1: type = splice_block %.loc10_10.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc10_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc10_10.3: type = converted %.loc10_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc8_10.1: type = splice_block %.loc8_10.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc8_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_10.3: type = converted %.loc8_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %v2: ref %empty_tuple.type = wrapper_binding v2, %v2.var [concrete = %v2.var] // CHECK:STDOUT: name_binding_decl { diff --git a/toolchain/check/testdata/var/initialization.carbon b/toolchain/check/testdata/var/initialization.carbon index 211d602bcf3a..346d204c875a 100644 --- a/toolchain/check/testdata/var/initialization.carbon +++ b/toolchain/check/testdata/var/initialization.carbon @@ -55,9 +55,7 @@ import Core; class A {} fn Main() { - // CHECK:STDERR: fail_uninitialized_no_impl.carbon:[[@LINE+4]]:3: error: cannot convert type `A` into type implementing `Core.DefaultOrUnformed` [ConversionFailureTypeToFacet] - // CHECK:STDERR: var unused x: A; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_uninitialized_no_impl.carbon:[[@LINE+2]]:3-18: error: cannot convert type `A` into type implementing `Core.DefaultOrUnformed` [ConversionFailureTypeToFacet] // CHECK:STDERR: var unused x: A; } diff --git a/toolchain/check/testdata/var/var_pattern.carbon b/toolchain/check/testdata/var/var_pattern.carbon index 92b17b827317..4edec3a198cc 100644 --- a/toolchain/check/testdata/var/var_pattern.carbon +++ b/toolchain/check/testdata/var/var_pattern.carbon @@ -82,13 +82,9 @@ fn G() { library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: fail_nested.carbon:[[@LINE+8]]:41: error: `var` nested within another `var` [NestedVar] - // CHECK:STDERR: let (unused x: (), var (unused y: (), var unused z: ())) = ((), ((), ())); - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_nested.carbon:[[@LINE+4]]:41-43: error: `var` nested within another `var` [NestedVar] // CHECK:STDERR: - // CHECK:STDERR: fail_nested.carbon:[[@LINE+4]]:41: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] - // CHECK:STDERR: let (unused x: (), var (unused y: (), var unused z: ())) = ((), ((), ())); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_nested.carbon:[[@LINE+2]]:41-56: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: let (unused x: (), var (unused y: (), var unused z: ())) = ((), ((), ())); } @@ -98,13 +94,9 @@ fn F() { library "[[@TEST_NAME]]"; fn f() { - // CHECK:STDERR: fail_compile_time.carbon:[[@LINE+8]]:15: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] - // CHECK:STDERR: var generic T: type; - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_compile_time.carbon:[[@LINE+4]]:15-21: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] // CHECK:STDERR: - // CHECK:STDERR: fail_compile_time.carbon:[[@LINE+4]]:22: error: found generic binding inside `var` pattern [NonRegularBindingInVarDecl] - // CHECK:STDERR: var generic T: type; - // CHECK:STDERR: ^ + // CHECK:STDERR: fail_compile_time.carbon:[[@LINE+2]]:22: error: found generic binding inside `var` pattern [NonRegularBindingInVarDecl] // CHECK:STDERR: var generic T: type; let (x: (), generic T: type) = ((), ()); @@ -114,15 +106,11 @@ fn f() { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_implicit.carbon:[[@LINE+4]]:10: error: implicit parameters of functions must be constant [ImplictParamMustBeConstant] -// CHECK:STDERR: fn F[var u: ()](); -// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: fail_implicit.carbon:[[@LINE+2]]:10-14: error: implicit parameters of functions must be constant [ImplictParamMustBeConstant] // CHECK:STDERR: fn F[var u: ()](); -// CHECK:STDERR: fail_implicit.carbon:[[@LINE+4]]:10: error: implicit parameters of functions must be constant [ImplictParamMustBeConstant] -// CHECK:STDERR: fn G[var T: type](); -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_implicit.carbon:[[@LINE+2]]:10-16: error: implicit parameters of functions must be constant [ImplictParamMustBeConstant] // CHECK:STDERR: fn G[var T: type](); diff --git a/toolchain/check/testdata/variadics/pack_expansion.carbon b/toolchain/check/testdata/variadics/pack_expansion.carbon index 274067048670..2e572cfdd762 100644 --- a/toolchain/check/testdata/variadics/pack_expansion.carbon +++ b/toolchain/check/testdata/variadics/pack_expansion.carbon @@ -14,9 +14,7 @@ library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: fail_todo_pack_expansion_statement.carbon:[[@LINE+4]]:3: error: semantics TODO: `HandlePackExpansionStart` [SemanticsTodo] - // CHECK:STDERR: ... F(); - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_todo_pack_expansion_statement.carbon:[[@LINE+2]]:3-5: error: semantics TODO: `HandlePackExpansionStart` [SemanticsTodo] // CHECK:STDERR: ... F(); } @@ -25,9 +23,7 @@ fn F() { library "[[@TEST_NAME]]"; fn F(x: (i32, i32)) { - // CHECK:STDERR: fail_todo_expand.carbon:[[@LINE+4]]:3: error: semantics TODO: `HandlePrefixOperatorExpand` [SemanticsTodo] - // CHECK:STDERR: expand x; - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_todo_expand.carbon:[[@LINE+2]]:3-10: error: semantics TODO: `HandlePrefixOperatorExpand` [SemanticsTodo] // CHECK:STDERR: expand x; } diff --git a/toolchain/check/testdata/where_expr/constraints.carbon b/toolchain/check/testdata/where_expr/constraints.carbon index 8ac7f13c5895..1415615aefbc 100644 --- a/toolchain/check/testdata/where_expr/constraints.carbon +++ b/toolchain/check/testdata/where_expr/constraints.carbon @@ -36,9 +36,7 @@ interface I {} // Because there's an error inside the `where`, the constant value of the // `where` should be an error also. // -// CHECK:STDERR: fail_self_impls_error.carbon:[[@LINE+4]]:37: error: name `J` not found [NameNotFound] -// CHECK:STDERR: fn F(generic T: I where .Self impls J); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_self_impls_error.carbon:[[@LINE+2]]:37: error: name `J` not found [NameNotFound] // CHECK:STDERR: fn F(generic T: I where .Self impls J); //@dump-sem-ir-end @@ -81,9 +79,7 @@ fn AssociatedTypeImpls(generic W: K where .Associated impls M); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_left_of_impls_non_type.carbon:[[@LINE+4]]:39: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] -// CHECK:STDERR: fn NonTypeImpls(generic U: type where 7 impls type); -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_left_of_impls_non_type.carbon:[[@LINE+2]]:39-50: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] // CHECK:STDERR: fn NonTypeImpls(generic U: type where 7 impls type); @@ -91,12 +87,8 @@ fn NonTypeImpls(generic U: type where 7 impls type); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_right_of_impls_non_type.carbon:[[@LINE+7]]:51: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] -// CHECK:STDERR: fn ImplsNonType(generic U: type where .Self impls 7); -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_right_of_impls_non_type.carbon:[[@LINE+4]]:51: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: fn ImplsNonType(generic U: type where .Self impls 7); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_right_of_impls_non_type.carbon:[[@LINE+3]]:51: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] +// CHECK:STDERR: fail_right_of_impls_non_type.carbon:[[@LINE+2]]:51: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn ImplsNonType(generic U: type where .Self impls 7); @@ -104,9 +96,7 @@ fn ImplsNonType(generic U: type where .Self impls 7); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_right_of_impls_non_facet_type.carbon:[[@LINE+4]]:58: error: right argument of `impls` requirement must be a facet type [ImplsOnNonFacetType] -// CHECK:STDERR: fn ImplsOfNonFacetType(generic U: type where .Self impls i32); -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_right_of_impls_non_facet_type.carbon:[[@LINE+2]]:58-60: error: right argument of `impls` requirement must be a facet type [ImplsOnNonFacetType] // CHECK:STDERR: fn ImplsOfNonFacetType(generic U: type where .Self impls i32); @@ -121,13 +111,9 @@ class C {} impl C as J {} fn DoesNotImplI() { - // CHECK:STDERR: fail_enforce_impls_constraint.carbon:[[@LINE+8]]:3: error: cannot convert type `C` into type implementing `J where .Self impls I` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Impls(C); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_enforce_impls_constraint.carbon:[[@LINE-10]]:1: in import [InImport] - // CHECK:STDERR: state_constraints.carbon:14:18: note: initializing generic parameter `V` declared here [InitializingGenericParam] - // CHECK:STDERR: fn Impls(generic V: J where .Self impls I); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_enforce_impls_constraint.carbon:[[@LINE+4]]:3-10: error: cannot convert type `C` into type implementing `J where .Self impls I` [ConversionFailureTypeToFacet] + // CHECK:STDERR: imported from: fail_enforce_impls_constraint.carbon:[[@LINE-8]]:1 [InImport] + // CHECK:STDERR: state_constraints.carbon:14:18-41: note: initializing generic parameter `V` declared here [InitializingGenericParam] // CHECK:STDERR: Impls(C); } @@ -147,12 +133,8 @@ fn EmptyStruct(unused generic Y: J where .Self == {}) {} // now there is no support for `==` constraints so it rejects it as an // "other currently unsupported constraint." fn NotEmptyStruct() { - // CHECK:STDERR: fail_todo_enforce_equality_constraint.carbon:[[@LINE+7]]:3: error: cannot convert type `C` into type implementing `J where...` [ConversionFailureTypeToFacet] - // CHECK:STDERR: EmptyStruct(C); - // CHECK:STDERR: ^~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_enforce_equality_constraint.carbon:[[@LINE-9]]:31: note: initializing generic parameter `Y` declared here [InitializingGenericParam] - // CHECK:STDERR: fn EmptyStruct(unused generic Y: J where .Self == {}) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_enforce_equality_constraint.carbon:[[@LINE+3]]:3-16: error: cannot convert type `C` into type implementing `J where...` [ConversionFailureTypeToFacet] + // CHECK:STDERR: fail_todo_enforce_equality_constraint.carbon:[[@LINE-7]]:31-52: note: initializing generic parameter `Y` declared here [InitializingGenericParam] // CHECK:STDERR: EmptyStruct(C); } @@ -162,9 +144,7 @@ fn NotEmptyStruct() { library "[[@TEST_NAME]]"; //@dump-sem-ir-begin -// CHECK:STDERR: fail_error_in_constraint.carbon:[[@LINE+4]]:48: error: name `I` not found [NameNotFound] -// CHECK:STDERR: fn WithError(generic U: type where .Self impls I); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_error_in_constraint.carbon:[[@LINE+2]]:48: error: name `I` not found [NameNotFound] // CHECK:STDERR: fn WithError(generic U: type where .Self impls I); //@dump-sem-ir-end @@ -295,24 +275,24 @@ fn F() { // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { // CHECK:STDOUT: %T.patt: = symbolic_binding_pattern T, 0 [concrete = ] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc14_19.1: type = splice_block %.loc14_19.2 [concrete = ] { -// CHECK:STDOUT: %.Self.frozen.loc14_15: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen.e58] +// CHECK:STDOUT: %.loc12_19.1: type = splice_block %.loc12_19.2 [concrete = ] { +// CHECK:STDOUT: %.Self.frozen.loc12_15: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen.e58] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] -// CHECK:STDOUT: %.Self.frozen.loc14_19: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen.3a0] +// CHECK:STDOUT: %.Self.frozen.loc12_19: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen.3a0] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %.Self.ref.loc14_25.1: %I.type = name_ref .Self, %.Self.frozen.loc14_19 [symbolic_self = constants.%.Self.frozen.3a0] +// CHECK:STDOUT: %.Self.ref.loc12_25.1: %I.type = name_ref .Self, %.Self.frozen.loc12_19 [symbolic_self = constants.%.Self.frozen.3a0] // CHECK:STDOUT: %J.ref: = name_ref J, [concrete = ] -// CHECK:STDOUT: %.Self.as_type.loc14_25.1: type = facet_access_type %.Self.ref.loc14_25.1 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc14_25.1: type = converted %.Self.ref.loc14_25.1, %.Self.as_type.loc14_25.1 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %impls.loc14_31.1 = requirement_impls %.loc14_25.1, [concrete] +// CHECK:STDOUT: %.Self.as_type.loc12_25.1: type = facet_access_type %.Self.ref.loc12_25.1 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc12_25.1: type = converted %.Self.ref.loc12_25.1, %.Self.as_type.loc12_25.1 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %impls.loc12_31.1 = requirement_impls %.loc12_25.1, [concrete] // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %.Self.ref.loc14_25.2: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %.Self.as_type.loc14_25.2: type = facet_access_type %.Self.ref.loc14_25.2 [symbolic_self = constants.%.Self.as_type] -// CHECK:STDOUT: %.loc14_25.2: type = converted %.Self.ref.loc14_25.1, %.Self.as_type.loc14_25.2 [symbolic_self = constants.%.Self.as_type] -// CHECK:STDOUT: %impls.loc14_31.2 = requirement_impls %.loc14_25.2, [concrete] -// CHECK:STDOUT: %.loc14_19.2: type = where_expr [concrete = ] { +// CHECK:STDOUT: %.Self.ref.loc12_25.2: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] +// CHECK:STDOUT: %.Self.as_type.loc12_25.2: type = facet_access_type %.Self.ref.loc12_25.2 [symbolic_self = constants.%.Self.as_type] +// CHECK:STDOUT: %.loc12_25.2: type = converted %.Self.ref.loc12_25.1, %.Self.as_type.loc12_25.2 [symbolic_self = constants.%.Self.as_type] +// CHECK:STDOUT: %impls.loc12_31.2 = requirement_impls %.loc12_25.2, [concrete] +// CHECK:STDOUT: %.loc12_19.2: type = where_expr [concrete = ] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %impls.loc14_31.2 = requirement_impls %.loc14_25.2, [concrete] +// CHECK:STDOUT: %impls.loc12_31.2 = requirement_impls %.loc12_25.2, [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: %T: = symbolic_binding T, 0 [concrete = ] @@ -572,20 +552,20 @@ fn F() { // CHECK:STDOUT: %WithError.decl: %WithError.type = fn_decl @WithError [concrete = constants.%WithError] { // CHECK:STDOUT: %U.patt: = symbolic_binding_pattern U, 0 [concrete = ] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc9_30.1: type = splice_block %.loc9_30.2 [concrete = ] { -// CHECK:STDOUT: %.Self.frozen.loc9_23: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc9_25: type = type_literal type [concrete = type] -// CHECK:STDOUT: %.Self.frozen.loc9_30: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc9_25 [concrete] -// CHECK:STDOUT: %.Self.ref.loc9_36.1: type = name_ref .Self, %.Self.frozen.loc9_30 [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc7_30.1: type = splice_block %.loc7_30.2 [concrete = ] { +// CHECK:STDOUT: %.Self.frozen.loc7_23: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc7_25: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.Self.frozen.loc7_30: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc7_25 [concrete] +// CHECK:STDOUT: %.Self.ref.loc7_36.1: type = name_ref .Self, %.Self.frozen.loc7_30 [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %I.ref: = name_ref I, [concrete = ] -// CHECK:STDOUT: %impls.loc9_42.1 = requirement_impls %.Self.ref.loc9_36.1, [concrete] +// CHECK:STDOUT: %impls.loc7_42.1 = requirement_impls %.Self.ref.loc7_36.1, [concrete] // CHECK:STDOUT: %.Self: type = symbolic_binding .Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %.Self.ref.loc9_36.2: type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %impls.loc9_42.2 = requirement_impls %.Self.ref.loc9_36.2, [concrete] -// CHECK:STDOUT: %.loc9_30.2: type = where_expr [concrete = ] { -// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc9_25 [concrete] -// CHECK:STDOUT: %impls.loc9_42.2 = requirement_impls %.Self.ref.loc9_36.2, [concrete] +// CHECK:STDOUT: %.Self.ref.loc7_36.2: type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] +// CHECK:STDOUT: %impls.loc7_42.2 = requirement_impls %.Self.ref.loc7_36.2, [concrete] +// CHECK:STDOUT: %.loc7_30.2: type = where_expr [concrete = ] { +// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc7_25 [concrete] +// CHECK:STDOUT: %impls.loc7_42.2 = requirement_impls %.Self.ref.loc7_36.2, [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: %U: = symbolic_binding U, 0 [concrete = ] diff --git a/toolchain/check/testdata/where_expr/designator.carbon b/toolchain/check/testdata/where_expr/designator.carbon index 6738ec521a9f..88a39ac3ff05 100644 --- a/toolchain/check/testdata/where_expr/designator.carbon +++ b/toolchain/check/testdata/where_expr/designator.carbon @@ -34,9 +34,7 @@ interface J { let Member: type; } -// CHECK:STDERR: fail_wrong_member.carbon:[[@LINE+4]]:38: error: member name `Mismatch` not found in `J` [MemberNameNotFoundInSpecificScope] -// CHECK:STDERR: fn PeriodMismatch(generic W: J where .Mismatch = {}); -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_wrong_member.carbon:[[@LINE+2]]:38-46: error: member name `Mismatch` not found in `J` [MemberNameNotFoundInSpecificScope] // CHECK:STDERR: fn PeriodMismatch(generic W: J where .Mismatch = {}); @@ -46,9 +44,7 @@ library "[[@TEST_NAME]]"; fn Foo() -> () { var unused x: (); - // CHECK:STDERR: fail_designator_matches_var.carbon:[[@LINE+5]]:10: error: name `.Self` not found [NameNotFound] - // CHECK:STDERR: return .x; - // CHECK:STDERR: ^~ + // CHECK:STDERR: fail_designator_matches_var.carbon:[[@LINE+3]]:10-11: error: name `.Self` not found [NameNotFound] // CHECK:STDERR: fail_designator_matches_var.carbon: note: designator may only be used when `.Self` is in scope [NoPeriodSelfForDesignator] // CHECK:STDERR: return .x; @@ -59,9 +55,7 @@ fn Foo() -> () { library "[[@TEST_NAME]]"; fn Bar() -> () { - // CHECK:STDERR: fail_unknown_designator.carbon:[[@LINE+5]]:10: error: name `.Self` not found [NameNotFound] - // CHECK:STDERR: return .undef; - // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_unknown_designator.carbon:[[@LINE+3]]:10-15: error: name `.Self` not found [NameNotFound] // CHECK:STDERR: fail_unknown_designator.carbon: note: designator may only be used when `.Self` is in scope [NoPeriodSelfForDesignator] // CHECK:STDERR: return .undef; @@ -72,9 +66,7 @@ fn Bar() -> () { library "[[@TEST_NAME]]"; class C { - // CHECK:STDERR: fail_dot_self_method_return_value.carbon:[[@LINE+4]]:27: error: name `.Self` not found [NameNotFound] - // CHECK:STDERR: fn F() -> Self { return .Self; } - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_dot_self_method_return_value.carbon:[[@LINE+2]]:27-31: error: name `.Self` not found [NameNotFound] // CHECK:STDERR: fn F() -> Self { return .Self; } } @@ -84,9 +76,7 @@ class C { library "[[@TEST_NAME]]"; class D { - // CHECK:STDERR: fail_dot_self_method_return_type.carbon:[[@LINE+4]]:13: error: name `.Self` not found [NameNotFound] - // CHECK:STDERR: fn G() -> .Self { return Self; } - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_dot_self_method_return_type.carbon:[[@LINE+2]]:13-17: error: name `.Self` not found [NameNotFound] // CHECK:STDERR: fn G() -> .Self { return Self; } } @@ -96,9 +86,7 @@ library "[[@TEST_NAME]]"; interface I {} -// CHECK:STDERR: fail_impls_constraint_does_not_constrain_self.carbon:[[@LINE+4]]:52: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] -// CHECK:STDERR: fn F(generic U: type, unused generic T: type where U impls I) {} -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_impls_constraint_does_not_constrain_self.carbon:[[@LINE+2]]:52-60: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] // CHECK:STDERR: fn F(generic U: type, unused generic T: type where U impls I) {} @@ -109,9 +97,7 @@ interface I { let X: type; } -// CHECK:STDERR: fail_equality_constraint_does_not_constrain_self.carbon:[[@LINE+4]]:49: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] -// CHECK:STDERR: fn F(generic U: I, unused generic T: type where U.X == ()) {} -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_equality_constraint_does_not_constrain_self.carbon:[[@LINE+2]]:49-57: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] // CHECK:STDERR: fn F(generic U: I, unused generic T: type where U.X == ()) {} @@ -122,13 +108,9 @@ interface I { let X: type; } -// CHECK:STDERR: fail_combined_constraint_does_not_constrain_self.carbon:[[@LINE+8]]:49: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] -// CHECK:STDERR: fn F(generic U: I, unused generic T: type where U impls I and U.X == ()) {} -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_combined_constraint_does_not_constrain_self.carbon:[[@LINE+4]]:49-57: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] // CHECK:STDERR: -// CHECK:STDERR: fail_combined_constraint_does_not_constrain_self.carbon:[[@LINE+4]]:63: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] -// CHECK:STDERR: fn F(generic U: I, unused generic T: type where U impls I and U.X == ()) {} -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_combined_constraint_does_not_constrain_self.carbon:[[@LINE+2]]:63-71: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] // CHECK:STDERR: fn F(generic U: I, unused generic T: type where U impls I and U.X == ()) {} @@ -152,9 +134,7 @@ class A(T: type); class B; class C; -// CHECK:STDERR: fail_where_without_designator_in_one_equiv_constraint.carbon:[[@LINE+4]]:53: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] -// CHECK:STDERR: fn F(unused generic T: type where A(.Self) == B and A(B) == B) {} -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_where_without_designator_in_one_equiv_constraint.carbon:[[@LINE+2]]:53-61: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] // CHECK:STDERR: fn F(unused generic T: type where A(.Self) == B and A(B) == B) {} @@ -162,9 +142,7 @@ interface Z { let Z0: type; } -// CHECK:STDERR: fail_where_without_designator_in_one_equiv_constraint.carbon:[[@LINE+4]]:48: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] -// CHECK:STDERR: fn G(unused generic T: Z where A(.Z0) == B and A(B) == B) {} -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_where_without_designator_in_one_equiv_constraint.carbon:[[@LINE+2]]:48-56: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] // CHECK:STDERR: fn G(unused generic T: Z where A(.Z0) == B and A(B) == B) {} @@ -186,9 +164,7 @@ interface I {} interface J(T: type) {} class C; -// CHECK:STDERR: fail_where_without_self_designator_in_type.carbon:[[@LINE+4]]:35: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] -// CHECK:STDERR: fn F(unused generic T: type where C impls type) {} -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_where_without_self_designator_in_type.carbon:[[@LINE+2]]:35-46: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] // CHECK:STDERR: fn F(unused generic T: type where C impls type) {} @@ -201,9 +177,7 @@ interface I {} interface J(T: type) {} class C; -// CHECK:STDERR: fail_where_without_self_designator_in_one_impls_interface.carbon:[[@LINE+4]]:35: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] -// CHECK:STDERR: fn F(unused generic T: type where C impls (I & J(.Self))) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_where_without_self_designator_in_one_impls_interface.carbon:[[@LINE+2]]:35-56: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] // CHECK:STDERR: fn F(unused generic T: type where C impls (I & J(.Self))) {} @@ -217,9 +191,7 @@ interface I {} interface J(T: type) {} class C; -// CHECK:STDERR: fail_where_without_member_designator_in_one_impls_interface.carbon:[[@LINE+4]]:32: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] -// CHECK:STDERR: fn F(unused generic T: Z where C impls (I & J(.Z0))) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_where_without_member_designator_in_one_impls_interface.carbon:[[@LINE+2]]:32-51: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] // CHECK:STDERR: fn F(unused generic T: Z where C impls (I & J(.Z0))) {} @@ -234,9 +206,7 @@ constraint K(T: type) { } class C; -// CHECK:STDERR: fail_where_without_self_designator_in_one_impls_named_constraint.carbon:[[@LINE+4]]:35: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] -// CHECK:STDERR: fn F(unused generic T: type where C impls (I & K(.Self))) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_where_without_self_designator_in_one_impls_named_constraint.carbon:[[@LINE+2]]:35-56: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] // CHECK:STDERR: fn F(unused generic T: type where C impls (I & K(.Self))) {} @@ -254,9 +224,7 @@ constraint K(T: type) { class C; -// CHECK:STDERR: fail_where_without_member_designator_in_one_impls_named_constraint.carbon:[[@LINE+4]]:32: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] -// CHECK:STDERR: fn F(unused generic T: Z where C impls (I & K(.Z0))) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_where_without_member_designator_in_one_impls_named_constraint.carbon:[[@LINE+2]]:32-51: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] // CHECK:STDERR: fn F(unused generic T: Z where C impls (I & K(.Z0))) {} @@ -345,9 +313,7 @@ class C; eval fn E(generic _: type) -> type { return C; } -// CHECK:STDERR: fail_fn_call_returns_type_without_self_in_same_type.carbon:[[@LINE+4]]:32: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] -// CHECK:STDERR: fn F(unused generic T: I where C == E(.Self)) {} -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_fn_call_returns_type_without_self_in_same_type.carbon:[[@LINE+2]]:32-44: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] // CHECK:STDERR: fn F(unused generic T: I where C == E(.Self)) {} @@ -359,9 +325,7 @@ class C; eval fn E(generic _: type) -> type { return C; } -// CHECK:STDERR: fail_fn_call_returns_type_without_self_in_impls.carbon:[[@LINE+4]]:32: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] -// CHECK:STDERR: fn F(unused generic T: I where C impls E(.Self)) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_fn_call_returns_type_without_self_in_impls.carbon:[[@LINE+2]]:32-47: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] // CHECK:STDERR: fn F(unused generic T: I where C impls E(.Self)) {} @@ -378,9 +342,7 @@ eval fn E(generic T: type) -> type { return T; } // value. As such, we can't tell at the time of checking the facet type if // `E(.Self)` resolves to an expression containing a designator. -// CHECK:STDERR: fail_fn_call_returns_type_with_self_in_same_type.carbon:[[@LINE+4]]:32: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] -// CHECK:STDERR: fn F(unused generic T: I where C == E(.Self)) {} -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_fn_call_returns_type_with_self_in_same_type.carbon:[[@LINE+2]]:32-44: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] // CHECK:STDERR: fn F(unused generic T: I where C == E(.Self)) {} @@ -397,9 +359,7 @@ eval fn E(generic T: type) -> type { return T; } // value. As such, we can't tell at the time of checking the facet type if // `E(.Self)` resolves to an expression containing a designator. -// CHECK:STDERR: fail_fn_call_returns_type_with_self_in_impls.carbon:[[@LINE+4]]:32: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] -// CHECK:STDERR: fn F(unused generic T: I where C impls E(.Self)) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_fn_call_returns_type_with_self_in_impls.carbon:[[@LINE+2]]:32-47: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] // CHECK:STDERR: fn F(unused generic T: I where C impls E(.Self)) {} @@ -421,9 +381,7 @@ class C(T: type); // TODO: Once we can write a generic alias, this should pass. -// CHECK:STDERR: fail_todo_generic_alias_preserves_self.carbon:[[@LINE+4]]:8: error: `alias` declaration cannot have parameters [UnexpectedDeclNameParams] -// CHECK:STDERR: alias A(U: type) = C(U); -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_todo_generic_alias_preserves_self.carbon:[[@LINE+2]]:8-16: error: `alias` declaration cannot have parameters [UnexpectedDeclNameParams] // CHECK:STDERR: alias A(U: type) = C(U); @@ -435,9 +393,7 @@ library "[[@TEST_NAME]]"; interface I {} class C; -// CHECK:STDERR: fail_generic_alias_without_self.carbon:[[@LINE+4]]:8: error: `alias` declaration cannot have parameters [UnexpectedDeclNameParams] -// CHECK:STDERR: alias A(U: type) = C; -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fail_generic_alias_without_self.carbon:[[@LINE+2]]:8-16: error: `alias` declaration cannot have parameters [UnexpectedDeclNameParams] // CHECK:STDERR: alias A(U: type) = C; diff --git a/toolchain/check/testdata/where_expr/dot_self_impls.carbon b/toolchain/check/testdata/where_expr/dot_self_impls.carbon index c4fd8c4d4c51..5c2d1275a321 100644 --- a/toolchain/check/testdata/where_expr/dot_self_impls.carbon +++ b/toolchain/check/testdata/where_expr/dot_self_impls.carbon @@ -72,9 +72,7 @@ interface J { } fn INotJ(generic T: I where .Self impls J) { - // CHECK:STDERR: fail_name_lookup_through_where_self_impls.carbon:[[@LINE+4]]:3: error: member name `G` not found in `I` [MemberNameNotFoundInSpecificScope] - // CHECK:STDERR: T.G(); - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_name_lookup_through_where_self_impls.carbon:[[@LINE+2]]:3-5: error: member name `G` not found in `I` [MemberNameNotFoundInSpecificScope] // CHECK:STDERR: T.G(); } @@ -87,9 +85,7 @@ interface J { } fn TypeNotJ(generic T: type where .Self impls J) { - // CHECK:STDERR: fail_name_lookup_with_type.carbon:[[@LINE+4]]:3: error: member name `G` not found [MemberNameNotFound] - // CHECK:STDERR: T.G(); - // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_name_lookup_with_type.carbon:[[@LINE+2]]:3-5: error: member name `G` not found [MemberNameNotFound] // CHECK:STDERR: T.G(); } @@ -101,15 +97,11 @@ interface A {} interface B { fn Bfn(); } fn F(generic T: A & B) { - // CHECK:STDERR: fail_facet_type_simple_member_access.carbon:[[@LINE+4]]:6: error: member name `Bfn` not found in `A` [MemberNameNotFoundInSpecificScope] - // CHECK:STDERR: T.((A where .Self impls B).Bfn)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_facet_type_simple_member_access.carbon:[[@LINE+2]]:6-32: error: member name `Bfn` not found in `A` [MemberNameNotFoundInSpecificScope] // CHECK:STDERR: T.((A where .Self impls B).Bfn)(); - // CHECK:STDERR: fail_facet_type_simple_member_access.carbon:[[@LINE+4]]:3: error: member name `Bfn` not found in `A` [MemberNameNotFoundInSpecificScope] - // CHECK:STDERR: (A where .Self impls B).Bfn; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_facet_type_simple_member_access.carbon:[[@LINE+2]]:3-29: error: member name `Bfn` not found in `A` [MemberNameNotFoundInSpecificScope] // CHECK:STDERR: (A where .Self impls B).Bfn; } @@ -128,15 +120,11 @@ interface J { } fn INotJ[T: I where .Self impls J](x: T) { - // CHECK:STDERR: fail_name_lookup_instance.carbon:[[@LINE+4]]:3: error: member name `GNonInstance` not found in `I` [MemberNameNotFoundInSpecificScope] - // CHECK:STDERR: x.GNonInstance(); - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_name_lookup_instance.carbon:[[@LINE+2]]:3-16: error: member name `GNonInstance` not found in `I` [MemberNameNotFoundInSpecificScope] // CHECK:STDERR: x.GNonInstance(); - // CHECK:STDERR: fail_name_lookup_instance.carbon:[[@LINE+4]]:3: error: member name `GSelf` not found in `I` [MemberNameNotFoundInSpecificScope] - // CHECK:STDERR: x.GSelf(); - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_name_lookup_instance.carbon:[[@LINE+2]]:3-9: error: member name `GSelf` not found in `I` [MemberNameNotFoundInSpecificScope] // CHECK:STDERR: x.GSelf(); } @@ -188,33 +176,21 @@ interface J { let B: type; } fn Test() { // TODO: This should pass. - // CHECK:STDERR: fail_todo_compare_equal_with_rewrite.carbon:[[@LINE+7]]:3: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent] - // CHECK:STDERR: AssertSame(Type((I where .A = ()) & J), - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_compare_equal_with_rewrite.carbon:[[@LINE-19]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn AssertSame[T: type](unused a: WrapType(T), unused b: WrapType(T)) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_compare_equal_with_rewrite.carbon:[[@LINE+3]]:3-41: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent] + // CHECK:STDERR: fail_todo_compare_equal_with_rewrite.carbon:[[@LINE-17]]:1-70: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: AssertSame(Type((I where .A = ()) & J), Type(I & J where .A = ())); // TODO: This should pass. - // CHECK:STDERR: fail_todo_compare_equal_with_rewrite.carbon:[[@LINE+7]]:3: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent] - // CHECK:STDERR: AssertSame(Type(I & (J where .B = {})), - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_compare_equal_with_rewrite.carbon:[[@LINE-29]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn AssertSame[T: type](unused a: WrapType(T), unused b: WrapType(T)) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_compare_equal_with_rewrite.carbon:[[@LINE+3]]:3-41: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent] + // CHECK:STDERR: fail_todo_compare_equal_with_rewrite.carbon:[[@LINE-23]]:1-70: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: AssertSame(Type(I & (J where .B = {})), Type(I & J where .B = {})); // TODO: This should pass. - // CHECK:STDERR: fail_todo_compare_equal_with_rewrite.carbon:[[@LINE+7]]:3: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent] - // CHECK:STDERR: AssertSame(Type((I where .A = ()) & (J where .B = {})), - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_compare_equal_with_rewrite.carbon:[[@LINE-40]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn AssertSame[T: type](unused a: WrapType(T), unused b: WrapType(T)) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_compare_equal_with_rewrite.carbon:[[@LINE+3]]:3-57: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent] + // CHECK:STDERR: fail_todo_compare_equal_with_rewrite.carbon:[[@LINE-30]]:1-70: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: AssertSame(Type((I where .A = ()) & (J where .B = {})), Type(I & J where .A = () and .B = {})); @@ -231,12 +207,8 @@ interface I {} interface J {} fn Test() { - // CHECK:STDERR: fail_compare_not_equal.carbon:[[@LINE+7]]:3: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent] - // CHECK:STDERR: Same(Type(I where .Self impls J), Type(J where .Self impls I)); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_compare_not_equal.carbon:[[@LINE-10]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Same[T: type](unused a: WrapType(T), unused b: WrapType(T)) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_compare_not_equal.carbon:[[@LINE+3]]:3-64: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent] + // CHECK:STDERR: fail_compare_not_equal.carbon:[[@LINE-8]]:1-64: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: Same(Type(I where .Self impls J), Type(J where .Self impls I)); } diff --git a/toolchain/check/testdata/where_expr/equal_rewrite.carbon b/toolchain/check/testdata/where_expr/equal_rewrite.carbon index ab4b9634dd2e..a88c522c696f 100644 --- a/toolchain/check/testdata/where_expr/equal_rewrite.carbon +++ b/toolchain/check/testdata/where_expr/equal_rewrite.carbon @@ -83,12 +83,8 @@ interface O { fn WithInteger(unused generic Q: O where .P = i32) {} fn WithBool(generic R: O where .P = bool) { - // CHECK:STDERR: fail_rewrites_mismatch_right.carbon:[[@LINE+7]]:3: error: cannot convert type `R` that implements `O where .(O.P) = bool` into type implementing `O where .(O.P) = i32` [ConversionFailureFacetToFacet] - // CHECK:STDERR: WithInteger(R); - // CHECK:STDERR: ^~~~~~~~~~~~~~ - // CHECK:STDERR: fail_rewrites_mismatch_right.carbon:[[@LINE-6]]:31: note: initializing generic parameter `Q` declared here [InitializingGenericParam] - // CHECK:STDERR: fn WithInteger(unused generic Q: O where .P = i32) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_rewrites_mismatch_right.carbon:[[@LINE+3]]:3-16: error: cannot convert type `R` that implements `O where .(O.P) = bool` into type implementing `O where .(O.P) = i32` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_rewrites_mismatch_right.carbon:[[@LINE-4]]:31-49: note: initializing generic parameter `Q` declared here [InitializingGenericParam] // CHECK:STDERR: WithInteger(R); } @@ -105,12 +101,8 @@ interface S { fn WithT(unused generic V: S where .T = ()) {} fn WithU(generic W: S where .U = ()) { - // CHECK:STDERR: fail_rewrites_mismatch_left.carbon:[[@LINE+7]]:3: error: cannot convert type `W` that implements `S where .(S.U) = ()` into type implementing `S where .(S.T) = ()` [ConversionFailureFacetToFacet] - // CHECK:STDERR: WithT(W); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_rewrites_mismatch_left.carbon:[[@LINE-6]]:25: note: initializing generic parameter `V` declared here [InitializingGenericParam] - // CHECK:STDERR: fn WithT(unused generic V: S where .T = ()) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_rewrites_mismatch_left.carbon:[[@LINE+3]]:3-10: error: cannot convert type `W` that implements `S where .(S.U) = ()` into type implementing `S where .(S.T) = ()` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fail_rewrites_mismatch_left.carbon:[[@LINE-4]]:25-42: note: initializing generic parameter `V` declared here [InitializingGenericParam] // CHECK:STDERR: WithT(W); } @@ -123,23 +115,15 @@ import library "equal_constraint"; import library "nested_rewrites"; fn Calls() { - // CHECK:STDERR: fail_import_rewrites.carbon:[[@LINE+8]]:3: error: cannot convert type `bool` into type implementing `N where .(N.P) = {}` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Equal(bool); - // CHECK:STDERR: ^~~~~~~~~~~ - // CHECK:STDERR: fail_import_rewrites.carbon:[[@LINE-7]]:1: in import [InImport] - // CHECK:STDERR: equal_constraint.carbon:9:18: note: initializing generic parameter `T` declared here [InitializingGenericParam] - // CHECK:STDERR: fn Equal(generic T: N where .P = {}); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_rewrites.carbon:[[@LINE+4]]:3-13: error: cannot convert type `bool` into type implementing `N where .(N.P) = {}` [ConversionFailureTypeToFacet] + // CHECK:STDERR: imported from: fail_import_rewrites.carbon:[[@LINE-5]]:1 [InImport] + // CHECK:STDERR: equal_constraint.carbon:9:18-35: note: initializing generic parameter `T` declared here [InitializingGenericParam] // CHECK:STDERR: Equal(bool); - // CHECK:STDERR: fail_import_rewrites.carbon:[[@LINE+8]]:3: error: cannot convert type `i32` into type implementing `A where .(A.C) = () and .(A.B) = bool` [ConversionFailureTypeToFacet] - // CHECK:STDERR: NestedRewrite(i32); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_rewrites.carbon:[[@LINE-17]]:1: in import [InImport] - // CHECK:STDERR: nested_rewrites.carbon:10:26: note: initializing generic parameter `D` declared here [InitializingGenericParam] - // CHECK:STDERR: fn NestedRewrite(generic D: (A where .B = bool) where .C = ()); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_rewrites.carbon:[[@LINE+4]]:3-20: error: cannot convert type `i32` into type implementing `A where .(A.C) = () and .(A.B) = bool` [ConversionFailureTypeToFacet] + // CHECK:STDERR: imported from: fail_import_rewrites.carbon:[[@LINE-11]]:1 [InImport] + // CHECK:STDERR: nested_rewrites.carbon:10:26-61: note: initializing generic parameter `D` declared here [InitializingGenericParam] // CHECK:STDERR: NestedRewrite(i32); } @@ -153,12 +137,8 @@ interface I { } // `2` can't be converted to the type of `I.Member` -// CHECK:STDERR: fail_check_rewrite_constraints.carbon:[[@LINE+7]]:53: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] -// CHECK:STDERR: fn RewriteTypeMismatch(generic X: I where .Member = 2); -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_check_rewrite_constraints.carbon:[[@LINE+4]]:53: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: fn RewriteTypeMismatch(generic X: I where .Member = 2); -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_check_rewrite_constraints.carbon:[[@LINE+3]]:53: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] +// CHECK:STDERR: fail_check_rewrite_constraints.carbon:[[@LINE+2]]:53: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn RewriteTypeMismatch(generic X: I where .Member = 2); @@ -171,9 +151,7 @@ class D {} impl D as A {} fn F() { - // CHECK:STDERR: fail_todo_let.carbon:[[@LINE+4]]:15: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] - // CHECK:STDERR: let generic E: type where .Self impls A = D; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_let.carbon:[[@LINE+2]]:15-41: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] // CHECK:STDERR: let generic E: type where .Self impls A = D; } @@ -186,9 +164,7 @@ interface A {} class D {} impl D as A {} // TODO: Compile-time binding are not yet supported at file scope. -// CHECK:STDERR: fail_todo_let_compile_time.carbon:[[@LINE+4]]:13: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] -// CHECK:STDERR: let generic B: type where .Self impls A = D; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_todo_let_compile_time.carbon:[[@LINE+2]]:13-39: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] // CHECK:STDERR: let generic B: type where .Self impls A = D; @@ -203,21 +179,15 @@ interface E { // Testing how these types get stringified in error messages. // TODO: This should be a compile-time binding, once that is supported. -// CHECK:STDERR: fail_type_does_not_implement_where.carbon:[[@LINE+4]]:42: error: cannot convert type `f64` into type implementing `E where .(E.F) = bool and .(E.G) = ()` [ConversionFailureTypeToFacet] -// CHECK:STDERR: let H: (E where .F = bool and .G = ()) = f64; -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_type_does_not_implement_where.carbon:[[@LINE+2]]:42-44: error: cannot convert type `f64` into type implementing `E where .(E.F) = bool and .(E.G) = ()` [ConversionFailureTypeToFacet] // CHECK:STDERR: let H: (E where .F = bool and .G = ()) = f64; -// CHECK:STDERR: fail_type_does_not_implement_where.carbon:[[@LINE+4]]:45: error: cannot convert type `bool` into type implementing `E where .(E.F) = {} and .(E.G) = i32` [ConversionFailureTypeToFacet] -// CHECK:STDERR: let J: ((E where .F = {}) where .G = i32) = bool; -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_type_does_not_implement_where.carbon:[[@LINE+2]]:45-48: error: cannot convert type `bool` into type implementing `E where .(E.F) = {} and .(E.G) = i32` [ConversionFailureTypeToFacet] // CHECK:STDERR: let J: ((E where .F = {}) where .G = i32) = bool; -// CHECK:STDERR: fail_type_does_not_implement_where.carbon:[[@LINE+4]]:33: error: cannot convert type `bool` into type implementing `E where .(E.F) = .(E.G)` [ConversionFailureTypeToFacet] -// CHECK:STDERR: let K: (E where .F = .Self.G) = bool; -// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_type_does_not_implement_where.carbon:[[@LINE+2]]:33-36: error: cannot convert type `bool` into type implementing `E where .(E.F) = .(E.G)` [ConversionFailureTypeToFacet] // CHECK:STDERR: let K: (E where .F = .Self.G) = bool; diff --git a/toolchain/check/testdata/where_expr/fail_not_facet.carbon b/toolchain/check/testdata/where_expr/fail_not_facet.carbon index ff4c85a08d07..22d42694d842 100644 --- a/toolchain/check/testdata/where_expr/fail_not_facet.carbon +++ b/toolchain/check/testdata/where_expr/fail_not_facet.carbon @@ -14,9 +14,7 @@ library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_left_where_not_facet.carbon:[[@LINE+4]]:17: error: left argument of `where` operator must be a facet type [WhereOnNonFacetType] -// CHECK:STDERR: fn F(generic T: i32 where .Self == bool); -// CHECK:STDERR: ^~~ +// CHECK:STDERR: fail_left_where_not_facet.carbon:[[@LINE+2]]:17-19: error: left argument of `where` operator must be a facet type [WhereOnNonFacetType] // CHECK:STDERR: fn F(generic T: i32 where .Self == bool); @@ -24,9 +22,7 @@ fn F(generic T: i32 where .Self == bool); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_left_where_unknown.carbon:[[@LINE+4]]:17: error: name `NOT_DECLARED` not found [NameNotFound] -// CHECK:STDERR: fn G(generic U: NOT_DECLARED where .Self == bool); -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: fail_left_where_unknown.carbon:[[@LINE+2]]:17-28: error: name `NOT_DECLARED` not found [NameNotFound] // CHECK:STDERR: fn G(generic U: NOT_DECLARED where .Self == bool); @@ -34,8 +30,6 @@ fn G(generic U: NOT_DECLARED where .Self == bool); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_var.carbon:[[@LINE+4]]:8: error: name `e` not found [NameNotFound] -// CHECK:STDERR: var v: e where .x = 3; -// CHECK:STDERR: ^ +// CHECK:STDERR: fail_var.carbon:[[@LINE+2]]:8: error: name `e` not found [NameNotFound] // CHECK:STDERR: var v: e where .x = 3; diff --git a/toolchain/check/testdata/while/while.carbon b/toolchain/check/testdata/while/while.carbon index 73d764224c4f..0919220f19f1 100644 --- a/toolchain/check/testdata/while/while.carbon +++ b/toolchain/check/testdata/while/while.carbon @@ -80,12 +80,8 @@ fn While() { library "[[@TEST_NAME]]"; 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)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: while ({}) {} - // CHECK:STDERR: ^~~~ + // CHECK:STDERR: fail_bad_condition.carbon:[[@LINE+3]]:9-12: error: cannot implicitly convert expression of type `{}` to `bool` [ConversionFailure] + // CHECK:STDERR: fail_bad_condition.carbon:[[@LINE+2]]:9-12: note: type `{}` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: while ({}) {} } @@ -94,28 +90,20 @@ fn While() { library "[[@TEST_NAME]]"; fn While() { - // CHECK:STDERR: fail_bad_break_continue.carbon:[[@LINE+4]]:3: error: `continue` can only be used in a loop [ContinueOutsideLoop] - // CHECK:STDERR: continue; - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_bad_break_continue.carbon:[[@LINE+2]]:3-10: error: `continue` can only be used in a loop [ContinueOutsideLoop] // CHECK:STDERR: continue; - // CHECK:STDERR: fail_bad_break_continue.carbon:[[@LINE+4]]:3: error: `break` can only be used in a loop [BreakOutsideLoop] - // CHECK:STDERR: break; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_bad_break_continue.carbon:[[@LINE+2]]:3-7: error: `break` can only be used in a loop [BreakOutsideLoop] // CHECK:STDERR: break; while (false) { continue; break; } - // CHECK:STDERR: fail_bad_break_continue.carbon:[[@LINE+4]]:3: error: `continue` can only be used in a loop [ContinueOutsideLoop] - // CHECK:STDERR: continue; - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_bad_break_continue.carbon:[[@LINE+2]]:3-10: error: `continue` can only be used in a loop [ContinueOutsideLoop] // CHECK:STDERR: continue; - // CHECK:STDERR: fail_bad_break_continue.carbon:[[@LINE+4]]:3: error: `break` can only be used in a loop [BreakOutsideLoop] - // CHECK:STDERR: break; - // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_bad_break_continue.carbon:[[@LINE+2]]:3-7: error: `break` can only be used in a loop [BreakOutsideLoop] // CHECK:STDERR: break; } diff --git a/toolchain/check/thunk.cpp b/toolchain/check/thunk.cpp index c8b9942c04ba..2c9c1bdb044b 100644 --- a/toolchain/check/thunk.cpp +++ b/toolchain/check/thunk.cpp @@ -333,9 +333,9 @@ static auto StartThunkFunctionDefinition(Context& context, // note the callee. Diagnostics::AnnotationScope annot_scope( &context.emitter(), [&](DiagnosticBuilder& builder) { - CARBON_DIAGNOSTIC(ThunkCallee, Note, - "while building thunk calling this function"); - builder.Note(callee_id, ThunkCallee); + CARBON_DIAGNOSTIC_LABEL(ThunkCallee, Info, + "while building thunk calling this function"); + builder.Attach(callee_id, ThunkCallee); }); StartFunctionDefinition(context, thunk_id, function_id); @@ -355,11 +355,12 @@ static auto BuildThunkDefinition(Context& context, // the signature. Diagnostics::AnnotationScope annot_scope( &context.emitter(), [&](DiagnosticBuilder& builder) { - CARBON_DIAGNOSTIC( - ThunkSignature, Note, + CARBON_DIAGNOSTIC_LABEL( + ThunkSignature, Info, "while building thunk to match the signature of this function"); - builder.Note(context.functions().Get(signature_id).first_owning_decl_id, - ThunkSignature); + builder.Attach( + context.functions().Get(signature_id).first_owning_decl_id, + ThunkSignature); }); const auto& function = context.functions().Get(function_id); diff --git a/toolchain/check/unused.cpp b/toolchain/check/unused.cpp index c623627d1b7c..94a0bf33da99 100644 --- a/toolchain/check/unused.cpp +++ b/toolchain/check/unused.cpp @@ -36,10 +36,10 @@ auto CheckUnusedBinding(Context& context, SemIR::NameId name_id, CARBON_DIAGNOSTIC_ON_SCOPE(UnusedButUsed, Error, "variable `{0}` marked `unused` but used", SemIR::NameId); - CARBON_DIAGNOSTIC(UnusedButUsedHere, Note, "usage here"); + CARBON_DIAGNOSTIC_LABEL(UnusedButUsedHere, Info, "usage here"); context.emitter() .Build(decl_loc, UnusedButUsed, name_id) - .Note(result.use_loc_id, UnusedButUsedHere) + .Attach(result.use_loc_id, UnusedButUsedHere) .Emit(); } } else { diff --git a/toolchain/diagnostics/BUILD b/toolchain/diagnostics/BUILD index 6492d8e3dd91..0b69a5e22272 100644 --- a/toolchain/diagnostics/BUILD +++ b/toolchain/diagnostics/BUILD @@ -4,15 +4,12 @@ load("//bazel/cc_rules:defs.bzl", "cc_library", "cc_test") load("//bazel/manifest:defs.bzl", "manifest") +load("//testing/fuzzing:rules.bzl", "cc_fuzz_test") package(default_visibility = ["//visibility:public"]) cc_library( name = "emitter", - srcs = [ - "consumer.cpp", - "diagnostic.cpp", - ], hdrs = [ "consumer.h", "diagnostic.h", @@ -27,6 +24,32 @@ cc_library( ], ) +cc_library( + name = "renderer", + srcs = [ + "renderer.cpp", + "stream_consumer.cpp", + ], + hdrs = [ + "renderer.h", + "stream_consumer.h", + ], + deps = [ + ":emitter", + ":format_providers", + ":kind", + "//common:check", + "//common:ostream", + "//common/terminal:buffer", + "//common/terminal:capabilities", + "//common/terminal:color", + "//common/terminal:metrics", + "//common/terminal:output_buffer_ref", + "//common/terminal:style", + "@llvm-project//llvm:Support", + ], +) + cc_test( name = "emitter_test", size = "small", @@ -40,6 +63,38 @@ cc_test( ], ) +cc_test( + name = "renderer_test", + size = "small", + srcs = ["renderer_test.cpp"], + deps = [ + ":emitter", + ":renderer", + "//common:raw_string_ostream", + "//common/terminal:capabilities", + "//common/terminal:metrics", + "//testing/base:gtest_main", + "@googletest//:gtest", + "@llvm-project//llvm:Support", + ], +) + +cc_fuzz_test( + name = "renderer_fuzzer", + size = "small", + srcs = ["renderer_fuzzer.cpp"], + corpus = glob(["fuzzer_corpus/*"]), + deps = [ + ":emitter", + ":renderer", + "//common:check", + "//common/terminal:capabilities", + "//common/terminal:output_buffer_ref", + "//testing/fuzzing:libfuzzer_header", + "@llvm-project//llvm:Support", + ], +) + cc_library( name = "kind", srcs = ["kind.cpp"], @@ -154,3 +209,8 @@ cc_library( "@llvm-project//llvm:Support", ], ) + +filegroup( + name = "testdata", + srcs = glob(["testdata/**/*.carbon"]), +) diff --git a/toolchain/diagnostics/check_diagnostics.py b/toolchain/diagnostics/check_diagnostics.py index baaa9082e5ad..2d4badd5cdd4 100755 --- a/toolchain/diagnostics/check_diagnostics.py +++ b/toolchain/diagnostics/check_diagnostics.py @@ -9,6 +9,23 @@ Validates that each diagnostic declared with CARBON_DIAGNOSTIC_KIND is referenced by one (and only one) CARBON_DIAGNOSTIC. + +Labels, contexts, and location info have no kind to register, so this also +stands in for the registry. `label` below stands for any of the three: + +- Each label is attached somewhere. The compiler warns about most of these, + but not about one declared in a header. + +- Each label is exercised by a file_test, which is what `coverage_test` does + for kinds. It can't do it for labels, because there is no list of them to + enumerate from C++; this reads the declarations and the testdata directly. + +- Each name a testdata file matches on is a kind or a label that exists, so a + renamed one doesn't leave a test matching nothing. + +Being attached does not imply being covered, which is why both are checked: a +label attached only on a branch no test takes is referenced by the code and +drawn by nothing. """ __copyright__ = """ @@ -26,17 +43,64 @@ from concurrent import futures from pathlib import Path from typing import Dict, List, NamedTuple, Set, override -# Example or test diagnostics, ignored because they're expected to not pass. -IGNORED = set( - [ - "MyDiagnostic", - "TestDiagnostic", - "TestDiagnosticContext", - "TestDiagnosticNote", - "TestDiagnosticSoftContext", - ] +# Test diagnostics, ignored because they're expected to not pass. +IGNORED = set(["TestDiagnostic"]) + +# The declarations that name something other than a diagnostic kind. A label +# marks a range of source; a context states a problem in terms of the operation +# it happened inside; location info is a step in the path a location was reached +# by. None of them is registered, and each carries a name that output and +# testdata can match on, so all three are checked here. +LABEL_DECL_RE = ( + r"CARBON_DIAGNOSTIC_(?:LABEL|SOFT_CONTEXT|CONTEXT|LOCATION_INFO)" + r"\(\s*(\w+)," ) +# Labels that no file_test exercises. This is `coverage_test`'s UntestedKinds +# for labels, and entries are checked for being genuinely uncovered so that one +# that gains a test has to be removed from here. +UNCOVERED_LABELS = { + # These exist only for unit tests, which write no testdata. + "TestContext", + "TestContext2", + "TestInfo", + "TestLabel", + "TestSoftContext", + "TestSoftContext2", + "TestSortContext", + # TODO: This is currently hard to test because it requires building and + # importing a module, which attempts to create additional files with + # unpredictable names in the module cache, which bazel doesn't permit. + "InCppModule", +} + + +def strip_noise(content: str) -> str: + """Returns `content` with comments and macro definitions deleted. + + The purpose of this is to remove text that superficially appears to be a + use of a macro, but is actually either defining or documenting it, so that + we can more easily match real macro uses with a simple regex. + + Retains newlines so that line numbers stay correct. + """ + # String literals are matched at the same time and kept, so a `//` inside + # one -- a URL in a diagnostic's message -- is not taken for a comment that + # hides the rest of its line. + content = re.sub( + r'"(?:[^"\\\n]|\\.)*"|//[^\n]*', + lambda m: m.group(0) if m.group(0).startswith('"') else "", + content, + ) + # A macro definition runs to the first line not continued with a backslash. + # Its newlines are kept so that what follows keeps its line number. + return re.sub( + r"^[ \t]*#[ \t]*define(?:[^\n\\]|\\\n?)*", + lambda m: "\n" * m.group(0).count("\n"), + content, + flags=re.M, + ) + class Loc(NamedTuple): """A location for a diagnostic.""" @@ -55,10 +119,8 @@ def load_diagnostic_kind() -> Set[str]: This isn't validated for uniqueness because the compiler does that. """ path = Path("toolchain/diagnostics/kind.def") - content = path.read_text() - decls = set( - re.findall(r"^CARBON_DIAGNOSTIC_KIND\((.+)\)", content, flags=re.M) - ) + content = strip_noise(path.read_text()) + decls = set(re.findall(r"^CARBON_DIAGNOSTIC_KIND\((\w+)\)", content, re.M)) return decls.difference(IGNORED) @@ -66,20 +128,20 @@ def load_diagnostic_uses_in( path: Path, ) -> Dict[str, List[Loc]]: """Returns the path's CARBON_DIAGNOSTIC uses.""" - content = path.read_text() + content = strip_noise(path.read_text()) # Keep a line cursor so that we don't keep re-scanning the file. line = 1 line_offset = 0 found: Dict[str, List[Loc]] = collections.defaultdict(lambda: []) - # `CARBON_DIAGNOSTIC_ON_SCOPE` declares a diagnostic too; the definitions of - # both macros name their own parameter, which is not a use. + # `CARBON_DIAGNOSTIC_ON_SCOPE` declares a diagnostic too; the label, + # context, and location-info macros do not, and have no kind to register. for m in re.finditer( - r"(? Dict[str, List[Loc]]: + """Returns the path's label, context, and location-info declarations. + + All three carry a name the same way a kind does, so all three are checked + the same way, and `label` stands for any of them throughout this script. + """ + content = strip_noise(path.read_text()) + + found: Dict[str, List[Loc]] = collections.defaultdict(list) + for m in re.finditer(LABEL_DECL_RE, content): + label = m.group(1) + if label not in IGNORED: + found[label].append( + Loc(path, 1 + content.count("\n", 0, m.start())) + ) + return found + + +def load_unattached_labels_in(path: Path) -> List[Loc]: + """Returns the path's labels that nothing attaches. + + A label is a file-local constant, so it must be named again in the file + that declares it, by the `Attach` call that attaches it. + + Two declarations of one name in a file -- test scaffolding, and the reason + same-file duplicates are allowed at all -- share their attach counts, so + one of them going unattached hides behind the other's attaches. + """ + content = strip_noise(path.read_text()) + return [ + loc + for label, locs in load_labels_in(path).items() + for loc in locs + if len(re.findall(rf"\b{label}\b", content)) <= len(locs) + ] + + +def sources() -> List[Path]: + """Returns the toolchain sources to scan.""" + return list( + itertools.chain( + *[Path("toolchain").glob(f"**/*.{ext}") for ext in ("h", "cpp")] + ) + ) + + def load_diagnostic_uses() -> Dict[str, List[Loc]]: """Returns all CARBON_DIAGNOSTIC uses.""" - globs = itertools.chain( - *[Path("toolchain").glob(f"**/*.{ext}") for ext in ("h", "cpp")] - ) with futures.ThreadPoolExecutor() as exec: - results = exec.map(load_diagnostic_uses_in, globs) + results = exec.map(load_diagnostic_uses_in, sources()) found: Dict[str, List[Loc]] = collections.defaultdict(lambda: []) for result in results: @@ -102,6 +207,55 @@ def load_diagnostic_uses() -> Dict[str, List[Loc]]: return found +def load_unattached_labels() -> List[Loc]: + """Returns all label declarations that go unused.""" + with futures.ThreadPoolExecutor() as exec: + results = exec.map(load_unattached_labels_in, sources()) + return [loc for result in results for loc in result] + + +def load_labels() -> Dict[str, List[Loc]]: + """Returns all label declarations. + + A name is what a test matches on and what `--include-diagnostic-kind` + prints, so two labels sharing one are indistinguishable to both. Every + declaration is kept rather than the last so that `check_label_uniqueness` + can say so. + """ + with futures.ThreadPoolExecutor() as exec: + results = exec.map(load_labels_in, sources()) + found: Dict[str, List[Loc]] = collections.defaultdict(list) + for result in results: + for label, locs in result.items(): + found[label].extend(locs) + return found + + +def load_covered_names() -> Set[str]: + """Returns the kinds and labels that a file_test matches on. + + This is the same line that `coverage_test` looks for, so the two agree on + what a match looks like. They scan different sets: this walks every + testdata file on disk, while `coverage_test` reads the files its bazel + manifest names, so a file no test runs still counts here. + """ + covered_re = re.compile(r"^ *// CHECK:STDERR: .* \[(\w+)\]$") + + def scan(path: Path) -> Set[str]: + found = set() + for line in path.read_text(errors="replace").splitlines(): + m = covered_re.match(line) + if m: + found.add(m.group(1)) + return found + + testdata = [ + p for p in Path("toolchain").glob("**/testdata/**/*") if p.is_file() + ] + with futures.ThreadPoolExecutor() as exec: + return set().union(*exec.map(scan, testdata)) + + def check_uniqueness(uses: Dict[str, List[Loc]]) -> bool: """If any diagnostic is non-unique, prints an error and returns true.""" has_errors = False @@ -114,23 +268,124 @@ def check_uniqueness(uses: Dict[str, List[Loc]]) -> bool: return has_errors +def check_label_uniqueness(labels: Dict[str, List[Loc]]) -> bool: + """If a label name is declared in two files, prints and returns true. + + A name is what a test matches on and what `--include-diagnostic-kind` + prints, so two labels sharing one are indistinguishable to both: a test + naming it covers whichever the reader guesses. + + Declaring one name twice in a file is left alone. A label is scoped to + where it is attached, so several tests declaring the same scaffolding are + separate objects the author can see together. + """ + has_errors = False + for label, locs in sorted(labels.items()): + files = sorted({loc.path for loc in locs}) + if len(files) > 1: + print( + f"Label {label} is declared in more than one file:", + file=sys.stderr, + ) + for loc in locs: + print(f" - {loc}", file=sys.stderr) + has_errors = True + return has_errors + + def check_unused(decls: Set[str], uses: Dict[str, List[Loc]]) -> bool: """If any diagnostic is unused, prints an error and returns true.""" unused = decls.difference(uses.keys()) if not unused: return False for diag in sorted(unused): - print(f"Unused diagnostic: {diag}") + print(f"Unused diagnostic: {diag}", file=sys.stderr) return True +def check_unattached(unattached: List[Loc]) -> bool: + """If any label is never attached, prints an error and returns true.""" + for loc in sorted(unattached): + print( + f"Unattached label: {loc} (a label is attached in the file that " + "declares it)", + file=sys.stderr, + ) + return bool(unattached) + + +def check_label_kind_collision( + decls: Set[str], labels: Dict[str, List[Loc]] +) -> bool: + """If a label reuses a kind's name, prints an error and returns true. + + A label sharing a kind's name would satisfy both coverage checks with the + other one's tests, so neither name would be checked at all. + """ + has_errors = False + for label in sorted(decls.intersection(labels)): + print( + f"Label {label} reuses a diagnostic kind's name: " + f"{labels[label][0]}", + file=sys.stderr, + ) + has_errors = True + return has_errors + + +def check_label_coverage( + labels: Dict[str, List[Loc]], covered: Set[str] +) -> bool: + """If label coverage doesn't match expectations, prints and returns true.""" + has_errors = False + for label, locs in sorted(labels.items()): + if label in UNCOVERED_LABELS: + if label in covered: + print( + f"Label {label} has coverage even though none was " + f"expected; remove it from UNCOVERED_LABELS: {locs[0]}", + file=sys.stderr, + ) + has_errors = True + elif label not in covered: + print(f"Label has no tests: {label}: {locs[0]}", file=sys.stderr) + has_errors = True + return has_errors + + +def check_unknown_names( + decls: Set[str], labels: Dict[str, List[Loc]], covered: Set[str] +) -> bool: + """If a test names something unknown, prints an error and returns true.""" + unknown = sorted(covered - decls - set(labels) - IGNORED) + for name in unknown: + print( + f"Tests match a name that is neither a kind nor a label: {name}", + file=sys.stderr, + ) + return bool(unknown) + + def main() -> None: # Run from the repo root. os.chdir(Path(__file__).parents[2]) decls = load_diagnostic_kind() uses = load_diagnostic_uses() + labels = load_labels() + unattached = load_unattached_labels() + covered = load_covered_names() - if any([check_uniqueness(uses), check_unused(decls, uses)]): + if any( + [ + check_uniqueness(uses), + check_label_uniqueness(labels), + check_label_kind_collision(decls, labels), + check_unused(decls, uses), + check_unattached(unattached), + check_label_coverage(labels, covered), + check_unknown_names(decls, labels, covered), + ] + ): exit(1) diff --git a/toolchain/diagnostics/consumer.cpp b/toolchain/diagnostics/consumer.cpp deleted file mode 100644 index 9156a730f8e6..000000000000 --- a/toolchain/diagnostics/consumer.cpp +++ /dev/null @@ -1,62 +0,0 @@ -// Part of the Carbon Language project, under the Apache License v2.0 with LLVM -// Exceptions. See /LICENSE for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -#include "toolchain/diagnostics/consumer.h" - -#include -#include - -namespace Carbon::Diagnostics { - -auto StreamConsumer::HandleDiagnostic(Diagnostic diagnostic) -> void { - if (printed_diagnostic_) { - *stream_ << "\n"; - } else { - 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(message)) { - case Level::Error: - *stream_ << "error: "; - break; - case Level::Warning: - *stream_ << "warning: "; - break; - case Level::Note: - *stream_ << "note: "; - 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_) { - *stream_ << " [" << message.kind << "]"; - } - *stream_ << "\n"; - // Don't include a snippet for location information to keep this diagnostic - // more visually associated with the following diagnostic that it describes - // and to better match C++ compilers. - if (message.level != Level::LocationInfo) { - message.loc.FormatSnippet(*stream_); - } - } -} - -auto ConsoleConsumer() -> Consumer& { - static auto* consumer = new StreamConsumer(&llvm::errs()); - return *consumer; -} - -} // namespace Carbon::Diagnostics diff --git a/toolchain/diagnostics/consumer.h b/toolchain/diagnostics/consumer.h index 5c0e83023be5..8d1e3e8245ea 100644 --- a/toolchain/diagnostics/consumer.h +++ b/toolchain/diagnostics/consumer.h @@ -23,7 +23,7 @@ class Consumer { // However, SortingConsumer needs a longer lifetime, until all // diagnostics have been produced. As a consequence, it needs to either copy // or move the Diagnostic, and right now we're moving due to the overhead of - // notes. + // labels. // // At present, there is no persistent storage of diagnostics because IDEs // would be fine with diagnostics being printed immediately and discarded, @@ -36,32 +36,8 @@ class Consumer { virtual auto Flush() -> void {} }; -// A diagnostic consumer that prints to a stream. -class StreamConsumer : public Consumer { - public: - explicit StreamConsumer(llvm::raw_ostream* stream) : stream_(stream) {} - - auto HandleDiagnostic(Diagnostic diagnostic) -> void override; - auto Flush() -> void override { stream_->flush(); } - - auto set_stream(llvm::raw_ostream* stream) -> void { stream_ = stream; } - auto set_include_diagnostic_kind(bool value) -> void { - include_diagnostic_kind_ = value; - } - - private: - auto Print(const Message& message, llvm::StringRef prefix) -> void; - - llvm::raw_ostream* stream_; - - // Whether to include the diagnostic kind when printing. - bool include_diagnostic_kind_ = false; - - // Whethere we've printed a diagnostic. Used for printing separators. - bool printed_diagnostic_ = false; -}; - -// Returns a diagnostic consumer instance that prints to stderr. +// Returns a diagnostic consumer instance that prints to stderr. Defined +// alongside `StreamConsumer` in `stream_consumer.h`, which it renders through. auto ConsoleConsumer() -> Consumer&; // Diagnostic consumer adaptor that tracks whether any errors have been diff --git a/toolchain/diagnostics/coverage_test.cpp b/toolchain/diagnostics/coverage_test.cpp index e3368f879e70..5408136b7a8f 100644 --- a/toolchain/diagnostics/coverage_test.cpp +++ b/toolchain/diagnostics/coverage_test.cpp @@ -22,12 +22,7 @@ constexpr Kind Kinds[] = { constexpr Kind UntestedKinds[] = { // These exist only for unit tests. Kind::TestDiagnostic, - Kind::TestDiagnosticContext, - Kind::TestDiagnosticContext2, - Kind::TestDiagnosticNote, Kind::TestDiagnosticOnScope, - Kind::TestDiagnosticSoftContext, - Kind::TestDiagnosticSoftContext2, // Diagnosing erroneous install conditions, but test environments are // typically correct. @@ -60,27 +55,33 @@ constexpr Kind UntestedKinds[] = { // Producing an emit failure may be infeasible. Kind::CodeGenUnableToEmit, - // TODO: This is currently hard to test because it requires building and - // importing a module, which attempts to create additional files with - // unpredictable names in the module cache, which bazel doesn't permit. - Kind::InCppModule, + // Degradation for a Clang note that leads a flushed buffer instead of + // trailing the diagnostic it explains, which needs a mistimed flush or a + // Clang bug to produce. + Kind::CppInteropStrayNote, - // TODO: This can only fire if the first message in a diagnostic is rooted - // in a file other than the file being compiled. The language server - // currently only supports compiling one file at a time. Do one of: - // - When imports are supported, find a diagnostic whose first message isn't - // in the current file. - // - Require all diagnostics produced by compiling have their first location - // be in the file being compiled, never an import. + // TODO: This can only fire if a diagnostic's message is rooted in a file + // other than the file being compiled. The language server currently only + // supports compiling one file at a time. Do one of: + // - When imports are supported, find a diagnostic whose message isn't in + // the current file. + // - Require all diagnostics produced by compiling have their message's + // location be in the file being compiled, never an import. Kind::LanguageServerDiagnosticInWrongFile, }; // Looks for diagnostic kinds that aren't covered by a file_test. +// +// A line names either a kind or an attached label, and there is no list of +// labels to enumerate from here, so a match that isn't a kind is left alone. +// `check_diagnostics.py` is what covers them: it reads the declarations and the +// testdata directly, so it checks that every label is exercised and that every +// name a test matches on is a kind or a label that exists. TEST(Coverage, Kind) { - Testing::TestKindCoverage(absl::GetFlag(FLAGS_testdata_manifest), - R"(^ *// CHECK:STDERR: .* \[(\w+)\]$)", - llvm::ArrayRef(Kinds), - llvm::ArrayRef(UntestedKinds)); + Testing::TestKindCoverage( + absl::GetFlag(FLAGS_testdata_manifest), + R"(^ *// CHECK:STDERR: .* \[(\w+)\]$)", llvm::ArrayRef(Kinds), + llvm::ArrayRef(UntestedKinds), /*allow_unlisted_matches=*/true); } } // namespace diff --git a/toolchain/diagnostics/diagnostic.cpp b/toolchain/diagnostics/diagnostic.cpp deleted file mode 100644 index 1338d5624e75..000000000000 --- a/toolchain/diagnostics/diagnostic.cpp +++ /dev/null @@ -1,93 +0,0 @@ -// Part of the Carbon Language project, under the Apache License v2.0 with LLVM -// Exceptions. See /LICENSE for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -#include "toolchain/diagnostics/diagnostic.h" - -#include -#include - -#include "llvm/ADT/Sequence.h" - -namespace Carbon::Diagnostics { - -auto Loc::FormatLocation(llvm::raw_ostream& out) const -> void { - if (filename.empty()) { - return; - } - out << filename; - if (line_number > 0) { - out << ":" << line_number; - if (column_number > 0) { - out << ":" << column_number; - } - } - out << ": "; -} - -auto Loc::FormatSnippet(llvm::raw_ostream& out, int indent) const -> void { - if (!snippet.empty()) { - llvm::StringRef snippet_ref = snippet; - do { - auto [snippet_line, rest] = snippet_ref.split('\n'); - out.indent(indent); - out << snippet_line << "\n"; - snippet_ref = rest; - } while (!snippet_ref.empty()); - return; - } - - if (column_number == -1) { - return; - } - // column_number is 1-based. - const int caret_byte_offset = column_number - 1; - - out.indent(indent); - - int column = 0; - int caret_column = 0; - int underline_end_column = 0; - - int byte_offset = 0; - for (char c : line) { - // TODO: Handle tab characters. - // TODO: Print Unicode characters directly, and use - // llvm::sys::unicode::getColumnWidth to determine their width. - if (std::isprint(static_cast(c))) { - out << c; - ++column; - } else { - // TODO: Consider using ANSI colors to distinguish this from the program - // text. - int pos = out.tell(); - out << '<'; - llvm::write_hex(out, static_cast(c), - llvm::HexPrintStyle::Upper, 2); - out << '>'; - column += out.tell() - pos; - } - - ++byte_offset; - if (byte_offset <= caret_byte_offset) { - caret_column = column; - } - if (byte_offset <= caret_byte_offset + length) { - underline_end_column = column; - } - } - - out << "\n"; - - out.indent(indent + caret_column); - out << "^"; - // TODO: Revisit this once we can reference multiple ranges in a single - // diagnostic message. - for (auto _ : - llvm::seq(std::max(underline_end_column - caret_column - 1, 0))) { - out << '~'; - } - out << '\n'; -} - -} // namespace Carbon::Diagnostics diff --git a/toolchain/diagnostics/diagnostic.h b/toolchain/diagnostics/diagnostic.h index 90196064b401..2089c51c05d8 100644 --- a/toolchain/diagnostics/diagnostic.h +++ b/toolchain/diagnostics/diagnostic.h @@ -11,37 +11,42 @@ #include "common/check.h" #include "llvm/ADT/Any.h" +#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" #include "toolchain/diagnostics/kind.h" namespace Carbon::Diagnostics { +// The severity of a diagnostic. +// +// A diagnostic reports one problem and its message says what that problem is, +// so these are the only levels there are. Everything else a diagnostic has to +// say is a label attached to it. enum class Level : int8_t { - // Information about the location of another diagnostic, showing how we - // reached that location. This is currently only used for the "in import" - // message. - LocationInfo, - // 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. + // A likely problem with the program. Warning, - // An error diagnostic, indicating that the program is not valid. + // The program is not valid. Error, }; -// Provides a definition of a diagnostic. For example: +// What a labeled range of source has to do with the diagnostic it is attached +// to. +// +// A label is read against the code it marks rather than on its own, which is +// what separates one from a message: `declared here` is not a sentence anyone +// would want to read by itself. Anything that doesn't mark source that way is +// not a label: see `CARBON_DIAGNOSTIC_CONTEXT` and +// `CARBON_DIAGNOSTIC_LOCATION_INFO`. +enum class LabelCategory : int8_t { + // Source that explains why the problem happened without being part of it. + Info, + // Source that is directly part of the problem. + Primary, +}; + +// Provides a definition of a diagnostic: the message that reports a problem +// and stands alone as the sentence describing it. For example: // CARBON_DIAGNOSTIC(MyDiagnostic, Error, "invalid code!"); // CARBON_DIAGNOSTIC(MyDiagnostic, Warning, "found {0}, expected {1}", // std::string, std::string); @@ -57,72 +62,175 @@ enum class Level : int8_t { ::Carbon::Diagnostics::Level::LevelValue, /*is_on_scope=*/false, \ Format) +// Provides a definition of a label: a phrase attached to a range of source, +// saying what that range has to do with the diagnostic. For example: +// CARBON_DIAGNOSTIC_LABEL(ArgsPassedHere, Primary, +// "{0} argument{0:s} passed here", IntAsSelect); +// CARBON_DIAGNOSTIC_LABEL(FunctionDeclaredHere, Info, +// "calling function declared here"); +// +// The category says what the range is to the diagnostic; see `LabelCategory`. +// A label has a format and arguments of its own, so it says only what it needs +// to about the place it marks, and both are validated as a message's are. +// +// It has no level, because it is read against the code rather than on its own, +// and no kind, because there is no central registry of labels: a label is +// declared where it is attached and nowhere else. What the registry does for a +// diagnostic is done here by `check_diagnostics.py`, which reports a label that +// is never attached, and by the compiler, which warns about most of them. +// +// It still carries its own name, so that `--include-diagnostic-kind` can say +// which label produced a line and a test can match on it. See +// `Emitter::Builder::Attach`. +#define CARBON_DIAGNOSTIC_LABEL(LabelName, CategoryValue, Format, ...) \ + static constexpr auto LabelName = \ + ::Carbon::Diagnostics::LabelBase<__VA_ARGS__>( \ + ::Carbon::Diagnostics::LabelCategory::CategoryValue, #LabelName, \ + Format) + +// Provides a definition of a context: a sentence stating a problem in terms of +// the operation it happened inside. For example: +// CARBON_DIAGNOSTIC_CONTEXT(IncompleteTypeInFunctionReturnType, +// "function returns incomplete type {0}", +// SemIR::TypeId); +// +// A context is not a label. It is a sentence in its own right, the way a +// message is, so where a diagnostic has one it leads and the message is read +// against the code like anything else explaining it; see `LeadingContext`. It +// is attached by a `ContextScope` rather than by the code emitting a +// diagnostic. +#define CARBON_DIAGNOSTIC_CONTEXT(ContextName, Format, ...) \ + static constexpr auto ContextName = \ + ::Carbon::Diagnostics::ContextBase<__VA_ARGS__>(/*is_soft=*/false, \ + #ContextName, Format) + +// Like `CARBON_DIAGNOSTIC_CONTEXT`, for a context used only as a fallback: it +// is dropped when the diagnostic already has one, which is assumed to describe +// the failure better. +#define CARBON_DIAGNOSTIC_SOFT_CONTEXT(ContextName, Format, ...) \ + static constexpr auto ContextName = \ + ::Carbon::Diagnostics::ContextBase<__VA_ARGS__>(/*is_soft=*/true, \ + #ContextName, Format) + +// Provides a definition of a step in the path by which a location was reached +// -- an import, an include, a macro expansion. For example: +// CARBON_DIAGNOSTIC_LOCATION_INFO(InImport, "imported from"); +// +// This is not a label either: it marks no source, and is drawn as +// `: ` above the file it leads to. It is attached by an +// emitter's `ConvertLoc`, and takes no arguments, because that is all the +// conversion has to give it. +#define CARBON_DIAGNOSTIC_LOCATION_INFO(StepName, Format) \ + static constexpr auto StepName = \ + ::Carbon::Diagnostics::LocationInfoBase(#StepName, Format) + // Similar to `CARBON_DIAGNOSTIC`, but for diagnostics that are generated on a // scope; see `Diagnostic::is_on_scope` for details. #define CARBON_DIAGNOSTIC_ON_SCOPE(DiagnosticName, LevelValue, Format, ...) \ - static_assert(::Carbon::Diagnostics::Level::LevelValue == \ - ::Carbon::Diagnostics::Level::Warning || \ - ::Carbon::Diagnostics::Level::LevelValue == \ - ::Carbon::Diagnostics::Level::Error, \ - "Only use CARBON_DIAGNOSTIC_ON_SCOPE for the main " \ - "diagnostic, not notes"); \ static constexpr auto DiagnosticName = \ ::Carbon::Diagnostics::DiagnosticBase<__VA_ARGS__>( \ ::Carbon::Diagnostics::Kind::DiagnosticName, \ ::Carbon::Diagnostics::Level::LevelValue, /*is_on_scope=*/true, \ Format) -// A location for a diagnostic in a file. The lifetime of a Loc -// is required to be less than SourceBuffer that it refers to due to the -// contained filename and line references. +// A location for a diagnostic in a file. A `Loc` must not outlive the +// `SourceBuffer` it refers into: `filename`, `line`, and `file_text` are all +// references into it. +// +// This is data only; see `Diagnostics::Renderer` for how it is drawn. struct Loc { - // Writes the location to the given stream. It will be formatted as - // `::: ` with parts dropped when - // unknown. - auto FormatLocation(llvm::raw_ostream& out) const -> void; - - // Write the source snippet corresponding to this location to the given - // stream. - auto FormatSnippet(llvm::raw_ostream& out, int indent = 0) const -> void; - // Name of the file or buffer that this diagnostic refers to. llvm::StringRef filename; // A reference to the line of the error. llvm::StringRef line; - // A full snippet to print. If non-empty, this is used instead of `line` when - // printing a snippet. Should contain both the quoted text and the caret line. - std::string snippet; + // The whole file `line` points into, when there is one. Rendering uses it to + // show the lines between two spans that are close together, and `line` is a + // slice of it, so the two can't disagree. + llvm::StringRef file_text; // 1-based line number. -1 indicates unknown; other values are unused. int32_t line_number = -1; - // 1-based column number. -1 indicates unknown; other values are unused. + // 1-based byte offset into `line`, despite the name. -1 indicates unknown; + // other values are unused. + // + // Bytes rather than columns because that is what every producer has: the + // lexer subtracts source pointers, and Clang's columns are byte offsets too. + // A location may name a byte inside a multi-byte character or a tab, so + // rendering converts to columns rather than assuming the two agree. int32_t column_number = -1; - // The number of characters corresponding to the location in the line, - // starting at column_number. Should always be at least 1. + // The number of bytes the location covers in `line`, starting at + // `column_number`. Should always be at least 1. + // + // This is the range underlined in the source snippet. A message's own + // location is a point that an editor puts a cursor on, so where a range was + // attached to the same line to say what the problem covers, that range is + // drawn in its place rather than this one. See `Emitter::Builder::Attach`. int32_t length = 1; }; -// A message composing a diagnostic. This may be the main message, but can also -// be notes providing more information. +// Applies a format to its arguments. +// +// Formatting is deferred so that a consumer can inspect a diagnostic's +// arguments rather than parsing its formatted text; see +// `Message::format_args`. +using FormatFn = std::function args) + ->std::string>; + +// A step in the path by which a location was reached; see +// `CARBON_DIAGNOSTIC_LOCATION_INFO`. +// +// Several steps stack into a path, outermost first, so they are held in the +// order they were walked by whatever they lead to. +struct LocationInfo { + // Returns the step's text, matching `Message` and `Label`. It is the declared + // format string verbatim, since a step has no arguments to apply to it. + auto Format() const -> std::string { return format.str(); } + + // The location this step names, which is where the step was taken from + // rather than where it arrived. + Loc loc; + + // The step's own name; see `CARBON_DIAGNOSTIC_LOCATION_INFO`. + llvm::StringLiteral name; + + // The step's format, which with no arguments to apply is its text. + llvm::StringLiteral format; +}; + +// The message reporting a problem, which is what starts a diagnostic. +// +// A message stands alone: it is the sentence that says what is wrong, and +// makes sense read by itself with nothing around it. Everything that only +// makes sense against a piece of code is a `Label` attached to the diagnostic +// instead. struct Message { // Helper for calling `format_fn`. - auto Format() const -> std::string { return format_fn(*this); } + auto Format() const -> std::string { + CARBON_CHECK(format_fn, "A message always has a `format_fn`."); + return format_fn(format, format_args); + } // The diagnostic's kind. Kind kind; - // The message's level. This may be different from, but should not be more - // severe than, the diagnostic's level. + // The message's level, which is the diagnostic's. Level level; - // The calculated location of the diagnostic. + // The primary location to associate with the message: where an editor puts a + // cursor, and the range underlined in the snippet. See `Loc::length`. Loc loc; - // The diagnostic's format string. This, along with format_args, will be + // How `loc` was reached, when it was reached through an import, an include, + // or a macro expansion. Inline storage is off because a step is large and + // almost nothing is reached through one. + llvm::SmallVector location_info; + + // The message's format string. This, along with format_args, will be // passed to format_fn. llvm::StringLiteral format; @@ -135,10 +243,79 @@ struct Message { llvm::SmallVector format_args; // Returns the formatted string. By default, this uses llvm::formatv. - std::functionstd::string> format_fn; + FormatFn format_fn; }; -// An instance of a single error or warning. Information about the diagnostic +// A range of source attached to a diagnostic, and optionally a phrase saying +// what that range has to do with it. +// +// A label with no text marks its range and says nothing, which is how a +// diagnostic points at the code its message is about without repeating the +// message against it. +struct Label { + // Returns the label's text, which is empty when it only marks a range. + auto Format() const -> std::string { + return format_fn ? format_fn(format, format_args) : std::string(); + } + + // What this range has to do with the diagnostic. + LabelCategory category; + + // The range of source this marks, from `Loc::column_number` across + // `Loc::length`. + Loc loc; + + // How `loc` was reached, when it was reached through an import, an include, + // or a macro expansion. Inline storage is off because a step is large and + // almost nothing is reached through one. + llvm::SmallVector location_info; + + // The label's own name; see `CARBON_DIAGNOSTIC_LABEL`. Empty for a label that + // only marks its range, which nothing needs to name because it says nothing. + llvm::StringLiteral name = ""; + + // The label's format for llvm::formatv, and the arguments to apply to it. + // Both are empty for a label that only marks its range. + llvm::StringLiteral format = ""; + llvm::SmallVector format_args; + + // Empty for a label that only marks its range. + FormatFn format_fn; +}; + +// A problem stated in terms of the operation it happened inside; see +// `CARBON_DIAGNOSTIC_CONTEXT`. +// +// This is not a label: its text stands alone as a sentence rather than being +// read against the source it names, which is what lets it lead a diagnostic in +// place of the message. +struct Context { + // Returns the context's text. + auto Format() const -> std::string { + CARBON_CHECK(format_fn, "A context always has a `format_fn`."); + return format_fn(format, format_args); + } + + // Where the operation was entered. + Loc loc; + + // How `loc` was reached, when it was reached through an import, an include, + // or a macro expansion. Inline storage is off because a step is large and + // almost nothing is reached through one. + llvm::SmallVector location_info; + + // The context's own name; see `CARBON_DIAGNOSTIC_CONTEXT`. + llvm::StringLiteral name; + + // The context's format for llvm::formatv, and the arguments to apply to it. + llvm::StringLiteral format; + llvm::SmallVector format_args; + + // Returns the formatted string. By default, this uses llvm::formatv. + FormatFn format_fn; +}; + +// An instance of a single error or warning. Information about the diagnostic // can be recorded into it for more complex consumers. struct Diagnostic { // The diagnostic's level. @@ -146,14 +323,14 @@ struct Diagnostic { // Whether a diagnostic should only sort by `last_byte_offset` (which is // normal), or if it's generated on a scope and should be sorted based on the - // first message's line and column when the `last_byte_offset` is equal. - // This is used by `SortingConsumer`. + // message's line and column when the `last_byte_offset` is equal. This is + // used by `SortingConsumer`. bool is_on_scope; // The byte offset of the final token which is associated with the diagnostic. // This is used by `SortingConsumer`. This is separate from the // `Loc` because it must refer to a position in the primary file - // being processed by a consumer, and has no use cross-file or in notes. + // being processed by a consumer, and has no use cross-file or in labels. // // This will usually be the start position (not end) of the last lexed token // processed before the diagnostic; it could also be `-1` when no source code @@ -162,11 +339,46 @@ struct Diagnostic { // is issued. int32_t last_byte_offset = -1; - // Messages related to the diagnostic. Only one should be a warning or error; - // other messages provide context. - llvm::SmallVector messages; + // The one problem being reported. + Message message; + + // The operations the problem happened inside, outermost first, which is the + // order their `ContextScope`s were entered in. + // + // A `Context` is undesirably large for inline storage by SmallVector, so we + // specify 0. + llvm::SmallVector contexts; + + // The source attached to the message, in the order it was attached. + // + // A `Label` is undesirably large for inline storage by SmallVector, so we + // specify 0. + llvm::SmallVector labels; }; +// Returns the context that leads the diagnostic in place of its message, or +// null when there is none. +// +// A context names the operation that failed, and when a diagnostic has one that +// is what the reader is told about; the message is then read against the code +// like anything else explaining it. Anything presenting a diagnostic as a +// single sentence -- the headline of the rendering, an editor's hover text -- +// wants this rather than the message. +inline auto LeadingContext(const Diagnostic& diagnostic) -> const Context* { + return diagnostic.contexts.empty() ? nullptr : &diagnostic.contexts.front(); +} + +// Rejects `Args` a diagnostic or label may not be formatted with, when the +// enclosing constructor is instantiated. +template +constexpr auto CheckArgTypes() -> void { + static_assert((... && !(std::is_same_v || + std::is_same_v)), + "String type disallowed in diagnostics. See " + "https://github.com/carbon-language/carbon-lang/blob/trunk/" + "toolchain/docs/diagnostics.md#diagnostic-parameter-types"); +} + // Use the DIAGNOSTIC macro to instantiate this. // This stores static information about a diagnostic category. template @@ -174,11 +386,7 @@ struct DiagnosticBase { explicit constexpr DiagnosticBase(Kind kind, Level level, bool is_on_scope, llvm::StringLiteral format) : Kind(kind), Level(level), IsOnScope(is_on_scope), Format(format) { - static_assert((... && !(std::is_same_v || - std::is_same_v)), - "String type disallowed in diagnostics. See " - "https://github.com/carbon-language/carbon-lang/blob/trunk/" - "toolchain/docs/diagnostics.md#diagnostic-parameter-types"); + CheckArgTypes(); } // The diagnostic's kind. @@ -191,6 +399,62 @@ struct DiagnosticBase { llvm::StringLiteral Format; }; +// Use the CARBON_DIAGNOSTIC_LABEL macro to instantiate this. This stores the +// static information about a label: what it is to the diagnostic, what it is +// called, its format, and the types of its arguments. +template +struct LabelBase { + explicit constexpr LabelBase(LabelCategory category, llvm::StringLiteral name, + llvm::StringLiteral format) + : Category(category), Name(name), Format(format) { + CheckArgTypes(); + } + + // What the labeled range is to the diagnostic. + LabelCategory Category; + // The label's own name, which stands in for a diagnostic's kind when naming + // what produced a line of output. + llvm::StringLiteral Name; + // The label's format for llvm::formatv. + llvm::StringLiteral Format; +}; + +// Use the CARBON_DIAGNOSTIC_CONTEXT macro to instantiate this. This stores the +// static information about a context: whether it is only a fallback, what it is +// called, its format, and the types of its arguments. +template +struct ContextBase { + explicit constexpr ContextBase(bool is_soft, llvm::StringLiteral name, + llvm::StringLiteral format) + : IsSoft(is_soft), Name(name), Format(format) { + CheckArgTypes(); + } + + // Whether this is dropped when the diagnostic already has a context; see + // `CARBON_DIAGNOSTIC_SOFT_CONTEXT`. + bool IsSoft; + // The context's own name, which stands in for a diagnostic's kind when naming + // what produced a line of output. + llvm::StringLiteral Name; + // The context's format for llvm::formatv. + llvm::StringLiteral Format; +}; + +// Use the CARBON_DIAGNOSTIC_LOCATION_INFO macro to instantiate this. This +// stores the static information about a step in a path: what it is called and +// its text. It is not a template, because a step has no arguments. +struct LocationInfoBase { + explicit constexpr LocationInfoBase(llvm::StringLiteral name, + llvm::StringLiteral format) + : Name(name), Format(format) {} + + // The step's own name, which stands in for a diagnostic's kind when naming + // what produced a line of output. + llvm::StringLiteral Name; + // The step's text. + llvm::StringLiteral Format; +}; + } // namespace Carbon::Diagnostics #endif // CARBON_TOOLCHAIN_DIAGNOSTICS_DIAGNOSTIC_H_ diff --git a/toolchain/diagnostics/emitter.h b/toolchain/diagnostics/emitter.h index 43fc12dc8c35..920c3c2307d0 100644 --- a/toolchain/diagnostics/emitter.h +++ b/toolchain/diagnostics/emitter.h @@ -6,12 +6,14 @@ #define CARBON_TOOLCHAIN_DIAGNOSTICS_EMITTER_H_ #include +#include #include #include #include #include "common/check.h" #include "llvm/ADT/Any.h" +#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Support/FormatVariadic.h" #include "llvm/Support/TypeName.h" @@ -33,7 +35,7 @@ using NoTypeDeduction = std::type_identity_t; template class AnnotationScope; -// The result of `DiagnosticConvert::ConvertLoc`. This is non-templated to allow +// The result of `Emitter::ConvertLoc`. This is non-templated to allow // sharing across converters. struct ConvertedLoc { // Becomes Message::loc. @@ -76,20 +78,27 @@ class Emitter { Builder(Builder&&) noexcept = default; auto operator=(Builder&&) noexcept -> Builder& = default; - // Overrides the snippet for the most recently added diagnostic or note with - // the given text. The provided override should include the caret text as - // well as the source snippet. An empty snippet restores the default - // behavior of printing the original source line. - auto OverrideSnippet(llvm::StringRef snippet) -> Builder&; - - // 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`. + // Attaches a range of source to the diagnostic, along with the phrase + // `label` declares saying what that range has to do with it; see + // `CARBON_DIAGNOSTIC_LABEL`. 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&; + auto Attach(LocT loc, const LabelBase& label, + Internal::NoTypeDeduction... args) -> Builder&; - // Emits the built diagnostic and its attached notes. + // Attaches a range of source with nothing to say about it beyond marking + // it. This is what points at the code the message is about without + // repeating the message against it. + // + // `category` says what the range is to the diagnostic, the way a declared + // label's does. A label saying nothing has no phrase to declare, so there + // is nothing for `CARBON_DIAGNOSTIC_LABEL` to hold and the category is + // passed here instead. + auto Attach(LocT loc, LabelCategory category = LabelCategory::Primary) + -> Builder&; + + // Emits the built diagnostic and its attached labels. // For the expected usage see the builder API: `Emitter::Build`. template auto Emit() & -> void; @@ -98,11 +107,6 @@ class Emitter { template auto Emit() && -> void; - // Returns true if this Builder may emit a diagnostic. Can be used - // to avoid excess work computing notes, etc, if no diagnostic is going to - // be emitted anyway. - explicit operator bool() { return emitter_; } - private: friend class Emitter; friend class ContextBuilder; @@ -112,45 +116,66 @@ class Emitter { const DiagnosticBase& diagnostic_base, llvm::SmallVector args); - // Adds a message to the diagnostic, handling conversion of the location and - // arguments. - template - auto AddMessage(LocT loc, const DiagnosticBase& diagnostic_base, - llvm::SmallVector args) -> void; + // Converts `loc`, collecting the path by which it was reached into + // `location_info` and recording the offset the diagnostic sorts by. + auto ConvertLoc(LocT loc, llvm::SmallVector& location_info) + -> Loc; - // Adds a message to the diagnostic, handling conversion of the arguments. A - // Loc must be provided instead of a LocT in order to - // avoid potential recursion. + // Attaches a label, handling conversion of the location and arguments. The + // category comes from `label`, so this is the one path every label takes + // however it was attached. template - auto AddMessageWithLoc(Loc loc, - const DiagnosticBase& diagnostic_base, - llvm::SmallVector args) -> void; + auto AttachLabel(LocT loc, const LabelBase& label, + llvm::SmallVector args) -> void; - // Handles the cast of llvm::Any to Args types for formatv. + // Attaches a context, handling conversion of the location and arguments. + // Only a `ContextScope` reaches this, through `ContextBuilder`. + template + auto AttachContext(LocT loc, const ContextBase& context, + llvm::SmallVector args) -> void; + + // Returns a function that formats `Args` from the storage types they + // convert to. + // // TODO: Custom formatting can be provided with an format_provider, but that // affects all formatv calls. Consider replacing formatv with a custom call // that allows diagnostic-specific formatting. - template - static auto FormatFn(const Message& message, - std::index_sequence /*indices*/) -> std::string; + template + static auto MakeFormatFn() -> Diagnostics::FormatFn; - // Whether a Context or SoftContext message has been added to the Builder. - auto has_context_message() const -> bool { return has_context_message_; } + // Applies `format` to `args`, which must be the storage types for `Args`. + // Both a message and a label format this way, from argument lists of their + // own. + template + static auto FormatArgs(llvm::StringLiteral format, + llvm::ArrayRef args, + std::index_sequence /*indices*/) + -> std::string; Emitter* emitter_; - Diagnostic diagnostic_; - bool has_context_message_ = false; + + // The diagnostic's parts, assembled by `Emit`. A `Message` can't be + // default-constructed -- a `Kind` has no value meaning "no kind" -- so the + // diagnostic itself only exists once there is a message to put in it. + Level level_; + bool is_on_scope_; + int32_t last_byte_offset_ = -1; + // Absent only while the constructor is gathering the context that comes + // before the message. + std::optional message_; + llvm::SmallVector contexts_; + llvm::SmallVector labels_; }; 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: + // Attaches 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&; + auto Attach(LocT loc, const ContextBase& context, + Internal::NoTypeDeduction... args) -> ContextBuilder&; private: friend class Emitter; @@ -175,11 +200,11 @@ class Emitter { auto Emit(LocT loc, const DiagnosticBase& diagnostic_base, Internal::NoTypeDeduction... args) -> void; - // A fluent interface for building a diagnostic and attaching notes for added - // context or information. For example: + // A fluent interface for building a diagnostic and attaching the source that + // explains it. For example: // // emitter_.Build(loc1, MyDiagnostic) - // .Note(loc2, MyDiagnosticNote) + // .Attach(loc2, MyDiagnosticLabel) // .Emit(); template auto Build(LocT loc, const DiagnosticBase& diagnostic_base, @@ -203,8 +228,9 @@ class Emitter { // error and producing the attached notes. // // This is called automatically before any diagnostic annotator is added or - // removed, to flush any pending diagnostics with suitable notes attached, and - // when the emitter is destroyed. + // removed, so that a pending diagnostic gets the annotations that were in + // force when it was produced. Destruction deliberately does not flush; see + // the `Flush` test. auto Flush() -> void { for (auto& flush_fn : flush_fns_) { flush_fn(); @@ -213,21 +239,18 @@ 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. + // messages are read against the higher-level operation that failed. // // 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()); } - // Returns the consumer for this emitter. - auto consumer() const -> Consumer& { return *consumer_; } - protected: - // Callback type used to report context messages from ConvertLoc. - // Note that the first parameter type is Loc rather than + // Callback type used to report the path a location was reached by from + // ConvertLoc. Note that the first parameter type is Loc rather than // LocT, because ConvertLoc must not recurse. using ContextFnT = - llvm::function_ref&)->void>; + llvm::function_refvoid>; // Converts a LocT to a Loc and its `last_byte_offset` (see // `Message`). ConvertLoc may invoke context_fn to provide context @@ -249,7 +272,6 @@ class Emitter { friend class ContextScope; template friend class AnnotationScope; - friend class NoLocEmitter; Consumer* consumer_; llvm::SmallVectorvoid>, 1> flush_fns_; @@ -270,10 +292,6 @@ class NoLocEmitter : public Emitter { public: using Emitter::Emitter; - template - explicit NoLocEmitter(const Emitter& emitter) - : Emitter(emitter.consumer_) {} - // Emits an error. This specialization only applies to // `NoLocEmitter`. template @@ -290,13 +308,12 @@ 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. +// carry a context label describing the higher-level operation that failed. // // 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`. +// given emitter. That function can provide a context label that explains the +// higher level failure caused by the diagnostic by calling `builder.Attach`. template class ContextScope { public: @@ -330,7 +347,7 @@ ContextScope(Emitter* emitter, ContextFn context) // This object is given a function `annotate` that will be called with a // `Builder& builder` for any diagnostic that is emitted through the // given emitter. That function can annotate the diagnostic by calling -// `builder.Note` to add notes. +// `builder.Attach` to attach labels. template class AnnotationScope { public: @@ -380,21 +397,24 @@ struct DiagnosticTypeForArg : public Arg::DiagnosticType {}; } // namespace Internal template -auto Emitter::Builder::OverrideSnippet(llvm::StringRef snippet) +template +auto Emitter::Builder::Attach(LocT loc, const LabelBase& label, + Internal::NoTypeDeduction... args) -> Builder& { - diagnostic_.messages.back().loc.snippet = snippet; + AttachLabel(LocT(loc), label, {emitter_->MakeAny(args)...}); return *this; } template -template -auto Emitter::Builder::Note( - LocT loc, const DiagnosticBase& diagnostic_base, - Internal::NoTypeDeduction... args) -> Builder& { - CARBON_CHECK(diagnostic_base.Level == Level::Note || - diagnostic_base.Level == Level::LocationInfo, - "{0}", static_cast(diagnostic_base.Level)); - AddMessage(LocT(loc), diagnostic_base, {emitter_->MakeAny(args)...}); +auto Emitter::Builder::Attach(LocT loc, LabelCategory category) + -> Builder& { + // Left without a format and without a `format_fn`, which is how a label says + // it marks its range and no more. + llvm::SmallVector location_info; + Loc loc_value = ConvertLoc(LocT(loc), location_info); + labels_.push_back(Label{.category = category, + .loc = loc_value, + .location_info = std::move(location_info)}); return *this; } @@ -404,7 +424,15 @@ auto Emitter::Builder::Emit() & -> void { for (auto annotate_fn : llvm::reverse(emitter_->annotate_fns_)) { annotate_fn(*this); } - emitter_->consumer_->HandleDiagnostic(std::move(diagnostic_)); + CARBON_CHECK(message_, + "A builder has its message from the moment it exists."); + emitter_->consumer_->HandleDiagnostic( + Diagnostic{.level = level_, + .is_on_scope = is_on_scope_, + .last_byte_offset = last_byte_offset_, + .message = *std::move(message_), + .contexts = std::move(contexts_), + .labels = std::move(labels_)}); } template @@ -412,7 +440,7 @@ template auto Emitter::Builder::Emit() && -> void { static_assert(false, "Use `emitter.Emit(...)` or " - "`emitter.Build(...).Note(...).Emit(...)` " + "`emitter.Build(...).Attach(...).Emit(...)` " "instead of `emitter.Build(...).Emit(...)`"); } @@ -422,78 +450,109 @@ Emitter::Builder::Builder(Emitter* emitter, LocT loc, const DiagnosticBase& diagnostic_base, llvm::SmallVector args) : 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); + level_(diagnostic_base.Level), + is_on_scope_(diagnostic_base.IsOnScope) { + // The context describes the operation the message happened inside, so it is + // gathered before the message it encloses -- which is also what makes its + // location the one the diagnostic sorts by. 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); + + llvm::SmallVector location_info; + Loc loc_value = ConvertLoc(LocT(loc), location_info); + message_ = Message{.kind = diagnostic_base.Kind, + .level = diagnostic_base.Level, + .loc = std::move(loc_value), + .location_info = std::move(location_info), + .format = diagnostic_base.Format, + .format_args = std::move(args), + .format_fn = MakeFormatFn()}; } template -template -auto Emitter::Builder::AddMessage( - LocT loc, const DiagnosticBase& diagnostic_base, - llvm::SmallVector args) -> void { - auto converted = emitter_->ConvertLoc( - loc, - [&](Loc context_loc, const DiagnosticBase<>& context_diagnostic_base) { - AddMessageWithLoc(context_loc, context_diagnostic_base, {}); +auto Emitter::Builder::ConvertLoc( + LocT loc, llvm::SmallVector& location_info) -> Loc { + ConvertedLoc converted = emitter_->ConvertLoc( + loc, [&](Loc step_loc, const LocationInfoBase& step) { + location_info.push_back(LocationInfo{ + .loc = step_loc, .name = step.Name, .format = step.Format}); }); - // Use the last byte offset from the first message. - if (diagnostic_.messages.empty()) { - diagnostic_.last_byte_offset = converted.last_byte_offset; + // The diagnostic sorts by where it was first rooted, which is the context's + // location when a `ContextScope` supplied one. + // + // TODO: A location reached through an import leaves the offset unset, because + // the steps leading to it count as having been added first. That looks + // unintended rather than deliberate, but it decides the order diagnostics are + // printed in, so changing it is its own change with its own testdata. + if (!message_ && contexts_.empty() && labels_.empty() && + location_info.empty()) { + last_byte_offset_ = converted.last_byte_offset; } - AddMessageWithLoc(converted.loc, diagnostic_base, args); + return converted.loc; } template template -auto Emitter::Builder::AddMessageWithLoc( - Loc loc, const DiagnosticBase& diagnostic_base, - llvm::SmallVector args) -> void { - 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.push_back( - Message{.kind = diagnostic_base.Kind, - .level = diagnostic_base.Level, - .loc = loc, - .format = diagnostic_base.Format, - .format_args = std::move(args), - .format_fn = [](const Message& message) -> std::string { - return FormatFn( - message, std::make_index_sequence()); - }}); +auto Emitter::Builder::AttachLabel(LocT loc, + const LabelBase& label, + llvm::SmallVector args) + -> void { + llvm::SmallVector location_info; + Loc loc_value = ConvertLoc(LocT(loc), location_info); + labels_.push_back(Label{.category = label.Category, + .loc = std::move(loc_value), + .location_info = std::move(location_info), + .name = label.Name, + .format = label.Format, + .format_args = std::move(args), + .format_fn = MakeFormatFn()}); +} + +template +template +auto Emitter::Builder::AttachContext(LocT loc, + const ContextBase& context, + llvm::SmallVector args) + -> void { + llvm::SmallVector location_info; + Loc loc_value = ConvertLoc(LocT(loc), location_info); + contexts_.push_back(Context{.loc = std::move(loc_value), + .location_info = std::move(location_info), + .name = context.Name, + .format = context.Format, + .format_args = std::move(args), + .format_fn = MakeFormatFn()}); +} + +template +template +auto Emitter::Builder::MakeFormatFn() -> Diagnostics::FormatFn { + return [](llvm::StringLiteral format, + llvm::ArrayRef args) -> std::string { + CARBON_CHECK(args.size() == sizeof...(Args), + "Argument count mismatch on `{0}`: {1} != {2}", format, + args.size(), sizeof...(Args)); + return FormatArgs(format, args, + std::make_index_sequence()); + }; } template template -auto Emitter::Builder::FormatFn(const Message& message, - std::index_sequence /*indices*/) +auto Emitter::Builder::FormatArgs(llvm::StringLiteral format, + llvm::ArrayRef args, + std::index_sequence /*indices*/) -> std::string { - static_assert(sizeof...(Args) == sizeof...(N), "Invalid template args"); - CARBON_CHECK(message.format_args.size() == sizeof...(Args), - "Argument count mismatch on {0}: {1} != {2}", message.kind, - message.format_args.size(), sizeof...(Args)); return llvm::formatv( // `format` is a StringLiteral which is always NUL terminated, so data() // is okay here. Too bad there's no c_str() method available. // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage) - message.format.data(), + format.data(), llvm::any_cast< typename Internal::DiagnosticTypeForArg::StorageType>( - message.format_args[N])...); + args[N])...); } template @@ -507,18 +566,14 @@ auto Emitter::Emit(LocT loc, template template -auto Emitter::ContextBuilder::Context( - LocT loc, const DiagnosticBase& diagnostic_base, +auto Emitter::ContextBuilder::Attach( + LocT loc, const ContextBase& context, 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) { + if (context.IsSoft && !builder_->contexts_.empty()) { return *this; } - builder_->AddMessage(LocT(loc), diagnostic_base, - {emitter_->template MakeAny(args)...}); + builder_->AttachContext(LocT(loc), context, + {emitter_->template MakeAny(args)...}); return *this; } diff --git a/toolchain/diagnostics/emitter_test.cpp b/toolchain/diagnostics/emitter_test.cpp index 40999754b7b0..1a7625c13cec 100644 --- a/toolchain/diagnostics/emitter_test.cpp +++ b/toolchain/diagnostics/emitter_test.cpp @@ -7,6 +7,8 @@ #include #include +#include + #include "llvm/ADT/StringRef.h" #include "toolchain/diagnostics/mocks.h" @@ -14,6 +16,7 @@ namespace Carbon::Testing { namespace { using testing::ElementsAre; +using testing::IsEmpty; class FakeEmitter : public Diagnostics::Emitter { public: @@ -64,161 +67,185 @@ TEST_F(EmitterTest, EmitOneArgDiagnostic) { emitter_.Emit(1, TestDiagnostic, "str"); } -TEST_F(EmitterTest, EmitNote) { - CARBON_DIAGNOSTIC(TestDiagnostic, Warning, "simple warning"); - CARBON_DIAGNOSTIC(TestDiagnosticNote, Note, "note"); +TEST_F(EmitterTest, AttachLabel) { + // The label has arguments and a format of its own, both validated. + CARBON_DIAGNOSTIC(TestDiagnostic, Error, "expected {0}, found {1}", + std::string, std::string); + CARBON_DIAGNOSTIC_LABEL(TestLabel, Primary, "this is {0}", std::string); EXPECT_CALL( consumer_, HandleDiagnostic(IsDiagnostic( - Diagnostics::Level::Warning, + Diagnostics::Level::Error, + IsDiagnosticMessage(Diagnostics::Kind::TestDiagnostic, + Diagnostics::Level::Error, 1, 1, + "expected i32, found String"), + IsEmpty(), + ElementsAre(IsDiagnosticLabel(Diagnostics::LabelCategory::Primary, 1, + 2, "this is String"))))); + emitter_.Build(1, TestDiagnostic, "i32", "String") + .Attach(2, TestLabel, "String") + .Emit(); +} + +TEST_F(EmitterTest, AttachRangeWithNoText) { + // A label with nothing to say marks its range and no more, which is how a + // diagnostic points at the code its message is about. + CARBON_DIAGNOSTIC(TestDiagnostic, Error, "simple error"); + EXPECT_CALL( + consumer_, + HandleDiagnostic(IsDiagnostic( + Diagnostics::Level::Error, + IsDiagnosticMessage(Diagnostics::Kind::TestDiagnostic, + Diagnostics::Level::Error, 1, 1, "simple error"), + IsEmpty(), + ElementsAre(IsDiagnosticLabel(Diagnostics::LabelCategory::Primary, 1, + 2, ""))))); + emitter_.Build(1, TestDiagnostic).Attach(2).Emit(); +} + +TEST_F(EmitterTest, AttachRangeWithNoTextAsInfo) { + // A range that only explains the problem can say nothing about itself too, + // which is what the category on the wordless `Attach` is for: there is no + // phrase to declare, so there is nowhere else to say what the range is. + CARBON_DIAGNOSTIC(TestDiagnostic, Error, "simple error"); + EXPECT_CALL( + consumer_, + HandleDiagnostic(IsDiagnostic( + Diagnostics::Level::Error, + IsDiagnosticMessage(Diagnostics::Kind::TestDiagnostic, + Diagnostics::Level::Error, 1, 1, "simple error"), + IsEmpty(), ElementsAre( - IsDiagnosticMessage(Diagnostics::Kind::TestDiagnostic, - Diagnostics::Level::Warning, 1, 1, - "simple warning"), - IsDiagnosticMessage(Diagnostics::Kind::TestDiagnosticNote, - Diagnostics::Level::Note, 1, 2, "note"))))); - emitter_.Build(1, TestDiagnostic).Note(2, TestDiagnosticNote).Emit(); + IsDiagnosticLabel(Diagnostics::LabelCategory::Info, 1, 2, ""))))); + emitter_.Build(1, TestDiagnostic) + .Attach(2, Diagnostics::LabelCategory::Info) + .Emit(); +} + +TEST_F(EmitterTest, AttachInfo) { + CARBON_DIAGNOSTIC(TestDiagnostic, Warning, "simple warning"); + CARBON_DIAGNOSTIC_LABEL(TestInfo, Info, "note"); + EXPECT_CALL(consumer_, + HandleDiagnostic(IsDiagnostic( + Diagnostics::Level::Warning, + IsDiagnosticMessage(Diagnostics::Kind::TestDiagnostic, + Diagnostics::Level::Warning, 1, 1, + "simple warning"), + IsEmpty(), + ElementsAre(IsDiagnosticLabel( + Diagnostics::LabelCategory::Info, 1, 2, "note"))))); + emitter_.Build(1, TestDiagnostic).Attach(2, TestInfo).Emit(); } TEST_F(EmitterTest, EmitContext) { - CARBON_DIAGNOSTIC(TestDiagnosticContext, Context, "context"); + CARBON_DIAGNOSTIC_CONTEXT(TestContext, "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); - }); + IsDiagnosticMessage(Diagnostics::Kind::TestDiagnostic, + Diagnostics::Level::Warning, 1, 1, + "simple warning"), + ElementsAre(IsDiagnosticContext(1, 2, "context")), IsEmpty()))); + Diagnostics::ContextScope scope( + &emitter_, [&](auto& builder) { builder.Attach(2, TestContext); }); emitter_.Emit(1, TestDiagnostic); } TEST_F(EmitterTest, EmitSoftContext) { - CARBON_DIAGNOSTIC(TestDiagnosticSoftContext, SoftContext, "soft context"); + CARBON_DIAGNOSTIC_SOFT_CONTEXT(TestSoftContext, "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); - }); + IsDiagnosticMessage(Diagnostics::Kind::TestDiagnostic, + Diagnostics::Level::Warning, 1, 1, + "simple warning"), + ElementsAre(IsDiagnosticContext(1, 2, "soft context")), IsEmpty()))); + Diagnostics::ContextScope soft_scope( + &emitter_, [&](auto& builder) { builder.Attach(2, TestSoftContext); }); emitter_.Emit(1, TestDiagnostic); } TEST_F(EmitterTest, EmitSoftContextAndContext) { - CARBON_DIAGNOSTIC(TestDiagnosticSoftContext, SoftContext, "soft context"); - CARBON_DIAGNOSTIC(TestDiagnosticContext, Context, "context"); + CARBON_DIAGNOSTIC_SOFT_CONTEXT(TestSoftContext, "soft context"); + CARBON_DIAGNOSTIC_CONTEXT(TestContext, "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); - }); + EXPECT_CALL(consumer_, + HandleDiagnostic(IsDiagnostic( + Diagnostics::Level::Warning, + IsDiagnosticMessage(Diagnostics::Kind::TestDiagnostic, + Diagnostics::Level::Warning, 1, 1, + "simple warning"), + ElementsAre(IsDiagnosticContext(1, 3, "soft context"), + IsDiagnosticContext(1, 2, "context")), + IsEmpty()))); + Diagnostics::ContextScope soft_scope( + &emitter_, [&](auto& builder) { builder.Attach(3, TestSoftContext); }); + Diagnostics::ContextScope scope( + &emitter_, [&](auto& builder) { builder.Attach(2, TestContext); }); emitter_.Emit(1, TestDiagnostic); } TEST_F(EmitterTest, EmitContextAndSoftContext) { - CARBON_DIAGNOSTIC(TestDiagnosticContext, Context, "context"); - CARBON_DIAGNOSTIC(TestDiagnosticSoftContext, SoftContext, "soft context"); + CARBON_DIAGNOSTIC_CONTEXT(TestContext, "context"); + CARBON_DIAGNOSTIC_SOFT_CONTEXT(TestSoftContext, "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); - }); + IsDiagnosticMessage(Diagnostics::Kind::TestDiagnostic, + Diagnostics::Level::Warning, 1, 1, + "simple warning"), + ElementsAre(IsDiagnosticContext(1, 3, "context")), IsEmpty()))); + Diagnostics::ContextScope scope( + &emitter_, [&](auto& builder) { builder.Attach(3, TestContext); }); + // This soft context is dropped, since the earlier context supersedes it. + Diagnostics::ContextScope soft_scope( + &emitter_, [&](auto& builder) { builder.Attach(2, TestSoftContext); }); emitter_.Emit(1, TestDiagnostic); } TEST_F(EmitterTest, EmitTwoContext) { - CARBON_DIAGNOSTIC(TestDiagnosticContext, Context, "context"); - CARBON_DIAGNOSTIC(TestDiagnosticContext2, Context, "context 2"); + CARBON_DIAGNOSTIC_CONTEXT(TestContext, "context"); + CARBON_DIAGNOSTIC_CONTEXT(TestContext2, "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); - }); + EXPECT_CALL(consumer_, + HandleDiagnostic(IsDiagnostic( + Diagnostics::Level::Warning, + IsDiagnosticMessage(Diagnostics::Kind::TestDiagnostic, + Diagnostics::Level::Warning, 1, 1, + "simple warning"), + ElementsAre(IsDiagnosticContext(1, 3, "context"), + IsDiagnosticContext(1, 2, "context 2")), + IsEmpty()))); + Diagnostics::ContextScope scope( + &emitter_, [&](auto& builder) { builder.Attach(3, TestContext); }); + Diagnostics::ContextScope scope2( + &emitter_, [&](auto& builder) { builder.Attach(2, TestContext2); }); emitter_.Emit(1, TestDiagnostic); } TEST_F(EmitterTest, EmitTwoSoftContext) { - CARBON_DIAGNOSTIC(TestDiagnosticSoftContext, SoftContext, "soft context"); - CARBON_DIAGNOSTIC(TestDiagnosticSoftContext2, SoftContext, "soft context 2"); + CARBON_DIAGNOSTIC_SOFT_CONTEXT(TestSoftContext, "soft context"); + CARBON_DIAGNOSTIC_SOFT_CONTEXT(TestSoftContext2, "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); - }); + IsDiagnosticMessage(Diagnostics::Kind::TestDiagnostic, + Diagnostics::Level::Warning, 1, 1, + "simple warning"), + ElementsAre(IsDiagnosticContext(1, 3, "soft context")), IsEmpty()))); + Diagnostics::ContextScope scope( + &emitter_, [&](auto& builder) { builder.Attach(3, TestSoftContext); }); + // This soft context is dropped, since the earlier one supersedes it. + Diagnostics::ContextScope soft_scope( + &emitter_, [&](auto& builder) { builder.Attach(2, TestSoftContext2); }); emitter_.Emit(1, TestDiagnostic); } diff --git a/toolchain/diagnostics/fuzzer_corpus/009e1ee035590f325c99f30a0c555dc314047c9f b/toolchain/diagnostics/fuzzer_corpus/009e1ee035590f325c99f30a0c555dc314047c9f new file mode 100644 index 000000000000..e76b5368b178 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/009e1ee035590f325c99f30a0c555dc314047c9f differ diff --git a/toolchain/diagnostics/fuzzer_corpus/0143bd02d7070776bef7c43206dabc1fab262981 b/toolchain/diagnostics/fuzzer_corpus/0143bd02d7070776bef7c43206dabc1fab262981 new file mode 100644 index 000000000000..667c931160ec Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/0143bd02d7070776bef7c43206dabc1fab262981 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/01b2b66ab09d23d5e46d03163700e3876296b0f9 b/toolchain/diagnostics/fuzzer_corpus/01b2b66ab09d23d5e46d03163700e3876296b0f9 new file mode 100644 index 000000000000..dfc00dded37f Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/01b2b66ab09d23d5e46d03163700e3876296b0f9 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/02630eb83dd60ce52b4f8b14c25df776e32a9e9f b/toolchain/diagnostics/fuzzer_corpus/02630eb83dd60ce52b4f8b14c25df776e32a9e9f new file mode 100644 index 000000000000..8054d07b6cac Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/02630eb83dd60ce52b4f8b14c25df776e32a9e9f differ diff --git a/toolchain/diagnostics/fuzzer_corpus/026f715681afef7e3b87ac390fbf550a815a0081 b/toolchain/diagnostics/fuzzer_corpus/026f715681afef7e3b87ac390fbf550a815a0081 new file mode 100644 index 000000000000..a7520203c1e5 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/026f715681afef7e3b87ac390fbf550a815a0081 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/03ff7484b329d1247c18ccd972a8533b323955c6 b/toolchain/diagnostics/fuzzer_corpus/03ff7484b329d1247c18ccd972a8533b323955c6 new file mode 100644 index 000000000000..e2ec7adf1f9e Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/03ff7484b329d1247c18ccd972a8533b323955c6 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/04a5f96cf505ad4e88f364752a735783a5b75461 b/toolchain/diagnostics/fuzzer_corpus/04a5f96cf505ad4e88f364752a735783a5b75461 new file mode 100644 index 000000000000..3b26f7aa9517 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/04a5f96cf505ad4e88f364752a735783a5b75461 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/058c64a6279cbf1da094aa7d1db3ead59d500d61 b/toolchain/diagnostics/fuzzer_corpus/058c64a6279cbf1da094aa7d1db3ead59d500d61 new file mode 100644 index 000000000000..bd58dd0dd46f Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/058c64a6279cbf1da094aa7d1db3ead59d500d61 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/061e0e6609a92111562e39ed740684c895fc55eb b/toolchain/diagnostics/fuzzer_corpus/061e0e6609a92111562e39ed740684c895fc55eb new file mode 100644 index 000000000000..dca10bfc4435 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/061e0e6609a92111562e39ed740684c895fc55eb differ diff --git a/toolchain/diagnostics/fuzzer_corpus/064ebcd52b3013d4f4e015b215654f1c5f25e152 b/toolchain/diagnostics/fuzzer_corpus/064ebcd52b3013d4f4e015b215654f1c5f25e152 new file mode 100644 index 000000000000..aeb35c56ff68 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/064ebcd52b3013d4f4e015b215654f1c5f25e152 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/06e7c259a04a6d0575c7fb26bb5e64c2ab794d2f b/toolchain/diagnostics/fuzzer_corpus/06e7c259a04a6d0575c7fb26bb5e64c2ab794d2f new file mode 100644 index 000000000000..1193ed2e159f Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/06e7c259a04a6d0575c7fb26bb5e64c2ab794d2f differ diff --git a/toolchain/diagnostics/fuzzer_corpus/07bc300a6eafd0a24f83b7ca9e3445791d4ae999 b/toolchain/diagnostics/fuzzer_corpus/07bc300a6eafd0a24f83b7ca9e3445791d4ae999 new file mode 100644 index 000000000000..717b56363124 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/07bc300a6eafd0a24f83b7ca9e3445791d4ae999 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/07c16dc38b5447f07cf9f59447d9484b6fa792fd b/toolchain/diagnostics/fuzzer_corpus/07c16dc38b5447f07cf9f59447d9484b6fa792fd new file mode 100644 index 000000000000..acd0e52ed65c Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/07c16dc38b5447f07cf9f59447d9484b6fa792fd differ diff --git a/toolchain/diagnostics/fuzzer_corpus/0948229dbc2d152bc92a07e773c861c0cec6148a b/toolchain/diagnostics/fuzzer_corpus/0948229dbc2d152bc92a07e773c861c0cec6148a new file mode 100644 index 000000000000..2603a5ae693a Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/0948229dbc2d152bc92a07e773c861c0cec6148a differ diff --git a/toolchain/diagnostics/fuzzer_corpus/0c019b0899c07b7d58e3ce7cc52fb03fd184f115 b/toolchain/diagnostics/fuzzer_corpus/0c019b0899c07b7d58e3ce7cc52fb03fd184f115 new file mode 100644 index 000000000000..ce82f7c87d33 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/0c019b0899c07b7d58e3ce7cc52fb03fd184f115 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/0d029aab69be7d18390d0ff1950615d51aafb4c8 b/toolchain/diagnostics/fuzzer_corpus/0d029aab69be7d18390d0ff1950615d51aafb4c8 new file mode 100644 index 000000000000..b3514b883a11 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/0d029aab69be7d18390d0ff1950615d51aafb4c8 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/11a56a0997a6e0149c0df3ba0d337d3b165707d7 b/toolchain/diagnostics/fuzzer_corpus/11a56a0997a6e0149c0df3ba0d337d3b165707d7 new file mode 100644 index 000000000000..3ec157bdf9c5 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/11a56a0997a6e0149c0df3ba0d337d3b165707d7 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/1259a0f2dd20787eef64b893a36704998dde2fea b/toolchain/diagnostics/fuzzer_corpus/1259a0f2dd20787eef64b893a36704998dde2fea new file mode 100644 index 000000000000..2656bc043402 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/1259a0f2dd20787eef64b893a36704998dde2fea differ diff --git a/toolchain/diagnostics/fuzzer_corpus/12952d26616a047f1857a8f3cc092f3bbcb48727 b/toolchain/diagnostics/fuzzer_corpus/12952d26616a047f1857a8f3cc092f3bbcb48727 new file mode 100644 index 000000000000..f8cd0d9f2cce Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/12952d26616a047f1857a8f3cc092f3bbcb48727 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/130f97367100cbe9c89479bc4fe00857c8cc99bd b/toolchain/diagnostics/fuzzer_corpus/130f97367100cbe9c89479bc4fe00857c8cc99bd new file mode 100644 index 000000000000..dd81323c1541 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/130f97367100cbe9c89479bc4fe00857c8cc99bd differ diff --git a/toolchain/diagnostics/fuzzer_corpus/1397f90edcb78f1ba4f17d6b87da3b6ae20cc751 b/toolchain/diagnostics/fuzzer_corpus/1397f90edcb78f1ba4f17d6b87da3b6ae20cc751 new file mode 100644 index 000000000000..e14a785d8c3f Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/1397f90edcb78f1ba4f17d6b87da3b6ae20cc751 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/13b4782fb186ab2aa90d1b7a9b4d5eaa17219d0f b/toolchain/diagnostics/fuzzer_corpus/13b4782fb186ab2aa90d1b7a9b4d5eaa17219d0f new file mode 100644 index 000000000000..c00514102e45 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/13b4782fb186ab2aa90d1b7a9b4d5eaa17219d0f differ diff --git a/toolchain/diagnostics/fuzzer_corpus/18820aa6e30836b5289785839d65f14d702b2a81 b/toolchain/diagnostics/fuzzer_corpus/18820aa6e30836b5289785839d65f14d702b2a81 new file mode 100644 index 000000000000..1ada86515b9c Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/18820aa6e30836b5289785839d65f14d702b2a81 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/196fd15915183a952b9c2eb7d67ca5404ed0b1e8 b/toolchain/diagnostics/fuzzer_corpus/196fd15915183a952b9c2eb7d67ca5404ed0b1e8 new file mode 100644 index 000000000000..e7cdd6e62746 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/196fd15915183a952b9c2eb7d67ca5404ed0b1e8 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/1c18b0bde9cebe8fee13bc1c8b95af2654b61951 b/toolchain/diagnostics/fuzzer_corpus/1c18b0bde9cebe8fee13bc1c8b95af2654b61951 new file mode 100644 index 000000000000..dba7983c4924 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/1c18b0bde9cebe8fee13bc1c8b95af2654b61951 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/1dc7fa47b99b360406789dbfecd58632a97ce8c2 b/toolchain/diagnostics/fuzzer_corpus/1dc7fa47b99b360406789dbfecd58632a97ce8c2 new file mode 100644 index 000000000000..bdd54c53d8d6 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/1dc7fa47b99b360406789dbfecd58632a97ce8c2 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/1f4ec4805d1b00990d151bcd2dd7dcb7eac58379 b/toolchain/diagnostics/fuzzer_corpus/1f4ec4805d1b00990d151bcd2dd7dcb7eac58379 new file mode 100644 index 000000000000..286c1cad300d Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/1f4ec4805d1b00990d151bcd2dd7dcb7eac58379 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/1f9ce876d3f3f36d594e3c95d39cf50e3bb0499d b/toolchain/diagnostics/fuzzer_corpus/1f9ce876d3f3f36d594e3c95d39cf50e3bb0499d new file mode 100644 index 000000000000..1d74867ec795 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/1f9ce876d3f3f36d594e3c95d39cf50e3bb0499d differ diff --git a/toolchain/diagnostics/fuzzer_corpus/202102bebc715c5a2e955bdeeadfd8076c072e95 b/toolchain/diagnostics/fuzzer_corpus/202102bebc715c5a2e955bdeeadfd8076c072e95 new file mode 100644 index 000000000000..110dd6abbb21 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/202102bebc715c5a2e955bdeeadfd8076c072e95 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/232fe617d26b40ddef338a750b9796c240ebf1a5 b/toolchain/diagnostics/fuzzer_corpus/232fe617d26b40ddef338a750b9796c240ebf1a5 new file mode 100644 index 000000000000..510355d8b807 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/232fe617d26b40ddef338a750b9796c240ebf1a5 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/2393205731d1095d58f13e900f3290fbeec11c45 b/toolchain/diagnostics/fuzzer_corpus/2393205731d1095d58f13e900f3290fbeec11c45 new file mode 100644 index 000000000000..f70842f8d299 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/2393205731d1095d58f13e900f3290fbeec11c45 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/23c67ce612f3dba587eb966064659a3f4b901c63 b/toolchain/diagnostics/fuzzer_corpus/23c67ce612f3dba587eb966064659a3f4b901c63 new file mode 100644 index 000000000000..4b1a51540279 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/23c67ce612f3dba587eb966064659a3f4b901c63 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/24648a08fc18d5714a00c046021ed913a81e1585 b/toolchain/diagnostics/fuzzer_corpus/24648a08fc18d5714a00c046021ed913a81e1585 new file mode 100644 index 000000000000..1999e3acf106 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/24648a08fc18d5714a00c046021ed913a81e1585 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/285e366dd2859e6a0a16b23ab2ec4efb4154ed37 b/toolchain/diagnostics/fuzzer_corpus/285e366dd2859e6a0a16b23ab2ec4efb4154ed37 new file mode 100644 index 000000000000..4a7f7230f518 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/285e366dd2859e6a0a16b23ab2ec4efb4154ed37 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/297520aa70fb4f6939c1ac40eb8d9294210057d6 b/toolchain/diagnostics/fuzzer_corpus/297520aa70fb4f6939c1ac40eb8d9294210057d6 new file mode 100644 index 000000000000..89af2eb424d9 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/297520aa70fb4f6939c1ac40eb8d9294210057d6 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/2a66a9b6799d3ed7322db76f8776b2db6aa371d0 b/toolchain/diagnostics/fuzzer_corpus/2a66a9b6799d3ed7322db76f8776b2db6aa371d0 new file mode 100644 index 000000000000..0fa1353a2488 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/2a66a9b6799d3ed7322db76f8776b2db6aa371d0 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/2b8b40d6537dcf0a6ee341ae8980e7d45610072d b/toolchain/diagnostics/fuzzer_corpus/2b8b40d6537dcf0a6ee341ae8980e7d45610072d new file mode 100644 index 000000000000..3127e85cd4de Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/2b8b40d6537dcf0a6ee341ae8980e7d45610072d differ diff --git a/toolchain/diagnostics/fuzzer_corpus/2be8c973a6ebdff094e58977f2bce939e775bdff b/toolchain/diagnostics/fuzzer_corpus/2be8c973a6ebdff094e58977f2bce939e775bdff new file mode 100644 index 000000000000..7d5df8350dc5 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/2be8c973a6ebdff094e58977f2bce939e775bdff differ diff --git a/toolchain/diagnostics/fuzzer_corpus/318fe0c3ba1a0f623c6d21253b54ff3b31a7d6f5 b/toolchain/diagnostics/fuzzer_corpus/318fe0c3ba1a0f623c6d21253b54ff3b31a7d6f5 new file mode 100644 index 000000000000..7413b8ad9e3b Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/318fe0c3ba1a0f623c6d21253b54ff3b31a7d6f5 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/32486ae67cbce9bc808be660cb63a5fc7a2b29be b/toolchain/diagnostics/fuzzer_corpus/32486ae67cbce9bc808be660cb63a5fc7a2b29be new file mode 100644 index 000000000000..ddd2528fb138 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/32486ae67cbce9bc808be660cb63a5fc7a2b29be differ diff --git a/toolchain/diagnostics/fuzzer_corpus/3279054370357f7ddb6bfb5a3ebee0681e4b374f b/toolchain/diagnostics/fuzzer_corpus/3279054370357f7ddb6bfb5a3ebee0681e4b374f new file mode 100644 index 000000000000..4b1c2b34d573 --- /dev/null +++ b/toolchain/diagnostics/fuzzer_corpus/3279054370357f7ddb6bfb5a3ebee0681e4b374f @@ -0,0 +1 @@ +A›› \ No newline at end of file diff --git a/toolchain/diagnostics/fuzzer_corpus/338444eec10c6afe5b66fa289705b6354f74a48b b/toolchain/diagnostics/fuzzer_corpus/338444eec10c6afe5b66fa289705b6354f74a48b new file mode 100644 index 000000000000..f45a8cdab479 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/338444eec10c6afe5b66fa289705b6354f74a48b differ diff --git a/toolchain/diagnostics/fuzzer_corpus/33b7fe2e0e833bc4098ae1c300ed502ca214e55a b/toolchain/diagnostics/fuzzer_corpus/33b7fe2e0e833bc4098ae1c300ed502ca214e55a new file mode 100644 index 000000000000..9c7157651fd6 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/33b7fe2e0e833bc4098ae1c300ed502ca214e55a differ diff --git a/toolchain/diagnostics/fuzzer_corpus/354875baeb3ac64d675dada8bdfbc24c16d7e861 b/toolchain/diagnostics/fuzzer_corpus/354875baeb3ac64d675dada8bdfbc24c16d7e861 new file mode 100644 index 000000000000..fe763def85c9 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/354875baeb3ac64d675dada8bdfbc24c16d7e861 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/3726f66a17f7d66e92632697ec7c48a66b72862f b/toolchain/diagnostics/fuzzer_corpus/3726f66a17f7d66e92632697ec7c48a66b72862f new file mode 100644 index 000000000000..95daaac3a14f Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/3726f66a17f7d66e92632697ec7c48a66b72862f differ diff --git a/toolchain/diagnostics/fuzzer_corpus/37422c99cda962055421d413ac4fb20664d68f14 b/toolchain/diagnostics/fuzzer_corpus/37422c99cda962055421d413ac4fb20664d68f14 new file mode 100644 index 000000000000..93d8b68abbc0 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/37422c99cda962055421d413ac4fb20664d68f14 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/378478b4a6438ae18482ddc76428b1b8df673f83 b/toolchain/diagnostics/fuzzer_corpus/378478b4a6438ae18482ddc76428b1b8df673f83 new file mode 100644 index 000000000000..4cb7bd9e4707 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/378478b4a6438ae18482ddc76428b1b8df673f83 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/383fcf4f5470140dba2bd0dba1540faf1b16fa4e b/toolchain/diagnostics/fuzzer_corpus/383fcf4f5470140dba2bd0dba1540faf1b16fa4e new file mode 100644 index 000000000000..e9f838362b2b Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/383fcf4f5470140dba2bd0dba1540faf1b16fa4e differ diff --git a/toolchain/diagnostics/fuzzer_corpus/39a29b6b4a6318a1153abc9d7c3a5ab8c3f111c7 b/toolchain/diagnostics/fuzzer_corpus/39a29b6b4a6318a1153abc9d7c3a5ab8c3f111c7 new file mode 100644 index 000000000000..ef634327ec99 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/39a29b6b4a6318a1153abc9d7c3a5ab8c3f111c7 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/3a5f50947ff89de2fa526102a334767022d83c27 b/toolchain/diagnostics/fuzzer_corpus/3a5f50947ff89de2fa526102a334767022d83c27 new file mode 100644 index 000000000000..e24670dd8265 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/3a5f50947ff89de2fa526102a334767022d83c27 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/3ab5d37edd863a1ca793ac3aef5af7bb105b755a b/toolchain/diagnostics/fuzzer_corpus/3ab5d37edd863a1ca793ac3aef5af7bb105b755a new file mode 100644 index 000000000000..9c5ba79f3d62 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/3ab5d37edd863a1ca793ac3aef5af7bb105b755a differ diff --git a/toolchain/diagnostics/fuzzer_corpus/3afbcfbd1d897cce8b5d3568fc25984fed100691 b/toolchain/diagnostics/fuzzer_corpus/3afbcfbd1d897cce8b5d3568fc25984fed100691 new file mode 100644 index 000000000000..f1c4c2a8dcea Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/3afbcfbd1d897cce8b5d3568fc25984fed100691 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/3b3ebd0ec652d8aa93fac420b073344b90a84a1c b/toolchain/diagnostics/fuzzer_corpus/3b3ebd0ec652d8aa93fac420b073344b90a84a1c new file mode 100644 index 000000000000..8aa59d6203ed Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/3b3ebd0ec652d8aa93fac420b073344b90a84a1c differ diff --git a/toolchain/diagnostics/fuzzer_corpus/3ca47f9fe7984422e4458c497254da373463fb55 b/toolchain/diagnostics/fuzzer_corpus/3ca47f9fe7984422e4458c497254da373463fb55 new file mode 100644 index 000000000000..6d435732fa8d Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/3ca47f9fe7984422e4458c497254da373463fb55 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/3d48ca9158e94a774688631a1df83d854350b42e b/toolchain/diagnostics/fuzzer_corpus/3d48ca9158e94a774688631a1df83d854350b42e new file mode 100644 index 000000000000..01efaed15870 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/3d48ca9158e94a774688631a1df83d854350b42e differ diff --git a/toolchain/diagnostics/fuzzer_corpus/3dbca6f6836a98b4958092d1c735c4158ec16f35 b/toolchain/diagnostics/fuzzer_corpus/3dbca6f6836a98b4958092d1c735c4158ec16f35 new file mode 100644 index 000000000000..fd60b0507ce5 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/3dbca6f6836a98b4958092d1c735c4158ec16f35 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/40d4b64ea4d75745a94fbe4665767d10ece57949 b/toolchain/diagnostics/fuzzer_corpus/40d4b64ea4d75745a94fbe4665767d10ece57949 new file mode 100644 index 000000000000..d4fe32efb83a Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/40d4b64ea4d75745a94fbe4665767d10ece57949 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/42dfebc2e3907eb1759414d1ad3b5e70dcf0e7bc b/toolchain/diagnostics/fuzzer_corpus/42dfebc2e3907eb1759414d1ad3b5e70dcf0e7bc new file mode 100644 index 000000000000..4aa53f02c9a7 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/42dfebc2e3907eb1759414d1ad3b5e70dcf0e7bc differ diff --git a/toolchain/diagnostics/fuzzer_corpus/42faaee94a2047743f917b02b7d7428ba8706127 b/toolchain/diagnostics/fuzzer_corpus/42faaee94a2047743f917b02b7d7428ba8706127 new file mode 100644 index 000000000000..e5917103eaf4 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/42faaee94a2047743f917b02b7d7428ba8706127 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/4443fb1502fa989257c0cf79a668a70d5dddbad3 b/toolchain/diagnostics/fuzzer_corpus/4443fb1502fa989257c0cf79a668a70d5dddbad3 new file mode 100644 index 000000000000..eb262a55c3eb Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/4443fb1502fa989257c0cf79a668a70d5dddbad3 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/4454664a38e4d245907d65cdbf3f5e71002413d6 b/toolchain/diagnostics/fuzzer_corpus/4454664a38e4d245907d65cdbf3f5e71002413d6 new file mode 100644 index 000000000000..9c29af3bc20d Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/4454664a38e4d245907d65cdbf3f5e71002413d6 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/454a25b123ceecea063f793f86dd567f56e279d2 b/toolchain/diagnostics/fuzzer_corpus/454a25b123ceecea063f793f86dd567f56e279d2 new file mode 100644 index 000000000000..1795b958b1d3 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/454a25b123ceecea063f793f86dd567f56e279d2 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/461e400e32c37661ce8f839fb79bb7b7bb5ab27a b/toolchain/diagnostics/fuzzer_corpus/461e400e32c37661ce8f839fb79bb7b7bb5ab27a new file mode 100644 index 000000000000..7975e75a64a9 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/461e400e32c37661ce8f839fb79bb7b7bb5ab27a differ diff --git a/toolchain/diagnostics/fuzzer_corpus/470022704136e22e204e5665533b5140b6fe261c b/toolchain/diagnostics/fuzzer_corpus/470022704136e22e204e5665533b5140b6fe261c new file mode 100644 index 000000000000..8ac6731aa05b Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/470022704136e22e204e5665533b5140b6fe261c differ diff --git a/toolchain/diagnostics/fuzzer_corpus/4735aec86ebf14bb3700871899beb0f49e37c0ea b/toolchain/diagnostics/fuzzer_corpus/4735aec86ebf14bb3700871899beb0f49e37c0ea new file mode 100644 index 000000000000..e406ab33d840 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/4735aec86ebf14bb3700871899beb0f49e37c0ea differ diff --git a/toolchain/diagnostics/fuzzer_corpus/475b65597d952d9feb39c75b3ff7b2bbd823a9ad b/toolchain/diagnostics/fuzzer_corpus/475b65597d952d9feb39c75b3ff7b2bbd823a9ad new file mode 100644 index 000000000000..3e21c3172157 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/475b65597d952d9feb39c75b3ff7b2bbd823a9ad differ diff --git a/toolchain/diagnostics/fuzzer_corpus/49fef3b103df07c5d481dd67a49a755c7ab1a58c b/toolchain/diagnostics/fuzzer_corpus/49fef3b103df07c5d481dd67a49a755c7ab1a58c new file mode 100644 index 000000000000..051f9fbd494f Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/49fef3b103df07c5d481dd67a49a755c7ab1a58c differ diff --git a/toolchain/diagnostics/fuzzer_corpus/4ac4d291a32a4202101fd207a06cfd9ab139d1d3 b/toolchain/diagnostics/fuzzer_corpus/4ac4d291a32a4202101fd207a06cfd9ab139d1d3 new file mode 100644 index 000000000000..d0404e63a1f7 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/4ac4d291a32a4202101fd207a06cfd9ab139d1d3 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/4c1f37a8a30d79b4f7b0370d2447b51388902c35 b/toolchain/diagnostics/fuzzer_corpus/4c1f37a8a30d79b4f7b0370d2447b51388902c35 new file mode 100644 index 000000000000..4813156e5826 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/4c1f37a8a30d79b4f7b0370d2447b51388902c35 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/4c4ab5dab4f4332a3961527ce78a3f453dadf8b3 b/toolchain/diagnostics/fuzzer_corpus/4c4ab5dab4f4332a3961527ce78a3f453dadf8b3 new file mode 100644 index 000000000000..1f9257cb23d1 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/4c4ab5dab4f4332a3961527ce78a3f453dadf8b3 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/4c4c7899efb3f578b748f443a5ea6587591ca626 b/toolchain/diagnostics/fuzzer_corpus/4c4c7899efb3f578b748f443a5ea6587591ca626 new file mode 100644 index 000000000000..091888b28616 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/4c4c7899efb3f578b748f443a5ea6587591ca626 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/4d10f7981806b6d0ccfbdd600867eef451201961 b/toolchain/diagnostics/fuzzer_corpus/4d10f7981806b6d0ccfbdd600867eef451201961 new file mode 100644 index 000000000000..35d522ff88ef Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/4d10f7981806b6d0ccfbdd600867eef451201961 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/4e49bd7c20662de6d0554500fb0085d1d42aec6a b/toolchain/diagnostics/fuzzer_corpus/4e49bd7c20662de6d0554500fb0085d1d42aec6a new file mode 100644 index 000000000000..921563cfec2c Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/4e49bd7c20662de6d0554500fb0085d1d42aec6a differ diff --git a/toolchain/diagnostics/fuzzer_corpus/4e61924ff678839fda79b1c6fffc27af4894f92c b/toolchain/diagnostics/fuzzer_corpus/4e61924ff678839fda79b1c6fffc27af4894f92c new file mode 100644 index 000000000000..c6d137fee750 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/4e61924ff678839fda79b1c6fffc27af4894f92c differ diff --git a/toolchain/diagnostics/fuzzer_corpus/50033e358a6694c353322a31cec30cc014efeb1f b/toolchain/diagnostics/fuzzer_corpus/50033e358a6694c353322a31cec30cc014efeb1f new file mode 100644 index 000000000000..b0b1f6fca2ad Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/50033e358a6694c353322a31cec30cc014efeb1f differ diff --git a/toolchain/diagnostics/fuzzer_corpus/502e102fc83058b6e10e75c4fa0bd62b7a3f7813 b/toolchain/diagnostics/fuzzer_corpus/502e102fc83058b6e10e75c4fa0bd62b7a3f7813 new file mode 100644 index 000000000000..672d5e56e762 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/502e102fc83058b6e10e75c4fa0bd62b7a3f7813 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/510e866286299f84200a30c9214570b8ebfe1856 b/toolchain/diagnostics/fuzzer_corpus/510e866286299f84200a30c9214570b8ebfe1856 new file mode 100644 index 000000000000..ddf1a1576354 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/510e866286299f84200a30c9214570b8ebfe1856 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/5341b847071338dd690c57b88d9bc60ee3f0c6d9 b/toolchain/diagnostics/fuzzer_corpus/5341b847071338dd690c57b88d9bc60ee3f0c6d9 new file mode 100644 index 000000000000..2f6cca13f4d0 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/5341b847071338dd690c57b88d9bc60ee3f0c6d9 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/53d66db819ae8e75511c299f7708f1a01d6a4683 b/toolchain/diagnostics/fuzzer_corpus/53d66db819ae8e75511c299f7708f1a01d6a4683 new file mode 100644 index 000000000000..3d37ee45e47c Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/53d66db819ae8e75511c299f7708f1a01d6a4683 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/543f557644ff2eec10b776372c2d2194360903a8 b/toolchain/diagnostics/fuzzer_corpus/543f557644ff2eec10b776372c2d2194360903a8 new file mode 100644 index 000000000000..57f806f1cf75 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/543f557644ff2eec10b776372c2d2194360903a8 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/557efff48f18b7a54651bc1d7ca6ab159fbf6444 b/toolchain/diagnostics/fuzzer_corpus/557efff48f18b7a54651bc1d7ca6ab159fbf6444 new file mode 100644 index 000000000000..1c1bb49832a6 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/557efff48f18b7a54651bc1d7ca6ab159fbf6444 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/564bb333f1adbaee3978d5f16278b22e0ed63dd0 b/toolchain/diagnostics/fuzzer_corpus/564bb333f1adbaee3978d5f16278b22e0ed63dd0 new file mode 100644 index 000000000000..eac2f93bbfb9 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/564bb333f1adbaee3978d5f16278b22e0ed63dd0 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/57eea43c50482d9c54f11b7336ea17a73d3ad4fb b/toolchain/diagnostics/fuzzer_corpus/57eea43c50482d9c54f11b7336ea17a73d3ad4fb new file mode 100644 index 000000000000..d74057282ccf Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/57eea43c50482d9c54f11b7336ea17a73d3ad4fb differ diff --git a/toolchain/diagnostics/fuzzer_corpus/5988df6f074c76bced8416ae1121e36cd68ae76c b/toolchain/diagnostics/fuzzer_corpus/5988df6f074c76bced8416ae1121e36cd68ae76c new file mode 100644 index 000000000000..2c0f932274e7 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/5988df6f074c76bced8416ae1121e36cd68ae76c differ diff --git a/toolchain/diagnostics/fuzzer_corpus/5af2960bba0cf333123316f419f6fca159161a68 b/toolchain/diagnostics/fuzzer_corpus/5af2960bba0cf333123316f419f6fca159161a68 new file mode 100644 index 000000000000..fdb407a11f0e Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/5af2960bba0cf333123316f419f6fca159161a68 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/5cd4787cd1c3192ecb4af44af44f11543169e073 b/toolchain/diagnostics/fuzzer_corpus/5cd4787cd1c3192ecb4af44af44f11543169e073 new file mode 100644 index 000000000000..3667c157eabf Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/5cd4787cd1c3192ecb4af44af44f11543169e073 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/5d1dd18b2b3211c0231c5cb648b53a0ca85cce29 b/toolchain/diagnostics/fuzzer_corpus/5d1dd18b2b3211c0231c5cb648b53a0ca85cce29 new file mode 100644 index 000000000000..9424a0cb1579 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/5d1dd18b2b3211c0231c5cb648b53a0ca85cce29 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/5d32111d9cfb1a1aeee589acbeb7bce1938fb2ac b/toolchain/diagnostics/fuzzer_corpus/5d32111d9cfb1a1aeee589acbeb7bce1938fb2ac new file mode 100644 index 000000000000..6f9d08072ea6 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/5d32111d9cfb1a1aeee589acbeb7bce1938fb2ac differ diff --git a/toolchain/diagnostics/fuzzer_corpus/5d73baf9ce420d30381acca72bbe1e9af1eb0d60 b/toolchain/diagnostics/fuzzer_corpus/5d73baf9ce420d30381acca72bbe1e9af1eb0d60 new file mode 100644 index 000000000000..b0bcc8488eba Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/5d73baf9ce420d30381acca72bbe1e9af1eb0d60 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/5d85a044516c9adb456fbdf94673acc47ee35ac4 b/toolchain/diagnostics/fuzzer_corpus/5d85a044516c9adb456fbdf94673acc47ee35ac4 new file mode 100644 index 000000000000..4f825eb1272e Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/5d85a044516c9adb456fbdf94673acc47ee35ac4 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/5db7282d575def98c806a5c83dac779ea0c562ae b/toolchain/diagnostics/fuzzer_corpus/5db7282d575def98c806a5c83dac779ea0c562ae new file mode 100644 index 000000000000..2d538f5402d6 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/5db7282d575def98c806a5c83dac779ea0c562ae differ diff --git a/toolchain/diagnostics/fuzzer_corpus/5df771bb3525f0c406b05f554677669184584667 b/toolchain/diagnostics/fuzzer_corpus/5df771bb3525f0c406b05f554677669184584667 new file mode 100644 index 000000000000..e0219a9a11c9 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/5df771bb3525f0c406b05f554677669184584667 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/5f2d72f0e7850b124157d9ca7b90bb8646150a58 b/toolchain/diagnostics/fuzzer_corpus/5f2d72f0e7850b124157d9ca7b90bb8646150a58 new file mode 100644 index 000000000000..e05ff836adfd Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/5f2d72f0e7850b124157d9ca7b90bb8646150a58 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/5ff5f4c12d3d6936f3ffaf09c124b7a43233bb1a b/toolchain/diagnostics/fuzzer_corpus/5ff5f4c12d3d6936f3ffaf09c124b7a43233bb1a new file mode 100644 index 000000000000..d299e0d4dc3c Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/5ff5f4c12d3d6936f3ffaf09c124b7a43233bb1a differ diff --git a/toolchain/diagnostics/fuzzer_corpus/60d88d693f151a7bb639188b322ff7c571185d3f b/toolchain/diagnostics/fuzzer_corpus/60d88d693f151a7bb639188b322ff7c571185d3f new file mode 100644 index 000000000000..64e9a926e5eb Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/60d88d693f151a7bb639188b322ff7c571185d3f differ diff --git a/toolchain/diagnostics/fuzzer_corpus/616ff662797bc3e9a1c80310c86fb3229582b5c1 b/toolchain/diagnostics/fuzzer_corpus/616ff662797bc3e9a1c80310c86fb3229582b5c1 new file mode 100644 index 000000000000..ed987846e9c9 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/616ff662797bc3e9a1c80310c86fb3229582b5c1 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/618ed73c888f22f6e9a199bf68b85a713722e3cd b/toolchain/diagnostics/fuzzer_corpus/618ed73c888f22f6e9a199bf68b85a713722e3cd new file mode 100644 index 000000000000..b9009104dae2 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/618ed73c888f22f6e9a199bf68b85a713722e3cd differ diff --git a/toolchain/diagnostics/fuzzer_corpus/632e0cf4471e6f9737e8bcd7c42a747615c4f51d b/toolchain/diagnostics/fuzzer_corpus/632e0cf4471e6f9737e8bcd7c42a747615c4f51d new file mode 100644 index 000000000000..26311b428419 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/632e0cf4471e6f9737e8bcd7c42a747615c4f51d differ diff --git a/toolchain/diagnostics/fuzzer_corpus/63f49602b128febe85800fc245f84341b718718f b/toolchain/diagnostics/fuzzer_corpus/63f49602b128febe85800fc245f84341b718718f new file mode 100644 index 000000000000..70e5ca3643c0 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/63f49602b128febe85800fc245f84341b718718f differ diff --git a/toolchain/diagnostics/fuzzer_corpus/677b726f848ab8648957b78ddf4721d868afd5f6 b/toolchain/diagnostics/fuzzer_corpus/677b726f848ab8648957b78ddf4721d868afd5f6 new file mode 100644 index 000000000000..4b5f5a95e41a Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/677b726f848ab8648957b78ddf4721d868afd5f6 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/67fb48b9566caa4c8116e65631d8df3f5d380057 b/toolchain/diagnostics/fuzzer_corpus/67fb48b9566caa4c8116e65631d8df3f5d380057 new file mode 100644 index 000000000000..f146e26d3d14 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/67fb48b9566caa4c8116e65631d8df3f5d380057 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/68806c52d45c07d4f1e7d64417d237916175fa7e b/toolchain/diagnostics/fuzzer_corpus/68806c52d45c07d4f1e7d64417d237916175fa7e new file mode 100644 index 000000000000..b7052f329648 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/68806c52d45c07d4f1e7d64417d237916175fa7e differ diff --git a/toolchain/diagnostics/fuzzer_corpus/6d3546eb008f86a0235a862eb80de1d7fb6bb90b b/toolchain/diagnostics/fuzzer_corpus/6d3546eb008f86a0235a862eb80de1d7fb6bb90b new file mode 100644 index 000000000000..35fa8ecbc2ce Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/6d3546eb008f86a0235a862eb80de1d7fb6bb90b differ diff --git a/toolchain/diagnostics/fuzzer_corpus/6d96a24650f5d4df4a7f4f774b3f03f62c9588f1 b/toolchain/diagnostics/fuzzer_corpus/6d96a24650f5d4df4a7f4f774b3f03f62c9588f1 new file mode 100644 index 000000000000..b03e01062a0e Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/6d96a24650f5d4df4a7f4f774b3f03f62c9588f1 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/6dcd4ce23d88e2ee9568ba546c007c63d9131c1b b/toolchain/diagnostics/fuzzer_corpus/6dcd4ce23d88e2ee9568ba546c007c63d9131c1b new file mode 100644 index 000000000000..8c7e5a667f1b --- /dev/null +++ b/toolchain/diagnostics/fuzzer_corpus/6dcd4ce23d88e2ee9568ba546c007c63d9131c1b @@ -0,0 +1 @@ +A \ No newline at end of file diff --git a/toolchain/diagnostics/fuzzer_corpus/6eacd278c8d3296f9d406a116414f74492ed5503 b/toolchain/diagnostics/fuzzer_corpus/6eacd278c8d3296f9d406a116414f74492ed5503 new file mode 100644 index 000000000000..b627566c335d Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/6eacd278c8d3296f9d406a116414f74492ed5503 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/707f2dae60478240d29c46d9d8929212c3bef74f b/toolchain/diagnostics/fuzzer_corpus/707f2dae60478240d29c46d9d8929212c3bef74f new file mode 100644 index 000000000000..6185b209fe5d Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/707f2dae60478240d29c46d9d8929212c3bef74f differ diff --git a/toolchain/diagnostics/fuzzer_corpus/708d97e4d18a09123c622c5e83e596f228626cd6 b/toolchain/diagnostics/fuzzer_corpus/708d97e4d18a09123c622c5e83e596f228626cd6 new file mode 100644 index 000000000000..f1af2045d55a Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/708d97e4d18a09123c622c5e83e596f228626cd6 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/70f9f83776423997bfbe06e9760edf5975ed4fc5 b/toolchain/diagnostics/fuzzer_corpus/70f9f83776423997bfbe06e9760edf5975ed4fc5 new file mode 100644 index 000000000000..723adfbcb722 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/70f9f83776423997bfbe06e9760edf5975ed4fc5 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/71ad46ce0484b31124ed3d3a2189b239d189bd4b b/toolchain/diagnostics/fuzzer_corpus/71ad46ce0484b31124ed3d3a2189b239d189bd4b new file mode 100644 index 000000000000..d70ac22e828f Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/71ad46ce0484b31124ed3d3a2189b239d189bd4b differ diff --git a/toolchain/diagnostics/fuzzer_corpus/72b17a19778cce7f1fd8c385d01b47bb571624d1 b/toolchain/diagnostics/fuzzer_corpus/72b17a19778cce7f1fd8c385d01b47bb571624d1 new file mode 100644 index 000000000000..4265e5994914 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/72b17a19778cce7f1fd8c385d01b47bb571624d1 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/72caa78ec364e5b6ea099bfa556698d070b11b13 b/toolchain/diagnostics/fuzzer_corpus/72caa78ec364e5b6ea099bfa556698d070b11b13 new file mode 100644 index 000000000000..302b172fe0d4 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/72caa78ec364e5b6ea099bfa556698d070b11b13 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/741b374bc567913c7565714e5dac4e59fa75aae4 b/toolchain/diagnostics/fuzzer_corpus/741b374bc567913c7565714e5dac4e59fa75aae4 new file mode 100644 index 000000000000..77d1bfafb1eb Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/741b374bc567913c7565714e5dac4e59fa75aae4 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/75a4f1b2f423d49f21e713dd13233ba9bb63f72e b/toolchain/diagnostics/fuzzer_corpus/75a4f1b2f423d49f21e713dd13233ba9bb63f72e new file mode 100644 index 000000000000..6e56f3e9099b Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/75a4f1b2f423d49f21e713dd13233ba9bb63f72e differ diff --git a/toolchain/diagnostics/fuzzer_corpus/779201452263c4992aa80d80cbb6ba77a335d7cf b/toolchain/diagnostics/fuzzer_corpus/779201452263c4992aa80d80cbb6ba77a335d7cf new file mode 100644 index 000000000000..1590444bbc32 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/779201452263c4992aa80d80cbb6ba77a335d7cf differ diff --git a/toolchain/diagnostics/fuzzer_corpus/787d6362b8101fd2a792b4603c1bac29c241bbd9 b/toolchain/diagnostics/fuzzer_corpus/787d6362b8101fd2a792b4603c1bac29c241bbd9 new file mode 100644 index 000000000000..9700834b9231 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/787d6362b8101fd2a792b4603c1bac29c241bbd9 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/7a57a99b158447e6dab4eb48953c892a954129d8 b/toolchain/diagnostics/fuzzer_corpus/7a57a99b158447e6dab4eb48953c892a954129d8 new file mode 100644 index 000000000000..cc26436d364e Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/7a57a99b158447e6dab4eb48953c892a954129d8 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/7b5248fd09e38a2030626b948834989303f16bec b/toolchain/diagnostics/fuzzer_corpus/7b5248fd09e38a2030626b948834989303f16bec new file mode 100644 index 000000000000..3be5ab610695 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/7b5248fd09e38a2030626b948834989303f16bec differ diff --git a/toolchain/diagnostics/fuzzer_corpus/7c1ebe9ceda7842557a0b3bca60522c868147439 b/toolchain/diagnostics/fuzzer_corpus/7c1ebe9ceda7842557a0b3bca60522c868147439 new file mode 100644 index 000000000000..8dda3e1e9b60 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/7c1ebe9ceda7842557a0b3bca60522c868147439 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/7dae293f26065c00322614bceb6794c8398305e1 b/toolchain/diagnostics/fuzzer_corpus/7dae293f26065c00322614bceb6794c8398305e1 new file mode 100644 index 000000000000..8efc65aa60cd Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/7dae293f26065c00322614bceb6794c8398305e1 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/7e5583a5b0bd84677058cfa0fd2d8fd2ca8ca223 b/toolchain/diagnostics/fuzzer_corpus/7e5583a5b0bd84677058cfa0fd2d8fd2ca8ca223 new file mode 100644 index 000000000000..85100c777706 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/7e5583a5b0bd84677058cfa0fd2d8fd2ca8ca223 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/7f4245291af1993065bdba02a9b188f0d8797463 b/toolchain/diagnostics/fuzzer_corpus/7f4245291af1993065bdba02a9b188f0d8797463 new file mode 100644 index 000000000000..b52a9facd816 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/7f4245291af1993065bdba02a9b188f0d8797463 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/81f7713107ceaea29d44298531e74129866e50db b/toolchain/diagnostics/fuzzer_corpus/81f7713107ceaea29d44298531e74129866e50db new file mode 100644 index 000000000000..c38c7541a11f Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/81f7713107ceaea29d44298531e74129866e50db differ diff --git a/toolchain/diagnostics/fuzzer_corpus/82a1d526bfdfb14f086b0578e5cdb4c7994d3263 b/toolchain/diagnostics/fuzzer_corpus/82a1d526bfdfb14f086b0578e5cdb4c7994d3263 new file mode 100644 index 000000000000..abddc96c7334 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/82a1d526bfdfb14f086b0578e5cdb4c7994d3263 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/834bdf2464f58da00145ff6fabb531f2a393d9e9 b/toolchain/diagnostics/fuzzer_corpus/834bdf2464f58da00145ff6fabb531f2a393d9e9 new file mode 100644 index 000000000000..de19f2049c5b Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/834bdf2464f58da00145ff6fabb531f2a393d9e9 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/8360d05f382f501e32dd197d1182235154dcd6a2 b/toolchain/diagnostics/fuzzer_corpus/8360d05f382f501e32dd197d1182235154dcd6a2 new file mode 100644 index 000000000000..3d9d5f00aae9 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/8360d05f382f501e32dd197d1182235154dcd6a2 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/85cb06bab29ae3afdd08e15be9c43d9e7dd05bb0 b/toolchain/diagnostics/fuzzer_corpus/85cb06bab29ae3afdd08e15be9c43d9e7dd05bb0 new file mode 100644 index 000000000000..5f5fb3cd6175 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/85cb06bab29ae3afdd08e15be9c43d9e7dd05bb0 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/85cdd9a51d592baef13bd56d67c4c4753c8b55ae b/toolchain/diagnostics/fuzzer_corpus/85cdd9a51d592baef13bd56d67c4c4753c8b55ae new file mode 100644 index 000000000000..e3ab7ea7a6ea Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/85cdd9a51d592baef13bd56d67c4c4753c8b55ae differ diff --git a/toolchain/diagnostics/fuzzer_corpus/866ebf931787c9f5dd29596684013ad0b99de6a1 b/toolchain/diagnostics/fuzzer_corpus/866ebf931787c9f5dd29596684013ad0b99de6a1 new file mode 100644 index 000000000000..3c7e8413540a Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/866ebf931787c9f5dd29596684013ad0b99de6a1 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/86a387b385ace93107ba6c0a413be79ce670d9e7 b/toolchain/diagnostics/fuzzer_corpus/86a387b385ace93107ba6c0a413be79ce670d9e7 new file mode 100644 index 000000000000..f2722d7e256c Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/86a387b385ace93107ba6c0a413be79ce670d9e7 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/883882cffbfc8dacd2c737662b722680af4994e3 b/toolchain/diagnostics/fuzzer_corpus/883882cffbfc8dacd2c737662b722680af4994e3 new file mode 100644 index 000000000000..43da0056a1fe Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/883882cffbfc8dacd2c737662b722680af4994e3 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/8988a609469efac9ccdc39dbd52f7e0d1d1a1b32 b/toolchain/diagnostics/fuzzer_corpus/8988a609469efac9ccdc39dbd52f7e0d1d1a1b32 new file mode 100644 index 000000000000..41d99a0d7949 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/8988a609469efac9ccdc39dbd52f7e0d1d1a1b32 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/8ac9d21d2a263453ef5204db615c7cafcb8b917c b/toolchain/diagnostics/fuzzer_corpus/8ac9d21d2a263453ef5204db615c7cafcb8b917c new file mode 100644 index 000000000000..65f759becdfa Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/8ac9d21d2a263453ef5204db615c7cafcb8b917c differ diff --git a/toolchain/diagnostics/fuzzer_corpus/8e18fc69f84fdc05d9bfddc9cfa3fd6de9a48fd5 b/toolchain/diagnostics/fuzzer_corpus/8e18fc69f84fdc05d9bfddc9cfa3fd6de9a48fd5 new file mode 100644 index 000000000000..5ca3b9533352 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/8e18fc69f84fdc05d9bfddc9cfa3fd6de9a48fd5 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/8eebc71273e441df4c242add1c4a1accbaf648e0 b/toolchain/diagnostics/fuzzer_corpus/8eebc71273e441df4c242add1c4a1accbaf648e0 new file mode 100644 index 000000000000..f2e6ddf75317 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/8eebc71273e441df4c242add1c4a1accbaf648e0 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/8f08f216cb1379e8423f24282ddee1cd0cbcd8c4 b/toolchain/diagnostics/fuzzer_corpus/8f08f216cb1379e8423f24282ddee1cd0cbcd8c4 new file mode 100644 index 000000000000..7d1951c77290 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/8f08f216cb1379e8423f24282ddee1cd0cbcd8c4 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/8f2e125c6058fd64b56d31cb4d3a959c1d9fba08 b/toolchain/diagnostics/fuzzer_corpus/8f2e125c6058fd64b56d31cb4d3a959c1d9fba08 new file mode 100644 index 000000000000..bfdef106e72a Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/8f2e125c6058fd64b56d31cb4d3a959c1d9fba08 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/8f5ce09dd5b4db613d382dbafd613b2f992e4078 b/toolchain/diagnostics/fuzzer_corpus/8f5ce09dd5b4db613d382dbafd613b2f992e4078 new file mode 100644 index 000000000000..1e62b9873957 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/8f5ce09dd5b4db613d382dbafd613b2f992e4078 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/94067dda69cfe39e2e2f891670409a43926ac3f9 b/toolchain/diagnostics/fuzzer_corpus/94067dda69cfe39e2e2f891670409a43926ac3f9 new file mode 100644 index 000000000000..0540a4df312c --- /dev/null +++ b/toolchain/diagnostics/fuzzer_corpus/94067dda69cfe39e2e2f891670409a43926ac3f9 @@ -0,0 +1 @@ +, A›¢ \ No newline at end of file diff --git a/toolchain/diagnostics/fuzzer_corpus/941789dcd698c988eb89a118373e841de0c8ba1b b/toolchain/diagnostics/fuzzer_corpus/941789dcd698c988eb89a118373e841de0c8ba1b new file mode 100644 index 000000000000..f697ee60d921 --- /dev/null +++ b/toolchain/diagnostics/fuzzer_corpus/941789dcd698c988eb89a118373e841de0c8ba1b @@ -0,0 +1 @@ +››ÎnÎÎ \ No newline at end of file diff --git a/toolchain/diagnostics/fuzzer_corpus/95551db5d293db56c03f88be58f1d888130d1e43 b/toolchain/diagnostics/fuzzer_corpus/95551db5d293db56c03f88be58f1d888130d1e43 new file mode 100644 index 000000000000..1b53d06b59b4 --- /dev/null +++ b/toolchain/diagnostics/fuzzer_corpus/95551db5d293db56c03f88be58f1d888130d1e43 @@ -0,0 +1 @@ +A› \ No newline at end of file diff --git a/toolchain/diagnostics/fuzzer_corpus/9555b7baa3e5b3f8034a19b4714c0f8631558abc b/toolchain/diagnostics/fuzzer_corpus/9555b7baa3e5b3f8034a19b4714c0f8631558abc new file mode 100644 index 000000000000..7466bb352f9e Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/9555b7baa3e5b3f8034a19b4714c0f8631558abc differ diff --git a/toolchain/diagnostics/fuzzer_corpus/96523e6c50a3ad98b08aae74f28bd910108d7470 b/toolchain/diagnostics/fuzzer_corpus/96523e6c50a3ad98b08aae74f28bd910108d7470 new file mode 100644 index 000000000000..eaac39033ff2 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/96523e6c50a3ad98b08aae74f28bd910108d7470 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/96c7a06f23dfd0453d475ff61b555d6392ee3e79 b/toolchain/diagnostics/fuzzer_corpus/96c7a06f23dfd0453d475ff61b555d6392ee3e79 new file mode 100644 index 000000000000..9818b245336b Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/96c7a06f23dfd0453d475ff61b555d6392ee3e79 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/975e5a76497908f45c6a94b8217eecd4724d3763 b/toolchain/diagnostics/fuzzer_corpus/975e5a76497908f45c6a94b8217eecd4724d3763 new file mode 100644 index 000000000000..9fe532ff4e71 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/975e5a76497908f45c6a94b8217eecd4724d3763 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/9831451a682b145c1b854069edd5453fc45e0a3c b/toolchain/diagnostics/fuzzer_corpus/9831451a682b145c1b854069edd5453fc45e0a3c new file mode 100644 index 000000000000..16e4246d4be7 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/9831451a682b145c1b854069edd5453fc45e0a3c differ diff --git a/toolchain/diagnostics/fuzzer_corpus/98423d7304435a14b91e74d2ca5b60ba3d6756af b/toolchain/diagnostics/fuzzer_corpus/98423d7304435a14b91e74d2ca5b60ba3d6756af new file mode 100644 index 000000000000..65ab1e91a7ee Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/98423d7304435a14b91e74d2ca5b60ba3d6756af differ diff --git a/toolchain/diagnostics/fuzzer_corpus/99d7758d39ddc9a12e475938ee79a77ac0a957fc b/toolchain/diagnostics/fuzzer_corpus/99d7758d39ddc9a12e475938ee79a77ac0a957fc new file mode 100644 index 000000000000..2c8b91dea55d Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/99d7758d39ddc9a12e475938ee79a77ac0a957fc differ diff --git a/toolchain/diagnostics/fuzzer_corpus/9aa659d6ff83ab9aef0199af68558af3fe0ed6e9 b/toolchain/diagnostics/fuzzer_corpus/9aa659d6ff83ab9aef0199af68558af3fe0ed6e9 new file mode 100644 index 000000000000..1c918545c45b Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/9aa659d6ff83ab9aef0199af68558af3fe0ed6e9 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/9bd3daaa4ea3ee3dd1ff6e091c1b75c2ce98647d b/toolchain/diagnostics/fuzzer_corpus/9bd3daaa4ea3ee3dd1ff6e091c1b75c2ce98647d new file mode 100644 index 000000000000..f8060771191a Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/9bd3daaa4ea3ee3dd1ff6e091c1b75c2ce98647d differ diff --git a/toolchain/diagnostics/fuzzer_corpus/9c7c87bea715d84d76c1bc3b21789c3570287ef6 b/toolchain/diagnostics/fuzzer_corpus/9c7c87bea715d84d76c1bc3b21789c3570287ef6 new file mode 100644 index 000000000000..77142a4ea14c Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/9c7c87bea715d84d76c1bc3b21789c3570287ef6 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/9ca1bad20f0dde4de875731643c53bbb4faf452e b/toolchain/diagnostics/fuzzer_corpus/9ca1bad20f0dde4de875731643c53bbb4faf452e new file mode 100644 index 000000000000..57f9b7484a8a Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/9ca1bad20f0dde4de875731643c53bbb4faf452e differ diff --git a/toolchain/diagnostics/fuzzer_corpus/9d24bd942ada2b9a942c9212470a672a8f021a94 b/toolchain/diagnostics/fuzzer_corpus/9d24bd942ada2b9a942c9212470a672a8f021a94 new file mode 100644 index 000000000000..2b4e3aa4a09d Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/9d24bd942ada2b9a942c9212470a672a8f021a94 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/9e49fe8100322ef6de4221ed0c343391acaf8aec b/toolchain/diagnostics/fuzzer_corpus/9e49fe8100322ef6de4221ed0c343391acaf8aec new file mode 100644 index 000000000000..4e15602ee660 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/9e49fe8100322ef6de4221ed0c343391acaf8aec differ diff --git a/toolchain/diagnostics/fuzzer_corpus/9e746bb315329c2548e9030f99554c8cb226baa5 b/toolchain/diagnostics/fuzzer_corpus/9e746bb315329c2548e9030f99554c8cb226baa5 new file mode 100644 index 000000000000..e4902b5cf041 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/9e746bb315329c2548e9030f99554c8cb226baa5 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/9f358f8689ac7b6db2bd0e6f29a12f23b90cc036 b/toolchain/diagnostics/fuzzer_corpus/9f358f8689ac7b6db2bd0e6f29a12f23b90cc036 new file mode 100644 index 000000000000..4e88c2b9900f Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/9f358f8689ac7b6db2bd0e6f29a12f23b90cc036 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/9fc398f66a8c9b7cfcff1f75f252e2810059ca45 b/toolchain/diagnostics/fuzzer_corpus/9fc398f66a8c9b7cfcff1f75f252e2810059ca45 new file mode 100644 index 000000000000..44c1fee43a33 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/9fc398f66a8c9b7cfcff1f75f252e2810059ca45 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/a08061381398cf09ecce284a06db94fb0f332d09 b/toolchain/diagnostics/fuzzer_corpus/a08061381398cf09ecce284a06db94fb0f332d09 new file mode 100644 index 000000000000..39bfaf0d4f47 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/a08061381398cf09ecce284a06db94fb0f332d09 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/a0bb306bf743553aece840b6f6450dead81d121e b/toolchain/diagnostics/fuzzer_corpus/a0bb306bf743553aece840b6f6450dead81d121e new file mode 100644 index 000000000000..35b426cc271f Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/a0bb306bf743553aece840b6f6450dead81d121e differ diff --git a/toolchain/diagnostics/fuzzer_corpus/a1fd1d319149d81c6eecab5d993fb3de19312a69 b/toolchain/diagnostics/fuzzer_corpus/a1fd1d319149d81c6eecab5d993fb3de19312a69 new file mode 100644 index 000000000000..3eac71f4cd19 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/a1fd1d319149d81c6eecab5d993fb3de19312a69 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/a36eb4db61dece5caa3148d86750667f11fc4852 b/toolchain/diagnostics/fuzzer_corpus/a36eb4db61dece5caa3148d86750667f11fc4852 new file mode 100644 index 000000000000..aedb135da95d Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/a36eb4db61dece5caa3148d86750667f11fc4852 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/a486c9d0094d356ec6484e1678c989ddc8753346 b/toolchain/diagnostics/fuzzer_corpus/a486c9d0094d356ec6484e1678c989ddc8753346 new file mode 100644 index 000000000000..c1033ee092a9 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/a486c9d0094d356ec6484e1678c989ddc8753346 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/a76f4fb15ddcb4a379385ecc8dfa21535f385849 b/toolchain/diagnostics/fuzzer_corpus/a76f4fb15ddcb4a379385ecc8dfa21535f385849 new file mode 100644 index 000000000000..35db3a06727e Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/a76f4fb15ddcb4a379385ecc8dfa21535f385849 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/a8c16015d50c13c10c8a8df560b8204faef88f93 b/toolchain/diagnostics/fuzzer_corpus/a8c16015d50c13c10c8a8df560b8204faef88f93 new file mode 100644 index 000000000000..8a1fa5b6034e Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/a8c16015d50c13c10c8a8df560b8204faef88f93 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/a8e373d3a30e51940d9bc60e37ed28fef19ec934 b/toolchain/diagnostics/fuzzer_corpus/a8e373d3a30e51940d9bc60e37ed28fef19ec934 new file mode 100644 index 000000000000..db5ab1846a2c Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/a8e373d3a30e51940d9bc60e37ed28fef19ec934 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/a9c1db90bf80c4a7355c80a1ea890959035ea14c b/toolchain/diagnostics/fuzzer_corpus/a9c1db90bf80c4a7355c80a1ea890959035ea14c new file mode 100644 index 000000000000..a6b3bd4c48fc Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/a9c1db90bf80c4a7355c80a1ea890959035ea14c differ diff --git a/toolchain/diagnostics/fuzzer_corpus/a9e54cb2a7056ca41f0f6e51dc4e560bee3b3a84 b/toolchain/diagnostics/fuzzer_corpus/a9e54cb2a7056ca41f0f6e51dc4e560bee3b3a84 new file mode 100644 index 000000000000..3b49c8e888b0 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/a9e54cb2a7056ca41f0f6e51dc4e560bee3b3a84 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/aa876c112fa4fb7959253840b18d3a3a15eb9e74 b/toolchain/diagnostics/fuzzer_corpus/aa876c112fa4fb7959253840b18d3a3a15eb9e74 new file mode 100644 index 000000000000..ae4c8db8d75a Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/aa876c112fa4fb7959253840b18d3a3a15eb9e74 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/ade890157b8dcd8ffa37434d9d6c6a8c723e87bc b/toolchain/diagnostics/fuzzer_corpus/ade890157b8dcd8ffa37434d9d6c6a8c723e87bc new file mode 100644 index 000000000000..c8b4cd72bfe3 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/ade890157b8dcd8ffa37434d9d6c6a8c723e87bc differ diff --git a/toolchain/diagnostics/fuzzer_corpus/ae2d2e0b46dbdc5589c9b8b048a29f2edaf49eaf b/toolchain/diagnostics/fuzzer_corpus/ae2d2e0b46dbdc5589c9b8b048a29f2edaf49eaf new file mode 100644 index 000000000000..2bc78bce6f93 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/ae2d2e0b46dbdc5589c9b8b048a29f2edaf49eaf differ diff --git a/toolchain/diagnostics/fuzzer_corpus/b2a1e32db5091dfe4503a2c85f857187f25d9af8 b/toolchain/diagnostics/fuzzer_corpus/b2a1e32db5091dfe4503a2c85f857187f25d9af8 new file mode 100644 index 000000000000..36c5375831e8 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/b2a1e32db5091dfe4503a2c85f857187f25d9af8 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/b410a3be390d0c2202bea66226298beb8b68d0d7 b/toolchain/diagnostics/fuzzer_corpus/b410a3be390d0c2202bea66226298beb8b68d0d7 new file mode 100644 index 000000000000..8ec610185982 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/b410a3be390d0c2202bea66226298beb8b68d0d7 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/b42e76308dc5c4cc13f0b9228ddb287dc0d83fef b/toolchain/diagnostics/fuzzer_corpus/b42e76308dc5c4cc13f0b9228ddb287dc0d83fef new file mode 100644 index 000000000000..0ec3091d2d72 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/b42e76308dc5c4cc13f0b9228ddb287dc0d83fef differ diff --git a/toolchain/diagnostics/fuzzer_corpus/b478db977be7045e0fdf6d18b6989c8a0ddc2d4b b/toolchain/diagnostics/fuzzer_corpus/b478db977be7045e0fdf6d18b6989c8a0ddc2d4b new file mode 100644 index 000000000000..fbafc6880214 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/b478db977be7045e0fdf6d18b6989c8a0ddc2d4b differ diff --git a/toolchain/diagnostics/fuzzer_corpus/b572e2be261f83b1428fae6fa768840796955410 b/toolchain/diagnostics/fuzzer_corpus/b572e2be261f83b1428fae6fa768840796955410 new file mode 100644 index 000000000000..12f3ca70ab4d Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/b572e2be261f83b1428fae6fa768840796955410 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/b693798f5d94c8d8dba763c0420812a63f5c7738 b/toolchain/diagnostics/fuzzer_corpus/b693798f5d94c8d8dba763c0420812a63f5c7738 new file mode 100644 index 000000000000..2780b7e03e5d Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/b693798f5d94c8d8dba763c0420812a63f5c7738 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/b9e882e968dbe9988bca34854346df3d6b0d187b b/toolchain/diagnostics/fuzzer_corpus/b9e882e968dbe9988bca34854346df3d6b0d187b new file mode 100644 index 000000000000..93ed717d20b8 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/b9e882e968dbe9988bca34854346df3d6b0d187b differ diff --git a/toolchain/diagnostics/fuzzer_corpus/ba5047502979ce2b979361893f937a1419a463bc b/toolchain/diagnostics/fuzzer_corpus/ba5047502979ce2b979361893f937a1419a463bc new file mode 100644 index 000000000000..183ebf7b8684 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/ba5047502979ce2b979361893f937a1419a463bc differ diff --git a/toolchain/diagnostics/fuzzer_corpus/bac75e7dcc8ca2e87882f6f0d0326dbd9c6abead b/toolchain/diagnostics/fuzzer_corpus/bac75e7dcc8ca2e87882f6f0d0326dbd9c6abead new file mode 100644 index 000000000000..d281bbd4c81f Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/bac75e7dcc8ca2e87882f6f0d0326dbd9c6abead differ diff --git a/toolchain/diagnostics/fuzzer_corpus/bc3ca742854d762f2f5b647f55dd53ecb99a7143 b/toolchain/diagnostics/fuzzer_corpus/bc3ca742854d762f2f5b647f55dd53ecb99a7143 new file mode 100644 index 000000000000..18646d143419 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/bc3ca742854d762f2f5b647f55dd53ecb99a7143 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/bcc7b167ffde961930de5f59200afcd73e99088c b/toolchain/diagnostics/fuzzer_corpus/bcc7b167ffde961930de5f59200afcd73e99088c new file mode 100644 index 000000000000..6adbfb93d5d7 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/bcc7b167ffde961930de5f59200afcd73e99088c differ diff --git a/toolchain/diagnostics/fuzzer_corpus/bcc957bd0be63dbe92a485c1442b453cfafbb063 b/toolchain/diagnostics/fuzzer_corpus/bcc957bd0be63dbe92a485c1442b453cfafbb063 new file mode 100644 index 000000000000..81d28e199e77 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/bcc957bd0be63dbe92a485c1442b453cfafbb063 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/bdec18ad4309d133f8e4be9dcd23d266d9668c9d b/toolchain/diagnostics/fuzzer_corpus/bdec18ad4309d133f8e4be9dcd23d266d9668c9d new file mode 100644 index 000000000000..33850ea96d80 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/bdec18ad4309d133f8e4be9dcd23d266d9668c9d differ diff --git a/toolchain/diagnostics/fuzzer_corpus/c4cebb6b8e2c04d8ca12b53dfdc2a3e6b0daf7ff b/toolchain/diagnostics/fuzzer_corpus/c4cebb6b8e2c04d8ca12b53dfdc2a3e6b0daf7ff new file mode 100644 index 000000000000..63a5192c0818 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/c4cebb6b8e2c04d8ca12b53dfdc2a3e6b0daf7ff differ diff --git a/toolchain/diagnostics/fuzzer_corpus/c5da01b3d382b078e818813edcc709858d2aa805 b/toolchain/diagnostics/fuzzer_corpus/c5da01b3d382b078e818813edcc709858d2aa805 new file mode 100644 index 000000000000..16546c855c28 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/c5da01b3d382b078e818813edcc709858d2aa805 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/c69d7d2a1e43ea2ba01b1fa8eb190733a47a1376 b/toolchain/diagnostics/fuzzer_corpus/c69d7d2a1e43ea2ba01b1fa8eb190733a47a1376 new file mode 100644 index 000000000000..f4014d9bdd9b Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/c69d7d2a1e43ea2ba01b1fa8eb190733a47a1376 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/cb863712a08392ecc318375560b6c8012263d5e6 b/toolchain/diagnostics/fuzzer_corpus/cb863712a08392ecc318375560b6c8012263d5e6 new file mode 100644 index 000000000000..0130464894ab Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/cb863712a08392ecc318375560b6c8012263d5e6 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/ce412c60a824a7bbb5742fd00a7874624ecd117f b/toolchain/diagnostics/fuzzer_corpus/ce412c60a824a7bbb5742fd00a7874624ecd117f new file mode 100644 index 000000000000..108cfad05f68 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/ce412c60a824a7bbb5742fd00a7874624ecd117f differ diff --git a/toolchain/diagnostics/fuzzer_corpus/ceb2cd93c27fc4ceae9d602ea2732d7b94bd95c9 b/toolchain/diagnostics/fuzzer_corpus/ceb2cd93c27fc4ceae9d602ea2732d7b94bd95c9 new file mode 100644 index 000000000000..3e85d45623a8 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/ceb2cd93c27fc4ceae9d602ea2732d7b94bd95c9 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/cf7af311c566dcd75ca255967220f1f0cc6b6056 b/toolchain/diagnostics/fuzzer_corpus/cf7af311c566dcd75ca255967220f1f0cc6b6056 new file mode 100644 index 000000000000..1c7baa4ae8a5 --- /dev/null +++ b/toolchain/diagnostics/fuzzer_corpus/cf7af311c566dcd75ca255967220f1f0cc6b6056 @@ -0,0 +1 @@ +A› \ No newline at end of file diff --git a/toolchain/diagnostics/fuzzer_corpus/d03a98fefe076a8fe44e72d3b3da122010424b1b b/toolchain/diagnostics/fuzzer_corpus/d03a98fefe076a8fe44e72d3b3da122010424b1b new file mode 100644 index 000000000000..19c02385a692 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/d03a98fefe076a8fe44e72d3b3da122010424b1b differ diff --git a/toolchain/diagnostics/fuzzer_corpus/d03d35447306821ba924d4e4317ba706ad65c2c2 b/toolchain/diagnostics/fuzzer_corpus/d03d35447306821ba924d4e4317ba706ad65c2c2 new file mode 100644 index 000000000000..174a8620f4ac Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/d03d35447306821ba924d4e4317ba706ad65c2c2 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/d169fdd3bc53cad5cebbd4f9506a14e7034b22fa b/toolchain/diagnostics/fuzzer_corpus/d169fdd3bc53cad5cebbd4f9506a14e7034b22fa new file mode 100644 index 000000000000..a9c242101a00 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/d169fdd3bc53cad5cebbd4f9506a14e7034b22fa differ diff --git a/toolchain/diagnostics/fuzzer_corpus/d1a2caaffe9fbcb979215a7fcaca02107e5adfff b/toolchain/diagnostics/fuzzer_corpus/d1a2caaffe9fbcb979215a7fcaca02107e5adfff new file mode 100644 index 000000000000..e89fb38db6a3 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/d1a2caaffe9fbcb979215a7fcaca02107e5adfff differ diff --git a/toolchain/diagnostics/fuzzer_corpus/d59554cc9fa05da71dd73b1939504c79e3fb51d3 b/toolchain/diagnostics/fuzzer_corpus/d59554cc9fa05da71dd73b1939504c79e3fb51d3 new file mode 100644 index 000000000000..8e9c40cfb3ad Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/d59554cc9fa05da71dd73b1939504c79e3fb51d3 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/d5da9e00471c8d4b5e02b0f7f94e1aab6415d1da b/toolchain/diagnostics/fuzzer_corpus/d5da9e00471c8d4b5e02b0f7f94e1aab6415d1da new file mode 100644 index 000000000000..4b9816ca9f0f Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/d5da9e00471c8d4b5e02b0f7f94e1aab6415d1da differ diff --git a/toolchain/diagnostics/fuzzer_corpus/d7077db25364eeaf16486d7c4ef71e2147702db1 b/toolchain/diagnostics/fuzzer_corpus/d7077db25364eeaf16486d7c4ef71e2147702db1 new file mode 100644 index 000000000000..44aa9603fb5c Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/d7077db25364eeaf16486d7c4ef71e2147702db1 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/d93f8edd1b1fbb992f16891d3ede6f0a52048e8c b/toolchain/diagnostics/fuzzer_corpus/d93f8edd1b1fbb992f16891d3ede6f0a52048e8c new file mode 100644 index 000000000000..ae6160accdec Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/d93f8edd1b1fbb992f16891d3ede6f0a52048e8c differ diff --git a/toolchain/diagnostics/fuzzer_corpus/db88b4913dc93e9c4ea6a7bc9bba72fdf5b56634 b/toolchain/diagnostics/fuzzer_corpus/db88b4913dc93e9c4ea6a7bc9bba72fdf5b56634 new file mode 100644 index 000000000000..3debc9a6d5a7 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/db88b4913dc93e9c4ea6a7bc9bba72fdf5b56634 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/dc65083798958a6923c2fe7676fc54b647503a11 b/toolchain/diagnostics/fuzzer_corpus/dc65083798958a6923c2fe7676fc54b647503a11 new file mode 100644 index 000000000000..41212b41f952 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/dc65083798958a6923c2fe7676fc54b647503a11 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/dd6ebc560c9ac3bbd74b9361cb81d5e16096780c b/toolchain/diagnostics/fuzzer_corpus/dd6ebc560c9ac3bbd74b9361cb81d5e16096780c new file mode 100644 index 000000000000..4f7c7a7db7aa Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/dd6ebc560c9ac3bbd74b9361cb81d5e16096780c differ diff --git a/toolchain/diagnostics/fuzzer_corpus/de1fae499d7c917a8db95d1adfea63a67a3173ca b/toolchain/diagnostics/fuzzer_corpus/de1fae499d7c917a8db95d1adfea63a67a3173ca new file mode 100644 index 000000000000..8237444a09a1 --- /dev/null +++ b/toolchain/diagnostics/fuzzer_corpus/de1fae499d7c917a8db95d1adfea63a67a3173ca @@ -0,0 +1 @@ + A›› \ No newline at end of file diff --git a/toolchain/diagnostics/fuzzer_corpus/e009e120783c6e9ca7eceaedcb98651e2c6d29ff b/toolchain/diagnostics/fuzzer_corpus/e009e120783c6e9ca7eceaedcb98651e2c6d29ff new file mode 100644 index 000000000000..105ee48b6371 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/e009e120783c6e9ca7eceaedcb98651e2c6d29ff differ diff --git a/toolchain/diagnostics/fuzzer_corpus/e030173c8b151ec0985fc15bcebe992bc87159da b/toolchain/diagnostics/fuzzer_corpus/e030173c8b151ec0985fc15bcebe992bc87159da new file mode 100644 index 000000000000..9d15c8b24149 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/e030173c8b151ec0985fc15bcebe992bc87159da differ diff --git a/toolchain/diagnostics/fuzzer_corpus/e267a21c5857815bab97732e93d8f890d28b3818 b/toolchain/diagnostics/fuzzer_corpus/e267a21c5857815bab97732e93d8f890d28b3818 new file mode 100644 index 000000000000..85866fa1e25e Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/e267a21c5857815bab97732e93d8f890d28b3818 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/e3a8ef9b95560490d6450a68186488f23a782c71 b/toolchain/diagnostics/fuzzer_corpus/e3a8ef9b95560490d6450a68186488f23a782c71 new file mode 100644 index 000000000000..bd8ad9e3e14d Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/e3a8ef9b95560490d6450a68186488f23a782c71 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/e5dbe53b7bf075f098c194b74af84f12d6767d5a b/toolchain/diagnostics/fuzzer_corpus/e5dbe53b7bf075f098c194b74af84f12d6767d5a new file mode 100644 index 000000000000..386552434977 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/e5dbe53b7bf075f098c194b74af84f12d6767d5a differ diff --git a/toolchain/diagnostics/fuzzer_corpus/e605e5dcc76260e4be46b79c9d43f51c9e85cc22 b/toolchain/diagnostics/fuzzer_corpus/e605e5dcc76260e4be46b79c9d43f51c9e85cc22 new file mode 100644 index 000000000000..86fcbb646288 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/e605e5dcc76260e4be46b79c9d43f51c9e85cc22 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/e6079d754285b55566367aaa56398c1d085d16c9 b/toolchain/diagnostics/fuzzer_corpus/e6079d754285b55566367aaa56398c1d085d16c9 new file mode 100644 index 000000000000..715f4133a69f Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/e6079d754285b55566367aaa56398c1d085d16c9 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/e618f9bb821f6e68ae80d3bb9e0fd17fa8ca1eec b/toolchain/diagnostics/fuzzer_corpus/e618f9bb821f6e68ae80d3bb9e0fd17fa8ca1eec new file mode 100644 index 000000000000..5cb88591218c Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/e618f9bb821f6e68ae80d3bb9e0fd17fa8ca1eec differ diff --git a/toolchain/diagnostics/fuzzer_corpus/e777db69ed9f364c34e0bf5831b48972b969df46 b/toolchain/diagnostics/fuzzer_corpus/e777db69ed9f364c34e0bf5831b48972b969df46 new file mode 100644 index 000000000000..f69ce5b0757b --- /dev/null +++ b/toolchain/diagnostics/fuzzer_corpus/e777db69ed9f364c34e0bf5831b48972b969df46 @@ -0,0 +1 @@ +ÿÿÿÿ diff --git a/toolchain/diagnostics/fuzzer_corpus/e77b1186a38174baaa371535e786ffebbbb88595 b/toolchain/diagnostics/fuzzer_corpus/e77b1186a38174baaa371535e786ffebbbb88595 new file mode 100644 index 000000000000..86b6971fc19f Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/e77b1186a38174baaa371535e786ffebbbb88595 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/e7c3a0ce0f50e049b5bfdbf1ac8a91eafdbff7d0 b/toolchain/diagnostics/fuzzer_corpus/e7c3a0ce0f50e049b5bfdbf1ac8a91eafdbff7d0 new file mode 100644 index 000000000000..2fd37bad9181 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/e7c3a0ce0f50e049b5bfdbf1ac8a91eafdbff7d0 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/e8022527bbf1106e42c067387fc5017672b75343 b/toolchain/diagnostics/fuzzer_corpus/e8022527bbf1106e42c067387fc5017672b75343 new file mode 100644 index 000000000000..cec4feb4be08 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/e8022527bbf1106e42c067387fc5017672b75343 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/e8575fcce3dfc4b6f6e5c240b0eb5db6eb9ff305 b/toolchain/diagnostics/fuzzer_corpus/e8575fcce3dfc4b6f6e5c240b0eb5db6eb9ff305 new file mode 100644 index 000000000000..e9070e1c22ab Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/e8575fcce3dfc4b6f6e5c240b0eb5db6eb9ff305 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/e9467a574f73fc6d317de665d0590b0d60592c0e b/toolchain/diagnostics/fuzzer_corpus/e9467a574f73fc6d317de665d0590b0d60592c0e new file mode 100644 index 000000000000..33360bee7ad2 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/e9467a574f73fc6d317de665d0590b0d60592c0e differ diff --git a/toolchain/diagnostics/fuzzer_corpus/e989ce14e4220c66e81eb07d17a8b211eaf360cb b/toolchain/diagnostics/fuzzer_corpus/e989ce14e4220c66e81eb07d17a8b211eaf360cb new file mode 100644 index 000000000000..9b79cd7f5555 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/e989ce14e4220c66e81eb07d17a8b211eaf360cb differ diff --git a/toolchain/diagnostics/fuzzer_corpus/ea966477da4bc672247242674afec7e83da47b59 b/toolchain/diagnostics/fuzzer_corpus/ea966477da4bc672247242674afec7e83da47b59 new file mode 100644 index 000000000000..8ba563783e3d Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/ea966477da4bc672247242674afec7e83da47b59 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/ebaaa9a8c6ba89bb88bc201f5c61288057bc2fad b/toolchain/diagnostics/fuzzer_corpus/ebaaa9a8c6ba89bb88bc201f5c61288057bc2fad new file mode 100644 index 000000000000..65517217a0e6 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/ebaaa9a8c6ba89bb88bc201f5c61288057bc2fad differ diff --git a/toolchain/diagnostics/fuzzer_corpus/ec748e31e33ea4d18da9ce0febe52191e6dc2f4f b/toolchain/diagnostics/fuzzer_corpus/ec748e31e33ea4d18da9ce0febe52191e6dc2f4f new file mode 100644 index 000000000000..f3fe26f800c0 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/ec748e31e33ea4d18da9ce0febe52191e6dc2f4f differ diff --git a/toolchain/diagnostics/fuzzer_corpus/ec867cf9282bf994f7de50afe62a41848f49aaa1 b/toolchain/diagnostics/fuzzer_corpus/ec867cf9282bf994f7de50afe62a41848f49aaa1 new file mode 100644 index 000000000000..16eb82279f35 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/ec867cf9282bf994f7de50afe62a41848f49aaa1 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/ed1d20e45dad6ca149de9d989cd2150637c56479 b/toolchain/diagnostics/fuzzer_corpus/ed1d20e45dad6ca149de9d989cd2150637c56479 new file mode 100644 index 000000000000..d29dd32bed40 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/ed1d20e45dad6ca149de9d989cd2150637c56479 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/ed8203518187ff4dfe42a6378212b1ebd9e2e1cc b/toolchain/diagnostics/fuzzer_corpus/ed8203518187ff4dfe42a6378212b1ebd9e2e1cc new file mode 100644 index 000000000000..0278531d5509 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/ed8203518187ff4dfe42a6378212b1ebd9e2e1cc differ diff --git a/toolchain/diagnostics/fuzzer_corpus/ee1183f6cc59ca020490e3befee11e90e61fa929 b/toolchain/diagnostics/fuzzer_corpus/ee1183f6cc59ca020490e3befee11e90e61fa929 new file mode 100644 index 000000000000..2d85fcef5f0a Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/ee1183f6cc59ca020490e3befee11e90e61fa929 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/f284927a1cdb426df7804b0d71b0720a6c965bc8 b/toolchain/diagnostics/fuzzer_corpus/f284927a1cdb426df7804b0d71b0720a6c965bc8 new file mode 100644 index 000000000000..8c6b8f96f2d9 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/f284927a1cdb426df7804b0d71b0720a6c965bc8 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/f335295c61ed092219cc0a4e411c47514b499f2a b/toolchain/diagnostics/fuzzer_corpus/f335295c61ed092219cc0a4e411c47514b499f2a new file mode 100644 index 000000000000..f3a86f65fb88 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/f335295c61ed092219cc0a4e411c47514b499f2a differ diff --git a/toolchain/diagnostics/fuzzer_corpus/f6f002454b61791759a66536f06f3cbdc98f7518 b/toolchain/diagnostics/fuzzer_corpus/f6f002454b61791759a66536f06f3cbdc98f7518 new file mode 100644 index 000000000000..02d473d1b4e1 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/f6f002454b61791759a66536f06f3cbdc98f7518 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/f7342d8d8d627a69565441b071e2ceef7db2fd4b b/toolchain/diagnostics/fuzzer_corpus/f7342d8d8d627a69565441b071e2ceef7db2fd4b new file mode 100644 index 000000000000..cd1713103d67 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/f7342d8d8d627a69565441b071e2ceef7db2fd4b differ diff --git a/toolchain/diagnostics/fuzzer_corpus/f80b63acc4989dacc0f679e5902619d01ef4112c b/toolchain/diagnostics/fuzzer_corpus/f80b63acc4989dacc0f679e5902619d01ef4112c new file mode 100644 index 000000000000..11d166b84af2 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/f80b63acc4989dacc0f679e5902619d01ef4112c differ diff --git a/toolchain/diagnostics/fuzzer_corpus/f8fd02f8628468b9c3b8ac5610eff36aee46e4cd b/toolchain/diagnostics/fuzzer_corpus/f8fd02f8628468b9c3b8ac5610eff36aee46e4cd new file mode 100644 index 000000000000..691787622c69 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/f8fd02f8628468b9c3b8ac5610eff36aee46e4cd differ diff --git a/toolchain/diagnostics/fuzzer_corpus/f9c2854fa276eb44891048ddf36885cf63698f33 b/toolchain/diagnostics/fuzzer_corpus/f9c2854fa276eb44891048ddf36885cf63698f33 new file mode 100644 index 000000000000..ca4df690b1f3 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/f9c2854fa276eb44891048ddf36885cf63698f33 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/fba407fd1320d7e740d604cafaf03296edc23130 b/toolchain/diagnostics/fuzzer_corpus/fba407fd1320d7e740d604cafaf03296edc23130 new file mode 100644 index 000000000000..39a535c1e2a4 Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/fba407fd1320d7e740d604cafaf03296edc23130 differ diff --git a/toolchain/diagnostics/fuzzer_corpus/fc6aeb9043cbd585df0c22e5cd82dad9d0f80eec b/toolchain/diagnostics/fuzzer_corpus/fc6aeb9043cbd585df0c22e5cd82dad9d0f80eec new file mode 100644 index 000000000000..86b8cf6c298d Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/fc6aeb9043cbd585df0c22e5cd82dad9d0f80eec differ diff --git a/toolchain/diagnostics/fuzzer_corpus/fe1d8f4a7d9cee164e834e54da75c7bf004c51ba b/toolchain/diagnostics/fuzzer_corpus/fe1d8f4a7d9cee164e834e54da75c7bf004c51ba new file mode 100644 index 000000000000..c2a04dd0358d Binary files /dev/null and b/toolchain/diagnostics/fuzzer_corpus/fe1d8f4a7d9cee164e834e54da75c7bf004c51ba differ diff --git a/toolchain/diagnostics/kind.def b/toolchain/diagnostics/kind.def index 42d923ba838a..c0c9e7894c16 100644 --- a/toolchain/diagnostics/kind.def +++ b/toolchain/diagnostics/kind.def @@ -89,7 +89,6 @@ CARBON_DIAGNOSTIC_KIND(UnsupportedCrLineEnding) CARBON_DIAGNOSTIC_KIND(UnsupportedLfCrLineEnding) CARBON_DIAGNOSTIC_KIND(UnmatchedOpening) CARBON_DIAGNOSTIC_KIND(UnmatchedClosing) -CARBON_DIAGNOSTIC_KIND(PossiblyMissingBracketHere) CARBON_DIAGNOSTIC_KIND(UnrecognizedCharacters) CARBON_DIAGNOSTIC_KIND(UnterminatedString) CARBON_DIAGNOSTIC_KIND(WrongRealLiteralExponent) @@ -166,8 +165,6 @@ CARBON_DIAGNOSTIC_KIND(UnexpectedTokenInMatchCasesBlock) CARBON_DIAGNOSTIC_KIND(UnreachableMatchCase) // Package-related diagnostics. -CARBON_DIAGNOSTIC_KIND(FirstDecl) -CARBON_DIAGNOSTIC_KIND(FirstNonCommentLine) CARBON_DIAGNOSTIC_KIND(PackageTooLate) CARBON_DIAGNOSTIC_KIND(ImportTooLate) CARBON_DIAGNOSTIC_KIND(ExpectedIdentifierAfterPackage) @@ -210,7 +207,6 @@ CARBON_DIAGNOSTIC_KIND(ExpectedRequirementOperator) CARBON_DIAGNOSTIC_KIND(RequirementEqualAfterNonDesignator) CARBON_DIAGNOSTIC_KIND(InvalidWhereInsideBinding) CARBON_DIAGNOSTIC_KIND(NestedWhereInsideWhere) -CARBON_DIAGNOSTIC_KIND(NestedWhereInsideWhereOuterNote) // ============================================================================ // Semantics diagnostics @@ -219,14 +215,6 @@ CARBON_DIAGNOSTIC_KIND(NestedWhereInsideWhereOuterNote) CARBON_DIAGNOSTIC_KIND(SemanticsTodo) // Location context. -CARBON_DIAGNOSTIC_KIND(InImport) -CARBON_DIAGNOSTIC_KIND(InCppInclude) -CARBON_DIAGNOSTIC_KIND(InCppModule) -CARBON_DIAGNOSTIC_KIND(InCppMacroExpansion) -CARBON_DIAGNOSTIC_KIND(ResolvingSpecificHere) -CARBON_DIAGNOSTIC_KIND(InCallToEvalFn) -CARBON_DIAGNOSTIC_KIND(InCppThunk) -CARBON_DIAGNOSTIC_KIND(InCppFunctionPointerThunk) // Package/import checking diagnostics. CARBON_DIAGNOSTIC_KIND(CppInteropFuzzing) @@ -234,10 +222,9 @@ CARBON_DIAGNOSTIC_KIND(CppInteropDriverError) CARBON_DIAGNOSTIC_KIND(CppInteropDriverWarning) CARBON_DIAGNOSTIC_KIND(CppInteropParseError) CARBON_DIAGNOSTIC_KIND(CppInteropParseWarning) -CARBON_DIAGNOSTIC_KIND(CppInteropParseNote) +CARBON_DIAGNOSTIC_KIND(CppInteropStrayNote) CARBON_DIAGNOSTIC_KIND(InlineImportNotCpp) CARBON_DIAGNOSTIC_KIND(IncorrectExtension) -CARBON_DIAGNOSTIC_KIND(IncorrectExtensionImplNote) CARBON_DIAGNOSTIC_KIND(DuplicateLibraryApi) CARBON_DIAGNOSTIC_KIND(DuplicateMainApi) CARBON_DIAGNOSTIC_KIND(LibraryApiNotFound) @@ -252,32 +239,23 @@ CARBON_DIAGNOSTIC_KIND(ImportCurrentPackageByName) CARBON_DIAGNOSTIC_KIND(ImportSelf) CARBON_DIAGNOSTIC_KIND(ExplicitImportApi) CARBON_DIAGNOSTIC_KIND(RepeatedImport) -CARBON_DIAGNOSTIC_KIND(FirstImported) CARBON_DIAGNOSTIC_KIND(ExportFromImpl) CARBON_DIAGNOSTIC_KIND(MissingOwningDeclarationInApi) CARBON_DIAGNOSTIC_KIND(MissingDefinitionInImpl) CARBON_DIAGNOSTIC_KIND(MissingGenericFunctionDefinition) -CARBON_DIAGNOSTIC_KIND(MissingGenericFunctionDefinitionHere) // Merge-related redeclaration checking. -CARBON_DIAGNOSTIC_KIND(RedeclPrevDecl) CARBON_DIAGNOSTIC_KIND(RedeclRedundant) -CARBON_DIAGNOSTIC_KIND(RedeclPrevDef) CARBON_DIAGNOSTIC_KIND(RedeclRedef) CARBON_DIAGNOSTIC_KIND(RedeclExternMismatch) CARBON_DIAGNOSTIC_KIND(RedeclImportedImpl) CARBON_DIAGNOSTIC_KIND(RedeclParamListDiffers) -CARBON_DIAGNOSTIC_KIND(RedeclParamListPrevious) CARBON_DIAGNOSTIC_KIND(RedeclParamCountDiffers) -CARBON_DIAGNOSTIC_KIND(RedeclParamCountPrevious) CARBON_DIAGNOSTIC_KIND(RedeclParamDiffers) CARBON_DIAGNOSTIC_KIND(RedeclParamDiffersType) -CARBON_DIAGNOSTIC_KIND(RedeclParamPrevious) CARBON_DIAGNOSTIC_KIND(RedeclParamSyntaxDiffers) -CARBON_DIAGNOSTIC_KIND(RedeclParamSyntaxPrevious) CARBON_DIAGNOSTIC_KIND(ExternLibraryInImporter) CARBON_DIAGNOSTIC_KIND(ExternLibraryIncorrect) -CARBON_DIAGNOSTIC_KIND(ExternLibraryExpected) CARBON_DIAGNOSTIC_KIND(ExternRequiresDeclInApiFile) // Namespace checking. @@ -291,13 +269,8 @@ CARBON_DIAGNOSTIC_KIND(CppCallArgTypeNotSupported) CARBON_DIAGNOSTIC_KIND(CppCallFieldNameNotSupported) CARBON_DIAGNOSTIC_KIND(GenericParamMustBeConstant) CARBON_DIAGNOSTIC_KIND(ImplictParamMustBeConstant) -CARBON_DIAGNOSTIC_KIND(VarParamIsRuntime) -CARBON_DIAGNOSTIC_KIND(IncompleteReturnTypeHere) -CARBON_DIAGNOSTIC_KIND(InCallToEntity) -CARBON_DIAGNOSTIC_KIND(InCallToFunctionParam) CARBON_DIAGNOSTIC_KIND(RefParamNoRefTag) CARBON_DIAGNOSTIC_KIND(RefTagNoRefParam) -CARBON_DIAGNOSTIC_KIND(ReturnTypeDeducedFromDefinition) CARBON_DIAGNOSTIC_KIND(SelfParameterNotAllowed) CARBON_DIAGNOSTIC_KIND(ValueForRefParam) @@ -308,33 +281,24 @@ CARBON_DIAGNOSTIC_KIND(DeducedReturnTypeRedecl) CARBON_DIAGNOSTIC_KIND(DefinedAbstractFunction) CARBON_DIAGNOSTIC_KIND(FunctionRedeclReturnTypeDiffers) CARBON_DIAGNOSTIC_KIND(FunctionRedeclReturnTypeDiffersNoReturn) -CARBON_DIAGNOSTIC_KIND(FunctionRedeclReturnTypePrevious) -CARBON_DIAGNOSTIC_KIND(FunctionRedeclReturnTypePreviousNoReturn) CARBON_DIAGNOSTIC_KIND(FunctionRedeclEvaluationModeDiffers) -CARBON_DIAGNOSTIC_KIND(FunctionRedeclEvaluationModePrevious) CARBON_DIAGNOSTIC_KIND(InvalidMainRunParameters) CARBON_DIAGNOSTIC_KIND(InvalidMainRunReturnType) CARBON_DIAGNOSTIC_KIND(MissingReturnStatement) CARBON_DIAGNOSTIC_KIND(UnknownBuiltinFunctionName) CARBON_DIAGNOSTIC_KIND(InvalidBuiltinSignature) -CARBON_DIAGNOSTIC_KIND(ThunkSignature) -CARBON_DIAGNOSTIC_KIND(ThunkCallee) // Class checking. CARBON_DIAGNOSTIC_KIND(AdaptDeclRepeated) CARBON_DIAGNOSTIC_KIND(AdaptWithBase) CARBON_DIAGNOSTIC_KIND(AdaptWithFields) CARBON_DIAGNOSTIC_KIND(AdaptWithVirtual) -CARBON_DIAGNOSTIC_KIND(AdaptWithBaseHere) -CARBON_DIAGNOSTIC_KIND(AdaptWithFieldHere) -CARBON_DIAGNOSTIC_KIND(AdaptWithVirtualHere) CARBON_DIAGNOSTIC_KIND(BaseDeclRepeated) CARBON_DIAGNOSTIC_KIND(BaseIsFinal) CARBON_DIAGNOSTIC_KIND(BaseMissingExtend) CARBON_DIAGNOSTIC_KIND(BaseDeclAfterFieldDecl) CARBON_DIAGNOSTIC_KIND(ClassAbstractHere) CARBON_DIAGNOSTIC_KIND(ClassSpecificDeclOutsideClass) -CARBON_DIAGNOSTIC_KIND(ClassSpecificDeclPrevious) CARBON_DIAGNOSTIC_KIND(ClassForwardDeclaredHere) CARBON_DIAGNOSTIC_KIND(ClassIncompleteWithinDefinition) CARBON_DIAGNOSTIC_KIND(FieldNamedUnderscore) @@ -344,23 +308,17 @@ CARBON_DIAGNOSTIC_KIND(FriendNotNameScope) CARBON_DIAGNOSTIC_KIND(GenericVirtual) CARBON_DIAGNOSTIC_KIND(OverrideWithoutBase) CARBON_DIAGNOSTIC_KIND(OverrideWithoutVirtualInBase) -CARBON_DIAGNOSTIC_KIND(OverrideCandidateArityMismatch) CARBON_DIAGNOSTIC_KIND(VirtualWithoutSelf) // Deduction. CARBON_DIAGNOSTIC_KIND(DeductionIncomplete) CARBON_DIAGNOSTIC_KIND(DeductionInconsistent) -CARBON_DIAGNOSTIC_KIND(DeductionGenericHere) -CARBON_DIAGNOSTIC_KIND(InitializingGenericParam) -CARBON_DIAGNOSTIC_KIND(SubstitutingGenericParamType) CARBON_DIAGNOSTIC_KIND(CompTimeArgumentNotConstant) CARBON_DIAGNOSTIC_KIND(RuntimeConversionDuringCompTimeDeduction) // Export checking. CARBON_DIAGNOSTIC_KIND(ExportNotImportedEntity) -CARBON_DIAGNOSTIC_KIND(ExportNotImportedEntitySource) CARBON_DIAGNOSTIC_KIND(ExportRedundant) -CARBON_DIAGNOSTIC_KIND(ExportPrevious) // Interface checking. CARBON_DIAGNOSTIC_KIND(InterfaceForwardDeclaredHere) @@ -368,22 +326,16 @@ CARBON_DIAGNOSTIC_KIND(InterfaceIncompleteWithinDefinition) // MatchFirst checking. CARBON_DIAGNOSTIC_KIND(MatchFirstInWrongScope) -CARBON_DIAGNOSTIC_KIND(MatchFirstInWrongScopeNote) // Named constraint checking. CARBON_DIAGNOSTIC_KIND(NamedConstraintForwardDeclaredHere) CARBON_DIAGNOSTIC_KIND(NamedConstraintIncompleteWithinDefinition) // Impl checking. -CARBON_DIAGNOSTIC_KIND(AssociatedConstantHere) -CARBON_DIAGNOSTIC_KIND(AssociatedFunctionHere) -CARBON_DIAGNOSTIC_KIND(ExtendImplAsIncomplete) CARBON_DIAGNOSTIC_KIND(ExtendImplForall) CARBON_DIAGNOSTIC_KIND(ExtendImplOutsideClass) CARBON_DIAGNOSTIC_KIND(ExtendImplSelfAs) -CARBON_DIAGNOSTIC_KIND(ExtendImplSelfAsDefault) CARBON_DIAGNOSTIC_KIND(ImplAccessMemberBeforeSet) -CARBON_DIAGNOSTIC_KIND(ImplAsIncompleteFacetTypeDefinition) CARBON_DIAGNOSTIC_KIND(ImplAsNonFacetType) CARBON_DIAGNOSTIC_KIND(ImplAsOutsideClass) CARBON_DIAGNOSTIC_KIND(ImplAssociatedConstantNeedsValue) @@ -391,47 +343,32 @@ CARBON_DIAGNOSTIC_KIND(ImplDeclInInvalidScope) CARBON_DIAGNOSTIC_KIND(ImplFinalFunction) CARBON_DIAGNOSTIC_KIND(ImplFunctionWithNonFunction) CARBON_DIAGNOSTIC_KIND(ImplInTwoMatchFirst) -CARBON_DIAGNOSTIC_KIND(ImplInTwoMatchFirstNote) CARBON_DIAGNOSTIC_KIND(ImplIsOrphan) CARBON_DIAGNOSTIC_KIND(ImplMissingDefinition) CARBON_DIAGNOSTIC_KIND(ImplMissingFunction) -CARBON_DIAGNOSTIC_KIND(ImplPreviousDefinition) CARBON_DIAGNOSTIC_KIND(ImplRedefinition) -CARBON_DIAGNOSTIC_KIND(ImplOfUnidentifiedFacetType) CARBON_DIAGNOSTIC_KIND(ImplOfNotOneInterface) CARBON_DIAGNOSTIC_KIND(ImplUnusedBinding) CARBON_DIAGNOSTIC_KIND(PoisonedImplLookupCustomResult) -CARBON_DIAGNOSTIC_KIND(PoisonedImplLookupCustomResultNoteBadImpl) CARBON_DIAGNOSTIC_KIND(PoisonedImplLookupConcreteResult) -CARBON_DIAGNOSTIC_KIND(PoisonedImplLookupConcreteResultNoteBadImpl) -CARBON_DIAGNOSTIC_KIND(PoisonedImplLookupConcreteResultNotePreviousImpl) CARBON_DIAGNOSTIC_KIND(ImplFinalOverlapsNonFinal) -CARBON_DIAGNOSTIC_KIND(ImplFinalOverlapsNonFinalNote) CARBON_DIAGNOSTIC_KIND(ImplNonFinalSameTypeStructure) -CARBON_DIAGNOSTIC_KIND(ImplNonFinalSameTypeStructureNote) CARBON_DIAGNOSTIC_KIND(FinalImplInMatchFirst) -CARBON_DIAGNOSTIC_KIND(FinalImplInMatchFirstNote) CARBON_DIAGNOSTIC_KIND(FinalImplInvalidFile) CARBON_DIAGNOSTIC_KIND(FinalImplOverlapsSameFile) -CARBON_DIAGNOSTIC_KIND(FinalImplOverlapsSameFileNote) CARBON_DIAGNOSTIC_KIND(FinalImplOverlapsDifferentFile) -CARBON_DIAGNOSTIC_KIND(FinalImplOverlapsDifferentFileNote) // Impl lookup. CARBON_DIAGNOSTIC_KIND(MissingImplInMemberAccess) CARBON_DIAGNOSTIC_KIND(MissingImplInMemberAccessInContext) CARBON_DIAGNOSTIC_KIND(ImplLookupCycle) -CARBON_DIAGNOSTIC_KIND(ImplLookupCycleNote) -CARBON_DIAGNOSTIC_KIND(ImplLookupInUnidentifiedFacetType) // Require checking. CARBON_DIAGNOSTIC_KIND(RequireImplsExtendWithExplicitSelf) CARBON_DIAGNOSTIC_KIND(RequireImplsMissingFacetType) CARBON_DIAGNOSTIC_KIND(RequireImplsMissingSelf) CARBON_DIAGNOSTIC_KIND(RequireImplsMissingSelfEmptyFacetType) -CARBON_DIAGNOSTIC_KIND(RequireImplsIncompleteFacetType) CARBON_DIAGNOSTIC_KIND(RequireImplsReferenceCycle) -CARBON_DIAGNOSTIC_KIND(RequireImplsUnidentifiedFacetType) CARBON_DIAGNOSTIC_KIND(IdentifiedRequireImplsNotEquivalent) CARBON_DIAGNOSTIC_KIND(IdentifiedRequireImplsNotImplemented) CARBON_DIAGNOSTIC_KIND(InterfaceRequireImplsNotImplemented) @@ -445,28 +382,18 @@ CARBON_DIAGNOSTIC_KIND(ExpectedInitializerAfterLet) // Qualified declaration name checking. CARBON_DIAGNOSTIC_KIND(QualifiedDeclOutsidePackage) -CARBON_DIAGNOSTIC_KIND(QualifiedDeclOutsidePackageSource) CARBON_DIAGNOSTIC_KIND(QualifiedDeclOutsideScopeEntity) -CARBON_DIAGNOSTIC_KIND(QualifiedDeclInIncompleteClassScope) -CARBON_DIAGNOSTIC_KIND(QualifiedDeclInUndefinedInterfaceScope) // Name lookup. CARBON_DIAGNOSTIC_KIND(InCppMacroEvaluation) -CARBON_DIAGNOSTIC_KIND(InCppNameLookup) -CARBON_DIAGNOSTIC_KIND(InNameLookup) -CARBON_DIAGNOSTIC_KIND(IncompleteOperandTypeInCppOperatorLookup) CARBON_DIAGNOSTIC_KIND(NameAmbiguousDueToExtend) CARBON_DIAGNOSTIC_KIND(NameNotFound) CARBON_DIAGNOSTIC_KIND(MemberNameNotFound) CARBON_DIAGNOSTIC_KIND(MemberNameNotFoundInInstScope) CARBON_DIAGNOSTIC_KIND(MemberNameNotFoundInSpecificScope) -CARBON_DIAGNOSTIC_KIND(NoPeriodSelfForDesignator) CARBON_DIAGNOSTIC_KIND(UsedBeforeInitialization) -CARBON_DIAGNOSTIC_KIND(AbstractTypeInAdaptDecl) -CARBON_DIAGNOSTIC_KIND(AbstractTypeInFunctionReturnType) CARBON_DIAGNOSTIC_KIND(AbstractTypeInInit) -CARBON_DIAGNOSTIC_KIND(AbstractTypeInVarPattern) CARBON_DIAGNOSTIC_KIND(AddrOfNonRef) CARBON_DIAGNOSTIC_KIND(ArrayBoundTooLarge) CARBON_DIAGNOSTIC_KIND(ArrayBoundNegative) @@ -486,31 +413,15 @@ CARBON_DIAGNOSTIC_KIND(CompileTimeShiftNegative) CARBON_DIAGNOSTIC_KIND(CompileTimeShiftOutOfRange) CARBON_DIAGNOSTIC_KIND(CompileTimeUnsizedShiftOutOfRange) CARBON_DIAGNOSTIC_KIND(ContinueOutsideLoop) -CARBON_DIAGNOSTIC_KIND(CopyOfUncopyableType) CARBON_DIAGNOSTIC_KIND(CoreNameNotFound) CARBON_DIAGNOSTIC_KIND(CoreNotFound) CARBON_DIAGNOSTIC_KIND(DerefOfNonPointer) -CARBON_DIAGNOSTIC_KIND(DerefOfType) CARBON_DIAGNOSTIC_KIND(CompoundMemberAccessDoesNotUseBase) CARBON_DIAGNOSTIC_KIND(EvalRequiresConstantValue) CARBON_DIAGNOSTIC_KIND(FormExprEvaluationFailure) CARBON_DIAGNOSTIC_KIND(NameDeclDuplicate) -CARBON_DIAGNOSTIC_KIND(NameDeclPrevious) CARBON_DIAGNOSTIC_KIND(NameUseBeforeDecl) -CARBON_DIAGNOSTIC_KIND(NameUseBeforeDeclNote) CARBON_DIAGNOSTIC_KIND(RepeatedConst) -CARBON_DIAGNOSTIC_KIND(IncompleteTypeInAdaptDecl) -CARBON_DIAGNOSTIC_KIND(IncompleteTypeInBaseDecl) -CARBON_DIAGNOSTIC_KIND(IncompleteTypeInBindingDecl) -CARBON_DIAGNOSTIC_KIND(IncompleteTypeInConversion) -CARBON_DIAGNOSTIC_KIND(IncompleteTypeInCopyWitness) -CARBON_DIAGNOSTIC_KIND(IncompleteTypeInFunctionParam) -CARBON_DIAGNOSTIC_KIND(IncompleteTypeInFunctionReturnType) -CARBON_DIAGNOSTIC_KIND(IncompleteTypeInMonomorphization) -CARBON_DIAGNOSTIC_KIND(IncompleteTypeInMemberAccess) -CARBON_DIAGNOSTIC_KIND(IncompleteTypeInMemberAccessOfFacet) -CARBON_DIAGNOSTIC_KIND(IncompleteTypeInValueConversion) -CARBON_DIAGNOSTIC_KIND(InCopy) CARBON_DIAGNOSTIC_KIND(CharTooLargeForType) CARBON_DIAGNOSTIC_KIND(InvalidCharLiteralValue) CARBON_DIAGNOSTIC_KIND(InvalidCharLiteralArithmeticResult) @@ -532,60 +443,44 @@ CARBON_DIAGNOSTIC_KIND(InvalidArrayExpr) CARBON_DIAGNOSTIC_KIND(NegativeIntInUnsignedType) CARBON_DIAGNOSTIC_KIND(NonConstantCallToCompTimeOnlyFunction) CARBON_DIAGNOSTIC_KIND(NonRegularBindingInVarDecl) -CARBON_DIAGNOSTIC_KIND(CompTimeOnlyFunctionHere) CARBON_DIAGNOSTIC_KIND(SelfOutsideParamList) CARBON_DIAGNOSTIC_KIND(SelfInImplicitParamList) CARBON_DIAGNOSTIC_KIND(SelfNotFirstParam) CARBON_DIAGNOSTIC_KIND(StringAtIndexOutOfBounds) CARBON_DIAGNOSTIC_KIND(StringAtIndexNegative) CARBON_DIAGNOSTIC_KIND(StringLiteralTooLong) -CARBON_DIAGNOSTIC_KIND(StringLiteralTypeIncomplete) CARBON_DIAGNOSTIC_KIND(StringLiteralTypeUnexpected) CARBON_DIAGNOSTIC_KIND(StructInitMissingFieldInLiteral) CARBON_DIAGNOSTIC_KIND(StructInitMissingFieldInConversion) CARBON_DIAGNOSTIC_KIND(StructInitUnexpectedFieldInLiteral) CARBON_DIAGNOSTIC_KIND(StructInitUnexpectedFieldInConversion) CARBON_DIAGNOSTIC_KIND(StructNameDuplicate) -CARBON_DIAGNOSTIC_KIND(StructNamePrevious) CARBON_DIAGNOSTIC_KIND(TupleIndexNotConstant) CARBON_DIAGNOSTIC_KIND(TupleIndexOnANonTupleType) CARBON_DIAGNOSTIC_KIND(TupleIndexOutOfBounds) CARBON_DIAGNOSTIC_KIND(TupleInitElementCountMismatch) CARBON_DIAGNOSTIC_KIND(PartialOnFinal) CARBON_DIAGNOSTIC_KIND(PeriodSelfInNonFacetType) -CARBON_DIAGNOSTIC_KIND(ReturnedVarHere) CARBON_DIAGNOSTIC_KIND(ReturnedVarNotInit) CARBON_DIAGNOSTIC_KIND(ReturnedVarShadowed) CARBON_DIAGNOSTIC_KIND(ReturnedVarWithNoReturnType) CARBON_DIAGNOSTIC_KIND(ReturnedVarWrongType) CARBON_DIAGNOSTIC_KIND(ReturnExprWithReturnedVar) -CARBON_DIAGNOSTIC_KIND(ReturnFormHereNote) CARBON_DIAGNOSTIC_KIND(ReturnVarWithNoReturnedVar) CARBON_DIAGNOSTIC_KIND(ReturnStatementDisallowExpr) -CARBON_DIAGNOSTIC_KIND(ReturnTypeHereNote) -CARBON_DIAGNOSTIC_KIND(ReturnTypeOmittedNote) CARBON_DIAGNOSTIC_KIND(ReturnStatementMissingExpr) CARBON_DIAGNOSTIC_KIND(DeducedReturnTypeMismatch) -CARBON_DIAGNOSTIC_KIND(DeducedReturnTypeMismatchPrevious) CARBON_DIAGNOSTIC_KIND(DeducedReturnTypeWithoutReturn) -CARBON_DIAGNOSTIC_KIND(ReturnTypeDeducedAs) -CARBON_DIAGNOSTIC_KIND(ReturnTypeIsDeducedNote) -CARBON_DIAGNOSTIC_KIND(ConversionFailure) -CARBON_DIAGNOSTIC_KIND(ConversionFailureNonTypeToFacet) CARBON_DIAGNOSTIC_KIND(ConversionFailureFacetToFacet) CARBON_DIAGNOSTIC_KIND(ConversionFailureTypeToFacet) CARBON_DIAGNOSTIC_KIND(ConversionFailureNonRefToRef) CARBON_DIAGNOSTIC_KIND(TypeExprEvaluationFailure) CARBON_DIAGNOSTIC_KIND(UnexpectedDeclNameParams) CARBON_DIAGNOSTIC_KIND(QualifiedNameInNonScope) -CARBON_DIAGNOSTIC_KIND(QualifiedNameNonScopeEntity) -CARBON_DIAGNOSTIC_KIND(QualifiedExprInIncompleteClassScope) -CARBON_DIAGNOSTIC_KIND(QualifiedExprInIncompleteFacetTypeScope) CARBON_DIAGNOSTIC_KIND(QualifiedExprUnsupported) CARBON_DIAGNOSTIC_KIND(QualifiedExprNameNotFound) CARBON_DIAGNOSTIC_KIND(UseOfNonExprAsValue) CARBON_DIAGNOSTIC_KIND(ExportedFunctionPtrTypeMismatch) -CARBON_DIAGNOSTIC_KIND(ExportedFromFunction) // Modifier checking. CARBON_DIAGNOSTIC_KIND(ModifierNotAllowedOnDeclaration) @@ -598,11 +493,9 @@ CARBON_DIAGNOSTIC_KIND(ModifierRequiresClass) CARBON_DIAGNOSTIC_KIND(ModifierRequiresInterface) CARBON_DIAGNOSTIC_KIND(ModifierExternNotAllowed) CARBON_DIAGNOSTIC_KIND(ModifierFinalRequiresDefaultImpl) -CARBON_DIAGNOSTIC_KIND(ModifierNotInContext) CARBON_DIAGNOSTIC_KIND(ModifierRepeated) CARBON_DIAGNOSTIC_KIND(ModifierNotAllowedWith) CARBON_DIAGNOSTIC_KIND(ModifierMustAppearBefore) -CARBON_DIAGNOSTIC_KIND(ModifierPrevious) CARBON_DIAGNOSTIC_KIND(ExternLibraryOnDefinition) CARBON_DIAGNOSTIC_KIND(ExternLibraryIsCurrentLibrary) @@ -610,7 +503,6 @@ CARBON_DIAGNOSTIC_KIND(ExternLibraryIsCurrentLibrary) CARBON_DIAGNOSTIC_KIND(ModifierNotAllowedOnOperator) // Access modifiers. -CARBON_DIAGNOSTIC_KIND(ClassMemberDeclaration) CARBON_DIAGNOSTIC_KIND(ClassInvalidMemberAccess) // Alias diagnostics. @@ -635,15 +527,12 @@ CARBON_DIAGNOSTIC_KIND(GenericMissingExplicitParameters) // Pattern matching diagnostics. CARBON_DIAGNOSTIC_KIND(RequiredPatternDefaultValueMissing) -CARBON_DIAGNOSTIC_KIND(RequiredPatternDefaultValueFirstDefault) -CARBON_DIAGNOSTIC_KIND(RequiredPatternDefaultValueMissingAdditional) CARBON_DIAGNOSTIC_KIND(PatternDefaultValueNotConstant) CARBON_DIAGNOSTIC_KIND(PatternDefaultValueNotInParameterList) CARBON_DIAGNOSTIC_KIND(TuplePatternSizeDoesntMatchLiteral) // Unused diagnostics. CARBON_DIAGNOSTIC_KIND(UnusedButUsed) -CARBON_DIAGNOSTIC_KIND(UnusedButUsedHere) CARBON_DIAGNOSTIC_KIND(UnusedModifierWithoutDefinition) CARBON_DIAGNOSTIC_KIND(UnusedPatternNoBindings) CARBON_DIAGNOSTIC_KIND(UnusedBinding) @@ -680,11 +569,6 @@ CARBON_DIAGNOSTIC_KIND(LanguageServerDiagnosticInWrongFile) // TestDiagnostic is only for unit tests. CARBON_DIAGNOSTIC_KIND(TestDiagnostic) -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/kind.h b/toolchain/diagnostics/kind.h index 69dc0d6b0475..edba7c490b37 100644 --- a/toolchain/diagnostics/kind.h +++ b/toolchain/diagnostics/kind.h @@ -20,7 +20,7 @@ CARBON_DEFINE_RAW_ENUM_CLASS(Kind, uint16_t) { // An enumeration of all diagnostics provided by the toolchain. Diagnostics must // be added to kind.def, and defined locally to where they're used using the -// `DIAGNOSTIC` macro in emitter.h. +// `CARBON_DIAGNOSTIC` macro in diagnostic.h. // // Diagnostic definitions are decentralized because placing all diagnostic // definitions centrally is expected to create a compilation bottleneck @@ -35,7 +35,7 @@ class Kind : public CARBON_ENUM_BASE(Kind) { #define CARBON_DIAGNOSTIC_KIND(Name) CARBON_ENUM_CONSTANT_DEFINITION(Kind, Name) #include "toolchain/diagnostics/kind.def" -// We expect Kind to fit into 2 bits. +// We expect Kind to fit into 2 bytes. static_assert(sizeof(Kind) == 2, "Kind includes padding!"); } // namespace Carbon::Diagnostics diff --git a/toolchain/diagnostics/mocks.cpp b/toolchain/diagnostics/mocks.cpp index c303c934a553..6bbead7bb858 100644 --- a/toolchain/diagnostics/mocks.cpp +++ b/toolchain/diagnostics/mocks.cpp @@ -11,28 +11,25 @@ namespace Carbon::Diagnostics { auto PrintTo(const Diagnostic& diagnostic, std::ostream* os) -> void { *os << "Diagnostic{"; PrintTo(diagnostic.level, os); - for (const auto& message : diagnostic.messages) { - *os << ", {" << message.loc.filename << ":" << message.loc.line_number - << ":" << message.loc.column_number << ", \"" << message.Format() - << "}"; + const Loc& loc = diagnostic.message.loc; + *os << ", {" << loc.filename << ":" << loc.line_number << ":" + << loc.column_number << ", \"" << diagnostic.message.Format() << "\"}"; + for (const auto& context : diagnostic.contexts) { + *os << ", {Context " << context.loc.filename << ":" + << context.loc.line_number << ":" << context.loc.column_number << ", \"" + << context.Format() << "\"}"; } - *os << "\"}"; + for (const auto& label : diagnostic.labels) { + *os << ", {"; + PrintTo(label.category, os); + *os << " " << label.loc.filename << ":" << label.loc.line_number << ":" + << label.loc.column_number << ", \"" << label.Format() << "\"}"; + } + *os << "}"; } auto PrintTo(Level level, std::ostream* os) -> void { switch (level) { - case Level::LocationInfo: - *os << "LocationInfo"; - break; - case Level::Note: - *os << "Note"; - break; - case Level::SoftContext: - *os << "SoftContext"; - break; - case Level::Context: - *os << "Context"; - break; case Level::Warning: *os << "Warning"; break; @@ -42,4 +39,15 @@ auto PrintTo(Level level, std::ostream* os) -> void { } } +auto PrintTo(LabelCategory category, std::ostream* os) -> void { + switch (category) { + case LabelCategory::Info: + *os << "Info"; + break; + case LabelCategory::Primary: + *os << "Primary"; + break; + } +} + } // namespace Carbon::Diagnostics diff --git a/toolchain/diagnostics/mocks.h b/toolchain/diagnostics/mocks.h index 9d87e36ce7ee..c21dc57609cf 100644 --- a/toolchain/diagnostics/mocks.h +++ b/toolchain/diagnostics/mocks.h @@ -24,6 +24,32 @@ MATCHER_P(IsDiagnosticsMessageString, matcher, "") { result_listener); } +// NOLINTNEXTLINE(modernize-use-trailing-return-type): From the macro. +MATCHER_P(IsDiagnosticsLabelString, matcher, "") { + const Diagnostics::Label& label = arg; + return testing::ExplainMatchResult(matcher, label.Format(), result_listener); +} + +// NOLINTNEXTLINE(modernize-use-trailing-return-type): From the macro. +MATCHER_P(IsDiagnosticsContextString, matcher, "") { + const Diagnostics::Context& context = arg; + return testing::ExplainMatchResult(matcher, context.Format(), + result_listener); +} + +// Matches the location fields both a message and a label carry. +template +auto IsAtLoc(testing::Matcher line_number, + testing::Matcher column_number) -> testing::Matcher { + using testing::AllOf; + using testing::Field; + return Field( + &T::loc, + AllOf(Field("line_number", &Diagnostics::Loc::line_number, line_number), + Field("column_number", &Diagnostics::Loc::column_number, + column_number))); +} + inline auto IsDiagnosticMessage(testing::Matcher kind, testing::Matcher level, testing::Matcher line_number, @@ -32,24 +58,44 @@ inline auto IsDiagnosticMessage(testing::Matcher kind, -> testing::Matcher { using testing::AllOf; using testing::Field; - return AllOf( - Field("kind", &Diagnostics::Message::kind, kind), - Field("level", &Diagnostics::Message::level, level), - Field(&Diagnostics::Message::loc, - AllOf(Field("line_number", &Diagnostics::Loc::line_number, - line_number), - Field("column_number", &Diagnostics::Loc::column_number, - column_number))), - IsDiagnosticsMessageString(message)); + return AllOf(Field("kind", &Diagnostics::Message::kind, kind), + Field("level", &Diagnostics::Message::level, level), + IsAtLoc(line_number, column_number), + IsDiagnosticsMessageString(message)); +} + +inline auto IsDiagnosticLabel( + testing::Matcher category, + testing::Matcher line_number, testing::Matcher column_number, + testing::Matcher text) + -> testing::Matcher { + using testing::AllOf; + using testing::Field; + return AllOf(Field("category", &Diagnostics::Label::category, category), + IsAtLoc(line_number, column_number), + IsDiagnosticsLabelString(text)); +} + +inline auto IsDiagnosticContext(testing::Matcher line_number, + testing::Matcher column_number, + testing::Matcher text) + -> testing::Matcher { + return testing::AllOf( + IsAtLoc(line_number, column_number), + IsDiagnosticsContextString(text)); } inline auto IsDiagnostic( testing::Matcher level, - testing::Matcher> elements) + testing::Matcher message, + testing::Matcher> contexts, + testing::Matcher> labels) -> testing::Matcher { return testing::AllOf( testing::Field("level", &Diagnostics::Diagnostic::level, level), - testing::Field("messages", &Diagnostics::Diagnostic::messages, elements)); + testing::Field("message", &Diagnostics::Diagnostic::message, message), + testing::Field("contexts", &Diagnostics::Diagnostic::contexts, contexts), + testing::Field("labels", &Diagnostics::Diagnostic::labels, labels)); } inline auto IsSingleDiagnostic(testing::Matcher kind, @@ -59,8 +105,9 @@ inline auto IsSingleDiagnostic(testing::Matcher kind, testing::Matcher message) -> testing::Matcher { return IsDiagnostic( - level, testing::ElementsAre(IsDiagnosticMessage(kind, level, line_number, - column_number, message))); + level, + IsDiagnosticMessage(kind, level, line_number, column_number, message), + testing::IsEmpty(), testing::IsEmpty()); } } // namespace Carbon::Testing @@ -70,6 +117,7 @@ namespace Carbon::Diagnostics { // Printing helpers for tests. auto PrintTo(const Diagnostic& diagnostic, std::ostream* os) -> void; auto PrintTo(Level level, std::ostream* os) -> void; +auto PrintTo(LabelCategory category, std::ostream* os) -> void; } // namespace Carbon::Diagnostics diff --git a/toolchain/diagnostics/renderer.cpp b/toolchain/diagnostics/renderer.cpp new file mode 100644 index 000000000000..58ce49969cc2 --- /dev/null +++ b/toolchain/diagnostics/renderer.cpp @@ -0,0 +1,2112 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include "toolchain/diagnostics/renderer.h" + +#include +#include +#include + +#include "common/check.h" +#include "common/terminal/buffer.h" +#include "common/terminal/color.h" +#include "common/terminal/metrics.h" +#include "common/terminal/style.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/Sequence.h" +#include "llvm/ADT/SmallPtrSet.h" +#include "llvm/ADT/SmallString.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/ADT/Twine.h" + +namespace Carbon::Diagnostics { + +using Terminal::AnsiColor; +using Terminal::Buffer; +using Terminal::Charset; +using Terminal::LineEnd; +using Terminal::Metrics; +using Terminal::Style; + +// The columns from the frame to the content beside it: the frame itself, and +// the stub next to it that a source row leaves blank. +static constexpr int FrameToContentWidth = 2; + +// Points at the lines the problem is on -- every line holding a range that is +// part of it -- from the margin outside the line numbers. A merged snippet can +// open on some other line, so without this there is nothing saying which lines +// the problem is actually on. +// +// Two ASCII characters rather than one of the arrows, which all read better and +// none of which measure reliably: they are East Asian Ambiguous, so a font may +// draw one across two columns while the width tables call it one, and a +// terminal falling back to such a font pushes the whole row over or clips the +// glyph. This is two columns because it is two characters, so nothing can +// disagree about it, and a font with programming ligatures draws it as an arrow +// anyway. +static constexpr llvm::StringLiteral LineMark = "->"; + +// The columns the mark spends before the line numbers. No space after it: the +// numbers are right-aligned in a field of their own, so a number shorter than +// that field already leaves a gap, and a number filling it is the widest there +// is to keep the mark off. +static constexpr int MarginWidth = LineMark.size(); + +// The columns an anchor spends before the location it names: `╭─┤ `. +static constexpr int AnchorPrefixWidth = 4; + +// The columns a connector spends before what it reaches: three of line, and +// then either a space or, where it reaches a label, the bar framing it. +static constexpr int ConnectorWidth = 4; + +// The columns the bar framing a label's left side spends before its text: +// `┤ `. The bar runs down every row the label takes, so that what belongs to +// the label is bounded rather than left to be inferred from indentation. +static constexpr int LabelFrameWidth = 2; + +// The columns between a label's anchor and its text: the connector reaching +// the bar that frames it, and the bar's own space before the words. +static constexpr int LabelIndentWidth = ConnectorWidth - 1 + LabelFrameWidth; + +// The columns a rule bracketing a snippet reaches across, starting at the +// frame. Long enough to read as a divider rather than as another branch off the +// frame, which is what the connector on a context row looks like. +static constexpr int SnippetRuleWidth = 13; + +// The columns of source a diagnostic aims to show: the width code is formatted +// to, so a formatted line is shown whole and nothing wider is asked for than +// that needs. A line longer than this is windowed, the way one longer than the +// terminal is. +static constexpr int FormattedSourceColumns = 80; + +// The columns a line number is given in the gutter, so that the frame runs +// down one column for every diagnostic in a file under ten thousand lines +// rather than stepping with each number's digits, at a cost of at most three +// columns on the smallest files. A number needing more still fits -- the frame +// moves right and the source is squeezed by the difference -- so the width +// laid out against is the same whatever line a diagnostic lands on. +static constexpr int LineNumberColumns = 4; + +// The most bytes one drawn string may hold. Nothing legitimate comes near it: +// it exists so that pathological input -- a generated file with one enormous +// line, or a message argument holding one -- degrades by truncation instead of +// hitting a limit the terminal buffer CHECKs. It bounds both the bytes of a +// single draw and, through the rows a wrapped string of this many bytes takes, +// the height a handful of them can reach, so it stays well under the buffer's +// row limit. +static constexpr size_t MaxDrawnBytes = 1 << 16; + +// Columns between tab stops, matching what a terminal does with a tab. +static constexpr int SourceTabWidth = 8; + +// What marks each end of a source line that windowing elided. +static constexpr llvm::StringLiteral WindowMarker = "..."; + +// The fewest columns of source a window shows, however narrow the terminal +// is. +static constexpr int MinWindowColumns = 16; + +// The most lines shown rather than elided between two spans in one file. One +// line of context is worth as much as the row saying it was skipped. +static constexpr int MaxShownGap = 1; + +// The fewest columns a framed diagnostic is drawn in, below which the compact +// form is used instead. A frame, its gutter, and a label hanging off a span +// need room before any of them say anything, and past some point there isn't +// enough to be worth spending on structure. Low enough that a terminal narrow +// enough to hit it is one a label would route on anyway. +// +// Where that point is, is a guess. It is not derived from anything, and no +// layout depends on the number being right -- a terminal one column either side +// of it gets a rendering that works. Move it if it turns out to be wrong. +static constexpr int MinFrameColumns = 60; + +// Returns the word naming `level`, including its separator. +static auto LevelText(Level level) -> llvm::StringRef { + switch (level) { + case Level::Error: + return "error: "; + case Level::Warning: + return "warning: "; + } +} + +// Returns the style the marks under the source take, which is the color of +// whatever they belong to without its weight. Bold reaches the line-drawing +// glyphs unevenly -- several terminals leave them alone and others only +// brighten them -- so the weight says nothing reliable there while it still +// says something on words. +static auto MarkStyle(const Style& style) -> Style { return style.Bold(false); } + +// The colors one theme is drawn in: what a diagnostic of that level, or the +// notes explaining one, take for their words and for the marks under the source +// that belong to them. +// +// The second is the theme's own color, which a range alone on its line takes. +// Where several share a line, the whole ramp is handed out left to right +// starting at the dark end, so a color always says which theme a range belongs +// to and only then which range it is. +using Theme = llvm::ArrayRef; + +// The themes for a terminal that renders 24-bit color, where the colors are +// ours to choose and are chosen together. +// +// Each theme is a ramp handed out left to right across the ranges on a line: +// darker, the theme's own color, lighter. The three centers sit at one +// lightness, so the level a diagnostic is reported at is said by hue and by the +// word rather than by how loud it is, and lightness varies only inside a theme, +// where a step says "a different range" rather than "a more important one". +// +// There are two palettes because a color picked to read against black is hard +// to read against white. Which is used follows `Capabilities::background`. +// +// See /toolchain/docs/diagnostics_rendering.md#the-palette for where these +// values came from and the distances and contrast ratios they satisfy. Changing +// one means checking it against those, not against how it looks on a swatch: +// these are drawn as marks a pixel tall. +static constexpr Terminal::Color DarkBgErrorTheme[] = { + {0xb5, 0x56, 0x00}, {0xff, 0x72, 0x61}, {0xff, 0xbc, 0xc8}}; +static constexpr Terminal::Color DarkBgWarningTheme[] = { + {0x51, 0x86, 0x00}, {0xac, 0xac, 0x00}, {0xff, 0xc9, 0x21}}; +static constexpr Terminal::Color DarkBgNoteTheme[] = { + {0x00, 0x82, 0x9a}, {0x00, 0xbc, 0xbc}, {0x00, 0xf3, 0xc6}}; + +static constexpr Terminal::Color LightBgErrorTheme[] = { + {0x80, 0x35, 0x00}, {0xd0, 0x00, 0x00}, {0xff, 0x28, 0x6a}}; +static constexpr Terminal::Color LightBgWarningTheme[] = { + {0x3d, 0x59, 0x00}, {0x73, 0x73, 0x00}, {0xad, 0x8c, 0x00}}; +static constexpr Terminal::Color LightBgNoteTheme[] = { + {0x00, 0x59, 0x67}, {0x00, 0x7f, 0x7f}, {0x00, 0xa7, 0x8e}}; + +// The themes for a terminal with only the 16 named colors, which renders them +// through the user's own palette. Their appearance is not ours to choose, so +// these say only which entry to use and let the user's theme decide the rest -- +// including which background it goes with, which is why these don't vary with +// it. +// +// Each is a ramp of two rather than three, the plain entry and then the bright +// one, because there is nowhere for a longer one to go. Downsampling the 24-bit +// colors instead would be worse than stopping at two: two of them land on +// `BrightBlack` and on `White`, which are not that theme or any other. Which +// theme a range belongs to is worth more than telling two ranges of one theme +// apart, so a ramp runs out and repeats rather than reaching outside its theme. +static constexpr Terminal::Color NamedErrorTheme[] = {AnsiColor::Red, + AnsiColor::BrightRed}; +static constexpr Terminal::Color NamedWarningTheme[] = { + AnsiColor::Yellow, AnsiColor::BrightYellow}; +static constexpr Terminal::Color NamedNoteTheme[] = {AnsiColor::Cyan, + AnsiColor::BrightCyan}; + +// Returns whether `capabilities` renders colors chosen here rather than the +// user's. +// +// `Ansi256` is on this side of the line because rounding to its cube keeps +// every theme's three colors distinct and keeps two colors of different themes +// far enough apart to read as different themes -- comfortably so on a dark +// background, and closer on a light one, where an error and a warning range +// sharing a line is the arrangement to watch. `Ansi16` keeps neither, which is +// why it has a table of its own -- and why the background makes no difference +// there, since a named color is drawn from a palette the user chose to go with +// their background. +static auto HasChosenColors(const Terminal::Capabilities& capabilities) + -> bool { + return capabilities.color_mode == Terminal::ColorMode::Ansi256 || + capabilities.color_mode == Terminal::ColorMode::Truecolor; +} + +// Returns whether the chosen colors should be the ones for a light background. +static auto WantsLightBackground(const Terminal::Capabilities& capabilities) + -> bool { + return capabilities.background == Terminal::Background::Light; +} + +// Returns the theme a diagnostic at `level` is drawn in. +static auto LevelTheme(Level level, const Terminal::Capabilities& capabilities) + -> Theme { + bool light = WantsLightBackground(capabilities); + if (!HasChosenColors(capabilities)) { + return level == Level::Error ? Theme(NamedErrorTheme) + : Theme(NamedWarningTheme); + } + switch (level) { + case Level::Error: + return light ? Theme(LightBgErrorTheme) : Theme(DarkBgErrorTheme); + case Level::Warning: + return light ? Theme(LightBgWarningTheme) : Theme(DarkBgWarningTheme); + } +} + +// Returns the theme anything explaining a diagnostic is drawn in. +static auto ExplanationTheme(const Terminal::Capabilities& capabilities) + -> Theme { + if (!HasChosenColors(capabilities)) { + return Theme(NamedNoteTheme); + } + return WantsLightBackground(capabilities) ? Theme(LightBgNoteTheme) + : Theme(DarkBgNoteTheme); +} + +// The place in a theme's ramp that is the theme's own color, which its words +// are drawn in and which a range takes when it is the only one of its theme on +// a line. Every ramp puts it second, so a ramp of two runs up to it and a ramp +// of three runs through it. +static constexpr int ThemeCenter = 1; + +// Returns the style a theme's words are drawn in. Also the color of the +// underline beneath the source that belongs to it, so that a mark and the +// sentence explaining it look like one thing. +static auto ThemeStyle(Theme theme) -> Style { + return Style().Bold().Foreground(theme[ThemeCenter]); +} + +// The word leading anything that explains the message rather than stating it. +static constexpr llvm::StringRef ExplanationText = "note: "; + +// The style of the frame and the line numbers beside it. Not dim, which several +// terminals ignore, leaving the frame as prominent as the code inside it. +static auto FrameStyle() -> Style { + return Style().Bold().Foreground(AnsiColor::BrightBlue); +} + +// The style of the diagnostic kind, which is only present under a flag and is +// never the thing being read. +static auto KindStyle() -> Style { return Style().Dim(); } + +// The style of location information, which says how the code below it was +// reached rather than anything about the code itself. Dim so that a reader who +// already knows the path can skip it, and unlike the frame nothing is lost on a +// terminal that ignores dim. It covers the whole row, quoted code included. +static auto ContextStyle() -> Style { return Style().Dim(); } + +namespace { + +// The glyphs that vary with the character set. +// +// Everything else the frame is made of comes from `Terminal::Buffer`'s line +// drawing, which picks its own glyphs and forms the corners and tees where +// lines meet. +struct Glyphs { + // Marks a row that annotates source rather than being source, so that which + // rows are the reader's code is visible at a glance. + char32_t annotation; + // Marks where lines of source were skipped. + char32_t elision; + + static auto For(Charset charset) -> Glyphs { + if (charset == Charset::Utf8) { + return {.annotation = U'·', .elision = U'┆'}; + } + // An ASCII terminal has one broken bar to spend on both the annotation and + // the elision. A row holding nothing but the bar is an elision; one with an + // underline after it is not. + return {.annotation = U':', .elision = U':'}; + } +}; + +} // namespace + +// Returns whether a terminal decoding `charset` draws `byte` as itself. +static auto IsPrintable(Charset charset, char byte) -> bool { + auto value = static_cast(byte); + if (charset == Charset::Ascii) { + // A terminal decoding some single-byte encoding renders anything outside + // printable ASCII as something, and there is no telling what. + return value >= 0x20 && value < 0x7f; + } + // Everything else goes to the buffer, which decodes UTF-8 and replaces what + // has no rendering of its own. + return value >= 0x20 && value != 0x7f; +} + +namespace { + +// A count of bytes into a source line, as against a column on screen. +// +// A `Loc` gives its span as byte offsets -- `column_number` counts bytes +// despite its name, and Clang's land inside multi-byte characters -- while +// everything drawn is placed by column. The two count the same line and +// neither follows from the other, so this keeps them from being taken for each +// other in the one place both are in scope. Columns stay `int`, which is what +// `Terminal::Buffer` addresses its grid with, so what this marks is the count +// that is not a coordinate. +// +// TODO: Move this out of this file, and use it for the byte counts elsewhere +// that are called columns, starting with `Loc::column_number`. +class Bytes { + public: + Bytes() = default; + explicit constexpr Bytes(int count) : count_(count) {} + + constexpr auto count() const -> int { return count_; } + + constexpr auto operator+(Bytes rhs) const -> Bytes { + return Bytes(count_ + rhs.count_); + } + constexpr auto operator-(Bytes rhs) const -> Bytes { + return Bytes(count_ - rhs.count_); + } + constexpr auto operator++() -> Bytes& { + ++count_; + return *this; + } + constexpr auto operator--() -> Bytes& { + --count_; + return *this; + } + + friend auto operator<=>(Bytes, Bytes) = default; + friend auto operator==(Bytes, Bytes) -> bool = default; + + private: + int count_ = 0; +}; + +} // namespace + +namespace Internal { + +// A source line prepared for drawing, and where a part's span lands in it. +// +// The text has tabs expanded and bytes with no rendering escaped, so that the +// columns measured against it are the columns a terminal will use. +struct PreparedSource { + std::string text; + int span_start = 0; + int span_length = 1; + + // Returns the columns the source and its underline occupy together. The + // underline can reach one column further, when a span starts past the end of + // the line it names. + auto Width(Metrics metrics) const -> int { + return std::max(metrics.Width(text), span_start + span_length); + } + + // The column a label's connector runs down, which layout sets to whichever + // end of the span the label attaches to. Until then it is the middle, which + // is what a span with no label of its own is measured from. + int anchor = 0; + + // Where the underline stops at each end. Layout sets an end to `Center` when + // another range begins or ends in the next column, so that the two marks + // don't run together; an end with nothing beside it covers its whole column. + LineEnd left_end = LineEnd::Edge; + LineEnd right_end = LineEnd::Edge; + + // Whether the label's connector is drawn in place of the underline rather + // than hanging off it. A mark of one column with an end pulled in has no + // junction to offer, and the line down its column says the column is marked + // without saying the mark carries on anywhere. + bool connector_stands_in = false; + + // Returns whether the underline covers `column` at all. + auto Covers(int column) const -> bool { + return column >= span_start && column < span_start + span_length; + } + + // Returns whether the underline runs out through the left or the right side + // of `column`. An end pulled in to clear the range beside it gives up the + // side it was pulled in on, which is the side a connector could not tee into. + auto ReachesLeftOf(int column) const -> bool { + return Covers(column) && (column > span_start || left_end == LineEnd::Edge); + } + auto ReachesRightOf(int column) const -> bool { + return Covers(column) && (column < span_start + span_length - 1 || + right_end == LineEnd::Edge); + } + + // Returns whether any column of the underline runs out through both of its + // sides, which is what a connector needs one to do to tee into it. + auto Joinable() const -> bool { + if (span_length == 1) { + return left_end == LineEnd::Edge && right_end == LineEnd::Edge; + } + return span_length > 2 || left_end == LineEnd::Edge || + right_end == LineEnd::Edge; + } +}; + +// What a part of a diagnostic is to the reader, which is what decides how it +// is drawn. +enum class Part : int8_t { + // A step in the path by which the part after it was reached. + LocationInfo, + // Something read against the code to explain the problem rather than to + // state it: a label, or the message itself once a context is stating the + // problem in its place. + Explanation, + // The problem itself: whatever leads the diagnostic, and the source that is + // directly part of it. + Problem, +}; + +// A part of a diagnostic prepared for drawing. +struct PreparedPart { + // What this is to the reader. + Part role = Part::Explanation; + + // Whether this part's range came from the message's own location rather than + // from a range attached to the diagnostic. Only the message has one. + // + // Every diagnostic marks at least one range as part of the problem. Where one + // was attached, it says where the problem is better than the message's + // location does, and this range gives way to it: a range containing the + // location hosts the message's words, and one that doesn't leaves the message + // marking nothing of its own. + bool from_message_loc = false; + + // The word leading this part's text, including its separator, and empty for + // location information, which leads with its own words instead. + llvm::StringRef level_text; + + // The style of that word and of this part's text. + Style style; + + // The style of the underline under this part's source, and of the connector + // and bar of the label hanging off it. The rotation moves this along the + // theme's ramp, which is why it is not `style`: the level word, the mark + // in the margin, and the line number beside the reported line all say what + // the diagnostic is, so where a range sits on a line must not recolor them. + Style mark_style; + + // `file:line:column`, with unknown parts left off, and empty for a part + // with no location at all. + std::string location; + + // The last byte column of the range starting at `location`, or 0 for a + // range of one column or of unknown extent. The compact form appends it to + // the location as `-`, which is all it has to say the extent with; the + // framed form says it with the underline instead. + int32_t location_end_column = 0; + + // The part's words when they go on a row of their own: the headline, and any + // part with no source to hang them against. Empty when they hang as a label. + std::string text; + + // The part's words when they hang against the source it marks, which is any + // part that has source and isn't the headline. Empty otherwise. + std::string label; + + // ` [Kind]`, or empty when kinds aren't being included. It goes at the end + // of the last row carrying the part's words, so that a test matching on it + // always finds it last, and so that a part drawn on two rows doesn't get it + // twice. + std::string kind_suffix; + + // Returns the suffix for a row, which is empty unless that row is the last + // one carrying this part's words. + auto KindSuffixOn(bool is_label_row) const -> llvm::StringRef { + return is_label_row == label.empty() ? llvm::StringRef() : kind_suffix; + } + + // The source and its span. Only meaningful when `has_source` is set. + PreparedSource source; + bool has_source = false; + + // Where the source came from, for grouping spans that share a file and for + // finding the lines between two of them. + llvm::StringRef file; + llvm::StringRef file_text; + llvm::StringRef raw_line; + int line_number = 0; +}; + +} // namespace Internal + +using Internal::Part; +using Internal::PreparedPart; +using Internal::PreparedSource; + +// Returns `style` recolored for the `index`th of `count` ranges of `theme` on a +// line, keeping everything about it except which color it is. +// +// Several ranges walk the ramp from its dark end, so that reading left to right +// reads as a progression. A range with no others of its theme beside it takes +// the theme's own color instead, so that it matches the words it belongs to. +static auto RotatedStyle(const Style& style, Theme theme, int index, int count) + -> Style { + if (count == 1) { + return style.Foreground(theme[ThemeCenter]); + } + return style.Foreground(theme[index % theme.size()]); +} + +namespace { + +// How a label's connector meets the underline it hangs from. +enum class Attachment : int8_t { + // Tees into the underline where it hangs from. Line drawing forms the + // junction the same way it forms the frame's own. + Tee, + // Stands in for the mark, in the one column it had, because the underline + // offers no column to tee into: a mark that stops at a cell's center to + // clear the range beside it would form a corner there, and a corner reads as + // a mark turning rather than as one a connector leaves. + Through, +}; + +// Where a label's connector meets its underline, and the column it runs down. +struct Placement { + Attachment attachment; + int anchor; +}; + +// A row of the rendering, laid out before anything is measured or drawn. +struct Row { + enum class Kind : int8_t { + // A message on a row of its own, inside the frame. + Message, + // The location the snippet below it comes from. + Anchor, + // A line of source, with its number beside the frame. + Source, + // The underline marking a span in the source above. + Annotation, + // The text hanging off that underline, framed by a bar the underline's + // connector reaches. + Label, + // A label that wouldn't fit hanging off its span, out-dented to the column + // the source starts in with its own frame reaching back to the span. + RoutedLabel, + // A stand-in for lines of source that were skipped. + Elision, + // Nothing but the frame, setting a snippet off from the anchor above it. + Gap, + // The rule closing off one snippet before the next begins. + Separator, + // How the location in the anchor below it was reached. + Context, + }; + + Kind kind; + // The part this row belongs to, or null for a row that draws only frame and + // for a source line shown between two spans. + const PreparedPart* part = nullptr; + // `Annotation` rows: every span underlined, widest first, which is the order + // they are drawn in so that the narrowest mark on a column is what shows. + llvm::SmallVector spans; + // `Source` rows: the part whose style the margin mark and line number + // take, set on every line holding a range that is part of the problem, and + // null on every other line. + const PreparedPart* points_here = nullptr; + // `Source` rows: the number to draw, or -1 when there is none to show. + int line_number = -1; + // `Source` rows: the text. + std::string text; +}; + +} // namespace + +// Returns whether `byte` continues a UTF-8 symbol that started before it. +static auto IsContinuation(char byte) -> bool { + return (static_cast(byte) & 0xc0) == 0x80; +} + +// Returns `line` with tabs expanded and unrenderable bytes escaped, along with +// where the span of `span_bytes` bytes at `column` lands in the result. +// +// TODO: Highlight the source's syntax. `PreparedSource` holds plain text, so +// this needs it to hold styled runs. +static auto PrepareSource(Metrics metrics, llvm::StringRef line, + Bytes span_byte, Bytes span_bytes) -> PreparedSource { + Charset charset = metrics.charset(); + // A file written on Windows carries the carriage return into the line, and + // drawing it would put a `<0D>` on the end of every snippet row. + line.consume_back("\r"); + // Windowing bounds what is shown by columns, not bytes, so a line of nothing + // but combining marks could otherwise carry any number of bytes through it. + // This bound also keeps the byte counts below inside `int`. + line = line.take_front(MaxDrawnBytes); + auto size = Bytes(line.size()); + + // `span_byte` is one-based, as `Loc::column_number` is. A span can name a + // token that isn't in the line at all, at the end of a file for example, so + // it is clamped rather than trusted: a renderer must never be the reason a + // compiler dies while reporting a problem. + Bytes span_begin = std::clamp(span_byte - Bytes(1), Bytes(0), size); + // Adding the length to the start would overflow for a length this doesn't + // expect, so it is clamped to what is left of the line first. + Bytes span_end = + span_begin + std::min(std::max(span_bytes, Bytes(1)), size - span_begin); + + // An offset that names a byte inside a symbol, which Clang's do, would split + // it and leave the run before it measured as loose bytes. + if (charset == Charset::Utf8) { + // A span starting where the line ends names no byte to walk back from, as a + // token synthesized by error recovery past the end of a line does. + while (span_begin > Bytes(0) && span_begin < size && + IsContinuation(line[span_begin.count()])) { + --span_begin; + } + while (span_end < size && IsContinuation(line[span_end.count()])) { + ++span_end; + } + } + + PreparedSource result; + int cursor = 0; + int start_column = 0; + int end_column = 0; + Bytes run_begin; + for (Bytes at;; ++at) { + bool at_span = at == span_begin || at == span_end; + bool rewritten = at < size && !IsPrintable(charset, line[at.count()]); + if (at < size && !at_span && !rewritten) { + continue; + } + + // Flush the run of bytes drawn as themselves. Measuring the run rather than + // everything so far is what keeps this linear, and is valid because a run + // only ever ends on a byte that starts a symbol. + llvm::StringRef run = + line.substr(run_begin.count(), (at - run_begin).count()); + result.text.append(run.begin(), run.end()); + cursor += metrics.Width(run); + run_begin = at; + + if (at == span_begin) { + start_column = cursor; + } + if (at == span_end) { + end_column = cursor; + } + if (at == size) { + break; + } + if (!rewritten) { + continue; + } + + if (line[at.count()] == '\t') { + int width = SourceTabWidth - cursor % SourceTabWidth; + result.text.append(width, ' '); + cursor += width; + } else { + // TODO: Draw an escaped byte in a style of its own, such as a background + // color, so that it can't be mistaken for the same characters written in + // the source. This needs the styled runs that syntax highlighting does. + auto value = static_cast(line[at.count()]); + result.text += '<'; + result.text += llvm::hexdigit(value >> 4); + result.text += llvm::hexdigit(value & 0xf); + result.text += '>'; + cursor += 4; + } + run_begin = at + Bytes(1); + } + + result.span_start = start_column; + result.span_length = std::max(end_column - start_column, 1); + result.anchor = result.span_start + result.span_length / 2; + return result; +} + +// Narrows `source` to `columns` around `focus`, marking each end that was +// elided. +// +// A source line and its underline that wrap onto different rows lose the +// alignment between them, which is the whole point of a snippet, so a line too +// wide for the terminal is elided rather than left to wrap. +// +// `focus` is the column the window is kept around, which is a span's own start +// unless several spans share one source row, in which case they must all be +// given the same one or their underlines land in different windows. +static auto WindowSource(Metrics metrics, PreparedSource& source, int columns, + int focus) -> void { + // The width includes the column past the text that a span starting at the + // end of the line is drawn in, so a line that exactly fills the columns is + // still windowed to bring that mark inside them. + int width = source.Width(metrics); + if (width <= columns) { + return; + } + + // Both markers are accounted for whether or not both are needed, so that how + // much source a window shows doesn't depend on where in the line it lands. + auto marker_width = static_cast(WindowMarker.size()); + int inner = std::max(columns - 2 * marker_width, MinWindowColumns); + int begin = std::clamp(focus - inner / 4, 0, std::max(width - inner, 0)); + + // The text is walked rather than indexed, so no byte offset into it is ever + // held next to a column. What is dropped from the front is measured from what + // was really taken, which can be a column short of what was asked for when a + // double-width symbol straddles the boundary; measuring from the column asked + // for would let the window keep that symbol's other column and come out a + // column wider than it is allowed. + llvm::StringRef rest = source.text; + llvm::StringRef before = metrics.TakeColumns(rest, begin); + int dropped = metrics.Width(before); + llvm::StringRef window = metrics.TakeColumns(rest, inner); + + std::string text; + int shift = 0; + if (!before.empty()) { + text.append(WindowMarker.begin(), WindowMarker.end()); + shift = marker_width; + } + text.append(window.begin(), window.end()); + if (!rest.empty()) { + text.append(WindowMarker.begin(), WindowMarker.end()); + } + + // Both ends of the span move by what was really dropped from in front of it, + // and each is clamped into the window's own columns. Clamping the ends rather + // than carrying the length is what keeps a span the window clipped short -- + // one windowed around another span on its row, off one edge -- from + // underlining the source that took its place: what was clipped away is not + // marked. Every column is drawable and none is past the last cell, so the + // mark stays a mark and never reaches past the grid. + int visible = metrics.Width(text); + int offset = shift - dropped; + int old_end = source.span_start + source.span_length; + source.span_start = + std::clamp(source.span_start + offset, 0, std::min(visible, columns - 1)); + int span_end = std::clamp(old_end + offset, source.span_start + 1, columns); + source.span_length = span_end - source.span_start; + source.anchor = source.span_start + source.span_length / 2; + source.text = std::move(text); +} + +// Returns line `number` of the file `part`'s source came from, or a null +// reference when there is no way to find it. A line that is genuinely empty +// still comes back as an empty reference over real data. +static auto LineFromFile(const PreparedPart& part, int number) + -> llvm::StringRef { + llvm::StringRef file = part.file_text; + if (file.empty() || part.raw_line.empty() || number <= part.line_number) { + return llvm::StringRef(); + } + // `Loc::line` is meant to be a slice of `Loc::file_text`, which lets this + // walk forward from it rather than counting from the top of the file. A `Loc` + // is a plain aggregate that anything can fill in, so that is checked rather + // than assumed. + const char* line = part.raw_line.data(); + if (line < file.begin() || line >= file.end()) { + return llvm::StringRef(); + } + size_t offset = line - file.begin(); + for (auto _ : llvm::seq(part.line_number, number)) { + size_t newline = file.find('\n', offset); + if (newline == llvm::StringRef::npos) { + return llvm::StringRef(); + } + offset = newline + 1; + } + return file.substr(offset).take_until([](char c) { return c == '\n'; }); +} + +// Returns a part of a diagnostic prepared for drawing: `text` said at `loc`, +// drawn as `role` says and named `name` where kinds are being included. +// +// `is_headline` says that the words lead the diagnostic, so they go on the +// headline row rather than against the source they point at. +static auto PreparePart(Metrics metrics, Part role, bool from_message_loc, + llvm::StringRef level_text, Style style, const Loc& loc, + std::string text, llvm::StringRef name, + bool is_headline, bool include_kind) -> PreparedPart { + // Text past any legitimate size is truncated rather than handed to the + // buffer, whose own limit on a single draw is a CHECK; nothing a diagnostic + // says comes near either bound. + if (text.size() > MaxDrawnBytes) { + text.resize(MaxDrawnBytes); + } + + PreparedPart result = { + .role = role, + .from_message_loc = from_message_loc, + .level_text = level_text, + .style = style, + .mark_style = MarkStyle(style), + .location = FormatLocation(loc), + .location_end_column = loc.column_number > 0 && loc.length > 1 + ? loc.column_number + loc.length - 1 + : 0, + .file = loc.filename, + .file_text = loc.file_text, + .raw_line = loc.line, + .line_number = loc.line_number}; + + // Location information says how a place was reached rather than pointing at + // code itself, so it never gets a snippet. + if (role != Part::LocationInfo && loc.column_number > 0) { + result.has_source = true; + result.source = PrepareSource(metrics, loc.line, Bytes(loc.column_number), + Bytes(loc.length)); + } + + // Words that lead the diagnostic go on its headline, and words with no source + // to point at have nowhere to go but a row of their own. Everything else is + // read against the code it marks. + if (is_headline || !result.has_source) { + result.text = std::move(text); + } else { + result.label = std::move(text); + } + + // Every row is one row: text carrying a newline would otherwise be measured + // as one column and drawn over the row below it. + for (std::string* row : {&result.text, &result.label}) { + for (char& c : *row) { + if (static_cast(c) < 0x20 || c == 0x7f) { + c = ' '; + } + } + } + // A label that scrubbed away to spaces has nothing to hang, and hanging it + // would spend rows and a connector on drawing nothing. It becomes what a + // label with no words is: a mark and nothing else. + if (result.label.find_first_not_of(' ') == std::string::npos) { + result.label.clear(); + } + + if (include_kind && !name.empty()) { + result.kind_suffix = (llvm::Twine(" [") + name + "]").str(); + } + return result; +} + +// Returns how `part`, which is location information, is spelled: what it says +// and then where, so that the words read as leading to the location. A part +// missing either half is just the other. +static auto ContextText(const PreparedPart& part) -> std::string { + if (part.location.empty()) { + return part.text; + } + if (part.text.empty()) { + return part.location; + } + return part.text + ": " + part.location; +} + +// Returns what a part drawn on a row of its own says. Location information +// that never found an anchor to lead into says where it is here instead. +static auto MessageRowText(const PreparedPart& part) -> std::string { + return part.role == Part::LocationInfo ? ContextText(part) : part.text; +} + +// Returns where `label`'s connector meets the underline it hangs from, and the +// column it runs down from there. +// +// The connector tees into the middle of the underline, which reads as pointing +// into the range rather than as running off an end of it, and slides left when +// the words don't fit -- but only as far as it has to, and never past where the +// range starts. Moving the connector is what a label gives up before it starts +// wrapping. +// +// An end pulled in to clear the range beside it has no junction to offer +// either, and a connector meeting one would form a corner, which reads as the +// underline turning down rather than as a line leaving it. So the connector +// steps a column away from that range, where the marks run out through both +// sides again. Where no column of its range does -- a single column, or two +// with a range on either side -- it takes a column instead of teeing into one, +// and the underline gives that column up to it. +// +// Whether a column offers a junction is asked of every mark on the row rather +// than of `against` alone, since a cell holds all of them together: a range +// drawn over this one covers what its own end gave up, and a connector meeting +// that reads as the tee it is drawn as. Asking only `against` would leave a +// connector running through a column another mark had filled, crossing it. +// +// `against` is what the connector leaves, which is the label's own range except +// for the message's: where a range drawn on the same row contains the message's +// location, the words belong to that range. +static auto PlaceLabel(Metrics metrics, const PreparedPart& label, + const PreparedSource& against, + llvm::ArrayRef spans, int content_x, + int columns) -> Placement { + int width = metrics.Width(label.label); + int middle = against.span_start + against.span_length / 2; + int anchor = middle; + if (content_x + anchor + LabelIndentWidth + width > columns) { + anchor = std::clamp(columns - content_x - LabelIndentWidth - width, + against.span_start, anchor); + } + auto tees_at = [&](int column) { + return against.Covers(column) && + llvm::any_of(spans, + [&](const PreparedPart* span) { + return span->source.ReachesLeftOf(column); + }) && + llvm::any_of(spans, [&](const PreparedPart* span) { + return span->source.ReachesRightOf(column); + }); + }; + if (tees_at(anchor)) { + return {Attachment::Tee, anchor}; + } + // Only an end fails to offer a junction, so the step is inward, away from the + // range that pulled that end in. + int step = anchor == against.span_start ? 1 : -1; + if (tees_at(anchor + step)) { + return {Attachment::Tee, anchor + step}; + } + // Nothing to tee into, so every label on this range takes the same column, + // which is the one the underline is measured from rather than wherever the + // words happened to have to start. + return {Attachment::Through, middle}; +} + +// Draws the mark under `span`, in source drawn from column `x`, on row `y`. +static auto DrawUnderline(Buffer& buffer, int x, int y, + const PreparedPart& span, const Style& style) + -> void { + // A connector with no column to tee into is drawn down the mark's own column + // in place of it. Only a mark of one column is ever left with none, so there + // is nothing of it to draw beside the line: an end gives up its half column + // only where the range can still carry its label without it. + if (span.source.connector_stands_in) { + return; + } + buffer.DrawHorizontalLine(x + span.source.span_start, y, + span.source.span_length, style, + span.source.left_end, span.source.right_end); +} + +// Returns the part whose range stands in for `message_part`'s own, or null when +// nothing does and the message marks where it points. +// +// A range attached as part of the problem says where the problem is in terms +// the reader can see, which the message's location -- a point, and often one +// chosen for an editor to put a cursor on rather than for anyone to look at -- +// does not. So a range marking the line that location names stands in for it +// entirely: the message marks nothing of its own, and whatever words it has +// left once a context leads the diagnostic hang from that range instead. +// +// It has to be that line. A range elsewhere says nothing about the code the +// location names, and taking its place would point the message's words at code +// they aren't about while dropping the line they are. +// +// The range containing the location is the one that takes it, since that is the +// one drawn over the column the location names. Failing that it is the first +// attached to the line, which is the one whose author put it first. +// +// `candidates` are the ranges drawn alongside the message's, which is what a +// range has to be to take its place: one drawn under an anchor of its own is +// read against the code below that one instead. +static auto FindMessageHost(llvm::ArrayRef candidates, + const PreparedPart& message_part) -> PreparedPart* { + PreparedPart* host = nullptr; + int column = message_part.source.span_start; + for (PreparedPart* candidate : candidates) { + if (candidate == &message_part || candidate->role != Part::Problem || + candidate->file != message_part.file || + candidate->line_number != message_part.line_number) { + continue; + } + const PreparedSource& source = candidate->source; + if (column >= source.span_start && + column < source.span_start + source.span_length) { + return candidate; + } + if (!host) { + host = candidate; + } + } + return host; +} + +// Recolors the marks of `spans`, which share one line, along their themes' +// ramps. Each theme counts its own way through its colors, left to right, so +// they run in the order the code they mark is read. +static auto RotateMarkStyles(llvm::ArrayRef spans, + Theme problem_theme, Theme explanation_theme) + -> void { + llvm::SmallVector across(spans); + llvm::stable_sort(across, + [](const PreparedPart* lhs, const PreparedPart* rhs) { + return lhs->source.span_start < rhs->source.span_start; + }); + int totals[2] = {0, 0}; + for (const PreparedPart* span : across) { + ++totals[span->role == Part::Problem]; + } + int counts[2] = {0, 0}; + for (PreparedPart* span : across) { + bool is_problem = span->role == Part::Problem; + int& count = counts[is_problem]; + span->mark_style = RotatedStyle( + span->mark_style, is_problem ? problem_theme : explanation_theme, + count++, totals[is_problem]); + } +} + +// Pulls in the ends of `spans` that touch another span on their line. +// +// Two ranges that touch have nothing between them to say where one ends and +// the next begins, so an end that meets one stops at the center of its cell +// rather than running out through the side. That leaves half a column of gap, +// and a full one where both ends give way. +// +// The gap is worth having but not worth paying for. An end gives way only +// where the range can still carry its label without it: two columns can spare +// one end but not both, since a connector needs a column the mark runs out +// through on both sides and after the left end gave way only the right one is +// left. Left is considered first, so the range that begins at a boundary is +// always the one that gives way there, and every boundary ends up with a gap. +// One column can spare neither end, and the accepted answer there is the line +// the connector leaves or a point where it has no connector. +static auto SeparateTouchingEnds( + llvm::ArrayRef spans, + const llvm::SmallPtrSetImpl& carries_label) -> void { + for (PreparedPart* span : spans) { + int span_end = span->source.span_start + span->source.span_length; + auto meets = [&](auto&& touches) { + return llvm::any_of(spans, [&](const PreparedPart* other) { + return other != span && touches(other->source); + }); + }; + if (meets([&](const PreparedSource& other) { + return other.span_start + other.span_length == + span->source.span_start; + })) { + span->source.left_end = LineEnd::Center; + } + if (meets([&](const PreparedSource& other) { + return other.span_start == span_end; + })) { + span->source.right_end = LineEnd::Center; + if (carries_label.contains(span) && span->source.span_length > 1 && + !span->source.Joinable()) { + span->source.right_end = LineEnd::Edge; + } + } + } +} + +// Sets each label's anchor to where its connector runs down, asked of the +// underline it hangs from against everything else marked on the line. +// +// `message_part` and `message_host` are as in `add_line` below: the message's +// words hang from the host's range when one has taken its place. +static auto PlaceLabels(Metrics metrics, llvm::ArrayRef labels, + const PreparedPart* message_part, + const PreparedPart* message_host, + llvm::ArrayRef spans, int content_x, + int columns) -> void { + for (PreparedPart* label : labels) { + const PreparedSource& against = label == message_part && message_host + ? message_host->source + : label->source; + Placement placement = + PlaceLabel(metrics, *label, against, spans, content_x, columns); + label->source.anchor = placement.anchor; + // A connector drawn in place of a mark is recorded on the range it stands + // in for, not on the label that asked for it -- and on every range drawn + // over exactly the same column, since a second mark there would be a half + // mark beside the connector rather than a stroke through it, which is the + // one thing that would leave a corner in the cell. + if (placement.attachment == Attachment::Through) { + for (PreparedPart* span : spans) { + if (span->source.span_start == against.span_start && + span->source.span_length == against.span_length) { + span->source.connector_stands_in = true; + } + } + } + } +} + +// Returns the spans on `line` that draw an underline: all of them, except +// `message_part` once `message_host` has taken its place. +// +// Everything marking the line goes on the one row below it, so that the marks +// read as marking that line rather than as a stack of rows each of which has to +// be traced back up to it. Ranges that overlap are drawn widest first, so the +// narrowest mark covering a column is the one that shows: a range containing +// another says less about the columns they share than the range inside it does, +// and a mark that is part of the problem says more than one that only explains +// it. +// +// Ranges shouldn't overlap in the first place -- one covering another means two +// parts of the diagnostic marking the same code -- but they are attached by +// layers that never see each other, so this repairs what it is given rather +// than checking a rule nothing is in a position to enforce. +static auto SpansWidestFirst(llvm::ArrayRef line, + const PreparedPart* message_part, + const PreparedPart* message_host) + -> llvm::SmallVector { + llvm::SmallVector spans; + for (PreparedPart* member : line) { + if (member != message_part || !message_host) { + spans.push_back(member); + } + } + llvm::stable_sort( + spans, [](const PreparedPart* lhs, const PreparedPart* rhs) { + if (lhs->source.span_length != rhs->source.span_length) { + return lhs->source.span_length > rhs->source.span_length; + } + return lhs->role < rhs->role; + }); + return spans; +} + +// Returns the parts whose words hang off `spans`, in the order of `spans`. +static auto LabelsHangingFrom(llvm::ArrayRef spans, + PreparedPart* message_part, + const PreparedPart* message_host) + -> llvm::SmallVector { + llvm::SmallVector labels; + for (PreparedPart* span : spans) { + if (!span->label.empty()) { + labels.push_back(span); + } + // A range standing in for the part's location hangs the part's own words + // from its underline alongside whatever it has to say itself. + if (span == message_host && !message_part->label.empty()) { + labels.push_back(message_part); + } + } + return labels; +} + +namespace { + +// Lays out the rows a diagnostic's frame holds, in the order they are drawn. +// +// `source_columns` bounds every source row: the lines shown between two spans +// as well as the spans' own, which are windowed here so that spans sharing a +// row share one view of their line. `buffer` is the one the rows will be drawn +// into, and is only measured against here: how far text wraps is its answer to +// give. +class RowLayout { + public: + RowLayout(const Buffer& buffer, llvm::MutableArrayRef parts, + int headline, Theme problem_theme, Theme explanation_theme, + int source_columns, int content_x, int columns); + + // Returns the rows, in the order they are drawn. + auto LayOut() && -> llvm::SmallVector; + + private: + // Adds the rows for `parts_[index]`: its own text, the anchor naming its + // location, and the snippet below that, which also shows the spans of the + // parts `TakeGroup` gathers with it. + auto AddBlock(size_t index) -> void; + + // Returns the spans shown under the anchor of `parts_[index]`: its own and + // every later span in the same file, shown as one view of it in source order + // with the lines between them elided. Each is marked as drawn. + auto TakeGroup(size_t index) -> llvm::SmallVector; + + // Adds the rows showing `group`'s source below its anchor, one line of + // source at a time. + auto AddSnippet(llvm::ArrayRef group, + PreparedPart* message_part, PreparedPart* message_host) + -> void; + + // Adds the lines of source between `previous`'s line and line `next`, or an + // elision standing in for them. + auto AddLinesBetween(const PreparedPart& previous, int next) -> void; + + // Adds the rows drawing the spans that fall on one source line: the line + // itself, the underlines beneath it, and the labels hanging off those. + // + // `message_part` is the range standing in for the part's own location, and + // `message_host` the attached range that has taken its place, in which case + // the part underlines nothing of its own and its words hang from the host. + auto AddLine(llvm::ArrayRef line, PreparedPart* message_part, + PreparedPart* message_host) -> void; + + // Adds a row for each of `labels`, below the underlines they hang off. + auto AddLabelRows(llvm::ArrayRef labels) -> void; + + // Adds `part`'s own text on a row of its own, which the drawing wraps into + // the column after the level word. + // + // TODO: No toolchain diagnostic should reach this: the goal is every part + // attached to a location that reaches source, with one genuinely about a + // file as a whole anchored at the file's start or end and drawn in a form of + // its own. That restructuring starts with the emitting diagnostics. + auto AddMessageRows(const PreparedPart& part) -> void; + + // Returns whether the last row added was part of a snippet, and so wants + // closing off before the next one starts. + auto InSnippet() const -> bool; + + const Buffer* buffer_; + Metrics metrics_; + llvm::MutableArrayRef parts_; + int headline_; + Theme problem_theme_; + Theme explanation_theme_; + int source_columns_; + int content_x_; + int columns_; + + // Whether a part has to open a block of its own rather than being merged + // into an earlier one: it has something to say on a row of its own, or there + // is location information above it that needs its anchor to lead into. + llvm::SmallVector opens_block_; + + // Whether each part's rows have been added. + llvm::SmallVector drawn_; + + // Location information waiting for the anchor it describes. + llvm::SmallVector context_; + + llvm::SmallVector rows_; +}; + +} // namespace + +RowLayout::RowLayout(const Buffer& buffer, + llvm::MutableArrayRef parts, int headline, + Theme problem_theme, Theme explanation_theme, + int source_columns, int content_x, int columns) + : buffer_(&buffer), + metrics_(buffer.metrics()), + parts_(parts), + headline_(headline), + problem_theme_(problem_theme), + explanation_theme_(explanation_theme), + source_columns_(source_columns), + content_x_(content_x), + columns_(columns), + opens_block_(parts.size(), false), + drawn_(parts.size(), false) { + bool context_pending = false; + for (auto [index, part] : llvm::enumerate(parts)) { + if (part.role == Part::LocationInfo) { + context_pending = true; + continue; + } + opens_block_[index] = + context_pending || + (static_cast(index) != headline && !part.text.empty()); + context_pending = false; + } +} + +auto RowLayout::LayOut() && -> llvm::SmallVector { + for (size_t index : llvm::seq(parts_.size())) { + if (!drawn_[index]) { + AddBlock(index); + } + } + for (const PreparedPart* reached_from : context_) { + AddMessageRows(*reached_from); + } + return std::move(rows_); +} + +auto RowLayout::AddBlock(size_t index) -> void { + drawn_[index] = true; + PreparedPart& part = parts_[index]; + bool is_headline = static_cast(index) == headline_; + + // Location information says how the location after it was reached, so it + // waits and is then drawn above that location's anchor. + if (part.role == Part::LocationInfo) { + context_.push_back(&part); + return; + } + + if (InSnippet()) { + rows_.push_back({.kind = Row::Kind::Separator}); + } + + if (!is_headline && !part.text.empty()) { + AddMessageRows(part); + } + // An anchor is drawn where a snippet follows it, so a part with no source + // to show gets none: its words go on a row of their own, and an anchor + // above them would lead nowhere. The headline is the exception -- its + // location is the diagnostic's, worth saying even when it names only a + // file, as for a diagnostic about a file rather than about code in one. + bool anchored = !part.location.empty() && (part.has_source || is_headline); + // Without an anchor below them there is nothing for the steps to lead into, + // so they say where they are on rows of their own instead. + for (const PreparedPart* reached_from : context_) { + if (anchored) { + rows_.push_back({.kind = Row::Kind::Context, .part = reached_from}); + } else { + AddMessageRows(*reached_from); + } + } + context_.clear(); + + llvm::SmallVector group = TakeGroup(index); + if (anchored) { + rows_.push_back({.kind = Row::Kind::Anchor, .part = &part}); + } + + // The spans shown under one anchor are the ones drawn alongside each other + // here, so the group is what a range has to be in to stand in for the + // part's location: a range under an anchor of its own is read against + // the code below that one instead. + PreparedPart* message_part = nullptr; + for (PreparedPart* member : group) { + if (member->from_message_loc) { + message_part = member; + break; + } + } + PreparedPart* message_host = + message_part ? FindMessageHost(group, *message_part) : nullptr; + if (message_host) { + // The part marks nothing of its own once something else has taken its + // place, so the line it named is not part of the snippet either -- unless + // an attached range is on it too. Leaving it in shows a line of source + // with nothing marking it, which reads as a line the reader is meant to + // find something in. + llvm::erase(group, message_part); + } + + AddSnippet(group, message_part, message_host); +} + +auto RowLayout::TakeGroup(size_t index) -> llvm::SmallVector { + const PreparedPart& part = parts_[index]; + llvm::SmallVector group; + if (!part.has_source) { + return group; + } + group.push_back(&parts_[index]); + for (size_t other : llvm::seq(index + 1, parts_.size())) { + if (!drawn_[other] && !opens_block_[other] && parts_[other].has_source && + parts_[other].file == part.file) { + drawn_[other] = true; + group.push_back(&parts_[other]); + } + } + llvm::stable_sort(group, + [](const PreparedPart* lhs, const PreparedPart* rhs) { + return lhs->line_number < rhs->line_number; + }); + return group; +} + +auto RowLayout::AddSnippet(llvm::ArrayRef group, + PreparedPart* message_part, + PreparedPart* message_host) -> void { + if (group.empty()) { + return; + } + + // A snippet always starts a row below its anchor, so that the code doesn't + // read as running on from the file name. Where the file goes on above the + // first line shown, that row says so instead. + int first_line = group.front()->line_number; + rows_.push_back( + {.kind = first_line > 1 ? Row::Kind::Elision : Row::Kind::Gap}); + + // Spans on one line are drawn together, against the one row that shows it. + const PreparedPart* previous = nullptr; + for (size_t begin = 0; begin < group.size();) { + size_t end = begin + 1; + while (end < group.size() && + group[end]->line_number == group[begin]->line_number) { + ++end; + } + if (previous) { + AddLinesBetween(*previous, group[begin]->line_number); + } + AddLine(group.slice(begin, end - begin), message_part, message_host); + previous = group[end - 1]; + begin = end; + } +} + +auto RowLayout::AddLinesBetween(const PreparedPart& previous, int next) + -> void { + if (next - previous.line_number - 1 > MaxShownGap) { + rows_.push_back({.kind = Row::Kind::Elision}); + return; + } + for (int number : llvm::seq(previous.line_number + 1, next)) { + llvm::StringRef line = LineFromFile(previous, number); + if (line.data() == nullptr) { + // Without the file there is no way to show what was skipped, and a blank + // row would claim the line is empty. + rows_.push_back({.kind = Row::Kind::Elision}); + continue; + } + PreparedSource shown = PrepareSource(metrics_, line, Bytes(1), Bytes(1)); + WindowSource(metrics_, shown, source_columns_, /*focus=*/0); + rows_.push_back({.kind = Row::Kind::Source, + .line_number = number, + .text = std::move(shown.text)}); + } +} + +auto RowLayout::AddLine(llvm::ArrayRef line, + PreparedPart* message_part, PreparedPart* message_host) + -> void { + // Spans sharing the row are windowed around the first of them: they share + // the one source row that shows their line, so windowing each around its + // own span would land their underlines in different views of it. Spans + // drawn on different rows never share a window, wherever in the file they + // are. + int focus = line.front()->source.span_start; + for (PreparedPart* member : line) { + WindowSource(metrics_, member->source, source_columns_, focus); + } + + llvm::SmallVector spans = + SpansWidestFirst(line, message_part, message_host); + RotateMarkStyles(spans, problem_theme_, explanation_theme_); + // The part's connector and bar follow the range hosting its words, so + // the rotation's choice for the host is copied after it is made. + if (message_host && llvm::is_contained(spans, message_host)) { + message_part->mark_style = message_host->mark_style; + } + + // The mark in the margin picks out the lines the problem is on, which is + // every line holding a range that is part of it. It is drawn in what the + // headline is drawn in, so that it reads as part of the same sentence. + bool marks_problem = llvm::any_of(spans, [](const PreparedPart* span) { + return span->role == Part::Problem; + }); + rows_.push_back({.kind = Row::Kind::Source, + .part = line.front(), + .points_here = marks_problem ? &parts_[headline_] : nullptr, + .line_number = line.front()->line_number, + .text = line.front()->source.text}); + + llvm::SmallVector labels = + LabelsHangingFrom(spans, message_part, message_host); + + // The ranges a connector will hang from, which is what decides whether a + // range can afford to give up half a column at an end. + llvm::SmallPtrSet carries_label; + for (PreparedPart* label : labels) { + carries_label.insert(label == message_part && message_host ? message_host + : label); + } + + SeparateTouchingEnds(spans, carries_label); + PlaceLabels(metrics_, labels, message_part, message_host, spans, content_x_, + columns_); + + // Right to left, so that each label's connector reaches across the ones + // already hanging rather than descending through them. + llvm::stable_sort(labels, + [](const PreparedPart* lhs, const PreparedPart* rhs) { + return lhs->source.anchor > rhs->source.anchor; + }); + + rows_.push_back( + {.kind = Row::Kind::Annotation, .spans = {spans.begin(), spans.end()}}); + AddLabelRows(labels); +} + +auto RowLayout::AddLabelRows(llvm::ArrayRef labels) -> void { + for (PreparedPart* label : labels) { + // A single unbreakable word can be wider than what is left to the right + // of where the label hangs, and hanging it there would push it out of the + // frame. Wrapping never breaks a word, so the widest one is the least + // width the label can be drawn in. Below that the label is out-dented to + // the column the source starts in, where the whole width is available, + // and the line reaching back to the connector is what says which range it + // belongs to. + bool routed = content_x_ + label->source.anchor + LabelIndentWidth + + buffer_->MeasureWrapWidth(label->label) > + columns_; + rows_.push_back({.kind = routed ? Row::Kind::RoutedLabel : Row::Kind::Label, + .part = label, + .text = label->label}); + } +} + +auto RowLayout::AddMessageRows(const PreparedPart& part) -> void { + rows_.push_back({.kind = Row::Kind::Message, + .part = &part, + .text = MessageRowText(part)}); +} + +auto RowLayout::InSnippet() const -> bool { + if (rows_.empty()) { + return false; + } + switch (rows_.back().kind) { + case Row::Kind::Source: + case Row::Kind::Annotation: + case Row::Kind::Label: + case Row::Kind::RoutedLabel: + case Row::Kind::Elision: + case Row::Kind::Gap: + return true; + case Row::Kind::Message: + case Row::Kind::Anchor: + case Row::Kind::Separator: + case Row::Kind::Context: + return false; + } +} + +// Draws the line running from an underline at `annotation_y` down to `meet_y`, +// in the column a label hangs from. +// +// It stops at the center of the cell the underline drew rather than redrawing +// it, so where the underline runs out through both sides of that cell the two +// form a junction. Where it stands in for a mark of one column instead, +// stopping at the center is what keeps the mark to the lower half of its cell, +// so that two of them in neighboring columns read as two marks rather than as +// one line drawn down both. +static auto DrawConnector(Buffer& buffer, int x, int annotation_y, int meet_y, + const Style& style) -> void { + buffer.DrawVerticalLine(x, annotation_y, meet_y - annotation_y + 1, style, + LineEnd::Center, LineEnd::Center); +} + +// Draws `number` in the columns before the frame, or nothing when there is no +// line to name. +// +// `points_here` is the message whose location is on this line, which takes the +// margin outside the numbers and colors the number to match what the headline +// says. Everything else keeps the frame's own color, so the one line the +// message is about is the one that isn't part of the frame. +static auto DrawLineNumber(Buffer& buffer, int frame_x, int y, int number, + const PreparedPart* points_here) -> void { + if (number <= 0) { + return; + } + std::string text = std::to_string(number); + // The line the problem is on takes the headline's color and its weight, and + // every other line number is left as light as the frame it belongs to, so + // that the one being reported is the one that stands out rather than every + // number competing with it. + Style style = points_here ? points_here->style : FrameStyle().Bold(false); + buffer.DrawText(frame_x - 1 - text.size(), y, text, style); + if (points_here) { + buffer.DrawText(0, y, LineMark, style); + } +} + +// Returns whether `text` and `suffix`, wrapped together into `columns` at +// (x, y), fit on the one row they start on. +// +// Measuring the two together, rather than asking whether the suffix fits +// after the text, is what gives a block that wrapped at all a tag naming it +// rather than trailing its last word. +static auto WrappedSharesRow(const Buffer& buffer, int x, int y, int columns, + llvm::StringRef text, llvm::StringRef suffix) + -> bool { + return buffer + .MeasureWrappedText(x, y, /*margin=*/x, columns, + (llvm::Twine(text) + suffix).str()) + .y == y; +} + +// Returns the row after what `DrawWrapped` below draws, without drawing it. +static auto MeasureWrapped(const Buffer& buffer, int x, int y, int columns, + llvm::StringRef text, llvm::StringRef suffix) + -> int { + Buffer::DrawEnd end = + buffer.MeasureWrappedText(x, y, /*margin=*/x, columns, text); + if (suffix.empty() || WrappedSharesRow(buffer, x, y, columns, text, suffix)) { + return end.y + 1; + } + return end.y + 2; +} + +// Draws `text` wrapped into `columns` at (x, y), with `suffix` after it, and +// returns the row after what it drew. +// +// The suffix is drawn on its own so that it keeps its own style, and placed +// where wrapping would have put it: after the text where the two share a row, +// and on a row of its own at the margin where they do not. +static auto DrawWrapped(Buffer& buffer, int x, int y, int columns, + llvm::StringRef text, llvm::StringRef suffix, + Style style = Style()) -> int { + if (suffix.empty()) { + return buffer.DrawWrappedText(x, y, /*margin=*/x, columns, text, style).y + + 1; + } + Buffer::DrawEnd end = + buffer.DrawWrappedText(x, y, /*margin=*/x, columns, text, style); + if (WrappedSharesRow(buffer, x, y, columns, text, suffix)) { + buffer.DrawText(end.x, end.y, suffix, KindStyle()); + return end.y + 1; + } + // The separating space would indent a tag that starts a row. + buffer.DrawText(x, end.y + 1, suffix.ltrim(), KindStyle()); + return end.y + 2; +} + +auto Renderer::Render(Terminal::OutputBufferRef out, + const Diagnostic& diagnostic) const -> void { + // Widths depend only on the character set, so this measures without ever + // drawing into anything. + Metrics metrics(capabilities_.charset); + + // A context names the operation that failed, and leads the diagnostic when + // there is one: it is the failure the reader is being told about, and the + // message is then read against the code like anything else explaining it. + const Context* leading_context = LeadingContext(diagnostic); + + // A `PreparedPart` is undesirably large for inline storage by + // SmallVector, so we specify 0. + llvm::SmallVector parts; + int headline = -1; + + // Which colors this terminal gets, decided once: everything drawn takes one + // of them. + Theme problem_theme = LevelTheme(diagnostic.level, capabilities_); + Theme explanation_theme = ExplanationTheme(capabilities_); + + // What leads the diagnostic is drawn at its level and everything else as + // something explaining it, except that a primary range is part of the problem + // and so keeps the level's color wherever down the frame it sits. + auto add_part = [&](bool is_headline, bool is_problem, bool from_message_loc, + const Loc& loc, std::string text, llvm::StringRef name) { + if (is_headline) { + headline = parts.size(); + } + parts.push_back( + PreparePart(metrics, is_problem ? Part::Problem : Part::Explanation, + from_message_loc, + is_headline ? LevelText(diagnostic.level) : ExplanationText, + ThemeStyle(is_problem ? problem_theme : explanation_theme), + loc, std::move(text), name, is_headline, include_kind_)); + }; + + // The same file reached the same way is a path drawn once. A path says how a + // file was got to, so every range marked in that file has the same one, and + // repeating it under each of them says nothing the first didn't. + std::string last_place; + auto add_location_info = [&](llvm::ArrayRef steps, + const Loc& reaches) { + std::string place = reaches.filename.str(); + for (const LocationInfo& step : steps) { + place += "\n" + step.Format() + " " + FormatLocation(step.loc); + } + if (place == last_place) { + return; + } + last_place = std::move(place); + for (const LocationInfo& step : steps) { + parts.push_back(PreparePart( + metrics, Part::LocationInfo, /*from_message_loc=*/false, + /*level_text=*/"", ContextStyle(), step.loc, step.Format(), step.name, + /*is_headline=*/false, include_kind_)); + } + }; + + // The contexts, then the message, then everything attached to explain it, + // which is the order they are read in. + for (const Context& context : diagnostic.contexts) { + add_location_info(context.location_info, context.loc); + // Only the leading context is the failure being reported; the rest name + // operations it happened inside, which explain it. + bool is_headline = &context == leading_context; + add_part(is_headline, is_headline, /*from_message_loc=*/false, context.loc, + context.Format(), context.name); + } + const Message& message = diagnostic.message; + add_location_info(message.location_info, message.loc); + // The message states the problem whether or not a context leads it: a + // context gives it a sentence to sit under, and doesn't demote what it says + // to an explanation of something else. Marking it otherwise puts an + // informational connector on a range that is marked as part of the problem. + bool message_leads = leading_context == nullptr; + add_part(message_leads, /*is_problem=*/true, /*from_message_loc=*/true, + message.loc, message.Format(), message.kind.name()); + for (const Label& label : diagnostic.labels) { + add_location_info(label.location_info, label.loc); + add_part(/*is_headline=*/false, label.category == LabelCategory::Primary, + /*from_message_loc=*/false, label.loc, label.Format(), label.name); + } + CARBON_CHECK(headline >= 0, "Either the context or the message leads."); + + // With snippets off, every diagnostic takes the compact form: nothing below + // is drawn, so none of its geometry needs deciding. + if (!snippets_) { + RenderCompact(out, parts); + return; + } + + // Where content starts, which is what a width has to hold on top of the + // source it shows. Line numbers sit to the left of the frame, so their width + // is what decides which column it runs down; any line shown between two spans + // has a number between theirs, so the widest is always one of these. + int frame_x = MarginWidth + LineNumberColumns + 1; + for (const PreparedPart& part : parts) { + if (part.has_source && part.line_number > 0) { + frame_x = std::max( + frame_x, + MarginWidth + metrics.Width(std::to_string(part.line_number)) + 1); + } + } + int content_x = frame_x + FrameToContentWidth; + + // What the gutter costs when a line number fits the columns set aside for it, + // which is what the target width is built on. A wider number spends the + // difference out of the source rather than out of the width. + int target_content_x = + MarginWidth + LineNumberColumns + 1 + FrameToContentWidth; + + // The width every layout decision below is made against, taken from the + // capabilities when they hold one. `COLUMNS` is whatever a user exported, so + // that width is held to what a grid can hold before anything is laid out + // against it. When there is none to take, the target is the source width + // plus whatever this diagnostic spends reaching it, so the gutter is paid + // for out of the total rather than out of the code. + int columns = capabilities_.columns + ? std::min(*capabilities_.columns, Buffer::MaxColumns) + : target_content_x + FormattedSourceColumns; + + // What is left for source once the frame and its gutter are paid for. This + // has to happen before the rows take their copy of the source they show. + int source_columns = std::max(columns - content_x, 1); + + // The frame exists to hold source, so a diagnostic with none to show -- one + // for a file that couldn't be opened, say -- gets the compact form instead of + // an empty frame around a location. So does a terminal too narrow to hold a + // frame, a gutter, and a label hanging off a span: below that the compact + // form carries more in the columns there are. + bool has_source = llvm::any_of( + parts, [](const PreparedPart& part) { return part.has_source; }); + if (!has_source || columns < MinFrameColumns) { + RenderCompact(out, parts); + return; + } + + RenderFramed(out, parts, headline, diagnostic.level, frame_x, content_x, + source_columns, columns); +} + +// Draws the framed form: the headline, and under it one frame holding every +// anchor, snippet, and label. The geometry arrives from `Render`, which chose +// it; the spans are windowed in `LayOutRows`, which knows which of them share +// a view of a line. +auto Renderer::RenderFramed(Terminal::OutputBufferRef out, + llvm::MutableArrayRef parts, + int headline, Level level, int frame_x, + int content_x, int source_columns, + int columns) const -> void { + Theme problem_theme = LevelTheme(level, capabilities_); + Theme explanation_theme = ExplanationTheme(capabilities_); + + // Every layout decision is made against `columns`, so the buffer is built for + // that rather than from the capabilities directly: where they held no width, + // this is the one the layout chose. + Terminal::Capabilities layout_capabilities = capabilities_; + layout_capabilities.columns = columns; + Buffer buffer(layout_capabilities); + + llvm::SmallVector rows = + RowLayout(buffer, parts, headline, problem_theme, explanation_theme, + source_columns, content_x, columns) + .LayOut(); + + Glyphs glyphs = Glyphs::For(capabilities_.charset); + + // The headline, wrapped under itself so that a continuation of it can't read + // as the start of another diagnostic. + const PreparedPart& head = parts[headline]; + // The separator beside an annotation runs down the frame's own column and + // reads as part of it, so it takes one color for the whole diagnostic rather + // than the color of whichever range happens to be on that row. That color is + // the headline's, which is what the mark in the margin and the line number + // beside the reported line take. + const Style annotation_style = MarkStyle(head.style); + Buffer::DrawEnd end = buffer.DrawText(0, 0, head.level_text, head.style); + int head_x = end.x; + int head_bottom = DrawWrapped(buffer, head_x, 0, columns - head_x, head.text, + head.kind_suffix, Style().Bold()); + + // Then everything else, hanging off one vertical line down the frame's + // column. Its corners and tees come out of the junctions the buffer forms + // where the stubs meet it, and rows that mark themselves draw their glyph + // over it. A row that wraps pushes the ones below it down, so the cursor + // follows what was drawn rather than counting rows. + int frame_top = head_bottom; + int y = frame_top; + // The row the underlines were drawn on, which is where every label below it + // reaches back up to. A label can be several rows down from it, since the + // labels on one underline stack. + int annotation_y = -1; + // A routed label's words, held back until every connector is drawn; see the + // `RoutedLabel` case below. + struct DeferredText { + int x; + int y; + int columns; + const Row* row; + }; + llvm::SmallVector deferred_text; + for (const Row& row : rows) { + CARBON_CHECK(annotation_y >= 0 || (row.kind != Row::Kind::Label && + row.kind != Row::Kind::RoutedLabel), + "A label hangs off the underline laid out above it."); + int next_y = y + 1; + const PreparedPart* part = row.part; + // What this row draws over the frame, from `mark_from` down, or nothing to + // leave the frame's own line showing through. + std::optional mark; + Style mark_style = FrameStyle(); + int mark_from = y; + switch (row.kind) { + case Row::Kind::Message: { + buffer.DrawHorizontalLine(frame_x, y, 2, FrameStyle(), LineEnd::Center, + LineEnd::Edge); + Buffer::DrawEnd end = + buffer.DrawText(content_x + 1, y, part->level_text, part->style); + next_y = DrawWrapped( + buffer, end.x, y, columns - end.x, row.text, + part->KindSuffixOn(/*is_label_row=*/false), + part->role == Part::LocationInfo ? ContextStyle() : Style()); + mark = glyphs.annotation; + mark_from = y + 1; + break; + } + case Row::Kind::Anchor: + // `╭─┤ location`. The bracket is drawn as lines so that the character + // set decides how it looks, and so that the context above can reach + // down into it. + buffer.DrawHorizontalLine(frame_x, y, 3, FrameStyle()); + buffer.DrawVerticalLine(frame_x + 2, y, 1, FrameStyle(), LineEnd::Edge, + LineEnd::Edge); + buffer.DrawText(frame_x + AnchorPrefixWidth, y, part->location, + Style()); + break; + case Row::Kind::Context: { + // The connector descends into the bracket before the file name in the + // anchor below, so the row reads as leading to it. Drawn downwards so + // that several of these stack into one line. + int bracket_x = frame_x + 2; + buffer.DrawVerticalLine(bracket_x, y, 2, FrameStyle()); + buffer.DrawHorizontalLine(bracket_x, y, ConnectorWidth - 1, + FrameStyle(), LineEnd::Center, LineEnd::Edge); + std::string text = ContextText(*part); + int text_x = bracket_x + ConnectorWidth; + Buffer::DrawEnd end = buffer.DrawText(text_x, y, text, ContextStyle()); + buffer.DrawText(end.x, end.y, part->kind_suffix, KindStyle()); + break; + } + case Row::Kind::Source: + DrawLineNumber(buffer, frame_x, y, row.line_number, row.points_here); + buffer.DrawText(content_x, y, row.text, Style()); + break; + case Row::Kind::Annotation: { + annotation_y = y; + for (const PreparedPart* span : row.spans) { + DrawUnderline(buffer, content_x, y, *span, span->mark_style); + } + mark = glyphs.annotation; + mark_style = annotation_style; + break; + } + case Row::Kind::Label: { + // The label hangs to the right of the connector, which comes in from + // the left to meet the bar framing it, at its middle row -- the row + // above the middle when it has an even number of them. + int anchor_x = content_x + part->source.anchor; + int text_x = anchor_x + LabelIndentWidth; + int bar_x = text_x - LabelFrameWidth; + const Style& style = part->mark_style; + next_y = DrawWrapped(buffer, text_x, y, columns - text_x, row.text, + part->KindSuffixOn(/*is_label_row=*/true)); + + // The bar is a stroke on each of the label's rows rather than one line + // running between them, so every cell of it reads as a bar: the one the + // connector arrives at is a tee rather than the corner an end would be, + // and a label of one row is framed the same as a label of ten. + for (int bar_y : llvm::seq(y, next_y)) { + buffer.DrawVerticalLine(bar_x, bar_y, 1, style, LineEnd::Edge, + LineEnd::Edge); + } + // The connector runs from the underline down past whatever labels are + // already hanging to the right of this one, all of which leave the + // column it descends in clear -- except a routed label, whose words + // are drawn last so that they win the cell; see below. + int meet_y = y + (next_y - y - 1) / 2; + DrawConnector(buffer, anchor_x, annotation_y, meet_y, style); + buffer.DrawHorizontalLine(anchor_x, meet_y, ConnectorWidth, style); + mark = glyphs.annotation; + mark_style = annotation_style; + break; + } + case Row::Kind::RoutedLabel: { + // The label is out-dented past its anchor, so there is no room to reach + // it from the left and the bar framing it is what reaches back instead: + // its top turns right along the row under the underline and runs to the + // anchor. Meeting the label at its top rather than its middle is what + // lets the bar sit directly against the text, which is where the width + // this form exists to find comes from. + int anchor_x = content_x + part->source.anchor; + int bar_x = content_x; + int text_x = bar_x + LabelFrameWidth; + const Style& style = part->mark_style; + DrawConnector(buffer, anchor_x, annotation_y, y, style); + buffer.DrawHorizontalLine(bar_x, y, anchor_x - bar_x + 1, style); + + // The words reach across the full width, so a label drawn after this + // one -- to its left, and so below it -- runs its connector through + // their rows. The words win the cells they share: they are measured + // now, so the rows below land where they will, and drawn once every + // connector is down, so a connector crossing this label is interrupted + // by its words rather than striking through them. + next_y = + MeasureWrapped(buffer, text_x, y + 1, columns - text_x, row.text, + part->KindSuffixOn(/*is_label_row=*/true)); + deferred_text.push_back({.x = text_x, + .y = y + 1, + .columns = columns - text_x, + .row = &row}); + buffer.DrawVerticalLine(bar_x, y, next_y - y, style, LineEnd::Center, + LineEnd::Edge); + mark = glyphs.annotation; + mark_style = annotation_style; + break; + } + case Row::Kind::Elision: + mark = glyphs.elision; + break; + case Row::Kind::Gap: + // The frame's own line running through is all this row is. + break; + case Row::Kind::Separator: + // The same rule that closes the diagnostic, tee'd because the frame + // carries on past it. + buffer.DrawHorizontalLine(frame_x, y, SnippetRuleWidth, FrameStyle(), + LineEnd::Center, LineEnd::Edge); + break; + } + + // The frame's line runs the whole height of the row, edge to edge, so that + // consecutive rows carry on into each other without either reaching into + // the other's cells. Only the topmost row starts at a center, which is what + // leaves that cell a corner for the anchor to turn. It can't be drawn in + // one pass afterwards because a row that wraps pushes the ones below it + // down, so how far it reaches isn't known until every row is drawn -- and + // it can't be drawn in one pass beforehand because it would cover the + // glyphs. + buffer.DrawVerticalLine(frame_x, y, next_y - y, FrameStyle(), + y == frame_top ? LineEnd::Center : LineEnd::Edge, + LineEnd::Edge); + if (mark) { + for (int row_y : llvm::seq(mark_from, next_y)) { + buffer.DrawCodePoint(frame_x, row_y, *mark, mark_style); + } + } + y = next_y; + } + + // The routed labels' words, drawn over whatever connectors crossed them. + for (const DeferredText& text : deferred_text) { + DrawWrapped(buffer, text.x, text.y, text.columns, text.row->text, + text.row->part->KindSuffixOn(/*is_label_row=*/true)); + } + + // The closing rule turns the corner the frame's last row left for it. + buffer.DrawVerticalLine(frame_x, y, 1, FrameStyle(), LineEnd::Edge, + LineEnd::Center); + buffer.DrawHorizontalLine(frame_x, y, SnippetRuleWidth, FrameStyle(), + LineEnd::Center, LineEnd::Edge); + buffer.Render(out, capabilities_.color_mode); +} + +// Draws the row `part` takes in the compact form -- its location with the +// extent of its range, level word, words, and kind -- and returns whether one +// was drawn: a part that only marks a range has nothing to say on a row of its +// own. +// +// Location information reads words first, leading to its own location, as it +// does in the frame. Reading it the other way around would make the words say +// the wrong thing. +static auto DrawMessageRow(Buffer& buffer, int y, const PreparedPart& part) + -> bool { + // With no frame for a label to hang off, its words serve as the part's own. + const std::string& words = part.text.empty() ? part.label : part.text; + if (part.role == Part::LocationInfo) { + Buffer::DrawEnd end = + buffer.DrawText(0, y, ContextText(part), ContextStyle()); + buffer.DrawText(end.x, end.y, part.kind_suffix, KindStyle()); + return true; + } + if (words.empty()) { + return false; + } + // Each run picks up where the one before it ended rather than being placed + // at a width measured separately, so the two can't disagree. + Buffer::DrawEnd end = {.x = 0, .y = y}; + if (!part.location.empty()) { + // The location carries the extent of the range as `-`, which is the + // one place this form has to say it; the framed form draws it instead. + std::string location = part.location; + if (part.location_end_column > 0) { + location += "-" + std::to_string(part.location_end_column); + } + end = buffer.DrawText(0, y, location + ": ", Style().Bold()); + } + end = buffer.DrawText(end.x, end.y, part.level_text, part.style); + end = buffer.DrawText(end.x, end.y, words, Style()); + buffer.DrawText(end.x, end.y, part.kind_suffix, KindStyle()); + return true; +} + +auto Renderer::RenderCompact(Terminal::OutputBufferRef out, + llvm::ArrayRef parts) const + -> void { + // Nothing here wraps, so the width binds nothing: each row runs as wide as + // the runs drawn into it. The capabilities still decide how those are + // measured and colored. + Buffer buffer(capabilities_); + int y = 0; + for (const PreparedPart& part : parts) { + if (DrawMessageRow(buffer, y, part)) { + ++y; + } + } + buffer.Render(out, capabilities_.color_mode); +} + +auto FormatLocation(const Loc& loc) -> std::string { + if (loc.filename.empty()) { + return ""; + } + // A filename is drawn on one row like anything else, so a control byte in it + // -- a newline most of all -- would break the frame or split a compact line + // in two. The bytes are the name of a real file, so they are replaced rather + // than dropped: the location still reads, and nothing it holds can move the + // cursor. + std::string result; + for (char c : loc.filename.take_front(MaxDrawnBytes)) { + result += static_cast(c) < 0x20 || c == 0x7f ? ' ' : c; + } + // The parts drop off the right as they become unknown. + if (loc.line_number > 0) { + result += ":" + std::to_string(loc.line_number); + if (loc.column_number > 0) { + result += ":" + std::to_string(loc.column_number); + } + } + return result; +} + +auto PrintSnippet(llvm::raw_ostream& out, const Loc& loc, int indent) -> void { + // Crash output is plain: it is going into a stack trace, and whatever is + // writing it has bigger problems than color. + Metrics metrics(Charset::Ascii); + llvm::SmallString<256> bytes; + + if (loc.column_number <= 0) { + return; + } + Glyphs glyphs = Glyphs::For(Charset::Ascii); + std::string number = + loc.line_number > 0 ? std::to_string(loc.line_number) : std::string(); + int frame_x = indent + std::max(number.size(), 1) + 1; + int content_x = frame_x + FrameToContentWidth; + PreparedSource source = PrepareSource( + metrics, loc.line, Bytes(loc.column_number), Bytes(loc.length)); + WindowSource(metrics, source, FormattedSourceColumns, source.span_start); + + Buffer buffer(content_x + source.Width(metrics), Charset::Ascii); + buffer.DrawVerticalLine(frame_x, /*y=*/0, /*length=*/2, FrameStyle()); + buffer.DrawText(frame_x - 1 - number.size(), 0, number, FrameStyle()); + buffer.DrawText(content_x, 0, source.text, Style()); + buffer.DrawCodePoint(frame_x, 1, glyphs.annotation, FrameStyle()); + buffer.DrawHorizontalLine(content_x + source.span_start, 1, + source.span_length, Style(), LineEnd::Edge, + LineEnd::Edge); + buffer.Render(bytes, Terminal::ColorMode::NoColor); + out << bytes; +} + +} // namespace Carbon::Diagnostics diff --git a/toolchain/diagnostics/renderer.h b/toolchain/diagnostics/renderer.h new file mode 100644 index 000000000000..b2a4620aacda --- /dev/null +++ b/toolchain/diagnostics/renderer.h @@ -0,0 +1,116 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#ifndef CARBON_TOOLCHAIN_DIAGNOSTICS_RENDERER_H_ +#define CARBON_TOOLCHAIN_DIAGNOSTICS_RENDERER_H_ + +#include +#include + +#include "common/ostream.h" +#include "common/terminal/capabilities.h" +#include "common/terminal/output_buffer_ref.h" +#include "llvm/ADT/ArrayRef.h" +#include "toolchain/diagnostics/diagnostic.h" + +namespace Carbon::Diagnostics { + +namespace Internal { +struct PreparedPart; +} // namespace Internal + +// Draws diagnostics for a terminal. +// +// A diagnostic renders as its headline, and then a frame holding everything +// that explains it: which file, the source there, and the text of each label +// against the code it marks. +// +// error: 1 argument passed to function expecting 0 arguments +// ╭─┤ foo.carbon:19:3 +// │ +// 1 │ fn Run0() {} +// · ──────┬───── +// · ╰──┤ calling function declared here +// ┆ +// -> 19 │ Run0(1); +// · ───┬─── +// · ╰──┤ 1 argument passed here +// ╰──────────── +// +// With snippets off, each part of the diagnostic is one line, led by its +// location and the extent of its range: +// +// foo.carbon:19:3-9: error: 1 argument passed to function expecting 0 +// foo.carbon:1:1-12: note: calling function declared here +// +// See /toolchain/docs/diagnostics_rendering.md for the full form, the palette, +// and why it looks like this rather than like something else. +// +// The rendering is decided entirely by the capabilities passed in, so the same +// diagnostic renders the same way every time for a given terminal, and the +// default capabilities render plain ASCII. What a stream's capabilities +// actually are is `Terminal::Capabilities::Detect`'s to answer: notably it +// takes the character set from the locale whether or not a terminal is +// attached, since the locale is what says how bytes will be decoded. +class Renderer { + public: + // Renders for a terminal with `capabilities`. The default describes a stream + // with no terminal behind it: no color, no line drawing, and no width. + // Layout still fits one -- the width code is formatted to, plus the gutter + // -- so the rendering is decided by the diagnostic rather than by the + // environment the stream ends up in. + explicit Renderer(const Terminal::Capabilities& capabilities = {}) + : capabilities_(capabilities) {} + + // Renders `diagnostic`, appending the bytes that draw it to `out`. Each row + // ends in a newline, and no style is left set at the end. + auto Render(Terminal::OutputBufferRef out, const Diagnostic& diagnostic) const + -> void; + + // Sets whether each message names the diagnostic kind that produced it. This + // is for tests, which match against the kind to prove they cover it. + auto set_include_kind(bool value) -> void { include_kind_ = value; } + + // Sets whether diagnostics show snippets of the source they point at. With + // them off, every diagnostic takes the compact form: one line per part, led + // by its location and the extent of its range, positioned against nothing, + // which is what a build log and a golden file want. + auto set_snippets(bool value) -> void { snippets_ = value; } + + auto set_capabilities(const Terminal::Capabilities& capabilities) -> void { + capabilities_ = capabilities; + } + + private: + // Renders one line per part of the diagnostic, led by its location. + auto RenderCompact(Terminal::OutputBufferRef out, + llvm::ArrayRef parts) const + -> void; + + // Renders the framed form into the geometry `Render` chose. + auto RenderFramed(Terminal::OutputBufferRef out, + llvm::MutableArrayRef parts, + int headline, Level level, int frame_x, int content_x, + int source_columns, int columns) const -> void; + + Terminal::Capabilities capabilities_; + bool include_kind_ = false; + bool snippets_ = true; +}; + +// Returns `loc` as `::`, with the parts that are +// unknown dropped from the right, and empty when even the filename is unknown. +auto FormatLocation(const Loc& loc) -> std::string; + +// Writes the source snippet for `loc` to `out`, indented by `indent` columns +// and with no styling. +// +// This and `FormatLocation` are for crash handlers, which interleave a location +// and its source with text of their own rather than emitting a diagnostic. They +// share their layout with `Renderer` so that there is one implementation of it. +auto PrintSnippet(llvm::raw_ostream& out, const Loc& loc, int indent) -> void; + +} // namespace Carbon::Diagnostics + +#endif // CARBON_TOOLCHAIN_DIAGNOSTICS_RENDERER_H_ diff --git a/toolchain/diagnostics/renderer_fuzzer.cpp b/toolchain/diagnostics/renderer_fuzzer.cpp new file mode 100644 index 000000000000..46c4c94682ba --- /dev/null +++ b/toolchain/diagnostics/renderer_fuzzer.cpp @@ -0,0 +1,170 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +// Fuzzes the diagnostic renderer directly, on `Diagnostic` values a compiler +// would never build: degenerate locations, spans past the end of a line, +// overlapping ranges, control bytes and invalid UTF-8 in every text field, and +// every combination of capabilities. The renderer's contract is that none of +// this is ever the reason a compiler dies while reporting a problem, so what is +// checked is that every form of every shape renders without a crash. Whether +// what it draws fits the width is not checked here: an unbreakable token or a +// path legitimately overhangs, and only the line art must fit, which the +// terminal buffer CHECKs on its own. + +#include +#include +#include +#include + +#include "common/check.h" +#include "common/terminal/capabilities.h" +#include "common/terminal/output_buffer_ref.h" +#include "llvm/ADT/SmallString.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringRef.h" +#include "testing/fuzzing/libfuzzer.h" +#include "toolchain/diagnostics/diagnostic.h" +#include "toolchain/diagnostics/renderer.h" + +namespace Carbon::Diagnostics { +namespace { + +// A cursor over the fuzzer input that hands out bounded values, returning zero +// once the bytes run out so that decoding always terminates. +class Bytes { + public: + Bytes(const unsigned char* data, size_t size) : data_(data), size_(size) {} + + // Returns the next byte, or 0 when the input is exhausted. + auto Next() -> uint8_t { return at_ < size_ ? data_[at_++] : 0; } + + // Returns the next value in `[0, bound)`, or 0 when `bound` is 0. + auto Below(int bound) -> int { return bound > 0 ? Next() % bound : 0; } + + // Returns a signed value spanning a range that includes the degenerate + // location values (-1) the renderer must tolerate. + auto Small() -> int32_t { return static_cast(Next()) - 2; } + + // Returns a run of the raw input bytes, so text fields carry whatever the + // fuzzer chose -- control bytes, invalid UTF-8, and embedded escapes + // included. The reference is into the input and lives as long as it does. + auto Text() -> llvm::StringRef { + size_t len = Next(); + if (at_ + len > size_) { + len = size_ - at_; + } + llvm::StringRef result(reinterpret_cast(data_ + at_), len); + at_ += len; + return result; + } + + private: + const unsigned char* data_; + size_t size_; + size_t at_ = 0; +}; + +// Builds a `Loc` from the fuzzer, sharing one buffer for `line`/`file_text` so +// the renderer's pointer-containment paths are exercised rather than always +// failing their guards. +static auto MakeLoc(Bytes& bytes, llvm::StringRef file_text) -> Loc { + llvm::StringRef line = file_text; + // Sometimes point `line` into `file_text` (a real slice), sometimes not. + if (!file_text.empty() && (bytes.Next() & 1)) { + size_t start = bytes.Next() % file_text.size(); + line = file_text.substr(start, bytes.Next()); + } + return {.filename = bytes.Text(), + .line = line, + .file_text = file_text, + .line_number = bytes.Small(), + .column_number = bytes.Small(), + .length = bytes.Small()}; +} + +// A format function that ignores the format and returns fuzzer-chosen text, so +// a part's rendered words are whatever the input holds. +static auto SaysText(std::string text) -> FormatFn { + return [text = std::move(text)](llvm::StringLiteral /*format*/, + llvm::ArrayRef /*args*/) { + return text; + }; +} + +} // namespace + +// NOLINTNEXTLINE: Match the documented fuzzer entry point declaration style. +extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) { + Bytes bytes(data, size); + + Terminal::Capabilities capabilities; + capabilities.color_mode = static_cast(bytes.Below(4)); + capabilities.charset = static_cast(bytes.Below(2)); + capabilities.background = static_cast(bytes.Below(2)); + capabilities.is_terminal = bytes.Next() & 1; + // Sometimes a width, always positive as the field promises. The range spans + // the compact-form threshold and small values a grid could divide badly. + if (bytes.Next() & 1) { + capabilities.columns = 1 + bytes.Below(200); + } + + // The source both the message and the labels point into. One shared buffer + // makes elision between two spans reachable. + llvm::StringRef file_text = bytes.Text(); + + bool include_kind = bytes.Next() & 1; + auto level = static_cast(bytes.Below(2)); + + Message message = {.kind = Kind::TestDiagnostic, + .level = level, + .loc = MakeLoc(bytes, file_text), + .format = "", + .format_fn = SaysText(bytes.Text().str())}; + + // A context leads the diagnostic in place of the message, so this reaches the + // shapes that only exist when one does. + llvm::SmallVector contexts; + int context_count = bytes.Below(3); + for (int i = 0; i < context_count; ++i) { + contexts.push_back({.loc = MakeLoc(bytes, file_text), + .name = "TestContext", + .format = "", + .format_fn = SaysText(bytes.Text().str())}); + } + + llvm::SmallVector labels; + int label_count = bytes.Below(8); + for (int i = 0; i < label_count; ++i) { + auto category = static_cast(bytes.Below(2)); + llvm::StringRef words = bytes.Text(); + labels.push_back( + {.category = category, + .loc = MakeLoc(bytes, file_text), + .name = "TestLabel", + .format = "", + .format_fn = words.empty() ? FormatFn() : SaysText(words.str())}); + } + + Diagnostic diagnostic = {.level = level, + .message = std::move(message), + .contexts = std::move(contexts), + .labels = std::move(labels)}; + + Renderer renderer(capabilities); + renderer.set_include_kind(include_kind); + + // The contract is that no shape of diagnostic, however malformed, is ever the + // reason a compiler dies while reporting a problem. Every form has to hold to + // it, so both are drawn; a crash in either is a crash in the error path. + for (bool snippets : {true, false}) { + renderer.set_snippets(snippets); + llvm::SmallString<256> rendered; + Terminal::OutputBufferRef out(rendered); + renderer.Render(out, diagnostic); + } + + return 0; +} + +} // namespace Carbon::Diagnostics diff --git a/toolchain/diagnostics/renderer_test.cpp b/toolchain/diagnostics/renderer_test.cpp new file mode 100644 index 000000000000..0635163289e5 --- /dev/null +++ b/toolchain/diagnostics/renderer_test.cpp @@ -0,0 +1,2447 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include "toolchain/diagnostics/renderer.h" + +#include +#include + +#include +#include + +#include "common/raw_string_ostream.h" +#include "common/terminal/capabilities.h" +#include "common/terminal/metrics.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/Sequence.h" +#include "llvm/ADT/SmallString.h" + +namespace Carbon::Diagnostics { +namespace { + +using ::testing::Eq; +using ::testing::HasSubstr; +using ::testing::Not; + +// Returns a function that formats as `text`, whatever it is handed. +static auto Says(llvm::StringRef text) -> FormatFn { + return + [text = text.str()](llvm::StringLiteral /*format*/, + llvm::ArrayRef /*args*/) { return text; }; +} + +// Builds a step in the path by which a location was reached. +static auto MakeOrigin(Loc loc, llvm::StringLiteral text) -> LocationInfo { + return {.loc = loc, .name = "TestOrigin", .format = text}; +} + +// Builds a message whose formatted text is `text`, reached by `origin`. +static auto MakeMessage(Loc loc, llvm::StringRef text, + llvm::SmallVector origin = {}, + Level level = Level::Error) -> Message { + return {.kind = Kind::TestDiagnostic, + .level = level, + .loc = loc, + .location_info = std::move(origin), + .format = "", + .format_args = {}, + .format_fn = Says(text)}; +} + +// Builds a label marking `loc` and saying `text`, reached by `origin`. An empty +// `text` marks the range and says nothing. +static auto MakeLabel(LabelCategory category, Loc loc, llvm::StringRef text, + llvm::SmallVector origin = {}) -> Label { + return {.category = category, + .loc = loc, + .location_info = std::move(origin), + .name = "TestLabel", + .format = "", + .format_args = {}, + .format_fn = text.empty() ? FormatFn() : Says(text)}; +} + +// Builds a context saying `text` about `loc`, reached by `origin`. +static auto MakeContext(Loc loc, llvm::StringRef text, + llvm::SmallVector origin = {}) + -> Context { + return {.loc = loc, + .location_info = std::move(origin), + .name = "TestContext", + .format = "", + .format_args = {}, + .format_fn = Says(text)}; +} + +// The columns of source a diagnostic targets with no terminal to measure, which +// is `Renderer`'s own `FormattedSourceColumns`. Spelled again here rather than +// exposed: a test that pins the width should say which width it pins. +static constexpr int TargetSourceColumns = 80; + +// The capabilities of a stream with no terminal behind it, which is what tests +// and redirected output get. +static auto Plain() -> Terminal::Capabilities { return {}; } + +// The capabilities of a terminal too narrow to hold a frame, which is how a +// diagnostic with source to show still reaches the compact form. +static auto Narrow() -> Terminal::Capabilities { + return {.is_terminal = true, .columns = 40}; +} + +// Renders `diagnostic` for `capabilities`. +static auto Render(const Terminal::Capabilities& capabilities, + const Diagnostic& diagnostic, bool snippets = true) + -> std::string { + Renderer renderer(capabilities); + renderer.set_snippets(snippets); + llvm::SmallString<256> bytes; + renderer.Render(bytes, diagnostic); + return std::string(bytes); +} + +// Renders a diagnostic with a single message at `level`. +static auto RenderOne(const Terminal::Capabilities& capabilities, Level level, + Loc loc, llvm::StringRef text) -> std::string { + return Render(capabilities, + {.level = level, .message = MakeMessage(loc, text, {}, level)}); +} + +// The file the tests point spans into. +static constexpr llvm::StringLiteral File = + "fn Run0() {}\n" + "\n" + "fn Main() {\n" + " Run0(1);\n" + "}\n"; + +// Returns a location naming only a file, which is what a part attached at no +// particular code converts to. +static auto FileOnly() -> Loc { return {.filename = "foo.carbon"}; } + +// Returns a location in `File` naming a line but no column. No producer emits +// one -- a location either reaches source or names at most a file -- but a +// `Loc` is a plain aggregate, so the renderer still has to draw it. +static auto LineOnly(int line_number) -> Loc { + return {.filename = "foo.carbon", .line_number = line_number}; +} + +// Returns a location in `File`. +static auto At(int line_number, int column, int length) -> Loc { + llvm::StringRef rest = File; + for (auto _ : llvm::seq(1, line_number)) { + rest = rest.split('\n').second; + } + return {.filename = "foo.carbon", + .line = rest.split('\n').first, + .file_text = File, + .line_number = line_number, + .column_number = column, + .length = length}; +} + +TEST(RendererTest, ErrorWithSnippet) { + // The row below the anchor is an elision, because the file goes on above the + // line the snippet starts at. + EXPECT_THAT(RenderOne(Plain(), Level::Error, At(4, 3, 7), "bad call"), + Eq("error: bad call\n" + " .-| foo.carbon:4:3\n" + " :\n" + "-> 4 | Run0(1);\n" + " : -------\n" + " '------------\n" + "")); +} + +TEST(RendererTest, ASpanStartingWhereTheLineEndsIsStillDrawn) { + // A location can name the column after the last character on a line: a + // fix-it inserting there, or a token synthesized past the end of the line by + // error recovery. The mark reaches one column further than the source rather + // than the renderer refusing to draw it. + Loc loc = {.filename = "foo.carbon", + .line = "var x: i32", + .file_text = "var x: i32", + .line_number = 1, + .column_number = 11, + .length = 1}; + // Drawn as UTF-8 because that is where the span is walked back to the start + // of whatever symbol it lands in, and there is no symbol at the end of a line + // to walk back through. + Terminal::Capabilities capabilities = {.charset = Terminal::Charset::Utf8}; + EXPECT_THAT(RenderOne(capabilities, Level::Error, loc, "missing `;`"), + Eq("error: missing `;`\n" + " ╭─┤ foo.carbon:1:11\n" + " │\n" + "-> 1 │ var x: i32\n" + " · ─\n" + " ╰────────────\n" + "")); +} + +TEST(RendererTest, WarningLevelWord) { + // The snippet starts at the top of the file, so nothing was skipped and the + // row below the anchor is just the frame. + EXPECT_THAT(RenderOne(Plain(), Level::Warning, At(1, 4, 4), "unused"), + Eq("warning: unused\n" + " .-| foo.carbon:1:4\n" + " |\n" + "-> 1 | fn Run0() {}\n" + " : ----\n" + " '------------\n" + "")); +} + +TEST(RendererTest, FrameMovesRightForLongLineNumbers) { + Loc loc = {.filename = "foo.carbon", + .line = "var x: i32;", + .line_number = 123456, + .column_number = 1, + .length = 3}; + EXPECT_THAT(RenderOne(Plain(), Level::Error, loc, "bad"), + Eq("error: bad\n" + " .-| foo.carbon:123456:1\n" + " :\n" + "->123456 | var x: i32;\n" + " : ---\n" + " '------------\n" + "")); +} + +TEST(RendererTest, NoLocationIsJustTheHeadline) { + EXPECT_THAT(RenderOne(Plain(), Level::Error, {}, "no file here"), + Eq("error: no file here\n")); +} + +TEST(RendererTest, NothingToFrameFallsBackToCompact) { + EXPECT_THAT( + RenderOne(Plain(), Level::Error, {.filename = "foo.carbon"}, "broken"), + Eq("foo.carbon: error: broken\n")); + Loc line_only = {.filename = "foo.carbon", .line_number = 3}; + EXPECT_THAT(RenderOne(Plain(), Level::Error, line_only, "broken"), + Eq("foo.carbon:3: error: broken\n")); +} + +TEST(RendererTest, TabsExpandToStops) { + Loc loc = {.filename = "foo.carbon", + .line = "\tvar\tx;", + .line_number = 1, + .column_number = 6, + .length = 1}; + // The tabs reach columns 8 and 16, so `x` lands in column 17. + EXPECT_THAT(RenderOne(Plain(), Level::Error, loc, "bad"), + Eq("error: bad\n" + " .-| foo.carbon:1:6\n" + " |\n" + "-> 1 | var x;\n" + " : -\n" + " '------------\n" + "")); +} + +TEST(RendererTest, UnprintableBytesAreEscaped) { + Loc loc = {.filename = "foo.carbon", + .line = "a\x01=b", + .line_number = 1, + .column_number = 4, + .length = 1}; + EXPECT_THAT(RenderOne(Plain(), Level::Error, loc, "bad"), + Eq("error: bad\n" + " .-| foo.carbon:1:4\n" + " |\n" + "-> 1 | a<01>=b\n" + " : -\n" + " '------------\n" + "")); +} + +TEST(RendererTest, NonAsciiIsEscapedUnderAscii) { + Loc loc = {.filename = "foo.carbon", + .line = "x = \xc3\xa9;", + .line_number = 1, + .column_number = 1, + .length = 1}; + EXPECT_THAT(RenderOne(Plain(), Level::Error, loc, "bad"), + Eq("error: bad\n" + " .-| foo.carbon:1:1\n" + " |\n" + "-> 1 | x = ;\n" + " : -\n" + " '------------\n" + "")); +} + +TEST(RendererTest, WideCharactersTakeTwoColumnsUnderUtf8) { + Terminal::Capabilities capabilities = {.charset = Terminal::Charset::Utf8}; + // `世界` is at byte offset 15, and occupies four columns. + Loc loc = {.filename = "foo.carbon", + .line = " var x: i32 = \xe4\xb8\x96\xe7\x95\x8c;", + .line_number = 3, + .column_number = 16, + .length = 6}; + EXPECT_THAT(RenderOne(capabilities, Level::Error, loc, "not found"), + Eq("error: not found\n" + " ╭─┤ foo.carbon:3:16\n" + " ┆\n" + "-> 3 │ var x: i32 = 世界;\n" + " · ────\n" + " ╰────────────\n" + "")); +} + +TEST(RendererTest, SpanPastEndOfLineIsClamped) { + Loc loc = {.filename = "foo.carbon", + .line = "var", + .line_number = 1, + .column_number = 40, + .length = 10}; + EXPECT_THAT(RenderOne(Plain(), Level::Error, loc, "at end"), + Eq("error: at end\n" + " .-| foo.carbon:1:40\n" + " |\n" + "-> 1 | var\n" + " : -\n" + " '------------\n" + "")); +} + +TEST(RendererTest, MergedShowsOneViewOfTheFile) { + Diagnostic diagnostic = { + .level = Level::Error, + .message = MakeMessage(At(4, 3, 7), "too many arguments"), + .labels = { + MakeLabel(LabelCategory::Info, At(1, 1, 12), "declared here")}}; + // The note is above the error in the file, so it is drawn first, and the two + // lines between them are elided. The row below the anchor is not an elision, + // because the snippet starts at the top of the file. + EXPECT_THAT(Render(Plain(), diagnostic), + Eq("error: too many arguments\n" + " .-| foo.carbon:4:3\n" + " |\n" + " 1 | fn Run0() {}\n" + " : ------------\n" + " : '--| declared here\n" + " :\n" + "-> 4 | Run0(1);\n" + " : -------\n" + " '------------\n" + "")); +} + +TEST(RendererTest, MergedShowsASingleSkippedLine) { + Diagnostic diagnostic = { + .level = Level::Error, + .message = MakeMessage(At(3, 1, 2), "bad"), + .labels = {MakeLabel(LabelCategory::Info, At(1, 1, 2), "here")}}; + // Only line 2 is between them, so it is shown rather than elided. + EXPECT_THAT(Render(Plain(), diagnostic), Eq("error: bad\n" + " .-| foo.carbon:3:1\n" + " |\n" + " 1 | fn Run0() {}\n" + " : --\n" + " : '--| here\n" + " 2 |\n" + "-> 3 | fn Main() {\n" + " : --\n" + " '------------\n" + "")); +} + +TEST(RendererTest, NotesInAnotherFileGetTheirOwnAnchor) { + Loc other = {.filename = "bar.carbon", + .line = "class C {", + .line_number = 9, + .column_number = 1, + .length = 9}; + Diagnostic diagnostic = { + .level = Level::Error, + .message = MakeMessage(At(4, 3, 7), "bad"), + .labels = {MakeLabel(LabelCategory::Info, other, "declared here")}}; + EXPECT_THAT(Render(Plain(), diagnostic), + Eq("error: bad\n" + " .-| foo.carbon:4:3\n" + " :\n" + "-> 4 | Run0(1);\n" + " : -------\n" + " |------------\n" + " |-| bar.carbon:9:1\n" + " :\n" + " 9 | class C {\n" + " : ---------\n" + " : '--| declared here\n" + " '------------\n" + "")); +} + +TEST(RendererTest, APrimaryLabelTeesIntoItsRange) { + // The connector leaves the middle of the underline through a junction, so the + // mark and what it says are one stroke and the words point into the range + // rather than off an end of it. + Diagnostic diagnostic = { + .level = Level::Error, + .message = + MakeMessage(At(4, 3, 7), "1 argument passed to function expecting 0"), + .labels = {MakeLabel(LabelCategory::Primary, At(4, 3, 7), + "1 argument passed here")}}; + EXPECT_THAT(Render(Plain(), diagnostic), + Eq("error: 1 argument passed to function expecting 0\n" + " .-| foo.carbon:4:3\n" + " :\n" + "-> 4 | Run0(1);\n" + " : -------\n" + " : '--| 1 argument passed here\n" + " '------------\n" + "")); +} + +TEST(RendererTest, TheShapeTheDesignDocDraws) { + // The anatomy illustration in /toolchain/docs/diagnostics_rendering.md, so + // that the picture there is output this produced rather than one drawn by + // hand and left behind by the next change. + // The declaration is in an imported file, so the picture carries the path + // above an anchor as well as the rows a single file needs. + static constexpr llvm::StringLiteral LibFile = "fn Run0() {}\n"; + Loc declaration = {.filename = "lib.carbon", + .line = "fn Run0() {}", + .file_text = LibFile, + .line_number = 1, + .column_number = 1, + .length = 12}; + Loc import = {.filename = "foo.carbon", .line_number = 2, .column_number = 1}; + Terminal::Capabilities capabilities = {.charset = Terminal::Charset::Utf8}; + Diagnostic diagnostic = { + .level = Level::Error, + .message = MakeMessage( + At(4, 3, 7), "1 argument passed to function expecting 0 arguments"), + .labels = { + MakeLabel(LabelCategory::Info, declaration, + "calling function declared here, expecting 0 arguments", + {MakeOrigin(import, "imported from")}), + MakeLabel(LabelCategory::Primary, At(4, 3, 7), + "1 argument passed here")}}; + EXPECT_THAT(Render(capabilities, diagnostic), + Eq("error: 1 argument passed to function expecting 0 arguments\n" + " ╭─┤ foo.carbon:4:3\n" + " ┆\n" + "-> 4 │ Run0(1);\n" + " · ───┬───\n" + " · ╰──┤ 1 argument passed here\n" + " ├────────────\n" + " │ ╭── imported from: foo.carbon:2:1\n" + " ├─┤ lib.carbon:1:1\n" + " │\n" + " 1 │ fn Run0() {}\n" + " · ──────┬─────\n" + " · ╰──┤ calling function declared here, " + "expecting 0 arguments\n" + " ╰────────────\n" + "")); +} + +TEST(RendererTest, TheMessageRowTheDesignDocDraws) { + // The message row illustration in /toolchain/docs/diagnostics_rendering.md, + // for the one row an ordinary diagnostic doesn't reach. + Terminal::Capabilities capabilities = {.charset = Terminal::Charset::Utf8}; + Diagnostic diagnostic = { + .level = Level::Error, + .message = MakeMessage(At(4, 8, 1), "cannot copy argument of type `A`"), + .labels = {MakeLabel(LabelCategory::Info, FileOnly(), + "type `A` does not implement interface " + "`Core.Copy`")}}; + EXPECT_THAT(Render(capabilities, diagnostic), + Eq("error: cannot copy argument of type `A`\n" + " ╭─┤ foo.carbon:4:8\n" + " ┆\n" + "-> 4 │ Run0(1);\n" + " · ─\n" + " ├────────────\n" + " ├─ note: type `A` does not implement interface " + "`Core.Copy`\n" + " ╰────────────\n" + "")); +} + +TEST(RendererTest, ARangeContainingTheMessageLocHostsIt) { + // A range containing the message's location is drawn over the code that + // location names, so it stands in for it and the location marks nothing of + // its own. + Diagnostic diagnostic = { + .level = Level::Error, + .message = MakeMessage(At(4, 3, 1), "bad call"), + .labels = {MakeLabel(LabelCategory::Primary, At(4, 3, 7), "")}}; + EXPECT_THAT(Render(Plain(), diagnostic), Eq("error: bad call\n" + " .-| foo.carbon:4:3\n" + " :\n" + "-> 4 | Run0(1);\n" + " : -------\n" + " '------------\n" + "")); +} + +TEST(RendererTest, AMessageLocOutsideEveryRangeMarksNothing) { + // A range on the line the message's location names stands in for it whether + // or not it contains it, so the location itself is not drawn and the line + // carries only the range's own mark. + Diagnostic diagnostic = { + .level = Level::Error, + .message = MakeMessage(At(4, 3, 1), "bad call"), + .labels = {MakeLabel(LabelCategory::Primary, At(4, 8, 3), "")}}; + EXPECT_THAT(Render(Plain(), diagnostic), Eq("error: bad call\n" + " .-| foo.carbon:4:3\n" + " :\n" + "-> 4 | Run0(1);\n" + " : ---\n" + " '------------\n" + "")); +} + +TEST(RendererTest, RepeatedSpansAreOneMark) { + // Two labels marking the same range draw the same underline in the same + // columns, so they are one mark rather than two identical rows. A message + // that a context leads and the range attached to it reach this shape. + Diagnostic diagnostic = { + .level = Level::Error, + .message = MakeMessage(At(4, 3, 1), "bad call"), + .labels = {MakeLabel(LabelCategory::Primary, At(4, 3, 7), ""), + MakeLabel(LabelCategory::Primary, At(4, 3, 7), "wrong")}}; + EXPECT_THAT(Render(Plain(), diagnostic), Eq("error: bad call\n" + " .-| foo.carbon:4:3\n" + " :\n" + "-> 4 | Run0(1);\n" + " : -------\n" + " : '--| wrong\n" + " '------------\n" + "")); +} + +TEST(RendererTest, ARangeCoveringOthersIsRepairedRatherThanStacked) { + // A range attached over the whole expression, with the operands inside it + // marked separately, is the shape overlap actually arrives in. Nothing is in + // a position to reject it, so it is drawn as one row with the operands + // showing through the range that covers them. + Diagnostic diagnostic = { + .level = Level::Error, + .message = MakeMessage(At(4, 3, 1), "bad call"), + .labels = {MakeLabel(LabelCategory::Primary, At(4, 3, 7), ""), + MakeLabel(LabelCategory::Info, At(4, 3, 4), "callee"), + MakeLabel(LabelCategory::Info, At(4, 8, 1), "argument")}}; + EXPECT_THAT(Render(Plain(), diagnostic), Eq("error: bad call\n" + " .-| foo.carbon:4:3\n" + " :\n" + "-> 4 | Run0(1);\n" + " : -------\n" + " : | '--| argument\n" + " : '--| callee\n" + " '------------\n" + "")); +} + +TEST(RendererTest, ALabelOnASingleColumnRangeDropsStraightDown) { + // With one column marked there is no underline to turn out of, and reaching + // in from the side would read as attaching to the column beside it. The + // connector starts on the row below instead and takes the gap, which says + // the column above is a point and not a range. + Diagnostic diagnostic = { + .level = Level::Error, + .message = MakeMessage(At(4, 8, 1), "bad index"), + .labels = {MakeLabel(LabelCategory::Primary, At(4, 3, 4), "indexed here"), + MakeLabel(LabelCategory::Primary, At(4, 8, 1), "with this")}}; + EXPECT_THAT(Render(Plain(), diagnostic), Eq("error: bad index\n" + " .-| foo.carbon:4:8\n" + " :\n" + "-> 4 | Run0(1);\n" + " : ---- -\n" + " : | '--| with this\n" + " : '--| indexed here\n" + " '------------\n" + "")); +} + +TEST(RendererTest, OverlappingSpansStillShareOneRow) { + // Ranges covering some of the same columns are still one row of marks. The + // narrower one is drawn over the wider, since a range containing another says + // less about the columns they share than the range inside it does. + Diagnostic diagnostic = { + .level = Level::Error, + .message = MakeMessage(At(4, 3, 1), "bad call"), + .labels = {MakeLabel(LabelCategory::Primary, At(4, 3, 7), ""), + MakeLabel(LabelCategory::Info, At(4, 7, 3), "")}}; + EXPECT_THAT(Render(Plain(), diagnostic), Eq("error: bad call\n" + " .-| foo.carbon:4:3\n" + " :\n" + "-> 4 | Run0(1);\n" + " : -------\n" + " '------------\n" + "")); +} + +// The glyphs a row of marks must never hold. A corner reads as a mark turning +// into the connector leaving it, a crossing as two marks meeting, and an upward +// tee as a mark joining the source above it. None of those is ever what +// happened, whatever the ranges on the row are. +static constexpr std::array ForbiddenInMarks = { + "╭", "╮", "╯", "╰", "┼", "┴"}; + +// The ASCII stand-ins for the same shapes: `'` is a corner arriving from +// above and `+` a crossing. `.`, the corner leaving downward, is left out +// because it is also how a point with no room for anything else degrades. +static constexpr std::array ForbiddenInAsciiMarks = { + "'", "+"}; + +// Returns the row of marks under the source, which is the row after it. +static auto MarkRow(llvm::StringRef rendered) -> std::string { + llvm::SmallVector rows; + rendered.split(rows, '\n'); + for (auto [index, row] : llvm::enumerate(rows)) { + if (row.contains("abcdefghij") && index + 1 < rows.size()) { + return rows[index + 1].str(); + } + } + return ""; +} + +TEST(RendererTest, MarksNeverHoldACornerOrACrossing) { + // Adjacency moves the ends of marks and the columns connectors leave them + // from, which is where a shape nothing drew could come from. This sweeps what + // ranges on one row can be rather than naming the combinations one at a time. + static constexpr llvm::StringLiteral Line = " abcdefghijklmnopqrstuvwxyz"; + auto at = [&](int column, int length) { + return Loc{.filename = "f.carbon", + .line = Line, + .line_number = 1, + .column_number = column, + .length = length}; + }; + struct Placed { + int start; + int length; + bool has_words; + }; + auto render = [&](llvm::ArrayRef ranges, Terminal::Charset charset, + LabelCategory category) { + Terminal::Capabilities capabilities = {.charset = charset}; + llvm::SmallVector