| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485 |
- // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
- // Exceptions. See /LICENSE for license information.
- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- //
- // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/destroy.carbon
- //
- // AUTOUPDATE
- // TIP: To test this file alone, run:
- // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/destroy_calls.carbon
- // TIP: To dump output, run:
- // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/destroy_calls.carbon
- // --- implicit_return.carbon
- library "[[@TEST_NAME]]";
- class A {}
- class B {}
- class C {}
- //@dump-sem-ir-begin
- fn F() {
- var a: A;
- var b: B;
- var c: C;
- }
- //@dump-sem-ir-end
- // --- nested_scope.carbon
- library "[[@TEST_NAME]]";
- class A {}
- class B {}
- class C {}
- //@dump-sem-ir-begin
- fn F() {
- var a: A;
- var b: B;
- if (true) {
- var c: C;
- }
- }
- //@dump-sem-ir-end
- // --- temp.carbon
- library "[[@TEST_NAME]]";
- class A { fn Make() -> A; }
- class B { fn Make() -> B; }
- class C { fn Make() -> C; }
- //@dump-sem-ir-begin
- fn F() {
- // TODO: The scoping of these destroy calls is incorrect. Maybe we need to
- // establish statement scopes?
- A.Make();
- B.Make();
- C.Make();
- }
- //@dump-sem-ir-end
- // --- generic_class.carbon
- library "[[@TEST_NAME]]";
- class C {}
- class D(template T:! type) {}
- //@dump-sem-ir-begin
- fn F() {
- var a: D(C);
- }
- //@dump-sem-ir-end
- // --- generic_use_inside_generic.carbon
- library "[[@TEST_NAME]]";
- class C(template T:! type) {}
- //@dump-sem-ir-begin
- fn F(template T:! type) {
- var v: C(T);
- }
- //@dump-sem-ir-end
- fn G() { F({}); }
- // CHECK:STDOUT: --- implicit_return.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %A: type = class_type @A [concrete]
- // CHECK:STDOUT: %B: type = class_type @B [concrete]
- // CHECK:STDOUT: %C: type = class_type @C [concrete]
- // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
- // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
- // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
- // CHECK:STDOUT: %pattern_type.c10: type = pattern_type %A [concrete]
- // CHECK:STDOUT: %pattern_type.049: type = pattern_type %B [concrete]
- // CHECK:STDOUT: %pattern_type.c48: type = pattern_type %C [concrete]
- // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
- // CHECK:STDOUT: %facet_value.be8: %type_where = facet_value %C, () [concrete]
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.ed8: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.be8) [concrete]
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.f93: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.ed8 = struct_value () [concrete]
- // CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete]
- // CHECK:STDOUT: %facet_value.5f2: %type_where = facet_value %B, () [concrete]
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.db1: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.5f2) [concrete]
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.7d9: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.db1 = struct_value () [concrete]
- // CHECK:STDOUT: %ptr.e79: type = ptr_type %B [concrete]
- // CHECK:STDOUT: %facet_value.bb7: %type_where = facet_value %A, () [concrete]
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.61e: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.bb7) [concrete]
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.8ee: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.61e = struct_value () [concrete]
- // CHECK:STDOUT: %ptr.6db: type = ptr_type %A [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: name_binding_decl {
- // CHECK:STDOUT: %a.patt: %pattern_type.c10 = binding_pattern a [concrete]
- // CHECK:STDOUT: %a.var_patt: %pattern_type.c10 = var_pattern %a.patt [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a.var: ref %A = var %a.var_patt
- // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A]
- // CHECK:STDOUT: %a: ref %A = bind_name a, %a.var
- // CHECK:STDOUT: name_binding_decl {
- // CHECK:STDOUT: %b.patt: %pattern_type.049 = binding_pattern b [concrete]
- // CHECK:STDOUT: %b.var_patt: %pattern_type.049 = var_pattern %b.patt [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %b.var: ref %B = var %b.var_patt
- // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B]
- // CHECK:STDOUT: %b: ref %B = bind_name b, %b.var
- // CHECK:STDOUT: name_binding_decl {
- // CHECK:STDOUT: %c.patt: %pattern_type.c48 = binding_pattern c [concrete]
- // CHECK:STDOUT: %c.var_patt: %pattern_type.c48 = var_pattern %c.patt [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %c.var: ref %C = var %c.var_patt
- // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
- // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc12: <bound method> = bound_method %c.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.f93
- // CHECK:STDOUT: <elided>
- // CHECK:STDOUT: %bound_method.loc12: <bound method> = bound_method %c.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.1
- // CHECK:STDOUT: %addr.loc12: %ptr.019 = addr_of %c.var
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc12: init %empty_tuple.type = call %bound_method.loc12(%addr.loc12)
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc11: <bound method> = bound_method %b.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.7d9
- // CHECK:STDOUT: <elided>
- // CHECK:STDOUT: %bound_method.loc11: <bound method> = bound_method %b.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.2
- // CHECK:STDOUT: %addr.loc11: %ptr.e79 = addr_of %b.var
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc11: init %empty_tuple.type = call %bound_method.loc11(%addr.loc11)
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc10: <bound method> = bound_method %a.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.8ee
- // CHECK:STDOUT: <elided>
- // CHECK:STDOUT: %bound_method.loc10: <bound method> = bound_method %a.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.3
- // CHECK:STDOUT: %addr.loc10: %ptr.6db = addr_of %a.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: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- nested_scope.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %A: type = class_type @A [concrete]
- // CHECK:STDOUT: %B: type = class_type @B [concrete]
- // CHECK:STDOUT: %C: type = class_type @C [concrete]
- // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
- // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
- // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
- // CHECK:STDOUT: %pattern_type.c10: type = pattern_type %A [concrete]
- // CHECK:STDOUT: %pattern_type.049: type = pattern_type %B [concrete]
- // CHECK:STDOUT: %true: bool = bool_literal true [concrete]
- // CHECK:STDOUT: %pattern_type.c48: type = pattern_type %C [concrete]
- // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
- // CHECK:STDOUT: %facet_value.be8: %type_where = facet_value %C, () [concrete]
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.ed8: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.be8) [concrete]
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.f93: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.ed8 = struct_value () [concrete]
- // CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete]
- // CHECK:STDOUT: %facet_value.5f2: %type_where = facet_value %B, () [concrete]
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.db1: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.5f2) [concrete]
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.7d9: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.db1 = struct_value () [concrete]
- // CHECK:STDOUT: %ptr.e79: type = ptr_type %B [concrete]
- // CHECK:STDOUT: %facet_value.bb7: %type_where = facet_value %A, () [concrete]
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.61e: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.bb7) [concrete]
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.8ee: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.61e = struct_value () [concrete]
- // CHECK:STDOUT: %ptr.6db: type = ptr_type %A [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: name_binding_decl {
- // CHECK:STDOUT: %a.patt: %pattern_type.c10 = binding_pattern a [concrete]
- // CHECK:STDOUT: %a.var_patt: %pattern_type.c10 = var_pattern %a.patt [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a.var: ref %A = var %a.var_patt
- // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A]
- // CHECK:STDOUT: %a: ref %A = bind_name a, %a.var
- // CHECK:STDOUT: name_binding_decl {
- // CHECK:STDOUT: %b.patt: %pattern_type.049 = binding_pattern b [concrete]
- // CHECK:STDOUT: %b.var_patt: %pattern_type.049 = var_pattern %b.patt [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %b.var: ref %B = var %b.var_patt
- // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B]
- // CHECK:STDOUT: %b: ref %B = bind_name b, %b.var
- // CHECK:STDOUT: %true: bool = bool_literal true [concrete = constants.%true]
- // CHECK:STDOUT: if %true br !if.then else br !if.else
- // CHECK:STDOUT:
- // CHECK:STDOUT: !if.then:
- // CHECK:STDOUT: name_binding_decl {
- // CHECK:STDOUT: %c.patt: %pattern_type.c48 = binding_pattern c [concrete]
- // CHECK:STDOUT: %c.var_patt: %pattern_type.c48 = var_pattern %c.patt [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %c.var: ref %C = var %c.var_patt
- // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
- // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var
- // CHECK:STDOUT: br !if.else
- // CHECK:STDOUT:
- // CHECK:STDOUT: !if.else:
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc13: <bound method> = bound_method %c.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.f93
- // CHECK:STDOUT: <elided>
- // CHECK:STDOUT: %bound_method.loc13: <bound method> = bound_method %c.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.1
- // CHECK:STDOUT: %addr.loc13: %ptr.019 = addr_of %c.var
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc13: init %empty_tuple.type = call %bound_method.loc13(%addr.loc13)
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc11: <bound method> = bound_method %b.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.7d9
- // CHECK:STDOUT: <elided>
- // CHECK:STDOUT: %bound_method.loc11: <bound method> = bound_method %b.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.2
- // CHECK:STDOUT: %addr.loc11: %ptr.e79 = addr_of %b.var
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc11: init %empty_tuple.type = call %bound_method.loc11(%addr.loc11)
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc10: <bound method> = bound_method %a.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.8ee
- // CHECK:STDOUT: <elided>
- // CHECK:STDOUT: %bound_method.loc10: <bound method> = bound_method %a.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.3
- // CHECK:STDOUT: %addr.loc10: %ptr.6db = addr_of %a.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: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- temp.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %A: type = class_type @A [concrete]
- // CHECK:STDOUT: %A.Make.type: type = fn_type @A.Make [concrete]
- // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
- // CHECK:STDOUT: %A.Make: %A.Make.type = struct_value () [concrete]
- // CHECK:STDOUT: %B: type = class_type @B [concrete]
- // CHECK:STDOUT: %B.Make.type: type = fn_type @B.Make [concrete]
- // CHECK:STDOUT: %B.Make: %B.Make.type = struct_value () [concrete]
- // CHECK:STDOUT: %C: type = class_type @C [concrete]
- // CHECK:STDOUT: %C.Make.type: type = fn_type @C.Make [concrete]
- // CHECK:STDOUT: %C.Make: %C.Make.type = struct_value () [concrete]
- // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
- // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
- // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
- // CHECK:STDOUT: %facet_value.be8: %type_where = facet_value %C, () [concrete]
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.ed8: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.be8) [concrete]
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.f93: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.ed8 = struct_value () [concrete]
- // CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete]
- // CHECK:STDOUT: %facet_value.5f2: %type_where = facet_value %B, () [concrete]
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.db1: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.5f2) [concrete]
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.7d9: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.db1 = struct_value () [concrete]
- // CHECK:STDOUT: %ptr.e79: type = ptr_type %B [concrete]
- // CHECK:STDOUT: %facet_value.bb7: %type_where = facet_value %A, () [concrete]
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.61e: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.bb7) [concrete]
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.8ee: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.61e = struct_value () [concrete]
- // CHECK:STDOUT: %ptr.6db: type = ptr_type %A [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A]
- // CHECK:STDOUT: %Make.ref.loc12: %A.Make.type = name_ref Make, @A.%A.Make.decl [concrete = constants.%A.Make]
- // CHECK:STDOUT: %.loc12_10.1: ref %A = temporary_storage
- // CHECK:STDOUT: %A.Make.call: init %A = call %Make.ref.loc12() to %.loc12_10.1
- // CHECK:STDOUT: %.loc12_10.2: ref %A = temporary %.loc12_10.1, %A.Make.call
- // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B]
- // CHECK:STDOUT: %Make.ref.loc13: %B.Make.type = name_ref Make, @B.%B.Make.decl [concrete = constants.%B.Make]
- // CHECK:STDOUT: %.loc13_10.1: ref %B = temporary_storage
- // CHECK:STDOUT: %B.Make.call: init %B = call %Make.ref.loc13() to %.loc13_10.1
- // CHECK:STDOUT: %.loc13_10.2: ref %B = temporary %.loc13_10.1, %B.Make.call
- // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
- // CHECK:STDOUT: %Make.ref.loc14: %C.Make.type = name_ref Make, @C.%C.Make.decl [concrete = constants.%C.Make]
- // CHECK:STDOUT: %.loc14_10.1: ref %C = temporary_storage
- // CHECK:STDOUT: %C.Make.call: init %C = call %Make.ref.loc14() to %.loc14_10.1
- // CHECK:STDOUT: %.loc14_10.2: ref %C = temporary %.loc14_10.1, %C.Make.call
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc14: <bound method> = bound_method %.loc14_10.2, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.f93
- // CHECK:STDOUT: <elided>
- // CHECK:STDOUT: %bound_method.loc14: <bound method> = bound_method %.loc14_10.2, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.1
- // CHECK:STDOUT: %addr.loc14: %ptr.019 = addr_of %.loc14_10.2
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc14: init %empty_tuple.type = call %bound_method.loc14(%addr.loc14)
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc13: <bound method> = bound_method %.loc13_10.2, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.7d9
- // CHECK:STDOUT: <elided>
- // CHECK:STDOUT: %bound_method.loc13: <bound method> = bound_method %.loc13_10.2, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.2
- // CHECK:STDOUT: %addr.loc13: %ptr.e79 = addr_of %.loc13_10.2
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc13: init %empty_tuple.type = call %bound_method.loc13(%addr.loc13)
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc12: <bound method> = bound_method %.loc12_10.2, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.8ee
- // CHECK:STDOUT: <elided>
- // CHECK:STDOUT: %bound_method.loc12: <bound method> = bound_method %.loc12_10.2, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.3
- // CHECK:STDOUT: %addr.loc12: %ptr.6db = addr_of %.loc12_10.2
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc12: init %empty_tuple.type = call %bound_method.loc12(%addr.loc12)
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- generic_class.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %C: type = class_type @C [concrete]
- // CHECK:STDOUT: %D.type: type = generic_class_type @D [concrete]
- // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
- // CHECK:STDOUT: %D.generic: %D.type = struct_value () [concrete]
- // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
- // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
- // CHECK:STDOUT: %D.113: type = class_type @D, @D(%C) [concrete]
- // CHECK:STDOUT: %pattern_type.c95: type = pattern_type %D.113 [concrete]
- // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
- // CHECK:STDOUT: %facet_value: %type_where = facet_value %D.113, () [concrete]
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.994: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value) [concrete]
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.e1c: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.994 = struct_value () [concrete]
- // CHECK:STDOUT: %ptr.22d: type = ptr_type %D.113 [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: name_binding_decl {
- // CHECK:STDOUT: %a.patt: %pattern_type.c95 = binding_pattern a [concrete]
- // CHECK:STDOUT: %a.var_patt: %pattern_type.c95 = var_pattern %a.patt [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a.var: ref %D.113 = var %a.var_patt
- // CHECK:STDOUT: %.loc9: type = splice_block %D [concrete = constants.%D.113] {
- // CHECK:STDOUT: %D.ref: %D.type = name_ref D, file.%D.decl [concrete = constants.%D.generic]
- // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
- // CHECK:STDOUT: %D: type = class_type @D, @D(constants.%C) [concrete = constants.%D.113]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a: ref %D.113 = bind_name a, %a.var
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound: <bound method> = bound_method %a.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.e1c
- // CHECK:STDOUT: <elided>
- // CHECK:STDOUT: %bound_method: <bound method> = bound_method %a.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn
- // CHECK:STDOUT: %addr: %ptr.22d = addr_of %a.var
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method(%addr)
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- generic_use_inside_generic.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0, template [template]
- // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
- // CHECK:STDOUT: %C.type: type = generic_class_type @C [concrete]
- // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
- // CHECK:STDOUT: %C.generic: %C.type = struct_value () [concrete]
- // CHECK:STDOUT: %C.f2e: type = class_type @C, @C(%T) [template]
- // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
- // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
- // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
- // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
- // CHECK:STDOUT: %require_complete.389: <witness> = require_complete_type %C.f2e [template]
- // CHECK:STDOUT: %pattern_type.e5e: type = pattern_type %C.f2e [template]
- // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
- // CHECK:STDOUT: %Destroy.Op.type: type = fn_type @Destroy.Op [concrete]
- // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
- // CHECK:STDOUT: %DestroyT: %type_where = bind_symbolic_name DestroyT, 0 [symbolic]
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.b5d: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%DestroyT) [symbolic]
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.544: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.b5d = struct_value () [symbolic]
- // CHECK:STDOUT: %facet_value.cb6: %type_where = facet_value %C.f2e, () [template]
- // CHECK:STDOUT: %Destroy.impl_witness.e6a: <witness> = impl_witness imports.%Destroy.impl_witness_table, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.cb6) [template]
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.f15: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.cb6) [template]
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.e4b: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.f15 = struct_value () [template]
- // CHECK:STDOUT: %ptr.7d2: type = ptr_type %C.f2e [template]
- // CHECK:STDOUT: %require_complete.448: <witness> = require_complete_type %ptr.7d2 [template]
- // CHECK:STDOUT: %Destroy.facet.f3c: %Destroy.type = facet_value %C.f2e, (%Destroy.impl_witness.e6a) [template]
- // CHECK:STDOUT: %.bba: type = fn_type_with_self_type %Destroy.Op.type, %Destroy.facet.f3c [template]
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.2ba: <specific function> = specific_function %DestroyT.binding.as_type.as.Destroy.impl.Op.e4b, @DestroyT.binding.as_type.as.Destroy.impl.Op(%facet_value.cb6) [template]
- // CHECK:STDOUT: %C.7a7: type = class_type @C, @C(%empty_struct_type) [concrete]
- // CHECK:STDOUT: %pattern_type.99a: type = pattern_type %C.7a7 [concrete]
- // CHECK:STDOUT: %facet_value.036: %type_where = facet_value %C.7a7, () [concrete]
- // CHECK:STDOUT: %Destroy.impl_witness.5c6: <witness> = impl_witness imports.%Destroy.impl_witness_table, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.036) [concrete]
- // CHECK:STDOUT: %Destroy.facet.666: %Destroy.type = facet_value %C.7a7, (%Destroy.impl_witness.5c6) [concrete]
- // CHECK:STDOUT: %.dad: type = fn_type_with_self_type %Destroy.Op.type, %Destroy.facet.666 [concrete]
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.996: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.036) [concrete]
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.03a: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.996 = struct_value () [concrete]
- // CHECK:STDOUT: %ptr.308: type = ptr_type %C.7a7 [concrete]
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.482: <specific function> = specific_function %DestroyT.binding.as_type.as.Destroy.impl.Op.03a, @DestroyT.binding.as_type.as.Destroy.impl.Op(%facet_value.036) [concrete]
- // CHECK:STDOUT: %complete_type.903: <witness> = complete_type_witness %ptr.308 [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Core.import_ref.950: @DestroyT.binding.as_type.as.Destroy.impl.%DestroyT.binding.as_type.as.Destroy.impl.Op.type (%DestroyT.binding.as_type.as.Destroy.impl.Op.type.b5d) = import_ref Core//prelude/parts/destroy, loc{{\d+_\d+}}, loaded [symbolic = @DestroyT.binding.as_type.as.Destroy.impl.%DestroyT.binding.as_type.as.Destroy.impl.Op (constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.544)]
- // CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.950), @DestroyT.binding.as_type.as.Destroy.impl [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
- // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0, template [concrete]
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: <elided>
- // CHECK:STDOUT: %T.loc6_15.2: type = bind_symbolic_name T, 0, template [template = %T.loc6_15.1 (constants.%T)]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic fn @F(%T.loc6_15.2: type) {
- // CHECK:STDOUT: %T.loc6_15.1: type = bind_symbolic_name T, 0, template [template = %T.loc6_15.1 (constants.%T)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %C.loc7_13.2: type = class_type @C, @C(%T.loc6_15.1) [template = %C.loc7_13.2 (constants.%C.f2e)]
- // CHECK:STDOUT: %require_complete.loc7_13: <witness> = require_complete_type %C.loc7_13.2 [template = %require_complete.loc7_13 (constants.%require_complete.389)]
- // CHECK:STDOUT: %pattern_type: type = pattern_type %C.loc7_13.2 [template = %pattern_type (constants.%pattern_type.e5e)]
- // CHECK:STDOUT: %facet_value: %type_where = facet_value %C.loc7_13.2, () [template = %facet_value (constants.%facet_value.cb6)]
- // CHECK:STDOUT: %Destroy.impl_witness: <witness> = impl_witness imports.%Destroy.impl_witness_table, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value) [template = %Destroy.impl_witness (constants.%Destroy.impl_witness.e6a)]
- // CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C.loc7_13.2, (%Destroy.impl_witness) [template = %Destroy.facet (constants.%Destroy.facet.f3c)]
- // CHECK:STDOUT: %.loc7_3: type = fn_type_with_self_type constants.%Destroy.Op.type, %Destroy.facet [template = %.loc7_3 (constants.%.bba)]
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value) [template = %DestroyT.binding.as_type.as.Destroy.impl.Op.type (constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.type.f15)]
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op: @F.%DestroyT.binding.as_type.as.Destroy.impl.Op.type (%DestroyT.binding.as_type.as.Destroy.impl.Op.type.f15) = struct_value () [template = %DestroyT.binding.as_type.as.Destroy.impl.Op (constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.e4b)]
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn: <specific function> = specific_function %DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl.Op(%facet_value) [template = %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn (constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.2ba)]
- // CHECK:STDOUT: %ptr: type = ptr_type %C.loc7_13.2 [template = %ptr (constants.%ptr.7d2)]
- // CHECK:STDOUT: %require_complete.loc7_3: <witness> = require_complete_type %ptr [template = %require_complete.loc7_3 (constants.%require_complete.448)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: name_binding_decl {
- // CHECK:STDOUT: %v.patt: @F.%pattern_type (%pattern_type.e5e) = binding_pattern v [concrete]
- // CHECK:STDOUT: %v.var_patt: @F.%pattern_type (%pattern_type.e5e) = var_pattern %v.patt [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %v.var: ref @F.%C.loc7_13.2 (%C.f2e) = var %v.var_patt
- // CHECK:STDOUT: %.loc7_13: type = splice_block %C.loc7_13.1 [template = %C.loc7_13.2 (constants.%C.f2e)] {
- // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [concrete = constants.%C.generic]
- // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc6_15.2 [template = %T.loc6_15.1 (constants.%T)]
- // CHECK:STDOUT: %C.loc7_13.1: type = class_type @C, @C(constants.%T) [template = %C.loc7_13.2 (constants.%C.f2e)]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %v: ref @F.%C.loc7_13.2 (%C.f2e) = bind_name v, %v.var
- // CHECK:STDOUT: %impl.elem0: @F.%.loc7_3 (%.bba) = impl_witness_access constants.%Destroy.impl_witness.e6a, element0 [template = %DestroyT.binding.as_type.as.Destroy.impl.Op (constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.e4b)]
- // CHECK:STDOUT: %bound_method.loc7_3.1: <bound method> = bound_method %v.var, %impl.elem0
- // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @DestroyT.binding.as_type.as.Destroy.impl.Op(constants.%facet_value.cb6) [template = %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn (constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.2ba)]
- // CHECK:STDOUT: %bound_method.loc7_3.2: <bound method> = bound_method %v.var, %specific_fn
- // CHECK:STDOUT: %addr: @F.%ptr (%ptr.7d2) = addr_of %v.var
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method.loc7_3.2(%addr)
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @F(constants.%T) {
- // CHECK:STDOUT: %T.loc6_15.1 => constants.%T
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @F(constants.%empty_struct_type) {
- // CHECK:STDOUT: %T.loc6_15.1 => constants.%empty_struct_type
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %C.loc7_13.2 => constants.%C.7a7
- // CHECK:STDOUT: %require_complete.loc7_13 => constants.%complete_type.357
- // CHECK:STDOUT: %pattern_type => constants.%pattern_type.99a
- // CHECK:STDOUT: %facet_value => constants.%facet_value.036
- // CHECK:STDOUT: %Destroy.impl_witness => constants.%Destroy.impl_witness.5c6
- // CHECK:STDOUT: %Destroy.facet => constants.%Destroy.facet.666
- // CHECK:STDOUT: %.loc7_3 => constants.%.dad
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type => constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.type.996
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op => constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.03a
- // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn => constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.482
- // CHECK:STDOUT: %ptr => constants.%ptr.308
- // CHECK:STDOUT: %require_complete.loc7_3 => constants.%complete_type.903
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
|