| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
- // 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/generic/call_basic_depth.carbon
- // TIP: To dump output, run:
- // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/generic/call_basic_depth.carbon
- class C {
- fn Cfn[unused self: Self, T:! type](unused x: T) {
- }
- }
- //@dump-sem-ir-begin
- fn F[T:! type](unused x: T) {
- }
- //@dump-sem-ir-end
- fn H[T:! type](x: T) {
- //@dump-sem-ir-begin
- F(x);
- //@dump-sem-ir-end
- }
- fn G[T:! type](x: T) {
- //@dump-sem-ir-begin
- H(x);
- F(x);
- //@dump-sem-ir-end
- var c: C;
- c.Cfn(x);
- }
- fn M() {
- var n: C;
- //@dump-sem-ir-begin
- F(n);
- G(n);
- //@dump-sem-ir-end
- }
- // CHECK:STDOUT: --- call_basic_depth.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %C: type = class_type @C [concrete]
- // CHECK:STDOUT: %pattern_type.7c7: type = pattern_type %C [concrete]
- // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
- // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic]
- // CHECK:STDOUT: %pattern_type.51d: type = pattern_type %T [symbolic]
- // CHECK:STDOUT: %C.Cfn.type: type = fn_type @C.Cfn [concrete]
- // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
- // CHECK:STDOUT: %C.Cfn: %C.Cfn.type = struct_value () [concrete]
- // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
- // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
- // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %T [symbolic]
- // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
- // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
- // CHECK:STDOUT: %H.type: type = fn_type @H [concrete]
- // CHECK:STDOUT: %H: %H.type = struct_value () [concrete]
- // CHECK:STDOUT: %F.specific_fn.643: <specific function> = specific_function %F, @F(%T) [symbolic]
- // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
- // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
- // CHECK:STDOUT: %H.specific_fn.965: <specific function> = specific_function %H, @H(%T) [symbolic]
- // CHECK:STDOUT: %F.specific_fn.540: <specific function> = specific_function %F, @F(%C) [concrete]
- // CHECK:STDOUT: %G.specific_fn: <specific function> = specific_function %G, @G(%C) [concrete]
- // CHECK:STDOUT: %H.specific_fn.d42: <specific function> = specific_function %H, @H(%C) [concrete]
- // CHECK:STDOUT: %C.Cfn.specific_fn.f5e: <specific function> = specific_function %C.Cfn, @C.Cfn(%C) [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 [concrete]
- // CHECK:STDOUT: %x.patt: @F.%pattern_type (%pattern_type.51d) = value_binding_pattern x [concrete]
- // CHECK:STDOUT: %x.param_patt: @F.%pattern_type (%pattern_type.51d) = value_param_pattern %x.patt [concrete]
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %.loc19_10.1: type = splice_block %.loc19_10.2 [concrete = type] {
- // CHECK:STDOUT: <elided>
- // CHECK:STDOUT: %.loc19_10.2: type = type_literal type [concrete = type]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %T.loc19_6.2: type = symbolic_binding T, 0 [symbolic = %T.loc19_6.1 (constants.%T)]
- // CHECK:STDOUT: %x.param: @F.%T.loc19_6.1 (%T) = value_param call_param0
- // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc19_6.2 [symbolic = %T.loc19_6.1 (constants.%T)]
- // CHECK:STDOUT: %x: @F.%T.loc19_6.1 (%T) = value_binding x, %x.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic fn @F(%T.loc19_6.2: type) {
- // CHECK:STDOUT: %T.loc19_6.1: type = symbolic_binding T, 0 [symbolic = %T.loc19_6.1 (constants.%T)]
- // CHECK:STDOUT: %pattern_type: type = pattern_type %T.loc19_6.1 [symbolic = %pattern_type (constants.%pattern_type.51d)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %T.loc19_6.1 [symbolic = %require_complete (constants.%require_complete)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn(%x.param: @F.%T.loc19_6.1 (%T)) {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic fn @H(%T.loc23_6.2: type) {
- // CHECK:STDOUT: <elided>
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: <elided>
- // CHECK:STDOUT: %F.specific_fn.loc25_3.2: <specific function> = specific_function constants.%F, @F(%T.loc23_6.1) [symbolic = %F.specific_fn.loc25_3.2 (constants.%F.specific_fn.643)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn(%x.param: @H.%T.loc23_6.1 (%T)) {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
- // CHECK:STDOUT: %x.ref: @H.%T.loc23_6.1 (%T) = name_ref x, %x
- // CHECK:STDOUT: %F.specific_fn.loc25_3.1: <specific function> = specific_function %F.ref, @F(constants.%T) [symbolic = %F.specific_fn.loc25_3.2 (constants.%F.specific_fn.643)]
- // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn.loc25_3.1(%x.ref)
- // CHECK:STDOUT: <elided>
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic fn @G(%T.loc29_6.2: type) {
- // CHECK:STDOUT: <elided>
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: <elided>
- // CHECK:STDOUT: %H.specific_fn.loc31_3.2: <specific function> = specific_function constants.%H, @H(%T.loc29_6.1) [symbolic = %H.specific_fn.loc31_3.2 (constants.%H.specific_fn.965)]
- // CHECK:STDOUT: %F.specific_fn.loc32_3.2: <specific function> = specific_function constants.%F, @F(%T.loc29_6.1) [symbolic = %F.specific_fn.loc32_3.2 (constants.%F.specific_fn.643)]
- // CHECK:STDOUT: <elided>
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn(%x.param: @G.%T.loc29_6.1 (%T)) {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %H.ref: %H.type = name_ref H, file.%H.decl [concrete = constants.%H]
- // CHECK:STDOUT: %x.ref.loc31: @G.%T.loc29_6.1 (%T) = name_ref x, %x
- // CHECK:STDOUT: %H.specific_fn.loc31_3.1: <specific function> = specific_function %H.ref, @H(constants.%T) [symbolic = %H.specific_fn.loc31_3.2 (constants.%H.specific_fn.965)]
- // CHECK:STDOUT: %H.call: init %empty_tuple.type = call %H.specific_fn.loc31_3.1(%x.ref.loc31)
- // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
- // CHECK:STDOUT: %x.ref.loc32: @G.%T.loc29_6.1 (%T) = name_ref x, %x
- // CHECK:STDOUT: %F.specific_fn.loc32_3.1: <specific function> = specific_function %F.ref, @F(constants.%T) [symbolic = %F.specific_fn.loc32_3.2 (constants.%F.specific_fn.643)]
- // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn.loc32_3.1(%x.ref.loc32)
- // CHECK:STDOUT: <elided>
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @M() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: <elided>
- // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
- // CHECK:STDOUT: %n.ref.loc43: ref %C = name_ref n, %n
- // CHECK:STDOUT: %F.specific_fn: <specific function> = specific_function %F.ref, @F(constants.%C) [concrete = constants.%F.specific_fn.540]
- // CHECK:STDOUT: %.loc43: %C = acquire_value %n.ref.loc43
- // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn(%.loc43)
- // CHECK:STDOUT: %G.ref: %G.type = name_ref G, file.%G.decl [concrete = constants.%G]
- // CHECK:STDOUT: %n.ref.loc44: ref %C = name_ref n, %n
- // CHECK:STDOUT: %G.specific_fn: <specific function> = specific_function %G.ref, @G(constants.%C) [concrete = constants.%G.specific_fn]
- // CHECK:STDOUT: %.loc44: %C = acquire_value %n.ref.loc44
- // CHECK:STDOUT: %G.call: init %empty_tuple.type = call %G.specific_fn(%.loc44)
- // CHECK:STDOUT: <elided>
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @F(constants.%T) {
- // CHECK:STDOUT: %T.loc19_6.1 => constants.%T
- // CHECK:STDOUT: %pattern_type => constants.%pattern_type.51d
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %require_complete => constants.%require_complete
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @H(constants.%T) {
- // CHECK:STDOUT: %T.loc23_6.1 => constants.%T
- // CHECK:STDOUT: %pattern_type => constants.%pattern_type.51d
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %require_complete => constants.%require_complete
- // CHECK:STDOUT: %F.specific_fn.loc25_3.2 => constants.%F.specific_fn.643
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @G(constants.%T) {
- // CHECK:STDOUT: %T.loc29_6.1 => constants.%T
- // CHECK:STDOUT: %pattern_type => constants.%pattern_type.51d
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @F(constants.%C) {
- // CHECK:STDOUT: %T.loc19_6.1 => constants.%C
- // CHECK:STDOUT: %pattern_type => constants.%pattern_type.7c7
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %require_complete => constants.%complete_type
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @G(constants.%C) {
- // CHECK:STDOUT: %T.loc29_6.1 => constants.%C
- // CHECK:STDOUT: %pattern_type => constants.%pattern_type.7c7
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %require_complete => constants.%complete_type
- // CHECK:STDOUT: %H.specific_fn.loc31_3.2 => constants.%H.specific_fn.d42
- // CHECK:STDOUT: %F.specific_fn.loc32_3.2 => constants.%F.specific_fn.540
- // CHECK:STDOUT: %C.Cfn.specific_fn.loc36_4.2 => constants.%C.Cfn.specific_fn.f5e
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @H(constants.%C) {
- // CHECK:STDOUT: %T.loc23_6.1 => constants.%C
- // CHECK:STDOUT: %pattern_type => constants.%pattern_type.7c7
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %require_complete => constants.%complete_type
- // CHECK:STDOUT: %F.specific_fn.loc25_3.2 => constants.%F.specific_fn.540
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
|