interface_args.carbon 105 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/destroy.carbon
  6. // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
  7. // EXTRA-ARGS: --dump-sem-ir-ranges=if-present
  8. //
  9. // AUTOUPDATE
  10. // TIP: To test this file alone, run:
  11. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/interface_args.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/interface_args.carbon
  14. // --- core.carbon
  15. package Core;
  16. interface ImplicitAs(Dest:! type) {
  17. fn Convert[self: Self]() -> Dest;
  18. }
  19. // --- action.carbon
  20. library "[[@TEST_NAME]]";
  21. interface Action(T:! type) {
  22. fn Op[self: Self]();
  23. }
  24. class A {}
  25. class B {}
  26. class C {}
  27. impl A as Action(B) {
  28. fn Op[self: Self]() {}
  29. }
  30. fn F(a: A) { a.(Action(B).Op)(); }
  31. // --- action.impl.carbon
  32. impl library "[[@TEST_NAME]]";
  33. fn G(a: A) { a.(Action(B).Op)(); }
  34. // --- fail_action.impl.carbon
  35. impl library "[[@TEST_NAME]]";
  36. // CHECK:STDERR: fail_action.impl.carbon:[[@LINE+4]]:14: error: cannot access member of interface `Action(C)` in type `A` that does not implement that interface [MissingImplInMemberAccess]
  37. // CHECK:STDERR: fn G(a: A) { a.(Action(C).Op)(); }
  38. // CHECK:STDERR: ^~~~~~~~~~~~~~~~
  39. // CHECK:STDERR:
  40. fn G(a: A) { a.(Action(C).Op)(); }
  41. // --- factory.carbon
  42. library "[[@TEST_NAME]]";
  43. interface Factory(T:! type) {
  44. // Non-instance class function
  45. fn Make() -> T;
  46. // Instance method
  47. fn Method[self: Self]() -> T;
  48. }
  49. class A {}
  50. class B {}
  51. impl A as Factory(B) {
  52. fn Make() -> B;
  53. fn Method[self: Self]() -> B;
  54. }
  55. // --- factory.impl.carbon
  56. impl library "[[@TEST_NAME]]";
  57. fn MakeB() -> B {
  58. return A.(Factory(B).Make)();
  59. }
  60. fn InstanceB(a: A) -> B {
  61. return a.(Factory(B).Method)();
  62. }
  63. // --- fail_factory.impl.carbon
  64. impl library "[[@TEST_NAME]]";
  65. import Core;
  66. class C {}
  67. fn MakeC() -> C {
  68. // CHECK:STDERR: fail_factory.impl.carbon:[[@LINE+4]]:10: error: cannot convert type `A` into type implementing `Factory(C)` [ConversionFailureTypeToFacet]
  69. // CHECK:STDERR: return A.(Factory(C).Make)();
  70. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
  71. // CHECK:STDERR:
  72. return A.(Factory(C).Make)();
  73. }
  74. fn InstanceC(a: A) -> C {
  75. // CHECK:STDERR: fail_factory.impl.carbon:[[@LINE+4]]:10: error: cannot access member of interface `Factory(C)` in type `A` that does not implement that interface [MissingImplInMemberAccess]
  76. // CHECK:STDERR: return a.(Factory(C).Method)();
  77. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
  78. // CHECK:STDERR:
  79. return a.(Factory(C).Method)();
  80. }
  81. // CHECK:STDOUT: --- core.carbon
  82. // CHECK:STDOUT:
  83. // CHECK:STDOUT: constants {
  84. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  85. // CHECK:STDOUT: %.Self: %type = bind_symbolic_name .Self [symbolic_self]
  86. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic]
  87. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  88. // CHECK:STDOUT: %ImplicitAs.type.96f: type = generic_interface_type @ImplicitAs [concrete]
  89. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.96f = struct_value () [concrete]
  90. // CHECK:STDOUT: %ImplicitAs.type.3ac: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic]
  91. // CHECK:STDOUT: %Self: %ImplicitAs.type.3ac = bind_symbolic_name Self, 1 [symbolic]
  92. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self [symbolic]
  93. // CHECK:STDOUT: %pattern_type.f6d: type = pattern_type %Self.binding.as_type [symbolic]
  94. // CHECK:STDOUT: %pattern_type.7dc: type = pattern_type %Dest [symbolic]
  95. // CHECK:STDOUT: %ImplicitAs.Convert.type: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%Dest) [symbolic]
  96. // CHECK:STDOUT: %ImplicitAs.Convert: %ImplicitAs.Convert.type = struct_value () [symbolic]
  97. // CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic]
  98. // CHECK:STDOUT: %assoc0: %ImplicitAs.assoc_type = assoc_entity element0, @ImplicitAs.%ImplicitAs.Convert.decl [symbolic]
  99. // CHECK:STDOUT: }
  100. // CHECK:STDOUT:
  101. // CHECK:STDOUT: file {
  102. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  103. // CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl
  104. // CHECK:STDOUT: }
  105. // CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.96f = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] {
  106. // CHECK:STDOUT: %Dest.patt: %pattern_type.98f = symbolic_binding_pattern Dest, 0 [concrete]
  107. // CHECK:STDOUT: } {
  108. // CHECK:STDOUT: %.Self: %type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  109. // CHECK:STDOUT: %Dest.loc3_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc3_22.1 (constants.%Dest)]
  110. // CHECK:STDOUT: }
  111. // CHECK:STDOUT: }
  112. // CHECK:STDOUT:
  113. // CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc3_22.2: type) {
  114. // CHECK:STDOUT: %Dest.loc3_22.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc3_22.1 (constants.%Dest)]
  115. // CHECK:STDOUT:
  116. // CHECK:STDOUT: !definition:
  117. // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc3_22.1)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.3ac)]
  118. // CHECK:STDOUT: %Self.2: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.3ac) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)]
  119. // CHECK:STDOUT: %ImplicitAs.Convert.type: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%Dest.loc3_22.1) [symbolic = %ImplicitAs.Convert.type (constants.%ImplicitAs.Convert.type)]
  120. // CHECK:STDOUT: %ImplicitAs.Convert: @ImplicitAs.%ImplicitAs.Convert.type (%ImplicitAs.Convert.type) = struct_value () [symbolic = %ImplicitAs.Convert (constants.%ImplicitAs.Convert)]
  121. // CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs, @ImplicitAs(%Dest.loc3_22.1) [symbolic = %ImplicitAs.assoc_type (constants.%ImplicitAs.assoc_type)]
  122. // CHECK:STDOUT: %assoc0.loc4_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %ImplicitAs.Convert.decl [symbolic = %assoc0.loc4_35.2 (constants.%assoc0)]
  123. // CHECK:STDOUT:
  124. // CHECK:STDOUT: interface {
  125. // CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.3ac) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)]
  126. // CHECK:STDOUT: %ImplicitAs.Convert.decl: @ImplicitAs.%ImplicitAs.Convert.type (%ImplicitAs.Convert.type) = fn_decl @ImplicitAs.Convert [symbolic = @ImplicitAs.%ImplicitAs.Convert (constants.%ImplicitAs.Convert)] {
  127. // CHECK:STDOUT: %self.patt: @ImplicitAs.Convert.%pattern_type.loc4_14 (%pattern_type.f6d) = binding_pattern self [concrete]
  128. // CHECK:STDOUT: %self.param_patt: @ImplicitAs.Convert.%pattern_type.loc4_14 (%pattern_type.f6d) = value_param_pattern %self.patt, call_param0 [concrete]
  129. // CHECK:STDOUT: %return.patt: @ImplicitAs.Convert.%pattern_type.loc4_28 (%pattern_type.7dc) = return_slot_pattern [concrete]
  130. // CHECK:STDOUT: %return.param_patt: @ImplicitAs.Convert.%pattern_type.loc4_28 (%pattern_type.7dc) = out_param_pattern %return.patt, call_param1 [concrete]
  131. // CHECK:STDOUT: } {
  132. // CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc3_22.2 [symbolic = %Dest (constants.%Dest)]
  133. // CHECK:STDOUT: %self.param: @ImplicitAs.Convert.%Self.binding.as_type (%Self.binding.as_type) = value_param call_param0
  134. // CHECK:STDOUT: %.loc4_20.1: type = splice_block %.loc4_20.3 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] {
  135. // CHECK:STDOUT: %.loc4_20.2: @ImplicitAs.Convert.%ImplicitAs.type (%ImplicitAs.type.3ac) = specific_constant @ImplicitAs.%Self.1, @ImplicitAs(constants.%Dest) [symbolic = %Self (constants.%Self)]
  136. // CHECK:STDOUT: %Self.ref: @ImplicitAs.Convert.%ImplicitAs.type (%ImplicitAs.type.3ac) = name_ref Self, %.loc4_20.2 [symbolic = %Self (constants.%Self)]
  137. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.ref [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  138. // CHECK:STDOUT: %.loc4_20.3: type = converted %Self.ref, %Self.as_type [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  139. // CHECK:STDOUT: }
  140. // CHECK:STDOUT: %self: @ImplicitAs.Convert.%Self.binding.as_type (%Self.binding.as_type) = bind_name self, %self.param
  141. // CHECK:STDOUT: %return.param: ref @ImplicitAs.Convert.%Dest (%Dest) = out_param call_param1
  142. // CHECK:STDOUT: %return: ref @ImplicitAs.Convert.%Dest (%Dest) = return_slot %return.param
  143. // CHECK:STDOUT: }
  144. // CHECK:STDOUT: %assoc0.loc4_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %ImplicitAs.Convert.decl [symbolic = %assoc0.loc4_35.2 (constants.%assoc0)]
  145. // CHECK:STDOUT:
  146. // CHECK:STDOUT: !members:
  147. // CHECK:STDOUT: .Self = %Self.1
  148. // CHECK:STDOUT: .Dest = <poisoned>
  149. // CHECK:STDOUT: .Convert = %assoc0.loc4_35.1
  150. // CHECK:STDOUT: witness = (%ImplicitAs.Convert.decl)
  151. // CHECK:STDOUT: }
  152. // CHECK:STDOUT: }
  153. // CHECK:STDOUT:
  154. // CHECK:STDOUT: generic fn @ImplicitAs.Convert(@ImplicitAs.%Dest.loc3_22.2: type, @ImplicitAs.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.3ac)) {
  155. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
  156. // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.3ac)]
  157. // CHECK:STDOUT: %Self: @ImplicitAs.Convert.%ImplicitAs.type (%ImplicitAs.type.3ac) = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)]
  158. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  159. // CHECK:STDOUT: %pattern_type.loc4_14: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type.loc4_14 (constants.%pattern_type.f6d)]
  160. // CHECK:STDOUT: %pattern_type.loc4_28: type = pattern_type %Dest [symbolic = %pattern_type.loc4_28 (constants.%pattern_type.7dc)]
  161. // CHECK:STDOUT:
  162. // CHECK:STDOUT: fn(%self.param: @ImplicitAs.Convert.%Self.binding.as_type (%Self.binding.as_type)) -> @ImplicitAs.Convert.%Dest (%Dest);
  163. // CHECK:STDOUT: }
  164. // CHECK:STDOUT:
  165. // CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) {
  166. // CHECK:STDOUT: %Dest.loc3_22.1 => constants.%Dest
  167. // CHECK:STDOUT: }
  168. // CHECK:STDOUT:
  169. // CHECK:STDOUT: specific @ImplicitAs.Convert(constants.%Dest, constants.%Self) {
  170. // CHECK:STDOUT: %Dest => constants.%Dest
  171. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3ac
  172. // CHECK:STDOUT: %Self => constants.%Self
  173. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  174. // CHECK:STDOUT: %pattern_type.loc4_14 => constants.%pattern_type.f6d
  175. // CHECK:STDOUT: %pattern_type.loc4_28 => constants.%pattern_type.7dc
  176. // CHECK:STDOUT: }
  177. // CHECK:STDOUT:
  178. // CHECK:STDOUT: --- action.carbon
  179. // CHECK:STDOUT:
  180. // CHECK:STDOUT: constants {
  181. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  182. // CHECK:STDOUT: %.Self: %type = bind_symbolic_name .Self [symbolic_self]
  183. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  184. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  185. // CHECK:STDOUT: %Action.type.29c: type = generic_interface_type @Action [concrete]
  186. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  187. // CHECK:STDOUT: %Action.generic: %Action.type.29c = struct_value () [concrete]
  188. // CHECK:STDOUT: %Action.type.aff: type = facet_type <@Action, @Action(%T)> [symbolic]
  189. // CHECK:STDOUT: %Self.2f4: %Action.type.aff = bind_symbolic_name Self, 1 [symbolic]
  190. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self.2f4 [symbolic]
  191. // CHECK:STDOUT: %pattern_type.4a4: type = pattern_type %Self.binding.as_type [symbolic]
  192. // CHECK:STDOUT: %Action.Op.type.036: type = fn_type @Action.Op, @Action(%T) [symbolic]
  193. // CHECK:STDOUT: %Action.Op.6ed: %Action.Op.type.036 = struct_value () [symbolic]
  194. // CHECK:STDOUT: %Action.assoc_type.32e: type = assoc_entity_type @Action, @Action(%T) [symbolic]
  195. // CHECK:STDOUT: %assoc0.268: %Action.assoc_type.32e = assoc_entity element0, @Action.%Action.Op.decl [symbolic]
  196. // CHECK:STDOUT: %A: type = class_type @A [concrete]
  197. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  198. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  199. // CHECK:STDOUT: %B: type = class_type @B [concrete]
  200. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  201. // CHECK:STDOUT: %Action.type.74f: type = facet_type <@Action, @Action(%B)> [concrete]
  202. // CHECK:STDOUT: %Self.4b7: %Action.type.74f = bind_symbolic_name Self, 1 [symbolic]
  203. // CHECK:STDOUT: %Action.Op.type.54d: type = fn_type @Action.Op, @Action(%B) [concrete]
  204. // CHECK:STDOUT: %Action.Op.dba: %Action.Op.type.54d = struct_value () [concrete]
  205. // CHECK:STDOUT: %Action.assoc_type.4ee: type = assoc_entity_type @Action, @Action(%B) [concrete]
  206. // CHECK:STDOUT: %assoc0.f3b: %Action.assoc_type.4ee = assoc_entity element0, @Action.%Action.Op.decl [concrete]
  207. // CHECK:STDOUT: %Action.impl_witness: <witness> = impl_witness file.%Action.impl_witness_table [concrete]
  208. // CHECK:STDOUT: %pattern_type.c10: type = pattern_type %A [concrete]
  209. // CHECK:STDOUT: %A.as.Action.impl.Op.type: type = fn_type @A.as.Action.impl.Op [concrete]
  210. // CHECK:STDOUT: %A.as.Action.impl.Op: %A.as.Action.impl.Op.type = struct_value () [concrete]
  211. // CHECK:STDOUT: %Action.facet: %Action.type.74f = facet_value %A, (%Action.impl_witness) [concrete]
  212. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  213. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  214. // CHECK:STDOUT: %.db8: type = fn_type_with_self_type %Action.Op.type.54d, %Action.facet [concrete]
  215. // CHECK:STDOUT: }
  216. // CHECK:STDOUT:
  217. // CHECK:STDOUT: imports {
  218. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  219. // CHECK:STDOUT: import Core//prelude
  220. // CHECK:STDOUT: import Core//prelude/...
  221. // CHECK:STDOUT: }
  222. // CHECK:STDOUT: }
  223. // CHECK:STDOUT:
  224. // CHECK:STDOUT: file {
  225. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  226. // CHECK:STDOUT: .Core = imports.%Core
  227. // CHECK:STDOUT: .Action = %Action.decl
  228. // CHECK:STDOUT: .A = %A.decl
  229. // CHECK:STDOUT: .B = %B.decl
  230. // CHECK:STDOUT: .C = %C.decl
  231. // CHECK:STDOUT: .F = %F.decl
  232. // CHECK:STDOUT: }
  233. // CHECK:STDOUT: %Core.import = import Core
  234. // CHECK:STDOUT: %Action.decl: %Action.type.29c = interface_decl @Action [concrete = constants.%Action.generic] {
  235. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  236. // CHECK:STDOUT: } {
  237. // CHECK:STDOUT: %.Self: %type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  238. // CHECK:STDOUT: %T.loc4_18.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_18.1 (constants.%T)]
  239. // CHECK:STDOUT: }
  240. // CHECK:STDOUT: %A.decl: type = class_decl @A [concrete = constants.%A] {} {}
  241. // CHECK:STDOUT: %B.decl: type = class_decl @B [concrete = constants.%B] {} {}
  242. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  243. // CHECK:STDOUT: impl_decl @A.as.Action.impl [concrete] {} {
  244. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A]
  245. // CHECK:STDOUT: %Action.ref: %Action.type.29c = name_ref Action, file.%Action.decl [concrete = constants.%Action.generic]
  246. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B]
  247. // CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(constants.%B)> [concrete = constants.%Action.type.74f]
  248. // CHECK:STDOUT: }
  249. // CHECK:STDOUT: %Action.impl_witness_table = impl_witness_table (@A.as.Action.impl.%A.as.Action.impl.Op.decl), @A.as.Action.impl [concrete]
  250. // CHECK:STDOUT: %Action.impl_witness: <witness> = impl_witness %Action.impl_witness_table [concrete = constants.%Action.impl_witness]
  251. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  252. // CHECK:STDOUT: %a.patt: %pattern_type.c10 = binding_pattern a [concrete]
  253. // CHECK:STDOUT: %a.param_patt: %pattern_type.c10 = value_param_pattern %a.patt, call_param0 [concrete]
  254. // CHECK:STDOUT: } {
  255. // CHECK:STDOUT: %a.param: %A = value_param call_param0
  256. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A]
  257. // CHECK:STDOUT: %a: %A = bind_name a, %a.param
  258. // CHECK:STDOUT: }
  259. // CHECK:STDOUT: }
  260. // CHECK:STDOUT:
  261. // CHECK:STDOUT: generic interface @Action(%T.loc4_18.2: type) {
  262. // CHECK:STDOUT: %T.loc4_18.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_18.1 (constants.%T)]
  263. // CHECK:STDOUT:
  264. // CHECK:STDOUT: !definition:
  265. // CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(%T.loc4_18.1)> [symbolic = %Action.type (constants.%Action.type.aff)]
  266. // CHECK:STDOUT: %Self.2: @Action.%Action.type (%Action.type.aff) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.2f4)]
  267. // CHECK:STDOUT: %Action.Op.type: type = fn_type @Action.Op, @Action(%T.loc4_18.1) [symbolic = %Action.Op.type (constants.%Action.Op.type.036)]
  268. // CHECK:STDOUT: %Action.Op: @Action.%Action.Op.type (%Action.Op.type.036) = struct_value () [symbolic = %Action.Op (constants.%Action.Op.6ed)]
  269. // CHECK:STDOUT: %Action.assoc_type: type = assoc_entity_type @Action, @Action(%T.loc4_18.1) [symbolic = %Action.assoc_type (constants.%Action.assoc_type.32e)]
  270. // CHECK:STDOUT: %assoc0.loc5_22.2: @Action.%Action.assoc_type (%Action.assoc_type.32e) = assoc_entity element0, %Action.Op.decl [symbolic = %assoc0.loc5_22.2 (constants.%assoc0.268)]
  271. // CHECK:STDOUT:
  272. // CHECK:STDOUT: interface {
  273. // CHECK:STDOUT: %Self.1: @Action.%Action.type (%Action.type.aff) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.2f4)]
  274. // CHECK:STDOUT: %Action.Op.decl: @Action.%Action.Op.type (%Action.Op.type.036) = fn_decl @Action.Op [symbolic = @Action.%Action.Op (constants.%Action.Op.6ed)] {
  275. // CHECK:STDOUT: %self.patt: @Action.Op.%pattern_type (%pattern_type.4a4) = binding_pattern self [concrete]
  276. // CHECK:STDOUT: %self.param_patt: @Action.Op.%pattern_type (%pattern_type.4a4) = value_param_pattern %self.patt, call_param0 [concrete]
  277. // CHECK:STDOUT: } {
  278. // CHECK:STDOUT: %self.param: @Action.Op.%Self.binding.as_type (%Self.binding.as_type) = value_param call_param0
  279. // CHECK:STDOUT: %.loc5_15.1: type = splice_block %.loc5_15.3 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] {
  280. // CHECK:STDOUT: %.loc5_15.2: @Action.Op.%Action.type (%Action.type.aff) = specific_constant @Action.%Self.1, @Action(constants.%T) [symbolic = %Self (constants.%Self.2f4)]
  281. // CHECK:STDOUT: %Self.ref: @Action.Op.%Action.type (%Action.type.aff) = name_ref Self, %.loc5_15.2 [symbolic = %Self (constants.%Self.2f4)]
  282. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.ref [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  283. // CHECK:STDOUT: %.loc5_15.3: type = converted %Self.ref, %Self.as_type [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  284. // CHECK:STDOUT: }
  285. // CHECK:STDOUT: %self: @Action.Op.%Self.binding.as_type (%Self.binding.as_type) = bind_name self, %self.param
  286. // CHECK:STDOUT: }
  287. // CHECK:STDOUT: %assoc0.loc5_22.1: @Action.%Action.assoc_type (%Action.assoc_type.32e) = assoc_entity element0, %Action.Op.decl [symbolic = %assoc0.loc5_22.2 (constants.%assoc0.268)]
  288. // CHECK:STDOUT:
  289. // CHECK:STDOUT: !members:
  290. // CHECK:STDOUT: .Self = %Self.1
  291. // CHECK:STDOUT: .Op = %assoc0.loc5_22.1
  292. // CHECK:STDOUT: witness = (%Action.Op.decl)
  293. // CHECK:STDOUT: }
  294. // CHECK:STDOUT: }
  295. // CHECK:STDOUT:
  296. // CHECK:STDOUT: impl @A.as.Action.impl: %A.ref as %Action.type {
  297. // CHECK:STDOUT: %A.as.Action.impl.Op.decl: %A.as.Action.impl.Op.type = fn_decl @A.as.Action.impl.Op [concrete = constants.%A.as.Action.impl.Op] {
  298. // CHECK:STDOUT: %self.patt: %pattern_type.c10 = binding_pattern self [concrete]
  299. // CHECK:STDOUT: %self.param_patt: %pattern_type.c10 = value_param_pattern %self.patt, call_param0 [concrete]
  300. // CHECK:STDOUT: } {
  301. // CHECK:STDOUT: %self.param: %A = value_param call_param0
  302. // CHECK:STDOUT: %Self.ref: type = name_ref Self, @A.as.Action.impl.%A.ref [concrete = constants.%A]
  303. // CHECK:STDOUT: %self: %A = bind_name self, %self.param
  304. // CHECK:STDOUT: }
  305. // CHECK:STDOUT:
  306. // CHECK:STDOUT: !members:
  307. // CHECK:STDOUT: .Op = %A.as.Action.impl.Op.decl
  308. // CHECK:STDOUT: witness = file.%Action.impl_witness
  309. // CHECK:STDOUT: }
  310. // CHECK:STDOUT:
  311. // CHECK:STDOUT: class @A {
  312. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  313. // CHECK:STDOUT: complete_type_witness = %complete_type
  314. // CHECK:STDOUT:
  315. // CHECK:STDOUT: !members:
  316. // CHECK:STDOUT: .Self = constants.%A
  317. // CHECK:STDOUT: }
  318. // CHECK:STDOUT:
  319. // CHECK:STDOUT: class @B {
  320. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  321. // CHECK:STDOUT: complete_type_witness = %complete_type
  322. // CHECK:STDOUT:
  323. // CHECK:STDOUT: !members:
  324. // CHECK:STDOUT: .Self = constants.%B
  325. // CHECK:STDOUT: }
  326. // CHECK:STDOUT:
  327. // CHECK:STDOUT: class @C {
  328. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  329. // CHECK:STDOUT: complete_type_witness = %complete_type
  330. // CHECK:STDOUT:
  331. // CHECK:STDOUT: !members:
  332. // CHECK:STDOUT: .Self = constants.%C
  333. // CHECK:STDOUT: }
  334. // CHECK:STDOUT:
  335. // CHECK:STDOUT: generic fn @Action.Op(@Action.%T.loc4_18.2: type, @Action.%Self.1: @Action.%Action.type (%Action.type.aff)) {
  336. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  337. // CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(%T)> [symbolic = %Action.type (constants.%Action.type.aff)]
  338. // CHECK:STDOUT: %Self: @Action.Op.%Action.type (%Action.type.aff) = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2f4)]
  339. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  340. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type (constants.%pattern_type.4a4)]
  341. // CHECK:STDOUT:
  342. // CHECK:STDOUT: fn(%self.param: @Action.Op.%Self.binding.as_type (%Self.binding.as_type));
  343. // CHECK:STDOUT: }
  344. // CHECK:STDOUT:
  345. // CHECK:STDOUT: fn @A.as.Action.impl.Op(%self.param: %A) {
  346. // CHECK:STDOUT: !entry:
  347. // CHECK:STDOUT: return
  348. // CHECK:STDOUT: }
  349. // CHECK:STDOUT:
  350. // CHECK:STDOUT: fn @F(%a.param: %A) {
  351. // CHECK:STDOUT: !entry:
  352. // CHECK:STDOUT: %a.ref: %A = name_ref a, %a
  353. // CHECK:STDOUT: %Action.ref: %Action.type.29c = name_ref Action, file.%Action.decl [concrete = constants.%Action.generic]
  354. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B]
  355. // CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(constants.%B)> [concrete = constants.%Action.type.74f]
  356. // CHECK:STDOUT: %.loc16: %Action.assoc_type.4ee = specific_constant @Action.%assoc0.loc5_22.1, @Action(constants.%B) [concrete = constants.%assoc0.f3b]
  357. // CHECK:STDOUT: %Op.ref: %Action.assoc_type.4ee = name_ref Op, %.loc16 [concrete = constants.%assoc0.f3b]
  358. // CHECK:STDOUT: %impl.elem0: %.db8 = impl_witness_access constants.%Action.impl_witness, element0 [concrete = constants.%A.as.Action.impl.Op]
  359. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %a.ref, %impl.elem0
  360. // CHECK:STDOUT: %A.as.Action.impl.Op.call: init %empty_tuple.type = call %bound_method(%a.ref)
  361. // CHECK:STDOUT: return
  362. // CHECK:STDOUT: }
  363. // CHECK:STDOUT:
  364. // CHECK:STDOUT: specific @Action(constants.%T) {
  365. // CHECK:STDOUT: %T.loc4_18.1 => constants.%T
  366. // CHECK:STDOUT: }
  367. // CHECK:STDOUT:
  368. // CHECK:STDOUT: specific @Action.Op(constants.%T, constants.%Self.2f4) {
  369. // CHECK:STDOUT: %T => constants.%T
  370. // CHECK:STDOUT: %Action.type => constants.%Action.type.aff
  371. // CHECK:STDOUT: %Self => constants.%Self.2f4
  372. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  373. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.4a4
  374. // CHECK:STDOUT: }
  375. // CHECK:STDOUT:
  376. // CHECK:STDOUT: specific @Action(constants.%B) {
  377. // CHECK:STDOUT: %T.loc4_18.1 => constants.%B
  378. // CHECK:STDOUT:
  379. // CHECK:STDOUT: !definition:
  380. // CHECK:STDOUT: %Action.type => constants.%Action.type.74f
  381. // CHECK:STDOUT: %Self.2 => constants.%Self.4b7
  382. // CHECK:STDOUT: %Action.Op.type => constants.%Action.Op.type.54d
  383. // CHECK:STDOUT: %Action.Op => constants.%Action.Op.dba
  384. // CHECK:STDOUT: %Action.assoc_type => constants.%Action.assoc_type.4ee
  385. // CHECK:STDOUT: %assoc0.loc5_22.2 => constants.%assoc0.f3b
  386. // CHECK:STDOUT: }
  387. // CHECK:STDOUT:
  388. // CHECK:STDOUT: specific @Action.Op(constants.%B, constants.%Action.facet) {
  389. // CHECK:STDOUT: %T => constants.%B
  390. // CHECK:STDOUT: %Action.type => constants.%Action.type.74f
  391. // CHECK:STDOUT: %Self => constants.%Action.facet
  392. // CHECK:STDOUT: %Self.binding.as_type => constants.%A
  393. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.c10
  394. // CHECK:STDOUT: }
  395. // CHECK:STDOUT:
  396. // CHECK:STDOUT: --- action.impl.carbon
  397. // CHECK:STDOUT:
  398. // CHECK:STDOUT: constants {
  399. // CHECK:STDOUT: %B: type = class_type @B [concrete]
  400. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  401. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  402. // CHECK:STDOUT: %Action.type.29c: type = generic_interface_type @Action [concrete]
  403. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  404. // CHECK:STDOUT: %Action.generic: %Action.type.29c = struct_value () [concrete]
  405. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  406. // CHECK:STDOUT: %Action.type.aff: type = facet_type <@Action, @Action(%T)> [symbolic]
  407. // CHECK:STDOUT: %Self.2f4: %Action.type.aff = bind_symbolic_name Self, 1 [symbolic]
  408. // CHECK:STDOUT: %Action.type.74f: type = facet_type <@Action, @Action(%B)> [concrete]
  409. // CHECK:STDOUT: %A: type = class_type @A [concrete]
  410. // CHECK:STDOUT: %Action.Op.type.036: type = fn_type @Action.Op, @Action(%T) [symbolic]
  411. // CHECK:STDOUT: %Action.Op.6ed: %Action.Op.type.036 = struct_value () [symbolic]
  412. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self.2f4 [symbolic]
  413. // CHECK:STDOUT: %pattern_type.4a4: type = pattern_type %Self.binding.as_type [symbolic]
  414. // CHECK:STDOUT: %Action.assoc_type.32e: type = assoc_entity_type @Action, @Action(%T) [symbolic]
  415. // CHECK:STDOUT: %assoc0.f18741.1: %Action.assoc_type.32e = assoc_entity element0, imports.%Main.import_ref.0e3753.1 [symbolic]
  416. // CHECK:STDOUT: %Self.4b7: %Action.type.74f = bind_symbolic_name Self, 1 [symbolic]
  417. // CHECK:STDOUT: %Action.Op.type.54d: type = fn_type @Action.Op, @Action(%B) [concrete]
  418. // CHECK:STDOUT: %Action.Op.dba: %Action.Op.type.54d = struct_value () [concrete]
  419. // CHECK:STDOUT: %Action.assoc_type.4ee: type = assoc_entity_type @Action, @Action(%B) [concrete]
  420. // CHECK:STDOUT: %assoc0.8a8: %Action.assoc_type.4ee = assoc_entity element0, imports.%Main.import_ref.1f6 [concrete]
  421. // CHECK:STDOUT: %pattern_type.c10: type = pattern_type %A [concrete]
  422. // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
  423. // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
  424. // CHECK:STDOUT: %assoc0.f18741.2: %Action.assoc_type.32e = assoc_entity element0, imports.%Main.import_ref.0e3753.2 [symbolic]
  425. // CHECK:STDOUT: %Action.impl_witness: <witness> = impl_witness imports.%Action.impl_witness_table [concrete]
  426. // CHECK:STDOUT: %Action.facet: %Action.type.74f = facet_value %A, (%Action.impl_witness) [concrete]
  427. // CHECK:STDOUT: %.452: type = fn_type_with_self_type %Action.Op.type.54d, %Action.facet [concrete]
  428. // CHECK:STDOUT: %A.as.Action.impl.Op.type: type = fn_type @A.as.Action.impl.Op [concrete]
  429. // CHECK:STDOUT: %A.as.Action.impl.Op: %A.as.Action.impl.Op.type = struct_value () [concrete]
  430. // CHECK:STDOUT: }
  431. // CHECK:STDOUT:
  432. // CHECK:STDOUT: imports {
  433. // CHECK:STDOUT: %Main.Action: %Action.type.29c = import_ref Main//action, Action, loaded [concrete = constants.%Action.generic]
  434. // CHECK:STDOUT: %Main.A: type = import_ref Main//action, A, loaded [concrete = constants.%A]
  435. // CHECK:STDOUT: %Main.B: type = import_ref Main//action, B, loaded [concrete = constants.%B]
  436. // CHECK:STDOUT: %Main.C = import_ref Main//action, C, unloaded
  437. // CHECK:STDOUT: %Main.F = import_ref Main//action, F, unloaded
  438. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  439. // CHECK:STDOUT: import Core//prelude
  440. // CHECK:STDOUT: import Core//prelude/...
  441. // CHECK:STDOUT: }
  442. // CHECK:STDOUT: %Main.import_ref.8f24d3.1: <witness> = import_ref Main//action, loc9_10, loaded [concrete = constants.%complete_type]
  443. // CHECK:STDOUT: %Main.import_ref.54a = import_ref Main//action, inst{{[0-9A-F]+}} [no loc], unloaded
  444. // CHECK:STDOUT: %Main.import_ref.5ab3ec.1: type = import_ref Main//action, loc4_18, loaded [symbolic = @Action.%T (constants.%T)]
  445. // CHECK:STDOUT: %Main.import_ref.489 = import_ref Main//action, inst{{[0-9A-F]+}} [no loc], unloaded
  446. // CHECK:STDOUT: %Main.import_ref.c55: @Action.%Action.assoc_type (%Action.assoc_type.32e) = import_ref Main//action, loc5_22, loaded [symbolic = @Action.%assoc0 (constants.%assoc0.f18741.2)]
  447. // CHECK:STDOUT: %Main.Op = import_ref Main//action, Op, unloaded
  448. // CHECK:STDOUT: %Main.import_ref.c2f: <witness> = import_ref Main//action, loc12_21, loaded [concrete = constants.%Action.impl_witness]
  449. // CHECK:STDOUT: %Main.import_ref.8f24d3.2: <witness> = import_ref Main//action, loc8_10, loaded [concrete = constants.%complete_type]
  450. // CHECK:STDOUT: %Main.import_ref.da3 = import_ref Main//action, inst{{[0-9A-F]+}} [no loc], unloaded
  451. // CHECK:STDOUT: %Main.import_ref.984: type = import_ref Main//action, loc12_6, loaded [concrete = constants.%A]
  452. // CHECK:STDOUT: %Main.import_ref.99f: type = import_ref Main//action, loc12_19, loaded [concrete = constants.%Action.type.74f]
  453. // CHECK:STDOUT: %Main.import_ref.8c4 = import_ref Main//action, loc13_23, unloaded
  454. // CHECK:STDOUT: %Main.import_ref.5ab3ec.2: type = import_ref Main//action, loc4_18, loaded [symbolic = @Action.%T (constants.%T)]
  455. // CHECK:STDOUT: %Main.import_ref.5ae: @Action.%Action.type (%Action.type.aff) = import_ref Main//action, inst{{[0-9A-F]+}} [no loc], loaded [symbolic = @Action.%Self (constants.%Self.2f4)]
  456. // CHECK:STDOUT: %Main.import_ref.0e3753.1 = import_ref Main//action, loc5_22, unloaded
  457. // CHECK:STDOUT: %Main.import_ref.1f6: @Action.%Action.Op.type (%Action.Op.type.036) = import_ref Main//action, loc5_22, loaded [symbolic = @Action.%Action.Op (constants.%Action.Op.6ed)]
  458. // CHECK:STDOUT: %Main.import_ref.0e3753.2 = import_ref Main//action, loc5_22, unloaded
  459. // CHECK:STDOUT: %Main.import_ref.469: %A.as.Action.impl.Op.type = import_ref Main//action, loc13_23, loaded [concrete = constants.%A.as.Action.impl.Op]
  460. // CHECK:STDOUT: %Action.impl_witness_table = impl_witness_table (%Main.import_ref.469), @A.as.Action.impl [concrete]
  461. // CHECK:STDOUT: }
  462. // CHECK:STDOUT:
  463. // CHECK:STDOUT: file {
  464. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  465. // CHECK:STDOUT: .Action = imports.%Main.Action
  466. // CHECK:STDOUT: .A = imports.%Main.A
  467. // CHECK:STDOUT: .B = imports.%Main.B
  468. // CHECK:STDOUT: .C = imports.%Main.C
  469. // CHECK:STDOUT: .F = imports.%Main.F
  470. // CHECK:STDOUT: .Core = imports.%Core
  471. // CHECK:STDOUT: .G = %G.decl
  472. // CHECK:STDOUT: }
  473. // CHECK:STDOUT: %default.import.loc2_22.1 = import <none>
  474. // CHECK:STDOUT: %default.import.loc2_22.2 = import <none>
  475. // CHECK:STDOUT: %Core.import = import Core
  476. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {
  477. // CHECK:STDOUT: %a.patt: %pattern_type.c10 = binding_pattern a [concrete]
  478. // CHECK:STDOUT: %a.param_patt: %pattern_type.c10 = value_param_pattern %a.patt, call_param0 [concrete]
  479. // CHECK:STDOUT: } {
  480. // CHECK:STDOUT: %a.param: %A = value_param call_param0
  481. // CHECK:STDOUT: %A.ref: type = name_ref A, imports.%Main.A [concrete = constants.%A]
  482. // CHECK:STDOUT: %a: %A = bind_name a, %a.param
  483. // CHECK:STDOUT: }
  484. // CHECK:STDOUT: }
  485. // CHECK:STDOUT:
  486. // CHECK:STDOUT: generic interface @Action(imports.%Main.import_ref.5ab3ec.1: type) [from "action.carbon"] {
  487. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  488. // CHECK:STDOUT:
  489. // CHECK:STDOUT: !definition:
  490. // CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(%T)> [symbolic = %Action.type (constants.%Action.type.aff)]
  491. // CHECK:STDOUT: %Self: @Action.%Action.type (%Action.type.aff) = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2f4)]
  492. // CHECK:STDOUT: %Action.Op.type: type = fn_type @Action.Op, @Action(%T) [symbolic = %Action.Op.type (constants.%Action.Op.type.036)]
  493. // CHECK:STDOUT: %Action.Op: @Action.%Action.Op.type (%Action.Op.type.036) = struct_value () [symbolic = %Action.Op (constants.%Action.Op.6ed)]
  494. // CHECK:STDOUT: %Action.assoc_type: type = assoc_entity_type @Action, @Action(%T) [symbolic = %Action.assoc_type (constants.%Action.assoc_type.32e)]
  495. // CHECK:STDOUT: %assoc0: @Action.%Action.assoc_type (%Action.assoc_type.32e) = assoc_entity element0, imports.%Main.import_ref.0e3753.1 [symbolic = %assoc0 (constants.%assoc0.f18741.1)]
  496. // CHECK:STDOUT:
  497. // CHECK:STDOUT: interface {
  498. // CHECK:STDOUT: !members:
  499. // CHECK:STDOUT: .Self = imports.%Main.import_ref.489
  500. // CHECK:STDOUT: .Op = imports.%Main.import_ref.c55
  501. // CHECK:STDOUT: witness = (imports.%Main.Op)
  502. // CHECK:STDOUT: }
  503. // CHECK:STDOUT: }
  504. // CHECK:STDOUT:
  505. // CHECK:STDOUT: impl @A.as.Action.impl: imports.%Main.import_ref.984 as imports.%Main.import_ref.99f [from "action.carbon"] {
  506. // CHECK:STDOUT: !members:
  507. // CHECK:STDOUT: .Op = imports.%Main.import_ref.8c4
  508. // CHECK:STDOUT: witness = imports.%Main.import_ref.c2f
  509. // CHECK:STDOUT: }
  510. // CHECK:STDOUT:
  511. // CHECK:STDOUT: class @B [from "action.carbon"] {
  512. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f24d3.1
  513. // CHECK:STDOUT:
  514. // CHECK:STDOUT: !members:
  515. // CHECK:STDOUT: .Self = imports.%Main.import_ref.54a
  516. // CHECK:STDOUT: }
  517. // CHECK:STDOUT:
  518. // CHECK:STDOUT: class @A [from "action.carbon"] {
  519. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f24d3.2
  520. // CHECK:STDOUT:
  521. // CHECK:STDOUT: !members:
  522. // CHECK:STDOUT: .Self = imports.%Main.import_ref.da3
  523. // CHECK:STDOUT: }
  524. // CHECK:STDOUT:
  525. // CHECK:STDOUT: generic fn @Action.Op(imports.%Main.import_ref.5ab3ec.2: type, imports.%Main.import_ref.5ae: @Action.%Action.type (%Action.type.aff)) [from "action.carbon"] {
  526. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  527. // CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(%T)> [symbolic = %Action.type (constants.%Action.type.aff)]
  528. // CHECK:STDOUT: %Self: @Action.Op.%Action.type (%Action.type.aff) = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2f4)]
  529. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  530. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type (constants.%pattern_type.4a4)]
  531. // CHECK:STDOUT:
  532. // CHECK:STDOUT: fn;
  533. // CHECK:STDOUT: }
  534. // CHECK:STDOUT:
  535. // CHECK:STDOUT: fn @G(%a.param: %A) {
  536. // CHECK:STDOUT: !entry:
  537. // CHECK:STDOUT: %a.ref: %A = name_ref a, %a
  538. // CHECK:STDOUT: %Action.ref: %Action.type.29c = name_ref Action, imports.%Main.Action [concrete = constants.%Action.generic]
  539. // CHECK:STDOUT: %B.ref: type = name_ref B, imports.%Main.B [concrete = constants.%B]
  540. // CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(constants.%B)> [concrete = constants.%Action.type.74f]
  541. // CHECK:STDOUT: %.loc4: %Action.assoc_type.4ee = specific_constant imports.%Main.import_ref.c55, @Action(constants.%B) [concrete = constants.%assoc0.8a8]
  542. // CHECK:STDOUT: %Op.ref: %Action.assoc_type.4ee = name_ref Op, %.loc4 [concrete = constants.%assoc0.8a8]
  543. // CHECK:STDOUT: %impl.elem0: %.452 = impl_witness_access constants.%Action.impl_witness, element0 [concrete = constants.%A.as.Action.impl.Op]
  544. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %a.ref, %impl.elem0
  545. // CHECK:STDOUT: %A.as.Action.impl.Op.call: init %empty_tuple.type = call %bound_method(%a.ref)
  546. // CHECK:STDOUT: return
  547. // CHECK:STDOUT: }
  548. // CHECK:STDOUT:
  549. // CHECK:STDOUT: fn @A.as.Action.impl.Op [from "action.carbon"];
  550. // CHECK:STDOUT:
  551. // CHECK:STDOUT: specific @Action(constants.%T) {
  552. // CHECK:STDOUT: %T => constants.%T
  553. // CHECK:STDOUT: }
  554. // CHECK:STDOUT:
  555. // CHECK:STDOUT: specific @Action(constants.%B) {
  556. // CHECK:STDOUT: %T => constants.%B
  557. // CHECK:STDOUT:
  558. // CHECK:STDOUT: !definition:
  559. // CHECK:STDOUT: %Action.type => constants.%Action.type.74f
  560. // CHECK:STDOUT: %Self => constants.%Self.4b7
  561. // CHECK:STDOUT: %Action.Op.type => constants.%Action.Op.type.54d
  562. // CHECK:STDOUT: %Action.Op => constants.%Action.Op.dba
  563. // CHECK:STDOUT: %Action.assoc_type => constants.%Action.assoc_type.4ee
  564. // CHECK:STDOUT: %assoc0 => constants.%assoc0.8a8
  565. // CHECK:STDOUT: }
  566. // CHECK:STDOUT:
  567. // CHECK:STDOUT: specific @Action.Op(constants.%T, constants.%Self.2f4) {
  568. // CHECK:STDOUT: %T => constants.%T
  569. // CHECK:STDOUT: %Action.type => constants.%Action.type.aff
  570. // CHECK:STDOUT: %Self => constants.%Self.2f4
  571. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  572. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.4a4
  573. // CHECK:STDOUT: }
  574. // CHECK:STDOUT:
  575. // CHECK:STDOUT: --- fail_action.impl.carbon
  576. // CHECK:STDOUT:
  577. // CHECK:STDOUT: constants {
  578. // CHECK:STDOUT: %B: type = class_type @B [concrete]
  579. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  580. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  581. // CHECK:STDOUT: %Action.type.29c: type = generic_interface_type @Action [concrete]
  582. // CHECK:STDOUT: %Action.generic: %Action.type.29c = struct_value () [concrete]
  583. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  584. // CHECK:STDOUT: %Action.type.aff: type = facet_type <@Action, @Action(%T)> [symbolic]
  585. // CHECK:STDOUT: %Self.2f4: %Action.type.aff = bind_symbolic_name Self, 1 [symbolic]
  586. // CHECK:STDOUT: %Action.type.74f: type = facet_type <@Action, @Action(%B)> [concrete]
  587. // CHECK:STDOUT: %A: type = class_type @A [concrete]
  588. // CHECK:STDOUT: %Action.Op.type.036: type = fn_type @Action.Op, @Action(%T) [symbolic]
  589. // CHECK:STDOUT: %Action.Op.6ed: %Action.Op.type.036 = struct_value () [symbolic]
  590. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self.2f4 [symbolic]
  591. // CHECK:STDOUT: %pattern_type.4a4: type = pattern_type %Self.binding.as_type [symbolic]
  592. // CHECK:STDOUT: %Action.assoc_type.32e: type = assoc_entity_type @Action, @Action(%T) [symbolic]
  593. // CHECK:STDOUT: %assoc0.326: %Action.assoc_type.32e = assoc_entity element0, imports.%Main.import_ref.1f6 [symbolic]
  594. // CHECK:STDOUT: %Self.4b7: %Action.type.74f = bind_symbolic_name Self, 1 [symbolic]
  595. // CHECK:STDOUT: %Action.Op.type.54d: type = fn_type @Action.Op, @Action(%B) [concrete]
  596. // CHECK:STDOUT: %Action.Op.dba: %Action.Op.type.54d = struct_value () [concrete]
  597. // CHECK:STDOUT: %Action.assoc_type.4ee: type = assoc_entity_type @Action, @Action(%B) [concrete]
  598. // CHECK:STDOUT: %assoc0.338: %Action.assoc_type.4ee = assoc_entity element0, imports.%Main.import_ref.0e3753.1 [concrete]
  599. // CHECK:STDOUT: %pattern_type.c10: type = pattern_type %A [concrete]
  600. // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
  601. // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
  602. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  603. // CHECK:STDOUT: %Action.type.eec: type = facet_type <@Action, @Action(%C)> [concrete]
  604. // CHECK:STDOUT: %Self.978: %Action.type.eec = bind_symbolic_name Self, 1 [symbolic]
  605. // CHECK:STDOUT: %Action.Op.type.5ad: type = fn_type @Action.Op, @Action(%C) [concrete]
  606. // CHECK:STDOUT: %Action.Op.b10: %Action.Op.type.5ad = struct_value () [concrete]
  607. // CHECK:STDOUT: %Action.assoc_type.79f: type = assoc_entity_type @Action, @Action(%C) [concrete]
  608. // CHECK:STDOUT: %assoc0.37d: %Action.assoc_type.79f = assoc_entity element0, imports.%Main.import_ref.1f6 [concrete]
  609. // CHECK:STDOUT: %assoc0.f18: %Action.assoc_type.32e = assoc_entity element0, imports.%Main.import_ref.0e3753.2 [symbolic]
  610. // CHECK:STDOUT: }
  611. // CHECK:STDOUT:
  612. // CHECK:STDOUT: imports {
  613. // CHECK:STDOUT: %Main.Action: %Action.type.29c = import_ref Main//action, Action, loaded [concrete = constants.%Action.generic]
  614. // CHECK:STDOUT: %Main.A: type = import_ref Main//action, A, loaded [concrete = constants.%A]
  615. // CHECK:STDOUT: %Main.B = import_ref Main//action, B, unloaded
  616. // CHECK:STDOUT: %Main.C: type = import_ref Main//action, C, loaded [concrete = constants.%C]
  617. // CHECK:STDOUT: %Main.F = import_ref Main//action, F, unloaded
  618. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  619. // CHECK:STDOUT: import Core//prelude
  620. // CHECK:STDOUT: import Core//prelude/...
  621. // CHECK:STDOUT: }
  622. // CHECK:STDOUT: %Main.import_ref.8f24d3.1: <witness> = import_ref Main//action, loc9_10, loaded [concrete = constants.%complete_type]
  623. // CHECK:STDOUT: %Main.import_ref.54a = import_ref Main//action, inst{{[0-9A-F]+}} [no loc], unloaded
  624. // CHECK:STDOUT: %Main.import_ref.5ab3ec.1: type = import_ref Main//action, loc4_18, loaded [symbolic = @Action.%T (constants.%T)]
  625. // CHECK:STDOUT: %Main.import_ref.489 = import_ref Main//action, inst{{[0-9A-F]+}} [no loc], unloaded
  626. // CHECK:STDOUT: %Main.import_ref.c55: @Action.%Action.assoc_type (%Action.assoc_type.32e) = import_ref Main//action, loc5_22, loaded [symbolic = @Action.%assoc0 (constants.%assoc0.f18)]
  627. // CHECK:STDOUT: %Main.Op = import_ref Main//action, Op, unloaded
  628. // CHECK:STDOUT: %Main.import_ref.7bf = import_ref Main//action, loc12_21, unloaded
  629. // CHECK:STDOUT: %Main.import_ref.8f24d3.2: <witness> = import_ref Main//action, loc8_10, loaded [concrete = constants.%complete_type]
  630. // CHECK:STDOUT: %Main.import_ref.da3 = import_ref Main//action, inst{{[0-9A-F]+}} [no loc], unloaded
  631. // CHECK:STDOUT: %Main.import_ref.984: type = import_ref Main//action, loc12_6, loaded [concrete = constants.%A]
  632. // CHECK:STDOUT: %Main.import_ref.99f: type = import_ref Main//action, loc12_19, loaded [concrete = constants.%Action.type.74f]
  633. // CHECK:STDOUT: %Main.import_ref.8c4 = import_ref Main//action, loc13_23, unloaded
  634. // CHECK:STDOUT: %Main.import_ref.5ab3ec.2: type = import_ref Main//action, loc4_18, loaded [symbolic = @Action.%T (constants.%T)]
  635. // CHECK:STDOUT: %Main.import_ref.5ae: @Action.%Action.type (%Action.type.aff) = import_ref Main//action, inst{{[0-9A-F]+}} [no loc], loaded [symbolic = @Action.%Self (constants.%Self.2f4)]
  636. // CHECK:STDOUT: %Main.import_ref.1f6: @Action.%Action.Op.type (%Action.Op.type.036) = import_ref Main//action, loc5_22, loaded [symbolic = @Action.%Action.Op (constants.%Action.Op.6ed)]
  637. // CHECK:STDOUT: %Main.import_ref.0e3753.1 = import_ref Main//action, loc5_22, unloaded
  638. // CHECK:STDOUT: %Main.import_ref.8f24d3.3: <witness> = import_ref Main//action, loc10_10, loaded [concrete = constants.%complete_type]
  639. // CHECK:STDOUT: %Main.import_ref.2c4 = import_ref Main//action, inst{{[0-9A-F]+}} [no loc], unloaded
  640. // CHECK:STDOUT: %Main.import_ref.0e3753.2 = import_ref Main//action, loc5_22, unloaded
  641. // CHECK:STDOUT: }
  642. // CHECK:STDOUT:
  643. // CHECK:STDOUT: file {
  644. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  645. // CHECK:STDOUT: .Action = imports.%Main.Action
  646. // CHECK:STDOUT: .A = imports.%Main.A
  647. // CHECK:STDOUT: .B = imports.%Main.B
  648. // CHECK:STDOUT: .C = imports.%Main.C
  649. // CHECK:STDOUT: .F = imports.%Main.F
  650. // CHECK:STDOUT: .Core = imports.%Core
  651. // CHECK:STDOUT: .G = %G.decl
  652. // CHECK:STDOUT: }
  653. // CHECK:STDOUT: %default.import.loc2_22.1 = import <none>
  654. // CHECK:STDOUT: %default.import.loc2_22.2 = import <none>
  655. // CHECK:STDOUT: %Core.import = import Core
  656. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {
  657. // CHECK:STDOUT: %a.patt: %pattern_type.c10 = binding_pattern a [concrete]
  658. // CHECK:STDOUT: %a.param_patt: %pattern_type.c10 = value_param_pattern %a.patt, call_param0 [concrete]
  659. // CHECK:STDOUT: } {
  660. // CHECK:STDOUT: %a.param: %A = value_param call_param0
  661. // CHECK:STDOUT: %A.ref: type = name_ref A, imports.%Main.A [concrete = constants.%A]
  662. // CHECK:STDOUT: %a: %A = bind_name a, %a.param
  663. // CHECK:STDOUT: }
  664. // CHECK:STDOUT: }
  665. // CHECK:STDOUT:
  666. // CHECK:STDOUT: generic interface @Action(imports.%Main.import_ref.5ab3ec.1: type) [from "action.carbon"] {
  667. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  668. // CHECK:STDOUT:
  669. // CHECK:STDOUT: !definition:
  670. // CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(%T)> [symbolic = %Action.type (constants.%Action.type.aff)]
  671. // CHECK:STDOUT: %Self: @Action.%Action.type (%Action.type.aff) = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2f4)]
  672. // CHECK:STDOUT: %Action.Op.type: type = fn_type @Action.Op, @Action(%T) [symbolic = %Action.Op.type (constants.%Action.Op.type.036)]
  673. // CHECK:STDOUT: %Action.Op: @Action.%Action.Op.type (%Action.Op.type.036) = struct_value () [symbolic = %Action.Op (constants.%Action.Op.6ed)]
  674. // CHECK:STDOUT: %Action.assoc_type: type = assoc_entity_type @Action, @Action(%T) [symbolic = %Action.assoc_type (constants.%Action.assoc_type.32e)]
  675. // CHECK:STDOUT: %assoc0: @Action.%Action.assoc_type (%Action.assoc_type.32e) = assoc_entity element0, imports.%Main.import_ref.1f6 [symbolic = %assoc0 (constants.%assoc0.326)]
  676. // CHECK:STDOUT:
  677. // CHECK:STDOUT: interface {
  678. // CHECK:STDOUT: !members:
  679. // CHECK:STDOUT: .Self = imports.%Main.import_ref.489
  680. // CHECK:STDOUT: .Op = imports.%Main.import_ref.c55
  681. // CHECK:STDOUT: witness = (imports.%Main.Op)
  682. // CHECK:STDOUT: }
  683. // CHECK:STDOUT: }
  684. // CHECK:STDOUT:
  685. // CHECK:STDOUT: impl @A.as.Action.impl: imports.%Main.import_ref.984 as imports.%Main.import_ref.99f [from "action.carbon"] {
  686. // CHECK:STDOUT: !members:
  687. // CHECK:STDOUT: .Op = imports.%Main.import_ref.8c4
  688. // CHECK:STDOUT: witness = imports.%Main.import_ref.7bf
  689. // CHECK:STDOUT: }
  690. // CHECK:STDOUT:
  691. // CHECK:STDOUT: class @B [from "action.carbon"] {
  692. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f24d3.1
  693. // CHECK:STDOUT:
  694. // CHECK:STDOUT: !members:
  695. // CHECK:STDOUT: .Self = imports.%Main.import_ref.54a
  696. // CHECK:STDOUT: }
  697. // CHECK:STDOUT:
  698. // CHECK:STDOUT: class @A [from "action.carbon"] {
  699. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f24d3.2
  700. // CHECK:STDOUT:
  701. // CHECK:STDOUT: !members:
  702. // CHECK:STDOUT: .Self = imports.%Main.import_ref.da3
  703. // CHECK:STDOUT: }
  704. // CHECK:STDOUT:
  705. // CHECK:STDOUT: class @C [from "action.carbon"] {
  706. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f24d3.3
  707. // CHECK:STDOUT:
  708. // CHECK:STDOUT: !members:
  709. // CHECK:STDOUT: .Self = imports.%Main.import_ref.2c4
  710. // CHECK:STDOUT: }
  711. // CHECK:STDOUT:
  712. // CHECK:STDOUT: generic fn @Action.Op(imports.%Main.import_ref.5ab3ec.2: type, imports.%Main.import_ref.5ae: @Action.%Action.type (%Action.type.aff)) [from "action.carbon"] {
  713. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  714. // CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(%T)> [symbolic = %Action.type (constants.%Action.type.aff)]
  715. // CHECK:STDOUT: %Self: @Action.Op.%Action.type (%Action.type.aff) = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2f4)]
  716. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  717. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type (constants.%pattern_type.4a4)]
  718. // CHECK:STDOUT:
  719. // CHECK:STDOUT: fn;
  720. // CHECK:STDOUT: }
  721. // CHECK:STDOUT:
  722. // CHECK:STDOUT: fn @G(%a.param: %A) {
  723. // CHECK:STDOUT: !entry:
  724. // CHECK:STDOUT: %a.ref: %A = name_ref a, %a
  725. // CHECK:STDOUT: %Action.ref: %Action.type.29c = name_ref Action, imports.%Main.Action [concrete = constants.%Action.generic]
  726. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C]
  727. // CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(constants.%C)> [concrete = constants.%Action.type.eec]
  728. // CHECK:STDOUT: %.loc8: %Action.assoc_type.79f = specific_constant imports.%Main.import_ref.c55, @Action(constants.%C) [concrete = constants.%assoc0.37d]
  729. // CHECK:STDOUT: %Op.ref: %Action.assoc_type.79f = name_ref Op, %.loc8 [concrete = constants.%assoc0.37d]
  730. // CHECK:STDOUT: return
  731. // CHECK:STDOUT: }
  732. // CHECK:STDOUT:
  733. // CHECK:STDOUT: specific @Action(constants.%T) {
  734. // CHECK:STDOUT: %T => constants.%T
  735. // CHECK:STDOUT: }
  736. // CHECK:STDOUT:
  737. // CHECK:STDOUT: specific @Action(constants.%B) {
  738. // CHECK:STDOUT: %T => constants.%B
  739. // CHECK:STDOUT:
  740. // CHECK:STDOUT: !definition:
  741. // CHECK:STDOUT: %Action.type => constants.%Action.type.74f
  742. // CHECK:STDOUT: %Self => constants.%Self.4b7
  743. // CHECK:STDOUT: %Action.Op.type => constants.%Action.Op.type.54d
  744. // CHECK:STDOUT: %Action.Op => constants.%Action.Op.dba
  745. // CHECK:STDOUT: %Action.assoc_type => constants.%Action.assoc_type.4ee
  746. // CHECK:STDOUT: %assoc0 => constants.%assoc0.338
  747. // CHECK:STDOUT: }
  748. // CHECK:STDOUT:
  749. // CHECK:STDOUT: specific @Action.Op(constants.%T, constants.%Self.2f4) {
  750. // CHECK:STDOUT: %T => constants.%T
  751. // CHECK:STDOUT: %Action.type => constants.%Action.type.aff
  752. // CHECK:STDOUT: %Self => constants.%Self.2f4
  753. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  754. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.4a4
  755. // CHECK:STDOUT: }
  756. // CHECK:STDOUT:
  757. // CHECK:STDOUT: specific @Action(constants.%C) {
  758. // CHECK:STDOUT: %T => constants.%C
  759. // CHECK:STDOUT:
  760. // CHECK:STDOUT: !definition:
  761. // CHECK:STDOUT: %Action.type => constants.%Action.type.eec
  762. // CHECK:STDOUT: %Self => constants.%Self.978
  763. // CHECK:STDOUT: %Action.Op.type => constants.%Action.Op.type.5ad
  764. // CHECK:STDOUT: %Action.Op => constants.%Action.Op.b10
  765. // CHECK:STDOUT: %Action.assoc_type => constants.%Action.assoc_type.79f
  766. // CHECK:STDOUT: %assoc0 => constants.%assoc0.37d
  767. // CHECK:STDOUT: }
  768. // CHECK:STDOUT:
  769. // CHECK:STDOUT: --- factory.carbon
  770. // CHECK:STDOUT:
  771. // CHECK:STDOUT: constants {
  772. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  773. // CHECK:STDOUT: %.Self: %type = bind_symbolic_name .Self [symbolic_self]
  774. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  775. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  776. // CHECK:STDOUT: %Factory.type.1a8: type = generic_interface_type @Factory [concrete]
  777. // CHECK:STDOUT: %Factory.generic: %Factory.type.1a8 = struct_value () [concrete]
  778. // CHECK:STDOUT: %Factory.type.82b: type = facet_type <@Factory, @Factory(%T)> [symbolic]
  779. // CHECK:STDOUT: %Self.f7c: %Factory.type.82b = bind_symbolic_name Self, 1 [symbolic]
  780. // CHECK:STDOUT: %pattern_type.7dc: type = pattern_type %T [symbolic]
  781. // CHECK:STDOUT: %Factory.Make.type.598: type = fn_type @Factory.Make, @Factory(%T) [symbolic]
  782. // CHECK:STDOUT: %Factory.Make.737: %Factory.Make.type.598 = struct_value () [symbolic]
  783. // CHECK:STDOUT: %Factory.assoc_type.207: type = assoc_entity_type @Factory, @Factory(%T) [symbolic]
  784. // CHECK:STDOUT: %assoc0.b3c: %Factory.assoc_type.207 = assoc_entity element0, @Factory.%Factory.Make.decl [symbolic]
  785. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self.f7c [symbolic]
  786. // CHECK:STDOUT: %pattern_type.745: type = pattern_type %Self.binding.as_type [symbolic]
  787. // CHECK:STDOUT: %Factory.Method.type.7ee: type = fn_type @Factory.Method, @Factory(%T) [symbolic]
  788. // CHECK:STDOUT: %Factory.Method.a71: %Factory.Method.type.7ee = struct_value () [symbolic]
  789. // CHECK:STDOUT: %assoc1.e30: %Factory.assoc_type.207 = assoc_entity element1, @Factory.%Factory.Method.decl [symbolic]
  790. // CHECK:STDOUT: %A: type = class_type @A [concrete]
  791. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  792. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  793. // CHECK:STDOUT: %B: type = class_type @B [concrete]
  794. // CHECK:STDOUT: %Factory.type.3cb: type = facet_type <@Factory, @Factory(%B)> [concrete]
  795. // CHECK:STDOUT: %Self.145: %Factory.type.3cb = bind_symbolic_name Self, 1 [symbolic]
  796. // CHECK:STDOUT: %Factory.Make.type.c59: type = fn_type @Factory.Make, @Factory(%B) [concrete]
  797. // CHECK:STDOUT: %Factory.Make.efe: %Factory.Make.type.c59 = struct_value () [concrete]
  798. // CHECK:STDOUT: %Factory.assoc_type.579: type = assoc_entity_type @Factory, @Factory(%B) [concrete]
  799. // CHECK:STDOUT: %assoc0.fe7: %Factory.assoc_type.579 = assoc_entity element0, @Factory.%Factory.Make.decl [concrete]
  800. // CHECK:STDOUT: %Factory.Method.type.117: type = fn_type @Factory.Method, @Factory(%B) [concrete]
  801. // CHECK:STDOUT: %Factory.Method.ea9: %Factory.Method.type.117 = struct_value () [concrete]
  802. // CHECK:STDOUT: %assoc1.02a: %Factory.assoc_type.579 = assoc_entity element1, @Factory.%Factory.Method.decl [concrete]
  803. // CHECK:STDOUT: %Factory.impl_witness: <witness> = impl_witness file.%Factory.impl_witness_table [concrete]
  804. // CHECK:STDOUT: %pattern_type.049: type = pattern_type %B [concrete]
  805. // CHECK:STDOUT: %A.as.Factory.impl.Make.type: type = fn_type @A.as.Factory.impl.Make [concrete]
  806. // CHECK:STDOUT: %A.as.Factory.impl.Make: %A.as.Factory.impl.Make.type = struct_value () [concrete]
  807. // CHECK:STDOUT: %pattern_type.c10: type = pattern_type %A [concrete]
  808. // CHECK:STDOUT: %A.as.Factory.impl.Method.type: type = fn_type @A.as.Factory.impl.Method [concrete]
  809. // CHECK:STDOUT: %A.as.Factory.impl.Method: %A.as.Factory.impl.Method.type = struct_value () [concrete]
  810. // CHECK:STDOUT: %Factory.facet: %Factory.type.3cb = facet_value %A, (%Factory.impl_witness) [concrete]
  811. // CHECK:STDOUT: }
  812. // CHECK:STDOUT:
  813. // CHECK:STDOUT: imports {
  814. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  815. // CHECK:STDOUT: import Core//prelude
  816. // CHECK:STDOUT: import Core//prelude/...
  817. // CHECK:STDOUT: }
  818. // CHECK:STDOUT: }
  819. // CHECK:STDOUT:
  820. // CHECK:STDOUT: file {
  821. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  822. // CHECK:STDOUT: .Core = imports.%Core
  823. // CHECK:STDOUT: .Factory = %Factory.decl
  824. // CHECK:STDOUT: .A = %A.decl
  825. // CHECK:STDOUT: .B = %B.decl
  826. // CHECK:STDOUT: }
  827. // CHECK:STDOUT: %Core.import = import Core
  828. // CHECK:STDOUT: %Factory.decl: %Factory.type.1a8 = interface_decl @Factory [concrete = constants.%Factory.generic] {
  829. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  830. // CHECK:STDOUT: } {
  831. // CHECK:STDOUT: %.Self: %type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  832. // CHECK:STDOUT: %T.loc4_19.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_19.1 (constants.%T)]
  833. // CHECK:STDOUT: }
  834. // CHECK:STDOUT: %A.decl: type = class_decl @A [concrete = constants.%A] {} {}
  835. // CHECK:STDOUT: %B.decl: type = class_decl @B [concrete = constants.%B] {} {}
  836. // CHECK:STDOUT: impl_decl @A.as.Factory.impl [concrete] {} {
  837. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A]
  838. // CHECK:STDOUT: %Factory.ref: %Factory.type.1a8 = name_ref Factory, file.%Factory.decl [concrete = constants.%Factory.generic]
  839. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B]
  840. // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(constants.%B)> [concrete = constants.%Factory.type.3cb]
  841. // CHECK:STDOUT: }
  842. // CHECK:STDOUT: %Factory.impl_witness_table = impl_witness_table (@A.as.Factory.impl.%A.as.Factory.impl.Make.decl, @A.as.Factory.impl.%A.as.Factory.impl.Method.decl), @A.as.Factory.impl [concrete]
  843. // CHECK:STDOUT: %Factory.impl_witness: <witness> = impl_witness %Factory.impl_witness_table [concrete = constants.%Factory.impl_witness]
  844. // CHECK:STDOUT: }
  845. // CHECK:STDOUT:
  846. // CHECK:STDOUT: generic interface @Factory(%T.loc4_19.2: type) {
  847. // CHECK:STDOUT: %T.loc4_19.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_19.1 (constants.%T)]
  848. // CHECK:STDOUT:
  849. // CHECK:STDOUT: !definition:
  850. // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(%T.loc4_19.1)> [symbolic = %Factory.type (constants.%Factory.type.82b)]
  851. // CHECK:STDOUT: %Self.2: @Factory.%Factory.type (%Factory.type.82b) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.f7c)]
  852. // CHECK:STDOUT: %Factory.Make.type: type = fn_type @Factory.Make, @Factory(%T.loc4_19.1) [symbolic = %Factory.Make.type (constants.%Factory.Make.type.598)]
  853. // CHECK:STDOUT: %Factory.Make: @Factory.%Factory.Make.type (%Factory.Make.type.598) = struct_value () [symbolic = %Factory.Make (constants.%Factory.Make.737)]
  854. // CHECK:STDOUT: %Factory.assoc_type: type = assoc_entity_type @Factory, @Factory(%T.loc4_19.1) [symbolic = %Factory.assoc_type (constants.%Factory.assoc_type.207)]
  855. // CHECK:STDOUT: %assoc0.loc6_17.2: @Factory.%Factory.assoc_type (%Factory.assoc_type.207) = assoc_entity element0, %Factory.Make.decl [symbolic = %assoc0.loc6_17.2 (constants.%assoc0.b3c)]
  856. // CHECK:STDOUT: %Factory.Method.type: type = fn_type @Factory.Method, @Factory(%T.loc4_19.1) [symbolic = %Factory.Method.type (constants.%Factory.Method.type.7ee)]
  857. // CHECK:STDOUT: %Factory.Method: @Factory.%Factory.Method.type (%Factory.Method.type.7ee) = struct_value () [symbolic = %Factory.Method (constants.%Factory.Method.a71)]
  858. // CHECK:STDOUT: %assoc1.loc8_31.2: @Factory.%Factory.assoc_type (%Factory.assoc_type.207) = assoc_entity element1, %Factory.Method.decl [symbolic = %assoc1.loc8_31.2 (constants.%assoc1.e30)]
  859. // CHECK:STDOUT:
  860. // CHECK:STDOUT: interface {
  861. // CHECK:STDOUT: %Self.1: @Factory.%Factory.type (%Factory.type.82b) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.f7c)]
  862. // CHECK:STDOUT: %Factory.Make.decl: @Factory.%Factory.Make.type (%Factory.Make.type.598) = fn_decl @Factory.Make [symbolic = @Factory.%Factory.Make (constants.%Factory.Make.737)] {
  863. // CHECK:STDOUT: %return.patt: @Factory.Make.%pattern_type (%pattern_type.7dc) = return_slot_pattern [concrete]
  864. // CHECK:STDOUT: %return.param_patt: @Factory.Make.%pattern_type (%pattern_type.7dc) = out_param_pattern %return.patt, call_param0 [concrete]
  865. // CHECK:STDOUT: } {
  866. // CHECK:STDOUT: %T.ref: type = name_ref T, @Factory.%T.loc4_19.2 [symbolic = %T (constants.%T)]
  867. // CHECK:STDOUT: %return.param: ref @Factory.Make.%T (%T) = out_param call_param0
  868. // CHECK:STDOUT: %return: ref @Factory.Make.%T (%T) = return_slot %return.param
  869. // CHECK:STDOUT: }
  870. // CHECK:STDOUT: %assoc0.loc6_17.1: @Factory.%Factory.assoc_type (%Factory.assoc_type.207) = assoc_entity element0, %Factory.Make.decl [symbolic = %assoc0.loc6_17.2 (constants.%assoc0.b3c)]
  871. // CHECK:STDOUT: %Factory.Method.decl: @Factory.%Factory.Method.type (%Factory.Method.type.7ee) = fn_decl @Factory.Method [symbolic = @Factory.%Factory.Method (constants.%Factory.Method.a71)] {
  872. // CHECK:STDOUT: %self.patt: @Factory.Method.%pattern_type.loc8_13 (%pattern_type.745) = binding_pattern self [concrete]
  873. // CHECK:STDOUT: %self.param_patt: @Factory.Method.%pattern_type.loc8_13 (%pattern_type.745) = value_param_pattern %self.patt, call_param0 [concrete]
  874. // CHECK:STDOUT: %return.patt: @Factory.Method.%pattern_type.loc8_27 (%pattern_type.7dc) = return_slot_pattern [concrete]
  875. // CHECK:STDOUT: %return.param_patt: @Factory.Method.%pattern_type.loc8_27 (%pattern_type.7dc) = out_param_pattern %return.patt, call_param1 [concrete]
  876. // CHECK:STDOUT: } {
  877. // CHECK:STDOUT: %T.ref: type = name_ref T, @Factory.%T.loc4_19.2 [symbolic = %T (constants.%T)]
  878. // CHECK:STDOUT: %self.param: @Factory.Method.%Self.binding.as_type (%Self.binding.as_type) = value_param call_param0
  879. // CHECK:STDOUT: %.loc8_19.1: type = splice_block %.loc8_19.3 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] {
  880. // CHECK:STDOUT: %.loc8_19.2: @Factory.Method.%Factory.type (%Factory.type.82b) = specific_constant @Factory.%Self.1, @Factory(constants.%T) [symbolic = %Self (constants.%Self.f7c)]
  881. // CHECK:STDOUT: %Self.ref: @Factory.Method.%Factory.type (%Factory.type.82b) = name_ref Self, %.loc8_19.2 [symbolic = %Self (constants.%Self.f7c)]
  882. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.ref [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  883. // CHECK:STDOUT: %.loc8_19.3: type = converted %Self.ref, %Self.as_type [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  884. // CHECK:STDOUT: }
  885. // CHECK:STDOUT: %self: @Factory.Method.%Self.binding.as_type (%Self.binding.as_type) = bind_name self, %self.param
  886. // CHECK:STDOUT: %return.param: ref @Factory.Method.%T (%T) = out_param call_param1
  887. // CHECK:STDOUT: %return: ref @Factory.Method.%T (%T) = return_slot %return.param
  888. // CHECK:STDOUT: }
  889. // CHECK:STDOUT: %assoc1.loc8_31.1: @Factory.%Factory.assoc_type (%Factory.assoc_type.207) = assoc_entity element1, %Factory.Method.decl [symbolic = %assoc1.loc8_31.2 (constants.%assoc1.e30)]
  890. // CHECK:STDOUT:
  891. // CHECK:STDOUT: !members:
  892. // CHECK:STDOUT: .Self = %Self.1
  893. // CHECK:STDOUT: .T = <poisoned>
  894. // CHECK:STDOUT: .Make = %assoc0.loc6_17.1
  895. // CHECK:STDOUT: .Method = %assoc1.loc8_31.1
  896. // CHECK:STDOUT: witness = (%Factory.Make.decl, %Factory.Method.decl)
  897. // CHECK:STDOUT: }
  898. // CHECK:STDOUT: }
  899. // CHECK:STDOUT:
  900. // CHECK:STDOUT: impl @A.as.Factory.impl: %A.ref as %Factory.type {
  901. // CHECK:STDOUT: %A.as.Factory.impl.Make.decl: %A.as.Factory.impl.Make.type = fn_decl @A.as.Factory.impl.Make [concrete = constants.%A.as.Factory.impl.Make] {
  902. // CHECK:STDOUT: %return.patt: %pattern_type.049 = return_slot_pattern [concrete]
  903. // CHECK:STDOUT: %return.param_patt: %pattern_type.049 = out_param_pattern %return.patt, call_param0 [concrete]
  904. // CHECK:STDOUT: } {
  905. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B]
  906. // CHECK:STDOUT: %return.param: ref %B = out_param call_param0
  907. // CHECK:STDOUT: %return: ref %B = return_slot %return.param
  908. // CHECK:STDOUT: }
  909. // CHECK:STDOUT: %A.as.Factory.impl.Method.decl: %A.as.Factory.impl.Method.type = fn_decl @A.as.Factory.impl.Method [concrete = constants.%A.as.Factory.impl.Method] {
  910. // CHECK:STDOUT: %self.patt: %pattern_type.c10 = binding_pattern self [concrete]
  911. // CHECK:STDOUT: %self.param_patt: %pattern_type.c10 = value_param_pattern %self.patt, call_param0 [concrete]
  912. // CHECK:STDOUT: %return.patt: %pattern_type.049 = return_slot_pattern [concrete]
  913. // CHECK:STDOUT: %return.param_patt: %pattern_type.049 = out_param_pattern %return.patt, call_param1 [concrete]
  914. // CHECK:STDOUT: } {
  915. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B]
  916. // CHECK:STDOUT: %self.param: %A = value_param call_param0
  917. // CHECK:STDOUT: %Self.ref: type = name_ref Self, @A.as.Factory.impl.%A.ref [concrete = constants.%A]
  918. // CHECK:STDOUT: %self: %A = bind_name self, %self.param
  919. // CHECK:STDOUT: %return.param: ref %B = out_param call_param1
  920. // CHECK:STDOUT: %return: ref %B = return_slot %return.param
  921. // CHECK:STDOUT: }
  922. // CHECK:STDOUT:
  923. // CHECK:STDOUT: !members:
  924. // CHECK:STDOUT: .B = <poisoned>
  925. // CHECK:STDOUT: .Make = %A.as.Factory.impl.Make.decl
  926. // CHECK:STDOUT: .Method = %A.as.Factory.impl.Method.decl
  927. // CHECK:STDOUT: witness = file.%Factory.impl_witness
  928. // CHECK:STDOUT: }
  929. // CHECK:STDOUT:
  930. // CHECK:STDOUT: class @A {
  931. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  932. // CHECK:STDOUT: complete_type_witness = %complete_type
  933. // CHECK:STDOUT:
  934. // CHECK:STDOUT: !members:
  935. // CHECK:STDOUT: .Self = constants.%A
  936. // CHECK:STDOUT: }
  937. // CHECK:STDOUT:
  938. // CHECK:STDOUT: class @B {
  939. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  940. // CHECK:STDOUT: complete_type_witness = %complete_type
  941. // CHECK:STDOUT:
  942. // CHECK:STDOUT: !members:
  943. // CHECK:STDOUT: .Self = constants.%B
  944. // CHECK:STDOUT: }
  945. // CHECK:STDOUT:
  946. // CHECK:STDOUT: generic fn @Factory.Make(@Factory.%T.loc4_19.2: type, @Factory.%Self.1: @Factory.%Factory.type (%Factory.type.82b)) {
  947. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  948. // CHECK:STDOUT: %pattern_type: type = pattern_type %T [symbolic = %pattern_type (constants.%pattern_type.7dc)]
  949. // CHECK:STDOUT:
  950. // CHECK:STDOUT: fn() -> @Factory.Make.%T (%T);
  951. // CHECK:STDOUT: }
  952. // CHECK:STDOUT:
  953. // CHECK:STDOUT: generic fn @Factory.Method(@Factory.%T.loc4_19.2: type, @Factory.%Self.1: @Factory.%Factory.type (%Factory.type.82b)) {
  954. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  955. // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(%T)> [symbolic = %Factory.type (constants.%Factory.type.82b)]
  956. // CHECK:STDOUT: %Self: @Factory.Method.%Factory.type (%Factory.type.82b) = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.f7c)]
  957. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  958. // CHECK:STDOUT: %pattern_type.loc8_13: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type.loc8_13 (constants.%pattern_type.745)]
  959. // CHECK:STDOUT: %pattern_type.loc8_27: type = pattern_type %T [symbolic = %pattern_type.loc8_27 (constants.%pattern_type.7dc)]
  960. // CHECK:STDOUT:
  961. // CHECK:STDOUT: fn(%self.param: @Factory.Method.%Self.binding.as_type (%Self.binding.as_type)) -> @Factory.Method.%T (%T);
  962. // CHECK:STDOUT: }
  963. // CHECK:STDOUT:
  964. // CHECK:STDOUT: fn @A.as.Factory.impl.Make() -> %B;
  965. // CHECK:STDOUT:
  966. // CHECK:STDOUT: fn @A.as.Factory.impl.Method(%self.param: %A) -> %B;
  967. // CHECK:STDOUT:
  968. // CHECK:STDOUT: specific @Factory(constants.%T) {
  969. // CHECK:STDOUT: %T.loc4_19.1 => constants.%T
  970. // CHECK:STDOUT: }
  971. // CHECK:STDOUT:
  972. // CHECK:STDOUT: specific @Factory.Make(constants.%T, constants.%Self.f7c) {
  973. // CHECK:STDOUT: %T => constants.%T
  974. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.7dc
  975. // CHECK:STDOUT: }
  976. // CHECK:STDOUT:
  977. // CHECK:STDOUT: specific @Factory.Method(constants.%T, constants.%Self.f7c) {
  978. // CHECK:STDOUT: %T => constants.%T
  979. // CHECK:STDOUT: %Factory.type => constants.%Factory.type.82b
  980. // CHECK:STDOUT: %Self => constants.%Self.f7c
  981. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  982. // CHECK:STDOUT: %pattern_type.loc8_13 => constants.%pattern_type.745
  983. // CHECK:STDOUT: %pattern_type.loc8_27 => constants.%pattern_type.7dc
  984. // CHECK:STDOUT: }
  985. // CHECK:STDOUT:
  986. // CHECK:STDOUT: specific @Factory(constants.%B) {
  987. // CHECK:STDOUT: %T.loc4_19.1 => constants.%B
  988. // CHECK:STDOUT:
  989. // CHECK:STDOUT: !definition:
  990. // CHECK:STDOUT: %Factory.type => constants.%Factory.type.3cb
  991. // CHECK:STDOUT: %Self.2 => constants.%Self.145
  992. // CHECK:STDOUT: %Factory.Make.type => constants.%Factory.Make.type.c59
  993. // CHECK:STDOUT: %Factory.Make => constants.%Factory.Make.efe
  994. // CHECK:STDOUT: %Factory.assoc_type => constants.%Factory.assoc_type.579
  995. // CHECK:STDOUT: %assoc0.loc6_17.2 => constants.%assoc0.fe7
  996. // CHECK:STDOUT: %Factory.Method.type => constants.%Factory.Method.type.117
  997. // CHECK:STDOUT: %Factory.Method => constants.%Factory.Method.ea9
  998. // CHECK:STDOUT: %assoc1.loc8_31.2 => constants.%assoc1.02a
  999. // CHECK:STDOUT: }
  1000. // CHECK:STDOUT:
  1001. // CHECK:STDOUT: specific @Factory.Make(constants.%B, constants.%Factory.facet) {
  1002. // CHECK:STDOUT: %T => constants.%B
  1003. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.049
  1004. // CHECK:STDOUT: }
  1005. // CHECK:STDOUT:
  1006. // CHECK:STDOUT: specific @Factory.Method(constants.%B, constants.%Factory.facet) {
  1007. // CHECK:STDOUT: %T => constants.%B
  1008. // CHECK:STDOUT: %Factory.type => constants.%Factory.type.3cb
  1009. // CHECK:STDOUT: %Self => constants.%Factory.facet
  1010. // CHECK:STDOUT: %Self.binding.as_type => constants.%A
  1011. // CHECK:STDOUT: %pattern_type.loc8_13 => constants.%pattern_type.c10
  1012. // CHECK:STDOUT: %pattern_type.loc8_27 => constants.%pattern_type.049
  1013. // CHECK:STDOUT: }
  1014. // CHECK:STDOUT:
  1015. // CHECK:STDOUT: --- factory.impl.carbon
  1016. // CHECK:STDOUT:
  1017. // CHECK:STDOUT: constants {
  1018. // CHECK:STDOUT: %B: type = class_type @B [concrete]
  1019. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  1020. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  1021. // CHECK:STDOUT: %Factory.type.1a8: type = generic_interface_type @Factory [concrete]
  1022. // CHECK:STDOUT: %Factory.generic: %Factory.type.1a8 = struct_value () [concrete]
  1023. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  1024. // CHECK:STDOUT: %Factory.type.82b: type = facet_type <@Factory, @Factory(%T)> [symbolic]
  1025. // CHECK:STDOUT: %Self.f7c: %Factory.type.82b = bind_symbolic_name Self, 1 [symbolic]
  1026. // CHECK:STDOUT: %Factory.type.3cb: type = facet_type <@Factory, @Factory(%B)> [concrete]
  1027. // CHECK:STDOUT: %A: type = class_type @A [concrete]
  1028. // CHECK:STDOUT: %Factory.Make.type.598: type = fn_type @Factory.Make, @Factory(%T) [symbolic]
  1029. // CHECK:STDOUT: %Factory.Make.737: %Factory.Make.type.598 = struct_value () [symbolic]
  1030. // CHECK:STDOUT: %pattern_type.7dc: type = pattern_type %T [symbolic]
  1031. // CHECK:STDOUT: %Factory.assoc_type.207: type = assoc_entity_type @Factory, @Factory(%T) [symbolic]
  1032. // CHECK:STDOUT: %assoc0.46d25f.1: %Factory.assoc_type.207 = assoc_entity element0, imports.%Main.import_ref.21018a.1 [symbolic]
  1033. // CHECK:STDOUT: %Factory.Method.type.7ee: type = fn_type @Factory.Method, @Factory(%T) [symbolic]
  1034. // CHECK:STDOUT: %Factory.Method.a71: %Factory.Method.type.7ee = struct_value () [symbolic]
  1035. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self.f7c [symbolic]
  1036. // CHECK:STDOUT: %pattern_type.745: type = pattern_type %Self.binding.as_type [symbolic]
  1037. // CHECK:STDOUT: %assoc1.16541d.1: %Factory.assoc_type.207 = assoc_entity element1, imports.%Main.import_ref.46fc3c.1 [symbolic]
  1038. // CHECK:STDOUT: %Self.145: %Factory.type.3cb = bind_symbolic_name Self, 1 [symbolic]
  1039. // CHECK:STDOUT: %Factory.Make.type.c59: type = fn_type @Factory.Make, @Factory(%B) [concrete]
  1040. // CHECK:STDOUT: %Factory.Make.efe: %Factory.Make.type.c59 = struct_value () [concrete]
  1041. // CHECK:STDOUT: %Factory.assoc_type.579: type = assoc_entity_type @Factory, @Factory(%B) [concrete]
  1042. // CHECK:STDOUT: %assoc0.153: %Factory.assoc_type.579 = assoc_entity element0, imports.%Main.import_ref.1aa [concrete]
  1043. // CHECK:STDOUT: %Factory.Method.type.117: type = fn_type @Factory.Method, @Factory(%B) [concrete]
  1044. // CHECK:STDOUT: %Factory.Method.ea9: %Factory.Method.type.117 = struct_value () [concrete]
  1045. // CHECK:STDOUT: %assoc1.a48: %Factory.assoc_type.579 = assoc_entity element1, imports.%Main.import_ref.5be [concrete]
  1046. // CHECK:STDOUT: %pattern_type.049: type = pattern_type %B [concrete]
  1047. // CHECK:STDOUT: %MakeB.type: type = fn_type @MakeB [concrete]
  1048. // CHECK:STDOUT: %MakeB: %MakeB.type = struct_value () [concrete]
  1049. // CHECK:STDOUT: %assoc0.46d25f.2: %Factory.assoc_type.207 = assoc_entity element0, imports.%Main.import_ref.21018a.2 [symbolic]
  1050. // CHECK:STDOUT: %Factory.impl_witness: <witness> = impl_witness imports.%Factory.impl_witness_table [concrete]
  1051. // CHECK:STDOUT: %Factory.facet: %Factory.type.3cb = facet_value %A, (%Factory.impl_witness) [concrete]
  1052. // CHECK:STDOUT: %.549: type = fn_type_with_self_type %Factory.Make.type.c59, %Factory.facet [concrete]
  1053. // CHECK:STDOUT: %A.as.Factory.impl.Make.type: type = fn_type @A.as.Factory.impl.Make [concrete]
  1054. // CHECK:STDOUT: %A.as.Factory.impl.Make: %A.as.Factory.impl.Make.type = struct_value () [concrete]
  1055. // CHECK:STDOUT: %pattern_type.c10: type = pattern_type %A [concrete]
  1056. // CHECK:STDOUT: %InstanceB.type: type = fn_type @InstanceB [concrete]
  1057. // CHECK:STDOUT: %InstanceB: %InstanceB.type = struct_value () [concrete]
  1058. // CHECK:STDOUT: %assoc1.16541d.2: %Factory.assoc_type.207 = assoc_entity element1, imports.%Main.import_ref.46fc3c.2 [symbolic]
  1059. // CHECK:STDOUT: %.a61: type = fn_type_with_self_type %Factory.Method.type.117, %Factory.facet [concrete]
  1060. // CHECK:STDOUT: %A.as.Factory.impl.Method.type: type = fn_type @A.as.Factory.impl.Method [concrete]
  1061. // CHECK:STDOUT: %A.as.Factory.impl.Method: %A.as.Factory.impl.Method.type = struct_value () [concrete]
  1062. // CHECK:STDOUT: }
  1063. // CHECK:STDOUT:
  1064. // CHECK:STDOUT: imports {
  1065. // CHECK:STDOUT: %Main.Factory: %Factory.type.1a8 = import_ref Main//factory, Factory, loaded [concrete = constants.%Factory.generic]
  1066. // CHECK:STDOUT: %Main.A: type = import_ref Main//factory, A, loaded [concrete = constants.%A]
  1067. // CHECK:STDOUT: %Main.B: type = import_ref Main//factory, B, loaded [concrete = constants.%B]
  1068. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  1069. // CHECK:STDOUT: import Core//prelude
  1070. // CHECK:STDOUT: import Core//prelude/...
  1071. // CHECK:STDOUT: }
  1072. // CHECK:STDOUT: %Main.import_ref.8f24d3.1: <witness> = import_ref Main//factory, loc12_10, loaded [concrete = constants.%complete_type]
  1073. // CHECK:STDOUT: %Main.import_ref.54a = import_ref Main//factory, inst{{[0-9A-F]+}} [no loc], unloaded
  1074. // CHECK:STDOUT: %Main.import_ref.5ab3ec.1: type = import_ref Main//factory, loc4_19, loaded [symbolic = @Factory.%T (constants.%T)]
  1075. // CHECK:STDOUT: %Main.import_ref.119 = import_ref Main//factory, inst{{[0-9A-F]+}} [no loc], unloaded
  1076. // CHECK:STDOUT: %Main.import_ref.46c: @Factory.%Factory.assoc_type (%Factory.assoc_type.207) = import_ref Main//factory, loc6_17, loaded [symbolic = @Factory.%assoc0 (constants.%assoc0.46d25f.2)]
  1077. // CHECK:STDOUT: %Main.import_ref.2e4: @Factory.%Factory.assoc_type (%Factory.assoc_type.207) = import_ref Main//factory, loc8_31, loaded [symbolic = @Factory.%assoc1 (constants.%assoc1.16541d.2)]
  1078. // CHECK:STDOUT: %Main.Make = import_ref Main//factory, Make, unloaded
  1079. // CHECK:STDOUT: %Main.Method = import_ref Main//factory, Method, unloaded
  1080. // CHECK:STDOUT: %Main.import_ref.a6e: <witness> = import_ref Main//factory, loc14_22, loaded [concrete = constants.%Factory.impl_witness]
  1081. // CHECK:STDOUT: %Main.import_ref.8f24d3.2: <witness> = import_ref Main//factory, loc11_10, loaded [concrete = constants.%complete_type]
  1082. // CHECK:STDOUT: %Main.import_ref.da3 = import_ref Main//factory, inst{{[0-9A-F]+}} [no loc], unloaded
  1083. // CHECK:STDOUT: %Main.import_ref.984: type = import_ref Main//factory, loc14_6, loaded [concrete = constants.%A]
  1084. // CHECK:STDOUT: %Main.import_ref.e91: type = import_ref Main//factory, loc14_20, loaded [concrete = constants.%Factory.type.3cb]
  1085. // CHECK:STDOUT: %Main.import_ref.22f = import_ref Main//factory, loc15_17, unloaded
  1086. // CHECK:STDOUT: %Main.import_ref.5a9 = import_ref Main//factory, loc16_31, unloaded
  1087. // CHECK:STDOUT: %Main.import_ref.5ab3ec.2: type = import_ref Main//factory, loc4_19, loaded [symbolic = @Factory.%T (constants.%T)]
  1088. // CHECK:STDOUT: %Main.import_ref.85368a.1: @Factory.%Factory.type (%Factory.type.82b) = import_ref Main//factory, inst{{[0-9A-F]+}} [no loc], loaded [symbolic = @Factory.%Self (constants.%Self.f7c)]
  1089. // CHECK:STDOUT: %Main.import_ref.21018a.1 = import_ref Main//factory, loc6_17, unloaded
  1090. // CHECK:STDOUT: %Main.import_ref.5ab3ec.3: type = import_ref Main//factory, loc4_19, loaded [symbolic = @Factory.%T (constants.%T)]
  1091. // CHECK:STDOUT: %Main.import_ref.85368a.2: @Factory.%Factory.type (%Factory.type.82b) = import_ref Main//factory, inst{{[0-9A-F]+}} [no loc], loaded [symbolic = @Factory.%Self (constants.%Self.f7c)]
  1092. // CHECK:STDOUT: %Main.import_ref.46fc3c.1 = import_ref Main//factory, loc8_31, unloaded
  1093. // CHECK:STDOUT: %Main.import_ref.1aa: @Factory.%Factory.Make.type (%Factory.Make.type.598) = import_ref Main//factory, loc6_17, loaded [symbolic = @Factory.%Factory.Make (constants.%Factory.Make.737)]
  1094. // CHECK:STDOUT: %Main.import_ref.5be: @Factory.%Factory.Method.type (%Factory.Method.type.7ee) = import_ref Main//factory, loc8_31, loaded [symbolic = @Factory.%Factory.Method (constants.%Factory.Method.a71)]
  1095. // CHECK:STDOUT: %Main.import_ref.21018a.2 = import_ref Main//factory, loc6_17, unloaded
  1096. // CHECK:STDOUT: %Main.import_ref.4c9: %A.as.Factory.impl.Make.type = import_ref Main//factory, loc15_17, loaded [concrete = constants.%A.as.Factory.impl.Make]
  1097. // CHECK:STDOUT: %Main.import_ref.721: %A.as.Factory.impl.Method.type = import_ref Main//factory, loc16_31, loaded [concrete = constants.%A.as.Factory.impl.Method]
  1098. // CHECK:STDOUT: %Factory.impl_witness_table = impl_witness_table (%Main.import_ref.4c9, %Main.import_ref.721), @A.as.Factory.impl [concrete]
  1099. // CHECK:STDOUT: %Main.import_ref.46fc3c.2 = import_ref Main//factory, loc8_31, unloaded
  1100. // CHECK:STDOUT: }
  1101. // CHECK:STDOUT:
  1102. // CHECK:STDOUT: file {
  1103. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1104. // CHECK:STDOUT: .Factory = imports.%Main.Factory
  1105. // CHECK:STDOUT: .A = imports.%Main.A
  1106. // CHECK:STDOUT: .B = imports.%Main.B
  1107. // CHECK:STDOUT: .Core = imports.%Core
  1108. // CHECK:STDOUT: .MakeB = %MakeB.decl
  1109. // CHECK:STDOUT: .InstanceB = %InstanceB.decl
  1110. // CHECK:STDOUT: }
  1111. // CHECK:STDOUT: %default.import.loc2_23.1 = import <none>
  1112. // CHECK:STDOUT: %default.import.loc2_23.2 = import <none>
  1113. // CHECK:STDOUT: %Core.import = import Core
  1114. // CHECK:STDOUT: %MakeB.decl: %MakeB.type = fn_decl @MakeB [concrete = constants.%MakeB] {
  1115. // CHECK:STDOUT: %return.patt: %pattern_type.049 = return_slot_pattern [concrete]
  1116. // CHECK:STDOUT: %return.param_patt: %pattern_type.049 = out_param_pattern %return.patt, call_param0 [concrete]
  1117. // CHECK:STDOUT: } {
  1118. // CHECK:STDOUT: %B.ref.loc4: type = name_ref B, imports.%Main.B [concrete = constants.%B]
  1119. // CHECK:STDOUT: %return.param: ref %B = out_param call_param0
  1120. // CHECK:STDOUT: %return: ref %B = return_slot %return.param
  1121. // CHECK:STDOUT: }
  1122. // CHECK:STDOUT: %InstanceB.decl: %InstanceB.type = fn_decl @InstanceB [concrete = constants.%InstanceB] {
  1123. // CHECK:STDOUT: %a.patt: %pattern_type.c10 = binding_pattern a [concrete]
  1124. // CHECK:STDOUT: %a.param_patt: %pattern_type.c10 = value_param_pattern %a.patt, call_param0 [concrete]
  1125. // CHECK:STDOUT: %return.patt: %pattern_type.049 = return_slot_pattern [concrete]
  1126. // CHECK:STDOUT: %return.param_patt: %pattern_type.049 = out_param_pattern %return.patt, call_param1 [concrete]
  1127. // CHECK:STDOUT: } {
  1128. // CHECK:STDOUT: %B.ref.loc7: type = name_ref B, imports.%Main.B [concrete = constants.%B]
  1129. // CHECK:STDOUT: %a.param: %A = value_param call_param0
  1130. // CHECK:STDOUT: %A.ref: type = name_ref A, imports.%Main.A [concrete = constants.%A]
  1131. // CHECK:STDOUT: %a: %A = bind_name a, %a.param
  1132. // CHECK:STDOUT: %return.param: ref %B = out_param call_param1
  1133. // CHECK:STDOUT: %return: ref %B = return_slot %return.param
  1134. // CHECK:STDOUT: }
  1135. // CHECK:STDOUT: }
  1136. // CHECK:STDOUT:
  1137. // CHECK:STDOUT: generic interface @Factory(imports.%Main.import_ref.5ab3ec.1: type) [from "factory.carbon"] {
  1138. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  1139. // CHECK:STDOUT:
  1140. // CHECK:STDOUT: !definition:
  1141. // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(%T)> [symbolic = %Factory.type (constants.%Factory.type.82b)]
  1142. // CHECK:STDOUT: %Self: @Factory.%Factory.type (%Factory.type.82b) = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.f7c)]
  1143. // CHECK:STDOUT: %Factory.Make.type: type = fn_type @Factory.Make, @Factory(%T) [symbolic = %Factory.Make.type (constants.%Factory.Make.type.598)]
  1144. // CHECK:STDOUT: %Factory.Make: @Factory.%Factory.Make.type (%Factory.Make.type.598) = struct_value () [symbolic = %Factory.Make (constants.%Factory.Make.737)]
  1145. // CHECK:STDOUT: %Factory.assoc_type: type = assoc_entity_type @Factory, @Factory(%T) [symbolic = %Factory.assoc_type (constants.%Factory.assoc_type.207)]
  1146. // CHECK:STDOUT: %assoc0: @Factory.%Factory.assoc_type (%Factory.assoc_type.207) = assoc_entity element0, imports.%Main.import_ref.21018a.1 [symbolic = %assoc0 (constants.%assoc0.46d25f.1)]
  1147. // CHECK:STDOUT: %Factory.Method.type: type = fn_type @Factory.Method, @Factory(%T) [symbolic = %Factory.Method.type (constants.%Factory.Method.type.7ee)]
  1148. // CHECK:STDOUT: %Factory.Method: @Factory.%Factory.Method.type (%Factory.Method.type.7ee) = struct_value () [symbolic = %Factory.Method (constants.%Factory.Method.a71)]
  1149. // CHECK:STDOUT: %assoc1: @Factory.%Factory.assoc_type (%Factory.assoc_type.207) = assoc_entity element1, imports.%Main.import_ref.46fc3c.1 [symbolic = %assoc1 (constants.%assoc1.16541d.1)]
  1150. // CHECK:STDOUT:
  1151. // CHECK:STDOUT: interface {
  1152. // CHECK:STDOUT: !members:
  1153. // CHECK:STDOUT: .Self = imports.%Main.import_ref.119
  1154. // CHECK:STDOUT: .Make = imports.%Main.import_ref.46c
  1155. // CHECK:STDOUT: .Method = imports.%Main.import_ref.2e4
  1156. // CHECK:STDOUT: witness = (imports.%Main.Make, imports.%Main.Method)
  1157. // CHECK:STDOUT: }
  1158. // CHECK:STDOUT: }
  1159. // CHECK:STDOUT:
  1160. // CHECK:STDOUT: impl @A.as.Factory.impl: imports.%Main.import_ref.984 as imports.%Main.import_ref.e91 [from "factory.carbon"] {
  1161. // CHECK:STDOUT: !members:
  1162. // CHECK:STDOUT: .Make = imports.%Main.import_ref.22f
  1163. // CHECK:STDOUT: .Method = imports.%Main.import_ref.5a9
  1164. // CHECK:STDOUT: witness = imports.%Main.import_ref.a6e
  1165. // CHECK:STDOUT: }
  1166. // CHECK:STDOUT:
  1167. // CHECK:STDOUT: class @B [from "factory.carbon"] {
  1168. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f24d3.1
  1169. // CHECK:STDOUT:
  1170. // CHECK:STDOUT: !members:
  1171. // CHECK:STDOUT: .Self = imports.%Main.import_ref.54a
  1172. // CHECK:STDOUT: }
  1173. // CHECK:STDOUT:
  1174. // CHECK:STDOUT: class @A [from "factory.carbon"] {
  1175. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f24d3.2
  1176. // CHECK:STDOUT:
  1177. // CHECK:STDOUT: !members:
  1178. // CHECK:STDOUT: .Self = imports.%Main.import_ref.da3
  1179. // CHECK:STDOUT: }
  1180. // CHECK:STDOUT:
  1181. // CHECK:STDOUT: generic fn @Factory.Make(imports.%Main.import_ref.5ab3ec.2: type, imports.%Main.import_ref.85368a.1: @Factory.%Factory.type (%Factory.type.82b)) [from "factory.carbon"] {
  1182. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  1183. // CHECK:STDOUT: %pattern_type: type = pattern_type %T [symbolic = %pattern_type (constants.%pattern_type.7dc)]
  1184. // CHECK:STDOUT:
  1185. // CHECK:STDOUT: fn;
  1186. // CHECK:STDOUT: }
  1187. // CHECK:STDOUT:
  1188. // CHECK:STDOUT: generic fn @Factory.Method(imports.%Main.import_ref.5ab3ec.3: type, imports.%Main.import_ref.85368a.2: @Factory.%Factory.type (%Factory.type.82b)) [from "factory.carbon"] {
  1189. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  1190. // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(%T)> [symbolic = %Factory.type (constants.%Factory.type.82b)]
  1191. // CHECK:STDOUT: %Self: @Factory.Method.%Factory.type (%Factory.type.82b) = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.f7c)]
  1192. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  1193. // CHECK:STDOUT: %pattern_type.1: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type.1 (constants.%pattern_type.745)]
  1194. // CHECK:STDOUT: %pattern_type.2: type = pattern_type %T [symbolic = %pattern_type.2 (constants.%pattern_type.7dc)]
  1195. // CHECK:STDOUT:
  1196. // CHECK:STDOUT: fn;
  1197. // CHECK:STDOUT: }
  1198. // CHECK:STDOUT:
  1199. // CHECK:STDOUT: fn @MakeB() -> %return.param: %B {
  1200. // CHECK:STDOUT: !entry:
  1201. // CHECK:STDOUT: %A.ref: type = name_ref A, imports.%Main.A [concrete = constants.%A]
  1202. // CHECK:STDOUT: %Factory.ref: %Factory.type.1a8 = name_ref Factory, imports.%Main.Factory [concrete = constants.%Factory.generic]
  1203. // CHECK:STDOUT: %B.ref.loc5: type = name_ref B, imports.%Main.B [concrete = constants.%B]
  1204. // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(constants.%B)> [concrete = constants.%Factory.type.3cb]
  1205. // CHECK:STDOUT: %.loc5_23: %Factory.assoc_type.579 = specific_constant imports.%Main.import_ref.46c, @Factory(constants.%B) [concrete = constants.%assoc0.153]
  1206. // CHECK:STDOUT: %Make.ref: %Factory.assoc_type.579 = name_ref Make, %.loc5_23 [concrete = constants.%assoc0.153]
  1207. // CHECK:STDOUT: %Factory.facet: %Factory.type.3cb = facet_value %A.ref, (constants.%Factory.impl_witness) [concrete = constants.%Factory.facet]
  1208. // CHECK:STDOUT: %.loc5_11: %Factory.type.3cb = converted %A.ref, %Factory.facet [concrete = constants.%Factory.facet]
  1209. // CHECK:STDOUT: %impl.elem0: %.549 = impl_witness_access constants.%Factory.impl_witness, element0 [concrete = constants.%A.as.Factory.impl.Make]
  1210. // CHECK:STDOUT: %.loc4: ref %B = splice_block %return {}
  1211. // CHECK:STDOUT: %A.as.Factory.impl.Make.call: init %B = call %impl.elem0() to %.loc4
  1212. // CHECK:STDOUT: return %A.as.Factory.impl.Make.call to %return
  1213. // CHECK:STDOUT: }
  1214. // CHECK:STDOUT:
  1215. // CHECK:STDOUT: fn @A.as.Factory.impl.Make [from "factory.carbon"];
  1216. // CHECK:STDOUT:
  1217. // CHECK:STDOUT: fn @InstanceB(%a.param: %A) -> %return.param: %B {
  1218. // CHECK:STDOUT: !entry:
  1219. // CHECK:STDOUT: %a.ref: %A = name_ref a, %a
  1220. // CHECK:STDOUT: %Factory.ref: %Factory.type.1a8 = name_ref Factory, imports.%Main.Factory [concrete = constants.%Factory.generic]
  1221. // CHECK:STDOUT: %B.ref.loc8: type = name_ref B, imports.%Main.B [concrete = constants.%B]
  1222. // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(constants.%B)> [concrete = constants.%Factory.type.3cb]
  1223. // CHECK:STDOUT: %.loc8: %Factory.assoc_type.579 = specific_constant imports.%Main.import_ref.2e4, @Factory(constants.%B) [concrete = constants.%assoc1.a48]
  1224. // CHECK:STDOUT: %Method.ref: %Factory.assoc_type.579 = name_ref Method, %.loc8 [concrete = constants.%assoc1.a48]
  1225. // CHECK:STDOUT: %impl.elem1: %.a61 = impl_witness_access constants.%Factory.impl_witness, element1 [concrete = constants.%A.as.Factory.impl.Method]
  1226. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %a.ref, %impl.elem1
  1227. // CHECK:STDOUT: %.loc7: ref %B = splice_block %return {}
  1228. // CHECK:STDOUT: %A.as.Factory.impl.Method.call: init %B = call %bound_method(%a.ref) to %.loc7
  1229. // CHECK:STDOUT: return %A.as.Factory.impl.Method.call to %return
  1230. // CHECK:STDOUT: }
  1231. // CHECK:STDOUT:
  1232. // CHECK:STDOUT: fn @A.as.Factory.impl.Method [from "factory.carbon"];
  1233. // CHECK:STDOUT:
  1234. // CHECK:STDOUT: specific @Factory(constants.%T) {
  1235. // CHECK:STDOUT: %T => constants.%T
  1236. // CHECK:STDOUT: }
  1237. // CHECK:STDOUT:
  1238. // CHECK:STDOUT: specific @Factory(constants.%B) {
  1239. // CHECK:STDOUT: %T => constants.%B
  1240. // CHECK:STDOUT:
  1241. // CHECK:STDOUT: !definition:
  1242. // CHECK:STDOUT: %Factory.type => constants.%Factory.type.3cb
  1243. // CHECK:STDOUT: %Self => constants.%Self.145
  1244. // CHECK:STDOUT: %Factory.Make.type => constants.%Factory.Make.type.c59
  1245. // CHECK:STDOUT: %Factory.Make => constants.%Factory.Make.efe
  1246. // CHECK:STDOUT: %Factory.assoc_type => constants.%Factory.assoc_type.579
  1247. // CHECK:STDOUT: %assoc0 => constants.%assoc0.153
  1248. // CHECK:STDOUT: %Factory.Method.type => constants.%Factory.Method.type.117
  1249. // CHECK:STDOUT: %Factory.Method => constants.%Factory.Method.ea9
  1250. // CHECK:STDOUT: %assoc1 => constants.%assoc1.a48
  1251. // CHECK:STDOUT: }
  1252. // CHECK:STDOUT:
  1253. // CHECK:STDOUT: specific @Factory.Make(constants.%T, constants.%Self.f7c) {
  1254. // CHECK:STDOUT: %T => constants.%T
  1255. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.7dc
  1256. // CHECK:STDOUT: }
  1257. // CHECK:STDOUT:
  1258. // CHECK:STDOUT: specific @Factory.Method(constants.%T, constants.%Self.f7c) {
  1259. // CHECK:STDOUT: %T => constants.%T
  1260. // CHECK:STDOUT: %Factory.type => constants.%Factory.type.82b
  1261. // CHECK:STDOUT: %Self => constants.%Self.f7c
  1262. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  1263. // CHECK:STDOUT: %pattern_type.1 => constants.%pattern_type.745
  1264. // CHECK:STDOUT: %pattern_type.2 => constants.%pattern_type.7dc
  1265. // CHECK:STDOUT: }
  1266. // CHECK:STDOUT:
  1267. // CHECK:STDOUT: --- fail_factory.impl.carbon
  1268. // CHECK:STDOUT:
  1269. // CHECK:STDOUT: constants {
  1270. // CHECK:STDOUT: %B: type = class_type @B [concrete]
  1271. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  1272. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  1273. // CHECK:STDOUT: %Factory.type.1a8: type = generic_interface_type @Factory [concrete]
  1274. // CHECK:STDOUT: %Factory.generic: %Factory.type.1a8 = struct_value () [concrete]
  1275. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  1276. // CHECK:STDOUT: %Factory.type.82b: type = facet_type <@Factory, @Factory(%T)> [symbolic]
  1277. // CHECK:STDOUT: %Self.f7c: %Factory.type.82b = bind_symbolic_name Self, 1 [symbolic]
  1278. // CHECK:STDOUT: %Factory.type.3cb: type = facet_type <@Factory, @Factory(%B)> [concrete]
  1279. // CHECK:STDOUT: %A: type = class_type @A [concrete]
  1280. // CHECK:STDOUT: %Factory.Make.type.598: type = fn_type @Factory.Make, @Factory(%T) [symbolic]
  1281. // CHECK:STDOUT: %Factory.Make.737: %Factory.Make.type.598 = struct_value () [symbolic]
  1282. // CHECK:STDOUT: %pattern_type.7dc: type = pattern_type %T [symbolic]
  1283. // CHECK:STDOUT: %Factory.assoc_type.207: type = assoc_entity_type @Factory, @Factory(%T) [symbolic]
  1284. // CHECK:STDOUT: %assoc0.fe4: %Factory.assoc_type.207 = assoc_entity element0, imports.%Main.import_ref.1aa [symbolic]
  1285. // CHECK:STDOUT: %Factory.Method.type.7ee: type = fn_type @Factory.Method, @Factory(%T) [symbolic]
  1286. // CHECK:STDOUT: %Factory.Method.a71: %Factory.Method.type.7ee = struct_value () [symbolic]
  1287. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self.f7c [symbolic]
  1288. // CHECK:STDOUT: %pattern_type.745: type = pattern_type %Self.binding.as_type [symbolic]
  1289. // CHECK:STDOUT: %assoc1.ea6: %Factory.assoc_type.207 = assoc_entity element1, imports.%Main.import_ref.5be [symbolic]
  1290. // CHECK:STDOUT: %Self.145: %Factory.type.3cb = bind_symbolic_name Self, 1 [symbolic]
  1291. // CHECK:STDOUT: %Factory.Make.type.c59: type = fn_type @Factory.Make, @Factory(%B) [concrete]
  1292. // CHECK:STDOUT: %Factory.Make.efe: %Factory.Make.type.c59 = struct_value () [concrete]
  1293. // CHECK:STDOUT: %Factory.assoc_type.579: type = assoc_entity_type @Factory, @Factory(%B) [concrete]
  1294. // CHECK:STDOUT: %assoc0.cc7: %Factory.assoc_type.579 = assoc_entity element0, imports.%Main.import_ref.21018a.1 [concrete]
  1295. // CHECK:STDOUT: %Factory.Method.type.117: type = fn_type @Factory.Method, @Factory(%B) [concrete]
  1296. // CHECK:STDOUT: %Factory.Method.ea9: %Factory.Method.type.117 = struct_value () [concrete]
  1297. // CHECK:STDOUT: %assoc1.535: %Factory.assoc_type.579 = assoc_entity element1, imports.%Main.import_ref.46fc3c.1 [concrete]
  1298. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  1299. // CHECK:STDOUT: %pattern_type.c48: type = pattern_type %C [concrete]
  1300. // CHECK:STDOUT: %MakeC.type: type = fn_type @MakeC [concrete]
  1301. // CHECK:STDOUT: %MakeC: %MakeC.type = struct_value () [concrete]
  1302. // CHECK:STDOUT: %Factory.type.a06: type = facet_type <@Factory, @Factory(%C)> [concrete]
  1303. // CHECK:STDOUT: %Self.c8b: %Factory.type.a06 = bind_symbolic_name Self, 1 [symbolic]
  1304. // CHECK:STDOUT: %Factory.Make.type.0de: type = fn_type @Factory.Make, @Factory(%C) [concrete]
  1305. // CHECK:STDOUT: %Factory.Make.8ba: %Factory.Make.type.0de = struct_value () [concrete]
  1306. // CHECK:STDOUT: %Factory.assoc_type.d01: type = assoc_entity_type @Factory, @Factory(%C) [concrete]
  1307. // CHECK:STDOUT: %assoc0.38e: %Factory.assoc_type.d01 = assoc_entity element0, imports.%Main.import_ref.1aa [concrete]
  1308. // CHECK:STDOUT: %Factory.Method.type.d46: type = fn_type @Factory.Method, @Factory(%C) [concrete]
  1309. // CHECK:STDOUT: %Factory.Method.f9e: %Factory.Method.type.d46 = struct_value () [concrete]
  1310. // CHECK:STDOUT: %assoc1.263: %Factory.assoc_type.d01 = assoc_entity element1, imports.%Main.import_ref.5be [concrete]
  1311. // CHECK:STDOUT: %assoc0.46d: %Factory.assoc_type.207 = assoc_entity element0, imports.%Main.import_ref.21018a.2 [symbolic]
  1312. // CHECK:STDOUT: %pattern_type.c10: type = pattern_type %A [concrete]
  1313. // CHECK:STDOUT: %InstanceC.type: type = fn_type @InstanceC [concrete]
  1314. // CHECK:STDOUT: %InstanceC: %InstanceC.type = struct_value () [concrete]
  1315. // CHECK:STDOUT: %assoc1.165: %Factory.assoc_type.207 = assoc_entity element1, imports.%Main.import_ref.46fc3c.2 [symbolic]
  1316. // CHECK:STDOUT: }
  1317. // CHECK:STDOUT:
  1318. // CHECK:STDOUT: imports {
  1319. // CHECK:STDOUT: %Main.Factory: %Factory.type.1a8 = import_ref Main//factory, Factory, loaded [concrete = constants.%Factory.generic]
  1320. // CHECK:STDOUT: %Main.A: type = import_ref Main//factory, A, loaded [concrete = constants.%A]
  1321. // CHECK:STDOUT: %Main.B = import_ref Main//factory, B, unloaded
  1322. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  1323. // CHECK:STDOUT: import Core//prelude
  1324. // CHECK:STDOUT: import Core//default
  1325. // CHECK:STDOUT: import Core//prelude/...
  1326. // CHECK:STDOUT: }
  1327. // CHECK:STDOUT: %Main.import_ref.8f24d3.1: <witness> = import_ref Main//factory, loc12_10, loaded [concrete = constants.%complete_type]
  1328. // CHECK:STDOUT: %Main.import_ref.54a = import_ref Main//factory, inst{{[0-9A-F]+}} [no loc], unloaded
  1329. // CHECK:STDOUT: %Main.import_ref.5ab3ec.1: type = import_ref Main//factory, loc4_19, loaded [symbolic = @Factory.%T (constants.%T)]
  1330. // CHECK:STDOUT: %Main.import_ref.119 = import_ref Main//factory, inst{{[0-9A-F]+}} [no loc], unloaded
  1331. // CHECK:STDOUT: %Main.import_ref.46c: @Factory.%Factory.assoc_type (%Factory.assoc_type.207) = import_ref Main//factory, loc6_17, loaded [symbolic = @Factory.%assoc0 (constants.%assoc0.46d)]
  1332. // CHECK:STDOUT: %Main.import_ref.2e4: @Factory.%Factory.assoc_type (%Factory.assoc_type.207) = import_ref Main//factory, loc8_31, loaded [symbolic = @Factory.%assoc1 (constants.%assoc1.165)]
  1333. // CHECK:STDOUT: %Main.Make = import_ref Main//factory, Make, unloaded
  1334. // CHECK:STDOUT: %Main.Method = import_ref Main//factory, Method, unloaded
  1335. // CHECK:STDOUT: %Main.import_ref.42c = import_ref Main//factory, loc14_22, unloaded
  1336. // CHECK:STDOUT: %Main.import_ref.8f24d3.2: <witness> = import_ref Main//factory, loc11_10, loaded [concrete = constants.%complete_type]
  1337. // CHECK:STDOUT: %Main.import_ref.da3 = import_ref Main//factory, inst{{[0-9A-F]+}} [no loc], unloaded
  1338. // CHECK:STDOUT: %Main.import_ref.984: type = import_ref Main//factory, loc14_6, loaded [concrete = constants.%A]
  1339. // CHECK:STDOUT: %Main.import_ref.e91: type = import_ref Main//factory, loc14_20, loaded [concrete = constants.%Factory.type.3cb]
  1340. // CHECK:STDOUT: %Main.import_ref.22f = import_ref Main//factory, loc15_17, unloaded
  1341. // CHECK:STDOUT: %Main.import_ref.5a9 = import_ref Main//factory, loc16_31, unloaded
  1342. // CHECK:STDOUT: %Main.import_ref.5ab3ec.2: type = import_ref Main//factory, loc4_19, loaded [symbolic = @Factory.%T (constants.%T)]
  1343. // CHECK:STDOUT: %Main.import_ref.85368a.1: @Factory.%Factory.type (%Factory.type.82b) = import_ref Main//factory, inst{{[0-9A-F]+}} [no loc], loaded [symbolic = @Factory.%Self (constants.%Self.f7c)]
  1344. // CHECK:STDOUT: %Main.import_ref.1aa: @Factory.%Factory.Make.type (%Factory.Make.type.598) = import_ref Main//factory, loc6_17, loaded [symbolic = @Factory.%Factory.Make (constants.%Factory.Make.737)]
  1345. // CHECK:STDOUT: %Main.import_ref.5ab3ec.3: type = import_ref Main//factory, loc4_19, loaded [symbolic = @Factory.%T (constants.%T)]
  1346. // CHECK:STDOUT: %Main.import_ref.85368a.2: @Factory.%Factory.type (%Factory.type.82b) = import_ref Main//factory, inst{{[0-9A-F]+}} [no loc], loaded [symbolic = @Factory.%Self (constants.%Self.f7c)]
  1347. // CHECK:STDOUT: %Main.import_ref.5be: @Factory.%Factory.Method.type (%Factory.Method.type.7ee) = import_ref Main//factory, loc8_31, loaded [symbolic = @Factory.%Factory.Method (constants.%Factory.Method.a71)]
  1348. // CHECK:STDOUT: %Main.import_ref.21018a.1 = import_ref Main//factory, loc6_17, unloaded
  1349. // CHECK:STDOUT: %Main.import_ref.46fc3c.1 = import_ref Main//factory, loc8_31, unloaded
  1350. // CHECK:STDOUT: %Main.import_ref.21018a.2 = import_ref Main//factory, loc6_17, unloaded
  1351. // CHECK:STDOUT: %Main.import_ref.46fc3c.2 = import_ref Main//factory, loc8_31, unloaded
  1352. // CHECK:STDOUT: }
  1353. // CHECK:STDOUT:
  1354. // CHECK:STDOUT: file {
  1355. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1356. // CHECK:STDOUT: .Factory = imports.%Main.Factory
  1357. // CHECK:STDOUT: .A = imports.%Main.A
  1358. // CHECK:STDOUT: .B = imports.%Main.B
  1359. // CHECK:STDOUT: .Core = imports.%Core
  1360. // CHECK:STDOUT: .C = %C.decl
  1361. // CHECK:STDOUT: .MakeC = %MakeC.decl
  1362. // CHECK:STDOUT: .InstanceC = %InstanceC.decl
  1363. // CHECK:STDOUT: }
  1364. // CHECK:STDOUT: %default.import.loc2_23.1 = import <none>
  1365. // CHECK:STDOUT: %default.import.loc2_23.2 = import <none>
  1366. // CHECK:STDOUT: %Core.import = import Core
  1367. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  1368. // CHECK:STDOUT: %MakeC.decl: %MakeC.type = fn_decl @MakeC [concrete = constants.%MakeC] {
  1369. // CHECK:STDOUT: %return.patt: %pattern_type.c48 = return_slot_pattern [concrete]
  1370. // CHECK:STDOUT: %return.param_patt: %pattern_type.c48 = out_param_pattern %return.patt, call_param0 [concrete]
  1371. // CHECK:STDOUT: } {
  1372. // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, file.%C.decl [concrete = constants.%C]
  1373. // CHECK:STDOUT: %return.param: ref %C = out_param call_param0
  1374. // CHECK:STDOUT: %return: ref %C = return_slot %return.param
  1375. // CHECK:STDOUT: }
  1376. // CHECK:STDOUT: %InstanceC.decl: %InstanceC.type = fn_decl @InstanceC [concrete = constants.%InstanceC] {
  1377. // CHECK:STDOUT: %a.patt: %pattern_type.c10 = binding_pattern a [concrete]
  1378. // CHECK:STDOUT: %a.param_patt: %pattern_type.c10 = value_param_pattern %a.patt, call_param0 [concrete]
  1379. // CHECK:STDOUT: %return.patt: %pattern_type.c48 = return_slot_pattern [concrete]
  1380. // CHECK:STDOUT: %return.param_patt: %pattern_type.c48 = out_param_pattern %return.patt, call_param1 [concrete]
  1381. // CHECK:STDOUT: } {
  1382. // CHECK:STDOUT: %C.ref.loc16: type = name_ref C, file.%C.decl [concrete = constants.%C]
  1383. // CHECK:STDOUT: %a.param: %A = value_param call_param0
  1384. // CHECK:STDOUT: %A.ref: type = name_ref A, imports.%Main.A [concrete = constants.%A]
  1385. // CHECK:STDOUT: %a: %A = bind_name a, %a.param
  1386. // CHECK:STDOUT: %return.param: ref %C = out_param call_param1
  1387. // CHECK:STDOUT: %return: ref %C = return_slot %return.param
  1388. // CHECK:STDOUT: }
  1389. // CHECK:STDOUT: }
  1390. // CHECK:STDOUT:
  1391. // CHECK:STDOUT: generic interface @Factory(imports.%Main.import_ref.5ab3ec.1: type) [from "factory.carbon"] {
  1392. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  1393. // CHECK:STDOUT:
  1394. // CHECK:STDOUT: !definition:
  1395. // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(%T)> [symbolic = %Factory.type (constants.%Factory.type.82b)]
  1396. // CHECK:STDOUT: %Self: @Factory.%Factory.type (%Factory.type.82b) = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.f7c)]
  1397. // CHECK:STDOUT: %Factory.Make.type: type = fn_type @Factory.Make, @Factory(%T) [symbolic = %Factory.Make.type (constants.%Factory.Make.type.598)]
  1398. // CHECK:STDOUT: %Factory.Make: @Factory.%Factory.Make.type (%Factory.Make.type.598) = struct_value () [symbolic = %Factory.Make (constants.%Factory.Make.737)]
  1399. // CHECK:STDOUT: %Factory.assoc_type: type = assoc_entity_type @Factory, @Factory(%T) [symbolic = %Factory.assoc_type (constants.%Factory.assoc_type.207)]
  1400. // CHECK:STDOUT: %assoc0: @Factory.%Factory.assoc_type (%Factory.assoc_type.207) = assoc_entity element0, imports.%Main.import_ref.1aa [symbolic = %assoc0 (constants.%assoc0.fe4)]
  1401. // CHECK:STDOUT: %Factory.Method.type: type = fn_type @Factory.Method, @Factory(%T) [symbolic = %Factory.Method.type (constants.%Factory.Method.type.7ee)]
  1402. // CHECK:STDOUT: %Factory.Method: @Factory.%Factory.Method.type (%Factory.Method.type.7ee) = struct_value () [symbolic = %Factory.Method (constants.%Factory.Method.a71)]
  1403. // CHECK:STDOUT: %assoc1: @Factory.%Factory.assoc_type (%Factory.assoc_type.207) = assoc_entity element1, imports.%Main.import_ref.5be [symbolic = %assoc1 (constants.%assoc1.ea6)]
  1404. // CHECK:STDOUT:
  1405. // CHECK:STDOUT: interface {
  1406. // CHECK:STDOUT: !members:
  1407. // CHECK:STDOUT: .Self = imports.%Main.import_ref.119
  1408. // CHECK:STDOUT: .Make = imports.%Main.import_ref.46c
  1409. // CHECK:STDOUT: .Method = imports.%Main.import_ref.2e4
  1410. // CHECK:STDOUT: witness = (imports.%Main.Make, imports.%Main.Method)
  1411. // CHECK:STDOUT: }
  1412. // CHECK:STDOUT: }
  1413. // CHECK:STDOUT:
  1414. // CHECK:STDOUT: impl @A.as.Factory.impl: imports.%Main.import_ref.984 as imports.%Main.import_ref.e91 [from "factory.carbon"] {
  1415. // CHECK:STDOUT: !members:
  1416. // CHECK:STDOUT: .Make = imports.%Main.import_ref.22f
  1417. // CHECK:STDOUT: .Method = imports.%Main.import_ref.5a9
  1418. // CHECK:STDOUT: witness = imports.%Main.import_ref.42c
  1419. // CHECK:STDOUT: }
  1420. // CHECK:STDOUT:
  1421. // CHECK:STDOUT: class @B [from "factory.carbon"] {
  1422. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f24d3.1
  1423. // CHECK:STDOUT:
  1424. // CHECK:STDOUT: !members:
  1425. // CHECK:STDOUT: .Self = imports.%Main.import_ref.54a
  1426. // CHECK:STDOUT: }
  1427. // CHECK:STDOUT:
  1428. // CHECK:STDOUT: class @A [from "factory.carbon"] {
  1429. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f24d3.2
  1430. // CHECK:STDOUT:
  1431. // CHECK:STDOUT: !members:
  1432. // CHECK:STDOUT: .Self = imports.%Main.import_ref.da3
  1433. // CHECK:STDOUT: }
  1434. // CHECK:STDOUT:
  1435. // CHECK:STDOUT: class @C {
  1436. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  1437. // CHECK:STDOUT: complete_type_witness = %complete_type
  1438. // CHECK:STDOUT:
  1439. // CHECK:STDOUT: !members:
  1440. // CHECK:STDOUT: .Self = constants.%C
  1441. // CHECK:STDOUT: }
  1442. // CHECK:STDOUT:
  1443. // CHECK:STDOUT: generic fn @Factory.Make(imports.%Main.import_ref.5ab3ec.2: type, imports.%Main.import_ref.85368a.1: @Factory.%Factory.type (%Factory.type.82b)) [from "factory.carbon"] {
  1444. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  1445. // CHECK:STDOUT: %pattern_type: type = pattern_type %T [symbolic = %pattern_type (constants.%pattern_type.7dc)]
  1446. // CHECK:STDOUT:
  1447. // CHECK:STDOUT: fn;
  1448. // CHECK:STDOUT: }
  1449. // CHECK:STDOUT:
  1450. // CHECK:STDOUT: generic fn @Factory.Method(imports.%Main.import_ref.5ab3ec.3: type, imports.%Main.import_ref.85368a.2: @Factory.%Factory.type (%Factory.type.82b)) [from "factory.carbon"] {
  1451. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  1452. // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(%T)> [symbolic = %Factory.type (constants.%Factory.type.82b)]
  1453. // CHECK:STDOUT: %Self: @Factory.Method.%Factory.type (%Factory.type.82b) = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.f7c)]
  1454. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  1455. // CHECK:STDOUT: %pattern_type.1: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type.1 (constants.%pattern_type.745)]
  1456. // CHECK:STDOUT: %pattern_type.2: type = pattern_type %T [symbolic = %pattern_type.2 (constants.%pattern_type.7dc)]
  1457. // CHECK:STDOUT:
  1458. // CHECK:STDOUT: fn;
  1459. // CHECK:STDOUT: }
  1460. // CHECK:STDOUT:
  1461. // CHECK:STDOUT: fn @MakeC() -> %return.param: %C {
  1462. // CHECK:STDOUT: !entry:
  1463. // CHECK:STDOUT: %A.ref: type = name_ref A, imports.%Main.A [concrete = constants.%A]
  1464. // CHECK:STDOUT: %Factory.ref: %Factory.type.1a8 = name_ref Factory, imports.%Main.Factory [concrete = constants.%Factory.generic]
  1465. // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, file.%C.decl [concrete = constants.%C]
  1466. // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(constants.%C)> [concrete = constants.%Factory.type.a06]
  1467. // CHECK:STDOUT: %.loc13: %Factory.assoc_type.d01 = specific_constant imports.%Main.import_ref.46c, @Factory(constants.%C) [concrete = constants.%assoc0.38e]
  1468. // CHECK:STDOUT: %Make.ref: %Factory.assoc_type.d01 = name_ref Make, %.loc13 [concrete = constants.%assoc0.38e]
  1469. // CHECK:STDOUT: return <error> to %return
  1470. // CHECK:STDOUT: }
  1471. // CHECK:STDOUT:
  1472. // CHECK:STDOUT: fn @InstanceC(%a.param: %A) -> %return.param: %C {
  1473. // CHECK:STDOUT: !entry:
  1474. // CHECK:STDOUT: %a.ref: %A = name_ref a, %a
  1475. // CHECK:STDOUT: %Factory.ref: %Factory.type.1a8 = name_ref Factory, imports.%Main.Factory [concrete = constants.%Factory.generic]
  1476. // CHECK:STDOUT: %C.ref.loc21: type = name_ref C, file.%C.decl [concrete = constants.%C]
  1477. // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(constants.%C)> [concrete = constants.%Factory.type.a06]
  1478. // CHECK:STDOUT: %.loc21: %Factory.assoc_type.d01 = specific_constant imports.%Main.import_ref.2e4, @Factory(constants.%C) [concrete = constants.%assoc1.263]
  1479. // CHECK:STDOUT: %Method.ref: %Factory.assoc_type.d01 = name_ref Method, %.loc21 [concrete = constants.%assoc1.263]
  1480. // CHECK:STDOUT: return <error> to %return
  1481. // CHECK:STDOUT: }
  1482. // CHECK:STDOUT:
  1483. // CHECK:STDOUT: specific @Factory(constants.%T) {
  1484. // CHECK:STDOUT: %T => constants.%T
  1485. // CHECK:STDOUT: }
  1486. // CHECK:STDOUT:
  1487. // CHECK:STDOUT: specific @Factory(constants.%B) {
  1488. // CHECK:STDOUT: %T => constants.%B
  1489. // CHECK:STDOUT:
  1490. // CHECK:STDOUT: !definition:
  1491. // CHECK:STDOUT: %Factory.type => constants.%Factory.type.3cb
  1492. // CHECK:STDOUT: %Self => constants.%Self.145
  1493. // CHECK:STDOUT: %Factory.Make.type => constants.%Factory.Make.type.c59
  1494. // CHECK:STDOUT: %Factory.Make => constants.%Factory.Make.efe
  1495. // CHECK:STDOUT: %Factory.assoc_type => constants.%Factory.assoc_type.579
  1496. // CHECK:STDOUT: %assoc0 => constants.%assoc0.cc7
  1497. // CHECK:STDOUT: %Factory.Method.type => constants.%Factory.Method.type.117
  1498. // CHECK:STDOUT: %Factory.Method => constants.%Factory.Method.ea9
  1499. // CHECK:STDOUT: %assoc1 => constants.%assoc1.535
  1500. // CHECK:STDOUT: }
  1501. // CHECK:STDOUT:
  1502. // CHECK:STDOUT: specific @Factory.Make(constants.%T, constants.%Self.f7c) {
  1503. // CHECK:STDOUT: %T => constants.%T
  1504. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.7dc
  1505. // CHECK:STDOUT: }
  1506. // CHECK:STDOUT:
  1507. // CHECK:STDOUT: specific @Factory.Method(constants.%T, constants.%Self.f7c) {
  1508. // CHECK:STDOUT: %T => constants.%T
  1509. // CHECK:STDOUT: %Factory.type => constants.%Factory.type.82b
  1510. // CHECK:STDOUT: %Self => constants.%Self.f7c
  1511. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  1512. // CHECK:STDOUT: %pattern_type.1 => constants.%pattern_type.745
  1513. // CHECK:STDOUT: %pattern_type.2 => constants.%pattern_type.7dc
  1514. // CHECK:STDOUT: }
  1515. // CHECK:STDOUT:
  1516. // CHECK:STDOUT: specific @Factory(constants.%C) {
  1517. // CHECK:STDOUT: %T => constants.%C
  1518. // CHECK:STDOUT:
  1519. // CHECK:STDOUT: !definition:
  1520. // CHECK:STDOUT: %Factory.type => constants.%Factory.type.a06
  1521. // CHECK:STDOUT: %Self => constants.%Self.c8b
  1522. // CHECK:STDOUT: %Factory.Make.type => constants.%Factory.Make.type.0de
  1523. // CHECK:STDOUT: %Factory.Make => constants.%Factory.Make.8ba
  1524. // CHECK:STDOUT: %Factory.assoc_type => constants.%Factory.assoc_type.d01
  1525. // CHECK:STDOUT: %assoc0 => constants.%assoc0.38e
  1526. // CHECK:STDOUT: %Factory.Method.type => constants.%Factory.Method.type.d46
  1527. // CHECK:STDOUT: %Factory.Method => constants.%Factory.Method.f9e
  1528. // CHECK:STDOUT: %assoc1 => constants.%assoc1.263
  1529. // CHECK:STDOUT: }
  1530. // CHECK:STDOUT: