call_basic_depth.carbon 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/int.carbon
  6. // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
  7. // EXTRA-ARGS: --dump-sem-ir-ranges=if-present
  8. //
  9. // AUTOUPDATE
  10. // TIP: To test this file alone, run:
  11. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/generic/call_basic_depth.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/generic/call_basic_depth.carbon
  14. class C {
  15. fn Cfn[self: Self, T:! type](x: T) {
  16. }
  17. }
  18. fn F[T:! type](x: T) {
  19. }
  20. fn H[T:! type](x: T) -> T {
  21. // TODO: Definition should be emitted for H for this to work in lowering.
  22. F(x);
  23. return x;
  24. }
  25. fn G[T:! type](x: T) -> T {
  26. H(x);
  27. F(x);
  28. var c: C;
  29. c.Cfn(x);
  30. return x;
  31. }
  32. fn M() {
  33. var n: i32 = 0;
  34. var m: i32;
  35. F(n);
  36. m = G(n);
  37. }
  38. // CHECK:STDOUT: --- call_basic_depth.carbon
  39. // CHECK:STDOUT:
  40. // CHECK:STDOUT: constants {
  41. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  42. // CHECK:STDOUT: %pattern_type.c48: type = pattern_type %C [concrete]
  43. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  44. // CHECK:STDOUT: %.Self.eb1: %type = bind_symbolic_name .Self [symbolic_self]
  45. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  46. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  47. // CHECK:STDOUT: %pattern_type.7dcd0a.1: type = pattern_type %T [symbolic]
  48. // CHECK:STDOUT: %C.Cfn.type: type = fn_type @C.Cfn [concrete]
  49. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  50. // CHECK:STDOUT: %C.Cfn: %C.Cfn.type = struct_value () [concrete]
  51. // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
  52. // CHECK:STDOUT: %pattern_type.f6d: type = pattern_type auto [concrete]
  53. // CHECK:STDOUT: %Destroy.impl_witness.9d0: <witness> = impl_witness @C.%Destroy.impl_witness_table [concrete]
  54. // CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete]
  55. // CHECK:STDOUT: %pattern_type.44a: type = pattern_type %ptr.019 [concrete]
  56. // CHECK:STDOUT: %C.as.Destroy.impl.Op.type: type = fn_type @C.as.Destroy.impl.Op [concrete]
  57. // CHECK:STDOUT: %C.as.Destroy.impl.Op: %C.as.Destroy.impl.Op.type = struct_value () [concrete]
  58. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  59. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  60. // CHECK:STDOUT: %require_complete.4ae: <witness> = require_complete_type %T [symbolic]
  61. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  62. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  63. // CHECK:STDOUT: %H.type: type = fn_type @H [concrete]
  64. // CHECK:STDOUT: %H: %H.type = struct_value () [concrete]
  65. // CHECK:STDOUT: %F.specific_fn.ef1: <specific function> = specific_function %F, @F(%T) [symbolic]
  66. // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
  67. // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
  68. // CHECK:STDOUT: %H.specific_fn.1ed: <specific function> = specific_function %H, @H(%T) [symbolic]
  69. // CHECK:STDOUT: %C.Cfn.specific_fn.53f: <specific function> = specific_function %C.Cfn, @C.Cfn(%T) [symbolic]
  70. // CHECK:STDOUT: %M.type: type = fn_type @M [concrete]
  71. // CHECK:STDOUT: %M: %M.type = struct_value () [concrete]
  72. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  73. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  74. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  75. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  76. // CHECK:STDOUT: %i32.builtin: type = int_type signed, %int_32 [concrete]
  77. // CHECK:STDOUT: %complete_type.f8a: <witness> = complete_type_witness %i32.builtin [concrete]
  78. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  79. // CHECK:STDOUT: %int_0.5c6: Core.IntLiteral = int_value 0 [concrete]
  80. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  81. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  82. // CHECK:STDOUT: %ImplicitAs.type.e8c: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  83. // CHECK:STDOUT: %ImplicitAs.Convert.type.1b6: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%i32) [concrete]
  84. // CHECK:STDOUT: %To: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  85. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.49e: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%To) [symbolic]
  86. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.f01: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.49e = struct_value () [symbolic]
  87. // CHECK:STDOUT: %ImplicitAs.impl_witness.acc: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.b6b, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  88. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.9ec: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  89. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.592: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.9ec = struct_value () [concrete]
  90. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.e8c = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.acc) [concrete]
  91. // CHECK:STDOUT: %.7ea: type = fn_type_with_self_type %ImplicitAs.Convert.type.1b6, %ImplicitAs.facet [concrete]
  92. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound: <bound method> = bound_method %int_0.5c6, %Core.IntLiteral.as.ImplicitAs.impl.Convert.592 [concrete]
  93. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.ImplicitAs.impl.Convert.592, @Core.IntLiteral.as.ImplicitAs.impl.Convert(%int_32) [concrete]
  94. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_0.5c6, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
  95. // CHECK:STDOUT: %int_0.6a9: %i32 = int_value 0 [concrete]
  96. // CHECK:STDOUT: %F.specific_fn.501: <specific function> = specific_function %F, @F(%i32) [concrete]
  97. // CHECK:STDOUT: %G.specific_fn: <specific function> = specific_function %G, @G(%i32) [concrete]
  98. // CHECK:STDOUT: %Int.as.Destroy.impl.Op.type.11b: type = fn_type @Int.as.Destroy.impl.Op, @Int.as.Destroy.impl(%int_32) [concrete]
  99. // CHECK:STDOUT: %Int.as.Destroy.impl.Op.054: %Int.as.Destroy.impl.Op.type.11b = struct_value () [concrete]
  100. // CHECK:STDOUT: %ptr.235: type = ptr_type %i32 [concrete]
  101. // CHECK:STDOUT: %Int.as.Destroy.impl.Op.specific_fn: <specific function> = specific_function %Int.as.Destroy.impl.Op.054, @Int.as.Destroy.impl.Op(%int_32) [concrete]
  102. // CHECK:STDOUT: %H.specific_fn.aac: <specific function> = specific_function %H, @H(%i32) [concrete]
  103. // CHECK:STDOUT: %C.Cfn.specific_fn.7b2: <specific function> = specific_function %C.Cfn, @C.Cfn(%i32) [concrete]
  104. // CHECK:STDOUT: }
  105. // CHECK:STDOUT:
  106. // CHECK:STDOUT: imports {
  107. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  108. // CHECK:STDOUT: .Destroy = %Core.Destroy
  109. // CHECK:STDOUT: .Int = %Core.Int
  110. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  111. // CHECK:STDOUT: import Core//prelude
  112. // CHECK:STDOUT: import Core//prelude/...
  113. // CHECK:STDOUT: }
  114. // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type]
  115. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  116. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  117. // CHECK:STDOUT: %Core.import_ref.428: @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert.type (%Core.IntLiteral.as.ImplicitAs.impl.Convert.type.49e) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert (constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f01)]
  118. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.b6b = impl_witness_table (%Core.import_ref.428), @Core.IntLiteral.as.ImplicitAs.impl [concrete]
  119. // CHECK:STDOUT: }
  120. // CHECK:STDOUT:
  121. // CHECK:STDOUT: file {
  122. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  123. // CHECK:STDOUT: .Core = imports.%Core
  124. // CHECK:STDOUT: .C = %C.decl
  125. // CHECK:STDOUT: .F = %F.decl
  126. // CHECK:STDOUT: .H = %H.decl
  127. // CHECK:STDOUT: .G = %G.decl
  128. // CHECK:STDOUT: .M = %M.decl
  129. // CHECK:STDOUT: }
  130. // CHECK:STDOUT: %Core.import = import Core
  131. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  132. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  133. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  134. // CHECK:STDOUT: %x.patt: @F.%pattern_type (%pattern_type.7dcd0a.1) = binding_pattern x [concrete]
  135. // CHECK:STDOUT: %x.param_patt: @F.%pattern_type (%pattern_type.7dcd0a.1) = value_param_pattern %x.patt, call_param0 [concrete]
  136. // CHECK:STDOUT: } {
  137. // CHECK:STDOUT: %.Self: %type = bind_symbolic_name .Self [symbolic_self = constants.%.Self.eb1]
  138. // CHECK:STDOUT: %T.loc20_6.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc20_6.1 (constants.%T)]
  139. // CHECK:STDOUT: %x.param: @F.%T.loc20_6.1 (%T) = value_param call_param0
  140. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc20_6.2 [symbolic = %T.loc20_6.1 (constants.%T)]
  141. // CHECK:STDOUT: %x: @F.%T.loc20_6.1 (%T) = bind_name x, %x.param
  142. // CHECK:STDOUT: }
  143. // CHECK:STDOUT: %H.decl: %H.type = fn_decl @H [concrete = constants.%H] {
  144. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  145. // CHECK:STDOUT: %x.patt: @H.%pattern_type (%pattern_type.7dcd0a.1) = binding_pattern x [concrete]
  146. // CHECK:STDOUT: %x.param_patt: @H.%pattern_type (%pattern_type.7dcd0a.1) = value_param_pattern %x.patt, call_param0 [concrete]
  147. // CHECK:STDOUT: %return.patt: @H.%pattern_type (%pattern_type.7dcd0a.1) = return_slot_pattern [concrete]
  148. // CHECK:STDOUT: %return.param_patt: @H.%pattern_type (%pattern_type.7dcd0a.1) = out_param_pattern %return.patt, call_param1 [concrete]
  149. // CHECK:STDOUT: } {
  150. // CHECK:STDOUT: %T.ref.loc23_25: type = name_ref T, %T.loc23_6.2 [symbolic = %T.loc23_6.1 (constants.%T)]
  151. // CHECK:STDOUT: %.Self: %type = bind_symbolic_name .Self [symbolic_self = constants.%.Self.eb1]
  152. // CHECK:STDOUT: %T.loc23_6.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc23_6.1 (constants.%T)]
  153. // CHECK:STDOUT: %x.param: @H.%T.loc23_6.1 (%T) = value_param call_param0
  154. // CHECK:STDOUT: %T.ref.loc23_19: type = name_ref T, %T.loc23_6.2 [symbolic = %T.loc23_6.1 (constants.%T)]
  155. // CHECK:STDOUT: %x: @H.%T.loc23_6.1 (%T) = bind_name x, %x.param
  156. // CHECK:STDOUT: %return.param: ref @H.%T.loc23_6.1 (%T) = out_param call_param1
  157. // CHECK:STDOUT: %return: ref @H.%T.loc23_6.1 (%T) = return_slot %return.param
  158. // CHECK:STDOUT: }
  159. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {
  160. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  161. // CHECK:STDOUT: %x.patt: @G.%pattern_type (%pattern_type.7dcd0a.1) = binding_pattern x [concrete]
  162. // CHECK:STDOUT: %x.param_patt: @G.%pattern_type (%pattern_type.7dcd0a.1) = value_param_pattern %x.patt, call_param0 [concrete]
  163. // CHECK:STDOUT: %return.patt: @G.%pattern_type (%pattern_type.7dcd0a.1) = return_slot_pattern [concrete]
  164. // CHECK:STDOUT: %return.param_patt: @G.%pattern_type (%pattern_type.7dcd0a.1) = out_param_pattern %return.patt, call_param1 [concrete]
  165. // CHECK:STDOUT: } {
  166. // CHECK:STDOUT: %T.ref.loc29_25: type = name_ref T, %T.loc29_6.2 [symbolic = %T.loc29_6.1 (constants.%T)]
  167. // CHECK:STDOUT: %.Self: %type = bind_symbolic_name .Self [symbolic_self = constants.%.Self.eb1]
  168. // CHECK:STDOUT: %T.loc29_6.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc29_6.1 (constants.%T)]
  169. // CHECK:STDOUT: %x.param: @G.%T.loc29_6.1 (%T) = value_param call_param0
  170. // CHECK:STDOUT: %T.ref.loc29_19: type = name_ref T, %T.loc29_6.2 [symbolic = %T.loc29_6.1 (constants.%T)]
  171. // CHECK:STDOUT: %x: @G.%T.loc29_6.1 (%T) = bind_name x, %x.param
  172. // CHECK:STDOUT: %return.param: ref @G.%T.loc29_6.1 (%T) = out_param call_param1
  173. // CHECK:STDOUT: %return: ref @G.%T.loc29_6.1 (%T) = return_slot %return.param
  174. // CHECK:STDOUT: }
  175. // CHECK:STDOUT: %M.decl: %M.type = fn_decl @M [concrete = constants.%M] {} {}
  176. // CHECK:STDOUT: }
  177. // CHECK:STDOUT:
  178. // CHECK:STDOUT: impl @C.as.Destroy.impl: @C.%Self.ref as constants.%Destroy.type {
  179. // CHECK:STDOUT: %C.as.Destroy.impl.Op.decl: %C.as.Destroy.impl.Op.type = fn_decl @C.as.Destroy.impl.Op [concrete = constants.%C.as.Destroy.impl.Op] {
  180. // CHECK:STDOUT: %self.patt: %pattern_type.44a = binding_pattern self [concrete]
  181. // CHECK:STDOUT: %self.param_patt: %pattern_type.44a = value_param_pattern %self.patt, call_param0 [concrete]
  182. // CHECK:STDOUT: %.loc15: %pattern_type.f6d = addr_pattern %self.param_patt [concrete]
  183. // CHECK:STDOUT: } {
  184. // CHECK:STDOUT: %self.param: %ptr.019 = value_param call_param0
  185. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [concrete = constants.%C]
  186. // CHECK:STDOUT: %self: %ptr.019 = bind_name self, %self.param
  187. // CHECK:STDOUT: }
  188. // CHECK:STDOUT:
  189. // CHECK:STDOUT: !members:
  190. // CHECK:STDOUT: .Op = %C.as.Destroy.impl.Op.decl
  191. // CHECK:STDOUT: witness = @C.%Destroy.impl_witness
  192. // CHECK:STDOUT: }
  193. // CHECK:STDOUT:
  194. // CHECK:STDOUT: class @C {
  195. // CHECK:STDOUT: %C.Cfn.decl: %C.Cfn.type = fn_decl @C.Cfn [concrete = constants.%C.Cfn] {
  196. // CHECK:STDOUT: %self.patt: %pattern_type.c48 = binding_pattern self [concrete]
  197. // CHECK:STDOUT: %self.param_patt: %pattern_type.c48 = value_param_pattern %self.patt, call_param0 [concrete]
  198. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  199. // CHECK:STDOUT: %x.patt: @C.Cfn.%pattern_type (%pattern_type.7dcd0a.1) = binding_pattern x [concrete]
  200. // CHECK:STDOUT: %x.param_patt: @C.Cfn.%pattern_type (%pattern_type.7dcd0a.1) = value_param_pattern %x.patt, call_param1 [concrete]
  201. // CHECK:STDOUT: } {
  202. // CHECK:STDOUT: %self.param: %C = value_param call_param0
  203. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [concrete = constants.%C]
  204. // CHECK:STDOUT: %self: %C = bind_name self, %self.param
  205. // CHECK:STDOUT: %.Self: %type = bind_symbolic_name .Self [symbolic_self = constants.%.Self.eb1]
  206. // CHECK:STDOUT: %T.loc16_22.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc16_22.1 (constants.%T)]
  207. // CHECK:STDOUT: %x.param: @C.Cfn.%T.loc16_22.1 (%T) = value_param call_param1
  208. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc16_22.2 [symbolic = %T.loc16_22.1 (constants.%T)]
  209. // CHECK:STDOUT: %x: @C.Cfn.%T.loc16_22.1 (%T) = bind_name x, %x.param
  210. // CHECK:STDOUT: }
  211. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [concrete = constants.%C]
  212. // CHECK:STDOUT: impl_decl @C.as.Destroy.impl [concrete] {} {}
  213. // CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (@C.as.Destroy.impl.%C.as.Destroy.impl.Op.decl), @C.as.Destroy.impl [concrete]
  214. // CHECK:STDOUT: %Destroy.impl_witness: <witness> = impl_witness %Destroy.impl_witness_table [concrete = constants.%Destroy.impl_witness.9d0]
  215. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357]
  216. // CHECK:STDOUT: complete_type_witness = %complete_type
  217. // CHECK:STDOUT:
  218. // CHECK:STDOUT: !members:
  219. // CHECK:STDOUT: .Self = constants.%C
  220. // CHECK:STDOUT: .Cfn = %C.Cfn.decl
  221. // CHECK:STDOUT: }
  222. // CHECK:STDOUT:
  223. // CHECK:STDOUT: generic fn @C.Cfn(%T.loc16_22.2: type) {
  224. // CHECK:STDOUT: %T.loc16_22.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc16_22.1 (constants.%T)]
  225. // CHECK:STDOUT: %pattern_type: type = pattern_type %T.loc16_22.1 [symbolic = %pattern_type (constants.%pattern_type.7dcd0a.1)]
  226. // CHECK:STDOUT:
  227. // CHECK:STDOUT: !definition:
  228. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %T.loc16_22.1 [symbolic = %require_complete (constants.%require_complete.4ae)]
  229. // CHECK:STDOUT:
  230. // CHECK:STDOUT: fn(%self.param: %C, %x.param: @C.Cfn.%T.loc16_22.1 (%T)) {
  231. // CHECK:STDOUT: !entry:
  232. // CHECK:STDOUT: return
  233. // CHECK:STDOUT: }
  234. // CHECK:STDOUT: }
  235. // CHECK:STDOUT:
  236. // CHECK:STDOUT: fn @C.as.Destroy.impl.Op(%self.param: %ptr.019) = "no_op";
  237. // CHECK:STDOUT:
  238. // CHECK:STDOUT: generic fn @F(%T.loc20_6.2: type) {
  239. // CHECK:STDOUT: %T.loc20_6.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc20_6.1 (constants.%T)]
  240. // CHECK:STDOUT: %pattern_type: type = pattern_type %T.loc20_6.1 [symbolic = %pattern_type (constants.%pattern_type.7dcd0a.1)]
  241. // CHECK:STDOUT:
  242. // CHECK:STDOUT: !definition:
  243. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %T.loc20_6.1 [symbolic = %require_complete (constants.%require_complete.4ae)]
  244. // CHECK:STDOUT:
  245. // CHECK:STDOUT: fn(%x.param: @F.%T.loc20_6.1 (%T)) {
  246. // CHECK:STDOUT: !entry:
  247. // CHECK:STDOUT: return
  248. // CHECK:STDOUT: }
  249. // CHECK:STDOUT: }
  250. // CHECK:STDOUT:
  251. // CHECK:STDOUT: generic fn @H(%T.loc23_6.2: type) {
  252. // CHECK:STDOUT: %T.loc23_6.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc23_6.1 (constants.%T)]
  253. // CHECK:STDOUT: %pattern_type: type = pattern_type %T.loc23_6.1 [symbolic = %pattern_type (constants.%pattern_type.7dcd0a.1)]
  254. // CHECK:STDOUT:
  255. // CHECK:STDOUT: !definition:
  256. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %T.loc23_6.1 [symbolic = %require_complete (constants.%require_complete.4ae)]
  257. // 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.ef1)]
  258. // CHECK:STDOUT:
  259. // CHECK:STDOUT: fn(%x.param: @H.%T.loc23_6.1 (%T)) -> @H.%T.loc23_6.1 (%T) {
  260. // CHECK:STDOUT: !entry:
  261. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
  262. // CHECK:STDOUT: %x.ref.loc25: @H.%T.loc23_6.1 (%T) = name_ref x, %x
  263. // 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.ef1)]
  264. // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn.loc25_3.1(%x.ref.loc25)
  265. // CHECK:STDOUT: %x.ref.loc26: @H.%T.loc23_6.1 (%T) = name_ref x, %x
  266. // CHECK:STDOUT: return %x.ref.loc26
  267. // CHECK:STDOUT: }
  268. // CHECK:STDOUT: }
  269. // CHECK:STDOUT:
  270. // CHECK:STDOUT: generic fn @G(%T.loc29_6.2: type) {
  271. // CHECK:STDOUT: %T.loc29_6.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc29_6.1 (constants.%T)]
  272. // CHECK:STDOUT: %pattern_type: type = pattern_type %T.loc29_6.1 [symbolic = %pattern_type (constants.%pattern_type.7dcd0a.1)]
  273. // CHECK:STDOUT:
  274. // CHECK:STDOUT: !definition:
  275. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %T.loc29_6.1 [symbolic = %require_complete (constants.%require_complete.4ae)]
  276. // CHECK:STDOUT: %H.specific_fn.loc30_3.2: <specific function> = specific_function constants.%H, @H(%T.loc29_6.1) [symbolic = %H.specific_fn.loc30_3.2 (constants.%H.specific_fn.1ed)]
  277. // CHECK:STDOUT: %F.specific_fn.loc31_3.2: <specific function> = specific_function constants.%F, @F(%T.loc29_6.1) [symbolic = %F.specific_fn.loc31_3.2 (constants.%F.specific_fn.ef1)]
  278. // CHECK:STDOUT: %C.Cfn.specific_fn.loc34_4.2: <specific function> = specific_function constants.%C.Cfn, @C.Cfn(%T.loc29_6.1) [symbolic = %C.Cfn.specific_fn.loc34_4.2 (constants.%C.Cfn.specific_fn.53f)]
  279. // CHECK:STDOUT:
  280. // CHECK:STDOUT: fn(%x.param: @G.%T.loc29_6.1 (%T)) -> @G.%T.loc29_6.1 (%T) {
  281. // CHECK:STDOUT: !entry:
  282. // CHECK:STDOUT: %H.ref: %H.type = name_ref H, file.%H.decl [concrete = constants.%H]
  283. // CHECK:STDOUT: %x.ref.loc30: @G.%T.loc29_6.1 (%T) = name_ref x, %x
  284. // CHECK:STDOUT: %H.specific_fn.loc30_3.1: <specific function> = specific_function %H.ref, @H(constants.%T) [symbolic = %H.specific_fn.loc30_3.2 (constants.%H.specific_fn.1ed)]
  285. // CHECK:STDOUT: %H.call: init @G.%T.loc29_6.1 (%T) = call %H.specific_fn.loc30_3.1(%x.ref.loc30)
  286. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
  287. // CHECK:STDOUT: %x.ref.loc31: @G.%T.loc29_6.1 (%T) = name_ref x, %x
  288. // CHECK:STDOUT: %F.specific_fn.loc31_3.1: <specific function> = specific_function %F.ref, @F(constants.%T) [symbolic = %F.specific_fn.loc31_3.2 (constants.%F.specific_fn.ef1)]
  289. // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn.loc31_3.1(%x.ref.loc31)
  290. // CHECK:STDOUT: name_binding_decl {
  291. // CHECK:STDOUT: %c.patt: %pattern_type.c48 = binding_pattern c [concrete]
  292. // CHECK:STDOUT: %c.var_patt: %pattern_type.c48 = var_pattern %c.patt [concrete]
  293. // CHECK:STDOUT: }
  294. // CHECK:STDOUT: %c.var: ref %C = var %c.var_patt
  295. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  296. // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var
  297. // CHECK:STDOUT: %c.ref: ref %C = name_ref c, %c
  298. // CHECK:STDOUT: %Cfn.ref: %C.Cfn.type = name_ref Cfn, @C.%C.Cfn.decl [concrete = constants.%C.Cfn]
  299. // CHECK:STDOUT: %C.Cfn.bound: <bound method> = bound_method %c.ref, %Cfn.ref
  300. // CHECK:STDOUT: %x.ref.loc34: @G.%T.loc29_6.1 (%T) = name_ref x, %x
  301. // CHECK:STDOUT: %C.Cfn.specific_fn.loc34_4.1: <specific function> = specific_function %Cfn.ref, @C.Cfn(constants.%T) [symbolic = %C.Cfn.specific_fn.loc34_4.2 (constants.%C.Cfn.specific_fn.53f)]
  302. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %c.ref, %C.Cfn.specific_fn.loc34_4.1
  303. // CHECK:STDOUT: %.loc34: %C = bind_value %c.ref
  304. // CHECK:STDOUT: %C.Cfn.call: init %empty_tuple.type = call %bound_method(%.loc34, %x.ref.loc34)
  305. // CHECK:STDOUT: %x.ref.loc35: @G.%T.loc29_6.1 (%T) = name_ref x, %x
  306. // CHECK:STDOUT: %C.as.Destroy.impl.Op.bound: <bound method> = bound_method %c.var, constants.%C.as.Destroy.impl.Op
  307. // CHECK:STDOUT: %addr: %ptr.019 = addr_of %c.var
  308. // CHECK:STDOUT: %C.as.Destroy.impl.Op.call: init %empty_tuple.type = call %C.as.Destroy.impl.Op.bound(%addr)
  309. // CHECK:STDOUT: return %x.ref.loc35
  310. // CHECK:STDOUT: }
  311. // CHECK:STDOUT: }
  312. // CHECK:STDOUT:
  313. // CHECK:STDOUT: fn @M() {
  314. // CHECK:STDOUT: !entry:
  315. // CHECK:STDOUT: name_binding_decl {
  316. // CHECK:STDOUT: %n.patt: %pattern_type.7ce = binding_pattern n [concrete]
  317. // CHECK:STDOUT: %n.var_patt: %pattern_type.7ce = var_pattern %n.patt [concrete]
  318. // CHECK:STDOUT: }
  319. // CHECK:STDOUT: %n.var: ref %i32 = var %n.var_patt
  320. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
  321. // CHECK:STDOUT: %impl.elem0: %.7ea = impl_witness_access constants.%ImplicitAs.impl_witness.acc, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.592]
  322. // CHECK:STDOUT: %bound_method.loc39_3.1: <bound method> = bound_method %int_0, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
  323. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  324. // CHECK:STDOUT: %bound_method.loc39_3.2: <bound method> = bound_method %int_0, %specific_fn [concrete = constants.%bound_method]
  325. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc39_3.2(%int_0) [concrete = constants.%int_0.6a9]
  326. // CHECK:STDOUT: %.loc39_3: init %i32 = converted %int_0, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_0.6a9]
  327. // CHECK:STDOUT: assign %n.var, %.loc39_3
  328. // CHECK:STDOUT: %.loc39_10: type = splice_block %i32.loc39 [concrete = constants.%i32] {
  329. // CHECK:STDOUT: %int_32.loc39: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  330. // CHECK:STDOUT: %i32.loc39: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  331. // CHECK:STDOUT: }
  332. // CHECK:STDOUT: %n: ref %i32 = bind_name n, %n.var
  333. // CHECK:STDOUT: name_binding_decl {
  334. // CHECK:STDOUT: %m.patt: %pattern_type.7ce = binding_pattern m [concrete]
  335. // CHECK:STDOUT: %m.var_patt: %pattern_type.7ce = var_pattern %m.patt [concrete]
  336. // CHECK:STDOUT: }
  337. // CHECK:STDOUT: %m.var: ref %i32 = var %m.var_patt
  338. // CHECK:STDOUT: %.loc40: type = splice_block %i32.loc40 [concrete = constants.%i32] {
  339. // CHECK:STDOUT: %int_32.loc40: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  340. // CHECK:STDOUT: %i32.loc40: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  341. // CHECK:STDOUT: }
  342. // CHECK:STDOUT: %m: ref %i32 = bind_name m, %m.var
  343. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
  344. // CHECK:STDOUT: %n.ref.loc42: ref %i32 = name_ref n, %n
  345. // CHECK:STDOUT: %F.specific_fn: <specific function> = specific_function %F.ref, @F(constants.%i32) [concrete = constants.%F.specific_fn.501]
  346. // CHECK:STDOUT: %.loc42: %i32 = bind_value %n.ref.loc42
  347. // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn(%.loc42)
  348. // CHECK:STDOUT: %m.ref: ref %i32 = name_ref m, %m
  349. // CHECK:STDOUT: %G.ref: %G.type = name_ref G, file.%G.decl [concrete = constants.%G]
  350. // CHECK:STDOUT: %n.ref.loc43: ref %i32 = name_ref n, %n
  351. // CHECK:STDOUT: %G.specific_fn: <specific function> = specific_function %G.ref, @G(constants.%i32) [concrete = constants.%G.specific_fn]
  352. // CHECK:STDOUT: %.loc43: %i32 = bind_value %n.ref.loc43
  353. // CHECK:STDOUT: %G.call: init %i32 = call %G.specific_fn(%.loc43)
  354. // CHECK:STDOUT: assign %m.ref, %G.call
  355. // CHECK:STDOUT: %Int.as.Destroy.impl.Op.bound.loc40: <bound method> = bound_method %m.var, constants.%Int.as.Destroy.impl.Op.054
  356. // CHECK:STDOUT: %Int.as.Destroy.impl.Op.specific_fn.1: <specific function> = specific_function constants.%Int.as.Destroy.impl.Op.054, @Int.as.Destroy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Destroy.impl.Op.specific_fn]
  357. // CHECK:STDOUT: %bound_method.loc40: <bound method> = bound_method %m.var, %Int.as.Destroy.impl.Op.specific_fn.1
  358. // CHECK:STDOUT: %addr.loc40: %ptr.235 = addr_of %m.var
  359. // CHECK:STDOUT: %Int.as.Destroy.impl.Op.call.loc40: init %empty_tuple.type = call %bound_method.loc40(%addr.loc40)
  360. // CHECK:STDOUT: %Int.as.Destroy.impl.Op.bound.loc39: <bound method> = bound_method %n.var, constants.%Int.as.Destroy.impl.Op.054
  361. // CHECK:STDOUT: %Int.as.Destroy.impl.Op.specific_fn.2: <specific function> = specific_function constants.%Int.as.Destroy.impl.Op.054, @Int.as.Destroy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Destroy.impl.Op.specific_fn]
  362. // CHECK:STDOUT: %bound_method.loc39_3.3: <bound method> = bound_method %n.var, %Int.as.Destroy.impl.Op.specific_fn.2
  363. // CHECK:STDOUT: %addr.loc39: %ptr.235 = addr_of %n.var
  364. // CHECK:STDOUT: %Int.as.Destroy.impl.Op.call.loc39: init %empty_tuple.type = call %bound_method.loc39_3.3(%addr.loc39)
  365. // CHECK:STDOUT: return
  366. // CHECK:STDOUT: }
  367. // CHECK:STDOUT:
  368. // CHECK:STDOUT: specific @C.Cfn(constants.%T) {
  369. // CHECK:STDOUT: %T.loc16_22.1 => constants.%T
  370. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.7dcd0a.1
  371. // CHECK:STDOUT:
  372. // CHECK:STDOUT: !definition:
  373. // CHECK:STDOUT: %require_complete => constants.%require_complete.4ae
  374. // CHECK:STDOUT: }
  375. // CHECK:STDOUT:
  376. // CHECK:STDOUT: specific @F(constants.%T) {
  377. // CHECK:STDOUT: %T.loc20_6.1 => constants.%T
  378. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.7dcd0a.1
  379. // CHECK:STDOUT:
  380. // CHECK:STDOUT: !definition:
  381. // CHECK:STDOUT: %require_complete => constants.%require_complete.4ae
  382. // CHECK:STDOUT: }
  383. // CHECK:STDOUT:
  384. // CHECK:STDOUT: specific @H(constants.%T) {
  385. // CHECK:STDOUT: %T.loc23_6.1 => constants.%T
  386. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.7dcd0a.1
  387. // CHECK:STDOUT:
  388. // CHECK:STDOUT: !definition:
  389. // CHECK:STDOUT: %require_complete => constants.%require_complete.4ae
  390. // CHECK:STDOUT: %F.specific_fn.loc25_3.2 => constants.%F.specific_fn.ef1
  391. // CHECK:STDOUT: }
  392. // CHECK:STDOUT:
  393. // CHECK:STDOUT: specific @G(constants.%T) {
  394. // CHECK:STDOUT: %T.loc29_6.1 => constants.%T
  395. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.7dcd0a.1
  396. // CHECK:STDOUT: }
  397. // CHECK:STDOUT:
  398. // CHECK:STDOUT: specific @F(constants.%i32) {
  399. // CHECK:STDOUT: %T.loc20_6.1 => constants.%i32
  400. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.7ce
  401. // CHECK:STDOUT:
  402. // CHECK:STDOUT: !definition:
  403. // CHECK:STDOUT: %require_complete => constants.%complete_type.f8a
  404. // CHECK:STDOUT: }
  405. // CHECK:STDOUT:
  406. // CHECK:STDOUT: specific @G(constants.%i32) {
  407. // CHECK:STDOUT: %T.loc29_6.1 => constants.%i32
  408. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.7ce
  409. // CHECK:STDOUT:
  410. // CHECK:STDOUT: !definition:
  411. // CHECK:STDOUT: %require_complete => constants.%complete_type.f8a
  412. // CHECK:STDOUT: %H.specific_fn.loc30_3.2 => constants.%H.specific_fn.aac
  413. // CHECK:STDOUT: %F.specific_fn.loc31_3.2 => constants.%F.specific_fn.501
  414. // CHECK:STDOUT: %C.Cfn.specific_fn.loc34_4.2 => constants.%C.Cfn.specific_fn.7b2
  415. // CHECK:STDOUT: }
  416. // CHECK:STDOUT:
  417. // CHECK:STDOUT: specific @H(constants.%i32) {
  418. // CHECK:STDOUT: %T.loc23_6.1 => constants.%i32
  419. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.7ce
  420. // CHECK:STDOUT:
  421. // CHECK:STDOUT: !definition:
  422. // CHECK:STDOUT: %require_complete => constants.%complete_type.f8a
  423. // CHECK:STDOUT: %F.specific_fn.loc25_3.2 => constants.%F.specific_fn.501
  424. // CHECK:STDOUT: }
  425. // CHECK:STDOUT:
  426. // CHECK:STDOUT: specific @C.Cfn(constants.%i32) {
  427. // CHECK:STDOUT: %T.loc16_22.1 => constants.%i32
  428. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.7ce
  429. // CHECK:STDOUT:
  430. // CHECK:STDOUT: !definition:
  431. // CHECK:STDOUT: %require_complete => constants.%complete_type.f8a
  432. // CHECK:STDOUT: }
  433. // CHECK:STDOUT: