interface_args.carbon 49 KB

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