interface_args.carbon 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000
  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. // AUTOUPDATE
  6. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/no_prelude/interface_args.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/no_prelude/interface_args.carbon
  10. // --- action.carbon
  11. library "[[@TEST_NAME]]";
  12. interface Action(T:! type) {
  13. fn Op();
  14. }
  15. class A {}
  16. class B {}
  17. class C {}
  18. impl A as Action(B) {
  19. fn Op() {}
  20. }
  21. fn F(a: A) { a.(Action(B).Op)(); }
  22. // --- action.impl.carbon
  23. impl library "[[@TEST_NAME]]";
  24. fn G(a: A) { a.(Action(B).Op)(); }
  25. // --- fail_action.impl.carbon
  26. impl library "[[@TEST_NAME]]";
  27. // CHECK:STDERR: fail_action.impl.carbon:[[@LINE+4]]:14: error: cannot access member of interface `Action` in type `A` that does not implement that interface
  28. // CHECK:STDERR: fn G(a: A) { a.(Action(C).Op)(); }
  29. // CHECK:STDERR: ^~~~~~~~~~~~~~~~
  30. // CHECK:STDERR:
  31. fn G(a: A) { a.(Action(C).Op)(); }
  32. // --- factory.carbon
  33. library "[[@TEST_NAME]]";
  34. interface Factory(T:! type) {
  35. fn Make() -> T;
  36. }
  37. class A {}
  38. class B {}
  39. impl A as Factory(B) {
  40. fn Make() -> B;
  41. }
  42. // --- factory.impl.carbon
  43. impl library "[[@TEST_NAME]]";
  44. fn MakeB(a: A) -> B {
  45. return a.(Factory(B).Make)();
  46. }
  47. // --- fail_factory.impl.carbon
  48. impl library "[[@TEST_NAME]]";
  49. class C {}
  50. fn MakeC(a: A) -> C {
  51. // CHECK:STDERR: fail_factory.impl.carbon:[[@LINE+3]]:10: error: cannot access member of interface `Factory` in type `A` that does not implement that interface
  52. // CHECK:STDERR: return a.(Factory(C).Make)();
  53. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
  54. return a.(Factory(C).Make)();
  55. }
  56. // CHECK:STDOUT: --- action.carbon
  57. // CHECK:STDOUT:
  58. // CHECK:STDOUT: constants {
  59. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic]
  60. // CHECK:STDOUT: %Action.type: type = generic_interface_type @Action [template]
  61. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  62. // CHECK:STDOUT: %Action: %Action.type = struct_value () [template]
  63. // CHECK:STDOUT: %.2: type = interface_type @Action, @Action(%T) [symbolic]
  64. // CHECK:STDOUT: %Self: %.2 = bind_symbolic_name Self 1 [symbolic]
  65. // CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1, @Action(%T) [symbolic]
  66. // CHECK:STDOUT: %Op.1: %Op.type.1 = struct_value () [symbolic]
  67. // CHECK:STDOUT: %.3: type = assoc_entity_type %.2, %Op.type.1 [symbolic]
  68. // CHECK:STDOUT: %.4: %.3 = assoc_entity element0, @Action.%Op.decl [symbolic]
  69. // CHECK:STDOUT: %A: type = class_type @A [template]
  70. // CHECK:STDOUT: %.5: type = struct_type {} [template]
  71. // CHECK:STDOUT: %.6: <witness> = complete_type_witness %.5 [template]
  72. // CHECK:STDOUT: %B: type = class_type @B [template]
  73. // CHECK:STDOUT: %C: type = class_type @C [template]
  74. // CHECK:STDOUT: %.7: type = interface_type @Action, @Action(%B) [template]
  75. // CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template]
  76. // CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template]
  77. // CHECK:STDOUT: %Op.type.3: type = fn_type @Op.1, @Action(%B) [template]
  78. // CHECK:STDOUT: %Op.3: %Op.type.3 = struct_value () [template]
  79. // CHECK:STDOUT: %.8: type = assoc_entity_type %.7, %Op.type.3 [template]
  80. // CHECK:STDOUT: %.9: %.8 = assoc_entity element0, @Action.%Op.decl [template]
  81. // CHECK:STDOUT: %.10: <witness> = interface_witness (%Op.2) [template]
  82. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  83. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  84. // CHECK:STDOUT: %.11: type = ptr_type %.5 [template]
  85. // CHECK:STDOUT: }
  86. // CHECK:STDOUT:
  87. // CHECK:STDOUT: file {
  88. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  89. // CHECK:STDOUT: .Action = %Action.decl
  90. // CHECK:STDOUT: .A = %A.decl
  91. // CHECK:STDOUT: .B = %B.decl
  92. // CHECK:STDOUT: .C = %C.decl
  93. // CHECK:STDOUT: .F = %F.decl
  94. // CHECK:STDOUT: }
  95. // CHECK:STDOUT: %Action.decl: %Action.type = interface_decl @Action [template = constants.%Action] {
  96. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T 0
  97. // CHECK:STDOUT: } {
  98. // CHECK:STDOUT: %T.param: type = param T, runtime_param<invalid>
  99. // CHECK:STDOUT: %T.loc4: type = bind_symbolic_name T 0, %T.param [symbolic = %T.1 (constants.%T)]
  100. // CHECK:STDOUT: }
  101. // CHECK:STDOUT: %A.decl: type = class_decl @A [template = constants.%A] {} {}
  102. // CHECK:STDOUT: %B.decl: type = class_decl @B [template = constants.%B] {} {}
  103. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  104. // CHECK:STDOUT: impl_decl @impl {} {
  105. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A]
  106. // CHECK:STDOUT: %Action.ref: %Action.type = name_ref Action, file.%Action.decl [template = constants.%Action]
  107. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B]
  108. // CHECK:STDOUT: %.loc12_17: type = interface_type @Action, @Action(constants.%B) [template = constants.%.7]
  109. // CHECK:STDOUT: }
  110. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
  111. // CHECK:STDOUT: %a.patt: %A = binding_pattern a
  112. // CHECK:STDOUT: } {
  113. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A]
  114. // CHECK:STDOUT: %a.param: %A = param a, runtime_param0
  115. // CHECK:STDOUT: %a: %A = bind_name a, %a.param
  116. // CHECK:STDOUT: }
  117. // CHECK:STDOUT: }
  118. // CHECK:STDOUT:
  119. // CHECK:STDOUT: generic interface @Action(%T.loc4: type) {
  120. // CHECK:STDOUT: %T.1: type = bind_symbolic_name T 0 [symbolic = %T.1 (constants.%T)]
  121. // CHECK:STDOUT:
  122. // CHECK:STDOUT: !definition:
  123. // CHECK:STDOUT: %.1: type = interface_type @Action, @Action(%T.1) [symbolic = %.1 (constants.%.2)]
  124. // CHECK:STDOUT: %Self.2: %.2 = bind_symbolic_name Self 1 [symbolic = %Self.2 (constants.%Self)]
  125. // CHECK:STDOUT: %Op.type: type = fn_type @Op.1, @Action(%T.1) [symbolic = %Op.type (constants.%Op.type.1)]
  126. // CHECK:STDOUT: %Op: @Action.%Op.type (%Op.type.1) = struct_value () [symbolic = %Op (constants.%Op.1)]
  127. // CHECK:STDOUT: %.2: type = assoc_entity_type @Action.%.1 (%.2), @Action.%Op.type (%Op.type.1) [symbolic = %.2 (constants.%.3)]
  128. // CHECK:STDOUT: %.3: @Action.%.2 (%.3) = assoc_entity element0, %Op.decl [symbolic = %.3 (constants.%.4)]
  129. // CHECK:STDOUT:
  130. // CHECK:STDOUT: interface {
  131. // CHECK:STDOUT: %Self.1: @Action.%.1 (%.2) = bind_symbolic_name Self 1 [symbolic = %Self.2 (constants.%Self)]
  132. // CHECK:STDOUT: %Op.decl: @Action.%Op.type (%Op.type.1) = fn_decl @Op.1 [symbolic = @Action.%Op (constants.%Op.1)] {} {}
  133. // CHECK:STDOUT: %.loc5: @Action.%.2 (%.3) = assoc_entity element0, %Op.decl [symbolic = %.3 (constants.%.4)]
  134. // CHECK:STDOUT:
  135. // CHECK:STDOUT: !members:
  136. // CHECK:STDOUT: .Self = %Self.1
  137. // CHECK:STDOUT: .Op = %.loc5
  138. // CHECK:STDOUT: witness = (%Op.decl)
  139. // CHECK:STDOUT: }
  140. // CHECK:STDOUT: }
  141. // CHECK:STDOUT:
  142. // CHECK:STDOUT: impl @impl: %A as %.7 {
  143. // CHECK:STDOUT: %Op.decl: %Op.type.2 = fn_decl @Op.2 [template = constants.%Op.2] {} {}
  144. // CHECK:STDOUT: %.loc12_21: <witness> = interface_witness (%Op.decl) [template = constants.%.10]
  145. // CHECK:STDOUT:
  146. // CHECK:STDOUT: !members:
  147. // CHECK:STDOUT: .Op = %Op.decl
  148. // CHECK:STDOUT: witness = %.loc12_21
  149. // CHECK:STDOUT: }
  150. // CHECK:STDOUT:
  151. // CHECK:STDOUT: class @A {
  152. // CHECK:STDOUT: %.loc8: <witness> = complete_type_witness %.5 [template = constants.%.6]
  153. // CHECK:STDOUT:
  154. // CHECK:STDOUT: !members:
  155. // CHECK:STDOUT: .Self = constants.%A
  156. // CHECK:STDOUT: }
  157. // CHECK:STDOUT:
  158. // CHECK:STDOUT: class @B {
  159. // CHECK:STDOUT: %.loc9: <witness> = complete_type_witness %.5 [template = constants.%.6]
  160. // CHECK:STDOUT:
  161. // CHECK:STDOUT: !members:
  162. // CHECK:STDOUT: .Self = constants.%B
  163. // CHECK:STDOUT: }
  164. // CHECK:STDOUT:
  165. // CHECK:STDOUT: class @C {
  166. // CHECK:STDOUT: %.loc10: <witness> = complete_type_witness %.5 [template = constants.%.6]
  167. // CHECK:STDOUT:
  168. // CHECK:STDOUT: !members:
  169. // CHECK:STDOUT: .Self = constants.%C
  170. // CHECK:STDOUT: }
  171. // CHECK:STDOUT:
  172. // CHECK:STDOUT: generic fn @Op.1(@Action.%T.loc4: type, @Action.%Self.1: @Action.%.1 (%.2)) {
  173. // CHECK:STDOUT:
  174. // CHECK:STDOUT: fn();
  175. // CHECK:STDOUT: }
  176. // CHECK:STDOUT:
  177. // CHECK:STDOUT: fn @Op.2() {
  178. // CHECK:STDOUT: !entry:
  179. // CHECK:STDOUT: return
  180. // CHECK:STDOUT: }
  181. // CHECK:STDOUT:
  182. // CHECK:STDOUT: fn @F(%a: %A) {
  183. // CHECK:STDOUT: !entry:
  184. // CHECK:STDOUT: %a.ref: %A = name_ref a, %a
  185. // CHECK:STDOUT: %Action.ref: %Action.type = name_ref Action, file.%Action.decl [template = constants.%Action]
  186. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B]
  187. // CHECK:STDOUT: %.loc16_23: type = interface_type @Action, @Action(constants.%B) [template = constants.%.7]
  188. // CHECK:STDOUT: %.loc16_26: %.8 = specific_constant @Action.%.loc5, @Action(constants.%B) [template = constants.%.9]
  189. // CHECK:STDOUT: %Op.ref: %.8 = name_ref Op, %.loc16_26 [template = constants.%.9]
  190. // CHECK:STDOUT: %.loc16_15: %Op.type.3 = interface_witness_access @impl.%.loc12_21, element0 [template = constants.%Op.2]
  191. // CHECK:STDOUT: %Op.call: init %.1 = call %.loc16_15()
  192. // CHECK:STDOUT: return
  193. // CHECK:STDOUT: }
  194. // CHECK:STDOUT:
  195. // CHECK:STDOUT: specific @Action(constants.%T) {
  196. // CHECK:STDOUT: %T.1 => constants.%T
  197. // CHECK:STDOUT: }
  198. // CHECK:STDOUT:
  199. // CHECK:STDOUT: specific @Op.1(constants.%T, constants.%Self) {}
  200. // CHECK:STDOUT:
  201. // CHECK:STDOUT: specific @Action(@Action.%T.1) {
  202. // CHECK:STDOUT: %T.1 => constants.%T
  203. // CHECK:STDOUT: }
  204. // CHECK:STDOUT:
  205. // CHECK:STDOUT: specific @Action(constants.%B) {
  206. // CHECK:STDOUT: %T.1 => constants.%B
  207. // CHECK:STDOUT:
  208. // CHECK:STDOUT: !definition:
  209. // CHECK:STDOUT: %.1 => constants.%.7
  210. // CHECK:STDOUT: %Self.2 => constants.%Self
  211. // CHECK:STDOUT: %Op.type => constants.%Op.type.3
  212. // CHECK:STDOUT: %Op => constants.%Op.3
  213. // CHECK:STDOUT: %.2 => constants.%.8
  214. // CHECK:STDOUT: %.3 => constants.%.9
  215. // CHECK:STDOUT: }
  216. // CHECK:STDOUT:
  217. // CHECK:STDOUT: specific @Op.1(constants.%B, constants.%A) {}
  218. // CHECK:STDOUT:
  219. // CHECK:STDOUT: --- action.impl.carbon
  220. // CHECK:STDOUT:
  221. // CHECK:STDOUT: constants {
  222. // CHECK:STDOUT: %A: type = class_type @A [template]
  223. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  224. // CHECK:STDOUT: %.2: <witness> = complete_type_witness %.1 [template]
  225. // CHECK:STDOUT: %B: type = class_type @B [template]
  226. // CHECK:STDOUT: %Action.type: type = generic_interface_type @Action [template]
  227. // CHECK:STDOUT: %.3: type = tuple_type () [template]
  228. // CHECK:STDOUT: %Action: %Action.type = struct_value () [template]
  229. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic]
  230. // CHECK:STDOUT: %.4: type = interface_type @Action, @Action(%T) [symbolic]
  231. // CHECK:STDOUT: %Self.1: @Action.%.1 (%.4) = bind_symbolic_name Self 1 [symbolic]
  232. // CHECK:STDOUT: %.5: type = interface_type @Action, @Action(%B) [template]
  233. // CHECK:STDOUT: %Self.2: %.4 = bind_symbolic_name Self 1 [symbolic]
  234. // CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1, @Action(%T) [symbolic]
  235. // CHECK:STDOUT: %Op.1: %Op.type.1 = struct_value () [symbolic]
  236. // CHECK:STDOUT: %.6: type = assoc_entity_type %.4, %Op.type.1 [symbolic]
  237. // CHECK:STDOUT: %.7: %.6 = assoc_entity element0, imports.%import_ref.11 [symbolic]
  238. // CHECK:STDOUT: %Op.type.2: type = fn_type @Op.1, @Action(%B) [template]
  239. // CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template]
  240. // CHECK:STDOUT: %.8: type = assoc_entity_type %.5, %Op.type.2 [template]
  241. // CHECK:STDOUT: %.9: %.8 = assoc_entity element0, imports.%import_ref.12 [template]
  242. // CHECK:STDOUT: %G.type: type = fn_type @G [template]
  243. // CHECK:STDOUT: %G: %G.type = struct_value () [template]
  244. // CHECK:STDOUT: %.10: type = ptr_type %.1 [template]
  245. // CHECK:STDOUT: %.11: %.6 = assoc_entity element0, imports.%import_ref.14 [symbolic]
  246. // CHECK:STDOUT: %Op.type.3: type = fn_type @Op.2 [template]
  247. // CHECK:STDOUT: %Op.3: %Op.type.3 = struct_value () [template]
  248. // CHECK:STDOUT: %.12: <witness> = interface_witness (%Op.3) [template]
  249. // CHECK:STDOUT: }
  250. // CHECK:STDOUT:
  251. // CHECK:STDOUT: imports {
  252. // CHECK:STDOUT: %import_ref.1: %Action.type = import_ref Main//action, inst+5, loaded [template = constants.%Action]
  253. // CHECK:STDOUT: %import_ref.2: type = import_ref Main//action, inst+25, loaded [template = constants.%A]
  254. // CHECK:STDOUT: %import_ref.3: type = import_ref Main//action, inst+30, loaded [template = constants.%B]
  255. // CHECK:STDOUT: %import_ref.4 = import_ref Main//action, inst+33, unloaded
  256. // CHECK:STDOUT: %import_ref.5 = import_ref Main//action, inst+56, unloaded
  257. // CHECK:STDOUT: %import_ref.6 = import_ref Main//action, inst+26, unloaded
  258. // CHECK:STDOUT: %import_ref.7 = import_ref Main//action, inst+31, unloaded
  259. // CHECK:STDOUT: %import_ref.8 = import_ref Main//action, inst+11, unloaded
  260. // CHECK:STDOUT: %import_ref.9: @Action.%.2 (%.6) = import_ref Main//action, inst+17, loaded [symbolic = @Action.%.3 (constants.%.11)]
  261. // CHECK:STDOUT: %import_ref.10 = import_ref Main//action, inst+13, unloaded
  262. // CHECK:STDOUT: %import_ref.11 = import_ref Main//action, inst+13, unloaded
  263. // CHECK:STDOUT: %import_ref.12 = import_ref Main//action, inst+13, unloaded
  264. // CHECK:STDOUT: %import_ref.13: <witness> = import_ref Main//action, inst+49, loaded [template = constants.%.12]
  265. // CHECK:STDOUT: %import_ref.14 = import_ref Main//action, inst+13, unloaded
  266. // CHECK:STDOUT: }
  267. // CHECK:STDOUT:
  268. // CHECK:STDOUT: file {
  269. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  270. // CHECK:STDOUT: .Action = imports.%import_ref.1
  271. // CHECK:STDOUT: .A = imports.%import_ref.2
  272. // CHECK:STDOUT: .B = imports.%import_ref.3
  273. // CHECK:STDOUT: .C = imports.%import_ref.4
  274. // CHECK:STDOUT: .F = imports.%import_ref.5
  275. // CHECK:STDOUT: .G = %G.decl
  276. // CHECK:STDOUT: }
  277. // CHECK:STDOUT: %default.import.loc2_6.1 = import <invalid>
  278. // CHECK:STDOUT: %default.import.loc2_6.2 = import <invalid>
  279. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
  280. // CHECK:STDOUT: %a.patt: %A = binding_pattern a
  281. // CHECK:STDOUT: } {
  282. // CHECK:STDOUT: %A.ref: type = name_ref A, imports.%import_ref.2 [template = constants.%A]
  283. // CHECK:STDOUT: %a.param: %A = param a, runtime_param0
  284. // CHECK:STDOUT: %a: %A = bind_name a, %a.param
  285. // CHECK:STDOUT: }
  286. // CHECK:STDOUT: }
  287. // CHECK:STDOUT:
  288. // CHECK:STDOUT: generic interface @Action(constants.%T: type) {
  289. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic = %T (constants.%T)]
  290. // CHECK:STDOUT:
  291. // CHECK:STDOUT: !definition:
  292. // CHECK:STDOUT: %.1: type = interface_type @Action, @Action(%T) [symbolic = %.1 (constants.%.4)]
  293. // CHECK:STDOUT: %Self: %.4 = bind_symbolic_name Self 1 [symbolic = %Self (constants.%Self.2)]
  294. // CHECK:STDOUT: %Op.type: type = fn_type @Op.1, @Action(%T) [symbolic = %Op.type (constants.%Op.type.1)]
  295. // CHECK:STDOUT: %Op: @Action.%Op.type (%Op.type.1) = struct_value () [symbolic = %Op (constants.%Op.1)]
  296. // CHECK:STDOUT: %.2: type = assoc_entity_type @Action.%.1 (%.4), @Action.%Op.type (%Op.type.1) [symbolic = %.2 (constants.%.6)]
  297. // CHECK:STDOUT: %.3: @Action.%.2 (%.6) = assoc_entity element0, imports.%import_ref.11 [symbolic = %.3 (constants.%.7)]
  298. // CHECK:STDOUT:
  299. // CHECK:STDOUT: interface {
  300. // CHECK:STDOUT: !members:
  301. // CHECK:STDOUT: .Self = imports.%import_ref.8
  302. // CHECK:STDOUT: .Op = imports.%import_ref.9
  303. // CHECK:STDOUT: witness = (imports.%import_ref.10)
  304. // CHECK:STDOUT: }
  305. // CHECK:STDOUT: }
  306. // CHECK:STDOUT:
  307. // CHECK:STDOUT: impl @impl: %A as %.5 {
  308. // CHECK:STDOUT: !members:
  309. // CHECK:STDOUT: witness = imports.%import_ref.13
  310. // CHECK:STDOUT: }
  311. // CHECK:STDOUT:
  312. // CHECK:STDOUT: class @A {
  313. // CHECK:STDOUT: !members:
  314. // CHECK:STDOUT: .Self = imports.%import_ref.6
  315. // CHECK:STDOUT: }
  316. // CHECK:STDOUT:
  317. // CHECK:STDOUT: class @B {
  318. // CHECK:STDOUT: !members:
  319. // CHECK:STDOUT: .Self = imports.%import_ref.7
  320. // CHECK:STDOUT: }
  321. // CHECK:STDOUT:
  322. // CHECK:STDOUT: generic fn @Op.1(constants.%T: type, constants.%Self.1: @Action.%.1 (%.4)) {
  323. // CHECK:STDOUT:
  324. // CHECK:STDOUT: fn();
  325. // CHECK:STDOUT: }
  326. // CHECK:STDOUT:
  327. // CHECK:STDOUT: fn @G(%a: %A) {
  328. // CHECK:STDOUT: !entry:
  329. // CHECK:STDOUT: %a.ref: %A = name_ref a, %a
  330. // CHECK:STDOUT: %Action.ref: %Action.type = name_ref Action, imports.%import_ref.1 [template = constants.%Action]
  331. // CHECK:STDOUT: %B.ref: type = name_ref B, imports.%import_ref.3 [template = constants.%B]
  332. // CHECK:STDOUT: %.loc4_23: type = interface_type @Action, @Action(constants.%B) [template = constants.%.5]
  333. // CHECK:STDOUT: %.loc4_26: %.8 = specific_constant imports.%import_ref.9, @Action(constants.%B) [template = constants.%.9]
  334. // CHECK:STDOUT: %Op.ref: %.8 = name_ref Op, %.loc4_26 [template = constants.%.9]
  335. // CHECK:STDOUT: %.loc4_15: %Op.type.2 = interface_witness_access imports.%import_ref.13, element0 [template = constants.%Op.3]
  336. // CHECK:STDOUT: %Op.call: init %.3 = call %.loc4_15()
  337. // CHECK:STDOUT: return
  338. // CHECK:STDOUT: }
  339. // CHECK:STDOUT:
  340. // CHECK:STDOUT: fn @Op.2();
  341. // CHECK:STDOUT:
  342. // CHECK:STDOUT: specific @Action(constants.%T) {
  343. // CHECK:STDOUT: %T => constants.%T
  344. // CHECK:STDOUT: }
  345. // CHECK:STDOUT:
  346. // CHECK:STDOUT: specific @Action(constants.%B) {
  347. // CHECK:STDOUT: %T => constants.%B
  348. // CHECK:STDOUT:
  349. // CHECK:STDOUT: !definition:
  350. // CHECK:STDOUT: %.1 => constants.%.5
  351. // CHECK:STDOUT: %Self => constants.%Self.2
  352. // CHECK:STDOUT: %Op.type => constants.%Op.type.2
  353. // CHECK:STDOUT: %Op => constants.%Op.2
  354. // CHECK:STDOUT: %.2 => constants.%.8
  355. // CHECK:STDOUT: %.3 => constants.%.9
  356. // CHECK:STDOUT: }
  357. // CHECK:STDOUT:
  358. // CHECK:STDOUT: specific @Action(@Action.%T) {
  359. // CHECK:STDOUT: %T => constants.%T
  360. // CHECK:STDOUT: }
  361. // CHECK:STDOUT:
  362. // CHECK:STDOUT: specific @Op.1(constants.%T, constants.%Self.1) {}
  363. // CHECK:STDOUT:
  364. // CHECK:STDOUT: --- fail_action.impl.carbon
  365. // CHECK:STDOUT:
  366. // CHECK:STDOUT: constants {
  367. // CHECK:STDOUT: %A: type = class_type @A [template]
  368. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  369. // CHECK:STDOUT: %.2: <witness> = complete_type_witness %.1 [template]
  370. // CHECK:STDOUT: %B: type = class_type @B [template]
  371. // CHECK:STDOUT: %Action.type: type = generic_interface_type @Action [template]
  372. // CHECK:STDOUT: %.3: type = tuple_type () [template]
  373. // CHECK:STDOUT: %Action: %Action.type = struct_value () [template]
  374. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic]
  375. // CHECK:STDOUT: %.4: type = interface_type @Action, @Action(%T) [symbolic]
  376. // CHECK:STDOUT: %Self.1: @Action.%.1 (%.4) = bind_symbolic_name Self 1 [symbolic]
  377. // CHECK:STDOUT: %.5: type = interface_type @Action, @Action(%B) [template]
  378. // CHECK:STDOUT: %Self.2: %.4 = bind_symbolic_name Self 1 [symbolic]
  379. // CHECK:STDOUT: %Op.type.1: type = fn_type @Op, @Action(%T) [symbolic]
  380. // CHECK:STDOUT: %Op.1: %Op.type.1 = struct_value () [symbolic]
  381. // CHECK:STDOUT: %.6: type = assoc_entity_type %.4, %Op.type.1 [symbolic]
  382. // CHECK:STDOUT: %.7: %.6 = assoc_entity element0, imports.%import_ref.11 [symbolic]
  383. // CHECK:STDOUT: %Op.type.2: type = fn_type @Op, @Action(%B) [template]
  384. // CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template]
  385. // CHECK:STDOUT: %.8: type = assoc_entity_type %.5, %Op.type.2 [template]
  386. // CHECK:STDOUT: %.9: %.8 = assoc_entity element0, imports.%import_ref.12 [template]
  387. // CHECK:STDOUT: %G.type: type = fn_type @G [template]
  388. // CHECK:STDOUT: %G: %G.type = struct_value () [template]
  389. // CHECK:STDOUT: %.10: type = ptr_type %.1 [template]
  390. // CHECK:STDOUT: %C: type = class_type @C [template]
  391. // CHECK:STDOUT: %.11: type = interface_type @Action, @Action(%C) [template]
  392. // CHECK:STDOUT: %Op.type.3: type = fn_type @Op, @Action(%C) [template]
  393. // CHECK:STDOUT: %Op.3: %Op.type.3 = struct_value () [template]
  394. // CHECK:STDOUT: %.12: type = assoc_entity_type %.11, %Op.type.3 [template]
  395. // CHECK:STDOUT: %.13: %.12 = assoc_entity element0, imports.%import_ref.11 [template]
  396. // CHECK:STDOUT: %.14: %.6 = assoc_entity element0, imports.%import_ref.15 [symbolic]
  397. // CHECK:STDOUT: }
  398. // CHECK:STDOUT:
  399. // CHECK:STDOUT: imports {
  400. // CHECK:STDOUT: %import_ref.1: %Action.type = import_ref Main//action, inst+5, loaded [template = constants.%Action]
  401. // CHECK:STDOUT: %import_ref.2: type = import_ref Main//action, inst+25, loaded [template = constants.%A]
  402. // CHECK:STDOUT: %import_ref.3 = import_ref Main//action, inst+30, unloaded
  403. // CHECK:STDOUT: %import_ref.4: type = import_ref Main//action, inst+33, loaded [template = constants.%C]
  404. // CHECK:STDOUT: %import_ref.5 = import_ref Main//action, inst+56, unloaded
  405. // CHECK:STDOUT: %import_ref.6 = import_ref Main//action, inst+26, unloaded
  406. // CHECK:STDOUT: %import_ref.7 = import_ref Main//action, inst+31, unloaded
  407. // CHECK:STDOUT: %import_ref.8 = import_ref Main//action, inst+11, unloaded
  408. // CHECK:STDOUT: %import_ref.9: @Action.%.2 (%.6) = import_ref Main//action, inst+17, loaded [symbolic = @Action.%.3 (constants.%.14)]
  409. // CHECK:STDOUT: %import_ref.10 = import_ref Main//action, inst+13, unloaded
  410. // CHECK:STDOUT: %import_ref.11 = import_ref Main//action, inst+13, unloaded
  411. // CHECK:STDOUT: %import_ref.12 = import_ref Main//action, inst+13, unloaded
  412. // CHECK:STDOUT: %import_ref.13 = import_ref Main//action, inst+49, unloaded
  413. // CHECK:STDOUT: %import_ref.14 = import_ref Main//action, inst+34, unloaded
  414. // CHECK:STDOUT: %import_ref.15 = import_ref Main//action, inst+13, unloaded
  415. // CHECK:STDOUT: }
  416. // CHECK:STDOUT:
  417. // CHECK:STDOUT: file {
  418. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  419. // CHECK:STDOUT: .Action = imports.%import_ref.1
  420. // CHECK:STDOUT: .A = imports.%import_ref.2
  421. // CHECK:STDOUT: .B = imports.%import_ref.3
  422. // CHECK:STDOUT: .C = imports.%import_ref.4
  423. // CHECK:STDOUT: .F = imports.%import_ref.5
  424. // CHECK:STDOUT: .G = %G.decl
  425. // CHECK:STDOUT: }
  426. // CHECK:STDOUT: %default.import.loc2_6.1 = import <invalid>
  427. // CHECK:STDOUT: %default.import.loc2_6.2 = import <invalid>
  428. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
  429. // CHECK:STDOUT: %a.patt: %A = binding_pattern a
  430. // CHECK:STDOUT: } {
  431. // CHECK:STDOUT: %A.ref: type = name_ref A, imports.%import_ref.2 [template = constants.%A]
  432. // CHECK:STDOUT: %a.param: %A = param a, runtime_param0
  433. // CHECK:STDOUT: %a: %A = bind_name a, %a.param
  434. // CHECK:STDOUT: }
  435. // CHECK:STDOUT: }
  436. // CHECK:STDOUT:
  437. // CHECK:STDOUT: generic interface @Action(constants.%T: type) {
  438. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic = %T (constants.%T)]
  439. // CHECK:STDOUT:
  440. // CHECK:STDOUT: !definition:
  441. // CHECK:STDOUT: %.1: type = interface_type @Action, @Action(%T) [symbolic = %.1 (constants.%.4)]
  442. // CHECK:STDOUT: %Self: %.4 = bind_symbolic_name Self 1 [symbolic = %Self (constants.%Self.2)]
  443. // CHECK:STDOUT: %Op.type: type = fn_type @Op, @Action(%T) [symbolic = %Op.type (constants.%Op.type.1)]
  444. // CHECK:STDOUT: %Op: @Action.%Op.type (%Op.type.1) = struct_value () [symbolic = %Op (constants.%Op.1)]
  445. // CHECK:STDOUT: %.2: type = assoc_entity_type @Action.%.1 (%.4), @Action.%Op.type (%Op.type.1) [symbolic = %.2 (constants.%.6)]
  446. // CHECK:STDOUT: %.3: @Action.%.2 (%.6) = assoc_entity element0, imports.%import_ref.11 [symbolic = %.3 (constants.%.7)]
  447. // CHECK:STDOUT:
  448. // CHECK:STDOUT: interface {
  449. // CHECK:STDOUT: !members:
  450. // CHECK:STDOUT: .Self = imports.%import_ref.8
  451. // CHECK:STDOUT: .Op = imports.%import_ref.9
  452. // CHECK:STDOUT: witness = (imports.%import_ref.10)
  453. // CHECK:STDOUT: }
  454. // CHECK:STDOUT: }
  455. // CHECK:STDOUT:
  456. // CHECK:STDOUT: impl @impl: %A as %.5 {
  457. // CHECK:STDOUT: !members:
  458. // CHECK:STDOUT: witness = imports.%import_ref.13
  459. // CHECK:STDOUT: }
  460. // CHECK:STDOUT:
  461. // CHECK:STDOUT: class @A {
  462. // CHECK:STDOUT: !members:
  463. // CHECK:STDOUT: .Self = imports.%import_ref.6
  464. // CHECK:STDOUT: }
  465. // CHECK:STDOUT:
  466. // CHECK:STDOUT: class @B {
  467. // CHECK:STDOUT: !members:
  468. // CHECK:STDOUT: .Self = imports.%import_ref.7
  469. // CHECK:STDOUT: }
  470. // CHECK:STDOUT:
  471. // CHECK:STDOUT: class @C {
  472. // CHECK:STDOUT: !members:
  473. // CHECK:STDOUT: .Self = imports.%import_ref.14
  474. // CHECK:STDOUT: }
  475. // CHECK:STDOUT:
  476. // CHECK:STDOUT: generic fn @Op(constants.%T: type, constants.%Self.1: @Action.%.1 (%.4)) {
  477. // CHECK:STDOUT:
  478. // CHECK:STDOUT: fn();
  479. // CHECK:STDOUT: }
  480. // CHECK:STDOUT:
  481. // CHECK:STDOUT: fn @G(%a: %A) {
  482. // CHECK:STDOUT: !entry:
  483. // CHECK:STDOUT: %a.ref: %A = name_ref a, %a
  484. // CHECK:STDOUT: %Action.ref: %Action.type = name_ref Action, imports.%import_ref.1 [template = constants.%Action]
  485. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.4 [template = constants.%C]
  486. // CHECK:STDOUT: %.loc8_23: type = interface_type @Action, @Action(constants.%C) [template = constants.%.11]
  487. // CHECK:STDOUT: %.loc8_26: %.12 = specific_constant imports.%import_ref.9, @Action(constants.%C) [template = constants.%.13]
  488. // CHECK:STDOUT: %Op.ref: %.12 = name_ref Op, %.loc8_26 [template = constants.%.13]
  489. // CHECK:STDOUT: return
  490. // CHECK:STDOUT: }
  491. // CHECK:STDOUT:
  492. // CHECK:STDOUT: specific @Action(constants.%T) {
  493. // CHECK:STDOUT: %T => constants.%T
  494. // CHECK:STDOUT: }
  495. // CHECK:STDOUT:
  496. // CHECK:STDOUT: specific @Action(constants.%B) {
  497. // CHECK:STDOUT: %T => constants.%B
  498. // CHECK:STDOUT:
  499. // CHECK:STDOUT: !definition:
  500. // CHECK:STDOUT: %.1 => constants.%.5
  501. // CHECK:STDOUT: %Self => constants.%Self.2
  502. // CHECK:STDOUT: %Op.type => constants.%Op.type.2
  503. // CHECK:STDOUT: %Op => constants.%Op.2
  504. // CHECK:STDOUT: %.2 => constants.%.8
  505. // CHECK:STDOUT: %.3 => constants.%.9
  506. // CHECK:STDOUT: }
  507. // CHECK:STDOUT:
  508. // CHECK:STDOUT: specific @Action(@Action.%T) {
  509. // CHECK:STDOUT: %T => constants.%T
  510. // CHECK:STDOUT: }
  511. // CHECK:STDOUT:
  512. // CHECK:STDOUT: specific @Op(constants.%T, constants.%Self.1) {}
  513. // CHECK:STDOUT:
  514. // CHECK:STDOUT: specific @Action(constants.%C) {
  515. // CHECK:STDOUT: %T => constants.%C
  516. // CHECK:STDOUT:
  517. // CHECK:STDOUT: !definition:
  518. // CHECK:STDOUT: %.1 => constants.%.11
  519. // CHECK:STDOUT: %Self => constants.%Self.2
  520. // CHECK:STDOUT: %Op.type => constants.%Op.type.3
  521. // CHECK:STDOUT: %Op => constants.%Op.3
  522. // CHECK:STDOUT: %.2 => constants.%.12
  523. // CHECK:STDOUT: %.3 => constants.%.13
  524. // CHECK:STDOUT: }
  525. // CHECK:STDOUT:
  526. // CHECK:STDOUT: --- factory.carbon
  527. // CHECK:STDOUT:
  528. // CHECK:STDOUT: constants {
  529. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic]
  530. // CHECK:STDOUT: %Factory.type: type = generic_interface_type @Factory [template]
  531. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  532. // CHECK:STDOUT: %Factory: %Factory.type = struct_value () [template]
  533. // CHECK:STDOUT: %.2: type = interface_type @Factory, @Factory(%T) [symbolic]
  534. // CHECK:STDOUT: %Self: %.2 = bind_symbolic_name Self 1 [symbolic]
  535. // CHECK:STDOUT: %Make.type.1: type = fn_type @Make.1, @Factory(%T) [symbolic]
  536. // CHECK:STDOUT: %Make.1: %Make.type.1 = struct_value () [symbolic]
  537. // CHECK:STDOUT: %.3: type = assoc_entity_type %.2, %Make.type.1 [symbolic]
  538. // CHECK:STDOUT: %.4: %.3 = assoc_entity element0, @Factory.%Make.decl [symbolic]
  539. // CHECK:STDOUT: %A: type = class_type @A [template]
  540. // CHECK:STDOUT: %.5: type = struct_type {} [template]
  541. // CHECK:STDOUT: %.6: <witness> = complete_type_witness %.5 [template]
  542. // CHECK:STDOUT: %B: type = class_type @B [template]
  543. // CHECK:STDOUT: %.7: type = interface_type @Factory, @Factory(%B) [template]
  544. // CHECK:STDOUT: %Make.type.2: type = fn_type @Make.2 [template]
  545. // CHECK:STDOUT: %Make.2: %Make.type.2 = struct_value () [template]
  546. // CHECK:STDOUT: %Make.type.3: type = fn_type @Make.1, @Factory(%B) [template]
  547. // CHECK:STDOUT: %Make.3: %Make.type.3 = struct_value () [template]
  548. // CHECK:STDOUT: %.8: type = assoc_entity_type %.7, %Make.type.3 [template]
  549. // CHECK:STDOUT: %.9: %.8 = assoc_entity element0, @Factory.%Make.decl [template]
  550. // CHECK:STDOUT: %.10: <witness> = interface_witness (%Make.2) [template]
  551. // CHECK:STDOUT: }
  552. // CHECK:STDOUT:
  553. // CHECK:STDOUT: file {
  554. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  555. // CHECK:STDOUT: .Factory = %Factory.decl
  556. // CHECK:STDOUT: .A = %A.decl
  557. // CHECK:STDOUT: .B = %B.decl
  558. // CHECK:STDOUT: }
  559. // CHECK:STDOUT: %Factory.decl: %Factory.type = interface_decl @Factory [template = constants.%Factory] {
  560. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T 0
  561. // CHECK:STDOUT: } {
  562. // CHECK:STDOUT: %T.param: type = param T, runtime_param<invalid>
  563. // CHECK:STDOUT: %T.loc4: type = bind_symbolic_name T 0, %T.param [symbolic = %T.1 (constants.%T)]
  564. // CHECK:STDOUT: }
  565. // CHECK:STDOUT: %A.decl: type = class_decl @A [template = constants.%A] {} {}
  566. // CHECK:STDOUT: %B.decl: type = class_decl @B [template = constants.%B] {} {}
  567. // CHECK:STDOUT: impl_decl @impl {} {
  568. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A]
  569. // CHECK:STDOUT: %Factory.ref: %Factory.type = name_ref Factory, file.%Factory.decl [template = constants.%Factory]
  570. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B]
  571. // CHECK:STDOUT: %.loc11_18: type = interface_type @Factory, @Factory(constants.%B) [template = constants.%.7]
  572. // CHECK:STDOUT: }
  573. // CHECK:STDOUT: }
  574. // CHECK:STDOUT:
  575. // CHECK:STDOUT: generic interface @Factory(%T.loc4: type) {
  576. // CHECK:STDOUT: %T.1: type = bind_symbolic_name T 0 [symbolic = %T.1 (constants.%T)]
  577. // CHECK:STDOUT:
  578. // CHECK:STDOUT: !definition:
  579. // CHECK:STDOUT: %.1: type = interface_type @Factory, @Factory(%T.1) [symbolic = %.1 (constants.%.2)]
  580. // CHECK:STDOUT: %Self.2: %.2 = bind_symbolic_name Self 1 [symbolic = %Self.2 (constants.%Self)]
  581. // CHECK:STDOUT: %Make.type: type = fn_type @Make.1, @Factory(%T.1) [symbolic = %Make.type (constants.%Make.type.1)]
  582. // CHECK:STDOUT: %Make: @Factory.%Make.type (%Make.type.1) = struct_value () [symbolic = %Make (constants.%Make.1)]
  583. // CHECK:STDOUT: %.2: type = assoc_entity_type @Factory.%.1 (%.2), @Factory.%Make.type (%Make.type.1) [symbolic = %.2 (constants.%.3)]
  584. // CHECK:STDOUT: %.3: @Factory.%.2 (%.3) = assoc_entity element0, %Make.decl [symbolic = %.3 (constants.%.4)]
  585. // CHECK:STDOUT:
  586. // CHECK:STDOUT: interface {
  587. // CHECK:STDOUT: %Self.1: @Factory.%.1 (%.2) = bind_symbolic_name Self 1 [symbolic = %Self.2 (constants.%Self)]
  588. // CHECK:STDOUT: %Make.decl: @Factory.%Make.type (%Make.type.1) = fn_decl @Make.1 [symbolic = @Factory.%Make (constants.%Make.1)] {} {
  589. // CHECK:STDOUT: %T.ref: type = name_ref T, @Factory.%T.loc4 [symbolic = %T (constants.%T)]
  590. // CHECK:STDOUT: %return: ref @Make.1.%T (%T) = var <return slot>
  591. // CHECK:STDOUT: }
  592. // CHECK:STDOUT: %.loc5: @Factory.%.2 (%.3) = assoc_entity element0, %Make.decl [symbolic = %.3 (constants.%.4)]
  593. // CHECK:STDOUT:
  594. // CHECK:STDOUT: !members:
  595. // CHECK:STDOUT: .Self = %Self.1
  596. // CHECK:STDOUT: .Make = %.loc5
  597. // CHECK:STDOUT: witness = (%Make.decl)
  598. // CHECK:STDOUT: }
  599. // CHECK:STDOUT: }
  600. // CHECK:STDOUT:
  601. // CHECK:STDOUT: impl @impl: %A as %.7 {
  602. // CHECK:STDOUT: %Make.decl: %Make.type.2 = fn_decl @Make.2 [template = constants.%Make.2] {} {
  603. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B]
  604. // CHECK:STDOUT: %return: ref %B = var <return slot>
  605. // CHECK:STDOUT: }
  606. // CHECK:STDOUT: %.loc11_22: <witness> = interface_witness (%Make.decl) [template = constants.%.10]
  607. // CHECK:STDOUT:
  608. // CHECK:STDOUT: !members:
  609. // CHECK:STDOUT: .Make = %Make.decl
  610. // CHECK:STDOUT: witness = %.loc11_22
  611. // CHECK:STDOUT: }
  612. // CHECK:STDOUT:
  613. // CHECK:STDOUT: class @A {
  614. // CHECK:STDOUT: %.loc8: <witness> = complete_type_witness %.5 [template = constants.%.6]
  615. // CHECK:STDOUT:
  616. // CHECK:STDOUT: !members:
  617. // CHECK:STDOUT: .Self = constants.%A
  618. // CHECK:STDOUT: }
  619. // CHECK:STDOUT:
  620. // CHECK:STDOUT: class @B {
  621. // CHECK:STDOUT: %.loc9: <witness> = complete_type_witness %.5 [template = constants.%.6]
  622. // CHECK:STDOUT:
  623. // CHECK:STDOUT: !members:
  624. // CHECK:STDOUT: .Self = constants.%B
  625. // CHECK:STDOUT: }
  626. // CHECK:STDOUT:
  627. // CHECK:STDOUT: generic fn @Make.1(@Factory.%T.loc4: type, @Factory.%Self.1: @Factory.%.1 (%.2)) {
  628. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic = %T (constants.%T)]
  629. // CHECK:STDOUT:
  630. // CHECK:STDOUT: fn() -> @Make.1.%T (%T);
  631. // CHECK:STDOUT: }
  632. // CHECK:STDOUT:
  633. // CHECK:STDOUT: fn @Make.2() -> %B;
  634. // CHECK:STDOUT:
  635. // CHECK:STDOUT: specific @Factory(constants.%T) {
  636. // CHECK:STDOUT: %T.1 => constants.%T
  637. // CHECK:STDOUT: }
  638. // CHECK:STDOUT:
  639. // CHECK:STDOUT: specific @Make.1(constants.%T, constants.%Self) {
  640. // CHECK:STDOUT: %T => constants.%T
  641. // CHECK:STDOUT: }
  642. // CHECK:STDOUT:
  643. // CHECK:STDOUT: specific @Factory(@Factory.%T.1) {
  644. // CHECK:STDOUT: %T.1 => constants.%T
  645. // CHECK:STDOUT: }
  646. // CHECK:STDOUT:
  647. // CHECK:STDOUT: specific @Factory(constants.%B) {
  648. // CHECK:STDOUT: %T.1 => constants.%B
  649. // CHECK:STDOUT:
  650. // CHECK:STDOUT: !definition:
  651. // CHECK:STDOUT: %.1 => constants.%.7
  652. // CHECK:STDOUT: %Self.2 => constants.%Self
  653. // CHECK:STDOUT: %Make.type => constants.%Make.type.3
  654. // CHECK:STDOUT: %Make => constants.%Make.3
  655. // CHECK:STDOUT: %.2 => constants.%.8
  656. // CHECK:STDOUT: %.3 => constants.%.9
  657. // CHECK:STDOUT: }
  658. // CHECK:STDOUT:
  659. // CHECK:STDOUT: specific @Make.1(constants.%B, constants.%A) {
  660. // CHECK:STDOUT: %T => constants.%B
  661. // CHECK:STDOUT: }
  662. // CHECK:STDOUT:
  663. // CHECK:STDOUT: --- factory.impl.carbon
  664. // CHECK:STDOUT:
  665. // CHECK:STDOUT: constants {
  666. // CHECK:STDOUT: %A: type = class_type @A [template]
  667. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  668. // CHECK:STDOUT: %.2: <witness> = complete_type_witness %.1 [template]
  669. // CHECK:STDOUT: %B: type = class_type @B [template]
  670. // CHECK:STDOUT: %Factory.type: type = generic_interface_type @Factory [template]
  671. // CHECK:STDOUT: %.3: type = tuple_type () [template]
  672. // CHECK:STDOUT: %Factory: %Factory.type = struct_value () [template]
  673. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic]
  674. // CHECK:STDOUT: %.4: type = interface_type @Factory, @Factory(%T) [symbolic]
  675. // CHECK:STDOUT: %Self.1: @Factory.%.1 (%.4) = bind_symbolic_name Self 1 [symbolic]
  676. // CHECK:STDOUT: %.5: type = interface_type @Factory, @Factory(%B) [template]
  677. // CHECK:STDOUT: %Self.2: %.4 = bind_symbolic_name Self 1 [symbolic]
  678. // CHECK:STDOUT: %Make.type.1: type = fn_type @Make.1, @Factory(%T) [symbolic]
  679. // CHECK:STDOUT: %Make.1: %Make.type.1 = struct_value () [symbolic]
  680. // CHECK:STDOUT: %.6: type = assoc_entity_type %.4, %Make.type.1 [symbolic]
  681. // CHECK:STDOUT: %.7: %.6 = assoc_entity element0, imports.%import_ref.9 [symbolic]
  682. // CHECK:STDOUT: %Make.type.2: type = fn_type @Make.1, @Factory(%B) [template]
  683. // CHECK:STDOUT: %Make.2: %Make.type.2 = struct_value () [template]
  684. // CHECK:STDOUT: %.8: type = assoc_entity_type %.5, %Make.type.2 [template]
  685. // CHECK:STDOUT: %.9: %.8 = assoc_entity element0, imports.%import_ref.10 [template]
  686. // CHECK:STDOUT: %MakeB.type: type = fn_type @MakeB [template]
  687. // CHECK:STDOUT: %MakeB: %MakeB.type = struct_value () [template]
  688. // CHECK:STDOUT: %.10: type = ptr_type %.1 [template]
  689. // CHECK:STDOUT: %.11: %.6 = assoc_entity element0, imports.%import_ref.12 [symbolic]
  690. // CHECK:STDOUT: %Make.type.3: type = fn_type @Make.2 [template]
  691. // CHECK:STDOUT: %Make.3: %Make.type.3 = struct_value () [template]
  692. // CHECK:STDOUT: %.12: <witness> = interface_witness (%Make.3) [template]
  693. // CHECK:STDOUT: }
  694. // CHECK:STDOUT:
  695. // CHECK:STDOUT: imports {
  696. // CHECK:STDOUT: %import_ref.1: %Factory.type = import_ref Main//factory, inst+5, loaded [template = constants.%Factory]
  697. // CHECK:STDOUT: %import_ref.2: type = import_ref Main//factory, inst+28, loaded [template = constants.%A]
  698. // CHECK:STDOUT: %import_ref.3: type = import_ref Main//factory, inst+33, loaded [template = constants.%B]
  699. // CHECK:STDOUT: %import_ref.4 = import_ref Main//factory, inst+29, unloaded
  700. // CHECK:STDOUT: %import_ref.5 = import_ref Main//factory, inst+34, unloaded
  701. // CHECK:STDOUT: %import_ref.6 = import_ref Main//factory, inst+11, unloaded
  702. // CHECK:STDOUT: %import_ref.7: @Factory.%.2 (%.6) = import_ref Main//factory, inst+20, loaded [symbolic = @Factory.%.3 (constants.%.11)]
  703. // CHECK:STDOUT: %import_ref.8 = import_ref Main//factory, inst+15, unloaded
  704. // CHECK:STDOUT: %import_ref.9 = import_ref Main//factory, inst+15, unloaded
  705. // CHECK:STDOUT: %import_ref.10 = import_ref Main//factory, inst+15, unloaded
  706. // CHECK:STDOUT: %import_ref.11: <witness> = import_ref Main//factory, inst+51, loaded [template = constants.%.12]
  707. // CHECK:STDOUT: %import_ref.12 = import_ref Main//factory, inst+15, unloaded
  708. // CHECK:STDOUT: }
  709. // CHECK:STDOUT:
  710. // CHECK:STDOUT: file {
  711. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  712. // CHECK:STDOUT: .Factory = imports.%import_ref.1
  713. // CHECK:STDOUT: .A = imports.%import_ref.2
  714. // CHECK:STDOUT: .B = imports.%import_ref.3
  715. // CHECK:STDOUT: .MakeB = %MakeB.decl
  716. // CHECK:STDOUT: }
  717. // CHECK:STDOUT: %default.import.loc2_6.1 = import <invalid>
  718. // CHECK:STDOUT: %default.import.loc2_6.2 = import <invalid>
  719. // CHECK:STDOUT: %MakeB.decl: %MakeB.type = fn_decl @MakeB [template = constants.%MakeB] {
  720. // CHECK:STDOUT: %a.patt: %A = binding_pattern a
  721. // CHECK:STDOUT: } {
  722. // CHECK:STDOUT: %A.ref: type = name_ref A, imports.%import_ref.2 [template = constants.%A]
  723. // CHECK:STDOUT: %a.param: %A = param a, runtime_param0
  724. // CHECK:STDOUT: %a: %A = bind_name a, %a.param
  725. // CHECK:STDOUT: %B.ref.loc4: type = name_ref B, imports.%import_ref.3 [template = constants.%B]
  726. // CHECK:STDOUT: %return: ref %B = var <return slot>
  727. // CHECK:STDOUT: }
  728. // CHECK:STDOUT: }
  729. // CHECK:STDOUT:
  730. // CHECK:STDOUT: generic interface @Factory(constants.%T: type) {
  731. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic = %T (constants.%T)]
  732. // CHECK:STDOUT:
  733. // CHECK:STDOUT: !definition:
  734. // CHECK:STDOUT: %.1: type = interface_type @Factory, @Factory(%T) [symbolic = %.1 (constants.%.4)]
  735. // CHECK:STDOUT: %Self: %.4 = bind_symbolic_name Self 1 [symbolic = %Self (constants.%Self.2)]
  736. // CHECK:STDOUT: %Make.type: type = fn_type @Make.1, @Factory(%T) [symbolic = %Make.type (constants.%Make.type.1)]
  737. // CHECK:STDOUT: %Make: @Factory.%Make.type (%Make.type.1) = struct_value () [symbolic = %Make (constants.%Make.1)]
  738. // CHECK:STDOUT: %.2: type = assoc_entity_type @Factory.%.1 (%.4), @Factory.%Make.type (%Make.type.1) [symbolic = %.2 (constants.%.6)]
  739. // CHECK:STDOUT: %.3: @Factory.%.2 (%.6) = assoc_entity element0, imports.%import_ref.9 [symbolic = %.3 (constants.%.7)]
  740. // CHECK:STDOUT:
  741. // CHECK:STDOUT: interface {
  742. // CHECK:STDOUT: !members:
  743. // CHECK:STDOUT: .Self = imports.%import_ref.6
  744. // CHECK:STDOUT: .Make = imports.%import_ref.7
  745. // CHECK:STDOUT: witness = (imports.%import_ref.8)
  746. // CHECK:STDOUT: }
  747. // CHECK:STDOUT: }
  748. // CHECK:STDOUT:
  749. // CHECK:STDOUT: impl @impl: %A as %.5 {
  750. // CHECK:STDOUT: !members:
  751. // CHECK:STDOUT: witness = imports.%import_ref.11
  752. // CHECK:STDOUT: }
  753. // CHECK:STDOUT:
  754. // CHECK:STDOUT: class @A {
  755. // CHECK:STDOUT: !members:
  756. // CHECK:STDOUT: .Self = imports.%import_ref.4
  757. // CHECK:STDOUT: }
  758. // CHECK:STDOUT:
  759. // CHECK:STDOUT: class @B {
  760. // CHECK:STDOUT: !members:
  761. // CHECK:STDOUT: .Self = imports.%import_ref.5
  762. // CHECK:STDOUT: }
  763. // CHECK:STDOUT:
  764. // CHECK:STDOUT: generic fn @Make.1(constants.%T: type, constants.%Self.1: @Factory.%.1 (%.4)) {
  765. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic = %T (constants.%T)]
  766. // CHECK:STDOUT:
  767. // CHECK:STDOUT: fn() -> @Make.1.%T (%T);
  768. // CHECK:STDOUT: }
  769. // CHECK:STDOUT:
  770. // CHECK:STDOUT: fn @MakeB(%a: %A) -> %return: %B {
  771. // CHECK:STDOUT: !entry:
  772. // CHECK:STDOUT: %a.ref: %A = name_ref a, %a
  773. // CHECK:STDOUT: %Factory.ref: %Factory.type = name_ref Factory, imports.%import_ref.1 [template = constants.%Factory]
  774. // CHECK:STDOUT: %B.ref.loc5: type = name_ref B, imports.%import_ref.3 [template = constants.%B]
  775. // CHECK:STDOUT: %.loc5_20: type = interface_type @Factory, @Factory(constants.%B) [template = constants.%.5]
  776. // CHECK:STDOUT: %.loc5_23: %.8 = specific_constant imports.%import_ref.7, @Factory(constants.%B) [template = constants.%.9]
  777. // CHECK:STDOUT: %Make.ref: %.8 = name_ref Make, %.loc5_23 [template = constants.%.9]
  778. // CHECK:STDOUT: %.loc5_11: %Make.type.2 = interface_witness_access imports.%import_ref.11, element0 [template = constants.%Make.3]
  779. // CHECK:STDOUT: %.loc4: ref %B = splice_block %return {}
  780. // CHECK:STDOUT: %Make.call: init %B = call %.loc5_11() to %.loc4
  781. // CHECK:STDOUT: return %Make.call to %return
  782. // CHECK:STDOUT: }
  783. // CHECK:STDOUT:
  784. // CHECK:STDOUT: fn @Make.2() -> %B;
  785. // CHECK:STDOUT:
  786. // CHECK:STDOUT: specific @Factory(constants.%T) {
  787. // CHECK:STDOUT: %T => constants.%T
  788. // CHECK:STDOUT: }
  789. // CHECK:STDOUT:
  790. // CHECK:STDOUT: specific @Factory(constants.%B) {
  791. // CHECK:STDOUT: %T => constants.%B
  792. // CHECK:STDOUT:
  793. // CHECK:STDOUT: !definition:
  794. // CHECK:STDOUT: %.1 => constants.%.5
  795. // CHECK:STDOUT: %Self => constants.%Self.2
  796. // CHECK:STDOUT: %Make.type => constants.%Make.type.2
  797. // CHECK:STDOUT: %Make => constants.%Make.2
  798. // CHECK:STDOUT: %.2 => constants.%.8
  799. // CHECK:STDOUT: %.3 => constants.%.9
  800. // CHECK:STDOUT: }
  801. // CHECK:STDOUT:
  802. // CHECK:STDOUT: specific @Factory(@Factory.%T) {
  803. // CHECK:STDOUT: %T => constants.%T
  804. // CHECK:STDOUT: }
  805. // CHECK:STDOUT:
  806. // CHECK:STDOUT: specific @Make.1(constants.%T, constants.%Self.1) {
  807. // CHECK:STDOUT: %T => constants.%T
  808. // CHECK:STDOUT: }
  809. // CHECK:STDOUT:
  810. // CHECK:STDOUT: --- fail_factory.impl.carbon
  811. // CHECK:STDOUT:
  812. // CHECK:STDOUT: constants {
  813. // CHECK:STDOUT: %A: type = class_type @A [template]
  814. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  815. // CHECK:STDOUT: %.2: <witness> = complete_type_witness %.1 [template]
  816. // CHECK:STDOUT: %B: type = class_type @B [template]
  817. // CHECK:STDOUT: %Factory.type: type = generic_interface_type @Factory [template]
  818. // CHECK:STDOUT: %.3: type = tuple_type () [template]
  819. // CHECK:STDOUT: %Factory: %Factory.type = struct_value () [template]
  820. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic]
  821. // CHECK:STDOUT: %.4: type = interface_type @Factory, @Factory(%T) [symbolic]
  822. // CHECK:STDOUT: %Self.1: @Factory.%.1 (%.4) = bind_symbolic_name Self 1 [symbolic]
  823. // CHECK:STDOUT: %.5: type = interface_type @Factory, @Factory(%B) [template]
  824. // CHECK:STDOUT: %Self.2: %.4 = bind_symbolic_name Self 1 [symbolic]
  825. // CHECK:STDOUT: %Make.type.1: type = fn_type @Make, @Factory(%T) [symbolic]
  826. // CHECK:STDOUT: %Make.1: %Make.type.1 = struct_value () [symbolic]
  827. // CHECK:STDOUT: %.6: type = assoc_entity_type %.4, %Make.type.1 [symbolic]
  828. // CHECK:STDOUT: %.7: %.6 = assoc_entity element0, imports.%import_ref.9 [symbolic]
  829. // CHECK:STDOUT: %Make.type.2: type = fn_type @Make, @Factory(%B) [template]
  830. // CHECK:STDOUT: %Make.2: %Make.type.2 = struct_value () [template]
  831. // CHECK:STDOUT: %.8: type = assoc_entity_type %.5, %Make.type.2 [template]
  832. // CHECK:STDOUT: %.9: %.8 = assoc_entity element0, imports.%import_ref.10 [template]
  833. // CHECK:STDOUT: %C: type = class_type @C [template]
  834. // CHECK:STDOUT: %MakeC.type: type = fn_type @MakeC [template]
  835. // CHECK:STDOUT: %MakeC: %MakeC.type = struct_value () [template]
  836. // CHECK:STDOUT: %.10: type = ptr_type %.1 [template]
  837. // CHECK:STDOUT: %.11: type = interface_type @Factory, @Factory(%C) [template]
  838. // CHECK:STDOUT: %Make.type.3: type = fn_type @Make, @Factory(%C) [template]
  839. // CHECK:STDOUT: %Make.3: %Make.type.3 = struct_value () [template]
  840. // CHECK:STDOUT: %.12: type = assoc_entity_type %.11, %Make.type.3 [template]
  841. // CHECK:STDOUT: %.13: %.12 = assoc_entity element0, imports.%import_ref.9 [template]
  842. // CHECK:STDOUT: %.14: %.6 = assoc_entity element0, imports.%import_ref.12 [symbolic]
  843. // CHECK:STDOUT: }
  844. // CHECK:STDOUT:
  845. // CHECK:STDOUT: imports {
  846. // CHECK:STDOUT: %import_ref.1: %Factory.type = import_ref Main//factory, inst+5, loaded [template = constants.%Factory]
  847. // CHECK:STDOUT: %import_ref.2: type = import_ref Main//factory, inst+28, loaded [template = constants.%A]
  848. // CHECK:STDOUT: %import_ref.3 = import_ref Main//factory, inst+33, unloaded
  849. // CHECK:STDOUT: %import_ref.4 = import_ref Main//factory, inst+29, unloaded
  850. // CHECK:STDOUT: %import_ref.5 = import_ref Main//factory, inst+34, unloaded
  851. // CHECK:STDOUT: %import_ref.6 = import_ref Main//factory, inst+11, unloaded
  852. // CHECK:STDOUT: %import_ref.7: @Factory.%.2 (%.6) = import_ref Main//factory, inst+20, loaded [symbolic = @Factory.%.3 (constants.%.14)]
  853. // CHECK:STDOUT: %import_ref.8 = import_ref Main//factory, inst+15, unloaded
  854. // CHECK:STDOUT: %import_ref.9 = import_ref Main//factory, inst+15, unloaded
  855. // CHECK:STDOUT: %import_ref.10 = import_ref Main//factory, inst+15, unloaded
  856. // CHECK:STDOUT: %import_ref.11 = import_ref Main//factory, inst+51, unloaded
  857. // CHECK:STDOUT: %import_ref.12 = import_ref Main//factory, inst+15, unloaded
  858. // CHECK:STDOUT: }
  859. // CHECK:STDOUT:
  860. // CHECK:STDOUT: file {
  861. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  862. // CHECK:STDOUT: .Factory = imports.%import_ref.1
  863. // CHECK:STDOUT: .A = imports.%import_ref.2
  864. // CHECK:STDOUT: .B = imports.%import_ref.3
  865. // CHECK:STDOUT: .C = %C.decl
  866. // CHECK:STDOUT: .MakeC = %MakeC.decl
  867. // CHECK:STDOUT: }
  868. // CHECK:STDOUT: %default.import.loc2_6.1 = import <invalid>
  869. // CHECK:STDOUT: %default.import.loc2_6.2 = import <invalid>
  870. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  871. // CHECK:STDOUT: %MakeC.decl: %MakeC.type = fn_decl @MakeC [template = constants.%MakeC] {
  872. // CHECK:STDOUT: %a.patt: %A = binding_pattern a
  873. // CHECK:STDOUT: } {
  874. // CHECK:STDOUT: %A.ref: type = name_ref A, imports.%import_ref.2 [template = constants.%A]
  875. // CHECK:STDOUT: %a.param: %A = param a, runtime_param0
  876. // CHECK:STDOUT: %a: %A = bind_name a, %a.param
  877. // CHECK:STDOUT: %C.ref.loc6: type = name_ref C, file.%C.decl [template = constants.%C]
  878. // CHECK:STDOUT: %return: ref %C = var <return slot>
  879. // CHECK:STDOUT: }
  880. // CHECK:STDOUT: }
  881. // CHECK:STDOUT:
  882. // CHECK:STDOUT: generic interface @Factory(constants.%T: type) {
  883. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic = %T (constants.%T)]
  884. // CHECK:STDOUT:
  885. // CHECK:STDOUT: !definition:
  886. // CHECK:STDOUT: %.1: type = interface_type @Factory, @Factory(%T) [symbolic = %.1 (constants.%.4)]
  887. // CHECK:STDOUT: %Self: %.4 = bind_symbolic_name Self 1 [symbolic = %Self (constants.%Self.2)]
  888. // CHECK:STDOUT: %Make.type: type = fn_type @Make, @Factory(%T) [symbolic = %Make.type (constants.%Make.type.1)]
  889. // CHECK:STDOUT: %Make: @Factory.%Make.type (%Make.type.1) = struct_value () [symbolic = %Make (constants.%Make.1)]
  890. // CHECK:STDOUT: %.2: type = assoc_entity_type @Factory.%.1 (%.4), @Factory.%Make.type (%Make.type.1) [symbolic = %.2 (constants.%.6)]
  891. // CHECK:STDOUT: %.3: @Factory.%.2 (%.6) = assoc_entity element0, imports.%import_ref.9 [symbolic = %.3 (constants.%.7)]
  892. // CHECK:STDOUT:
  893. // CHECK:STDOUT: interface {
  894. // CHECK:STDOUT: !members:
  895. // CHECK:STDOUT: .Self = imports.%import_ref.6
  896. // CHECK:STDOUT: .Make = imports.%import_ref.7
  897. // CHECK:STDOUT: witness = (imports.%import_ref.8)
  898. // CHECK:STDOUT: }
  899. // CHECK:STDOUT: }
  900. // CHECK:STDOUT:
  901. // CHECK:STDOUT: impl @impl: %A as %.5 {
  902. // CHECK:STDOUT: !members:
  903. // CHECK:STDOUT: witness = imports.%import_ref.11
  904. // CHECK:STDOUT: }
  905. // CHECK:STDOUT:
  906. // CHECK:STDOUT: class @A {
  907. // CHECK:STDOUT: !members:
  908. // CHECK:STDOUT: .Self = imports.%import_ref.4
  909. // CHECK:STDOUT: }
  910. // CHECK:STDOUT:
  911. // CHECK:STDOUT: class @B {
  912. // CHECK:STDOUT: !members:
  913. // CHECK:STDOUT: .Self = imports.%import_ref.5
  914. // CHECK:STDOUT: }
  915. // CHECK:STDOUT:
  916. // CHECK:STDOUT: class @C {
  917. // CHECK:STDOUT: %.loc4: <witness> = complete_type_witness %.1 [template = constants.%.2]
  918. // CHECK:STDOUT:
  919. // CHECK:STDOUT: !members:
  920. // CHECK:STDOUT: .Self = constants.%C
  921. // CHECK:STDOUT: }
  922. // CHECK:STDOUT:
  923. // CHECK:STDOUT: generic fn @Make(constants.%T: type, constants.%Self.1: @Factory.%.1 (%.4)) {
  924. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic = %T (constants.%T)]
  925. // CHECK:STDOUT:
  926. // CHECK:STDOUT: fn() -> @Make.%T (%T);
  927. // CHECK:STDOUT: }
  928. // CHECK:STDOUT:
  929. // CHECK:STDOUT: fn @MakeC(%a: %A) -> %return: %C {
  930. // CHECK:STDOUT: !entry:
  931. // CHECK:STDOUT: %a.ref: %A = name_ref a, %a
  932. // CHECK:STDOUT: %Factory.ref: %Factory.type = name_ref Factory, imports.%import_ref.1 [template = constants.%Factory]
  933. // CHECK:STDOUT: %C.ref.loc10: type = name_ref C, file.%C.decl [template = constants.%C]
  934. // CHECK:STDOUT: %.loc10_20: type = interface_type @Factory, @Factory(constants.%C) [template = constants.%.11]
  935. // CHECK:STDOUT: %.loc10_23: %.12 = specific_constant imports.%import_ref.7, @Factory(constants.%C) [template = constants.%.13]
  936. // CHECK:STDOUT: %Make.ref: %.12 = name_ref Make, %.loc10_23 [template = constants.%.13]
  937. // CHECK:STDOUT: return <error> to %return
  938. // CHECK:STDOUT: }
  939. // CHECK:STDOUT:
  940. // CHECK:STDOUT: specific @Factory(constants.%T) {
  941. // CHECK:STDOUT: %T => constants.%T
  942. // CHECK:STDOUT: }
  943. // CHECK:STDOUT:
  944. // CHECK:STDOUT: specific @Factory(constants.%B) {
  945. // CHECK:STDOUT: %T => constants.%B
  946. // CHECK:STDOUT:
  947. // CHECK:STDOUT: !definition:
  948. // CHECK:STDOUT: %.1 => constants.%.5
  949. // CHECK:STDOUT: %Self => constants.%Self.2
  950. // CHECK:STDOUT: %Make.type => constants.%Make.type.2
  951. // CHECK:STDOUT: %Make => constants.%Make.2
  952. // CHECK:STDOUT: %.2 => constants.%.8
  953. // CHECK:STDOUT: %.3 => constants.%.9
  954. // CHECK:STDOUT: }
  955. // CHECK:STDOUT:
  956. // CHECK:STDOUT: specific @Factory(@Factory.%T) {
  957. // CHECK:STDOUT: %T => constants.%T
  958. // CHECK:STDOUT: }
  959. // CHECK:STDOUT:
  960. // CHECK:STDOUT: specific @Make(constants.%T, constants.%Self.1) {
  961. // CHECK:STDOUT: %T => constants.%T
  962. // CHECK:STDOUT: }
  963. // CHECK:STDOUT:
  964. // CHECK:STDOUT: specific @Factory(constants.%C) {
  965. // CHECK:STDOUT: %T => constants.%C
  966. // CHECK:STDOUT:
  967. // CHECK:STDOUT: !definition:
  968. // CHECK:STDOUT: %.1 => constants.%.11
  969. // CHECK:STDOUT: %Self => constants.%Self.2
  970. // CHECK:STDOUT: %Make.type => constants.%Make.type.3
  971. // CHECK:STDOUT: %Make => constants.%Make.3
  972. // CHECK:STDOUT: %.2 => constants.%.12
  973. // CHECK:STDOUT: %.3 => constants.%.13
  974. // CHECK:STDOUT: }
  975. // CHECK:STDOUT: