interface_args.carbon 47 KB

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