Support Temporary constants (#6983)

Evaluate `Temporary` constants to a `Temporary` with the `storage` field
set to `None`.
This commit is contained in:
Nicholas Bishop
2026-03-30 19:07:46 +00:00
committed by GitHub
parent 9ed045ec25
commit bf6a14ac39
64 changed files with 462 additions and 721 deletions
@@ -1826,6 +1826,7 @@ fn F() {
// 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: %.6ef: ref %S = temporary invalid, %S.val [concrete]
// CHECK:STDOUT: %Destroy.Op.type.bae255.2: type = fn_type @Destroy.Op.loc13 [concrete]
// CHECK:STDOUT: %Destroy.Op.651ba6.2: %Destroy.Op.type.bae255.2 = struct_value () [concrete]
// CHECK:STDOUT: %S.cpp_destructor.type: type = fn_type @S.cpp_destructor [concrete]
@@ -1927,7 +1928,7 @@ fn F() {
// CHECK:STDOUT: %.loc13_55.2: ref %S = temporary_storage
// CHECK:STDOUT: %.loc13_55.3: init %S to %.loc13_55.2 = class_init () [concrete = constants.%S.val]
// CHECK:STDOUT: %.loc13_57.1: init %S = converted %.loc13_55.1, %.loc13_55.3 [concrete = constants.%S.val]
// CHECK:STDOUT: %.loc13_57.2: ref %S = temporary %.loc13_55.2, %.loc13_57.1
// CHECK:STDOUT: %.loc13_57.2: ref %S = temporary %.loc13_55.2, %.loc13_57.1 [concrete = constants.%.6ef]
// CHECK:STDOUT: %.loc13_57.3: %S = acquire_value %.loc13_57.2
// CHECK:STDOUT: %.loc13_57.4: ref %S = value_as_ref %.loc13_57.3
// CHECK:STDOUT: %addr.loc13: %ptr.5c7 = addr_of %.loc13_57.4
@@ -1948,12 +1949,10 @@ fn F() {
// CHECK:STDOUT: %a: %Optional.065 = value_binding a, %.loc13_65.3
// CHECK:STDOUT: %Destroy.Op.bound.loc13: <bound method> = bound_method %.loc13_65.2, constants.%Destroy.Op.651ba6.2
// CHECK:STDOUT: %Destroy.Op.call.loc13: init %empty_tuple.type = call %Destroy.Op.bound.loc13(%.loc13_65.2)
// CHECK:STDOUT: %S.cpp_destructor.bound.loc13: <bound method> = bound_method %.loc13_57.2, constants.%S.cpp_destructor
// CHECK:STDOUT: %S.cpp_destructor.call.loc13: init %empty_tuple.type = call %S.cpp_destructor.bound.loc13(%.loc13_57.2)
// CHECK:STDOUT: %Destroy.Op.bound.loc11: <bound method> = bound_method %.loc11_14.3, constants.%Destroy.Op.651ba6.2
// CHECK:STDOUT: %Destroy.Op.call.loc11: init %empty_tuple.type = call %Destroy.Op.bound.loc11(%.loc11_14.3)
// CHECK:STDOUT: %S.cpp_destructor.bound.loc10: <bound method> = bound_method %s.var, constants.%S.cpp_destructor
// CHECK:STDOUT: %S.cpp_destructor.call.loc10: init %empty_tuple.type = call %S.cpp_destructor.bound.loc10(%s.var)
// CHECK:STDOUT: %S.cpp_destructor.bound: <bound method> = bound_method %s.var, constants.%S.cpp_destructor
// CHECK:STDOUT: %S.cpp_destructor.call: init %empty_tuple.type = call %S.cpp_destructor.bound(%s.var)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT: