Handle more kinds of templated conversion. (#7662)

Generalize ConvertToValue template action to handle other kinds of
conversion target that don't perform initialization. Initializing
conversions will need more work since they also need to use a splice to
form the storage block.
This commit is contained in:
Richard Smith
2026-08-21 14:39:19 +00:00
committed by GitHub
parent 4172f4d3f2
commit 186a756b72
9 changed files with 315 additions and 251 deletions
+1 -2
View File
@@ -195,14 +195,13 @@ fn H() { G(3); }
// CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.specific_fn: <specific function> = specific_function %Int.as.ImplicitAs.impl.Convert.69e, @Int.as.ImplicitAs.impl.Convert(%int_32) [concrete]
// CHECK:STDOUT: %bound_method.545: <bound method> = bound_method %int_3.410, %Int.as.ImplicitAs.impl.Convert.specific_fn [concrete]
// CHECK:STDOUT: %inst.splice_block: <instruction> = inst_value [concrete] {
// CHECK:STDOUT: %.774: Core.IntLiteral = splice_block %.60a [concrete = %int_3.1ba] {
// CHECK:STDOUT: %.354: Core.IntLiteral = splice_block %.238 [concrete = %int_3.1ba] {
// CHECK:STDOUT: %impl.elem0: %.e3f = impl_witness_access %ImplicitAs.impl_witness.590, element0 [concrete = %Int.as.ImplicitAs.impl.Convert.69e]
// CHECK:STDOUT: %bound_method.1cb: <bound method> = bound_method %int_3.410, %impl.elem0 [concrete = %Int.as.ImplicitAs.impl.Convert.bound]
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Int.as.ImplicitAs.impl.Convert(%int_32) [concrete = %Int.as.ImplicitAs.impl.Convert.specific_fn]
// CHECK:STDOUT: %bound_method.ae8: <bound method> = bound_method %int_3.410, %specific_fn [concrete = %bound_method.545]
// CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.call: init Core.IntLiteral = call %bound_method.ae8(%int_3.410) [concrete = %int_3.1ba]
// CHECK:STDOUT: %.238: Core.IntLiteral = value_of_initializer %Int.as.ImplicitAs.impl.Convert.call [concrete = %int_3.1ba]
// CHECK:STDOUT: %.60a: Core.IntLiteral = converted %int_3.410, %.238 [concrete = %int_3.1ba]
// CHECK:STDOUT: }
// CHECK:STDOUT: }
// CHECK:STDOUT: }