Start every diagnostic with a single message attached to the code (#8102)

This is the final step in landing the _structural_ updates to diagnostic
rendering.

The key idea here is that we want the primary diagnostic to have a
message clearly explaining the problem and attached to the code that has
that problem. This should be the starting point for readers working to
address the issue, but is rendered attached to the code snippet in
question so errors are always "in context" of the code with the error.
Everything else in a diagnostic is an additional label attached to code
to explain or help the reader understand the problem in the primary
message.

Previously, `ContextScope` resulted in some confusion here, as
diagnostic consumers turned messages into labels and made the message in
the context scope the message. In essence, this isn't a scope with
context _for_ a diagnostic (with two exceptions that should probably
have been an `AnnotationScope`), but a context within `check` where we
have a preferred message for a diagnostic emitted by general purpose
code we call into. For example, "class was forward declared here" starts
as an error, and then consumers render it as a label to make the message
from the context scope the error. We also grew an `AnnotationScope` to
handle the contextual information we want to show for a diagnostic (what
I would have assumed `ContextScope` actually did).

Now we have a `Diagnoser`: code in `check` that can better explain the
problem than shared logic it is calling into passes a callback that
builds a caller-specific diagnostic. The callee then can attach relevant
labels and emit it. Diagnostics no longer store `contexts` and consumers
no longer need the logic to restructure things. We move all (but two) of
the old contexts to be normal messages emitted in this way, and we move
some diagnostics to become labels. Each of the new normal messages
corresponds to a new diagnostic kind as usual. Common code following
this pattern now _requires_ the `Diagnoser` to be passed (or emit
nothing), and this uncovered three places where an empty context was
used that made the rendered form miss key information. All three are
fixed with new diagnostics, one already covered by tests, and two with
TODOs to add test coverage.

We also completely remove the old `ContextScope` and
`CARBON_DIAGNOSTIC_CONTEXT` and rename `AnnotationScope` to
`ContextScope`. It is only used to attach information about when/where a
diagnostic occurred.

Labels also no longer have categories. What were `Primary` are now
`ExtraRange`s on the diagnostic rather than labels. Labels are now
always informational.

`DeclaredName` now narrows the range of a label when the range is a
declaration of a named entity to only be the range of that name. For
entities that don't have a declared name, the entire declaration remains
the range. The code building and emitting these diagnostics can skip
them if the declared location isn't distinct from the diagnostic
location.

Wording is largely unchanged here so we can just review the _structural_
change. #7991 iterates using this to improve locations and adds missing
labels. A subsequent PR will iterate on the wording to increasingly fit
within this structural model.

This is separated out as a way to review incrementally, and so that
subsequently we don't have to review wording improvements that only make
sense in a new structure that you cannot see yet. It seems easier to
look at the structure here even with awkward wording.

Assisted-by: Claude Code
This commit is contained in:
Chandler Carruth authored and GitHub committed 2026-11-22 05:19:35 +00:00
1 parent 4729b4473b
commit 0072b28129
378 files changed
+5795 -6998

No files matched your search

+22 -26
View File
@@ -112,18 +112,14 @@ import Cpp library "conversions.h";
fn ConstructorExplicit(s: Cpp.Source) {
//@dump-sem-ir-begin
// CHECK:STDERR: ╭─┤ fail_conditionally_explicit_implicit.carbon:[[@LINE+14]]:42
// CHECK:STDERR: ╭─┤ fail_conditionally_explicit_implicit.carbon:[[@LINE+10]]:42
// CHECK:STDERR: -> │ let _: Cpp.ConditionallyExplicitTrue = s;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert
// CHECK:STDERR: · │ ┃ expression of type `Source`
// CHECK:STDERR: · │ ┃ to
// CHECK:STDERR: · │ ┃ `Cpp.ConditionallyExplicit`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╭────────────────────────────────────────╯
// CHECK:STDERR: · │ type `Cpp.Source` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.ConditionallyExplicit)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ expression of type `Source`
// CHECK:STDERR: · ┃ to
// CHECK:STDERR: · ┃ `Cpp.ConditionallyExplicit`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.ConditionallyExplicitTrue = s;
@@ -571,9 +567,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: %.loc22_42: %ConditionallyExplicit.9d4 = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc22_13: type = splice_block %ConditionallyExplicitTrue.ref [concrete = constants.%ConditionallyExplicit.9d4] {
// CHECK:STDOUT: %Cpp.ref.loc22: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %.loc18_42: %ConditionallyExplicit.9d4 = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc18_13: type = splice_block %ConditionallyExplicitTrue.ref [concrete = constants.%ConditionallyExplicit.9d4] {
// CHECK:STDOUT: %Cpp.ref.loc18: <namespace> = 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 _, <error> [concrete = <error>]
@@ -586,27 +582,27 @@ 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: %.loc28_21.1: ref %Dest.980 = temporary_storage
// CHECK:STDOUT: %addr: %ptr.ca8 = addr_of %.loc28_21.1
// CHECK:STDOUT: %.loc24_21.1: ref %Dest.980 = temporary_storage
// CHECK:STDOUT: %addr: %ptr.ca8 = addr_of %.loc24_21.1
// CHECK:STDOUT: %Dest__carbon_thunk.call: init %empty_tuple.type = call imports.%Dest__carbon_thunk.decl(%s.ref, %addr)
// CHECK:STDOUT: %.loc28_21.2: init %Dest.980 to %.loc28_21.1 = mark_in_place_init %Dest__carbon_thunk.call
// CHECK:STDOUT: %.loc28_21.3: init %Dest.980 = converted %s.ref, %.loc28_21.2
// CHECK:STDOUT: %.loc28_21.4: ref %Dest.980 = temporary %.loc28_21.1, %.loc28_21.3
// CHECK:STDOUT: %.loc28_21.5: %Dest.980 = acquire_value %.loc28_21.4
// CHECK:STDOUT: %.loc28_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] {
// CHECK:STDOUT: %Cpp.ref.loc28: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %.loc24_21.2: init %Dest.980 to %.loc24_21.1 = mark_in_place_init %Dest__carbon_thunk.call
// CHECK:STDOUT: %.loc24_21.3: init %Dest.980 = converted %s.ref, %.loc24_21.2
// CHECK:STDOUT: %.loc24_21.4: ref %Dest.980 = temporary %.loc24_21.1, %.loc24_21.3
// CHECK:STDOUT: %.loc24_21.5: %Dest.980 = acquire_value %.loc24_21.4
// CHECK:STDOUT: %.loc24_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] {
// CHECK:STDOUT: %Cpp.ref.loc24: <namespace> = 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 _, %.loc28_21.5
// CHECK:STDOUT: %_: %Dest.980 = wrapper_binding _, %.loc24_21.5
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt: %pattern_type.b72 = value_binding_pattern _ [concrete = constants.%_.patt.664]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Destroy.facet.loc28_21.1: %Destroy.type = facet_value constants.%Dest.980, (constants.%DestroyImpl.impl_witness.771, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc28_21.6: %Destroy.type = converted constants.%Dest.980, %Destroy.facet.loc28_21.1 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %Destroy.facet.loc28_21.2: %Destroy.type = facet_value constants.%Dest.980, (constants.%DestroyImpl.impl_witness.771, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc28_21.7: %Destroy.type = converted constants.%Dest.980, %Destroy.facet.loc28_21.2 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %Destroy.facet.loc24_21.1: %Destroy.type = facet_value constants.%Dest.980, (constants.%DestroyImpl.impl_witness.771, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc24_21.6: %Destroy.type = converted constants.%Dest.980, %Destroy.facet.loc24_21.1 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %Destroy.facet.loc24_21.2: %Destroy.type = facet_value constants.%Dest.980, (constants.%DestroyImpl.impl_witness.771, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc24_21.7: %Destroy.type = converted constants.%Dest.980, %Destroy.facet.loc24_21.2 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc28_21.4)
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc24_21.4)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
+4 -9
View File
@@ -134,13 +134,11 @@ fn CopyDeletedMove(c: Cpp.DeletedMove) -> Cpp.DeletedMove {
fn CopyNonConstCopy(c: Cpp.NonConstCopy) -> Cpp.NonConstCopy {
// TODO: List candidates here.
// CHECK:STDERR: ╭─┤ fail_copy_noncopyable.carbon:[[@LINE+9]]:10
// CHECK:STDERR: ╭─┤ fail_copy_noncopyable.carbon:[[@LINE+7]]:10
// CHECK:STDERR: -> │ return c;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot copy value of type `NonConstCopy`
// CHECK:STDERR: · │ ┃ [CopyOfUncopyableType]
// CHECK:STDERR: · ╰────┤ type `Cpp.NonConstCopy` does not implement interface `Core.Copy`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ [CopyOfUncopyableType]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return c;
@@ -148,14 +146,11 @@ fn CopyNonConstCopy(c: Cpp.NonConstCopy) -> Cpp.NonConstCopy {
fn CopyAmbiguousCopy(c: Cpp.AmbiguousCopy) -> Cpp.AmbiguousCopy {
// TODO: List candidates here.
// CHECK:STDERR: ╭─┤ fail_copy_noncopyable.carbon:[[@LINE+10]]:10
// CHECK:STDERR: ╭─┤ fail_copy_noncopyable.carbon:[[@LINE+7]]:10
// CHECK:STDERR: -> │ return c;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot copy value of type `AmbiguousCopy`
// CHECK:STDERR: · │ ┃ [CopyOfUncopyableType]
// CHECK:STDERR: · ╰────┤ type `Cpp.AmbiguousCopy` does not implement interface
// CHECK:STDERR: · │ `Core.Copy`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ [CopyOfUncopyableType]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return c;
+74 -75
View File
@@ -91,9 +91,9 @@ fn DestroyClassWithProtectedBaseDestructor() {
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon
// CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) {
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ──────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused a: Derived = {.base = {}};
@@ -113,7 +113,7 @@ 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+19]]:3
// CHECK:STDERR: ╭─┤ fail_destroy_private_base_destructor.carbon:[[@LINE+43]]:3
// CHECK:STDERR: -> │ var unused a: Derived = {.base = {}};
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access private member `<C++ destructor>` of type
@@ -127,9 +127,33 @@ fn DestroyClassWithPrivateBaseDestructor() {
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon
// CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) {
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ──────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: ╷ ╭── included from: fail_destroy_nondestroyable.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./types.h:13:7
// CHECK:STDERR: -> │ class AmbiguousDestructorT {
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: destructor of class 'AmbiguousDestructorT<>' is ambiguous
// CHECK:STDERR: · │ ┃ [CppInteropParseError]
// CHECK:STDERR: · ╰────┤ in instantiation of template class 'AmbiguousDestructorT<>'
// CHECK:STDERR: · │ requested here
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: │ public:
// CHECK:STDERR: │ ~AmbiguousDestructorT() requires (N != 1);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function [CppInteropParseNote]
// CHECK:STDERR: │ ~AmbiguousDestructorT() requires (N != 2);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_destroy_nondestroyable.carbon
// CHECK:STDERR: │ var unused a: Cpp.AmbiguousDestructor = {};
// CHECK:STDERR: · ──────┬────────────────
// CHECK:STDERR: · ╰──┤ in completion of type `Cpp.AmbiguousDestructorT` here
// CHECK:STDERR: · │ [InTypeCompletion]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused a: Derived = {.base = {}};
@@ -143,31 +167,6 @@ library "[[@TEST_NAME]]";
import Cpp library "types.h";
fn AmbiguousDestroy() {
// CHECK:STDERR: ╭─┤ fail_destroy_nondestroyable.carbon:[[@LINE+25]]:17
// CHECK:STDERR: -> │ var unused a: Cpp.AmbiguousDestructor = {};
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type
// CHECK:STDERR: · ┃ `AmbiguousDestructor` in name binding declaration
// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_destroy_nondestroyable.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./types.h
// CHECK:STDERR: │ class AmbiguousDestructorT {
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ in instantiation of template class 'AmbiguousDestructorT<>' requested
// CHECK:STDERR: · │ │ here
// CHECK:STDERR: · │ │ [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ destructor of class 'AmbiguousDestructorT<>' is ambiguous
// CHECK:STDERR: · │ [CppInteropParseError]
// CHECK:STDERR: │ public:
// CHECK:STDERR: │ ~AmbiguousDestructorT() requires (N != 1);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function [CppInteropParseNote]
// CHECK:STDERR: │ ~AmbiguousDestructorT() requires (N != 2);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused a: Cpp.AmbiguousDestructor = {};
}
@@ -185,9 +184,9 @@ fn DeletedDestroy() {
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon
// CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) {
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ──────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: ╭─┤ fail_destroy_nondestroyable.carbon:[[@LINE+14]]:3
@@ -199,9 +198,9 @@ fn DeletedDestroy() {
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon
// CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) {
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ──────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused a: Cpp.DeletedDestructor = {};
@@ -222,9 +221,9 @@ fn PrivateDestroy() {
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon
// CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) {
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ──────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused a: Cpp.PrivateDestructor = {};
@@ -245,9 +244,9 @@ fn ProtectedDestroy() {
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon
// CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) {
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ──────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused a: Cpp.ProtectedDestructor = {};
@@ -299,9 +298,9 @@ fn F() {
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon
// CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) {
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ──────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var _: AdaptNoDestroy = Make();
@@ -609,7 +608,7 @@ fn F() {
// CHECK:STDOUT: %SubobjectDestroy.facet.be1: %SubobjectDestroy.type = facet_value %PrivateDestructor, (%custom_witness.fe1) [concrete]
// CHECK:STDOUT: %DestroyImpl.impl_witness.a8a: <witness> = impl_witness imports.%DestroyImpl.impl_witness_table, @T.as_type.as.DestroyImpl.impl(%SubobjectDestroy.facet.be1) [concrete]
// CHECK:STDOUT: %Destroy.facet.75a: %Destroy.type = facet_value %PrivateDestructor, (%DestroyImpl.impl_witness.a8a, %custom_witness.fe1) [concrete]
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc32_3.2 [concrete]
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc56_3.2 [concrete]
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.2: %SubobjectDestroy.WithSelf.Op.type.6870fd.2 = struct_value () [concrete]
// CHECK:STDOUT: %custom_witness.b80ef6.2: <witness> = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.2), @SubobjectDestroy [concrete]
// CHECK:STDOUT: %SubobjectDestroy.facet.1fc: %SubobjectDestroy.type = facet_value %Derived, (%custom_witness.b80ef6.2) [concrete]
@@ -625,52 +624,52 @@ fn F() {
// CHECK:STDOUT: fn @DestroyClassWithPrivateBaseDestructor() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %a.var: ref %Derived = var_storage %a.var_patt
// CHECK:STDOUT: %.loc32_37.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct.a40]
// CHECK:STDOUT: %.loc32_38.1: %struct_type.base.f5e = struct_literal (%.loc32_37.1) [concrete = constants.%struct]
// CHECK:STDOUT: %.loc32_38.2: ref %.c73 = class_element_access %a.var, element0
// CHECK:STDOUT: %.loc32_37.2: init %.c73 to %.loc32_38.2 = class_init () [concrete = constants.%empty_struct.d8b]
// CHECK:STDOUT: %.loc32_38.3: init %.c73 = converted %.loc32_37.1, %.loc32_37.2 [concrete = constants.%empty_struct.d8b]
// CHECK:STDOUT: %.loc32_38.4: init %PrivateDestructor = as_compatible %.loc32_38.3 [concrete = constants.%PrivateDestructor.val]
// CHECK:STDOUT: %.loc32_38.5: init %Derived to %a.var = class_init (%.loc32_38.4) [concrete = constants.%Derived.val]
// CHECK:STDOUT: %.loc32_3.1: init %Derived = converted %.loc32_38.1, %.loc32_38.5 [concrete = constants.%Derived.val]
// CHECK:STDOUT: assign %a.var, %.loc32_3.1
// CHECK:STDOUT: %.loc56_37.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct.a40]
// CHECK:STDOUT: %.loc56_38.1: %struct_type.base.f5e = struct_literal (%.loc56_37.1) [concrete = constants.%struct]
// CHECK:STDOUT: %.loc56_38.2: ref %.c73 = class_element_access %a.var, element0
// CHECK:STDOUT: %.loc56_37.2: init %.c73 to %.loc56_38.2 = class_init () [concrete = constants.%empty_struct.d8b]
// CHECK:STDOUT: %.loc56_38.3: init %.c73 = converted %.loc56_37.1, %.loc56_37.2 [concrete = constants.%empty_struct.d8b]
// CHECK:STDOUT: %.loc56_38.4: init %PrivateDestructor = as_compatible %.loc56_38.3 [concrete = constants.%PrivateDestructor.val]
// CHECK:STDOUT: %.loc56_38.5: init %Derived to %a.var = class_init (%.loc56_38.4) [concrete = constants.%Derived.val]
// CHECK:STDOUT: %.loc56_3.1: init %Derived = converted %.loc56_38.1, %.loc56_38.5 [concrete = constants.%Derived.val]
// CHECK:STDOUT: assign %a.var, %.loc56_3.1
// 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 {
// CHECK:STDOUT: %a.patt: %pattern_type.746 = ref_binding_pattern a [concrete = constants.%a.patt]
// CHECK:STDOUT: %a.var_patt: %pattern_type.746 = var_pattern %a.patt [concrete = constants.%a.var_patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Destroy.facet.loc32_3.1: %Destroy.type = facet_value constants.%Derived, (constants.%DestroyImpl.impl_witness.660, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: %.loc32_3.2: %Destroy.type = converted constants.%Derived, %Destroy.facet.loc32_3.1 [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: %Destroy.facet.loc32_3.2: %Destroy.type = facet_value constants.%Derived, (constants.%DestroyImpl.impl_witness.660, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: %.loc32_3.3: %Destroy.type = converted constants.%Derived, %Destroy.facet.loc32_3.2 [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: %Destroy.facet.loc56_3.1: %Destroy.type = facet_value constants.%Derived, (constants.%DestroyImpl.impl_witness.660, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: %.loc56_3.2: %Destroy.type = converted constants.%Derived, %Destroy.facet.loc56_3.1 [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: %Destroy.facet.loc56_3.2: %Destroy.type = facet_value constants.%Derived, (constants.%DestroyImpl.impl_witness.660, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: %.loc56_3.3: %Destroy.type = converted constants.%Derived, %Destroy.facet.loc56_3.2 [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%a.var)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc32_3.1(%self.param: ref %struct_type.base.9aa) {
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc56_3.1(%self.param: ref %struct_type.base.9aa) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc32_3.1: ref %PrivateDestructor = struct_access %self.param, element0
// CHECK:STDOUT: %Destroy.facet.loc32_3.1: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %.loc32_3.2: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc32_3.1 [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %Destroy.facet.loc32_3.2: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %.loc32_3.3: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc32_3.2 [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %.loc56_3.1: ref %PrivateDestructor = struct_access %self.param, element0
// CHECK:STDOUT: %Destroy.facet.loc56_3.1: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %.loc56_3.2: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc56_3.1 [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %Destroy.facet.loc56_3.2: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %.loc56_3.3: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc56_3.2 [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc32_3.1)
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc56_3.1)
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc32_3.2(%self.param: ref %Derived) {
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc56_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: %.loc32_3.1: ref %PrivateDestructor = class_element_access %self.param, element0
// CHECK:STDOUT: %Destroy.facet.loc32_3.1: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %.loc32_3.2: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc32_3.1 [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %Destroy.facet.loc32_3.2: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %.loc32_3.3: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc32_3.2 [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %.loc56_3.1: ref %PrivateDestructor = class_element_access %self.param, element0
// CHECK:STDOUT: %Destroy.facet.loc56_3.1: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %.loc56_3.2: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc56_3.1 [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %Destroy.facet.loc56_3.2: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %.loc56_3.3: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc56_3.2 [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc32_3.1)
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc56_3.1)
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT:
+149 -201
View File
@@ -92,15 +92,12 @@ import Cpp library "implicit_conversions.h";
fn NonConstConversionTest(s: Cpp.NonConstConversion) {
//@dump-sem-ir-begin
// CHECK:STDERR: ╭─┤ fail_expr_category.carbon:[[@LINE+11]]:21
// CHECK:STDERR: ╭─┤ fail_expr_category.carbon:[[@LINE+8]]:21
// CHECK:STDERR: -> │ let _: Cpp.Dest = s;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `NonConstConversion` to `Cpp.Dest`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.NonConstConversion` does not implement
// CHECK:STDERR: · │ interface `Core.ImplicitAs(Cpp.Dest)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `NonConstConversion` to `Cpp.Dest`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.Dest = s;
@@ -161,17 +158,13 @@ import Cpp library "implicit_conversions.h";
fn DeletedConstructorTest(s: Cpp.Source) {
//@dump-sem-ir-begin
// CHECK:STDERR: ╭─┤ fail_deleted.carbon:[[@LINE+13]]:35
// CHECK:STDERR: ╭─┤ fail_deleted.carbon:[[@LINE+9]]:35
// CHECK:STDERR: -> │ let _: Cpp.DeletedConstructor = s;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert
// CHECK:STDERR: · │ ┃ expression of type `Source` to
// CHECK:STDERR: · │ ┃ `Cpp.DeletedConstructor`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╭─────────────────────────────────╯
// CHECK:STDERR: · │ type `Cpp.Source` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.DeletedConstructor)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ expression of type `Source` to
// CHECK:STDERR: · ┃ `Cpp.DeletedConstructor`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.DeletedConstructor = s;
@@ -180,15 +173,12 @@ fn DeletedConstructorTest(s: Cpp.Source) {
fn DeletedConversionTest(s: Cpp.DeletedConversion) {
//@dump-sem-ir-begin
// CHECK:STDERR: ╭─┤ fail_deleted.carbon:[[@LINE+11]]:21
// CHECK:STDERR: ╭─┤ fail_deleted.carbon:[[@LINE+8]]:21
// CHECK:STDERR: -> │ let _: Cpp.Dest = s;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `DeletedConversion` to `Cpp.Dest`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.DeletedConversion` does not implement
// CHECK:STDERR: · │ interface `Core.ImplicitAs(Cpp.Dest)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `DeletedConversion` to `Cpp.Dest`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.Dest = s;
@@ -203,17 +193,13 @@ import Cpp library "implicit_conversions.h";
fn ExplicitConstructorTest(s: Cpp.Source) {
//@dump-sem-ir-begin
// CHECK:STDERR: ╭─┤ fail_explicit.carbon:[[@LINE+13]]:36
// CHECK:STDERR: ╭─┤ fail_explicit.carbon:[[@LINE+9]]:36
// CHECK:STDERR: -> │ let _: Cpp.ExplicitConstructor = s;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert
// CHECK:STDERR: · │ ┃ expression of type `Source` to
// CHECK:STDERR: · │ ┃ `Cpp.ExplicitConstructor`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╭──────────────────────────────────╯
// CHECK:STDERR: · │ type `Cpp.Source` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.ExplicitConstructor)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ expression of type `Source` to
// CHECK:STDERR: · ┃ `Cpp.ExplicitConstructor`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.ExplicitConstructor = s;
@@ -222,15 +208,12 @@ fn ExplicitConstructorTest(s: Cpp.Source) {
fn ExplicitConversionTest(s: Cpp.ExplicitConversion) {
//@dump-sem-ir-begin
// CHECK:STDERR: ╭─┤ fail_explicit.carbon:[[@LINE+11]]:21
// CHECK:STDERR: ╭─┤ fail_explicit.carbon:[[@LINE+8]]:21
// CHECK:STDERR: -> │ let _: Cpp.Dest = s;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `ExplicitConversion` to `Cpp.Dest`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.ExplicitConversion` does not implement
// CHECK:STDERR: · │ interface `Core.ImplicitAs(Cpp.Dest)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `ExplicitConversion` to `Cpp.Dest`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.Dest = s;
@@ -257,15 +240,12 @@ 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+16]]:31
// CHECK:STDERR: ╭─┤ fail_no_u32_to_int_conversion_in_carbon.carbon:[[@LINE+13]]:31
// CHECK:STDERR: -> │ let _: Cpp.IntConstructor = u;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression
// CHECK:STDERR: · │ ┃ of type `u32` to `i32`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `u32` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(i32)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ of type `u32` to `i32`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./implicit_conversions.h
// CHECK:STDERR: │ IntConstructor(int);
@@ -341,42 +321,32 @@ import Cpp library "aggregate.h";
fn InitFromTuple() {
//@dump-sem-ir-begin
// CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_tuple.carbon:[[@LINE+11]]:26
// CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_tuple.carbon:[[@LINE+8]]:26
// CHECK:STDERR: -> │ let _: Cpp.Aggregate = ();
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of
// CHECK:STDERR: · │ ┃ type `()` to `Cpp.Aggregate`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `()` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Aggregate)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ type `()` to `Cpp.Aggregate`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.Aggregate = ();
// CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_tuple.carbon:[[@LINE+12]]:26
// CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_tuple.carbon:[[@LINE+9]]:26
// CHECK:STDERR: -> │ let _: Cpp.Aggregate = (1,);
// CHECK:STDERR: · ┳━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of
// CHECK:STDERR: · │ ┃ type `(Core.IntLiteral,)` to
// CHECK:STDERR: · │ ┃ `Cpp.Aggregate`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `(Core.IntLiteral,)` does not implement
// CHECK:STDERR: · │ interface `Core.ImplicitAs(Cpp.Aggregate)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ type `(Core.IntLiteral,)` to
// CHECK:STDERR: · ┃ `Cpp.Aggregate`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.Aggregate = (1,);
// CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_tuple.carbon:[[@LINE+13]]:26
// CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_tuple.carbon:[[@LINE+9]]:26
// CHECK:STDERR: -> │ let _: Cpp.Aggregate = (1, 2);
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of
// CHECK:STDERR: · │ ┃ type `(Core.IntLiteral, Core.IntLiteral)`
// CHECK:STDERR: · │ ┃ to `Cpp.Aggregate`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `(Core.IntLiteral, Core.IntLiteral)` does
// CHECK:STDERR: · │ not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Aggregate)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ type `(Core.IntLiteral, Core.IntLiteral)`
// CHECK:STDERR: · ┃ to `Cpp.Aggregate`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.Aggregate = (1, 2);
@@ -391,42 +361,32 @@ import Cpp library "aggregate.h";
fn InitFromStruct() {
//@dump-sem-ir-begin
// CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_struct.carbon:[[@LINE+11]]:26
// CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_struct.carbon:[[@LINE+8]]:26
// CHECK:STDERR: -> │ let _: Cpp.Aggregate = {};
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of
// CHECK:STDERR: · │ ┃ type `{}` to `Cpp.Aggregate`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `{}` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Aggregate)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ type `{}` to `Cpp.Aggregate`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.Aggregate = {};
// CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_struct.carbon:[[@LINE+12]]:26
// CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_struct.carbon:[[@LINE+9]]:26
// CHECK:STDERR: -> │ let _: Cpp.Aggregate = {.x = 1};
// CHECK:STDERR: · ┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of
// CHECK:STDERR: · │ ┃ type `{.x: Core.IntLiteral}` to
// CHECK:STDERR: · │ ┃ `Cpp.Aggregate`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `{.x: Core.IntLiteral}` does not implement
// CHECK:STDERR: · │ interface `Core.ImplicitAs(Cpp.Aggregate)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ type `{.x: Core.IntLiteral}` to
// CHECK:STDERR: · ┃ `Cpp.Aggregate`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.Aggregate = {.x = 1};
// CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_struct.carbon:[[@LINE+13]]:26
// CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_struct.carbon:[[@LINE+9]]:26
// CHECK:STDERR: -> │ let _: Cpp.Aggregate = {.x = 1, .y = 2};
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: cannot implicitly convert expression of type
// CHECK:STDERR: · ┃ `{.x: Core.IntLiteral, .y: Core.IntLiteral}` to `Cpp.Aggregate`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: · ╰──┤ type `{.x: Core.IntLiteral, .y: Core.IntLiteral}`
// CHECK:STDERR: · │ does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Aggregate)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.Aggregate = {.x = 1, .y = 2};
@@ -455,44 +415,32 @@ import Cpp library "aggregate.h";
fn InitFromStruct() {
//@dump-sem-ir-begin
// CHECK:STDERR: ╭─┤ fail_non_aggregate_from_struct.carbon:[[@LINE+11]]:29
// CHECK:STDERR: ╭─┤ fail_non_aggregate_from_struct.carbon:[[@LINE+8]]:29
// CHECK:STDERR: -> │ let _: Cpp.NonAggregate = {};
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of
// CHECK:STDERR: · │ ┃ type `{}` to `Cpp.NonAggregate`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `{}` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.NonAggregate)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ type `{}` to `Cpp.NonAggregate`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.NonAggregate = {};
// CHECK:STDERR: ╭─┤ fail_non_aggregate_from_struct.carbon:[[@LINE+13]]:29
// CHECK:STDERR: ╭─┤ fail_non_aggregate_from_struct.carbon:[[@LINE+9]]:29
// CHECK:STDERR: -> │ let _: Cpp.NonAggregate = {.x = 1};
// CHECK:STDERR: · ┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of
// CHECK:STDERR: · │ ┃ type `{.x: Core.IntLiteral}` to
// CHECK:STDERR: · │ ┃ `Cpp.NonAggregate`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `{.x: Core.IntLiteral}` does not
// CHECK:STDERR: · │ implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.NonAggregate)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ type `{.x: Core.IntLiteral}` to
// CHECK:STDERR: · ┃ `Cpp.NonAggregate`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.NonAggregate = {.x = 1};
// CHECK:STDERR: ╭─┤ fail_non_aggregate_from_struct.carbon:[[@LINE+14]]:29
// CHECK:STDERR: ╭─┤ fail_non_aggregate_from_struct.carbon:[[@LINE+9]]:29
// CHECK:STDERR: -> │ let _: Cpp.NonAggregate = {.x = 1, .y = 2};
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: cannot implicitly convert expression of type
// CHECK:STDERR: · ┃ `{.x: Core.IntLiteral, .y: Core.IntLiteral}` to `Cpp.NonAggregate`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: · ╰──┤ type
// CHECK:STDERR: · │ `{.x: Core.IntLiteral, .y: Core.IntLiteral}`
// CHECK:STDERR: · │ does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.NonAggregate)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.NonAggregate = {.x = 1, .y = 2};
@@ -680,9 +628,9 @@ fn InitFromStruct() {
// CHECK:STDOUT: fn @NonConstConversionTest(%s.param: %NonConstConversion) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %s.ref: %NonConstConversion = name_ref s, %s
// CHECK:STDOUT: %.loc19_21: %Dest.980 = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc19_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] {
// CHECK:STDOUT: %Cpp.ref.loc19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %.loc16_21: %Dest.980 = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc16_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] {
// CHECK:STDOUT: %Cpp.ref.loc16: <namespace> = 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 _, <error> [concrete = <error>]
@@ -844,9 +792,9 @@ fn InitFromStruct() {
// CHECK:STDOUT: fn @DeletedConstructorTest(%s.param: %Source) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %s.ref: %Source = name_ref s, %s
// CHECK:STDOUT: %.loc21_35: %DeletedConstructor = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc21_13: type = splice_block %DeletedConstructor.ref [concrete = constants.%DeletedConstructor] {
// CHECK:STDOUT: %Cpp.ref.loc21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %.loc17_35: %DeletedConstructor = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc17_13: type = splice_block %DeletedConstructor.ref [concrete = constants.%DeletedConstructor] {
// CHECK:STDOUT: %Cpp.ref.loc17: <namespace> = 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 _, <error> [concrete = <error>]
@@ -859,9 +807,9 @@ fn InitFromStruct() {
// CHECK:STDOUT: fn @DeletedConversionTest(%s.param: %DeletedConversion) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %s.ref: %DeletedConversion = name_ref s, %s
// CHECK:STDOUT: %.loc38_21: %Dest.980 = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc38_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] {
// CHECK:STDOUT: %Cpp.ref.loc38: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %.loc31_21: %Dest.980 = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc31_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] {
// CHECK:STDOUT: %Cpp.ref.loc31: <namespace> = 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 _, <error> [concrete = <error>]
@@ -902,9 +850,9 @@ fn InitFromStruct() {
// CHECK:STDOUT: fn @ExplicitConstructorTest(%s.param: %Source) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %s.ref: %Source = name_ref s, %s
// CHECK:STDOUT: %.loc21_36: %ExplicitConstructor = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc21_13: type = splice_block %ExplicitConstructor.ref [concrete = constants.%ExplicitConstructor] {
// CHECK:STDOUT: %Cpp.ref.loc21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %.loc17_36: %ExplicitConstructor = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc17_13: type = splice_block %ExplicitConstructor.ref [concrete = constants.%ExplicitConstructor] {
// CHECK:STDOUT: %Cpp.ref.loc17: <namespace> = 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 _, <error> [concrete = <error>]
@@ -917,9 +865,9 @@ fn InitFromStruct() {
// CHECK:STDOUT: fn @ExplicitConversionTest(%s.param: %ExplicitConversion) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %s.ref: %ExplicitConversion = name_ref s, %s
// CHECK:STDOUT: %.loc38_21: %Dest.980 = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc38_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] {
// CHECK:STDOUT: %Cpp.ref.loc38: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %.loc31_21: %Dest.980 = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc31_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] {
// CHECK:STDOUT: %Cpp.ref.loc31: <namespace> = 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 _, <error> [concrete = <error>]
@@ -1042,28 +990,28 @@ fn InitFromStruct() {
// CHECK:STDOUT: fn @IntConstructorTest(%u.param: %u32) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %u.ref: %u32 = name_ref u, %u
// CHECK:STDOUT: %.loc24_31.1: ref %IntConstructor = temporary_storage
// CHECK:STDOUT: %.loc24_31.2: %i32 = converted %u.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %addr: %ptr.100 = addr_of %.loc24_31.1
// CHECK:STDOUT: %.loc21_31.1: ref %IntConstructor = temporary_storage
// CHECK:STDOUT: %.loc21_31.2: %i32 = converted %u.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %addr: %ptr.100 = addr_of %.loc21_31.1
// CHECK:STDOUT: %IntConstructor__carbon_thunk.call: init %empty_tuple.type = call imports.%IntConstructor__carbon_thunk.decl(<error>, %addr)
// CHECK:STDOUT: %.loc24_31.3: init %IntConstructor to %.loc24_31.1 = mark_in_place_init %IntConstructor__carbon_thunk.call
// CHECK:STDOUT: %.loc24_31.4: init %IntConstructor = converted %u.ref, %.loc24_31.3
// CHECK:STDOUT: %.loc24_31.5: ref %IntConstructor = temporary %.loc24_31.1, %.loc24_31.4
// CHECK:STDOUT: %.loc24_31.6: %IntConstructor = acquire_value %.loc24_31.5
// CHECK:STDOUT: %.loc24_13: type = splice_block %IntConstructor.ref [concrete = constants.%IntConstructor] {
// CHECK:STDOUT: %.loc21_31.3: init %IntConstructor to %.loc21_31.1 = mark_in_place_init %IntConstructor__carbon_thunk.call
// CHECK:STDOUT: %.loc21_31.4: init %IntConstructor = converted %u.ref, %.loc21_31.3
// CHECK:STDOUT: %.loc21_31.5: ref %IntConstructor = temporary %.loc21_31.1, %.loc21_31.4
// CHECK:STDOUT: %.loc21_31.6: %IntConstructor = acquire_value %.loc21_31.5
// CHECK:STDOUT: %.loc21_13: type = splice_block %IntConstructor.ref [concrete = constants.%IntConstructor] {
// CHECK:STDOUT: %Cpp.ref: <namespace> = 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 _, %.loc24_31.6
// CHECK:STDOUT: %_: %IntConstructor = wrapper_binding _, %.loc21_31.6
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt: %pattern_type.c4e = value_binding_pattern _ [concrete = constants.%_.patt.151]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Destroy.facet.loc24_31.1: %Destroy.type = facet_value constants.%IntConstructor, (constants.%DestroyImpl.impl_witness.1d9, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc24_31.7: %Destroy.type = converted constants.%IntConstructor, %Destroy.facet.loc24_31.1 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %Destroy.facet.loc24_31.2: %Destroy.type = facet_value constants.%IntConstructor, (constants.%DestroyImpl.impl_witness.1d9, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc24_31.8: %Destroy.type = converted constants.%IntConstructor, %Destroy.facet.loc24_31.2 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %Destroy.facet.loc21_31.1: %Destroy.type = facet_value constants.%IntConstructor, (constants.%DestroyImpl.impl_witness.1d9, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc21_31.7: %Destroy.type = converted constants.%IntConstructor, %Destroy.facet.loc21_31.1 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %Destroy.facet.loc21_31.2: %Destroy.type = facet_value constants.%IntConstructor, (constants.%DestroyImpl.impl_witness.1d9, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc21_31.8: %Destroy.type = converted constants.%IntConstructor, %Destroy.facet.loc21_31.2 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc24_31.5)
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc21_31.5)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -1384,38 +1332,38 @@ fn InitFromStruct() {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @InitFromTuple() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc19_27.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
// CHECK:STDOUT: %.loc19_27.2: %Aggregate = converted %.loc19_27.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc19_13: type = splice_block %Aggregate.ref.loc19 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc19: <namespace> = 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: %.loc16_27.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
// CHECK:STDOUT: %.loc16_27.2: %Aggregate = converted %.loc16_27.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc16_13: type = splice_block %Aggregate.ref.loc16 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc16: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc16: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_.loc19: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: %_.loc16: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc19: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: %_.patt.loc16: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %int_1.loc32: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %.loc32_29.1: %tuple.type.985 = tuple_literal (%int_1.loc32) [concrete = constants.%tuple.378]
// CHECK:STDOUT: %.loc32_29.2: %Aggregate = converted %.loc32_29.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc32_13: type = splice_block %Aggregate.ref.loc32 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc32: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc32: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
// CHECK:STDOUT: %int_1.loc26: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %.loc26_29.1: %tuple.type.985 = tuple_literal (%int_1.loc26) [concrete = constants.%tuple.378]
// CHECK:STDOUT: %.loc26_29.2: %Aggregate = converted %.loc26_29.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc26_13: type = splice_block %Aggregate.ref.loc26 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc26: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc26: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_.loc32: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: %_.loc26: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc32: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: %_.patt.loc26: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %int_1.loc46: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %int_1.loc36: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2]
// CHECK:STDOUT: %.loc46_31.1: %tuple.type.f94 = tuple_literal (%int_1.loc46, %int_2) [concrete = constants.%tuple.ad8]
// CHECK:STDOUT: %.loc46_31.2: %Aggregate = converted %.loc46_31.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc46_13: type = splice_block %Aggregate.ref.loc46 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc46: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc46: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
// CHECK:STDOUT: %.loc36_31.1: %tuple.type.f94 = tuple_literal (%int_1.loc36, %int_2) [concrete = constants.%tuple.ad8]
// CHECK:STDOUT: %.loc36_31.2: %Aggregate = converted %.loc36_31.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc36_13: type = splice_block %Aggregate.ref.loc36 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc36: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc36: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_.loc46: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: %_.loc36: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc46: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: %_.patt.loc36: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
@@ -1447,38 +1395,38 @@ fn InitFromStruct() {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @InitFromStruct() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc19_27.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
// CHECK:STDOUT: %.loc19_27.2: %Aggregate = converted %.loc19_27.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc19_13: type = splice_block %Aggregate.ref.loc19 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc19: <namespace> = 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: %.loc16_27.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
// CHECK:STDOUT: %.loc16_27.2: %Aggregate = converted %.loc16_27.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc16_13: type = splice_block %Aggregate.ref.loc16 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc16: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc16: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_.loc19: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: %_.loc16: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc19: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: %_.patt.loc16: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %int_1.loc32: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %.loc32_33.1: %struct_type.x = struct_literal (%int_1.loc32) [concrete = constants.%struct.147]
// CHECK:STDOUT: %.loc32_33.2: %Aggregate = converted %.loc32_33.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc32_13: type = splice_block %Aggregate.ref.loc32 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc32: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc32: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
// CHECK:STDOUT: %int_1.loc26: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %.loc26_33.1: %struct_type.x = struct_literal (%int_1.loc26) [concrete = constants.%struct.147]
// CHECK:STDOUT: %.loc26_33.2: %Aggregate = converted %.loc26_33.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc26_13: type = splice_block %Aggregate.ref.loc26 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc26: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc26: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_.loc32: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: %_.loc26: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc32: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: %_.patt.loc26: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %int_1.loc46: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %int_1.loc36: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2]
// CHECK:STDOUT: %.loc46_41.1: %struct_type.x.y = struct_literal (%int_1.loc46, %int_2) [concrete = constants.%struct.004]
// CHECK:STDOUT: %.loc46_41.2: %Aggregate = converted %.loc46_41.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc46_13: type = splice_block %Aggregate.ref.loc46 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc46: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc46: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
// CHECK:STDOUT: %.loc36_41.1: %struct_type.x.y = struct_literal (%int_1.loc36, %int_2) [concrete = constants.%struct.004]
// CHECK:STDOUT: %.loc36_41.2: %Aggregate = converted %.loc36_41.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc36_13: type = splice_block %Aggregate.ref.loc36 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc36: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc36: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_.loc46: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: %_.loc36: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc46: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: %_.patt.loc36: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
@@ -1686,38 +1634,38 @@ fn InitFromStruct() {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @InitFromStruct() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc19_30.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
// CHECK:STDOUT: %.loc19_30.2: %NonAggregate = converted %.loc19_30.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc19_13: type = splice_block %NonAggregate.ref.loc19 [concrete = constants.%NonAggregate] {
// CHECK:STDOUT: %Cpp.ref.loc19: <namespace> = 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: %.loc16_30.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
// CHECK:STDOUT: %.loc16_30.2: %NonAggregate = converted %.loc16_30.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc16_13: type = splice_block %NonAggregate.ref.loc16 [concrete = constants.%NonAggregate] {
// CHECK:STDOUT: %Cpp.ref.loc16: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %NonAggregate.ref.loc16: type = name_ref NonAggregate, imports.%NonAggregate.decl [concrete = constants.%NonAggregate]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_.loc19: %NonAggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: %_.loc16: %NonAggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc19: %pattern_type.273 = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: %_.patt.loc16: %pattern_type.273 = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %int_1.loc33: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %.loc33_36.1: %struct_type.x = struct_literal (%int_1.loc33) [concrete = constants.%struct.147]
// CHECK:STDOUT: %.loc33_36.2: %NonAggregate = converted %.loc33_36.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc33_13: type = splice_block %NonAggregate.ref.loc33 [concrete = constants.%NonAggregate] {
// CHECK:STDOUT: %Cpp.ref.loc33: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %NonAggregate.ref.loc33: type = name_ref NonAggregate, imports.%NonAggregate.decl [concrete = constants.%NonAggregate]
// CHECK:STDOUT: %int_1.loc26: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %.loc26_36.1: %struct_type.x = struct_literal (%int_1.loc26) [concrete = constants.%struct.147]
// CHECK:STDOUT: %.loc26_36.2: %NonAggregate = converted %.loc26_36.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc26_13: type = splice_block %NonAggregate.ref.loc26 [concrete = constants.%NonAggregate] {
// CHECK:STDOUT: %Cpp.ref.loc26: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %NonAggregate.ref.loc26: type = name_ref NonAggregate, imports.%NonAggregate.decl [concrete = constants.%NonAggregate]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_.loc33: %NonAggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: %_.loc26: %NonAggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc33: %pattern_type.273 = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: %_.patt.loc26: %pattern_type.273 = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %int_1.loc48: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %int_1.loc36: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2]
// CHECK:STDOUT: %.loc48_44.1: %struct_type.x.y = struct_literal (%int_1.loc48, %int_2) [concrete = constants.%struct.004]
// CHECK:STDOUT: %.loc48_44.2: %NonAggregate = converted %.loc48_44.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc48_13: type = splice_block %NonAggregate.ref.loc48 [concrete = constants.%NonAggregate] {
// CHECK:STDOUT: %Cpp.ref.loc48: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %NonAggregate.ref.loc48: type = name_ref NonAggregate, imports.%NonAggregate.decl [concrete = constants.%NonAggregate]
// CHECK:STDOUT: %.loc36_44.1: %struct_type.x.y = struct_literal (%int_1.loc36, %int_2) [concrete = constants.%struct.004]
// CHECK:STDOUT: %.loc36_44.2: %NonAggregate = converted %.loc36_44.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc36_13: type = splice_block %NonAggregate.ref.loc36 [concrete = constants.%NonAggregate] {
// CHECK:STDOUT: %Cpp.ref.loc36: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %NonAggregate.ref.loc36: type = name_ref NonAggregate, imports.%NonAggregate.decl [concrete = constants.%NonAggregate]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_.loc48: %NonAggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: %_.loc36: %NonAggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc48: %pattern_type.273 = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: %_.patt.loc36: %pattern_type.273 = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }