diff --git a/core/prelude/operators/as.carbon b/core/prelude/operators/as.carbon index 7c7728632fc4..4a89db108caf 100644 --- a/core/prelude/operators/as.carbon +++ b/core/prelude/operators/as.carbon @@ -23,3 +23,11 @@ interface ImplicitAs(Dest:! type) { impl forall [T:! Copy] T as ImplicitAs(T) { fn Convert[self: Self]() -> Self { return self.(Copy.Op)(); } } + +impl forall [T:! type, U:! ImplicitAs(T)] U as ImplicitAs(const T) { + fn Convert[self: U]() -> const T { return self.Convert(); } +} + +impl forall [T:! type, U:! ImplicitAs(T)] const U as ImplicitAs(T) { + fn Convert[self: const U]() -> T { return (self as U).Convert(); } +} diff --git a/core/prelude/types/optional.carbon b/core/prelude/types/optional.carbon index 73f876aa6cce..aecf2c5d2a75 100644 --- a/core/prelude/types/optional.carbon +++ b/core/prelude/types/optional.carbon @@ -7,6 +7,7 @@ package Core library "prelude/types/optional"; import library "prelude/copy"; import library "prelude/destroy"; import library "prelude/operators/as"; +import library "prelude/operators/bitwise"; import library "prelude/types/bool"; import library "prelude/types/maybe_unformed"; @@ -35,16 +36,54 @@ class Optional(T:! OptionalStorage) { return T.Get(self as T.Type); } - impl T as ImplicitAs(Optional(T)) { - fn Convert[self: T]() -> Optional(T) { - return Some(self); - } - } - // TODO: Use `private adapt` or `unsafe adapt` once available. adapt T.Type; } +// Support for converting a `T` to an `Optional(U)` if `T` converts to `U`. +// Once we have match_first, this can be rewritten more simply as: +// +// match_first { +// impl forall [T:! OptionalStorage] +// T as ImplicitAs(Optional(T)) { +// fn Convert[self: T]() -> Optional(T) { +// return Optional(T).Some(self); +// } +// } +// +// impl forall [T:! Destroy & OptionalStorage, U:! ImplicitAs(T)] +// U as ImplicitAs(Optional(T)) { +// fn Convert[self: U]() -> Optional(T) { +// return Optional(T).Some(self.Convert()); +// } +// } +// } + +private interface OptionalAs(T:! OptionalStorage) { + fn Convert[self: Self]() -> Optional(T); +} + +final impl forall [T:! OptionalStorage] + T as OptionalAs(T) { + fn Convert[self: Self]() -> Optional(T) { + return Optional(T).Some(self); + } +} + +impl forall [T:! Destroy & OptionalStorage, U:! ImplicitAs(T)] + U as OptionalAs(T) { + fn Convert[self: Self]() -> Optional(T) { + return Optional(T).Some(self.Convert()); + } +} + +impl forall [T:! OptionalStorage, U:! OptionalAs(T)] + U as ImplicitAs(Optional(T)) { + fn Convert[self: Self]() -> Optional(T) { + return self.Convert(); + } +} + // By default, an `Optional(T)` is stored as a pair of a `bool` and a // `MaybeUnformed(T)`, with the `MaybeUnformed(T)` left uninitialized if the // `bool` is `false`. diff --git a/toolchain/check/testdata/interop/cpp/function/decayed_param.carbon b/toolchain/check/testdata/interop/cpp/function/decayed_param.carbon index 6e15b6b9530c..38c111cdcb35 100644 --- a/toolchain/check/testdata/interop/cpp/function/decayed_param.carbon +++ b/toolchain/check/testdata/interop/cpp/function/decayed_param.carbon @@ -97,6 +97,7 @@ fn F() { // CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic] // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.f51: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%To) [symbolic] // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.2a1: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.f51 = struct_value () [symbolic] +// CHECK:STDOUT: %T.d9f: type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %ImplicitAs.impl_witness.bc9: = impl_witness imports.%ImplicitAs.impl_witness_table.132, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete] // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.51e: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete] // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.51e = struct_value () [concrete] @@ -109,26 +110,32 @@ fn F() { // CHECK:STDOUT: %ptr.235: type = ptr_type %i32 [concrete] // CHECK:STDOUT: %OptionalStorage.type: type = facet_type <@OptionalStorage> [concrete] // CHECK:STDOUT: %T.3fe: %OptionalStorage.type = symbolic_binding T, 0 [symbolic] -// CHECK:STDOUT: %T.d9f: type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %ptr.4f0: type = ptr_type %T.d9f [symbolic] // CHECK:STDOUT: %MaybeUnformed.cff: type = class_type @MaybeUnformed, @MaybeUnformed(%ptr.4f0) [symbolic] // CHECK:STDOUT: %ptr.as.OptionalStorage.impl.Some.type.911: type = fn_type @ptr.as.OptionalStorage.impl.Some, @ptr.as.OptionalStorage.impl(%T.d9f) [symbolic] // CHECK:STDOUT: %ptr.as.OptionalStorage.impl.Some.2a0: %ptr.as.OptionalStorage.impl.Some.type.911 = struct_value () [symbolic] // CHECK:STDOUT: %OptionalStorage.impl_witness.2cf: = impl_witness imports.%OptionalStorage.impl_witness_table.236, @ptr.as.OptionalStorage.impl(%i32) [concrete] -// CHECK:STDOUT: %OptionalStorage.facet: %OptionalStorage.type = facet_value %ptr.235, (%OptionalStorage.impl_witness.2cf) [concrete] -// CHECK:STDOUT: %Optional.18c: type = class_type @Optional, @Optional(%OptionalStorage.facet) [concrete] +// CHECK:STDOUT: %OptionalStorage.facet.0a3: %OptionalStorage.type = facet_value %ptr.235, (%OptionalStorage.impl_witness.2cf) [concrete] +// CHECK:STDOUT: %Optional.18c: type = class_type @Optional, @Optional(%OptionalStorage.facet.0a3) [concrete] // CHECK:STDOUT: %TakesArray.type: type = fn_type @TakesArray [concrete] // CHECK:STDOUT: %TakesArray: %TakesArray.type = struct_value () [concrete] // CHECK:STDOUT: %ImplicitAs.type.4f4: type = facet_type <@ImplicitAs, @ImplicitAs(%Optional.18c)> [concrete] // CHECK:STDOUT: %ImplicitAs.Convert.type.7ef: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%Optional.18c) [concrete] -// CHECK:STDOUT: %T.binding.as_type.as.ImplicitAs.impl.Convert.type.a78: type = fn_type @T.binding.as_type.as.ImplicitAs.impl.Convert.2, @T.binding.as_type.as.ImplicitAs.impl.339(%T.3fe) [symbolic] -// CHECK:STDOUT: %T.binding.as_type.as.ImplicitAs.impl.Convert.d1b: %T.binding.as_type.as.ImplicitAs.impl.Convert.type.a78 = struct_value () [symbolic] -// CHECK:STDOUT: %ImplicitAs.impl_witness.f82: = impl_witness imports.%ImplicitAs.impl_witness_table.284, @T.binding.as_type.as.ImplicitAs.impl.339(%OptionalStorage.facet) [concrete] -// CHECK:STDOUT: %T.binding.as_type.as.ImplicitAs.impl.Convert.type.f2f: type = fn_type @T.binding.as_type.as.ImplicitAs.impl.Convert.2, @T.binding.as_type.as.ImplicitAs.impl.339(%OptionalStorage.facet) [concrete] -// CHECK:STDOUT: %T.binding.as_type.as.ImplicitAs.impl.Convert.2dc: %T.binding.as_type.as.ImplicitAs.impl.Convert.type.f2f = struct_value () [concrete] -// CHECK:STDOUT: %ImplicitAs.facet.6d1: %ImplicitAs.type.4f4 = facet_value %ptr.235, (%ImplicitAs.impl_witness.f82) [concrete] -// CHECK:STDOUT: %.e81: type = fn_type_with_self_type %ImplicitAs.Convert.type.7ef, %ImplicitAs.facet.6d1 [concrete] -// CHECK:STDOUT: %T.binding.as_type.as.ImplicitAs.impl.Convert.specific_fn: = specific_function %T.binding.as_type.as.ImplicitAs.impl.Convert.2dc, @T.binding.as_type.as.ImplicitAs.impl.Convert.2(%OptionalStorage.facet) [concrete] +// CHECK:STDOUT: %OptionalAs.type.593: type = facet_type <@OptionalAs, @OptionalAs(%T.3fe)> [symbolic] +// CHECK:STDOUT: %U.ec3: %OptionalAs.type.593 = symbolic_binding U, 1 [symbolic] +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.type.855: type = fn_type @U.binding.as_type.as.ImplicitAs.impl.Convert.2, @U.binding.as_type.as.ImplicitAs.impl.ea7(%T.3fe, %U.ec3) [symbolic] +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.337: %U.binding.as_type.as.ImplicitAs.impl.Convert.type.855 = struct_value () [symbolic] +// CHECK:STDOUT: %OptionalAs.type.75b: type = facet_type <@OptionalAs, @OptionalAs(%OptionalStorage.facet.0a3)> [concrete] +// CHECK:STDOUT: %T.binding.as_type.as.OptionalAs.impl.Convert.type.8c6: type = fn_type @T.binding.as_type.as.OptionalAs.impl.Convert, @T.binding.as_type.as.OptionalAs.impl(%T.3fe) [symbolic] +// CHECK:STDOUT: %T.binding.as_type.as.OptionalAs.impl.Convert.180: %T.binding.as_type.as.OptionalAs.impl.Convert.type.8c6 = struct_value () [symbolic] +// CHECK:STDOUT: %OptionalAs.impl_witness.06b: = impl_witness imports.%OptionalAs.impl_witness_table.8ee, @T.binding.as_type.as.OptionalAs.impl(%OptionalStorage.facet.0a3) [concrete] +// CHECK:STDOUT: %OptionalAs.facet: %OptionalAs.type.75b = facet_value %ptr.235, (%OptionalAs.impl_witness.06b) [concrete] +// CHECK:STDOUT: %ImplicitAs.impl_witness.f51: = impl_witness imports.%ImplicitAs.impl_witness_table.da6, @U.binding.as_type.as.ImplicitAs.impl.ea7(%OptionalStorage.facet.0a3, %OptionalAs.facet) [concrete] +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.type.f95: type = fn_type @U.binding.as_type.as.ImplicitAs.impl.Convert.2, @U.binding.as_type.as.ImplicitAs.impl.ea7(%OptionalStorage.facet.0a3, %OptionalAs.facet) [concrete] +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.b59: %U.binding.as_type.as.ImplicitAs.impl.Convert.type.f95 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet.59b: %ImplicitAs.type.4f4 = facet_value %ptr.235, (%ImplicitAs.impl_witness.f51) [concrete] +// CHECK:STDOUT: %.4d2: type = fn_type_with_self_type %ImplicitAs.Convert.type.7ef, %ImplicitAs.facet.59b [concrete] +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.specific_fn: = specific_function %U.binding.as_type.as.ImplicitAs.impl.Convert.b59, @U.binding.as_type.as.ImplicitAs.impl.Convert.2(%OptionalStorage.facet.0a3, %OptionalAs.facet) [concrete] // CHECK:STDOUT: %type_where: type = facet_type > [concrete] // CHECK:STDOUT: %facet_value.888: %type_where = facet_value %Optional.18c, () [concrete] // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.b81: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.888) [concrete] @@ -159,14 +166,16 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: %.loc11_23.1: type = splice_block %Optional [concrete = constants.%Optional.18c] { // CHECK:STDOUT: -// CHECK:STDOUT: %OptionalStorage.facet: %OptionalStorage.type = facet_value constants.%ptr.235, (constants.%OptionalStorage.impl_witness.2cf) [concrete = constants.%OptionalStorage.facet] -// CHECK:STDOUT: %.loc11_23.2: %OptionalStorage.type = converted constants.%ptr.235, %OptionalStorage.facet [concrete = constants.%OptionalStorage.facet] -// CHECK:STDOUT: %Optional: type = class_type @Optional, @Optional(constants.%OptionalStorage.facet) [concrete = constants.%Optional.18c] +// CHECK:STDOUT: %OptionalStorage.facet: %OptionalStorage.type = facet_value constants.%ptr.235, (constants.%OptionalStorage.impl_witness.2cf) [concrete = constants.%OptionalStorage.facet.0a3] +// CHECK:STDOUT: %.loc11_23.2: %OptionalStorage.type = converted constants.%ptr.235, %OptionalStorage.facet [concrete = constants.%OptionalStorage.facet.0a3] +// CHECK:STDOUT: %Optional: type = class_type @Optional, @Optional(constants.%OptionalStorage.facet.0a3) [concrete = constants.%Optional.18c] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import_ref.7bc: @T.binding.as_type.as.ImplicitAs.impl.339.%T.binding.as_type.as.ImplicitAs.impl.Convert.type (%T.binding.as_type.as.ImplicitAs.impl.Convert.type.a78) = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, loaded [symbolic = @T.binding.as_type.as.ImplicitAs.impl.339.%T.binding.as_type.as.ImplicitAs.impl.Convert (constants.%T.binding.as_type.as.ImplicitAs.impl.Convert.d1b)] -// CHECK:STDOUT: %ImplicitAs.impl_witness_table.284 = impl_witness_table (%Core.import_ref.7bc), @T.binding.as_type.as.ImplicitAs.impl.339 [concrete] +// CHECK:STDOUT: %Core.import_ref.ec9: @U.binding.as_type.as.ImplicitAs.impl.ea7.%U.binding.as_type.as.ImplicitAs.impl.Convert.type (%U.binding.as_type.as.ImplicitAs.impl.Convert.type.855) = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, loaded [symbolic = @U.binding.as_type.as.ImplicitAs.impl.ea7.%U.binding.as_type.as.ImplicitAs.impl.Convert (constants.%U.binding.as_type.as.ImplicitAs.impl.Convert.337)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.da6 = impl_witness_table (%Core.import_ref.ec9), @U.binding.as_type.as.ImplicitAs.impl.ea7 [concrete] +// CHECK:STDOUT: %Core.import_ref.7fb: @T.binding.as_type.as.OptionalAs.impl.%T.binding.as_type.as.OptionalAs.impl.Convert.type (%T.binding.as_type.as.OptionalAs.impl.Convert.type.8c6) = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, loaded [symbolic = @T.binding.as_type.as.OptionalAs.impl.%T.binding.as_type.as.OptionalAs.impl.Convert (constants.%T.binding.as_type.as.OptionalAs.impl.Convert.180)] +// CHECK:STDOUT: %OptionalAs.impl_witness_table.8ee = impl_witness_table (%Core.import_ref.7fb), @T.binding.as_type.as.OptionalAs.impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -198,13 +207,13 @@ fn F() { // CHECK:STDOUT: %.loc11_21.2: %i32 = converted %int_0, %.loc11_21.1 [concrete = constants.%int_0.6a9] // CHECK:STDOUT: %.loc11_22: ref %i32 = array_index %n.ref, %.loc11_21.2 // CHECK:STDOUT: %addr.loc11_18.1: %ptr.235 = addr_of %.loc11_22 -// CHECK:STDOUT: %impl.elem0.loc11_18: %.e81 = impl_witness_access constants.%ImplicitAs.impl_witness.f82, element0 [concrete = constants.%T.binding.as_type.as.ImplicitAs.impl.Convert.2dc] +// CHECK:STDOUT: %impl.elem0.loc11_18: %.4d2 = impl_witness_access constants.%ImplicitAs.impl_witness.f51, element0 [concrete = constants.%U.binding.as_type.as.ImplicitAs.impl.Convert.b59] // CHECK:STDOUT: %bound_method.loc11_18.1: = bound_method %addr.loc11_18.1, %impl.elem0.loc11_18 -// CHECK:STDOUT: %specific_fn.loc11_18: = specific_function %impl.elem0.loc11_18, @T.binding.as_type.as.ImplicitAs.impl.Convert.2(constants.%OptionalStorage.facet) [concrete = constants.%T.binding.as_type.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %specific_fn.loc11_18: = specific_function %impl.elem0.loc11_18, @U.binding.as_type.as.ImplicitAs.impl.Convert.2(constants.%OptionalStorage.facet.0a3, constants.%OptionalAs.facet) [concrete = constants.%U.binding.as_type.as.ImplicitAs.impl.Convert.specific_fn] // CHECK:STDOUT: %bound_method.loc11_18.2: = bound_method %addr.loc11_18.1, %specific_fn.loc11_18 // CHECK:STDOUT: %.loc11_18.1: ref %Optional.18c = temporary_storage -// CHECK:STDOUT: %T.binding.as_type.as.ImplicitAs.impl.Convert.call: init %Optional.18c = call %bound_method.loc11_18.2(%addr.loc11_18.1) to %.loc11_18.1 -// CHECK:STDOUT: %.loc11_18.2: init %Optional.18c = converted %addr.loc11_18.1, %T.binding.as_type.as.ImplicitAs.impl.Convert.call +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.call: init %Optional.18c = call %bound_method.loc11_18.2(%addr.loc11_18.1) to %.loc11_18.1 +// CHECK:STDOUT: %.loc11_18.2: init %Optional.18c = converted %addr.loc11_18.1, %U.binding.as_type.as.ImplicitAs.impl.Convert.call // CHECK:STDOUT: %.loc11_18.3: ref %Optional.18c = temporary %.loc11_18.1, %.loc11_18.2 // CHECK:STDOUT: %.loc11_18.4: %Optional.18c = acquire_value %.loc11_18.3 // CHECK:STDOUT: %TakesArray.call: init %empty_tuple.type = call imports.%TakesArray.decl(%.loc11_18.4) diff --git a/toolchain/check/testdata/interop/cpp/function/pointer.carbon b/toolchain/check/testdata/interop/cpp/function/pointer.carbon index 757ab06ef6b8..24aba230d2bb 100644 --- a/toolchain/check/testdata/interop/cpp/function/pointer.carbon +++ b/toolchain/check/testdata/interop/cpp/function/pointer.carbon @@ -181,7 +181,7 @@ struct S {}; auto foo(S* const) -> void; -// --- fail_todo_import_const_nullable_pointer_param_using_const.carbon +// --- import_const_nullable_pointer_param_using_const.carbon library "[[@TEST_NAME]]"; @@ -192,17 +192,6 @@ fn G() -> const (Cpp.S*); fn F() { //@dump-sem-ir-begin var p: const (Cpp.S*) = G(); - // CHECK:STDERR: fail_todo_import_const_nullable_pointer_param_using_const.carbon:[[@LINE+11]]:11: error: cannot implicitly convert expression of type `const (Cpp.S*)` to `Core.Optional(Cpp.S* as Core.OptionalStorage)` [ConversionFailure] - // CHECK:STDERR: Cpp.foo(p); - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_todo_import_const_nullable_pointer_param_using_const.carbon:[[@LINE+8]]:11: note: type `const (Cpp.S*)` does not implement interface `Core.ImplicitAs(Core.Optional(Cpp.S* as Core.OptionalStorage))` [MissingImplInMemberAccessNote] - // CHECK:STDERR: Cpp.foo(p); - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_todo_import_const_nullable_pointer_param_using_const.carbon:[[@LINE-13]]:10: in file included here [InCppInclude] - // CHECK:STDERR: ./const_nullable_pointer_param.h:4:18: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: auto foo(S* const) -> void; - // CHECK:STDERR: ^ - // CHECK:STDERR: Cpp.foo(p); //@dump-sem-ir-end } @@ -915,7 +904,7 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: --- fail_todo_import_const_nullable_pointer_param_using_const.carbon +// CHECK:STDOUT: --- import_const_nullable_pointer_param_using_const.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] @@ -928,17 +917,47 @@ fn F() { // CHECK:STDOUT: %foo.cpp_overload_set.type: type = cpp_overload_set_type @foo.cpp_overload_set [concrete] // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete] // CHECK:STDOUT: %OptionalStorage.type: type = facet_type <@OptionalStorage> [concrete] +// CHECK:STDOUT: %T.3fe: %OptionalStorage.type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %T.d9f: type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %ptr.4f0: type = ptr_type %T.d9f [symbolic] // CHECK:STDOUT: %MaybeUnformed.cff: type = class_type @MaybeUnformed, @MaybeUnformed(%ptr.4f0) [symbolic] -// CHECK:STDOUT: %OptionalStorage.impl_witness.81d: = impl_witness imports.%OptionalStorage.impl_witness_table.2f8, @ptr.as.OptionalStorage.impl(%S) [concrete] -// CHECK:STDOUT: %OptionalStorage.facet.9f4: %OptionalStorage.type = facet_value %ptr.5c7, (%OptionalStorage.impl_witness.81d) [concrete] -// CHECK:STDOUT: %Optional.4c2: type = class_type @Optional, @Optional(%OptionalStorage.facet.9f4) [concrete] +// CHECK:STDOUT: %ptr.as.OptionalStorage.impl.Some.type.911: type = fn_type @ptr.as.OptionalStorage.impl.Some, @ptr.as.OptionalStorage.impl(%T.d9f) [symbolic] +// CHECK:STDOUT: %ptr.as.OptionalStorage.impl.Some.2a0: %ptr.as.OptionalStorage.impl.Some.type.911 = struct_value () [symbolic] +// CHECK:STDOUT: %OptionalStorage.impl_witness.fef: = impl_witness imports.%OptionalStorage.impl_witness_table.236, @ptr.as.OptionalStorage.impl(%S) [concrete] +// CHECK:STDOUT: %OptionalStorage.facet.066: %OptionalStorage.type = facet_value %ptr.5c7, (%OptionalStorage.impl_witness.fef) [concrete] +// CHECK:STDOUT: %Optional.454: type = class_type @Optional, @Optional(%OptionalStorage.facet.066) [concrete] // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.type.099: type = facet_type <@ImplicitAs, @ImplicitAs(%Optional.454)> [concrete] +// CHECK:STDOUT: %ImplicitAs.Convert.type.d3b: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%Optional.454) [concrete] +// CHECK:STDOUT: %ImplicitAs.type.2d9d4e.2: type = facet_type <@ImplicitAs, @ImplicitAs(%T.d9f)> [symbolic] +// CHECK:STDOUT: %U.4f1: %ImplicitAs.type.2d9d4e.2 = symbolic_binding U, 1 [symbolic] +// CHECK:STDOUT: %const.as.ImplicitAs.impl.Convert.type.47d: type = fn_type @const.as.ImplicitAs.impl.Convert, @const.as.ImplicitAs.impl(%T.d9f, %U.4f1) [symbolic] +// CHECK:STDOUT: %const.as.ImplicitAs.impl.Convert.0d0: %const.as.ImplicitAs.impl.Convert.type.47d = struct_value () [symbolic] +// CHECK:STDOUT: %OptionalAs.type.593: type = facet_type <@OptionalAs, @OptionalAs(%T.3fe)> [symbolic] +// CHECK:STDOUT: %U.ec3: %OptionalAs.type.593 = symbolic_binding U, 1 [symbolic] +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.type.855: type = fn_type @U.binding.as_type.as.ImplicitAs.impl.Convert.2, @U.binding.as_type.as.ImplicitAs.impl.ea7(%T.3fe, %U.ec3) [symbolic] +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.337: %U.binding.as_type.as.ImplicitAs.impl.Convert.type.855 = struct_value () [symbolic] +// CHECK:STDOUT: %OptionalAs.type.af7: type = facet_type <@OptionalAs, @OptionalAs(%OptionalStorage.facet.066)> [concrete] +// CHECK:STDOUT: %T.binding.as_type.as.OptionalAs.impl.Convert.type.8c6: type = fn_type @T.binding.as_type.as.OptionalAs.impl.Convert, @T.binding.as_type.as.OptionalAs.impl(%T.3fe) [symbolic] +// CHECK:STDOUT: %T.binding.as_type.as.OptionalAs.impl.Convert.180: %T.binding.as_type.as.OptionalAs.impl.Convert.type.8c6 = struct_value () [symbolic] +// CHECK:STDOUT: %OptionalAs.impl_witness.12c: = impl_witness imports.%OptionalAs.impl_witness_table.8ee, @T.binding.as_type.as.OptionalAs.impl(%OptionalStorage.facet.066) [concrete] +// CHECK:STDOUT: %OptionalAs.facet: %OptionalAs.type.af7 = facet_value %ptr.5c7, (%OptionalAs.impl_witness.12c) [concrete] +// CHECK:STDOUT: %ImplicitAs.impl_witness.aa3: = impl_witness imports.%ImplicitAs.impl_witness_table.da6, @U.binding.as_type.as.ImplicitAs.impl.ea7(%OptionalStorage.facet.066, %OptionalAs.facet) [concrete] +// CHECK:STDOUT: %ImplicitAs.facet.2c8: %ImplicitAs.type.099 = facet_value %ptr.5c7, (%ImplicitAs.impl_witness.aa3) [concrete] +// CHECK:STDOUT: %ImplicitAs.impl_witness.322: = impl_witness imports.%ImplicitAs.impl_witness_table.215, @const.as.ImplicitAs.impl(%Optional.454, %ImplicitAs.facet.2c8) [concrete] +// CHECK:STDOUT: %const.as.ImplicitAs.impl.Convert.type.82d: type = fn_type @const.as.ImplicitAs.impl.Convert, @const.as.ImplicitAs.impl(%Optional.454, %ImplicitAs.facet.2c8) [concrete] +// CHECK:STDOUT: %const.as.ImplicitAs.impl.Convert.3a1: %const.as.ImplicitAs.impl.Convert.type.82d = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet.5b5: %ImplicitAs.type.099 = facet_value %const.b9a, (%ImplicitAs.impl_witness.322) [concrete] +// CHECK:STDOUT: %.65a: type = fn_type_with_self_type %ImplicitAs.Convert.type.d3b, %ImplicitAs.facet.5b5 [concrete] +// CHECK:STDOUT: %const.as.ImplicitAs.impl.Convert.specific_fn: = specific_function %const.as.ImplicitAs.impl.Convert.3a1, @const.as.ImplicitAs.impl.Convert(%Optional.454, %ImplicitAs.facet.2c8) [concrete] // CHECK:STDOUT: %type_where: type = facet_type > [concrete] -// CHECK:STDOUT: %facet_value: %type_where = facet_value %const.b9a, () [concrete] -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.2ba: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value) [concrete] +// CHECK:STDOUT: %facet_value.542: %type_where = facet_value %Optional.454, () [concrete] +// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.6e8: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.542) [concrete] +// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.de7: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.6e8 = struct_value () [concrete] +// CHECK:STDOUT: %ptr.3c6: type = ptr_type %Optional.454 [concrete] +// CHECK:STDOUT: %facet_value.3d1: %type_where = facet_value %const.b9a, () [concrete] +// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.2ba: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.3d1) [concrete] // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.14a: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.2ba = struct_value () [concrete] // CHECK:STDOUT: %ptr.6c1: type = ptr_type %const.b9a [concrete] // CHECK:STDOUT: } @@ -953,21 +972,27 @@ fn F() { // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete = constants.%foo.cpp_overload_set.value] // CHECK:STDOUT: %Core.import_ref.2fb: type = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, loaded [symbolic = @ptr.as.OptionalStorage.impl.%MaybeUnformed (constants.%MaybeUnformed.cff)] // CHECK:STDOUT: %Core.import_ref.a7c = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, unloaded -// CHECK:STDOUT: %Core.import_ref.720 = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, unloaded +// CHECK:STDOUT: %Core.import_ref.1b2: @ptr.as.OptionalStorage.impl.%ptr.as.OptionalStorage.impl.Some.type (%ptr.as.OptionalStorage.impl.Some.type.911) = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, loaded [symbolic = @ptr.as.OptionalStorage.impl.%ptr.as.OptionalStorage.impl.Some (constants.%ptr.as.OptionalStorage.impl.Some.2a0)] // CHECK:STDOUT: %Core.import_ref.6a9 = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, unloaded // CHECK:STDOUT: %Core.import_ref.971 = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, unloaded -// CHECK:STDOUT: %OptionalStorage.impl_witness_table.2f8 = impl_witness_table (%Core.import_ref.2fb, %Core.import_ref.a7c, %Core.import_ref.720, %Core.import_ref.6a9, %Core.import_ref.971), @ptr.as.OptionalStorage.impl [concrete] +// CHECK:STDOUT: %OptionalStorage.impl_witness_table.236 = impl_witness_table (%Core.import_ref.2fb, %Core.import_ref.a7c, %Core.import_ref.1b2, %Core.import_ref.6a9, %Core.import_ref.971), @ptr.as.OptionalStorage.impl [concrete] // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] { // CHECK:STDOUT: // CHECK:STDOUT: } { // CHECK:STDOUT: -// CHECK:STDOUT: %.loc22_12.1: type = splice_block %Optional [concrete = constants.%Optional.4c2] { -// CHECK:STDOUT: %OptionalStorage.facet: %OptionalStorage.type = facet_value constants.%ptr.5c7, (constants.%OptionalStorage.impl_witness.81d) [concrete = constants.%OptionalStorage.facet.9f4] -// CHECK:STDOUT: %.loc22_12.2: %OptionalStorage.type = converted constants.%ptr.5c7, %OptionalStorage.facet [concrete = constants.%OptionalStorage.facet.9f4] -// CHECK:STDOUT: %Optional: type = class_type @Optional, @Optional(constants.%OptionalStorage.facet.9f4) [concrete = constants.%Optional.4c2] +// CHECK:STDOUT: %.loc11_12.1: type = splice_block %Optional [concrete = constants.%Optional.454] { +// CHECK:STDOUT: %OptionalStorage.facet: %OptionalStorage.type = facet_value constants.%ptr.5c7, (constants.%OptionalStorage.impl_witness.fef) [concrete = constants.%OptionalStorage.facet.066] +// CHECK:STDOUT: %.loc11_12.2: %OptionalStorage.type = converted constants.%ptr.5c7, %OptionalStorage.facet [concrete = constants.%OptionalStorage.facet.066] +// CHECK:STDOUT: %Optional: type = class_type @Optional, @Optional(constants.%OptionalStorage.facet.066) [concrete = constants.%Optional.454] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import_ref.5f9: @const.as.ImplicitAs.impl.%const.as.ImplicitAs.impl.Convert.type (%const.as.ImplicitAs.impl.Convert.type.47d) = import_ref Core//prelude/types/optional, inst{{[0-9A-F]+}} [indirect], loaded [symbolic = @const.as.ImplicitAs.impl.%const.as.ImplicitAs.impl.Convert (constants.%const.as.ImplicitAs.impl.Convert.0d0)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.215 = impl_witness_table (%Core.import_ref.5f9), @const.as.ImplicitAs.impl [concrete] +// CHECK:STDOUT: %Core.import_ref.ec9: @U.binding.as_type.as.ImplicitAs.impl.ea7.%U.binding.as_type.as.ImplicitAs.impl.Convert.type (%U.binding.as_type.as.ImplicitAs.impl.Convert.type.855) = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, loaded [symbolic = @U.binding.as_type.as.ImplicitAs.impl.ea7.%U.binding.as_type.as.ImplicitAs.impl.Convert (constants.%U.binding.as_type.as.ImplicitAs.impl.Convert.337)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.da6 = impl_witness_table (%Core.import_ref.ec9), @U.binding.as_type.as.ImplicitAs.impl.ea7 [concrete] +// CHECK:STDOUT: %Core.import_ref.7fb: @T.binding.as_type.as.OptionalAs.impl.%T.binding.as_type.as.OptionalAs.impl.Convert.type (%T.binding.as_type.as.OptionalAs.impl.Convert.type.8c6) = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, loaded [symbolic = @T.binding.as_type.as.OptionalAs.impl.%T.binding.as_type.as.OptionalAs.impl.Convert (constants.%T.binding.as_type.as.OptionalAs.impl.Convert.180)] +// CHECK:STDOUT: %OptionalAs.impl_witness_table.8ee = impl_witness_table (%Core.import_ref.7fb), @T.binding.as_type.as.OptionalAs.impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -987,16 +1012,30 @@ fn F() { // CHECK:STDOUT: %const: type = const_type %ptr [concrete = constants.%const.b9a] // CHECK:STDOUT: } // CHECK:STDOUT: %p: ref %const.b9a = ref_binding p, %p.var -// CHECK:STDOUT: %Cpp.ref.loc22: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Cpp.ref.loc11: = 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: %p.ref: ref %const.b9a = name_ref p, %p -// CHECK:STDOUT: %.loc22: %Optional.4c2 = converted %p.ref, [concrete = ] -// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl() -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound: = bound_method %p.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.14a +// CHECK:STDOUT: %impl.elem0: %.65a = impl_witness_access constants.%ImplicitAs.impl_witness.322, element0 [concrete = constants.%const.as.ImplicitAs.impl.Convert.3a1] +// CHECK:STDOUT: %bound_method.loc11_11.1: = bound_method %p.ref, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @const.as.ImplicitAs.impl.Convert(constants.%Optional.454, constants.%ImplicitAs.facet.2c8) [concrete = constants.%const.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc11_11.2: = bound_method %p.ref, %specific_fn +// CHECK:STDOUT: %.loc11_11.1: ref %Optional.454 = temporary_storage +// CHECK:STDOUT: %.loc11_11.2: %const.b9a = acquire_value %p.ref +// CHECK:STDOUT: %const.as.ImplicitAs.impl.Convert.call: init %Optional.454 = call %bound_method.loc11_11.2(%.loc11_11.2) to %.loc11_11.1 +// CHECK:STDOUT: %.loc11_11.3: init %Optional.454 = converted %p.ref, %const.as.ImplicitAs.impl.Convert.call +// CHECK:STDOUT: %.loc11_11.4: ref %Optional.454 = temporary %.loc11_11.1, %.loc11_11.3 +// CHECK:STDOUT: %.loc11_11.5: %Optional.454 = acquire_value %.loc11_11.4 +// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl(%.loc11_11.5) +// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc11: = bound_method %.loc11_11.4, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.de7 // CHECK:STDOUT: -// CHECK:STDOUT: %bound_method: = bound_method %p.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn -// CHECK:STDOUT: %addr: %ptr.6c1 = addr_of %p.var -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method(%addr) +// CHECK:STDOUT: %bound_method.loc11_11.3: = bound_method %.loc11_11.4, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.1 +// CHECK:STDOUT: %addr.loc11: %ptr.3c6 = addr_of %.loc11_11.4 +// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc11: init %empty_tuple.type = call %bound_method.loc11_11.3(%addr.loc11) +// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc10: = bound_method %p.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.14a +// CHECK:STDOUT: +// CHECK:STDOUT: %bound_method.loc10: = bound_method %p.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.2 +// CHECK:STDOUT: %addr.loc10: %ptr.6c1 = addr_of %p.var +// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc10: init %empty_tuple.type = call %bound_method.loc10(%addr.loc10) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1019,20 +1058,27 @@ fn F() { // CHECK:STDOUT: %ptr.as.OptionalStorage.impl.Some.type.911: type = fn_type @ptr.as.OptionalStorage.impl.Some, @ptr.as.OptionalStorage.impl(%T.d9f) [symbolic] // CHECK:STDOUT: %ptr.as.OptionalStorage.impl.Some.2a0: %ptr.as.OptionalStorage.impl.Some.type.911 = struct_value () [symbolic] // CHECK:STDOUT: %OptionalStorage.impl_witness.fef: = impl_witness imports.%OptionalStorage.impl_witness_table.236, @ptr.as.OptionalStorage.impl(%S) [concrete] -// CHECK:STDOUT: %OptionalStorage.facet: %OptionalStorage.type = facet_value %ptr.5c7, (%OptionalStorage.impl_witness.fef) [concrete] -// CHECK:STDOUT: %Optional.454: type = class_type @Optional, @Optional(%OptionalStorage.facet) [concrete] +// CHECK:STDOUT: %OptionalStorage.facet.066: %OptionalStorage.type = facet_value %ptr.5c7, (%OptionalStorage.impl_witness.fef) [concrete] +// CHECK:STDOUT: %Optional.454: type = class_type @Optional, @Optional(%OptionalStorage.facet.066) [concrete] // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] // CHECK:STDOUT: %ImplicitAs.type.099: type = facet_type <@ImplicitAs, @ImplicitAs(%Optional.454)> [concrete] // CHECK:STDOUT: %ImplicitAs.Convert.type.d3b: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%Optional.454) [concrete] -// CHECK:STDOUT: %T.binding.as_type.as.ImplicitAs.impl.Convert.type.a78: type = fn_type @T.binding.as_type.as.ImplicitAs.impl.Convert.1, @T.binding.as_type.as.ImplicitAs.impl.339(%T.3fe) [symbolic] -// CHECK:STDOUT: %T.binding.as_type.as.ImplicitAs.impl.Convert.d1b: %T.binding.as_type.as.ImplicitAs.impl.Convert.type.a78 = struct_value () [symbolic] -// CHECK:STDOUT: %ImplicitAs.impl_witness.ff2: = impl_witness imports.%ImplicitAs.impl_witness_table.284, @T.binding.as_type.as.ImplicitAs.impl.339(%OptionalStorage.facet) [concrete] -// CHECK:STDOUT: %T.binding.as_type.as.ImplicitAs.impl.Convert.type.398: type = fn_type @T.binding.as_type.as.ImplicitAs.impl.Convert.1, @T.binding.as_type.as.ImplicitAs.impl.339(%OptionalStorage.facet) [concrete] -// CHECK:STDOUT: %T.binding.as_type.as.ImplicitAs.impl.Convert.6d1: %T.binding.as_type.as.ImplicitAs.impl.Convert.type.398 = struct_value () [concrete] -// CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.099 = facet_value %ptr.5c7, (%ImplicitAs.impl_witness.ff2) [concrete] -// CHECK:STDOUT: %.681: type = fn_type_with_self_type %ImplicitAs.Convert.type.d3b, %ImplicitAs.facet [concrete] -// CHECK:STDOUT: %T.binding.as_type.as.ImplicitAs.impl.Convert.specific_fn: = specific_function %T.binding.as_type.as.ImplicitAs.impl.Convert.6d1, @T.binding.as_type.as.ImplicitAs.impl.Convert.1(%OptionalStorage.facet) [concrete] +// CHECK:STDOUT: %OptionalAs.type.593: type = facet_type <@OptionalAs, @OptionalAs(%T.3fe)> [symbolic] +// CHECK:STDOUT: %U.ec3: %OptionalAs.type.593 = symbolic_binding U, 1 [symbolic] +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.type.855: type = fn_type @U.binding.as_type.as.ImplicitAs.impl.Convert.2, @U.binding.as_type.as.ImplicitAs.impl.ea7(%T.3fe, %U.ec3) [symbolic] +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.337: %U.binding.as_type.as.ImplicitAs.impl.Convert.type.855 = struct_value () [symbolic] +// CHECK:STDOUT: %OptionalAs.type.af7: type = facet_type <@OptionalAs, @OptionalAs(%OptionalStorage.facet.066)> [concrete] +// CHECK:STDOUT: %T.binding.as_type.as.OptionalAs.impl.Convert.type.8c6: type = fn_type @T.binding.as_type.as.OptionalAs.impl.Convert, @T.binding.as_type.as.OptionalAs.impl(%T.3fe) [symbolic] +// CHECK:STDOUT: %T.binding.as_type.as.OptionalAs.impl.Convert.180: %T.binding.as_type.as.OptionalAs.impl.Convert.type.8c6 = struct_value () [symbolic] +// CHECK:STDOUT: %OptionalAs.impl_witness.12c: = impl_witness imports.%OptionalAs.impl_witness_table.8ee, @T.binding.as_type.as.OptionalAs.impl(%OptionalStorage.facet.066) [concrete] +// CHECK:STDOUT: %OptionalAs.facet: %OptionalAs.type.af7 = facet_value %ptr.5c7, (%OptionalAs.impl_witness.12c) [concrete] +// CHECK:STDOUT: %ImplicitAs.impl_witness.aa3: = impl_witness imports.%ImplicitAs.impl_witness_table.da6, @U.binding.as_type.as.ImplicitAs.impl.ea7(%OptionalStorage.facet.066, %OptionalAs.facet) [concrete] +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.type.95c: type = fn_type @U.binding.as_type.as.ImplicitAs.impl.Convert.2, @U.binding.as_type.as.ImplicitAs.impl.ea7(%OptionalStorage.facet.066, %OptionalAs.facet) [concrete] +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.80c: %U.binding.as_type.as.ImplicitAs.impl.Convert.type.95c = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.099 = facet_value %ptr.5c7, (%ImplicitAs.impl_witness.aa3) [concrete] +// CHECK:STDOUT: %.4d4: type = fn_type_with_self_type %ImplicitAs.Convert.type.d3b, %ImplicitAs.facet [concrete] +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.specific_fn: = specific_function %U.binding.as_type.as.ImplicitAs.impl.Convert.80c, @U.binding.as_type.as.ImplicitAs.impl.Convert.2(%OptionalStorage.facet.066, %OptionalAs.facet) [concrete] // CHECK:STDOUT: %type_where: type = facet_type > [concrete] // CHECK:STDOUT: %facet_value.542: %type_where = facet_value %Optional.454, () [concrete] // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.6e8: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.542) [concrete] @@ -1063,14 +1109,16 @@ fn F() { // CHECK:STDOUT: } { // CHECK:STDOUT: // CHECK:STDOUT: %.loc11_12.1: type = splice_block %Optional [concrete = constants.%Optional.454] { -// CHECK:STDOUT: %OptionalStorage.facet: %OptionalStorage.type = facet_value constants.%ptr.5c7, (constants.%OptionalStorage.impl_witness.fef) [concrete = constants.%OptionalStorage.facet] -// CHECK:STDOUT: %.loc11_12.2: %OptionalStorage.type = converted constants.%ptr.5c7, %OptionalStorage.facet [concrete = constants.%OptionalStorage.facet] -// CHECK:STDOUT: %Optional: type = class_type @Optional, @Optional(constants.%OptionalStorage.facet) [concrete = constants.%Optional.454] +// CHECK:STDOUT: %OptionalStorage.facet: %OptionalStorage.type = facet_value constants.%ptr.5c7, (constants.%OptionalStorage.impl_witness.fef) [concrete = constants.%OptionalStorage.facet.066] +// CHECK:STDOUT: %.loc11_12.2: %OptionalStorage.type = converted constants.%ptr.5c7, %OptionalStorage.facet [concrete = constants.%OptionalStorage.facet.066] +// CHECK:STDOUT: %Optional: type = class_type @Optional, @Optional(constants.%OptionalStorage.facet.066) [concrete = constants.%Optional.454] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import_ref.7bc: @T.binding.as_type.as.ImplicitAs.impl.339.%T.binding.as_type.as.ImplicitAs.impl.Convert.type (%T.binding.as_type.as.ImplicitAs.impl.Convert.type.a78) = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, loaded [symbolic = @T.binding.as_type.as.ImplicitAs.impl.339.%T.binding.as_type.as.ImplicitAs.impl.Convert (constants.%T.binding.as_type.as.ImplicitAs.impl.Convert.d1b)] -// CHECK:STDOUT: %ImplicitAs.impl_witness_table.284 = impl_witness_table (%Core.import_ref.7bc), @T.binding.as_type.as.ImplicitAs.impl.339 [concrete] +// CHECK:STDOUT: %Core.import_ref.ec9: @U.binding.as_type.as.ImplicitAs.impl.ea7.%U.binding.as_type.as.ImplicitAs.impl.Convert.type (%U.binding.as_type.as.ImplicitAs.impl.Convert.type.855) = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, loaded [symbolic = @U.binding.as_type.as.ImplicitAs.impl.ea7.%U.binding.as_type.as.ImplicitAs.impl.Convert (constants.%U.binding.as_type.as.ImplicitAs.impl.Convert.337)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.da6 = impl_witness_table (%Core.import_ref.ec9), @U.binding.as_type.as.ImplicitAs.impl.ea7 [concrete] +// CHECK:STDOUT: %Core.import_ref.7fb: @T.binding.as_type.as.OptionalAs.impl.%T.binding.as_type.as.OptionalAs.impl.Convert.type (%T.binding.as_type.as.OptionalAs.impl.Convert.type.8c6) = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, loaded [symbolic = @T.binding.as_type.as.OptionalAs.impl.%T.binding.as_type.as.OptionalAs.impl.Convert (constants.%T.binding.as_type.as.OptionalAs.impl.Convert.180)] +// CHECK:STDOUT: %OptionalAs.impl_witness_table.8ee = impl_witness_table (%Core.import_ref.7fb), @T.binding.as_type.as.OptionalAs.impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -1092,14 +1140,14 @@ fn F() { // CHECK:STDOUT: %Cpp.ref.loc11: = 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: %p.ref: ref %ptr.5c7 = name_ref p, %p -// CHECK:STDOUT: %impl.elem0: %.681 = impl_witness_access constants.%ImplicitAs.impl_witness.ff2, element0 [concrete = constants.%T.binding.as_type.as.ImplicitAs.impl.Convert.6d1] +// CHECK:STDOUT: %impl.elem0: %.4d4 = impl_witness_access constants.%ImplicitAs.impl_witness.aa3, element0 [concrete = constants.%U.binding.as_type.as.ImplicitAs.impl.Convert.80c] // CHECK:STDOUT: %bound_method.loc11_11.1: = bound_method %p.ref, %impl.elem0 -// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @T.binding.as_type.as.ImplicitAs.impl.Convert.1(constants.%OptionalStorage.facet) [concrete = constants.%T.binding.as_type.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @U.binding.as_type.as.ImplicitAs.impl.Convert.2(constants.%OptionalStorage.facet.066, constants.%OptionalAs.facet) [concrete = constants.%U.binding.as_type.as.ImplicitAs.impl.Convert.specific_fn] // CHECK:STDOUT: %bound_method.loc11_11.2: = bound_method %p.ref, %specific_fn // CHECK:STDOUT: %.loc11_11.1: ref %Optional.454 = temporary_storage // CHECK:STDOUT: %.loc11_11.2: %ptr.5c7 = acquire_value %p.ref -// CHECK:STDOUT: %T.binding.as_type.as.ImplicitAs.impl.Convert.call: init %Optional.454 = call %bound_method.loc11_11.2(%.loc11_11.2) to %.loc11_11.1 -// CHECK:STDOUT: %.loc11_11.3: init %Optional.454 = converted %p.ref, %T.binding.as_type.as.ImplicitAs.impl.Convert.call +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.call: init %Optional.454 = call %bound_method.loc11_11.2(%.loc11_11.2) to %.loc11_11.1 +// CHECK:STDOUT: %.loc11_11.3: init %Optional.454 = converted %p.ref, %U.binding.as_type.as.ImplicitAs.impl.Convert.call // CHECK:STDOUT: %.loc11_11.4: ref %Optional.454 = temporary %.loc11_11.1, %.loc11_11.3 // CHECK:STDOUT: %.loc11_11.5: %Optional.454 = acquire_value %.loc11_11.4 // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl(%.loc11_11.5) @@ -1269,20 +1317,27 @@ fn F() { // CHECK:STDOUT: %ptr.as.OptionalStorage.impl.Some.type.911: type = fn_type @ptr.as.OptionalStorage.impl.Some, @ptr.as.OptionalStorage.impl(%T.d9f) [symbolic] // CHECK:STDOUT: %ptr.as.OptionalStorage.impl.Some.2a0: %ptr.as.OptionalStorage.impl.Some.type.911 = struct_value () [symbolic] // CHECK:STDOUT: %OptionalStorage.impl_witness.fef: = impl_witness imports.%OptionalStorage.impl_witness_table.236, @ptr.as.OptionalStorage.impl(%S) [concrete] -// CHECK:STDOUT: %OptionalStorage.facet: %OptionalStorage.type = facet_value %ptr.5c7, (%OptionalStorage.impl_witness.fef) [concrete] -// CHECK:STDOUT: %Optional.454: type = class_type @Optional, @Optional(%OptionalStorage.facet) [concrete] +// CHECK:STDOUT: %OptionalStorage.facet.066: %OptionalStorage.type = facet_value %ptr.5c7, (%OptionalStorage.impl_witness.fef) [concrete] +// CHECK:STDOUT: %Optional.454: type = class_type @Optional, @Optional(%OptionalStorage.facet.066) [concrete] // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] // CHECK:STDOUT: %ImplicitAs.type.099: type = facet_type <@ImplicitAs, @ImplicitAs(%Optional.454)> [concrete] // CHECK:STDOUT: %ImplicitAs.Convert.type.d3b: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%Optional.454) [concrete] -// CHECK:STDOUT: %T.binding.as_type.as.ImplicitAs.impl.Convert.type.a78: type = fn_type @T.binding.as_type.as.ImplicitAs.impl.Convert.1, @T.binding.as_type.as.ImplicitAs.impl.339(%T.3fe) [symbolic] -// CHECK:STDOUT: %T.binding.as_type.as.ImplicitAs.impl.Convert.d1b: %T.binding.as_type.as.ImplicitAs.impl.Convert.type.a78 = struct_value () [symbolic] -// CHECK:STDOUT: %ImplicitAs.impl_witness.ff2: = impl_witness imports.%ImplicitAs.impl_witness_table.284, @T.binding.as_type.as.ImplicitAs.impl.339(%OptionalStorage.facet) [concrete] -// CHECK:STDOUT: %T.binding.as_type.as.ImplicitAs.impl.Convert.type.398: type = fn_type @T.binding.as_type.as.ImplicitAs.impl.Convert.1, @T.binding.as_type.as.ImplicitAs.impl.339(%OptionalStorage.facet) [concrete] -// CHECK:STDOUT: %T.binding.as_type.as.ImplicitAs.impl.Convert.6d1: %T.binding.as_type.as.ImplicitAs.impl.Convert.type.398 = struct_value () [concrete] -// CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.099 = facet_value %ptr.5c7, (%ImplicitAs.impl_witness.ff2) [concrete] -// CHECK:STDOUT: %.681: type = fn_type_with_self_type %ImplicitAs.Convert.type.d3b, %ImplicitAs.facet [concrete] -// CHECK:STDOUT: %T.binding.as_type.as.ImplicitAs.impl.Convert.specific_fn: = specific_function %T.binding.as_type.as.ImplicitAs.impl.Convert.6d1, @T.binding.as_type.as.ImplicitAs.impl.Convert.1(%OptionalStorage.facet) [concrete] +// CHECK:STDOUT: %OptionalAs.type.593: type = facet_type <@OptionalAs, @OptionalAs(%T.3fe)> [symbolic] +// CHECK:STDOUT: %U.ec3: %OptionalAs.type.593 = symbolic_binding U, 1 [symbolic] +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.type.855: type = fn_type @U.binding.as_type.as.ImplicitAs.impl.Convert.2, @U.binding.as_type.as.ImplicitAs.impl.ea7(%T.3fe, %U.ec3) [symbolic] +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.337: %U.binding.as_type.as.ImplicitAs.impl.Convert.type.855 = struct_value () [symbolic] +// CHECK:STDOUT: %OptionalAs.type.af7: type = facet_type <@OptionalAs, @OptionalAs(%OptionalStorage.facet.066)> [concrete] +// CHECK:STDOUT: %T.binding.as_type.as.OptionalAs.impl.Convert.type.8c6: type = fn_type @T.binding.as_type.as.OptionalAs.impl.Convert, @T.binding.as_type.as.OptionalAs.impl(%T.3fe) [symbolic] +// CHECK:STDOUT: %T.binding.as_type.as.OptionalAs.impl.Convert.180: %T.binding.as_type.as.OptionalAs.impl.Convert.type.8c6 = struct_value () [symbolic] +// CHECK:STDOUT: %OptionalAs.impl_witness.12c: = impl_witness imports.%OptionalAs.impl_witness_table.8ee, @T.binding.as_type.as.OptionalAs.impl(%OptionalStorage.facet.066) [concrete] +// CHECK:STDOUT: %OptionalAs.facet: %OptionalAs.type.af7 = facet_value %ptr.5c7, (%OptionalAs.impl_witness.12c) [concrete] +// CHECK:STDOUT: %ImplicitAs.impl_witness.aa3: = impl_witness imports.%ImplicitAs.impl_witness_table.da6, @U.binding.as_type.as.ImplicitAs.impl.ea7(%OptionalStorage.facet.066, %OptionalAs.facet) [concrete] +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.type.95c: type = fn_type @U.binding.as_type.as.ImplicitAs.impl.Convert.2, @U.binding.as_type.as.ImplicitAs.impl.ea7(%OptionalStorage.facet.066, %OptionalAs.facet) [concrete] +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.80c: %U.binding.as_type.as.ImplicitAs.impl.Convert.type.95c = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.099 = facet_value %ptr.5c7, (%ImplicitAs.impl_witness.aa3) [concrete] +// CHECK:STDOUT: %.4d4: type = fn_type_with_self_type %ImplicitAs.Convert.type.d3b, %ImplicitAs.facet [concrete] +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.specific_fn: = specific_function %U.binding.as_type.as.ImplicitAs.impl.Convert.80c, @U.binding.as_type.as.ImplicitAs.impl.Convert.2(%OptionalStorage.facet.066, %OptionalAs.facet) [concrete] // CHECK:STDOUT: %type_where: type = facet_type > [concrete] // CHECK:STDOUT: %facet_value.542: %type_where = facet_value %Optional.454, () [concrete] // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.6e8: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.542) [concrete] @@ -1312,14 +1367,16 @@ fn F() { // CHECK:STDOUT: } { // CHECK:STDOUT: // CHECK:STDOUT: %.loc9_13.1: type = splice_block %Optional [concrete = constants.%Optional.454] { -// CHECK:STDOUT: %OptionalStorage.facet: %OptionalStorage.type = facet_value constants.%ptr.5c7, (constants.%OptionalStorage.impl_witness.fef) [concrete = constants.%OptionalStorage.facet] -// CHECK:STDOUT: %.loc9_13.2: %OptionalStorage.type = converted constants.%ptr.5c7, %OptionalStorage.facet [concrete = constants.%OptionalStorage.facet] -// CHECK:STDOUT: %Optional: type = class_type @Optional, @Optional(constants.%OptionalStorage.facet) [concrete = constants.%Optional.454] +// CHECK:STDOUT: %OptionalStorage.facet: %OptionalStorage.type = facet_value constants.%ptr.5c7, (constants.%OptionalStorage.impl_witness.fef) [concrete = constants.%OptionalStorage.facet.066] +// CHECK:STDOUT: %.loc9_13.2: %OptionalStorage.type = converted constants.%ptr.5c7, %OptionalStorage.facet [concrete = constants.%OptionalStorage.facet.066] +// CHECK:STDOUT: %Optional: type = class_type @Optional, @Optional(constants.%OptionalStorage.facet.066) [concrete = constants.%Optional.454] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import_ref.7bc: @T.binding.as_type.as.ImplicitAs.impl.339.%T.binding.as_type.as.ImplicitAs.impl.Convert.type (%T.binding.as_type.as.ImplicitAs.impl.Convert.type.a78) = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, loaded [symbolic = @T.binding.as_type.as.ImplicitAs.impl.339.%T.binding.as_type.as.ImplicitAs.impl.Convert (constants.%T.binding.as_type.as.ImplicitAs.impl.Convert.d1b)] -// CHECK:STDOUT: %ImplicitAs.impl_witness_table.284 = impl_witness_table (%Core.import_ref.7bc), @T.binding.as_type.as.ImplicitAs.impl.339 [concrete] +// CHECK:STDOUT: %Core.import_ref.ec9: @U.binding.as_type.as.ImplicitAs.impl.ea7.%U.binding.as_type.as.ImplicitAs.impl.Convert.type (%U.binding.as_type.as.ImplicitAs.impl.Convert.type.855) = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, loaded [symbolic = @U.binding.as_type.as.ImplicitAs.impl.ea7.%U.binding.as_type.as.ImplicitAs.impl.Convert (constants.%U.binding.as_type.as.ImplicitAs.impl.Convert.337)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.da6 = impl_witness_table (%Core.import_ref.ec9), @U.binding.as_type.as.ImplicitAs.impl.ea7 [concrete] +// CHECK:STDOUT: %Core.import_ref.7fb: @T.binding.as_type.as.OptionalAs.impl.%T.binding.as_type.as.OptionalAs.impl.Convert.type (%T.binding.as_type.as.OptionalAs.impl.Convert.type.8c6) = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, loaded [symbolic = @T.binding.as_type.as.OptionalAs.impl.%T.binding.as_type.as.OptionalAs.impl.Convert (constants.%T.binding.as_type.as.OptionalAs.impl.Convert.180)] +// CHECK:STDOUT: %OptionalAs.impl_witness_table.8ee = impl_witness_table (%Core.import_ref.7fb), @T.binding.as_type.as.OptionalAs.impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -1342,13 +1399,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: %s.ref: ref %S = name_ref s, %s // CHECK:STDOUT: %addr.loc9_11.1: %ptr.5c7 = addr_of %s.ref -// CHECK:STDOUT: %impl.elem0: %.681 = impl_witness_access constants.%ImplicitAs.impl_witness.ff2, element0 [concrete = constants.%T.binding.as_type.as.ImplicitAs.impl.Convert.6d1] +// CHECK:STDOUT: %impl.elem0: %.4d4 = impl_witness_access constants.%ImplicitAs.impl_witness.aa3, element0 [concrete = constants.%U.binding.as_type.as.ImplicitAs.impl.Convert.80c] // CHECK:STDOUT: %bound_method.loc9_11.1: = bound_method %addr.loc9_11.1, %impl.elem0 -// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @T.binding.as_type.as.ImplicitAs.impl.Convert.1(constants.%OptionalStorage.facet) [concrete = constants.%T.binding.as_type.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @U.binding.as_type.as.ImplicitAs.impl.Convert.2(constants.%OptionalStorage.facet.066, constants.%OptionalAs.facet) [concrete = constants.%U.binding.as_type.as.ImplicitAs.impl.Convert.specific_fn] // CHECK:STDOUT: %bound_method.loc9_11.2: = bound_method %addr.loc9_11.1, %specific_fn // CHECK:STDOUT: %.loc9_11.1: ref %Optional.454 = temporary_storage -// CHECK:STDOUT: %T.binding.as_type.as.ImplicitAs.impl.Convert.call: init %Optional.454 = call %bound_method.loc9_11.2(%addr.loc9_11.1) to %.loc9_11.1 -// CHECK:STDOUT: %.loc9_11.2: init %Optional.454 = converted %addr.loc9_11.1, %T.binding.as_type.as.ImplicitAs.impl.Convert.call +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.call: init %Optional.454 = call %bound_method.loc9_11.2(%addr.loc9_11.1) to %.loc9_11.1 +// CHECK:STDOUT: %.loc9_11.2: init %Optional.454 = converted %addr.loc9_11.1, %U.binding.as_type.as.ImplicitAs.impl.Convert.call // CHECK:STDOUT: %.loc9_11.3: ref %Optional.454 = temporary %.loc9_11.1, %.loc9_11.2 // CHECK:STDOUT: %.loc9_11.4: %Optional.454 = acquire_value %.loc9_11.3 // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl(%.loc9_11.4) @@ -1530,8 +1587,8 @@ fn F() { // CHECK:STDOUT: %ptr.as.OptionalStorage.impl.Some.type.911: type = fn_type @ptr.as.OptionalStorage.impl.Some, @ptr.as.OptionalStorage.impl(%T.d9f) [symbolic] // CHECK:STDOUT: %ptr.as.OptionalStorage.impl.Some.2a0: %ptr.as.OptionalStorage.impl.Some.type.911 = struct_value () [symbolic] // CHECK:STDOUT: %OptionalStorage.impl_witness.fef: = impl_witness imports.%OptionalStorage.impl_witness_table.236, @ptr.as.OptionalStorage.impl(%S) [concrete] -// CHECK:STDOUT: %OptionalStorage.facet: %OptionalStorage.type = facet_value %ptr.5c7, (%OptionalStorage.impl_witness.fef) [concrete] -// CHECK:STDOUT: %Optional.454: type = class_type @Optional, @Optional(%OptionalStorage.facet) [concrete] +// CHECK:STDOUT: %OptionalStorage.facet.066: %OptionalStorage.type = facet_value %ptr.5c7, (%OptionalStorage.impl_witness.fef) [concrete] +// CHECK:STDOUT: %Optional.454: type = class_type @Optional, @Optional(%OptionalStorage.facet.066) [concrete] // CHECK:STDOUT: %pattern_type.683: type = pattern_type %Optional.454 [concrete] // CHECK:STDOUT: %Direct.type: type = fn_type @Direct [concrete] // CHECK:STDOUT: %Direct: %Direct.type = struct_value () [concrete] @@ -1539,19 +1596,26 @@ fn F() { // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] // CHECK:STDOUT: %ImplicitAs.type.099: type = facet_type <@ImplicitAs, @ImplicitAs(%Optional.454)> [concrete] // CHECK:STDOUT: %ImplicitAs.Convert.type.d3b: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%Optional.454) [concrete] -// CHECK:STDOUT: %T.binding.as_type.as.ImplicitAs.impl.Convert.type.a78: type = fn_type @T.binding.as_type.as.ImplicitAs.impl.Convert.1, @T.binding.as_type.as.ImplicitAs.impl.339(%T.3fe) [symbolic] -// CHECK:STDOUT: %T.binding.as_type.as.ImplicitAs.impl.Convert.d1b: %T.binding.as_type.as.ImplicitAs.impl.Convert.type.a78 = struct_value () [symbolic] -// CHECK:STDOUT: %ImplicitAs.impl_witness.ff2: = impl_witness imports.%ImplicitAs.impl_witness_table.284, @T.binding.as_type.as.ImplicitAs.impl.339(%OptionalStorage.facet) [concrete] -// CHECK:STDOUT: %T.binding.as_type.as.ImplicitAs.impl.Convert.type.398: type = fn_type @T.binding.as_type.as.ImplicitAs.impl.Convert.1, @T.binding.as_type.as.ImplicitAs.impl.339(%OptionalStorage.facet) [concrete] -// CHECK:STDOUT: %T.binding.as_type.as.ImplicitAs.impl.Convert.6d1: %T.binding.as_type.as.ImplicitAs.impl.Convert.type.398 = struct_value () [concrete] -// CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.099 = facet_value %ptr.5c7, (%ImplicitAs.impl_witness.ff2) [concrete] -// CHECK:STDOUT: %.681: type = fn_type_with_self_type %ImplicitAs.Convert.type.d3b, %ImplicitAs.facet [concrete] -// CHECK:STDOUT: %T.binding.as_type.as.ImplicitAs.impl.Convert.specific_fn: = specific_function %T.binding.as_type.as.ImplicitAs.impl.Convert.6d1, @T.binding.as_type.as.ImplicitAs.impl.Convert.1(%OptionalStorage.facet) [concrete] +// CHECK:STDOUT: %OptionalAs.type.593: type = facet_type <@OptionalAs, @OptionalAs(%T.3fe)> [symbolic] +// CHECK:STDOUT: %U.ec3: %OptionalAs.type.593 = symbolic_binding U, 1 [symbolic] +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.type.855: type = fn_type @U.binding.as_type.as.ImplicitAs.impl.Convert.2, @U.binding.as_type.as.ImplicitAs.impl.ea7(%T.3fe, %U.ec3) [symbolic] +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.337: %U.binding.as_type.as.ImplicitAs.impl.Convert.type.855 = struct_value () [symbolic] +// CHECK:STDOUT: %OptionalAs.type.af7: type = facet_type <@OptionalAs, @OptionalAs(%OptionalStorage.facet.066)> [concrete] +// CHECK:STDOUT: %T.binding.as_type.as.OptionalAs.impl.Convert.type.8c6: type = fn_type @T.binding.as_type.as.OptionalAs.impl.Convert, @T.binding.as_type.as.OptionalAs.impl(%T.3fe) [symbolic] +// CHECK:STDOUT: %T.binding.as_type.as.OptionalAs.impl.Convert.180: %T.binding.as_type.as.OptionalAs.impl.Convert.type.8c6 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %OptionalAs.impl_witness.12c: = impl_witness imports.%OptionalAs.impl_witness_table.8ee, @T.binding.as_type.as.OptionalAs.impl(%OptionalStorage.facet.066) [concrete] +// CHECK:STDOUT: %OptionalAs.facet: %OptionalAs.type.af7 = facet_value %ptr.5c7, (%OptionalAs.impl_witness.12c) [concrete] +// CHECK:STDOUT: %ImplicitAs.impl_witness.aa3: = impl_witness imports.%ImplicitAs.impl_witness_table.da6, @U.binding.as_type.as.ImplicitAs.impl.ea7(%OptionalStorage.facet.066, %OptionalAs.facet) [concrete] +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.type.95c: type = fn_type @U.binding.as_type.as.ImplicitAs.impl.Convert.2, @U.binding.as_type.as.ImplicitAs.impl.ea7(%OptionalStorage.facet.066, %OptionalAs.facet) [concrete] +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.80c: %U.binding.as_type.as.ImplicitAs.impl.Convert.type.95c = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.099 = facet_value %ptr.5c7, (%ImplicitAs.impl_witness.aa3) [concrete] +// CHECK:STDOUT: %.4d4: type = fn_type_with_self_type %ImplicitAs.Convert.type.d3b, %ImplicitAs.facet [concrete] +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.specific_fn: = specific_function %U.binding.as_type.as.ImplicitAs.impl.Convert.80c, @U.binding.as_type.as.ImplicitAs.impl.Convert.2(%OptionalStorage.facet.066, %OptionalAs.facet) [concrete] // CHECK:STDOUT: %Indirect.cpp_overload_set.type: type = cpp_overload_set_type @Indirect.cpp_overload_set [concrete] // CHECK:STDOUT: %Indirect.cpp_overload_set.value: %Indirect.cpp_overload_set.type = cpp_overload_set_value @Indirect.cpp_overload_set [concrete] // CHECK:STDOUT: %Indirect__carbon_thunk.type: type = fn_type @Indirect__carbon_thunk [concrete] // CHECK:STDOUT: %Indirect__carbon_thunk: %Indirect__carbon_thunk.type = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] // CHECK:STDOUT: %type_where: type = facet_type > [concrete] // CHECK:STDOUT: %facet_value.542: %type_where = facet_value %Optional.454, () [concrete] // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.6e8: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.542) [concrete] @@ -1588,27 +1652,29 @@ fn F() { // CHECK:STDOUT: %Direct.decl: %Direct.type = fn_decl @Direct [concrete = constants.%Direct] { // CHECK:STDOUT: // CHECK:STDOUT: } { -// CHECK:STDOUT: %OptionalStorage.facet.loc11_16.1: %OptionalStorage.type = facet_value constants.%ptr.5c7, (constants.%OptionalStorage.impl_witness.fef) [concrete = constants.%OptionalStorage.facet] -// CHECK:STDOUT: %.loc11_16.1: %OptionalStorage.type = converted constants.%ptr.5c7, %OptionalStorage.facet.loc11_16.1 [concrete = constants.%OptionalStorage.facet] -// CHECK:STDOUT: %Optional.loc11_16.1: type = class_type @Optional, @Optional(constants.%OptionalStorage.facet) [concrete = constants.%Optional.454] +// CHECK:STDOUT: %OptionalStorage.facet.loc11_16.1: %OptionalStorage.type = facet_value constants.%ptr.5c7, (constants.%OptionalStorage.impl_witness.fef) [concrete = constants.%OptionalStorage.facet.066] +// CHECK:STDOUT: %.loc11_16.1: %OptionalStorage.type = converted constants.%ptr.5c7, %OptionalStorage.facet.loc11_16.1 [concrete = constants.%OptionalStorage.facet.066] +// CHECK:STDOUT: %Optional.loc11_16.1: type = class_type @Optional, @Optional(constants.%OptionalStorage.facet.066) [concrete = constants.%Optional.454] // CHECK:STDOUT: // CHECK:STDOUT: %.loc11_16.2: type = splice_block %Optional.loc11_16.2 [concrete = constants.%Optional.454] { -// CHECK:STDOUT: %OptionalStorage.facet.loc11_16.2: %OptionalStorage.type = facet_value constants.%ptr.5c7, (constants.%OptionalStorage.impl_witness.fef) [concrete = constants.%OptionalStorage.facet] -// CHECK:STDOUT: %.loc11_16.3: %OptionalStorage.type = converted constants.%ptr.5c7, %OptionalStorage.facet.loc11_16.2 [concrete = constants.%OptionalStorage.facet] -// CHECK:STDOUT: %Optional.loc11_16.2: type = class_type @Optional, @Optional(constants.%OptionalStorage.facet) [concrete = constants.%Optional.454] +// CHECK:STDOUT: %OptionalStorage.facet.loc11_16.2: %OptionalStorage.type = facet_value constants.%ptr.5c7, (constants.%OptionalStorage.impl_witness.fef) [concrete = constants.%OptionalStorage.facet.066] +// CHECK:STDOUT: %.loc11_16.3: %OptionalStorage.type = converted constants.%ptr.5c7, %OptionalStorage.facet.loc11_16.2 [concrete = constants.%OptionalStorage.facet.066] +// CHECK:STDOUT: %Optional.loc11_16.2: type = class_type @Optional, @Optional(constants.%OptionalStorage.facet.066) [concrete = constants.%Optional.454] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] -// CHECK:STDOUT: %Core.import_ref.7bc: @T.binding.as_type.as.ImplicitAs.impl.339.%T.binding.as_type.as.ImplicitAs.impl.Convert.type (%T.binding.as_type.as.ImplicitAs.impl.Convert.type.a78) = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, loaded [symbolic = @T.binding.as_type.as.ImplicitAs.impl.339.%T.binding.as_type.as.ImplicitAs.impl.Convert (constants.%T.binding.as_type.as.ImplicitAs.impl.Convert.d1b)] -// CHECK:STDOUT: %ImplicitAs.impl_witness_table.284 = impl_witness_table (%Core.import_ref.7bc), @T.binding.as_type.as.ImplicitAs.impl.339 [concrete] +// CHECK:STDOUT: %Core.import_ref.ec9: @U.binding.as_type.as.ImplicitAs.impl.ea7.%U.binding.as_type.as.ImplicitAs.impl.Convert.type (%U.binding.as_type.as.ImplicitAs.impl.Convert.type.855) = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, loaded [symbolic = @U.binding.as_type.as.ImplicitAs.impl.ea7.%U.binding.as_type.as.ImplicitAs.impl.Convert (constants.%U.binding.as_type.as.ImplicitAs.impl.Convert.337)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.da6 = impl_witness_table (%Core.import_ref.ec9), @U.binding.as_type.as.ImplicitAs.impl.ea7 [concrete] +// CHECK:STDOUT: %Core.import_ref.7fb: @T.binding.as_type.as.OptionalAs.impl.%T.binding.as_type.as.OptionalAs.impl.Convert.type (%T.binding.as_type.as.OptionalAs.impl.Convert.type.8c6) = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, loaded [symbolic = @T.binding.as_type.as.OptionalAs.impl.%T.binding.as_type.as.OptionalAs.impl.Convert (constants.%T.binding.as_type.as.OptionalAs.impl.Convert.180)] +// CHECK:STDOUT: %OptionalAs.impl_witness_table.8ee = impl_witness_table (%Core.import_ref.7fb), @T.binding.as_type.as.OptionalAs.impl [concrete] // CHECK:STDOUT: %Indirect.cpp_overload_set.value: %Indirect.cpp_overload_set.type = cpp_overload_set_value @Indirect.cpp_overload_set [concrete = constants.%Indirect.cpp_overload_set.value] // CHECK:STDOUT: %Indirect__carbon_thunk.decl: %Indirect__carbon_thunk.type = fn_decl @Indirect__carbon_thunk [concrete = constants.%Indirect__carbon_thunk] { // CHECK:STDOUT: // CHECK:STDOUT: } { -// CHECK:STDOUT: %OptionalStorage.facet: %OptionalStorage.type = facet_value constants.%ptr.5c7, (constants.%OptionalStorage.impl_witness.fef) [concrete = constants.%OptionalStorage.facet] -// CHECK:STDOUT: %.loc13: %OptionalStorage.type = converted constants.%ptr.5c7, %OptionalStorage.facet [concrete = constants.%OptionalStorage.facet] -// CHECK:STDOUT: %Optional: type = class_type @Optional, @Optional(constants.%OptionalStorage.facet) [concrete = constants.%Optional.454] +// CHECK:STDOUT: %OptionalStorage.facet: %OptionalStorage.type = facet_value constants.%ptr.5c7, (constants.%OptionalStorage.impl_witness.fef) [concrete = constants.%OptionalStorage.facet.066] +// CHECK:STDOUT: %.loc13: %OptionalStorage.type = converted constants.%ptr.5c7, %OptionalStorage.facet [concrete = constants.%OptionalStorage.facet.066] +// CHECK:STDOUT: %Optional: type = class_type @Optional, @Optional(constants.%OptionalStorage.facet.066) [concrete = constants.%Optional.454] // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/destroy, Destroy, loaded [concrete = constants.%Destroy.type] @@ -1635,13 +1701,13 @@ fn F() { // CHECK:STDOUT: %s.ref: ref %S = name_ref s, %s // CHECK:STDOUT: %addr.loc11_14.1: %ptr.5c7 = addr_of %s.ref // CHECK:STDOUT: %.loc11_16.1: ref %Optional.454 = temporary_storage -// CHECK:STDOUT: %impl.elem0: %.681 = impl_witness_access constants.%ImplicitAs.impl_witness.ff2, element0 [concrete = constants.%T.binding.as_type.as.ImplicitAs.impl.Convert.6d1] +// CHECK:STDOUT: %impl.elem0: %.4d4 = impl_witness_access constants.%ImplicitAs.impl_witness.aa3, element0 [concrete = constants.%U.binding.as_type.as.ImplicitAs.impl.Convert.80c] // CHECK:STDOUT: %bound_method.loc11_14.1: = bound_method %addr.loc11_14.1, %impl.elem0 -// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @T.binding.as_type.as.ImplicitAs.impl.Convert.1(constants.%OptionalStorage.facet) [concrete = constants.%T.binding.as_type.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @U.binding.as_type.as.ImplicitAs.impl.Convert.2(constants.%OptionalStorage.facet.066, constants.%OptionalAs.facet) [concrete = constants.%U.binding.as_type.as.ImplicitAs.impl.Convert.specific_fn] // CHECK:STDOUT: %bound_method.loc11_14.2: = bound_method %addr.loc11_14.1, %specific_fn // CHECK:STDOUT: %.loc11_14.1: ref %Optional.454 = temporary_storage -// CHECK:STDOUT: %T.binding.as_type.as.ImplicitAs.impl.Convert.call: init %Optional.454 = call %bound_method.loc11_14.2(%addr.loc11_14.1) to %.loc11_14.1 -// CHECK:STDOUT: %.loc11_14.2: init %Optional.454 = converted %addr.loc11_14.1, %T.binding.as_type.as.ImplicitAs.impl.Convert.call +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.call: init %Optional.454 = call %bound_method.loc11_14.2(%addr.loc11_14.1) to %.loc11_14.1 +// CHECK:STDOUT: %.loc11_14.2: init %Optional.454 = converted %addr.loc11_14.1, %U.binding.as_type.as.ImplicitAs.impl.Convert.call // CHECK:STDOUT: %.loc11_14.3: ref %Optional.454 = temporary %.loc11_14.1, %.loc11_14.2 // CHECK:STDOUT: %.loc11_14.4: %Optional.454 = acquire_value %.loc11_14.3 // CHECK:STDOUT: %Direct.call: init %Optional.454 = call imports.%Direct.decl(%.loc11_14.4) to %.loc11_16.1 @@ -1669,9 +1735,9 @@ fn F() { // CHECK:STDOUT: %Cpp.ref.loc13_24: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %S.ref.loc13_27: type = name_ref S, imports.%S.decl [concrete = constants.%S] // CHECK:STDOUT: %ptr: type = ptr_type %S.ref.loc13_27 [concrete = constants.%ptr.5c7] -// CHECK:STDOUT: %OptionalStorage.facet: %OptionalStorage.type = facet_value %ptr, (constants.%OptionalStorage.impl_witness.fef) [concrete = constants.%OptionalStorage.facet] -// CHECK:STDOUT: %.loc13_30.2: %OptionalStorage.type = converted %ptr, %OptionalStorage.facet [concrete = constants.%OptionalStorage.facet] -// CHECK:STDOUT: %Optional: type = class_type @Optional, @Optional(constants.%OptionalStorage.facet) [concrete = constants.%Optional.454] +// CHECK:STDOUT: %OptionalStorage.facet: %OptionalStorage.type = facet_value %ptr, (constants.%OptionalStorage.impl_witness.fef) [concrete = constants.%OptionalStorage.facet.066] +// CHECK:STDOUT: %.loc13_30.2: %OptionalStorage.type = converted %ptr, %OptionalStorage.facet [concrete = constants.%OptionalStorage.facet.066] +// CHECK:STDOUT: %Optional: type = class_type @Optional, @Optional(constants.%OptionalStorage.facet.066) [concrete = constants.%Optional.454] // CHECK:STDOUT: } // CHECK:STDOUT: %.loc13_58.2: ref %Optional.454 = temporary %.loc13_58.1, %Indirect__carbon_thunk.call // CHECK:STDOUT: %.loc13_58.3: %Optional.454 = acquire_value %.loc13_58.2 diff --git a/toolchain/check/testdata/interop/cpp/function/void_pointer.carbon b/toolchain/check/testdata/interop/cpp/function/void_pointer.carbon index c6791bdcb235..40b2391b9c9e 100644 --- a/toolchain/check/testdata/interop/cpp/function/void_pointer.carbon +++ b/toolchain/check/testdata/interop/cpp/function/void_pointer.carbon @@ -222,20 +222,27 @@ fn F() { // CHECK:STDOUT: %ptr.as.OptionalStorage.impl.Some.type.911: type = fn_type @ptr.as.OptionalStorage.impl.Some, @ptr.as.OptionalStorage.impl(%T.d9f) [symbolic] // CHECK:STDOUT: %ptr.as.OptionalStorage.impl.Some.2a0: %ptr.as.OptionalStorage.impl.Some.type.911 = struct_value () [symbolic] // CHECK:STDOUT: %OptionalStorage.impl_witness.a64: = impl_witness imports.%OptionalStorage.impl_witness_table.236, @ptr.as.OptionalStorage.impl(Cpp.void) [concrete] -// CHECK:STDOUT: %OptionalStorage.facet: %OptionalStorage.type = facet_value %ptr.03c, (%OptionalStorage.impl_witness.a64) [concrete] -// CHECK:STDOUT: %Optional.75d: type = class_type @Optional, @Optional(%OptionalStorage.facet) [concrete] +// CHECK:STDOUT: %OptionalStorage.facet.e2a: %OptionalStorage.type = facet_value %ptr.03c, (%OptionalStorage.impl_witness.a64) [concrete] +// CHECK:STDOUT: %Optional.75d: type = class_type @Optional, @Optional(%OptionalStorage.facet.e2a) [concrete] // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] // CHECK:STDOUT: %ImplicitAs.type.707: type = facet_type <@ImplicitAs, @ImplicitAs(%Optional.75d)> [concrete] // CHECK:STDOUT: %ImplicitAs.Convert.type.465: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%Optional.75d) [concrete] -// CHECK:STDOUT: %T.binding.as_type.as.ImplicitAs.impl.Convert.type.a78: type = fn_type @T.binding.as_type.as.ImplicitAs.impl.Convert.1, @T.binding.as_type.as.ImplicitAs.impl.339(%T.3fe) [symbolic] -// CHECK:STDOUT: %T.binding.as_type.as.ImplicitAs.impl.Convert.d1b: %T.binding.as_type.as.ImplicitAs.impl.Convert.type.a78 = struct_value () [symbolic] -// CHECK:STDOUT: %ImplicitAs.impl_witness.aa2: = impl_witness imports.%ImplicitAs.impl_witness_table.284, @T.binding.as_type.as.ImplicitAs.impl.339(%OptionalStorage.facet) [concrete] -// CHECK:STDOUT: %T.binding.as_type.as.ImplicitAs.impl.Convert.type.a1e: type = fn_type @T.binding.as_type.as.ImplicitAs.impl.Convert.1, @T.binding.as_type.as.ImplicitAs.impl.339(%OptionalStorage.facet) [concrete] -// CHECK:STDOUT: %T.binding.as_type.as.ImplicitAs.impl.Convert.16f: %T.binding.as_type.as.ImplicitAs.impl.Convert.type.a1e = struct_value () [concrete] -// CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.707 = facet_value %ptr.03c, (%ImplicitAs.impl_witness.aa2) [concrete] -// CHECK:STDOUT: %.3b4: type = fn_type_with_self_type %ImplicitAs.Convert.type.465, %ImplicitAs.facet [concrete] -// CHECK:STDOUT: %T.binding.as_type.as.ImplicitAs.impl.Convert.specific_fn: = specific_function %T.binding.as_type.as.ImplicitAs.impl.Convert.16f, @T.binding.as_type.as.ImplicitAs.impl.Convert.1(%OptionalStorage.facet) [concrete] +// CHECK:STDOUT: %OptionalAs.type.593: type = facet_type <@OptionalAs, @OptionalAs(%T.3fe)> [symbolic] +// CHECK:STDOUT: %U.ec3: %OptionalAs.type.593 = symbolic_binding U, 1 [symbolic] +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.type.855: type = fn_type @U.binding.as_type.as.ImplicitAs.impl.Convert.2, @U.binding.as_type.as.ImplicitAs.impl.ea7(%T.3fe, %U.ec3) [symbolic] +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.337: %U.binding.as_type.as.ImplicitAs.impl.Convert.type.855 = struct_value () [symbolic] +// CHECK:STDOUT: %OptionalAs.type.a25: type = facet_type <@OptionalAs, @OptionalAs(%OptionalStorage.facet.e2a)> [concrete] +// CHECK:STDOUT: %T.binding.as_type.as.OptionalAs.impl.Convert.type.8c6: type = fn_type @T.binding.as_type.as.OptionalAs.impl.Convert, @T.binding.as_type.as.OptionalAs.impl(%T.3fe) [symbolic] +// CHECK:STDOUT: %T.binding.as_type.as.OptionalAs.impl.Convert.180: %T.binding.as_type.as.OptionalAs.impl.Convert.type.8c6 = struct_value () [symbolic] +// CHECK:STDOUT: %OptionalAs.impl_witness.c4d: = impl_witness imports.%OptionalAs.impl_witness_table.8ee, @T.binding.as_type.as.OptionalAs.impl(%OptionalStorage.facet.e2a) [concrete] +// CHECK:STDOUT: %OptionalAs.facet: %OptionalAs.type.a25 = facet_value %ptr.03c, (%OptionalAs.impl_witness.c4d) [concrete] +// CHECK:STDOUT: %ImplicitAs.impl_witness.354: = impl_witness imports.%ImplicitAs.impl_witness_table.da6, @U.binding.as_type.as.ImplicitAs.impl.ea7(%OptionalStorage.facet.e2a, %OptionalAs.facet) [concrete] +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.type.efe: type = fn_type @U.binding.as_type.as.ImplicitAs.impl.Convert.2, @U.binding.as_type.as.ImplicitAs.impl.ea7(%OptionalStorage.facet.e2a, %OptionalAs.facet) [concrete] +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.aa4: %U.binding.as_type.as.ImplicitAs.impl.Convert.type.efe = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.707 = facet_value %ptr.03c, (%ImplicitAs.impl_witness.354) [concrete] +// CHECK:STDOUT: %.120: type = fn_type_with_self_type %ImplicitAs.Convert.type.465, %ImplicitAs.facet [concrete] +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.specific_fn: = specific_function %U.binding.as_type.as.ImplicitAs.impl.Convert.aa4, @U.binding.as_type.as.ImplicitAs.impl.Convert.2(%OptionalStorage.facet.e2a, %OptionalAs.facet) [concrete] // CHECK:STDOUT: %type_where: type = facet_type > [concrete] // CHECK:STDOUT: %facet_value: %type_where = facet_value %Optional.75d, () [concrete] // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.773: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value) [concrete] @@ -261,14 +268,16 @@ fn F() { // CHECK:STDOUT: } { // CHECK:STDOUT: // CHECK:STDOUT: %.loc10_16.1: type = splice_block %Optional [concrete = constants.%Optional.75d] { -// CHECK:STDOUT: %OptionalStorage.facet: %OptionalStorage.type = facet_value constants.%ptr.03c, (constants.%OptionalStorage.impl_witness.a64) [concrete = constants.%OptionalStorage.facet] -// CHECK:STDOUT: %.loc10_16.2: %OptionalStorage.type = converted constants.%ptr.03c, %OptionalStorage.facet [concrete = constants.%OptionalStorage.facet] -// CHECK:STDOUT: %Optional: type = class_type @Optional, @Optional(constants.%OptionalStorage.facet) [concrete = constants.%Optional.75d] +// CHECK:STDOUT: %OptionalStorage.facet: %OptionalStorage.type = facet_value constants.%ptr.03c, (constants.%OptionalStorage.impl_witness.a64) [concrete = constants.%OptionalStorage.facet.e2a] +// CHECK:STDOUT: %.loc10_16.2: %OptionalStorage.type = converted constants.%ptr.03c, %OptionalStorage.facet [concrete = constants.%OptionalStorage.facet.e2a] +// CHECK:STDOUT: %Optional: type = class_type @Optional, @Optional(constants.%OptionalStorage.facet.e2a) [concrete = constants.%Optional.75d] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import_ref.7bc: @T.binding.as_type.as.ImplicitAs.impl.339.%T.binding.as_type.as.ImplicitAs.impl.Convert.type (%T.binding.as_type.as.ImplicitAs.impl.Convert.type.a78) = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, loaded [symbolic = @T.binding.as_type.as.ImplicitAs.impl.339.%T.binding.as_type.as.ImplicitAs.impl.Convert (constants.%T.binding.as_type.as.ImplicitAs.impl.Convert.d1b)] -// CHECK:STDOUT: %ImplicitAs.impl_witness_table.284 = impl_witness_table (%Core.import_ref.7bc), @T.binding.as_type.as.ImplicitAs.impl.339 [concrete] +// CHECK:STDOUT: %Core.import_ref.ec9: @U.binding.as_type.as.ImplicitAs.impl.ea7.%U.binding.as_type.as.ImplicitAs.impl.Convert.type (%U.binding.as_type.as.ImplicitAs.impl.Convert.type.855) = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, loaded [symbolic = @U.binding.as_type.as.ImplicitAs.impl.ea7.%U.binding.as_type.as.ImplicitAs.impl.Convert (constants.%U.binding.as_type.as.ImplicitAs.impl.Convert.337)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.da6 = impl_witness_table (%Core.import_ref.ec9), @U.binding.as_type.as.ImplicitAs.impl.ea7 [concrete] +// CHECK:STDOUT: %Core.import_ref.7fb: @T.binding.as_type.as.OptionalAs.impl.%T.binding.as_type.as.OptionalAs.impl.Convert.type (%T.binding.as_type.as.OptionalAs.impl.Convert.type.8c6) = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, loaded [symbolic = @T.binding.as_type.as.OptionalAs.impl.%T.binding.as_type.as.OptionalAs.impl.Convert (constants.%T.binding.as_type.as.OptionalAs.impl.Convert.180)] +// CHECK:STDOUT: %OptionalAs.impl_witness_table.8ee = impl_witness_table (%Core.import_ref.7fb), @T.binding.as_type.as.OptionalAs.impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%input.param: %ptr.03c) { @@ -276,13 +285,13 @@ fn F() { // CHECK:STDOUT: %Cpp.ref.loc10: = 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: %input.ref: %ptr.03c = name_ref input, %input -// CHECK:STDOUT: %impl.elem0: %.3b4 = impl_witness_access constants.%ImplicitAs.impl_witness.aa2, element0 [concrete = constants.%T.binding.as_type.as.ImplicitAs.impl.Convert.16f] +// CHECK:STDOUT: %impl.elem0: %.120 = impl_witness_access constants.%ImplicitAs.impl_witness.354, element0 [concrete = constants.%U.binding.as_type.as.ImplicitAs.impl.Convert.aa4] // CHECK:STDOUT: %bound_method.loc10_11.1: = bound_method %input.ref, %impl.elem0 -// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @T.binding.as_type.as.ImplicitAs.impl.Convert.1(constants.%OptionalStorage.facet) [concrete = constants.%T.binding.as_type.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @U.binding.as_type.as.ImplicitAs.impl.Convert.2(constants.%OptionalStorage.facet.e2a, constants.%OptionalAs.facet) [concrete = constants.%U.binding.as_type.as.ImplicitAs.impl.Convert.specific_fn] // CHECK:STDOUT: %bound_method.loc10_11.2: = bound_method %input.ref, %specific_fn // CHECK:STDOUT: %.loc10_11.1: ref %Optional.75d = temporary_storage -// CHECK:STDOUT: %T.binding.as_type.as.ImplicitAs.impl.Convert.call: init %Optional.75d = call %bound_method.loc10_11.2(%input.ref) to %.loc10_11.1 -// CHECK:STDOUT: %.loc10_11.2: init %Optional.75d = converted %input.ref, %T.binding.as_type.as.ImplicitAs.impl.Convert.call +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.call: init %Optional.75d = call %bound_method.loc10_11.2(%input.ref) to %.loc10_11.1 +// CHECK:STDOUT: %.loc10_11.2: init %Optional.75d = converted %input.ref, %U.binding.as_type.as.ImplicitAs.impl.Convert.call // CHECK:STDOUT: %.loc10_11.3: ref %Optional.75d = temporary %.loc10_11.1, %.loc10_11.2 // CHECK:STDOUT: %.loc10_11.4: %Optional.75d = acquire_value %.loc10_11.3 // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl(%.loc10_11.4) diff --git a/toolchain/lower/testdata/array/iterate.carbon b/toolchain/lower/testdata/array/iterate.carbon index 81f328e57328..e4cf19a5bbac 100644 --- a/toolchain/lower/testdata/array/iterate.carbon +++ b/toolchain/lower/testdata/array/iterate.carbon @@ -202,39 +202,39 @@ fn F() { // CHECK:STDOUT: !22 = !DILocation(line: 27, column: 7, scope: !15) // CHECK:STDOUT: !23 = !DILocation(line: 29, column: 14, scope: !15) // CHECK:STDOUT: !24 = !DILocation(line: 29, column: 7, scope: !15) -// CHECK:STDOUT: !25 = distinct !DISubprogram(name: "HasValue", linkageName: "_CHasValue.Optional.Core.c1b882a73b8b9531", scope: null, file: !26, line: 31, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !25 = distinct !DISubprogram(name: "HasValue", linkageName: "_CHasValue.Optional.Core.c1b882a73b8b9531", scope: null, file: !26, line: 32, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !26 = !DIFile(filename: "{{.*}}/prelude/types/optional.carbon", directory: "") -// CHECK:STDOUT: !27 = !DILocation(line: 32, column: 12, scope: !25) -// CHECK:STDOUT: !28 = !DILocation(line: 32, column: 5, scope: !25) -// CHECK:STDOUT: !29 = distinct !DISubprogram(name: "Get", linkageName: "_CGet.Optional.Core.c1b882a73b8b9531", scope: null, file: !26, line: 34, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !30 = !DILocation(line: 35, column: 12, scope: !29) -// CHECK:STDOUT: !31 = !DILocation(line: 35, column: 5, scope: !29) +// CHECK:STDOUT: !27 = !DILocation(line: 33, column: 12, scope: !25) +// CHECK:STDOUT: !28 = !DILocation(line: 33, column: 5, scope: !25) +// CHECK:STDOUT: !29 = distinct !DISubprogram(name: "Get", linkageName: "_CGet.Optional.Core.c1b882a73b8b9531", scope: null, file: !26, line: 35, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !30 = !DILocation(line: 36, column: 12, scope: !29) +// CHECK:STDOUT: !31 = !DILocation(line: 36, column: 5, scope: !29) // CHECK:STDOUT: !32 = distinct !DISubprogram(name: "Op", linkageName: "_COp.Int.Core:Inc.Core.be1e879c1ad406d8", scope: null, file: !33, line: 339, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !33 = !DIFile(filename: "{{.*}}/prelude/types/int.carbon", directory: "") // CHECK:STDOUT: !34 = !DILocation(line: 341, column: 5, scope: !32) // CHECK:STDOUT: !35 = !DILocation(line: 339, column: 3, scope: !32) -// CHECK:STDOUT: !36 = distinct !DISubprogram(name: "Some", linkageName: "_CSome.Optional.Core.c1b882a73b8b9531", scope: null, file: !26, line: 28, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !37 = !DILocation(line: 29, column: 12, scope: !36) -// CHECK:STDOUT: !38 = !DILocation(line: 29, column: 5, scope: !36) -// CHECK:STDOUT: !39 = distinct !DISubprogram(name: "None", linkageName: "_CNone.Optional.Core.c1b882a73b8b9531", scope: null, file: !26, line: 25, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !40 = !DILocation(line: 26, column: 12, scope: !39) -// CHECK:STDOUT: !41 = !DILocation(line: 26, column: 5, scope: !39) -// CHECK:STDOUT: !42 = distinct !DISubprogram(name: "Has", linkageName: "_CHas.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !26, line: 73, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !43 = !DILocation(line: 74, column: 12, scope: !42) -// CHECK:STDOUT: !44 = !DILocation(line: 74, column: 5, scope: !42) -// CHECK:STDOUT: !45 = distinct !DISubprogram(name: "Get", linkageName: "_CGet.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !26, line: 76, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !46 = !DILocation(line: 77, column: 12, scope: !45) -// CHECK:STDOUT: !47 = !DILocation(line: 77, column: 5, scope: !45) +// CHECK:STDOUT: !36 = distinct !DISubprogram(name: "Some", linkageName: "_CSome.Optional.Core.c1b882a73b8b9531", scope: null, file: !26, line: 29, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !37 = !DILocation(line: 30, column: 12, scope: !36) +// CHECK:STDOUT: !38 = !DILocation(line: 30, column: 5, scope: !36) +// CHECK:STDOUT: !39 = distinct !DISubprogram(name: "None", linkageName: "_CNone.Optional.Core.c1b882a73b8b9531", scope: null, file: !26, line: 26, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !40 = !DILocation(line: 27, column: 12, scope: !39) +// CHECK:STDOUT: !41 = !DILocation(line: 27, column: 5, scope: !39) +// CHECK:STDOUT: !42 = distinct !DISubprogram(name: "Has", linkageName: "_CHas.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !26, line: 112, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !43 = !DILocation(line: 113, column: 12, scope: !42) +// CHECK:STDOUT: !44 = !DILocation(line: 113, column: 5, scope: !42) +// CHECK:STDOUT: !45 = distinct !DISubprogram(name: "Get", linkageName: "_CGet.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !26, line: 115, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !46 = !DILocation(line: 116, column: 12, scope: !45) +// CHECK:STDOUT: !47 = !DILocation(line: 116, column: 5, scope: !45) // CHECK:STDOUT: !48 = distinct !DISubprogram(name: "Op", linkageName: "_COp:thunk.Int.Core:AddAssignWith.Core.dbc952efa35fc763", scope: null, file: !33, line: 275, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !49 = !DILocation(line: 4294967295, scope: !48) // CHECK:STDOUT: !50 = !DILocation(line: 275, column: 3, scope: !48) -// CHECK:STDOUT: !51 = distinct !DISubprogram(name: "Some", linkageName: "_CSome.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !26, line: 65, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !52 = !DILocation(line: 69, column: 5, scope: !51) -// CHECK:STDOUT: !53 = !DILocation(line: 70, column: 5, scope: !51) -// CHECK:STDOUT: !54 = !DILocation(line: 71, column: 5, scope: !51) -// CHECK:STDOUT: !55 = distinct !DISubprogram(name: "None", linkageName: "_CNone.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !26, line: 60, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !56 = !DILocation(line: 62, column: 5, scope: !55) -// CHECK:STDOUT: !57 = !DILocation(line: 63, column: 5, scope: !55) +// CHECK:STDOUT: !51 = distinct !DISubprogram(name: "Some", linkageName: "_CSome.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !26, line: 104, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !52 = !DILocation(line: 108, column: 5, scope: !51) +// CHECK:STDOUT: !53 = !DILocation(line: 109, column: 5, scope: !51) +// CHECK:STDOUT: !54 = !DILocation(line: 110, column: 5, scope: !51) +// CHECK:STDOUT: !55 = distinct !DISubprogram(name: "None", linkageName: "_CNone.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !26, line: 99, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !56 = !DILocation(line: 101, column: 5, scope: !55) +// CHECK:STDOUT: !57 = !DILocation(line: 102, column: 5, scope: !55) // CHECK:STDOUT: !58 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert.02bbc8f98b95ea6d:ImplicitAs.Core.5854fed63e66a74b", scope: null, file: !59, line: 24, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !59 = !DIFile(filename: "{{.*}}/prelude/operators/as.carbon", directory: "") // CHECK:STDOUT: !60 = !DILocation(line: 24, column: 38, scope: !58) diff --git a/toolchain/lower/testdata/for/bindings.carbon b/toolchain/lower/testdata/for/bindings.carbon index 4d224a05dd7a..8426704da45c 100644 --- a/toolchain/lower/testdata/for/bindings.carbon +++ b/toolchain/lower/testdata/for/bindings.carbon @@ -174,25 +174,25 @@ fn For() { // CHECK:STDOUT: !15 = distinct !DISubprogram(name: "Next", linkageName: "_CNext.EmptyRange.Main:Iterate.Core.a862d5c8b748242e", scope: null, file: !3, line: 18, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !16 = !DILocation(line: 19, column: 14, scope: !15) // CHECK:STDOUT: !17 = !DILocation(line: 19, column: 7, scope: !15) -// CHECK:STDOUT: !18 = distinct !DISubprogram(name: "HasValue", linkageName: "_CHasValue.Optional.Core.7a2fd2277130880e", scope: null, file: !19, line: 31, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !18 = distinct !DISubprogram(name: "HasValue", linkageName: "_CHasValue.Optional.Core.7a2fd2277130880e", scope: null, file: !19, line: 32, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !19 = !DIFile(filename: "{{.*}}/prelude/types/optional.carbon", directory: "") -// CHECK:STDOUT: !20 = !DILocation(line: 32, column: 12, scope: !18) -// CHECK:STDOUT: !21 = !DILocation(line: 32, column: 5, scope: !18) -// CHECK:STDOUT: !22 = distinct !DISubprogram(name: "Get", linkageName: "_CGet.Optional.Core.7a2fd2277130880e", scope: null, file: !19, line: 34, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !23 = !DILocation(line: 35, column: 12, scope: !22) -// CHECK:STDOUT: !24 = !DILocation(line: 35, column: 5, scope: !22) -// CHECK:STDOUT: !25 = distinct !DISubprogram(name: "None", linkageName: "_CNone.Optional.Core.7a2fd2277130880e", scope: null, file: !19, line: 25, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !26 = !DILocation(line: 26, column: 12, scope: !25) -// CHECK:STDOUT: !27 = !DILocation(line: 26, column: 5, scope: !25) -// CHECK:STDOUT: !28 = distinct !DISubprogram(name: "Has", linkageName: "_CHas.225258f1a45e9386:OptionalStorage.Core.a862d5c8b748242e", scope: null, file: !19, line: 73, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !29 = !DILocation(line: 74, column: 12, scope: !28) -// CHECK:STDOUT: !30 = !DILocation(line: 74, column: 5, scope: !28) -// CHECK:STDOUT: !31 = distinct !DISubprogram(name: "Get", linkageName: "_CGet.225258f1a45e9386:OptionalStorage.Core.a862d5c8b748242e", scope: null, file: !19, line: 76, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !32 = !DILocation(line: 77, column: 12, scope: !31) -// CHECK:STDOUT: !33 = !DILocation(line: 77, column: 5, scope: !31) -// CHECK:STDOUT: !34 = distinct !DISubprogram(name: "None", linkageName: "_CNone.225258f1a45e9386:OptionalStorage.Core.a862d5c8b748242e", scope: null, file: !19, line: 60, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !35 = !DILocation(line: 62, column: 5, scope: !34) -// CHECK:STDOUT: !36 = !DILocation(line: 63, column: 5, scope: !34) +// CHECK:STDOUT: !20 = !DILocation(line: 33, column: 12, scope: !18) +// CHECK:STDOUT: !21 = !DILocation(line: 33, column: 5, scope: !18) +// CHECK:STDOUT: !22 = distinct !DISubprogram(name: "Get", linkageName: "_CGet.Optional.Core.7a2fd2277130880e", scope: null, file: !19, line: 35, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !23 = !DILocation(line: 36, column: 12, scope: !22) +// CHECK:STDOUT: !24 = !DILocation(line: 36, column: 5, scope: !22) +// CHECK:STDOUT: !25 = distinct !DISubprogram(name: "None", linkageName: "_CNone.Optional.Core.7a2fd2277130880e", scope: null, file: !19, line: 26, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !26 = !DILocation(line: 27, column: 12, scope: !25) +// CHECK:STDOUT: !27 = !DILocation(line: 27, column: 5, scope: !25) +// CHECK:STDOUT: !28 = distinct !DISubprogram(name: "Has", linkageName: "_CHas.225258f1a45e9386:OptionalStorage.Core.a862d5c8b748242e", scope: null, file: !19, line: 112, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !29 = !DILocation(line: 113, column: 12, scope: !28) +// CHECK:STDOUT: !30 = !DILocation(line: 113, column: 5, scope: !28) +// CHECK:STDOUT: !31 = distinct !DISubprogram(name: "Get", linkageName: "_CGet.225258f1a45e9386:OptionalStorage.Core.a862d5c8b748242e", scope: null, file: !19, line: 115, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !32 = !DILocation(line: 116, column: 12, scope: !31) +// CHECK:STDOUT: !33 = !DILocation(line: 116, column: 5, scope: !31) +// CHECK:STDOUT: !34 = distinct !DISubprogram(name: "None", linkageName: "_CNone.225258f1a45e9386:OptionalStorage.Core.a862d5c8b748242e", scope: null, file: !19, line: 99, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !35 = !DILocation(line: 101, column: 5, scope: !34) +// CHECK:STDOUT: !36 = !DILocation(line: 102, column: 5, scope: !34) // CHECK:STDOUT: !37 = distinct !DISubprogram(name: "Op", linkageName: "_COp.2b3ba83e01542f11:Copy.Core.4193728889277ad1", scope: null, file: !38, line: 58, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !38 = !DIFile(filename: "{{.*}}/prelude/copy.carbon", directory: "") // CHECK:STDOUT: !39 = !DILocation(line: 59, column: 13, scope: !37) diff --git a/toolchain/lower/testdata/for/break_continue.carbon b/toolchain/lower/testdata/for/break_continue.carbon index 34d8450ddc6c..53ccbd5a4784 100644 --- a/toolchain/lower/testdata/for/break_continue.carbon +++ b/toolchain/lower/testdata/for/break_continue.carbon @@ -231,39 +231,39 @@ fn For() { // CHECK:STDOUT: !31 = !DILocation(line: 30, column: 9, scope: !22) // CHECK:STDOUT: !32 = !DILocation(line: 32, column: 16, scope: !22) // CHECK:STDOUT: !33 = !DILocation(line: 32, column: 9, scope: !22) -// CHECK:STDOUT: !34 = distinct !DISubprogram(name: "HasValue", linkageName: "_CHasValue.Optional.Core.c1b882a73b8b9531", scope: null, file: !35, line: 31, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !34 = distinct !DISubprogram(name: "HasValue", linkageName: "_CHasValue.Optional.Core.c1b882a73b8b9531", scope: null, file: !35, line: 32, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !35 = !DIFile(filename: "{{.*}}/prelude/types/optional.carbon", directory: "") -// CHECK:STDOUT: !36 = !DILocation(line: 32, column: 12, scope: !34) -// CHECK:STDOUT: !37 = !DILocation(line: 32, column: 5, scope: !34) -// CHECK:STDOUT: !38 = distinct !DISubprogram(name: "Get", linkageName: "_CGet.Optional.Core.c1b882a73b8b9531", scope: null, file: !35, line: 34, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !39 = !DILocation(line: 35, column: 12, scope: !38) -// CHECK:STDOUT: !40 = !DILocation(line: 35, column: 5, scope: !38) +// CHECK:STDOUT: !36 = !DILocation(line: 33, column: 12, scope: !34) +// CHECK:STDOUT: !37 = !DILocation(line: 33, column: 5, scope: !34) +// CHECK:STDOUT: !38 = distinct !DISubprogram(name: "Get", linkageName: "_CGet.Optional.Core.c1b882a73b8b9531", scope: null, file: !35, line: 35, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !39 = !DILocation(line: 36, column: 12, scope: !38) +// CHECK:STDOUT: !40 = !DILocation(line: 36, column: 5, scope: !38) // CHECK:STDOUT: !41 = distinct !DISubprogram(name: "Op", linkageName: "_COp.Int.Core:Inc.Core.be1e879c1ad406d8", scope: null, file: !42, line: 339, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !42 = !DIFile(filename: "{{.*}}/prelude/types/int.carbon", directory: "") // CHECK:STDOUT: !43 = !DILocation(line: 341, column: 5, scope: !41) // CHECK:STDOUT: !44 = !DILocation(line: 339, column: 3, scope: !41) -// CHECK:STDOUT: !45 = distinct !DISubprogram(name: "Some", linkageName: "_CSome.Optional.Core.c1b882a73b8b9531", scope: null, file: !35, line: 28, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !46 = !DILocation(line: 29, column: 12, scope: !45) -// CHECK:STDOUT: !47 = !DILocation(line: 29, column: 5, scope: !45) -// CHECK:STDOUT: !48 = distinct !DISubprogram(name: "None", linkageName: "_CNone.Optional.Core.c1b882a73b8b9531", scope: null, file: !35, line: 25, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !49 = !DILocation(line: 26, column: 12, scope: !48) -// CHECK:STDOUT: !50 = !DILocation(line: 26, column: 5, scope: !48) -// CHECK:STDOUT: !51 = distinct !DISubprogram(name: "Has", linkageName: "_CHas.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !35, line: 73, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !52 = !DILocation(line: 74, column: 12, scope: !51) -// CHECK:STDOUT: !53 = !DILocation(line: 74, column: 5, scope: !51) -// CHECK:STDOUT: !54 = distinct !DISubprogram(name: "Get", linkageName: "_CGet.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !35, line: 76, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !55 = !DILocation(line: 77, column: 12, scope: !54) -// CHECK:STDOUT: !56 = !DILocation(line: 77, column: 5, scope: !54) +// CHECK:STDOUT: !45 = distinct !DISubprogram(name: "Some", linkageName: "_CSome.Optional.Core.c1b882a73b8b9531", scope: null, file: !35, line: 29, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !46 = !DILocation(line: 30, column: 12, scope: !45) +// CHECK:STDOUT: !47 = !DILocation(line: 30, column: 5, scope: !45) +// CHECK:STDOUT: !48 = distinct !DISubprogram(name: "None", linkageName: "_CNone.Optional.Core.c1b882a73b8b9531", scope: null, file: !35, line: 26, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !49 = !DILocation(line: 27, column: 12, scope: !48) +// CHECK:STDOUT: !50 = !DILocation(line: 27, column: 5, scope: !48) +// CHECK:STDOUT: !51 = distinct !DISubprogram(name: "Has", linkageName: "_CHas.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !35, line: 112, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !52 = !DILocation(line: 113, column: 12, scope: !51) +// CHECK:STDOUT: !53 = !DILocation(line: 113, column: 5, scope: !51) +// CHECK:STDOUT: !54 = distinct !DISubprogram(name: "Get", linkageName: "_CGet.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !35, line: 115, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !55 = !DILocation(line: 116, column: 12, scope: !54) +// CHECK:STDOUT: !56 = !DILocation(line: 116, column: 5, scope: !54) // CHECK:STDOUT: !57 = distinct !DISubprogram(name: "Op", linkageName: "_COp:thunk.Int.Core:AddAssignWith.Core.5dfb78ae56583d8e", scope: null, file: !42, line: 275, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !58 = !DILocation(line: 4294967295, scope: !57) // CHECK:STDOUT: !59 = !DILocation(line: 275, column: 3, scope: !57) -// CHECK:STDOUT: !60 = distinct !DISubprogram(name: "Some", linkageName: "_CSome.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !35, line: 65, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !61 = !DILocation(line: 69, column: 5, scope: !60) -// CHECK:STDOUT: !62 = !DILocation(line: 70, column: 5, scope: !60) -// CHECK:STDOUT: !63 = !DILocation(line: 71, column: 5, scope: !60) -// CHECK:STDOUT: !64 = distinct !DISubprogram(name: "None", linkageName: "_CNone.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !35, line: 60, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !65 = !DILocation(line: 62, column: 5, scope: !64) -// CHECK:STDOUT: !66 = !DILocation(line: 63, column: 5, scope: !64) +// CHECK:STDOUT: !60 = distinct !DISubprogram(name: "Some", linkageName: "_CSome.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !35, line: 104, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !61 = !DILocation(line: 108, column: 5, scope: !60) +// CHECK:STDOUT: !62 = !DILocation(line: 109, column: 5, scope: !60) +// CHECK:STDOUT: !63 = !DILocation(line: 110, column: 5, scope: !60) +// CHECK:STDOUT: !64 = distinct !DISubprogram(name: "None", linkageName: "_CNone.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !35, line: 99, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !65 = !DILocation(line: 101, column: 5, scope: !64) +// CHECK:STDOUT: !66 = !DILocation(line: 102, column: 5, scope: !64) // CHECK:STDOUT: !67 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert.225258f1a45e9386:ImplicitAs.Core.5450dc8e8b8e0899", scope: null, file: !68, line: 24, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !68 = !DIFile(filename: "{{.*}}/prelude/operators/as.carbon", directory: "") // CHECK:STDOUT: !69 = !DILocation(line: 24, column: 38, scope: !67) diff --git a/toolchain/lower/testdata/for/for.carbon b/toolchain/lower/testdata/for/for.carbon index f7577a60e0a2..e0e30034722d 100644 --- a/toolchain/lower/testdata/for/for.carbon +++ b/toolchain/lower/testdata/for/for.carbon @@ -215,39 +215,39 @@ fn For() { // CHECK:STDOUT: !27 = !DILocation(line: 30, column: 9, scope: !18) // CHECK:STDOUT: !28 = !DILocation(line: 32, column: 16, scope: !18) // CHECK:STDOUT: !29 = !DILocation(line: 32, column: 9, scope: !18) -// CHECK:STDOUT: !30 = distinct !DISubprogram(name: "HasValue", linkageName: "_CHasValue.Optional.Core.c1b882a73b8b9531", scope: null, file: !31, line: 31, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !30 = distinct !DISubprogram(name: "HasValue", linkageName: "_CHasValue.Optional.Core.c1b882a73b8b9531", scope: null, file: !31, line: 32, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !31 = !DIFile(filename: "{{.*}}/prelude/types/optional.carbon", directory: "") -// CHECK:STDOUT: !32 = !DILocation(line: 32, column: 12, scope: !30) -// CHECK:STDOUT: !33 = !DILocation(line: 32, column: 5, scope: !30) -// CHECK:STDOUT: !34 = distinct !DISubprogram(name: "Get", linkageName: "_CGet.Optional.Core.c1b882a73b8b9531", scope: null, file: !31, line: 34, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !35 = !DILocation(line: 35, column: 12, scope: !34) -// CHECK:STDOUT: !36 = !DILocation(line: 35, column: 5, scope: !34) +// CHECK:STDOUT: !32 = !DILocation(line: 33, column: 12, scope: !30) +// CHECK:STDOUT: !33 = !DILocation(line: 33, column: 5, scope: !30) +// CHECK:STDOUT: !34 = distinct !DISubprogram(name: "Get", linkageName: "_CGet.Optional.Core.c1b882a73b8b9531", scope: null, file: !31, line: 35, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !35 = !DILocation(line: 36, column: 12, scope: !34) +// CHECK:STDOUT: !36 = !DILocation(line: 36, column: 5, scope: !34) // CHECK:STDOUT: !37 = distinct !DISubprogram(name: "Op", linkageName: "_COp.Int.Core:Inc.Core.be1e879c1ad406d8", scope: null, file: !38, line: 339, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !38 = !DIFile(filename: "{{.*}}/prelude/types/int.carbon", directory: "") // CHECK:STDOUT: !39 = !DILocation(line: 341, column: 5, scope: !37) // CHECK:STDOUT: !40 = !DILocation(line: 339, column: 3, scope: !37) -// CHECK:STDOUT: !41 = distinct !DISubprogram(name: "Some", linkageName: "_CSome.Optional.Core.c1b882a73b8b9531", scope: null, file: !31, line: 28, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !42 = !DILocation(line: 29, column: 12, scope: !41) -// CHECK:STDOUT: !43 = !DILocation(line: 29, column: 5, scope: !41) -// CHECK:STDOUT: !44 = distinct !DISubprogram(name: "None", linkageName: "_CNone.Optional.Core.c1b882a73b8b9531", scope: null, file: !31, line: 25, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !45 = !DILocation(line: 26, column: 12, scope: !44) -// CHECK:STDOUT: !46 = !DILocation(line: 26, column: 5, scope: !44) -// CHECK:STDOUT: !47 = distinct !DISubprogram(name: "Has", linkageName: "_CHas.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !31, line: 73, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !48 = !DILocation(line: 74, column: 12, scope: !47) -// CHECK:STDOUT: !49 = !DILocation(line: 74, column: 5, scope: !47) -// CHECK:STDOUT: !50 = distinct !DISubprogram(name: "Get", linkageName: "_CGet.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !31, line: 76, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !51 = !DILocation(line: 77, column: 12, scope: !50) -// CHECK:STDOUT: !52 = !DILocation(line: 77, column: 5, scope: !50) +// CHECK:STDOUT: !41 = distinct !DISubprogram(name: "Some", linkageName: "_CSome.Optional.Core.c1b882a73b8b9531", scope: null, file: !31, line: 29, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !42 = !DILocation(line: 30, column: 12, scope: !41) +// CHECK:STDOUT: !43 = !DILocation(line: 30, column: 5, scope: !41) +// CHECK:STDOUT: !44 = distinct !DISubprogram(name: "None", linkageName: "_CNone.Optional.Core.c1b882a73b8b9531", scope: null, file: !31, line: 26, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !45 = !DILocation(line: 27, column: 12, scope: !44) +// CHECK:STDOUT: !46 = !DILocation(line: 27, column: 5, scope: !44) +// CHECK:STDOUT: !47 = distinct !DISubprogram(name: "Has", linkageName: "_CHas.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !31, line: 112, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !48 = !DILocation(line: 113, column: 12, scope: !47) +// CHECK:STDOUT: !49 = !DILocation(line: 113, column: 5, scope: !47) +// CHECK:STDOUT: !50 = distinct !DISubprogram(name: "Get", linkageName: "_CGet.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !31, line: 115, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !51 = !DILocation(line: 116, column: 12, scope: !50) +// CHECK:STDOUT: !52 = !DILocation(line: 116, column: 5, scope: !50) // CHECK:STDOUT: !53 = distinct !DISubprogram(name: "Op", linkageName: "_COp:thunk.Int.Core:AddAssignWith.Core.5dfb78ae56583d8e", scope: null, file: !38, line: 275, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !54 = !DILocation(line: 4294967295, scope: !53) // CHECK:STDOUT: !55 = !DILocation(line: 275, column: 3, scope: !53) -// CHECK:STDOUT: !56 = distinct !DISubprogram(name: "Some", linkageName: "_CSome.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !31, line: 65, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !57 = !DILocation(line: 69, column: 5, scope: !56) -// CHECK:STDOUT: !58 = !DILocation(line: 70, column: 5, scope: !56) -// CHECK:STDOUT: !59 = !DILocation(line: 71, column: 5, scope: !56) -// CHECK:STDOUT: !60 = distinct !DISubprogram(name: "None", linkageName: "_CNone.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !31, line: 60, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !61 = !DILocation(line: 62, column: 5, scope: !60) -// CHECK:STDOUT: !62 = !DILocation(line: 63, column: 5, scope: !60) +// CHECK:STDOUT: !56 = distinct !DISubprogram(name: "Some", linkageName: "_CSome.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !31, line: 104, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !57 = !DILocation(line: 108, column: 5, scope: !56) +// CHECK:STDOUT: !58 = !DILocation(line: 109, column: 5, scope: !56) +// CHECK:STDOUT: !59 = !DILocation(line: 110, column: 5, scope: !56) +// CHECK:STDOUT: !60 = distinct !DISubprogram(name: "None", linkageName: "_CNone.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !31, line: 99, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !61 = !DILocation(line: 101, column: 5, scope: !60) +// CHECK:STDOUT: !62 = !DILocation(line: 102, column: 5, scope: !60) // CHECK:STDOUT: !63 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert.225258f1a45e9386:ImplicitAs.Core.5450dc8e8b8e0899", scope: null, file: !64, line: 24, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !64 = !DIFile(filename: "{{.*}}/prelude/operators/as.carbon", directory: "") // CHECK:STDOUT: !65 = !DILocation(line: 24, column: 38, scope: !63) diff --git a/toolchain/lower/testdata/primitives/optional.carbon b/toolchain/lower/testdata/primitives/optional.carbon index 8bce88455448..051e873a9c24 100644 --- a/toolchain/lower/testdata/primitives/optional.carbon +++ b/toolchain/lower/testdata/primitives/optional.carbon @@ -20,6 +20,19 @@ fn Convert(o: Core.Optional(i32*)) -> Core.Optional(i32) { return Core.Optional(i32).None(); } +fn AddOrRemoveConst(a: i32, b: const i32) { + // TODO: The code generated for these conversions is wrong: we initialize a + // temporary rather than the local variable. + var oa: Core.Optional(i32) = a; + var coa: const Core.Optional(i32) = a; + var oca: Core.Optional(const i32) = a; + var coca: const Core.Optional(const i32) = a; + var ob: Core.Optional(i32) = b; + var cob: const Core.Optional(i32) = b; + var ocb: Core.Optional(const i32) = b; + var cocb: const Core.Optional(const i32) = b; +} + // CHECK:STDOUT: ; ModuleID = 'optional.carbon' // CHECK:STDOUT: source_filename = "optional.carbon" // CHECK:STDOUT: @@ -34,7 +47,7 @@ fn Convert(o: Core.Optional(i32*)) -> Core.Optional(i32) { // CHECK:STDOUT: %Optional.Get.call = call ptr @_CGet.Optional.Core.217efae529e578bc(ptr %o), !dbg !10 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc18_20.1.temp), !dbg !7 // CHECK:STDOUT: %.loc18_12.2 = load i32, ptr %Optional.Get.call, align 4, !dbg !11 -// CHECK:STDOUT: call void @"_CConvert.8d16edc1dfe20a7c:ImplicitAs.Core.f16306f3d30b9711"(ptr %.loc18_20.1.temp, i32 %.loc18_12.2), !dbg !7 +// CHECK:STDOUT: call void @"_CConvert.f82b7327366b1770:ImplicitAs.Core.dbc2dba5c3cff15b"(ptr %.loc18_20.1.temp, i32 %.loc18_12.2), !dbg !7 // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: // CHECK:STDOUT: if.else: ; preds = %entry @@ -43,61 +56,208 @@ fn Convert(o: Core.Optional(i32*)) -> Core.Optional(i32) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define linkonce_odr i1 @_CHasValue.Optional.Core.217efae529e578bc(ptr %self) #0 !dbg !14 { -// CHECK:STDOUT: %1 = load ptr, ptr %self, align 8, !dbg !16 -// CHECK:STDOUT: %2 = icmp eq ptr %1, null, !dbg !16 -// CHECK:STDOUT: ret i1 %2, !dbg !17 +// CHECK:STDOUT: define void @_CAddOrRemoveConst.Main(i32 %a, i32 %b) #0 !dbg !14 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %oa.var = alloca { i32, i1 }, align 8, !dbg !15 +// CHECK:STDOUT: %.loc26_3.1.temp = alloca { i32, i1 }, align 8, !dbg !15 +// CHECK:STDOUT: %coa.var = alloca { i32, i1 }, align 8, !dbg !16 +// CHECK:STDOUT: %.loc27_3.1.temp = alloca { i32, i1 }, align 8, !dbg !16 +// CHECK:STDOUT: %oca.var = alloca { i32, i1 }, align 8, !dbg !17 +// CHECK:STDOUT: %.loc28_3.1.temp = alloca { i32, i1 }, align 8, !dbg !17 +// CHECK:STDOUT: %coca.var = alloca { i32, i1 }, align 8, !dbg !18 +// CHECK:STDOUT: %.loc29_3.1.temp = alloca { i32, i1 }, align 8, !dbg !18 +// CHECK:STDOUT: %ob.var = alloca { i32, i1 }, align 8, !dbg !19 +// CHECK:STDOUT: %.loc30_3.1.temp = alloca { i32, i1 }, align 8, !dbg !19 +// CHECK:STDOUT: %cob.var = alloca { i32, i1 }, align 8, !dbg !20 +// CHECK:STDOUT: %.loc31_3.1.temp = alloca { i32, i1 }, align 8, !dbg !20 +// CHECK:STDOUT: %ocb.var = alloca { i32, i1 }, align 8, !dbg !21 +// CHECK:STDOUT: %.loc32_3.1.temp = alloca { i32, i1 }, align 8, !dbg !21 +// CHECK:STDOUT: %cocb.var = alloca { i32, i1 }, align 8, !dbg !22 +// CHECK:STDOUT: %.loc33_3.1.temp = alloca { i32, i1 }, align 8, !dbg !22 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %oa.var), !dbg !15 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc26_3.1.temp), !dbg !15 +// CHECK:STDOUT: call void @"_CConvert.f82b7327366b1770:ImplicitAs.Core.dbc2dba5c3cff15b"(ptr %.loc26_3.1.temp, i32 %a), !dbg !15 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %coa.var), !dbg !16 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc27_3.1.temp), !dbg !16 +// CHECK:STDOUT: call void @"_CConvert.ab0f2d07242360d7:ImplicitAs.Core.7bf331f068e9c2df"(ptr %.loc27_3.1.temp, i32 %a), !dbg !16 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %oca.var), !dbg !17 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc28_3.1.temp), !dbg !17 +// CHECK:STDOUT: call void @"_CConvert.f82b7327366b1770:ImplicitAs.Core.aa7929136b20b999"(ptr %.loc28_3.1.temp, i32 %a), !dbg !17 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %coca.var), !dbg !18 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc29_3.1.temp), !dbg !18 +// CHECK:STDOUT: call void @"_CConvert.ab0f2d07242360d7:ImplicitAs.Core.988e6ea8b7110d27"(ptr %.loc29_3.1.temp, i32 %a), !dbg !18 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %ob.var), !dbg !19 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc30_3.1.temp), !dbg !19 +// CHECK:STDOUT: call void @"_CConvert.4a889a7251a91071:ImplicitAs.Core.7bf331f068e9c2df"(ptr %.loc30_3.1.temp, i32 %b), !dbg !19 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %cob.var), !dbg !20 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc31_3.1.temp), !dbg !20 +// CHECK:STDOUT: call void @"_CConvert.4a889a7251a91071:ImplicitAs.Core.af35f070baa4994b"(ptr %.loc31_3.1.temp, i32 %b), !dbg !20 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %ocb.var), !dbg !21 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc32_3.1.temp), !dbg !21 +// CHECK:STDOUT: call void @"_CConvert.4a889a7251a91071:ImplicitAs.Core.988e6ea8b7110d27"(ptr %.loc32_3.1.temp, i32 %b), !dbg !21 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %cocb.var), !dbg !22 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc33_3.1.temp), !dbg !22 +// CHECK:STDOUT: call void @"_CConvert.4a889a7251a91071:ImplicitAs.Core.42efcbde6ff4083b"(ptr %.loc33_3.1.temp, i32 %b), !dbg !22 +// CHECK:STDOUT: ret void, !dbg !23 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define linkonce_odr ptr @_CGet.Optional.Core.217efae529e578bc(ptr %self) #0 !dbg !18 { -// CHECK:STDOUT: %1 = call ptr @"_CGet.4f0b5cc38af595d2:OptionalStorage.Core.b88d1103f417c6d4"(ptr %self), !dbg !19 -// CHECK:STDOUT: ret ptr %1, !dbg !20 +// CHECK:STDOUT: define linkonce_odr i1 @_CHasValue.Optional.Core.217efae529e578bc(ptr %self) #0 !dbg !24 { +// CHECK:STDOUT: %1 = load ptr, ptr %self, align 8, !dbg !26 +// CHECK:STDOUT: %2 = icmp eq ptr %1, null, !dbg !26 +// CHECK:STDOUT: ret i1 %2, !dbg !27 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr ptr @_CGet.Optional.Core.217efae529e578bc(ptr %self) #0 !dbg !28 { +// CHECK:STDOUT: %1 = call ptr @"_CGet.4f0b5cc38af595d2:OptionalStorage.Core.b88d1103f417c6d4"(ptr %self), !dbg !29 +// CHECK:STDOUT: ret ptr %1, !dbg !30 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) // CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define linkonce_odr void @"_CConvert.8d16edc1dfe20a7c:ImplicitAs.Core.f16306f3d30b9711"(ptr sret({ i32, i1 }) %return, i32 %self) #0 !dbg !21 { -// CHECK:STDOUT: call void @_CSome.Optional.Core.f16306f3d30b9711(ptr %return, i32 %self), !dbg !22 -// CHECK:STDOUT: ret void, !dbg !23 +// CHECK:STDOUT: define linkonce_odr void @"_CConvert.f82b7327366b1770:ImplicitAs.Core.dbc2dba5c3cff15b"(ptr sret({ i32, i1 }) %return, i32 %self) #0 !dbg !31 { +// CHECK:STDOUT: call void @"_CConvert.8d16edc1dfe20a7c:OptionalAs.Core.f16306f3d30b9711"(ptr %return, i32 %self), !dbg !32 +// CHECK:STDOUT: ret void, !dbg !33 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define linkonce_odr void @_CNone.Optional.Core.f16306f3d30b9711(ptr sret({ i32, i1 }) %return) #0 !dbg !24 { -// CHECK:STDOUT: call void @"_CNone.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %return), !dbg !25 -// CHECK:STDOUT: ret void, !dbg !26 +// CHECK:STDOUT: define linkonce_odr void @_CNone.Optional.Core.f16306f3d30b9711(ptr sret({ i32, i1 }) %return) #0 !dbg !34 { +// CHECK:STDOUT: call void @"_CNone.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %return), !dbg !35 +// CHECK:STDOUT: ret void, !dbg !36 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define linkonce_odr ptr @"_CGet.4f0b5cc38af595d2:OptionalStorage.Core.b88d1103f417c6d4"(ptr %value) #0 !dbg !27 { -// CHECK:STDOUT: %1 = load ptr, ptr %value, align 8, !dbg !28 -// CHECK:STDOUT: ret ptr %1, !dbg !29 +// CHECK:STDOUT: define linkonce_odr void @"_CConvert.ab0f2d07242360d7:ImplicitAs.Core.7bf331f068e9c2df"(ptr sret({ i32, i1 }) %return, i32 %self) #0 !dbg !37 { +// CHECK:STDOUT: %temp = alloca { i32, i1 }, align 8, !dbg !39 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %temp), !dbg !39 +// CHECK:STDOUT: call void @"_CConvert.f82b7327366b1770:ImplicitAs.Core.dbc2dba5c3cff15b"(ptr %temp, i32 %self), !dbg !39 +// CHECK:STDOUT: ret void, !dbg !40 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define linkonce_odr void @_CSome.Optional.Core.f16306f3d30b9711(ptr sret({ i32, i1 }) %return, i32 %value) #0 !dbg !30 { -// CHECK:STDOUT: call void @"_CSome.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %return, i32 %value), !dbg !31 -// CHECK:STDOUT: ret void, !dbg !32 +// CHECK:STDOUT: define linkonce_odr void @"_CConvert.f82b7327366b1770:ImplicitAs.Core.aa7929136b20b999"(ptr sret({ i32, i1 }) %return, i32 %self) #0 !dbg !41 { +// CHECK:STDOUT: call void @"_CConvert.9d11af2db03b082d:OptionalAs.Core.f6268c15480add99"(ptr %return, i32 %self), !dbg !42 +// CHECK:STDOUT: ret void, !dbg !43 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define linkonce_odr void @"_CNone.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr sret({ i32, i1 }) %return) #0 !dbg !33 { -// CHECK:STDOUT: %has_value = getelementptr inbounds nuw { i32, i1 }, ptr %return, i32 0, i32 1, !dbg !34 -// CHECK:STDOUT: store i8 0, ptr %has_value, align 1, !dbg !34 -// CHECK:STDOUT: ret void, !dbg !35 +// CHECK:STDOUT: define linkonce_odr void @"_CConvert.ab0f2d07242360d7:ImplicitAs.Core.988e6ea8b7110d27"(ptr sret({ i32, i1 }) %return, i32 %self) #0 !dbg !44 { +// CHECK:STDOUT: %temp = alloca { i32, i1 }, align 8, !dbg !45 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %temp), !dbg !45 +// CHECK:STDOUT: call void @"_CConvert.f82b7327366b1770:ImplicitAs.Core.aa7929136b20b999"(ptr %temp, i32 %self), !dbg !45 +// CHECK:STDOUT: ret void, !dbg !46 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define linkonce_odr void @"_CSome.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr sret({ i32, i1 }) %return, i32 %self) #0 !dbg !36 { -// CHECK:STDOUT: %value = getelementptr inbounds nuw { i32, i1 }, ptr %return, i32 0, i32 0, !dbg !37 -// CHECK:STDOUT: store i32 %self, ptr %value, align 4, !dbg !37 -// CHECK:STDOUT: %has_value = getelementptr inbounds nuw { i32, i1 }, ptr %return, i32 0, i32 1, !dbg !38 -// CHECK:STDOUT: store i8 1, ptr %has_value, align 1, !dbg !38 -// CHECK:STDOUT: ret void, !dbg !39 +// CHECK:STDOUT: define linkonce_odr void @"_CConvert.4a889a7251a91071:ImplicitAs.Core.7bf331f068e9c2df"(ptr sret({ i32, i1 }) %return, i32 %self) #0 !dbg !47 { +// CHECK:STDOUT: call void @"_CConvert.f82b7327366b1770:ImplicitAs.Core.dbc2dba5c3cff15b"(ptr %return, i32 %self), !dbg !48 +// CHECK:STDOUT: ret void, !dbg !49 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_CConvert.4a889a7251a91071:ImplicitAs.Core.af35f070baa4994b"(ptr sret({ i32, i1 }) %return, i32 %self) #0 !dbg !50 { +// CHECK:STDOUT: call void @"_CConvert.ab0f2d07242360d7:ImplicitAs.Core.7bf331f068e9c2df"(ptr %return, i32 %self), !dbg !51 +// CHECK:STDOUT: ret void, !dbg !52 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_CConvert.4a889a7251a91071:ImplicitAs.Core.988e6ea8b7110d27"(ptr sret({ i32, i1 }) %return, i32 %self) #0 !dbg !53 { +// CHECK:STDOUT: call void @"_CConvert.f82b7327366b1770:ImplicitAs.Core.aa7929136b20b999"(ptr %return, i32 %self), !dbg !54 +// CHECK:STDOUT: ret void, !dbg !55 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_CConvert.4a889a7251a91071:ImplicitAs.Core.42efcbde6ff4083b"(ptr sret({ i32, i1 }) %return, i32 %self) #0 !dbg !56 { +// CHECK:STDOUT: call void @"_CConvert.ab0f2d07242360d7:ImplicitAs.Core.988e6ea8b7110d27"(ptr %return, i32 %self), !dbg !57 +// CHECK:STDOUT: ret void, !dbg !58 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr ptr @"_CGet.4f0b5cc38af595d2:OptionalStorage.Core.b88d1103f417c6d4"(ptr %value) #0 !dbg !59 { +// CHECK:STDOUT: %1 = load ptr, ptr %value, align 8, !dbg !60 +// CHECK:STDOUT: ret ptr %1, !dbg !61 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_CConvert.8d16edc1dfe20a7c:OptionalAs.Core.f16306f3d30b9711"(ptr sret({ i32, i1 }) %return, i32 %self) #0 !dbg !62 { +// CHECK:STDOUT: call void @_CSome.Optional.Core.f16306f3d30b9711(ptr %return, i32 %self), !dbg !63 +// CHECK:STDOUT: ret void, !dbg !64 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_CNone.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr sret({ i32, i1 }) %return) #0 !dbg !65 { +// CHECK:STDOUT: %has_value = getelementptr inbounds nuw { i32, i1 }, ptr %return, i32 0, i32 1, !dbg !66 +// CHECK:STDOUT: store i8 0, ptr %has_value, align 1, !dbg !66 +// CHECK:STDOUT: ret void, !dbg !67 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_CConvert.9d11af2db03b082d:OptionalAs.Core.f6268c15480add99"(ptr sret({ i32, i1 }) %return, i32 %self) #0 !dbg !68 { +// CHECK:STDOUT: %temp = alloca i32, align 4, !dbg !69 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %temp), !dbg !69 +// CHECK:STDOUT: %1 = call i32 @"_CConvert.ab0f2d07242360d7:ImplicitAs.Core.f9a27c9a1900a4ff"(i32 %self), !dbg !69 +// CHECK:STDOUT: store i32 %1, ptr %temp, align 4, !dbg !69 +// CHECK:STDOUT: %2 = load i32, ptr %temp, align 4, !dbg !69 +// CHECK:STDOUT: call void @_CSome.Optional.Core.9427236976e7a9ec(ptr %return, i32 %2), !dbg !70 +// CHECK:STDOUT: ret void, !dbg !71 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CSome.Optional.Core.f16306f3d30b9711(ptr sret({ i32, i1 }) %return, i32 %value) #0 !dbg !72 { +// CHECK:STDOUT: call void @"_CSome.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %return, i32 %value), !dbg !73 +// CHECK:STDOUT: ret void, !dbg !74 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @"_CConvert.ab0f2d07242360d7:ImplicitAs.Core.f9a27c9a1900a4ff"(i32 %self) #0 !dbg !75 { +// CHECK:STDOUT: %temp = alloca i32, align 4, !dbg !76 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %temp), !dbg !76 +// CHECK:STDOUT: %1 = call i32 @"_CConvert.225258f1a45e9386:ImplicitAs.Core.5450dc8e8b8e0899"(i32 %self), !dbg !76 +// CHECK:STDOUT: ret i32 %1, !dbg !77 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CSome.Optional.Core.9427236976e7a9ec(ptr sret({ i32, i1 }) %return, i32 %value) #0 !dbg !78 { +// CHECK:STDOUT: call void @"_CSome.225258f1a45e9386:OptionalStorage.Core.ae62e7630b150053"(ptr %return, i32 %value), !dbg !79 +// CHECK:STDOUT: ret void, !dbg !80 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_CSome.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr sret({ i32, i1 }) %return, i32 %self) #0 !dbg !81 { +// CHECK:STDOUT: %value = getelementptr inbounds nuw { i32, i1 }, ptr %return, i32 0, i32 0, !dbg !82 +// CHECK:STDOUT: store i32 %self, ptr %value, align 4, !dbg !82 +// CHECK:STDOUT: %has_value = getelementptr inbounds nuw { i32, i1 }, ptr %return, i32 0, i32 1, !dbg !83 +// CHECK:STDOUT: store i8 1, ptr %has_value, align 1, !dbg !83 +// CHECK:STDOUT: ret void, !dbg !84 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @"_CConvert.225258f1a45e9386:ImplicitAs.Core.5450dc8e8b8e0899"(i32 %self) #0 !dbg !85 { +// CHECK:STDOUT: ret i32 %self, !dbg !86 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_CSome.225258f1a45e9386:OptionalStorage.Core.ae62e7630b150053"(ptr sret({ i32, i1 }) %return, i32 %self) #0 !dbg !87 { +// CHECK:STDOUT: %value = getelementptr inbounds nuw { i32, i1 }, ptr %return, i32 0, i32 0, !dbg !88 +// CHECK:STDOUT: %1 = call i32 @"_COp.14f25726eade61db:Copy.Core.5450dc8e8b8e0899"(i32 %self), !dbg !89 +// CHECK:STDOUT: store i32 %1, ptr %value, align 4, !dbg !88 +// CHECK:STDOUT: %has_value = getelementptr inbounds nuw { i32, i1 }, ptr %return, i32 0, i32 1, !dbg !90 +// CHECK:STDOUT: store i8 1, ptr %has_value, align 1, !dbg !90 +// CHECK:STDOUT: ret void, !dbg !91 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @"_COp.14f25726eade61db:Copy.Core.5450dc8e8b8e0899"(i32 %self) #0 !dbg !92 { +// CHECK:STDOUT: ret i32 %self, !dbg !94 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; uselistorder directives +// CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 0, 1, 2, 3, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4 } +// CHECK:STDOUT: uselistorder ptr @"_CConvert.f82b7327366b1770:ImplicitAs.Core.dbc2dba5c3cff15b", { 0, 1, 3, 2 } +// CHECK:STDOUT: // CHECK:STDOUT: attributes #0 = { nounwind } // CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: @@ -118,29 +278,84 @@ fn Convert(o: Core.Optional(i32*)) -> Core.Optional(i32) { // CHECK:STDOUT: !11 = !DILocation(line: 18, column: 12, scope: !4) // CHECK:STDOUT: !12 = !DILocation(line: 20, column: 10, scope: !4) // CHECK:STDOUT: !13 = !DILocation(line: 20, column: 3, scope: !4) -// CHECK:STDOUT: !14 = distinct !DISubprogram(name: "HasValue", linkageName: "_CHasValue.Optional.Core.217efae529e578bc", scope: null, file: !15, line: 31, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !15 = !DIFile(filename: "{{.*}}/prelude/types/optional.carbon", directory: "") -// CHECK:STDOUT: !16 = !DILocation(line: 32, column: 12, scope: !14) -// CHECK:STDOUT: !17 = !DILocation(line: 32, column: 5, scope: !14) -// CHECK:STDOUT: !18 = distinct !DISubprogram(name: "Get", linkageName: "_CGet.Optional.Core.217efae529e578bc", scope: null, file: !15, line: 34, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !19 = !DILocation(line: 35, column: 12, scope: !18) -// CHECK:STDOUT: !20 = !DILocation(line: 35, column: 5, scope: !18) -// CHECK:STDOUT: !21 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert.8d16edc1dfe20a7c:ImplicitAs.Core.f16306f3d30b9711", scope: null, file: !15, line: 39, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !22 = !DILocation(line: 40, column: 14, scope: !21) -// CHECK:STDOUT: !23 = !DILocation(line: 40, column: 7, scope: !21) -// CHECK:STDOUT: !24 = distinct !DISubprogram(name: "None", linkageName: "_CNone.Optional.Core.f16306f3d30b9711", scope: null, file: !15, line: 25, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !25 = !DILocation(line: 26, column: 12, scope: !24) -// CHECK:STDOUT: !26 = !DILocation(line: 26, column: 5, scope: !24) -// CHECK:STDOUT: !27 = distinct !DISubprogram(name: "Get", linkageName: "_CGet.4f0b5cc38af595d2:OptionalStorage.Core.b88d1103f417c6d4", scope: null, file: !15, line: 92, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !28 = !DILocation(line: 93, column: 12, scope: !27) -// CHECK:STDOUT: !29 = !DILocation(line: 93, column: 5, scope: !27) -// CHECK:STDOUT: !30 = distinct !DISubprogram(name: "Some", linkageName: "_CSome.Optional.Core.f16306f3d30b9711", scope: null, file: !15, line: 28, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !31 = !DILocation(line: 29, column: 12, scope: !30) -// CHECK:STDOUT: !32 = !DILocation(line: 29, column: 5, scope: !30) -// CHECK:STDOUT: !33 = distinct !DISubprogram(name: "None", linkageName: "_CNone.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !15, line: 60, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !34 = !DILocation(line: 62, column: 5, scope: !33) -// CHECK:STDOUT: !35 = !DILocation(line: 63, column: 5, scope: !33) -// CHECK:STDOUT: !36 = distinct !DISubprogram(name: "Some", linkageName: "_CSome.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !15, line: 65, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !37 = !DILocation(line: 69, column: 5, scope: !36) -// CHECK:STDOUT: !38 = !DILocation(line: 70, column: 5, scope: !36) -// CHECK:STDOUT: !39 = !DILocation(line: 71, column: 5, scope: !36) +// CHECK:STDOUT: !14 = distinct !DISubprogram(name: "AddOrRemoveConst", linkageName: "_CAddOrRemoveConst.Main", scope: null, file: !3, line: 23, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !15 = !DILocation(line: 26, column: 3, scope: !14) +// CHECK:STDOUT: !16 = !DILocation(line: 27, column: 3, scope: !14) +// CHECK:STDOUT: !17 = !DILocation(line: 28, column: 3, scope: !14) +// CHECK:STDOUT: !18 = !DILocation(line: 29, column: 3, scope: !14) +// CHECK:STDOUT: !19 = !DILocation(line: 30, column: 3, scope: !14) +// CHECK:STDOUT: !20 = !DILocation(line: 31, column: 3, scope: !14) +// CHECK:STDOUT: !21 = !DILocation(line: 32, column: 3, scope: !14) +// CHECK:STDOUT: !22 = !DILocation(line: 33, column: 3, scope: !14) +// CHECK:STDOUT: !23 = !DILocation(line: 23, column: 1, scope: !14) +// CHECK:STDOUT: !24 = distinct !DISubprogram(name: "HasValue", linkageName: "_CHasValue.Optional.Core.217efae529e578bc", scope: null, file: !25, line: 32, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !25 = !DIFile(filename: "{{.*}}/prelude/types/optional.carbon", directory: "") +// CHECK:STDOUT: !26 = !DILocation(line: 33, column: 12, scope: !24) +// CHECK:STDOUT: !27 = !DILocation(line: 33, column: 5, scope: !24) +// CHECK:STDOUT: !28 = distinct !DISubprogram(name: "Get", linkageName: "_CGet.Optional.Core.217efae529e578bc", scope: null, file: !25, line: 35, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !29 = !DILocation(line: 36, column: 12, scope: !28) +// CHECK:STDOUT: !30 = !DILocation(line: 36, column: 5, scope: !28) +// CHECK:STDOUT: !31 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert.f82b7327366b1770:ImplicitAs.Core.dbc2dba5c3cff15b", scope: null, file: !25, line: 82, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !32 = !DILocation(line: 83, column: 12, scope: !31) +// CHECK:STDOUT: !33 = !DILocation(line: 83, column: 5, scope: !31) +// CHECK:STDOUT: !34 = distinct !DISubprogram(name: "None", linkageName: "_CNone.Optional.Core.f16306f3d30b9711", scope: null, file: !25, line: 26, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !35 = !DILocation(line: 27, column: 12, scope: !34) +// CHECK:STDOUT: !36 = !DILocation(line: 27, column: 5, scope: !34) +// CHECK:STDOUT: !37 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert.ab0f2d07242360d7:ImplicitAs.Core.7bf331f068e9c2df", scope: null, file: !38, line: 28, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !38 = !DIFile(filename: "{{.*}}/prelude/operators/as.carbon", directory: "") +// CHECK:STDOUT: !39 = !DILocation(line: 28, column: 45, scope: !37) +// CHECK:STDOUT: !40 = !DILocation(line: 28, column: 38, scope: !37) +// CHECK:STDOUT: !41 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert.f82b7327366b1770:ImplicitAs.Core.aa7929136b20b999", scope: null, file: !25, line: 82, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !42 = !DILocation(line: 83, column: 12, scope: !41) +// CHECK:STDOUT: !43 = !DILocation(line: 83, column: 5, scope: !41) +// CHECK:STDOUT: !44 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert.ab0f2d07242360d7:ImplicitAs.Core.988e6ea8b7110d27", scope: null, file: !38, line: 28, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !45 = !DILocation(line: 28, column: 45, scope: !44) +// CHECK:STDOUT: !46 = !DILocation(line: 28, column: 38, scope: !44) +// CHECK:STDOUT: !47 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert.4a889a7251a91071:ImplicitAs.Core.7bf331f068e9c2df", scope: null, file: !38, line: 32, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !48 = !DILocation(line: 32, column: 45, scope: !47) +// CHECK:STDOUT: !49 = !DILocation(line: 32, column: 38, scope: !47) +// CHECK:STDOUT: !50 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert.4a889a7251a91071:ImplicitAs.Core.af35f070baa4994b", scope: null, file: !38, line: 32, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !51 = !DILocation(line: 32, column: 45, scope: !50) +// CHECK:STDOUT: !52 = !DILocation(line: 32, column: 38, scope: !50) +// CHECK:STDOUT: !53 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert.4a889a7251a91071:ImplicitAs.Core.988e6ea8b7110d27", scope: null, file: !38, line: 32, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !54 = !DILocation(line: 32, column: 45, scope: !53) +// CHECK:STDOUT: !55 = !DILocation(line: 32, column: 38, scope: !53) +// CHECK:STDOUT: !56 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert.4a889a7251a91071:ImplicitAs.Core.42efcbde6ff4083b", scope: null, file: !38, line: 32, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !57 = !DILocation(line: 32, column: 45, scope: !56) +// CHECK:STDOUT: !58 = !DILocation(line: 32, column: 38, scope: !56) +// CHECK:STDOUT: !59 = distinct !DISubprogram(name: "Get", linkageName: "_CGet.4f0b5cc38af595d2:OptionalStorage.Core.b88d1103f417c6d4", scope: null, file: !25, line: 131, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !60 = !DILocation(line: 132, column: 12, scope: !59) +// CHECK:STDOUT: !61 = !DILocation(line: 132, column: 5, scope: !59) +// CHECK:STDOUT: !62 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert.8d16edc1dfe20a7c:OptionalAs.Core.f16306f3d30b9711", scope: null, file: !25, line: 68, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !63 = !DILocation(line: 69, column: 12, scope: !62) +// CHECK:STDOUT: !64 = !DILocation(line: 69, column: 5, scope: !62) +// CHECK:STDOUT: !65 = distinct !DISubprogram(name: "None", linkageName: "_CNone.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !25, line: 99, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !66 = !DILocation(line: 101, column: 5, scope: !65) +// CHECK:STDOUT: !67 = !DILocation(line: 102, column: 5, scope: !65) +// CHECK:STDOUT: !68 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert.9d11af2db03b082d:OptionalAs.Core.f6268c15480add99", scope: null, file: !25, line: 75, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !69 = !DILocation(line: 76, column: 29, scope: !68) +// CHECK:STDOUT: !70 = !DILocation(line: 76, column: 12, scope: !68) +// CHECK:STDOUT: !71 = !DILocation(line: 76, column: 5, scope: !68) +// CHECK:STDOUT: !72 = distinct !DISubprogram(name: "Some", linkageName: "_CSome.Optional.Core.f16306f3d30b9711", scope: null, file: !25, line: 29, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !73 = !DILocation(line: 30, column: 12, scope: !72) +// CHECK:STDOUT: !74 = !DILocation(line: 30, column: 5, scope: !72) +// CHECK:STDOUT: !75 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert.ab0f2d07242360d7:ImplicitAs.Core.f9a27c9a1900a4ff", scope: null, file: !38, line: 28, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !76 = !DILocation(line: 28, column: 45, scope: !75) +// CHECK:STDOUT: !77 = !DILocation(line: 28, column: 38, scope: !75) +// CHECK:STDOUT: !78 = distinct !DISubprogram(name: "Some", linkageName: "_CSome.Optional.Core.9427236976e7a9ec", scope: null, file: !25, line: 29, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !79 = !DILocation(line: 30, column: 12, scope: !78) +// CHECK:STDOUT: !80 = !DILocation(line: 30, column: 5, scope: !78) +// CHECK:STDOUT: !81 = distinct !DISubprogram(name: "Some", linkageName: "_CSome.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !25, line: 104, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !82 = !DILocation(line: 108, column: 5, scope: !81) +// CHECK:STDOUT: !83 = !DILocation(line: 109, column: 5, scope: !81) +// CHECK:STDOUT: !84 = !DILocation(line: 110, column: 5, scope: !81) +// CHECK:STDOUT: !85 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert.225258f1a45e9386:ImplicitAs.Core.5450dc8e8b8e0899", scope: null, file: !38, line: 24, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !86 = !DILocation(line: 24, column: 38, scope: !85) +// CHECK:STDOUT: !87 = distinct !DISubprogram(name: "Some", linkageName: "_CSome.225258f1a45e9386:OptionalStorage.Core.ae62e7630b150053", scope: null, file: !25, line: 104, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !88 = !DILocation(line: 108, column: 5, scope: !87) +// CHECK:STDOUT: !89 = !DILocation(line: 108, column: 28, scope: !87) +// CHECK:STDOUT: !90 = !DILocation(line: 109, column: 5, scope: !87) +// CHECK:STDOUT: !91 = !DILocation(line: 110, column: 5, scope: !87) +// CHECK:STDOUT: !92 = distinct !DISubprogram(name: "Op", linkageName: "_COp.14f25726eade61db:Copy.Core.5450dc8e8b8e0899", scope: null, file: !93, line: 19, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !93 = !DIFile(filename: "{{.*}}/prelude/copy.carbon", directory: "") +// CHECK:STDOUT: !94 = !DILocation(line: 19, column: 33, scope: !92)