call.carbon 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  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/convert.carbon
  6. //
  7. // AUTOUPDATE
  8. // TIP: To test this file alone, run:
  9. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/generic/call.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/generic/call.carbon
  12. // --- explicit.carbon
  13. library "[[@TEST_NAME]]";
  14. //@dump-sem-ir-begin
  15. fn Function(T:! Core.Copy, x: T) -> T {
  16. return x;
  17. }
  18. //@dump-sem-ir-end
  19. fn CallGeneric(T:! Core.Copy, x: T) -> T {
  20. //@dump-sem-ir-begin
  21. return Function(T, x);
  22. //@dump-sem-ir-end
  23. }
  24. fn CallGenericPtr(T:! type, x: T*) -> T* {
  25. //@dump-sem-ir-begin
  26. return Function(T*, x);
  27. //@dump-sem-ir-end
  28. }
  29. class C {}
  30. fn CallSpecific(x: C*) -> C* {
  31. //@dump-sem-ir-begin
  32. return Function(C*, x);
  33. //@dump-sem-ir-end
  34. }
  35. // --- deduced.carbon
  36. library "[[@TEST_NAME]]";
  37. //@dump-sem-ir-begin
  38. fn Function[T:! Core.Copy](x: T) -> T {
  39. return x;
  40. }
  41. //@dump-sem-ir-end
  42. fn CallGeneric(T:! Core.Copy, x: T) -> T {
  43. //@dump-sem-ir-begin
  44. return Function(x);
  45. //@dump-sem-ir-end
  46. }
  47. fn CallGenericPtr(T:! type, x: T*) -> T* {
  48. //@dump-sem-ir-begin
  49. return Function(x);
  50. //@dump-sem-ir-end
  51. }
  52. class C {}
  53. fn CallSpecific(x: C*) -> C* {
  54. //@dump-sem-ir-begin
  55. return Function(x);
  56. //@dump-sem-ir-end
  57. }
  58. // CHECK:STDOUT: --- explicit.carbon
  59. // CHECK:STDOUT:
  60. // CHECK:STDOUT: constants {
  61. // CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete]
  62. // CHECK:STDOUT: %T.be8: %Copy.type = bind_symbolic_name T, 0 [symbolic]
  63. // CHECK:STDOUT: %pattern_type.322: type = pattern_type %Copy.type [concrete]
  64. // CHECK:STDOUT: %T.as_type: type = facet_access_type %T.be8 [symbolic]
  65. // CHECK:STDOUT: %pattern_type.965801.1: type = pattern_type %T.as_type [symbolic]
  66. // CHECK:STDOUT: %Function.type: type = fn_type @Function [concrete]
  67. // CHECK:STDOUT: %Function: %Function.type = struct_value () [concrete]
  68. // CHECK:STDOUT: %require_complete.07c: <witness> = require_complete_type %T.as_type [symbolic]
  69. // CHECK:STDOUT: %Copy.Op.type: type = fn_type @Copy.Op [concrete]
  70. // CHECK:STDOUT: %Copy.lookup_impl_witness.e15: <witness> = lookup_impl_witness %T.be8, @Copy [symbolic]
  71. // CHECK:STDOUT: %Copy.facet.021: %Copy.type = facet_value %T.as_type, (%Copy.lookup_impl_witness.e15) [symbolic]
  72. // CHECK:STDOUT: %.c50: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet.021 [symbolic]
  73. // CHECK:STDOUT: %impl.elem0.792: %.c50 = impl_witness_access %Copy.lookup_impl_witness.e15, element0 [symbolic]
  74. // CHECK:STDOUT: %specific_impl_fn.547: <specific function> = specific_impl_function %impl.elem0.792, @Copy.Op(%Copy.facet.021) [symbolic]
  75. // CHECK:STDOUT: %T.8b3: type = bind_symbolic_name T, 0 [symbolic]
  76. // CHECK:STDOUT: %ptr.79f: type = ptr_type %T.8b3 [symbolic]
  77. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.type.31f: type = fn_type @ptr.as.Copy.impl.Op, @ptr.as.Copy.impl(%T.8b3) [symbolic]
  78. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.8a8: %ptr.as.Copy.impl.Op.type.31f = struct_value () [symbolic]
  79. // CHECK:STDOUT: %pattern_type.afe: type = pattern_type %ptr.79f [symbolic]
  80. // CHECK:STDOUT: %require_complete.6e5: <witness> = require_complete_type %ptr.79f [symbolic]
  81. // CHECK:STDOUT: %Function.specific_fn.8cd: <specific function> = specific_function %Function, @Function(%T.be8) [symbolic]
  82. // CHECK:STDOUT: %Copy.lookup_impl_witness.cb2: <witness> = lookup_impl_witness %ptr.79f, @Copy [symbolic]
  83. // CHECK:STDOUT: %Copy.facet.2d1: %Copy.type = facet_value %ptr.79f, (%Copy.lookup_impl_witness.cb2) [symbolic]
  84. // CHECK:STDOUT: %Function.specific_fn.d32: <specific function> = specific_function %Function, @Function(%Copy.facet.2d1) [symbolic]
  85. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  86. // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
  87. // CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete]
  88. // CHECK:STDOUT: %pattern_type.44a: type = pattern_type %ptr.019 [concrete]
  89. // CHECK:STDOUT: %Copy.impl_witness.999: <witness> = impl_witness imports.%Copy.impl_witness_table.53c, @ptr.as.Copy.impl(%C) [concrete]
  90. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.type.c3f: type = fn_type @ptr.as.Copy.impl.Op, @ptr.as.Copy.impl(%C) [concrete]
  91. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.fb8: %ptr.as.Copy.impl.Op.type.c3f = struct_value () [concrete]
  92. // CHECK:STDOUT: %complete_type.d05: <witness> = complete_type_witness %ptr.019 [concrete]
  93. // CHECK:STDOUT: %Copy.facet.9e3: %Copy.type = facet_value %ptr.019, (%Copy.impl_witness.999) [concrete]
  94. // CHECK:STDOUT: %Function.specific_fn.d9e: <specific function> = specific_function %Function, @Function(%Copy.facet.9e3) [concrete]
  95. // CHECK:STDOUT: %.1cc: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet.2d1 [symbolic]
  96. // CHECK:STDOUT: %impl.elem0.751: %.1cc = impl_witness_access %Copy.lookup_impl_witness.cb2, element0 [symbolic]
  97. // CHECK:STDOUT: %specific_impl_fn.f44: <specific function> = specific_impl_function %impl.elem0.751, @Copy.Op(%Copy.facet.2d1) [symbolic]
  98. // CHECK:STDOUT: %.7e9: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet.9e3 [concrete]
  99. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.specific_fn: <specific function> = specific_function %ptr.as.Copy.impl.Op.fb8, @ptr.as.Copy.impl.Op(%C) [concrete]
  100. // CHECK:STDOUT: }
  101. // CHECK:STDOUT:
  102. // CHECK:STDOUT: imports {
  103. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  104. // CHECK:STDOUT: .Copy = %Core.Copy
  105. // CHECK:STDOUT: .Destroy = %Core.Destroy
  106. // CHECK:STDOUT: import Core//prelude
  107. // CHECK:STDOUT: import Core//prelude/...
  108. // CHECK:STDOUT: }
  109. // CHECK:STDOUT: %Core.Copy: type = import_ref Core//prelude/parts/copy, Copy, loaded [concrete = constants.%Copy.type]
  110. // CHECK:STDOUT: %Core.import_ref.0e4: @ptr.as.Copy.impl.%ptr.as.Copy.impl.Op.type (%ptr.as.Copy.impl.Op.type.31f) = import_ref Core//prelude/parts/copy, loc36_31, loaded [symbolic = @ptr.as.Copy.impl.%ptr.as.Copy.impl.Op (constants.%ptr.as.Copy.impl.Op.8a8)]
  111. // CHECK:STDOUT: %Copy.impl_witness_table.53c = impl_witness_table (%Core.import_ref.0e4), @ptr.as.Copy.impl [concrete]
  112. // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type]
  113. // CHECK:STDOUT: }
  114. // CHECK:STDOUT:
  115. // CHECK:STDOUT: file {
  116. // CHECK:STDOUT: %Function.decl: %Function.type = fn_decl @Function [concrete = constants.%Function] {
  117. // CHECK:STDOUT: %T.patt: %pattern_type.322 = symbolic_binding_pattern T, 0 [concrete]
  118. // CHECK:STDOUT: %x.patt: @Function.%pattern_type (%pattern_type.965801.1) = binding_pattern x [concrete]
  119. // CHECK:STDOUT: %x.param_patt: @Function.%pattern_type (%pattern_type.965801.1) = value_param_pattern %x.patt, call_param0 [concrete]
  120. // CHECK:STDOUT: %return.patt: @Function.%pattern_type (%pattern_type.965801.1) = return_slot_pattern [concrete]
  121. // CHECK:STDOUT: %return.param_patt: @Function.%pattern_type (%pattern_type.965801.1) = out_param_pattern %return.patt, call_param1 [concrete]
  122. // CHECK:STDOUT: } {
  123. // CHECK:STDOUT: %T.ref.loc5_37: %Copy.type = name_ref T, %T.loc5_13.2 [symbolic = %T.loc5_13.1 (constants.%T.be8)]
  124. // CHECK:STDOUT: %T.as_type.loc5_37: type = facet_access_type %T.ref.loc5_37 [symbolic = %T.as_type.loc5_31.1 (constants.%T.as_type)]
  125. // CHECK:STDOUT: %.loc5_37: type = converted %T.ref.loc5_37, %T.as_type.loc5_37 [symbolic = %T.as_type.loc5_31.1 (constants.%T.as_type)]
  126. // CHECK:STDOUT: %.loc5_21: type = splice_block %Copy.ref [concrete = constants.%Copy.type] {
  127. // CHECK:STDOUT: <elided>
  128. // CHECK:STDOUT: %Core.ref: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
  129. // CHECK:STDOUT: %Copy.ref: type = name_ref Copy, imports.%Core.Copy [concrete = constants.%Copy.type]
  130. // CHECK:STDOUT: }
  131. // CHECK:STDOUT: %T.loc5_13.2: %Copy.type = bind_symbolic_name T, 0 [symbolic = %T.loc5_13.1 (constants.%T.be8)]
  132. // CHECK:STDOUT: %x.param: @Function.%T.as_type.loc5_31.1 (%T.as_type) = value_param call_param0
  133. // CHECK:STDOUT: %.loc5_31.1: type = splice_block %.loc5_31.2 [symbolic = %T.as_type.loc5_31.1 (constants.%T.as_type)] {
  134. // CHECK:STDOUT: %T.ref.loc5_31: %Copy.type = name_ref T, %T.loc5_13.2 [symbolic = %T.loc5_13.1 (constants.%T.be8)]
  135. // CHECK:STDOUT: %T.as_type.loc5_31.2: type = facet_access_type %T.ref.loc5_31 [symbolic = %T.as_type.loc5_31.1 (constants.%T.as_type)]
  136. // CHECK:STDOUT: %.loc5_31.2: type = converted %T.ref.loc5_31, %T.as_type.loc5_31.2 [symbolic = %T.as_type.loc5_31.1 (constants.%T.as_type)]
  137. // CHECK:STDOUT: }
  138. // CHECK:STDOUT: %x: @Function.%T.as_type.loc5_31.1 (%T.as_type) = bind_name x, %x.param
  139. // CHECK:STDOUT: %return.param: ref @Function.%T.as_type.loc5_31.1 (%T.as_type) = out_param call_param1
  140. // CHECK:STDOUT: %return: ref @Function.%T.as_type.loc5_31.1 (%T.as_type) = return_slot %return.param
  141. // CHECK:STDOUT: }
  142. // CHECK:STDOUT: }
  143. // CHECK:STDOUT:
  144. // CHECK:STDOUT: generic fn @Function(%T.loc5_13.2: %Copy.type) {
  145. // CHECK:STDOUT: %T.loc5_13.1: %Copy.type = bind_symbolic_name T, 0 [symbolic = %T.loc5_13.1 (constants.%T.be8)]
  146. // CHECK:STDOUT: %T.as_type.loc5_31.1: type = facet_access_type %T.loc5_13.1 [symbolic = %T.as_type.loc5_31.1 (constants.%T.as_type)]
  147. // CHECK:STDOUT: %pattern_type: type = pattern_type %T.as_type.loc5_31.1 [symbolic = %pattern_type (constants.%pattern_type.965801.1)]
  148. // CHECK:STDOUT:
  149. // CHECK:STDOUT: !definition:
  150. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %T.as_type.loc5_31.1 [symbolic = %require_complete (constants.%require_complete.07c)]
  151. // CHECK:STDOUT: %Copy.lookup_impl_witness: <witness> = lookup_impl_witness %T.loc5_13.1, @Copy [symbolic = %Copy.lookup_impl_witness (constants.%Copy.lookup_impl_witness.e15)]
  152. // CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %T.as_type.loc5_31.1, (%Copy.lookup_impl_witness) [symbolic = %Copy.facet (constants.%Copy.facet.021)]
  153. // CHECK:STDOUT: %.loc6_10.2: type = fn_type_with_self_type constants.%Copy.Op.type, %Copy.facet [symbolic = %.loc6_10.2 (constants.%.c50)]
  154. // CHECK:STDOUT: %impl.elem0.loc6_10.2: @Function.%.loc6_10.2 (%.c50) = impl_witness_access %Copy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc6_10.2 (constants.%impl.elem0.792)]
  155. // CHECK:STDOUT: %specific_impl_fn.loc6_10.2: <specific function> = specific_impl_function %impl.elem0.loc6_10.2, @Copy.Op(%Copy.facet) [symbolic = %specific_impl_fn.loc6_10.2 (constants.%specific_impl_fn.547)]
  156. // CHECK:STDOUT:
  157. // CHECK:STDOUT: fn(%x.param: @Function.%T.as_type.loc5_31.1 (%T.as_type)) -> %return.param: @Function.%T.as_type.loc5_31.1 (%T.as_type) {
  158. // CHECK:STDOUT: !entry:
  159. // CHECK:STDOUT: %x.ref: @Function.%T.as_type.loc5_31.1 (%T.as_type) = name_ref x, %x
  160. // CHECK:STDOUT: %impl.elem0.loc6_10.1: @Function.%.loc6_10.2 (%.c50) = impl_witness_access constants.%Copy.lookup_impl_witness.e15, element0 [symbolic = %impl.elem0.loc6_10.2 (constants.%impl.elem0.792)]
  161. // CHECK:STDOUT: %bound_method.loc6_10.1: <bound method> = bound_method %x.ref, %impl.elem0.loc6_10.1
  162. // CHECK:STDOUT: %specific_impl_fn.loc6_10.1: <specific function> = specific_impl_function %impl.elem0.loc6_10.1, @Copy.Op(constants.%Copy.facet.021) [symbolic = %specific_impl_fn.loc6_10.2 (constants.%specific_impl_fn.547)]
  163. // CHECK:STDOUT: %bound_method.loc6_10.2: <bound method> = bound_method %x.ref, %specific_impl_fn.loc6_10.1
  164. // CHECK:STDOUT: %.loc5_34: ref @Function.%T.as_type.loc5_31.1 (%T.as_type) = splice_block %return {}
  165. // CHECK:STDOUT: %.loc6_10.1: init @Function.%T.as_type.loc5_31.1 (%T.as_type) = call %bound_method.loc6_10.2(%x.ref) to %.loc5_34
  166. // CHECK:STDOUT: return %.loc6_10.1 to %return
  167. // CHECK:STDOUT: }
  168. // CHECK:STDOUT: }
  169. // CHECK:STDOUT:
  170. // CHECK:STDOUT: generic fn @CallGeneric(%T.loc10_16.2: %Copy.type) {
  171. // CHECK:STDOUT: <elided>
  172. // CHECK:STDOUT:
  173. // CHECK:STDOUT: !definition:
  174. // CHECK:STDOUT: <elided>
  175. // CHECK:STDOUT: %Function.specific_fn.loc12_10.2: <specific function> = specific_function constants.%Function, @Function(%T.loc10_16.1) [symbolic = %Function.specific_fn.loc12_10.2 (constants.%Function.specific_fn.8cd)]
  176. // CHECK:STDOUT:
  177. // CHECK:STDOUT: fn(%x.param: @CallGeneric.%T.as_type.loc10_34.1 (%T.as_type)) -> %return.param: @CallGeneric.%T.as_type.loc10_34.1 (%T.as_type) {
  178. // CHECK:STDOUT: !entry:
  179. // CHECK:STDOUT: %Function.ref: %Function.type = name_ref Function, file.%Function.decl [concrete = constants.%Function]
  180. // CHECK:STDOUT: %T.ref.loc12: %Copy.type = name_ref T, %T.loc10_16.2 [symbolic = %T.loc10_16.1 (constants.%T.be8)]
  181. // CHECK:STDOUT: %x.ref: @CallGeneric.%T.as_type.loc10_34.1 (%T.as_type) = name_ref x, %x
  182. // CHECK:STDOUT: %.loc12_23.1: %Copy.type = converted constants.%T.as_type, constants.%T.be8 [symbolic = %T.loc10_16.1 (constants.%T.be8)]
  183. // CHECK:STDOUT: %.loc12_23.2: %Copy.type = converted constants.%T.as_type, constants.%T.be8 [symbolic = %T.loc10_16.1 (constants.%T.be8)]
  184. // CHECK:STDOUT: %Function.specific_fn.loc12_10.1: <specific function> = specific_function %Function.ref, @Function(constants.%T.be8) [symbolic = %Function.specific_fn.loc12_10.2 (constants.%Function.specific_fn.8cd)]
  185. // CHECK:STDOUT: <elided>
  186. // CHECK:STDOUT: %Function.call: init @CallGeneric.%T.as_type.loc10_34.1 (%T.as_type) = call %Function.specific_fn.loc12_10.1(%x.ref) to %.loc10_37
  187. // CHECK:STDOUT: return %Function.call to %return
  188. // CHECK:STDOUT: }
  189. // CHECK:STDOUT: }
  190. // CHECK:STDOUT:
  191. // CHECK:STDOUT: generic fn @CallGenericPtr(%T.loc16_19.2: type) {
  192. // CHECK:STDOUT: <elided>
  193. // CHECK:STDOUT:
  194. // CHECK:STDOUT: !definition:
  195. // CHECK:STDOUT: <elided>
  196. // CHECK:STDOUT: %Copy.lookup_impl_witness: <witness> = lookup_impl_witness %ptr.loc16_33.1, @Copy [symbolic = %Copy.lookup_impl_witness (constants.%Copy.lookup_impl_witness.cb2)]
  197. // CHECK:STDOUT: %Copy.facet.loc18_24.4: %Copy.type = facet_value %ptr.loc16_33.1, (%Copy.lookup_impl_witness) [symbolic = %Copy.facet.loc18_24.4 (constants.%Copy.facet.2d1)]
  198. // CHECK:STDOUT: %Function.specific_fn.loc18_10.2: <specific function> = specific_function constants.%Function, @Function(%Copy.facet.loc18_24.4) [symbolic = %Function.specific_fn.loc18_10.2 (constants.%Function.specific_fn.d32)]
  199. // CHECK:STDOUT:
  200. // CHECK:STDOUT: fn(%x.param: @CallGenericPtr.%ptr.loc16_33.1 (%ptr.79f)) -> @CallGenericPtr.%ptr.loc16_33.1 (%ptr.79f) {
  201. // CHECK:STDOUT: !entry:
  202. // CHECK:STDOUT: %Function.ref: %Function.type = name_ref Function, file.%Function.decl [concrete = constants.%Function]
  203. // CHECK:STDOUT: %T.ref.loc18: type = name_ref T, %T.loc16_19.2 [symbolic = %T.loc16_19.1 (constants.%T.8b3)]
  204. // CHECK:STDOUT: %ptr.loc18: type = ptr_type %T.ref.loc18 [symbolic = %ptr.loc16_33.1 (constants.%ptr.79f)]
  205. // CHECK:STDOUT: %x.ref: @CallGenericPtr.%ptr.loc16_33.1 (%ptr.79f) = name_ref x, %x
  206. // CHECK:STDOUT: %Copy.facet.loc18_24.1: %Copy.type = facet_value constants.%ptr.79f, (constants.%Copy.lookup_impl_witness.cb2) [symbolic = %Copy.facet.loc18_24.4 (constants.%Copy.facet.2d1)]
  207. // CHECK:STDOUT: %.loc18_24.1: %Copy.type = converted %ptr.loc18, %Copy.facet.loc18_24.1 [symbolic = %Copy.facet.loc18_24.4 (constants.%Copy.facet.2d1)]
  208. // CHECK:STDOUT: %Copy.facet.loc18_24.2: %Copy.type = facet_value constants.%ptr.79f, (constants.%Copy.lookup_impl_witness.cb2) [symbolic = %Copy.facet.loc18_24.4 (constants.%Copy.facet.2d1)]
  209. // CHECK:STDOUT: %.loc18_24.2: %Copy.type = converted constants.%ptr.79f, %Copy.facet.loc18_24.2 [symbolic = %Copy.facet.loc18_24.4 (constants.%Copy.facet.2d1)]
  210. // CHECK:STDOUT: %Copy.facet.loc18_24.3: %Copy.type = facet_value constants.%ptr.79f, (constants.%Copy.lookup_impl_witness.cb2) [symbolic = %Copy.facet.loc18_24.4 (constants.%Copy.facet.2d1)]
  211. // CHECK:STDOUT: %.loc18_24.3: %Copy.type = converted constants.%ptr.79f, %Copy.facet.loc18_24.3 [symbolic = %Copy.facet.loc18_24.4 (constants.%Copy.facet.2d1)]
  212. // CHECK:STDOUT: %Function.specific_fn.loc18_10.1: <specific function> = specific_function %Function.ref, @Function(constants.%Copy.facet.2d1) [symbolic = %Function.specific_fn.loc18_10.2 (constants.%Function.specific_fn.d32)]
  213. // CHECK:STDOUT: %Function.call: init @CallGenericPtr.%ptr.loc16_33.1 (%ptr.79f) = call %Function.specific_fn.loc18_10.1(%x.ref)
  214. // CHECK:STDOUT: return %Function.call to %return
  215. // CHECK:STDOUT: }
  216. // CHECK:STDOUT: }
  217. // CHECK:STDOUT:
  218. // CHECK:STDOUT: fn @CallSpecific(%x.param: %ptr.019) -> %ptr.019 {
  219. // CHECK:STDOUT: !entry:
  220. // CHECK:STDOUT: %Function.ref: %Function.type = name_ref Function, file.%Function.decl [concrete = constants.%Function]
  221. // CHECK:STDOUT: %C.ref.loc26: type = name_ref C, file.%C.decl [concrete = constants.%C]
  222. // CHECK:STDOUT: %ptr.loc26: type = ptr_type %C.ref.loc26 [concrete = constants.%ptr.019]
  223. // CHECK:STDOUT: %x.ref: %ptr.019 = name_ref x, %x
  224. // CHECK:STDOUT: %Copy.facet.loc26_24.1: %Copy.type = facet_value constants.%ptr.019, (constants.%Copy.impl_witness.999) [concrete = constants.%Copy.facet.9e3]
  225. // CHECK:STDOUT: %.loc26_24.1: %Copy.type = converted %ptr.loc26, %Copy.facet.loc26_24.1 [concrete = constants.%Copy.facet.9e3]
  226. // CHECK:STDOUT: %Copy.facet.loc26_24.2: %Copy.type = facet_value constants.%ptr.019, (constants.%Copy.impl_witness.999) [concrete = constants.%Copy.facet.9e3]
  227. // CHECK:STDOUT: %.loc26_24.2: %Copy.type = converted constants.%ptr.019, %Copy.facet.loc26_24.2 [concrete = constants.%Copy.facet.9e3]
  228. // CHECK:STDOUT: %Copy.facet.loc26_24.3: %Copy.type = facet_value constants.%ptr.019, (constants.%Copy.impl_witness.999) [concrete = constants.%Copy.facet.9e3]
  229. // CHECK:STDOUT: %.loc26_24.3: %Copy.type = converted constants.%ptr.019, %Copy.facet.loc26_24.3 [concrete = constants.%Copy.facet.9e3]
  230. // CHECK:STDOUT: %Function.specific_fn: <specific function> = specific_function %Function.ref, @Function(constants.%Copy.facet.9e3) [concrete = constants.%Function.specific_fn.d9e]
  231. // CHECK:STDOUT: %Function.call: init %ptr.019 = call %Function.specific_fn(%x.ref)
  232. // CHECK:STDOUT: return %Function.call to %return
  233. // CHECK:STDOUT: }
  234. // CHECK:STDOUT:
  235. // CHECK:STDOUT: specific @Function(constants.%T.be8) {
  236. // CHECK:STDOUT: %T.loc5_13.1 => constants.%T.be8
  237. // CHECK:STDOUT: %T.as_type.loc5_31.1 => constants.%T.as_type
  238. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.965801.1
  239. // CHECK:STDOUT:
  240. // CHECK:STDOUT: !definition:
  241. // CHECK:STDOUT: %require_complete => constants.%require_complete.07c
  242. // CHECK:STDOUT: %Copy.lookup_impl_witness => constants.%Copy.lookup_impl_witness.e15
  243. // CHECK:STDOUT: %Copy.facet => constants.%Copy.facet.021
  244. // CHECK:STDOUT: %.loc6_10.2 => constants.%.c50
  245. // CHECK:STDOUT: %impl.elem0.loc6_10.2 => constants.%impl.elem0.792
  246. // CHECK:STDOUT: %specific_impl_fn.loc6_10.2 => constants.%specific_impl_fn.547
  247. // CHECK:STDOUT: }
  248. // CHECK:STDOUT:
  249. // CHECK:STDOUT: specific @CallGeneric(constants.%T.be8) {
  250. // CHECK:STDOUT: %T.loc10_16.1 => constants.%T.be8
  251. // CHECK:STDOUT: %T.as_type.loc10_34.1 => constants.%T.as_type
  252. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.965801.1
  253. // CHECK:STDOUT: }
  254. // CHECK:STDOUT:
  255. // CHECK:STDOUT: specific @CallGenericPtr(constants.%T.8b3) {
  256. // CHECK:STDOUT: %T.loc16_19.1 => constants.%T.8b3
  257. // CHECK:STDOUT: %ptr.loc16_33.1 => constants.%ptr.79f
  258. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.afe
  259. // CHECK:STDOUT: }
  260. // CHECK:STDOUT:
  261. // CHECK:STDOUT: specific @Function(constants.%Copy.facet.2d1) {
  262. // CHECK:STDOUT: %T.loc5_13.1 => constants.%Copy.facet.2d1
  263. // CHECK:STDOUT: %T.as_type.loc5_31.1 => constants.%ptr.79f
  264. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.afe
  265. // CHECK:STDOUT:
  266. // CHECK:STDOUT: !definition:
  267. // CHECK:STDOUT: %require_complete => constants.%require_complete.6e5
  268. // CHECK:STDOUT: %Copy.lookup_impl_witness => constants.%Copy.lookup_impl_witness.cb2
  269. // CHECK:STDOUT: %Copy.facet => constants.%Copy.facet.2d1
  270. // CHECK:STDOUT: %.loc6_10.2 => constants.%.1cc
  271. // CHECK:STDOUT: %impl.elem0.loc6_10.2 => constants.%impl.elem0.751
  272. // CHECK:STDOUT: %specific_impl_fn.loc6_10.2 => constants.%specific_impl_fn.f44
  273. // CHECK:STDOUT: }
  274. // CHECK:STDOUT:
  275. // CHECK:STDOUT: specific @Function(constants.%Copy.facet.9e3) {
  276. // CHECK:STDOUT: %T.loc5_13.1 => constants.%Copy.facet.9e3
  277. // CHECK:STDOUT: %T.as_type.loc5_31.1 => constants.%ptr.019
  278. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.44a
  279. // CHECK:STDOUT:
  280. // CHECK:STDOUT: !definition:
  281. // CHECK:STDOUT: %require_complete => constants.%complete_type.d05
  282. // CHECK:STDOUT: %Copy.lookup_impl_witness => constants.%Copy.impl_witness.999
  283. // CHECK:STDOUT: %Copy.facet => constants.%Copy.facet.9e3
  284. // CHECK:STDOUT: %.loc6_10.2 => constants.%.7e9
  285. // CHECK:STDOUT: %impl.elem0.loc6_10.2 => constants.%ptr.as.Copy.impl.Op.fb8
  286. // CHECK:STDOUT: %specific_impl_fn.loc6_10.2 => constants.%ptr.as.Copy.impl.Op.specific_fn
  287. // CHECK:STDOUT: }
  288. // CHECK:STDOUT:
  289. // CHECK:STDOUT: --- deduced.carbon
  290. // CHECK:STDOUT:
  291. // CHECK:STDOUT: constants {
  292. // CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete]
  293. // CHECK:STDOUT: %T.be8: %Copy.type = bind_symbolic_name T, 0 [symbolic]
  294. // CHECK:STDOUT: %pattern_type.322: type = pattern_type %Copy.type [concrete]
  295. // CHECK:STDOUT: %T.as_type: type = facet_access_type %T.be8 [symbolic]
  296. // CHECK:STDOUT: %pattern_type.965801.1: type = pattern_type %T.as_type [symbolic]
  297. // CHECK:STDOUT: %Function.type: type = fn_type @Function [concrete]
  298. // CHECK:STDOUT: %Function: %Function.type = struct_value () [concrete]
  299. // CHECK:STDOUT: %require_complete.07c: <witness> = require_complete_type %T.as_type [symbolic]
  300. // CHECK:STDOUT: %Copy.Op.type: type = fn_type @Copy.Op [concrete]
  301. // CHECK:STDOUT: %Copy.lookup_impl_witness.e15: <witness> = lookup_impl_witness %T.be8, @Copy [symbolic]
  302. // CHECK:STDOUT: %Copy.facet.021: %Copy.type = facet_value %T.as_type, (%Copy.lookup_impl_witness.e15) [symbolic]
  303. // CHECK:STDOUT: %.c50: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet.021 [symbolic]
  304. // CHECK:STDOUT: %impl.elem0.792: %.c50 = impl_witness_access %Copy.lookup_impl_witness.e15, element0 [symbolic]
  305. // CHECK:STDOUT: %specific_impl_fn.547: <specific function> = specific_impl_function %impl.elem0.792, @Copy.Op(%Copy.facet.021) [symbolic]
  306. // CHECK:STDOUT: %T.8b3: type = bind_symbolic_name T, 0 [symbolic]
  307. // CHECK:STDOUT: %ptr.79f: type = ptr_type %T.8b3 [symbolic]
  308. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.type.31f: type = fn_type @ptr.as.Copy.impl.Op, @ptr.as.Copy.impl(%T.8b3) [symbolic]
  309. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.8a8: %ptr.as.Copy.impl.Op.type.31f = struct_value () [symbolic]
  310. // CHECK:STDOUT: %pattern_type.afe: type = pattern_type %ptr.79f [symbolic]
  311. // CHECK:STDOUT: %require_complete.6e5: <witness> = require_complete_type %ptr.79f [symbolic]
  312. // CHECK:STDOUT: %Function.specific_fn.8cd: <specific function> = specific_function %Function, @Function(%T.be8) [symbolic]
  313. // CHECK:STDOUT: %Copy.lookup_impl_witness.cb2: <witness> = lookup_impl_witness %ptr.79f, @Copy [symbolic]
  314. // CHECK:STDOUT: %Copy.facet.2d1: %Copy.type = facet_value %ptr.79f, (%Copy.lookup_impl_witness.cb2) [symbolic]
  315. // CHECK:STDOUT: %Function.specific_fn.d32: <specific function> = specific_function %Function, @Function(%Copy.facet.2d1) [symbolic]
  316. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  317. // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
  318. // CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete]
  319. // CHECK:STDOUT: %pattern_type.44a: type = pattern_type %ptr.019 [concrete]
  320. // CHECK:STDOUT: %Copy.impl_witness.999: <witness> = impl_witness imports.%Copy.impl_witness_table.53c, @ptr.as.Copy.impl(%C) [concrete]
  321. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.type.c3f: type = fn_type @ptr.as.Copy.impl.Op, @ptr.as.Copy.impl(%C) [concrete]
  322. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.fb8: %ptr.as.Copy.impl.Op.type.c3f = struct_value () [concrete]
  323. // CHECK:STDOUT: %complete_type.d05: <witness> = complete_type_witness %ptr.019 [concrete]
  324. // CHECK:STDOUT: %Copy.facet.9e3: %Copy.type = facet_value %ptr.019, (%Copy.impl_witness.999) [concrete]
  325. // CHECK:STDOUT: %Function.specific_fn.d9e: <specific function> = specific_function %Function, @Function(%Copy.facet.9e3) [concrete]
  326. // CHECK:STDOUT: %.1cc: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet.2d1 [symbolic]
  327. // CHECK:STDOUT: %impl.elem0.751: %.1cc = impl_witness_access %Copy.lookup_impl_witness.cb2, element0 [symbolic]
  328. // CHECK:STDOUT: %specific_impl_fn.f44: <specific function> = specific_impl_function %impl.elem0.751, @Copy.Op(%Copy.facet.2d1) [symbolic]
  329. // CHECK:STDOUT: %.7e9: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet.9e3 [concrete]
  330. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.specific_fn: <specific function> = specific_function %ptr.as.Copy.impl.Op.fb8, @ptr.as.Copy.impl.Op(%C) [concrete]
  331. // CHECK:STDOUT: }
  332. // CHECK:STDOUT:
  333. // CHECK:STDOUT: imports {
  334. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  335. // CHECK:STDOUT: .Copy = %Core.Copy
  336. // CHECK:STDOUT: .Destroy = %Core.Destroy
  337. // CHECK:STDOUT: import Core//prelude
  338. // CHECK:STDOUT: import Core//prelude/...
  339. // CHECK:STDOUT: }
  340. // CHECK:STDOUT: %Core.Copy: type = import_ref Core//prelude/parts/copy, Copy, loaded [concrete = constants.%Copy.type]
  341. // CHECK:STDOUT: %Core.import_ref.0e4: @ptr.as.Copy.impl.%ptr.as.Copy.impl.Op.type (%ptr.as.Copy.impl.Op.type.31f) = import_ref Core//prelude/parts/copy, loc36_31, loaded [symbolic = @ptr.as.Copy.impl.%ptr.as.Copy.impl.Op (constants.%ptr.as.Copy.impl.Op.8a8)]
  342. // CHECK:STDOUT: %Copy.impl_witness_table.53c = impl_witness_table (%Core.import_ref.0e4), @ptr.as.Copy.impl [concrete]
  343. // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type]
  344. // CHECK:STDOUT: }
  345. // CHECK:STDOUT:
  346. // CHECK:STDOUT: file {
  347. // CHECK:STDOUT: %Function.decl: %Function.type = fn_decl @Function [concrete = constants.%Function] {
  348. // CHECK:STDOUT: %T.patt: %pattern_type.322 = symbolic_binding_pattern T, 0 [concrete]
  349. // CHECK:STDOUT: %x.patt: @Function.%pattern_type (%pattern_type.965801.1) = binding_pattern x [concrete]
  350. // CHECK:STDOUT: %x.param_patt: @Function.%pattern_type (%pattern_type.965801.1) = value_param_pattern %x.patt, call_param0 [concrete]
  351. // CHECK:STDOUT: %return.patt: @Function.%pattern_type (%pattern_type.965801.1) = return_slot_pattern [concrete]
  352. // CHECK:STDOUT: %return.param_patt: @Function.%pattern_type (%pattern_type.965801.1) = out_param_pattern %return.patt, call_param1 [concrete]
  353. // CHECK:STDOUT: } {
  354. // CHECK:STDOUT: %T.ref.loc5_37: %Copy.type = name_ref T, %T.loc5_13.2 [symbolic = %T.loc5_13.1 (constants.%T.be8)]
  355. // CHECK:STDOUT: %T.as_type.loc5_37: type = facet_access_type %T.ref.loc5_37 [symbolic = %T.as_type.loc5_31.1 (constants.%T.as_type)]
  356. // CHECK:STDOUT: %.loc5_37: type = converted %T.ref.loc5_37, %T.as_type.loc5_37 [symbolic = %T.as_type.loc5_31.1 (constants.%T.as_type)]
  357. // CHECK:STDOUT: %.loc5_21: type = splice_block %Copy.ref [concrete = constants.%Copy.type] {
  358. // CHECK:STDOUT: <elided>
  359. // CHECK:STDOUT: %Core.ref: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
  360. // CHECK:STDOUT: %Copy.ref: type = name_ref Copy, imports.%Core.Copy [concrete = constants.%Copy.type]
  361. // CHECK:STDOUT: }
  362. // CHECK:STDOUT: %T.loc5_13.2: %Copy.type = bind_symbolic_name T, 0 [symbolic = %T.loc5_13.1 (constants.%T.be8)]
  363. // CHECK:STDOUT: %x.param: @Function.%T.as_type.loc5_31.1 (%T.as_type) = value_param call_param0
  364. // CHECK:STDOUT: %.loc5_31.1: type = splice_block %.loc5_31.2 [symbolic = %T.as_type.loc5_31.1 (constants.%T.as_type)] {
  365. // CHECK:STDOUT: %T.ref.loc5_31: %Copy.type = name_ref T, %T.loc5_13.2 [symbolic = %T.loc5_13.1 (constants.%T.be8)]
  366. // CHECK:STDOUT: %T.as_type.loc5_31.2: type = facet_access_type %T.ref.loc5_31 [symbolic = %T.as_type.loc5_31.1 (constants.%T.as_type)]
  367. // CHECK:STDOUT: %.loc5_31.2: type = converted %T.ref.loc5_31, %T.as_type.loc5_31.2 [symbolic = %T.as_type.loc5_31.1 (constants.%T.as_type)]
  368. // CHECK:STDOUT: }
  369. // CHECK:STDOUT: %x: @Function.%T.as_type.loc5_31.1 (%T.as_type) = bind_name x, %x.param
  370. // CHECK:STDOUT: %return.param: ref @Function.%T.as_type.loc5_31.1 (%T.as_type) = out_param call_param1
  371. // CHECK:STDOUT: %return: ref @Function.%T.as_type.loc5_31.1 (%T.as_type) = return_slot %return.param
  372. // CHECK:STDOUT: }
  373. // CHECK:STDOUT: }
  374. // CHECK:STDOUT:
  375. // CHECK:STDOUT: generic fn @Function(%T.loc5_13.2: %Copy.type) {
  376. // CHECK:STDOUT: %T.loc5_13.1: %Copy.type = bind_symbolic_name T, 0 [symbolic = %T.loc5_13.1 (constants.%T.be8)]
  377. // CHECK:STDOUT: %T.as_type.loc5_31.1: type = facet_access_type %T.loc5_13.1 [symbolic = %T.as_type.loc5_31.1 (constants.%T.as_type)]
  378. // CHECK:STDOUT: %pattern_type: type = pattern_type %T.as_type.loc5_31.1 [symbolic = %pattern_type (constants.%pattern_type.965801.1)]
  379. // CHECK:STDOUT:
  380. // CHECK:STDOUT: !definition:
  381. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %T.as_type.loc5_31.1 [symbolic = %require_complete (constants.%require_complete.07c)]
  382. // CHECK:STDOUT: %Copy.lookup_impl_witness: <witness> = lookup_impl_witness %T.loc5_13.1, @Copy [symbolic = %Copy.lookup_impl_witness (constants.%Copy.lookup_impl_witness.e15)]
  383. // CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %T.as_type.loc5_31.1, (%Copy.lookup_impl_witness) [symbolic = %Copy.facet (constants.%Copy.facet.021)]
  384. // CHECK:STDOUT: %.loc6_10.2: type = fn_type_with_self_type constants.%Copy.Op.type, %Copy.facet [symbolic = %.loc6_10.2 (constants.%.c50)]
  385. // CHECK:STDOUT: %impl.elem0.loc6_10.2: @Function.%.loc6_10.2 (%.c50) = impl_witness_access %Copy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc6_10.2 (constants.%impl.elem0.792)]
  386. // CHECK:STDOUT: %specific_impl_fn.loc6_10.2: <specific function> = specific_impl_function %impl.elem0.loc6_10.2, @Copy.Op(%Copy.facet) [symbolic = %specific_impl_fn.loc6_10.2 (constants.%specific_impl_fn.547)]
  387. // CHECK:STDOUT:
  388. // CHECK:STDOUT: fn(%x.param: @Function.%T.as_type.loc5_31.1 (%T.as_type)) -> %return.param: @Function.%T.as_type.loc5_31.1 (%T.as_type) {
  389. // CHECK:STDOUT: !entry:
  390. // CHECK:STDOUT: %x.ref: @Function.%T.as_type.loc5_31.1 (%T.as_type) = name_ref x, %x
  391. // CHECK:STDOUT: %impl.elem0.loc6_10.1: @Function.%.loc6_10.2 (%.c50) = impl_witness_access constants.%Copy.lookup_impl_witness.e15, element0 [symbolic = %impl.elem0.loc6_10.2 (constants.%impl.elem0.792)]
  392. // CHECK:STDOUT: %bound_method.loc6_10.1: <bound method> = bound_method %x.ref, %impl.elem0.loc6_10.1
  393. // CHECK:STDOUT: %specific_impl_fn.loc6_10.1: <specific function> = specific_impl_function %impl.elem0.loc6_10.1, @Copy.Op(constants.%Copy.facet.021) [symbolic = %specific_impl_fn.loc6_10.2 (constants.%specific_impl_fn.547)]
  394. // CHECK:STDOUT: %bound_method.loc6_10.2: <bound method> = bound_method %x.ref, %specific_impl_fn.loc6_10.1
  395. // CHECK:STDOUT: %.loc5_34: ref @Function.%T.as_type.loc5_31.1 (%T.as_type) = splice_block %return {}
  396. // CHECK:STDOUT: %.loc6_10.1: init @Function.%T.as_type.loc5_31.1 (%T.as_type) = call %bound_method.loc6_10.2(%x.ref) to %.loc5_34
  397. // CHECK:STDOUT: return %.loc6_10.1 to %return
  398. // CHECK:STDOUT: }
  399. // CHECK:STDOUT: }
  400. // CHECK:STDOUT:
  401. // CHECK:STDOUT: generic fn @CallGeneric(%T.loc10_16.2: %Copy.type) {
  402. // CHECK:STDOUT: <elided>
  403. // CHECK:STDOUT:
  404. // CHECK:STDOUT: !definition:
  405. // CHECK:STDOUT: <elided>
  406. // CHECK:STDOUT: %Function.specific_fn.loc12_10.2: <specific function> = specific_function constants.%Function, @Function(%T.loc10_16.1) [symbolic = %Function.specific_fn.loc12_10.2 (constants.%Function.specific_fn.8cd)]
  407. // CHECK:STDOUT:
  408. // CHECK:STDOUT: fn(%x.param: @CallGeneric.%T.as_type.loc10_34.1 (%T.as_type)) -> %return.param: @CallGeneric.%T.as_type.loc10_34.1 (%T.as_type) {
  409. // CHECK:STDOUT: !entry:
  410. // CHECK:STDOUT: %Function.ref: %Function.type = name_ref Function, file.%Function.decl [concrete = constants.%Function]
  411. // CHECK:STDOUT: %x.ref: @CallGeneric.%T.as_type.loc10_34.1 (%T.as_type) = name_ref x, %x
  412. // CHECK:STDOUT: %.loc12_20.1: %Copy.type = converted constants.%T.as_type, constants.%T.be8 [symbolic = %T.loc10_16.1 (constants.%T.be8)]
  413. // CHECK:STDOUT: %.loc12_20.2: %Copy.type = converted constants.%T.as_type, constants.%T.be8 [symbolic = %T.loc10_16.1 (constants.%T.be8)]
  414. // CHECK:STDOUT: %Function.specific_fn.loc12_10.1: <specific function> = specific_function %Function.ref, @Function(constants.%T.be8) [symbolic = %Function.specific_fn.loc12_10.2 (constants.%Function.specific_fn.8cd)]
  415. // CHECK:STDOUT: <elided>
  416. // CHECK:STDOUT: %Function.call: init @CallGeneric.%T.as_type.loc10_34.1 (%T.as_type) = call %Function.specific_fn.loc12_10.1(%x.ref) to %.loc10_37
  417. // CHECK:STDOUT: return %Function.call to %return
  418. // CHECK:STDOUT: }
  419. // CHECK:STDOUT: }
  420. // CHECK:STDOUT:
  421. // CHECK:STDOUT: generic fn @CallGenericPtr(%T.loc16_19.2: type) {
  422. // CHECK:STDOUT: <elided>
  423. // CHECK:STDOUT:
  424. // CHECK:STDOUT: !definition:
  425. // CHECK:STDOUT: <elided>
  426. // CHECK:STDOUT: %Copy.lookup_impl_witness: <witness> = lookup_impl_witness %ptr.loc16_33.1, @Copy [symbolic = %Copy.lookup_impl_witness (constants.%Copy.lookup_impl_witness.cb2)]
  427. // CHECK:STDOUT: %Copy.facet.loc18_20.3: %Copy.type = facet_value %ptr.loc16_33.1, (%Copy.lookup_impl_witness) [symbolic = %Copy.facet.loc18_20.3 (constants.%Copy.facet.2d1)]
  428. // CHECK:STDOUT: %Function.specific_fn.loc18_10.2: <specific function> = specific_function constants.%Function, @Function(%Copy.facet.loc18_20.3) [symbolic = %Function.specific_fn.loc18_10.2 (constants.%Function.specific_fn.d32)]
  429. // CHECK:STDOUT:
  430. // CHECK:STDOUT: fn(%x.param: @CallGenericPtr.%ptr.loc16_33.1 (%ptr.79f)) -> @CallGenericPtr.%ptr.loc16_33.1 (%ptr.79f) {
  431. // CHECK:STDOUT: !entry:
  432. // CHECK:STDOUT: %Function.ref: %Function.type = name_ref Function, file.%Function.decl [concrete = constants.%Function]
  433. // CHECK:STDOUT: %x.ref: @CallGenericPtr.%ptr.loc16_33.1 (%ptr.79f) = name_ref x, %x
  434. // CHECK:STDOUT: %Copy.facet.loc18_20.1: %Copy.type = facet_value constants.%ptr.79f, (constants.%Copy.lookup_impl_witness.cb2) [symbolic = %Copy.facet.loc18_20.3 (constants.%Copy.facet.2d1)]
  435. // CHECK:STDOUT: %.loc18_20.1: %Copy.type = converted constants.%ptr.79f, %Copy.facet.loc18_20.1 [symbolic = %Copy.facet.loc18_20.3 (constants.%Copy.facet.2d1)]
  436. // CHECK:STDOUT: %Copy.facet.loc18_20.2: %Copy.type = facet_value constants.%ptr.79f, (constants.%Copy.lookup_impl_witness.cb2) [symbolic = %Copy.facet.loc18_20.3 (constants.%Copy.facet.2d1)]
  437. // CHECK:STDOUT: %.loc18_20.2: %Copy.type = converted constants.%ptr.79f, %Copy.facet.loc18_20.2 [symbolic = %Copy.facet.loc18_20.3 (constants.%Copy.facet.2d1)]
  438. // CHECK:STDOUT: %Function.specific_fn.loc18_10.1: <specific function> = specific_function %Function.ref, @Function(constants.%Copy.facet.2d1) [symbolic = %Function.specific_fn.loc18_10.2 (constants.%Function.specific_fn.d32)]
  439. // CHECK:STDOUT: %Function.call: init @CallGenericPtr.%ptr.loc16_33.1 (%ptr.79f) = call %Function.specific_fn.loc18_10.1(%x.ref)
  440. // CHECK:STDOUT: return %Function.call to %return
  441. // CHECK:STDOUT: }
  442. // CHECK:STDOUT: }
  443. // CHECK:STDOUT:
  444. // CHECK:STDOUT: fn @CallSpecific(%x.param: %ptr.019) -> %ptr.019 {
  445. // CHECK:STDOUT: !entry:
  446. // CHECK:STDOUT: %Function.ref: %Function.type = name_ref Function, file.%Function.decl [concrete = constants.%Function]
  447. // CHECK:STDOUT: %x.ref: %ptr.019 = name_ref x, %x
  448. // CHECK:STDOUT: %Copy.facet.loc26_20.1: %Copy.type = facet_value constants.%ptr.019, (constants.%Copy.impl_witness.999) [concrete = constants.%Copy.facet.9e3]
  449. // CHECK:STDOUT: %.loc26_20.1: %Copy.type = converted constants.%ptr.019, %Copy.facet.loc26_20.1 [concrete = constants.%Copy.facet.9e3]
  450. // CHECK:STDOUT: %Copy.facet.loc26_20.2: %Copy.type = facet_value constants.%ptr.019, (constants.%Copy.impl_witness.999) [concrete = constants.%Copy.facet.9e3]
  451. // CHECK:STDOUT: %.loc26_20.2: %Copy.type = converted constants.%ptr.019, %Copy.facet.loc26_20.2 [concrete = constants.%Copy.facet.9e3]
  452. // CHECK:STDOUT: %Function.specific_fn: <specific function> = specific_function %Function.ref, @Function(constants.%Copy.facet.9e3) [concrete = constants.%Function.specific_fn.d9e]
  453. // CHECK:STDOUT: %Function.call: init %ptr.019 = call %Function.specific_fn(%x.ref)
  454. // CHECK:STDOUT: return %Function.call to %return
  455. // CHECK:STDOUT: }
  456. // CHECK:STDOUT:
  457. // CHECK:STDOUT: specific @Function(constants.%T.be8) {
  458. // CHECK:STDOUT: %T.loc5_13.1 => constants.%T.be8
  459. // CHECK:STDOUT: %T.as_type.loc5_31.1 => constants.%T.as_type
  460. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.965801.1
  461. // CHECK:STDOUT:
  462. // CHECK:STDOUT: !definition:
  463. // CHECK:STDOUT: %require_complete => constants.%require_complete.07c
  464. // CHECK:STDOUT: %Copy.lookup_impl_witness => constants.%Copy.lookup_impl_witness.e15
  465. // CHECK:STDOUT: %Copy.facet => constants.%Copy.facet.021
  466. // CHECK:STDOUT: %.loc6_10.2 => constants.%.c50
  467. // CHECK:STDOUT: %impl.elem0.loc6_10.2 => constants.%impl.elem0.792
  468. // CHECK:STDOUT: %specific_impl_fn.loc6_10.2 => constants.%specific_impl_fn.547
  469. // CHECK:STDOUT: }
  470. // CHECK:STDOUT:
  471. // CHECK:STDOUT: specific @CallGeneric(constants.%T.be8) {
  472. // CHECK:STDOUT: %T.loc10_16.1 => constants.%T.be8
  473. // CHECK:STDOUT: %T.as_type.loc10_34.1 => constants.%T.as_type
  474. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.965801.1
  475. // CHECK:STDOUT: }
  476. // CHECK:STDOUT:
  477. // CHECK:STDOUT: specific @CallGenericPtr(constants.%T.8b3) {
  478. // CHECK:STDOUT: %T.loc16_19.1 => constants.%T.8b3
  479. // CHECK:STDOUT: %ptr.loc16_33.1 => constants.%ptr.79f
  480. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.afe
  481. // CHECK:STDOUT: }
  482. // CHECK:STDOUT:
  483. // CHECK:STDOUT: specific @Function(constants.%Copy.facet.2d1) {
  484. // CHECK:STDOUT: %T.loc5_13.1 => constants.%Copy.facet.2d1
  485. // CHECK:STDOUT: %T.as_type.loc5_31.1 => constants.%ptr.79f
  486. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.afe
  487. // CHECK:STDOUT:
  488. // CHECK:STDOUT: !definition:
  489. // CHECK:STDOUT: %require_complete => constants.%require_complete.6e5
  490. // CHECK:STDOUT: %Copy.lookup_impl_witness => constants.%Copy.lookup_impl_witness.cb2
  491. // CHECK:STDOUT: %Copy.facet => constants.%Copy.facet.2d1
  492. // CHECK:STDOUT: %.loc6_10.2 => constants.%.1cc
  493. // CHECK:STDOUT: %impl.elem0.loc6_10.2 => constants.%impl.elem0.751
  494. // CHECK:STDOUT: %specific_impl_fn.loc6_10.2 => constants.%specific_impl_fn.f44
  495. // CHECK:STDOUT: }
  496. // CHECK:STDOUT:
  497. // CHECK:STDOUT: specific @Function(constants.%Copy.facet.9e3) {
  498. // CHECK:STDOUT: %T.loc5_13.1 => constants.%Copy.facet.9e3
  499. // CHECK:STDOUT: %T.as_type.loc5_31.1 => constants.%ptr.019
  500. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.44a
  501. // CHECK:STDOUT:
  502. // CHECK:STDOUT: !definition:
  503. // CHECK:STDOUT: %require_complete => constants.%complete_type.d05
  504. // CHECK:STDOUT: %Copy.lookup_impl_witness => constants.%Copy.impl_witness.999
  505. // CHECK:STDOUT: %Copy.facet => constants.%Copy.facet.9e3
  506. // CHECK:STDOUT: %.loc6_10.2 => constants.%.7e9
  507. // CHECK:STDOUT: %impl.elem0.loc6_10.2 => constants.%ptr.as.Copy.impl.Op.fb8
  508. // CHECK:STDOUT: %specific_impl_fn.loc6_10.2 => constants.%ptr.as.Copy.impl.Op.specific_fn
  509. // CHECK:STDOUT: }
  510. // CHECK:STDOUT: