compound.carbon 73 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077
  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/none.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/compound.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/compound.carbon
  14. // --- core.carbon
  15. package Core;
  16. interface ImplicitAs(Dest:! type) {
  17. fn Convert[self: Self]() -> Dest;
  18. }
  19. // --- non-instance_success.carbon
  20. library "[[@TEST_NAME]]";
  21. interface NonInstance1 {
  22. fn F1();
  23. }
  24. impl {.a: ()} as NonInstance1 {
  25. fn F1() {}
  26. }
  27. fn NonInstanceCall1() {
  28. {.a: ()}.(NonInstance1.F1)();
  29. }
  30. // --- fail_non-instance.carbon
  31. library "[[@TEST_NAME]]";
  32. import Core;
  33. interface NonInstance2 {
  34. fn F2();
  35. }
  36. impl {.b: ()} as NonInstance2 {
  37. fn F2() {}
  38. }
  39. fn NonInstanceCall2(n: {.b: ()}) {
  40. // CHECK:STDERR: fail_non-instance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert non-type value of type `{.b: ()}` into type implementing `NonInstance2` [ConversionFailureNonTypeToFacet]
  41. // CHECK:STDERR: n.(NonInstance2.F2)();
  42. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
  43. // CHECK:STDERR: fail_non-instance.carbon:[[@LINE+4]]:3: note: type `{.b: ()}` does not implement interface `Core.ImplicitAs(NonInstance2)` [MissingImplInMemberAccessInContext]
  44. // CHECK:STDERR: n.(NonInstance2.F2)();
  45. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
  46. // CHECK:STDERR:
  47. n.(NonInstance2.F2)();
  48. }
  49. // --- fail_non-instance_indirect.carbon
  50. library "[[@TEST_NAME]]";
  51. import Core;
  52. interface NonInstance3 {
  53. fn F3();
  54. }
  55. impl {.c: ()} as NonInstance3 {
  56. fn F3() {}
  57. }
  58. fn NonInstanceCallIndirect(p: {.c: ()}*) {
  59. // CHECK:STDERR: fail_non-instance_indirect.carbon:[[@LINE+7]]:3: error: cannot implicitly convert non-type value of type `{.c: ()}` into type implementing `NonInstance3` [ConversionFailureNonTypeToFacet]
  60. // CHECK:STDERR: p->(NonInstance3.F3)();
  61. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
  62. // CHECK:STDERR: fail_non-instance_indirect.carbon:[[@LINE+4]]:3: note: type `{.c: ()}` does not implement interface `Core.ImplicitAs(NonInstance3)` [MissingImplInMemberAccessInContext]
  63. // CHECK:STDERR: p->(NonInstance3.F3)();
  64. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
  65. // CHECK:STDERR:
  66. p->(NonInstance3.F3)();
  67. }
  68. // --- instance_success.carbon
  69. library "[[@TEST_NAME]]";
  70. interface Instance1 {
  71. fn G1[self: Self]();
  72. }
  73. impl {.d: ()} as Instance1 {
  74. fn G1[unused self: Self]() {}
  75. }
  76. fn InstanceCall(n: {.d: ()}) {
  77. n.(Instance1.G1)();
  78. }
  79. fn InstanceCallIndirect(p: {.d: ()}*) {
  80. p->(Instance1.G1)();
  81. }
  82. // --- fail_instance.carbon
  83. library "[[@TEST_NAME]]";
  84. interface Instance2 {
  85. fn G2[self: Self]();
  86. }
  87. impl {.e: ()} as Instance2 {
  88. fn G2[unused self: Self]() {}
  89. }
  90. fn InstanceCallFail() {
  91. // CHECK:STDERR: fail_instance.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Instance2` in type `type` that does not implement that interface [MissingImplInMemberAccess]
  92. // CHECK:STDERR: {.e: ()}.(Instance2.G2)();
  93. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~
  94. // CHECK:STDERR:
  95. {.e: ()}.(Instance2.G2)();
  96. }
  97. // CHECK:STDOUT: --- core.carbon
  98. // CHECK:STDOUT:
  99. // CHECK:STDOUT: constants {
  100. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  101. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self]
  102. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  103. // CHECK:STDOUT: %Dest: type = symbolic_binding Dest, 0 [symbolic]
  104. // CHECK:STDOUT: %ImplicitAs.type.595: type = generic_interface_type @ImplicitAs [concrete]
  105. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.595 = struct_value () [concrete]
  106. // CHECK:STDOUT: %ImplicitAs.type.9fe: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic]
  107. // CHECK:STDOUT: %Self: %ImplicitAs.type.9fe = symbolic_binding Self, 1 [symbolic]
  108. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self [symbolic]
  109. // CHECK:STDOUT: %pattern_type.8de: type = pattern_type %Self.binding.as_type [symbolic]
  110. // CHECK:STDOUT: %.184: Core.Form = init_form %Dest [symbolic]
  111. // CHECK:STDOUT: %pattern_type.51d: type = pattern_type %Dest [symbolic]
  112. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert.type: type = fn_type @ImplicitAs.WithSelf.Convert, @ImplicitAs.WithSelf(%Dest, %Self) [symbolic]
  113. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert: %ImplicitAs.WithSelf.Convert.type = struct_value () [symbolic]
  114. // CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic]
  115. // CHECK:STDOUT: %assoc0: %ImplicitAs.assoc_type = assoc_entity element0, @ImplicitAs.WithSelf.%ImplicitAs.WithSelf.Convert.decl [symbolic]
  116. // CHECK:STDOUT: }
  117. // CHECK:STDOUT:
  118. // CHECK:STDOUT: file {
  119. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  120. // CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl
  121. // CHECK:STDOUT: }
  122. // CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.595 = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] {
  123. // CHECK:STDOUT: %Dest.patt: %pattern_type.98f = symbolic_binding_pattern Dest, 0 [concrete]
  124. // CHECK:STDOUT: } {
  125. // CHECK:STDOUT: %.loc3_29.1: type = splice_block %.loc3_29.2 [concrete = type] {
  126. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  127. // CHECK:STDOUT: %.loc3_29.2: type = type_literal type [concrete = type]
  128. // CHECK:STDOUT: }
  129. // CHECK:STDOUT: %Dest.loc3_26.2: type = symbolic_binding Dest, 0 [symbolic = %Dest.loc3_26.1 (constants.%Dest)]
  130. // CHECK:STDOUT: }
  131. // CHECK:STDOUT: }
  132. // CHECK:STDOUT:
  133. // CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc3_26.2: type) {
  134. // CHECK:STDOUT: %Dest.loc3_26.1: type = symbolic_binding Dest, 0 [symbolic = %Dest.loc3_26.1 (constants.%Dest)]
  135. // CHECK:STDOUT:
  136. // CHECK:STDOUT: !definition:
  137. // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc3_26.1)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.9fe)]
  138. // CHECK:STDOUT: %Self.loc3_35.2: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.9fe) = symbolic_binding Self, 1 [symbolic = %Self.loc3_35.2 (constants.%Self)]
  139. // CHECK:STDOUT:
  140. // CHECK:STDOUT: interface {
  141. // CHECK:STDOUT: %Self.loc3_35.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.9fe) = symbolic_binding Self, 1 [symbolic = %Self.loc3_35.2 (constants.%Self)]
  142. // CHECK:STDOUT: %ImplicitAs.WithSelf.decl = interface_with_self_decl @ImplicitAs [concrete]
  143. // CHECK:STDOUT:
  144. // CHECK:STDOUT: !with Self:
  145. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert.decl: @ImplicitAs.WithSelf.%ImplicitAs.WithSelf.Convert.type (%ImplicitAs.WithSelf.Convert.type) = fn_decl @ImplicitAs.WithSelf.Convert [symbolic = @ImplicitAs.WithSelf.%ImplicitAs.WithSelf.Convert (constants.%ImplicitAs.WithSelf.Convert)] {
  146. // CHECK:STDOUT: %self.param_patt: @ImplicitAs.WithSelf.Convert.%pattern_type.loc4_18 (%pattern_type.8de) = value_param_pattern [concrete]
  147. // CHECK:STDOUT: %self.patt: @ImplicitAs.WithSelf.Convert.%pattern_type.loc4_18 (%pattern_type.8de) = at_binding_pattern self, %self.param_patt [concrete]
  148. // CHECK:STDOUT: %return.param_patt: @ImplicitAs.WithSelf.Convert.%pattern_type.loc4_31 (%pattern_type.51d) = out_param_pattern [concrete]
  149. // CHECK:STDOUT: %return.patt: @ImplicitAs.WithSelf.Convert.%pattern_type.loc4_31 (%pattern_type.51d) = return_slot_pattern %return.param_patt, %Dest.ref [concrete]
  150. // CHECK:STDOUT: } {
  151. // CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc3_26.2 [symbolic = %Dest (constants.%Dest)]
  152. // CHECK:STDOUT: %.loc4_31.2: Core.Form = init_form %Dest.ref [symbolic = %.loc4_31.1 (constants.%.184)]
  153. // CHECK:STDOUT: %self.param: @ImplicitAs.WithSelf.Convert.%Self.binding.as_type (%Self.binding.as_type) = value_param call_param0
  154. // CHECK:STDOUT: %.loc4_20.1: type = splice_block %.loc4_20.3 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] {
  155. // CHECK:STDOUT: %.loc4_20.2: @ImplicitAs.WithSelf.Convert.%ImplicitAs.type (%ImplicitAs.type.9fe) = specific_constant @ImplicitAs.%Self.loc3_35.1, @ImplicitAs(constants.%Dest) [symbolic = %Self (constants.%Self)]
  156. // CHECK:STDOUT: %Self.ref: @ImplicitAs.WithSelf.Convert.%ImplicitAs.type (%ImplicitAs.type.9fe) = name_ref Self, %.loc4_20.2 [symbolic = %Self (constants.%Self)]
  157. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.ref [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  158. // CHECK:STDOUT: %.loc4_20.3: type = converted %Self.ref, %Self.as_type [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  159. // CHECK:STDOUT: }
  160. // CHECK:STDOUT: %self: @ImplicitAs.WithSelf.Convert.%Self.binding.as_type (%Self.binding.as_type) = value_binding self, %self.param
  161. // CHECK:STDOUT: %return.param: ref @ImplicitAs.WithSelf.Convert.%Dest (%Dest) = out_param call_param1
  162. // CHECK:STDOUT: %return: ref @ImplicitAs.WithSelf.Convert.%Dest (%Dest) = return_slot %return.param
  163. // CHECK:STDOUT: }
  164. // CHECK:STDOUT: %assoc0.loc4_35.1: @ImplicitAs.WithSelf.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %ImplicitAs.WithSelf.Convert.decl [symbolic = %assoc0.loc4_35.2 (constants.%assoc0)]
  165. // CHECK:STDOUT:
  166. // CHECK:STDOUT: !members:
  167. // CHECK:STDOUT: .Self = %Self.loc3_35.1
  168. // CHECK:STDOUT: .Dest = <poisoned>
  169. // CHECK:STDOUT: .Dest = <poisoned>
  170. // CHECK:STDOUT: .Convert = @ImplicitAs.WithSelf.%assoc0.loc4_35.1
  171. // CHECK:STDOUT: witness = (@ImplicitAs.WithSelf.%ImplicitAs.WithSelf.Convert.decl)
  172. // CHECK:STDOUT:
  173. // CHECK:STDOUT: !requires:
  174. // CHECK:STDOUT: }
  175. // CHECK:STDOUT: }
  176. // CHECK:STDOUT:
  177. // CHECK:STDOUT: generic fn @ImplicitAs.WithSelf.Convert(@ImplicitAs.%Dest.loc3_26.2: type, @ImplicitAs.%Self.loc3_35.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.9fe)) {
  178. // CHECK:STDOUT: %Dest: type = symbolic_binding Dest, 0 [symbolic = %Dest (constants.%Dest)]
  179. // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.9fe)]
  180. // CHECK:STDOUT: %Self: @ImplicitAs.WithSelf.Convert.%ImplicitAs.type (%ImplicitAs.type.9fe) = symbolic_binding Self, 1 [symbolic = %Self (constants.%Self)]
  181. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  182. // CHECK:STDOUT: %pattern_type.loc4_18: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type.loc4_18 (constants.%pattern_type.8de)]
  183. // CHECK:STDOUT: %.loc4_31.1: Core.Form = init_form %Dest [symbolic = %.loc4_31.1 (constants.%.184)]
  184. // CHECK:STDOUT: %pattern_type.loc4_31: type = pattern_type %Dest [symbolic = %pattern_type.loc4_31 (constants.%pattern_type.51d)]
  185. // CHECK:STDOUT:
  186. // CHECK:STDOUT: fn(%self.param: @ImplicitAs.WithSelf.Convert.%Self.binding.as_type (%Self.binding.as_type)) -> out %return.param: @ImplicitAs.WithSelf.Convert.%Dest (%Dest);
  187. // CHECK:STDOUT: }
  188. // CHECK:STDOUT:
  189. // CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) {
  190. // CHECK:STDOUT: %Dest.loc3_26.1 => constants.%Dest
  191. // CHECK:STDOUT: }
  192. // CHECK:STDOUT:
  193. // CHECK:STDOUT: specific @ImplicitAs.WithSelf(constants.%Dest, constants.%Self) {}
  194. // CHECK:STDOUT:
  195. // CHECK:STDOUT: specific @ImplicitAs.WithSelf.Convert(constants.%Dest, constants.%Self) {
  196. // CHECK:STDOUT: %Dest => constants.%Dest
  197. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.9fe
  198. // CHECK:STDOUT: %Self => constants.%Self
  199. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  200. // CHECK:STDOUT: %pattern_type.loc4_18 => constants.%pattern_type.8de
  201. // CHECK:STDOUT: %.loc4_31.1 => constants.%.184
  202. // CHECK:STDOUT: %pattern_type.loc4_31 => constants.%pattern_type.51d
  203. // CHECK:STDOUT: }
  204. // CHECK:STDOUT:
  205. // CHECK:STDOUT: --- non-instance_success.carbon
  206. // CHECK:STDOUT:
  207. // CHECK:STDOUT: constants {
  208. // CHECK:STDOUT: %NonInstance1.type: type = facet_type <@NonInstance1> [concrete]
  209. // CHECK:STDOUT: %Self: %NonInstance1.type = symbolic_binding Self, 0 [symbolic]
  210. // CHECK:STDOUT: %NonInstance1.WithSelf.F1.type.3a6: type = fn_type @NonInstance1.WithSelf.F1, @NonInstance1.WithSelf(%Self) [symbolic]
  211. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  212. // CHECK:STDOUT: %NonInstance1.WithSelf.F1.898: %NonInstance1.WithSelf.F1.type.3a6 = struct_value () [symbolic]
  213. // CHECK:STDOUT: %NonInstance1.assoc_type: type = assoc_entity_type @NonInstance1 [concrete]
  214. // CHECK:STDOUT: %assoc0: %NonInstance1.assoc_type = assoc_entity element0, @NonInstance1.WithSelf.%NonInstance1.WithSelf.F1.decl [concrete]
  215. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  216. // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %empty_tuple.type} [concrete]
  217. // CHECK:STDOUT: %NonInstance1.impl_witness: <witness> = impl_witness @struct_type.a.as.NonInstance1.impl.%NonInstance1.impl_witness_table [concrete]
  218. // CHECK:STDOUT: %struct_type.a.as.NonInstance1.impl.F1.type: type = fn_type @struct_type.a.as.NonInstance1.impl.F1 [concrete]
  219. // CHECK:STDOUT: %struct_type.a.as.NonInstance1.impl.F1: %struct_type.a.as.NonInstance1.impl.F1.type = struct_value () [concrete]
  220. // CHECK:STDOUT: %NonInstance1.facet: %NonInstance1.type = facet_value %struct_type.a, (%NonInstance1.impl_witness) [concrete]
  221. // CHECK:STDOUT: %NonInstance1.WithSelf.F1.type.a2c: type = fn_type @NonInstance1.WithSelf.F1, @NonInstance1.WithSelf(%NonInstance1.facet) [concrete]
  222. // CHECK:STDOUT: %NonInstance1.WithSelf.F1.e33: %NonInstance1.WithSelf.F1.type.a2c = struct_value () [concrete]
  223. // CHECK:STDOUT: %NonInstanceCall1.type: type = fn_type @NonInstanceCall1 [concrete]
  224. // CHECK:STDOUT: %NonInstanceCall1: %NonInstanceCall1.type = struct_value () [concrete]
  225. // CHECK:STDOUT: %.737: type = fn_type_with_self_type %NonInstance1.WithSelf.F1.type.a2c, %NonInstance1.facet [concrete]
  226. // CHECK:STDOUT: }
  227. // CHECK:STDOUT:
  228. // CHECK:STDOUT: file {
  229. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  230. // CHECK:STDOUT: .NonInstance1 = %NonInstance1.decl
  231. // CHECK:STDOUT: .NonInstanceCall1 = %NonInstanceCall1.decl
  232. // CHECK:STDOUT: }
  233. // CHECK:STDOUT: %NonInstance1.decl: type = interface_decl @NonInstance1 [concrete = constants.%NonInstance1.type] {} {}
  234. // CHECK:STDOUT: impl_decl @struct_type.a.as.NonInstance1.impl [concrete] {} {
  235. // CHECK:STDOUT: %.loc7_12.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  236. // CHECK:STDOUT: %.loc7_12.2: type = converted %.loc7_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  237. // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %empty_tuple.type} [concrete = constants.%struct_type.a]
  238. // CHECK:STDOUT: %NonInstance1.ref: type = name_ref NonInstance1, file.%NonInstance1.decl [concrete = constants.%NonInstance1.type]
  239. // CHECK:STDOUT: }
  240. // CHECK:STDOUT: %NonInstanceCall1.decl: %NonInstanceCall1.type = fn_decl @NonInstanceCall1 [concrete = constants.%NonInstanceCall1] {} {}
  241. // CHECK:STDOUT: }
  242. // CHECK:STDOUT:
  243. // CHECK:STDOUT: interface @NonInstance1 {
  244. // CHECK:STDOUT: %Self: %NonInstance1.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  245. // CHECK:STDOUT: %NonInstance1.WithSelf.decl = interface_with_self_decl @NonInstance1 [concrete]
  246. // CHECK:STDOUT:
  247. // CHECK:STDOUT: !with Self:
  248. // CHECK:STDOUT: %NonInstance1.WithSelf.F1.decl: @NonInstance1.WithSelf.%NonInstance1.WithSelf.F1.type (%NonInstance1.WithSelf.F1.type.3a6) = fn_decl @NonInstance1.WithSelf.F1 [symbolic = @NonInstance1.WithSelf.%NonInstance1.WithSelf.F1 (constants.%NonInstance1.WithSelf.F1.898)] {} {}
  249. // CHECK:STDOUT: %assoc0: %NonInstance1.assoc_type = assoc_entity element0, %NonInstance1.WithSelf.F1.decl [concrete = constants.%assoc0]
  250. // CHECK:STDOUT:
  251. // CHECK:STDOUT: !members:
  252. // CHECK:STDOUT: .Self = %Self
  253. // CHECK:STDOUT: .F1 = @NonInstance1.WithSelf.%assoc0
  254. // CHECK:STDOUT: witness = (@NonInstance1.WithSelf.%NonInstance1.WithSelf.F1.decl)
  255. // CHECK:STDOUT:
  256. // CHECK:STDOUT: !requires:
  257. // CHECK:STDOUT: }
  258. // CHECK:STDOUT:
  259. // CHECK:STDOUT: impl @struct_type.a.as.NonInstance1.impl: %struct_type.a as %NonInstance1.ref {
  260. // CHECK:STDOUT: %struct_type.a.as.NonInstance1.impl.F1.decl: %struct_type.a.as.NonInstance1.impl.F1.type = fn_decl @struct_type.a.as.NonInstance1.impl.F1 [concrete = constants.%struct_type.a.as.NonInstance1.impl.F1] {} {}
  261. // CHECK:STDOUT: %NonInstance1.impl_witness_table = impl_witness_table (%struct_type.a.as.NonInstance1.impl.F1.decl), @struct_type.a.as.NonInstance1.impl [concrete]
  262. // CHECK:STDOUT: %NonInstance1.impl_witness: <witness> = impl_witness %NonInstance1.impl_witness_table [concrete = constants.%NonInstance1.impl_witness]
  263. // CHECK:STDOUT:
  264. // CHECK:STDOUT: !members:
  265. // CHECK:STDOUT: .F1 = %struct_type.a.as.NonInstance1.impl.F1.decl
  266. // CHECK:STDOUT: witness = %NonInstance1.impl_witness
  267. // CHECK:STDOUT: }
  268. // CHECK:STDOUT:
  269. // CHECK:STDOUT: generic fn @NonInstance1.WithSelf.F1(@NonInstance1.%Self: %NonInstance1.type) {
  270. // CHECK:STDOUT: fn();
  271. // CHECK:STDOUT: }
  272. // CHECK:STDOUT:
  273. // CHECK:STDOUT: fn @struct_type.a.as.NonInstance1.impl.F1() {
  274. // CHECK:STDOUT: !entry:
  275. // CHECK:STDOUT: return
  276. // CHECK:STDOUT: }
  277. // CHECK:STDOUT:
  278. // CHECK:STDOUT: fn @NonInstanceCall1() {
  279. // CHECK:STDOUT: !entry:
  280. // CHECK:STDOUT: %.loc12_9.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  281. // CHECK:STDOUT: %.loc12_9.2: type = converted %.loc12_9.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  282. // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %empty_tuple.type} [concrete = constants.%struct_type.a]
  283. // CHECK:STDOUT: %NonInstance1.ref: type = name_ref NonInstance1, file.%NonInstance1.decl [concrete = constants.%NonInstance1.type]
  284. // CHECK:STDOUT: %F1.ref: %NonInstance1.assoc_type = name_ref F1, @NonInstance1.WithSelf.%assoc0 [concrete = constants.%assoc0]
  285. // CHECK:STDOUT: %NonInstance1.facet: %NonInstance1.type = facet_value %struct_type.a, (constants.%NonInstance1.impl_witness) [concrete = constants.%NonInstance1.facet]
  286. // CHECK:STDOUT: %.loc12_11: %NonInstance1.type = converted %struct_type.a, %NonInstance1.facet [concrete = constants.%NonInstance1.facet]
  287. // CHECK:STDOUT: %impl.elem0: %.737 = impl_witness_access constants.%NonInstance1.impl_witness, element0 [concrete = constants.%struct_type.a.as.NonInstance1.impl.F1]
  288. // CHECK:STDOUT: %struct_type.a.as.NonInstance1.impl.F1.call: init %empty_tuple.type = call %impl.elem0()
  289. // CHECK:STDOUT: return
  290. // CHECK:STDOUT: }
  291. // CHECK:STDOUT:
  292. // CHECK:STDOUT: specific @NonInstance1.WithSelf(constants.%Self) {
  293. // CHECK:STDOUT: !definition:
  294. // CHECK:STDOUT: %Self => constants.%Self
  295. // CHECK:STDOUT: %NonInstance1.WithSelf.F1.type => constants.%NonInstance1.WithSelf.F1.type.3a6
  296. // CHECK:STDOUT: %NonInstance1.WithSelf.F1 => constants.%NonInstance1.WithSelf.F1.898
  297. // CHECK:STDOUT: }
  298. // CHECK:STDOUT:
  299. // CHECK:STDOUT: specific @NonInstance1.WithSelf.F1(constants.%Self) {}
  300. // CHECK:STDOUT:
  301. // CHECK:STDOUT: specific @NonInstance1.WithSelf(constants.%NonInstance1.facet) {
  302. // CHECK:STDOUT: !definition:
  303. // CHECK:STDOUT: %Self => constants.%NonInstance1.facet
  304. // CHECK:STDOUT: %NonInstance1.WithSelf.F1.type => constants.%NonInstance1.WithSelf.F1.type.a2c
  305. // CHECK:STDOUT: %NonInstance1.WithSelf.F1 => constants.%NonInstance1.WithSelf.F1.e33
  306. // CHECK:STDOUT: }
  307. // CHECK:STDOUT:
  308. // CHECK:STDOUT: specific @NonInstance1.WithSelf.F1(constants.%NonInstance1.facet) {}
  309. // CHECK:STDOUT:
  310. // CHECK:STDOUT: --- fail_non-instance.carbon
  311. // CHECK:STDOUT:
  312. // CHECK:STDOUT: constants {
  313. // CHECK:STDOUT: %NonInstance2.type: type = facet_type <@NonInstance2> [concrete]
  314. // CHECK:STDOUT: %Self.e6c: %NonInstance2.type = symbolic_binding Self, 0 [symbolic]
  315. // CHECK:STDOUT: %NonInstance2.WithSelf.F2.type.824: type = fn_type @NonInstance2.WithSelf.F2, @NonInstance2.WithSelf(%Self.e6c) [symbolic]
  316. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  317. // CHECK:STDOUT: %NonInstance2.WithSelf.F2.9da: %NonInstance2.WithSelf.F2.type.824 = struct_value () [symbolic]
  318. // CHECK:STDOUT: %NonInstance2.assoc_type: type = assoc_entity_type @NonInstance2 [concrete]
  319. // CHECK:STDOUT: %assoc0.56f: %NonInstance2.assoc_type = assoc_entity element0, @NonInstance2.WithSelf.%NonInstance2.WithSelf.F2.decl [concrete]
  320. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  321. // CHECK:STDOUT: %struct_type.b: type = struct_type {.b: %empty_tuple.type} [concrete]
  322. // CHECK:STDOUT: %NonInstance2.impl_witness: <witness> = impl_witness @struct_type.b.as.NonInstance2.impl.%NonInstance2.impl_witness_table [concrete]
  323. // CHECK:STDOUT: %struct_type.b.as.NonInstance2.impl.F2.type: type = fn_type @struct_type.b.as.NonInstance2.impl.F2 [concrete]
  324. // CHECK:STDOUT: %struct_type.b.as.NonInstance2.impl.F2: %struct_type.b.as.NonInstance2.impl.F2.type = struct_value () [concrete]
  325. // CHECK:STDOUT: %NonInstance2.facet: %NonInstance2.type = facet_value %struct_type.b, (%NonInstance2.impl_witness) [concrete]
  326. // CHECK:STDOUT: %NonInstance2.WithSelf.F2.type.041: type = fn_type @NonInstance2.WithSelf.F2, @NonInstance2.WithSelf(%NonInstance2.facet) [concrete]
  327. // CHECK:STDOUT: %NonInstance2.WithSelf.F2.fc4: %NonInstance2.WithSelf.F2.type.041 = struct_value () [concrete]
  328. // CHECK:STDOUT: %pattern_type.d5c: type = pattern_type %struct_type.b [concrete]
  329. // CHECK:STDOUT: %NonInstanceCall2.type: type = fn_type @NonInstanceCall2 [concrete]
  330. // CHECK:STDOUT: %NonInstanceCall2: %NonInstanceCall2.type = struct_value () [concrete]
  331. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  332. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  333. // CHECK:STDOUT: %Dest: type = symbolic_binding Dest, 0 [symbolic]
  334. // CHECK:STDOUT: %ImplicitAs.type.031: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic]
  335. // CHECK:STDOUT: %Self.738: %ImplicitAs.type.031 = symbolic_binding Self, 1 [symbolic]
  336. // CHECK:STDOUT: %ImplicitAs.assoc_type.ff3: type = assoc_entity_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic]
  337. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert.type.b3a: type = fn_type @ImplicitAs.WithSelf.Convert, @ImplicitAs.WithSelf(%Dest, %Self.738) [symbolic]
  338. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert.1de: %ImplicitAs.WithSelf.Convert.type.b3a = struct_value () [symbolic]
  339. // CHECK:STDOUT: %pattern_type.51d: type = pattern_type %Dest [symbolic]
  340. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self.738 [symbolic]
  341. // CHECK:STDOUT: %pattern_type.e9a: type = pattern_type %Self.binding.as_type [symbolic]
  342. // CHECK:STDOUT: %.184: Core.Form = init_form %Dest [symbolic]
  343. // CHECK:STDOUT: %ImplicitAs.type.282: type = facet_type <@ImplicitAs, @ImplicitAs(%NonInstance2.type)> [concrete]
  344. // CHECK:STDOUT: %Self.df1: %ImplicitAs.type.282 = symbolic_binding Self, 1 [symbolic]
  345. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert.type.03b: type = fn_type @ImplicitAs.WithSelf.Convert, @ImplicitAs.WithSelf(%NonInstance2.type, %Self.738) [symbolic]
  346. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert.4fe: %ImplicitAs.WithSelf.Convert.type.03b = struct_value () [symbolic]
  347. // CHECK:STDOUT: %ImplicitAs.assoc_type.cd6: type = assoc_entity_type @ImplicitAs, @ImplicitAs(%NonInstance2.type) [concrete]
  348. // CHECK:STDOUT: %assoc0.af4: %ImplicitAs.assoc_type.cd6 = assoc_entity element0, imports.%Core.import_ref.201 [concrete]
  349. // CHECK:STDOUT: %assoc0.843: %ImplicitAs.assoc_type.ff3 = assoc_entity element0, imports.%Core.import_ref.cc1 [symbolic]
  350. // CHECK:STDOUT: }
  351. // CHECK:STDOUT:
  352. // CHECK:STDOUT: imports {
  353. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  354. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  355. // CHECK:STDOUT: import Core//default
  356. // CHECK:STDOUT: }
  357. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//default, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  358. // CHECK:STDOUT: %Core.import_ref.178: @ImplicitAs.WithSelf.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.ff3) = import_ref Core//default, loc{{\d+_\d+}}, loaded [symbolic = @ImplicitAs.WithSelf.%assoc0 (constants.%assoc0.843)]
  359. // CHECK:STDOUT: %Core.Convert = import_ref Core//default, Convert, unloaded
  360. // CHECK:STDOUT: %Core.import_ref.201: @ImplicitAs.WithSelf.%ImplicitAs.WithSelf.Convert.type (%ImplicitAs.WithSelf.Convert.type.b3a) = import_ref Core//default, loc{{\d+_\d+}}, loaded [symbolic = @ImplicitAs.WithSelf.%ImplicitAs.WithSelf.Convert (constants.%ImplicitAs.WithSelf.Convert.1de)]
  361. // CHECK:STDOUT: %Core.import_ref.b3bc94.2: type = import_ref Core//default, loc{{\d+_\d+}}, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)]
  362. // CHECK:STDOUT: %Core.import_ref.ac4dc5.2: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.031) = import_ref Core//default, loc{{\d+_\d+}}, loaded [symbolic = @ImplicitAs.%Self (constants.%Self.738)]
  363. // CHECK:STDOUT: %Core.import_ref.9ec = import_ref Core//default, loc{{\d+_\d+}}, unloaded
  364. // CHECK:STDOUT: %Core.import_ref.b3bc94.3: type = import_ref Core//default, loc{{\d+_\d+}}, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)]
  365. // CHECK:STDOUT: %Core.import_ref.cc1 = import_ref Core//default, loc{{\d+_\d+}}, unloaded
  366. // CHECK:STDOUT: }
  367. // CHECK:STDOUT:
  368. // CHECK:STDOUT: file {
  369. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  370. // CHECK:STDOUT: .Core = imports.%Core
  371. // CHECK:STDOUT: .NonInstance2 = %NonInstance2.decl
  372. // CHECK:STDOUT: .NonInstanceCall2 = %NonInstanceCall2.decl
  373. // CHECK:STDOUT: }
  374. // CHECK:STDOUT: %Core.import = import Core
  375. // CHECK:STDOUT: %NonInstance2.decl: type = interface_decl @NonInstance2 [concrete = constants.%NonInstance2.type] {} {}
  376. // CHECK:STDOUT: impl_decl @struct_type.b.as.NonInstance2.impl [concrete] {} {
  377. // CHECK:STDOUT: %.loc9_12.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  378. // CHECK:STDOUT: %.loc9_12.2: type = converted %.loc9_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  379. // CHECK:STDOUT: %struct_type.b: type = struct_type {.b: %empty_tuple.type} [concrete = constants.%struct_type.b]
  380. // CHECK:STDOUT: %NonInstance2.ref: type = name_ref NonInstance2, file.%NonInstance2.decl [concrete = constants.%NonInstance2.type]
  381. // CHECK:STDOUT: }
  382. // CHECK:STDOUT: %NonInstanceCall2.decl: %NonInstanceCall2.type = fn_decl @NonInstanceCall2 [concrete = constants.%NonInstanceCall2] {
  383. // CHECK:STDOUT: %n.param_patt: %pattern_type.d5c = value_param_pattern [concrete]
  384. // CHECK:STDOUT: %n.patt: %pattern_type.d5c = at_binding_pattern n, %n.param_patt [concrete]
  385. // CHECK:STDOUT: } {
  386. // CHECK:STDOUT: %n.param: %struct_type.b = value_param call_param0
  387. // CHECK:STDOUT: %.loc13_31: type = splice_block %struct_type.b [concrete = constants.%struct_type.b] {
  388. // CHECK:STDOUT: %.loc13_30.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  389. // CHECK:STDOUT: %.loc13_30.2: type = converted %.loc13_30.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  390. // CHECK:STDOUT: %struct_type.b: type = struct_type {.b: %empty_tuple.type} [concrete = constants.%struct_type.b]
  391. // CHECK:STDOUT: }
  392. // CHECK:STDOUT: %n: %struct_type.b = value_binding n, %n.param
  393. // CHECK:STDOUT: }
  394. // CHECK:STDOUT: }
  395. // CHECK:STDOUT:
  396. // CHECK:STDOUT: interface @NonInstance2 {
  397. // CHECK:STDOUT: %Self: %NonInstance2.type = symbolic_binding Self, 0 [symbolic = constants.%Self.e6c]
  398. // CHECK:STDOUT: %NonInstance2.WithSelf.decl = interface_with_self_decl @NonInstance2 [concrete]
  399. // CHECK:STDOUT:
  400. // CHECK:STDOUT: !with Self:
  401. // CHECK:STDOUT: %NonInstance2.WithSelf.F2.decl: @NonInstance2.WithSelf.%NonInstance2.WithSelf.F2.type (%NonInstance2.WithSelf.F2.type.824) = fn_decl @NonInstance2.WithSelf.F2 [symbolic = @NonInstance2.WithSelf.%NonInstance2.WithSelf.F2 (constants.%NonInstance2.WithSelf.F2.9da)] {} {}
  402. // CHECK:STDOUT: %assoc0: %NonInstance2.assoc_type = assoc_entity element0, %NonInstance2.WithSelf.F2.decl [concrete = constants.%assoc0.56f]
  403. // CHECK:STDOUT:
  404. // CHECK:STDOUT: !members:
  405. // CHECK:STDOUT: .Self = %Self
  406. // CHECK:STDOUT: .F2 = @NonInstance2.WithSelf.%assoc0
  407. // CHECK:STDOUT: witness = (@NonInstance2.WithSelf.%NonInstance2.WithSelf.F2.decl)
  408. // CHECK:STDOUT:
  409. // CHECK:STDOUT: !requires:
  410. // CHECK:STDOUT: }
  411. // CHECK:STDOUT:
  412. // CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.b3bc94.3: type) [from "core.carbon"] {
  413. // CHECK:STDOUT: %Dest: type = symbolic_binding Dest, 0 [symbolic = %Dest (constants.%Dest)]
  414. // CHECK:STDOUT:
  415. // CHECK:STDOUT: !definition:
  416. // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.031)]
  417. // CHECK:STDOUT: %Self: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.031) = symbolic_binding Self, 1 [symbolic = %Self (constants.%Self.738)]
  418. // CHECK:STDOUT:
  419. // CHECK:STDOUT: interface {
  420. // CHECK:STDOUT: !members:
  421. // CHECK:STDOUT: .Self = imports.%Core.import_ref.9ec
  422. // CHECK:STDOUT: .Convert = imports.%Core.import_ref.178
  423. // CHECK:STDOUT: witness = (imports.%Core.Convert)
  424. // CHECK:STDOUT:
  425. // CHECK:STDOUT: !requires:
  426. // CHECK:STDOUT: }
  427. // CHECK:STDOUT: }
  428. // CHECK:STDOUT:
  429. // CHECK:STDOUT: impl @struct_type.b.as.NonInstance2.impl: %struct_type.b as %NonInstance2.ref {
  430. // CHECK:STDOUT: %struct_type.b.as.NonInstance2.impl.F2.decl: %struct_type.b.as.NonInstance2.impl.F2.type = fn_decl @struct_type.b.as.NonInstance2.impl.F2 [concrete = constants.%struct_type.b.as.NonInstance2.impl.F2] {} {}
  431. // CHECK:STDOUT: %NonInstance2.impl_witness_table = impl_witness_table (%struct_type.b.as.NonInstance2.impl.F2.decl), @struct_type.b.as.NonInstance2.impl [concrete]
  432. // CHECK:STDOUT: %NonInstance2.impl_witness: <witness> = impl_witness %NonInstance2.impl_witness_table [concrete = constants.%NonInstance2.impl_witness]
  433. // CHECK:STDOUT:
  434. // CHECK:STDOUT: !members:
  435. // CHECK:STDOUT: .F2 = %struct_type.b.as.NonInstance2.impl.F2.decl
  436. // CHECK:STDOUT: witness = %NonInstance2.impl_witness
  437. // CHECK:STDOUT: }
  438. // CHECK:STDOUT:
  439. // CHECK:STDOUT: generic fn @NonInstance2.WithSelf.F2(@NonInstance2.%Self: %NonInstance2.type) {
  440. // CHECK:STDOUT: fn();
  441. // CHECK:STDOUT: }
  442. // CHECK:STDOUT:
  443. // CHECK:STDOUT: fn @struct_type.b.as.NonInstance2.impl.F2() {
  444. // CHECK:STDOUT: !entry:
  445. // CHECK:STDOUT: return
  446. // CHECK:STDOUT: }
  447. // CHECK:STDOUT:
  448. // CHECK:STDOUT: fn @NonInstanceCall2(%n.param: %struct_type.b) {
  449. // CHECK:STDOUT: !entry:
  450. // CHECK:STDOUT: %n.ref: %struct_type.b = name_ref n, %n
  451. // CHECK:STDOUT: %NonInstance2.ref: type = name_ref NonInstance2, file.%NonInstance2.decl [concrete = constants.%NonInstance2.type]
  452. // CHECK:STDOUT: %F2.ref: %NonInstance2.assoc_type = name_ref F2, @NonInstance2.WithSelf.%assoc0 [concrete = constants.%assoc0.56f]
  453. // CHECK:STDOUT: %.loc21: %NonInstance2.type = converted %n.ref, <error> [concrete = <error>]
  454. // CHECK:STDOUT: return
  455. // CHECK:STDOUT: }
  456. // CHECK:STDOUT:
  457. // CHECK:STDOUT: generic fn @ImplicitAs.WithSelf.Convert(imports.%Core.import_ref.b3bc94.2: type, imports.%Core.import_ref.ac4dc5.2: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.031)) [from "core.carbon"] {
  458. // CHECK:STDOUT: %Dest: type = symbolic_binding Dest, 0 [symbolic = %Dest (constants.%Dest)]
  459. // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.031)]
  460. // CHECK:STDOUT: %Self: @ImplicitAs.WithSelf.Convert.%ImplicitAs.type (%ImplicitAs.type.031) = symbolic_binding Self, 1 [symbolic = %Self (constants.%Self.738)]
  461. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  462. // CHECK:STDOUT: %pattern_type.1: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type.1 (constants.%pattern_type.e9a)]
  463. // CHECK:STDOUT: %.1: Core.Form = init_form %Dest [symbolic = %.1 (constants.%.184)]
  464. // CHECK:STDOUT: %pattern_type.2: type = pattern_type %Dest [symbolic = %pattern_type.2 (constants.%pattern_type.51d)]
  465. // CHECK:STDOUT:
  466. // CHECK:STDOUT: fn;
  467. // CHECK:STDOUT: }
  468. // CHECK:STDOUT:
  469. // CHECK:STDOUT: specific @NonInstance2.WithSelf(constants.%Self.e6c) {
  470. // CHECK:STDOUT: !definition:
  471. // CHECK:STDOUT: %Self => constants.%Self.e6c
  472. // CHECK:STDOUT: %NonInstance2.WithSelf.F2.type => constants.%NonInstance2.WithSelf.F2.type.824
  473. // CHECK:STDOUT: %NonInstance2.WithSelf.F2 => constants.%NonInstance2.WithSelf.F2.9da
  474. // CHECK:STDOUT: }
  475. // CHECK:STDOUT:
  476. // CHECK:STDOUT: specific @NonInstance2.WithSelf.F2(constants.%Self.e6c) {}
  477. // CHECK:STDOUT:
  478. // CHECK:STDOUT: specific @NonInstance2.WithSelf(constants.%NonInstance2.facet) {
  479. // CHECK:STDOUT: !definition:
  480. // CHECK:STDOUT: %Self => constants.%NonInstance2.facet
  481. // CHECK:STDOUT: %NonInstance2.WithSelf.F2.type => constants.%NonInstance2.WithSelf.F2.type.041
  482. // CHECK:STDOUT: %NonInstance2.WithSelf.F2 => constants.%NonInstance2.WithSelf.F2.fc4
  483. // CHECK:STDOUT: }
  484. // CHECK:STDOUT:
  485. // CHECK:STDOUT: specific @NonInstance2.WithSelf.F2(constants.%NonInstance2.facet) {}
  486. // CHECK:STDOUT:
  487. // CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) {
  488. // CHECK:STDOUT: %Dest => constants.%Dest
  489. // CHECK:STDOUT: }
  490. // CHECK:STDOUT:
  491. // CHECK:STDOUT: specific @ImplicitAs.WithSelf(constants.%Dest, constants.%Self.738) {}
  492. // CHECK:STDOUT:
  493. // CHECK:STDOUT: specific @ImplicitAs.WithSelf.Convert(constants.%Dest, constants.%Self.738) {
  494. // CHECK:STDOUT: %Dest => constants.%Dest
  495. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.031
  496. // CHECK:STDOUT: %Self => constants.%Self.738
  497. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  498. // CHECK:STDOUT: %pattern_type.1 => constants.%pattern_type.e9a
  499. // CHECK:STDOUT: %.1 => constants.%.184
  500. // CHECK:STDOUT: %pattern_type.2 => constants.%pattern_type.51d
  501. // CHECK:STDOUT: }
  502. // CHECK:STDOUT:
  503. // CHECK:STDOUT: specific @ImplicitAs(constants.%NonInstance2.type) {
  504. // CHECK:STDOUT: %Dest => constants.%NonInstance2.type
  505. // CHECK:STDOUT:
  506. // CHECK:STDOUT: !definition:
  507. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.282
  508. // CHECK:STDOUT: %Self => constants.%Self.df1
  509. // CHECK:STDOUT: }
  510. // CHECK:STDOUT:
  511. // CHECK:STDOUT: specific @ImplicitAs.WithSelf(constants.%NonInstance2.type, constants.%Self.738) {
  512. // CHECK:STDOUT: !definition:
  513. // CHECK:STDOUT: %Dest => constants.%NonInstance2.type
  514. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.282
  515. // CHECK:STDOUT: %Self => constants.%Self.738
  516. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert.type => constants.%ImplicitAs.WithSelf.Convert.type.03b
  517. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert => constants.%ImplicitAs.WithSelf.Convert.4fe
  518. // CHECK:STDOUT: %ImplicitAs.assoc_type => constants.%ImplicitAs.assoc_type.cd6
  519. // CHECK:STDOUT: %assoc0 => constants.%assoc0.af4
  520. // CHECK:STDOUT: }
  521. // CHECK:STDOUT:
  522. // CHECK:STDOUT: --- fail_non-instance_indirect.carbon
  523. // CHECK:STDOUT:
  524. // CHECK:STDOUT: constants {
  525. // CHECK:STDOUT: %NonInstance3.type: type = facet_type <@NonInstance3> [concrete]
  526. // CHECK:STDOUT: %Self.0da: %NonInstance3.type = symbolic_binding Self, 0 [symbolic]
  527. // CHECK:STDOUT: %NonInstance3.WithSelf.F3.type.c21: type = fn_type @NonInstance3.WithSelf.F3, @NonInstance3.WithSelf(%Self.0da) [symbolic]
  528. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  529. // CHECK:STDOUT: %NonInstance3.WithSelf.F3.b62: %NonInstance3.WithSelf.F3.type.c21 = struct_value () [symbolic]
  530. // CHECK:STDOUT: %NonInstance3.assoc_type: type = assoc_entity_type @NonInstance3 [concrete]
  531. // CHECK:STDOUT: %assoc0.342: %NonInstance3.assoc_type = assoc_entity element0, @NonInstance3.WithSelf.%NonInstance3.WithSelf.F3.decl [concrete]
  532. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  533. // CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %empty_tuple.type} [concrete]
  534. // CHECK:STDOUT: %NonInstance3.impl_witness: <witness> = impl_witness @struct_type.c.as.NonInstance3.impl.%NonInstance3.impl_witness_table [concrete]
  535. // CHECK:STDOUT: %struct_type.c.as.NonInstance3.impl.F3.type: type = fn_type @struct_type.c.as.NonInstance3.impl.F3 [concrete]
  536. // CHECK:STDOUT: %struct_type.c.as.NonInstance3.impl.F3: %struct_type.c.as.NonInstance3.impl.F3.type = struct_value () [concrete]
  537. // CHECK:STDOUT: %NonInstance3.facet: %NonInstance3.type = facet_value %struct_type.c, (%NonInstance3.impl_witness) [concrete]
  538. // CHECK:STDOUT: %NonInstance3.WithSelf.F3.type.a3f: type = fn_type @NonInstance3.WithSelf.F3, @NonInstance3.WithSelf(%NonInstance3.facet) [concrete]
  539. // CHECK:STDOUT: %NonInstance3.WithSelf.F3.04b: %NonInstance3.WithSelf.F3.type.a3f = struct_value () [concrete]
  540. // CHECK:STDOUT: %ptr: type = ptr_type %struct_type.c [concrete]
  541. // CHECK:STDOUT: %pattern_type.5f5: type = pattern_type %ptr [concrete]
  542. // CHECK:STDOUT: %NonInstanceCallIndirect.type: type = fn_type @NonInstanceCallIndirect [concrete]
  543. // CHECK:STDOUT: %NonInstanceCallIndirect: %NonInstanceCallIndirect.type = struct_value () [concrete]
  544. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  545. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  546. // CHECK:STDOUT: %Dest: type = symbolic_binding Dest, 0 [symbolic]
  547. // CHECK:STDOUT: %ImplicitAs.type.031: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic]
  548. // CHECK:STDOUT: %Self.738: %ImplicitAs.type.031 = symbolic_binding Self, 1 [symbolic]
  549. // CHECK:STDOUT: %ImplicitAs.assoc_type.ff3: type = assoc_entity_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic]
  550. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert.type.b3a: type = fn_type @ImplicitAs.WithSelf.Convert, @ImplicitAs.WithSelf(%Dest, %Self.738) [symbolic]
  551. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert.1de: %ImplicitAs.WithSelf.Convert.type.b3a = struct_value () [symbolic]
  552. // CHECK:STDOUT: %pattern_type.51d: type = pattern_type %Dest [symbolic]
  553. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self.738 [symbolic]
  554. // CHECK:STDOUT: %pattern_type.e9a: type = pattern_type %Self.binding.as_type [symbolic]
  555. // CHECK:STDOUT: %.184: Core.Form = init_form %Dest [symbolic]
  556. // CHECK:STDOUT: %ImplicitAs.type.deb: type = facet_type <@ImplicitAs, @ImplicitAs(%NonInstance3.type)> [concrete]
  557. // CHECK:STDOUT: %Self.9cf: %ImplicitAs.type.deb = symbolic_binding Self, 1 [symbolic]
  558. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert.type.8ec: type = fn_type @ImplicitAs.WithSelf.Convert, @ImplicitAs.WithSelf(%NonInstance3.type, %Self.738) [symbolic]
  559. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert.0e4: %ImplicitAs.WithSelf.Convert.type.8ec = struct_value () [symbolic]
  560. // CHECK:STDOUT: %ImplicitAs.assoc_type.eea: type = assoc_entity_type @ImplicitAs, @ImplicitAs(%NonInstance3.type) [concrete]
  561. // CHECK:STDOUT: %assoc0.605: %ImplicitAs.assoc_type.eea = assoc_entity element0, imports.%Core.import_ref.201 [concrete]
  562. // CHECK:STDOUT: %assoc0.843: %ImplicitAs.assoc_type.ff3 = assoc_entity element0, imports.%Core.import_ref.cc1 [symbolic]
  563. // CHECK:STDOUT: }
  564. // CHECK:STDOUT:
  565. // CHECK:STDOUT: imports {
  566. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  567. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  568. // CHECK:STDOUT: import Core//default
  569. // CHECK:STDOUT: }
  570. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//default, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  571. // CHECK:STDOUT: %Core.import_ref.178: @ImplicitAs.WithSelf.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.ff3) = import_ref Core//default, loc{{\d+_\d+}}, loaded [symbolic = @ImplicitAs.WithSelf.%assoc0 (constants.%assoc0.843)]
  572. // CHECK:STDOUT: %Core.Convert = import_ref Core//default, Convert, unloaded
  573. // CHECK:STDOUT: %Core.import_ref.201: @ImplicitAs.WithSelf.%ImplicitAs.WithSelf.Convert.type (%ImplicitAs.WithSelf.Convert.type.b3a) = import_ref Core//default, loc{{\d+_\d+}}, loaded [symbolic = @ImplicitAs.WithSelf.%ImplicitAs.WithSelf.Convert (constants.%ImplicitAs.WithSelf.Convert.1de)]
  574. // CHECK:STDOUT: %Core.import_ref.b3bc94.2: type = import_ref Core//default, loc{{\d+_\d+}}, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)]
  575. // CHECK:STDOUT: %Core.import_ref.ac4dc5.2: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.031) = import_ref Core//default, loc{{\d+_\d+}}, loaded [symbolic = @ImplicitAs.%Self (constants.%Self.738)]
  576. // CHECK:STDOUT: %Core.import_ref.9ec = import_ref Core//default, loc{{\d+_\d+}}, unloaded
  577. // CHECK:STDOUT: %Core.import_ref.b3bc94.3: type = import_ref Core//default, loc{{\d+_\d+}}, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)]
  578. // CHECK:STDOUT: %Core.import_ref.cc1 = import_ref Core//default, loc{{\d+_\d+}}, unloaded
  579. // CHECK:STDOUT: }
  580. // CHECK:STDOUT:
  581. // CHECK:STDOUT: file {
  582. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  583. // CHECK:STDOUT: .Core = imports.%Core
  584. // CHECK:STDOUT: .NonInstance3 = %NonInstance3.decl
  585. // CHECK:STDOUT: .NonInstanceCallIndirect = %NonInstanceCallIndirect.decl
  586. // CHECK:STDOUT: }
  587. // CHECK:STDOUT: %Core.import = import Core
  588. // CHECK:STDOUT: %NonInstance3.decl: type = interface_decl @NonInstance3 [concrete = constants.%NonInstance3.type] {} {}
  589. // CHECK:STDOUT: impl_decl @struct_type.c.as.NonInstance3.impl [concrete] {} {
  590. // CHECK:STDOUT: %.loc9_12.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  591. // CHECK:STDOUT: %.loc9_12.2: type = converted %.loc9_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  592. // CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %empty_tuple.type} [concrete = constants.%struct_type.c]
  593. // CHECK:STDOUT: %NonInstance3.ref: type = name_ref NonInstance3, file.%NonInstance3.decl [concrete = constants.%NonInstance3.type]
  594. // CHECK:STDOUT: }
  595. // CHECK:STDOUT: %NonInstanceCallIndirect.decl: %NonInstanceCallIndirect.type = fn_decl @NonInstanceCallIndirect [concrete = constants.%NonInstanceCallIndirect] {
  596. // CHECK:STDOUT: %p.param_patt: %pattern_type.5f5 = value_param_pattern [concrete]
  597. // CHECK:STDOUT: %p.patt: %pattern_type.5f5 = at_binding_pattern p, %p.param_patt [concrete]
  598. // CHECK:STDOUT: } {
  599. // CHECK:STDOUT: %p.param: %ptr = value_param call_param0
  600. // CHECK:STDOUT: %.loc13_39: type = splice_block %ptr [concrete = constants.%ptr] {
  601. // CHECK:STDOUT: %.loc13_37.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  602. // CHECK:STDOUT: %.loc13_37.2: type = converted %.loc13_37.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  603. // CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %empty_tuple.type} [concrete = constants.%struct_type.c]
  604. // CHECK:STDOUT: %ptr: type = ptr_type %struct_type.c [concrete = constants.%ptr]
  605. // CHECK:STDOUT: }
  606. // CHECK:STDOUT: %p: %ptr = value_binding p, %p.param
  607. // CHECK:STDOUT: }
  608. // CHECK:STDOUT: }
  609. // CHECK:STDOUT:
  610. // CHECK:STDOUT: interface @NonInstance3 {
  611. // CHECK:STDOUT: %Self: %NonInstance3.type = symbolic_binding Self, 0 [symbolic = constants.%Self.0da]
  612. // CHECK:STDOUT: %NonInstance3.WithSelf.decl = interface_with_self_decl @NonInstance3 [concrete]
  613. // CHECK:STDOUT:
  614. // CHECK:STDOUT: !with Self:
  615. // CHECK:STDOUT: %NonInstance3.WithSelf.F3.decl: @NonInstance3.WithSelf.%NonInstance3.WithSelf.F3.type (%NonInstance3.WithSelf.F3.type.c21) = fn_decl @NonInstance3.WithSelf.F3 [symbolic = @NonInstance3.WithSelf.%NonInstance3.WithSelf.F3 (constants.%NonInstance3.WithSelf.F3.b62)] {} {}
  616. // CHECK:STDOUT: %assoc0: %NonInstance3.assoc_type = assoc_entity element0, %NonInstance3.WithSelf.F3.decl [concrete = constants.%assoc0.342]
  617. // CHECK:STDOUT:
  618. // CHECK:STDOUT: !members:
  619. // CHECK:STDOUT: .Self = %Self
  620. // CHECK:STDOUT: .F3 = @NonInstance3.WithSelf.%assoc0
  621. // CHECK:STDOUT: witness = (@NonInstance3.WithSelf.%NonInstance3.WithSelf.F3.decl)
  622. // CHECK:STDOUT:
  623. // CHECK:STDOUT: !requires:
  624. // CHECK:STDOUT: }
  625. // CHECK:STDOUT:
  626. // CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.b3bc94.3: type) [from "core.carbon"] {
  627. // CHECK:STDOUT: %Dest: type = symbolic_binding Dest, 0 [symbolic = %Dest (constants.%Dest)]
  628. // CHECK:STDOUT:
  629. // CHECK:STDOUT: !definition:
  630. // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.031)]
  631. // CHECK:STDOUT: %Self: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.031) = symbolic_binding Self, 1 [symbolic = %Self (constants.%Self.738)]
  632. // CHECK:STDOUT:
  633. // CHECK:STDOUT: interface {
  634. // CHECK:STDOUT: !members:
  635. // CHECK:STDOUT: .Self = imports.%Core.import_ref.9ec
  636. // CHECK:STDOUT: .Convert = imports.%Core.import_ref.178
  637. // CHECK:STDOUT: witness = (imports.%Core.Convert)
  638. // CHECK:STDOUT:
  639. // CHECK:STDOUT: !requires:
  640. // CHECK:STDOUT: }
  641. // CHECK:STDOUT: }
  642. // CHECK:STDOUT:
  643. // CHECK:STDOUT: impl @struct_type.c.as.NonInstance3.impl: %struct_type.c as %NonInstance3.ref {
  644. // CHECK:STDOUT: %struct_type.c.as.NonInstance3.impl.F3.decl: %struct_type.c.as.NonInstance3.impl.F3.type = fn_decl @struct_type.c.as.NonInstance3.impl.F3 [concrete = constants.%struct_type.c.as.NonInstance3.impl.F3] {} {}
  645. // CHECK:STDOUT: %NonInstance3.impl_witness_table = impl_witness_table (%struct_type.c.as.NonInstance3.impl.F3.decl), @struct_type.c.as.NonInstance3.impl [concrete]
  646. // CHECK:STDOUT: %NonInstance3.impl_witness: <witness> = impl_witness %NonInstance3.impl_witness_table [concrete = constants.%NonInstance3.impl_witness]
  647. // CHECK:STDOUT:
  648. // CHECK:STDOUT: !members:
  649. // CHECK:STDOUT: .F3 = %struct_type.c.as.NonInstance3.impl.F3.decl
  650. // CHECK:STDOUT: witness = %NonInstance3.impl_witness
  651. // CHECK:STDOUT: }
  652. // CHECK:STDOUT:
  653. // CHECK:STDOUT: generic fn @NonInstance3.WithSelf.F3(@NonInstance3.%Self: %NonInstance3.type) {
  654. // CHECK:STDOUT: fn();
  655. // CHECK:STDOUT: }
  656. // CHECK:STDOUT:
  657. // CHECK:STDOUT: fn @struct_type.c.as.NonInstance3.impl.F3() {
  658. // CHECK:STDOUT: !entry:
  659. // CHECK:STDOUT: return
  660. // CHECK:STDOUT: }
  661. // CHECK:STDOUT:
  662. // CHECK:STDOUT: fn @NonInstanceCallIndirect(%p.param: %ptr) {
  663. // CHECK:STDOUT: !entry:
  664. // CHECK:STDOUT: %p.ref: %ptr = name_ref p, %p
  665. // CHECK:STDOUT: %NonInstance3.ref: type = name_ref NonInstance3, file.%NonInstance3.decl [concrete = constants.%NonInstance3.type]
  666. // CHECK:STDOUT: %F3.ref: %NonInstance3.assoc_type = name_ref F3, @NonInstance3.WithSelf.%assoc0 [concrete = constants.%assoc0.342]
  667. // CHECK:STDOUT: %.loc21_4.1: ref %struct_type.c = deref %p.ref
  668. // CHECK:STDOUT: %.loc21_4.2: %NonInstance3.type = converted %.loc21_4.1, <error> [concrete = <error>]
  669. // CHECK:STDOUT: return
  670. // CHECK:STDOUT: }
  671. // CHECK:STDOUT:
  672. // CHECK:STDOUT: generic fn @ImplicitAs.WithSelf.Convert(imports.%Core.import_ref.b3bc94.2: type, imports.%Core.import_ref.ac4dc5.2: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.031)) [from "core.carbon"] {
  673. // CHECK:STDOUT: %Dest: type = symbolic_binding Dest, 0 [symbolic = %Dest (constants.%Dest)]
  674. // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.031)]
  675. // CHECK:STDOUT: %Self: @ImplicitAs.WithSelf.Convert.%ImplicitAs.type (%ImplicitAs.type.031) = symbolic_binding Self, 1 [symbolic = %Self (constants.%Self.738)]
  676. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  677. // CHECK:STDOUT: %pattern_type.1: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type.1 (constants.%pattern_type.e9a)]
  678. // CHECK:STDOUT: %.1: Core.Form = init_form %Dest [symbolic = %.1 (constants.%.184)]
  679. // CHECK:STDOUT: %pattern_type.2: type = pattern_type %Dest [symbolic = %pattern_type.2 (constants.%pattern_type.51d)]
  680. // CHECK:STDOUT:
  681. // CHECK:STDOUT: fn;
  682. // CHECK:STDOUT: }
  683. // CHECK:STDOUT:
  684. // CHECK:STDOUT: specific @NonInstance3.WithSelf(constants.%Self.0da) {
  685. // CHECK:STDOUT: !definition:
  686. // CHECK:STDOUT: %Self => constants.%Self.0da
  687. // CHECK:STDOUT: %NonInstance3.WithSelf.F3.type => constants.%NonInstance3.WithSelf.F3.type.c21
  688. // CHECK:STDOUT: %NonInstance3.WithSelf.F3 => constants.%NonInstance3.WithSelf.F3.b62
  689. // CHECK:STDOUT: }
  690. // CHECK:STDOUT:
  691. // CHECK:STDOUT: specific @NonInstance3.WithSelf.F3(constants.%Self.0da) {}
  692. // CHECK:STDOUT:
  693. // CHECK:STDOUT: specific @NonInstance3.WithSelf(constants.%NonInstance3.facet) {
  694. // CHECK:STDOUT: !definition:
  695. // CHECK:STDOUT: %Self => constants.%NonInstance3.facet
  696. // CHECK:STDOUT: %NonInstance3.WithSelf.F3.type => constants.%NonInstance3.WithSelf.F3.type.a3f
  697. // CHECK:STDOUT: %NonInstance3.WithSelf.F3 => constants.%NonInstance3.WithSelf.F3.04b
  698. // CHECK:STDOUT: }
  699. // CHECK:STDOUT:
  700. // CHECK:STDOUT: specific @NonInstance3.WithSelf.F3(constants.%NonInstance3.facet) {}
  701. // CHECK:STDOUT:
  702. // CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) {
  703. // CHECK:STDOUT: %Dest => constants.%Dest
  704. // CHECK:STDOUT: }
  705. // CHECK:STDOUT:
  706. // CHECK:STDOUT: specific @ImplicitAs.WithSelf(constants.%Dest, constants.%Self.738) {}
  707. // CHECK:STDOUT:
  708. // CHECK:STDOUT: specific @ImplicitAs.WithSelf.Convert(constants.%Dest, constants.%Self.738) {
  709. // CHECK:STDOUT: %Dest => constants.%Dest
  710. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.031
  711. // CHECK:STDOUT: %Self => constants.%Self.738
  712. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  713. // CHECK:STDOUT: %pattern_type.1 => constants.%pattern_type.e9a
  714. // CHECK:STDOUT: %.1 => constants.%.184
  715. // CHECK:STDOUT: %pattern_type.2 => constants.%pattern_type.51d
  716. // CHECK:STDOUT: }
  717. // CHECK:STDOUT:
  718. // CHECK:STDOUT: specific @ImplicitAs(constants.%NonInstance3.type) {
  719. // CHECK:STDOUT: %Dest => constants.%NonInstance3.type
  720. // CHECK:STDOUT:
  721. // CHECK:STDOUT: !definition:
  722. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.deb
  723. // CHECK:STDOUT: %Self => constants.%Self.9cf
  724. // CHECK:STDOUT: }
  725. // CHECK:STDOUT:
  726. // CHECK:STDOUT: specific @ImplicitAs.WithSelf(constants.%NonInstance3.type, constants.%Self.738) {
  727. // CHECK:STDOUT: !definition:
  728. // CHECK:STDOUT: %Dest => constants.%NonInstance3.type
  729. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.deb
  730. // CHECK:STDOUT: %Self => constants.%Self.738
  731. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert.type => constants.%ImplicitAs.WithSelf.Convert.type.8ec
  732. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert => constants.%ImplicitAs.WithSelf.Convert.0e4
  733. // CHECK:STDOUT: %ImplicitAs.assoc_type => constants.%ImplicitAs.assoc_type.eea
  734. // CHECK:STDOUT: %assoc0 => constants.%assoc0.605
  735. // CHECK:STDOUT: }
  736. // CHECK:STDOUT:
  737. // CHECK:STDOUT: --- instance_success.carbon
  738. // CHECK:STDOUT:
  739. // CHECK:STDOUT: constants {
  740. // CHECK:STDOUT: %Instance1.type: type = facet_type <@Instance1> [concrete]
  741. // CHECK:STDOUT: %Self: %Instance1.type = symbolic_binding Self, 0 [symbolic]
  742. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic]
  743. // CHECK:STDOUT: %pattern_type.97b: type = pattern_type %Self.binding.as_type [symbolic]
  744. // CHECK:STDOUT: %Instance1.WithSelf.G1.type.291: type = fn_type @Instance1.WithSelf.G1, @Instance1.WithSelf(%Self) [symbolic]
  745. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  746. // CHECK:STDOUT: %Instance1.WithSelf.G1.db7: %Instance1.WithSelf.G1.type.291 = struct_value () [symbolic]
  747. // CHECK:STDOUT: %Instance1.assoc_type: type = assoc_entity_type @Instance1 [concrete]
  748. // CHECK:STDOUT: %assoc0: %Instance1.assoc_type = assoc_entity element0, @Instance1.WithSelf.%Instance1.WithSelf.G1.decl [concrete]
  749. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  750. // CHECK:STDOUT: %struct_type.d: type = struct_type {.d: %empty_tuple.type} [concrete]
  751. // CHECK:STDOUT: %Instance1.impl_witness: <witness> = impl_witness @struct_type.d.as.Instance1.impl.%Instance1.impl_witness_table [concrete]
  752. // CHECK:STDOUT: %pattern_type.515: type = pattern_type %struct_type.d [concrete]
  753. // CHECK:STDOUT: %struct_type.d.as.Instance1.impl.G1.type: type = fn_type @struct_type.d.as.Instance1.impl.G1 [concrete]
  754. // CHECK:STDOUT: %struct_type.d.as.Instance1.impl.G1: %struct_type.d.as.Instance1.impl.G1.type = struct_value () [concrete]
  755. // CHECK:STDOUT: %Instance1.facet: %Instance1.type = facet_value %struct_type.d, (%Instance1.impl_witness) [concrete]
  756. // CHECK:STDOUT: %Instance1.WithSelf.G1.type.ba6: type = fn_type @Instance1.WithSelf.G1, @Instance1.WithSelf(%Instance1.facet) [concrete]
  757. // CHECK:STDOUT: %Instance1.WithSelf.G1.ceb: %Instance1.WithSelf.G1.type.ba6 = struct_value () [concrete]
  758. // CHECK:STDOUT: %InstanceCall.type: type = fn_type @InstanceCall [concrete]
  759. // CHECK:STDOUT: %InstanceCall: %InstanceCall.type = struct_value () [concrete]
  760. // CHECK:STDOUT: %.276: type = fn_type_with_self_type %Instance1.WithSelf.G1.type.ba6, %Instance1.facet [concrete]
  761. // CHECK:STDOUT: %ptr: type = ptr_type %struct_type.d [concrete]
  762. // CHECK:STDOUT: %pattern_type.8d6: type = pattern_type %ptr [concrete]
  763. // CHECK:STDOUT: %InstanceCallIndirect.type: type = fn_type @InstanceCallIndirect [concrete]
  764. // CHECK:STDOUT: %InstanceCallIndirect: %InstanceCallIndirect.type = struct_value () [concrete]
  765. // CHECK:STDOUT: %struct: %struct_type.d = struct_value (%empty_tuple) [concrete]
  766. // CHECK:STDOUT: }
  767. // CHECK:STDOUT:
  768. // CHECK:STDOUT: file {
  769. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  770. // CHECK:STDOUT: .Instance1 = %Instance1.decl
  771. // CHECK:STDOUT: .InstanceCall = %InstanceCall.decl
  772. // CHECK:STDOUT: .InstanceCallIndirect = %InstanceCallIndirect.decl
  773. // CHECK:STDOUT: }
  774. // CHECK:STDOUT: %Instance1.decl: type = interface_decl @Instance1 [concrete = constants.%Instance1.type] {} {}
  775. // CHECK:STDOUT: impl_decl @struct_type.d.as.Instance1.impl [concrete] {} {
  776. // CHECK:STDOUT: %.loc7_12.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  777. // CHECK:STDOUT: %.loc7_12.2: type = converted %.loc7_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  778. // CHECK:STDOUT: %struct_type.d: type = struct_type {.d: %empty_tuple.type} [concrete = constants.%struct_type.d]
  779. // CHECK:STDOUT: %Instance1.ref: type = name_ref Instance1, file.%Instance1.decl [concrete = constants.%Instance1.type]
  780. // CHECK:STDOUT: }
  781. // CHECK:STDOUT: %InstanceCall.decl: %InstanceCall.type = fn_decl @InstanceCall [concrete = constants.%InstanceCall] {
  782. // CHECK:STDOUT: %n.param_patt: %pattern_type.515 = value_param_pattern [concrete]
  783. // CHECK:STDOUT: %n.patt: %pattern_type.515 = at_binding_pattern n, %n.param_patt [concrete]
  784. // CHECK:STDOUT: } {
  785. // CHECK:STDOUT: %n.param: %struct_type.d = value_param call_param0
  786. // CHECK:STDOUT: %.loc11_27: type = splice_block %struct_type.d [concrete = constants.%struct_type.d] {
  787. // CHECK:STDOUT: %.loc11_26.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  788. // CHECK:STDOUT: %.loc11_26.2: type = converted %.loc11_26.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  789. // CHECK:STDOUT: %struct_type.d: type = struct_type {.d: %empty_tuple.type} [concrete = constants.%struct_type.d]
  790. // CHECK:STDOUT: }
  791. // CHECK:STDOUT: %n: %struct_type.d = value_binding n, %n.param
  792. // CHECK:STDOUT: }
  793. // CHECK:STDOUT: %InstanceCallIndirect.decl: %InstanceCallIndirect.type = fn_decl @InstanceCallIndirect [concrete = constants.%InstanceCallIndirect] {
  794. // CHECK:STDOUT: %p.param_patt: %pattern_type.8d6 = value_param_pattern [concrete]
  795. // CHECK:STDOUT: %p.patt: %pattern_type.8d6 = at_binding_pattern p, %p.param_patt [concrete]
  796. // CHECK:STDOUT: } {
  797. // CHECK:STDOUT: %p.param: %ptr = value_param call_param0
  798. // CHECK:STDOUT: %.loc15_36: type = splice_block %ptr [concrete = constants.%ptr] {
  799. // CHECK:STDOUT: %.loc15_34.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  800. // CHECK:STDOUT: %.loc15_34.2: type = converted %.loc15_34.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  801. // CHECK:STDOUT: %struct_type.d: type = struct_type {.d: %empty_tuple.type} [concrete = constants.%struct_type.d]
  802. // CHECK:STDOUT: %ptr: type = ptr_type %struct_type.d [concrete = constants.%ptr]
  803. // CHECK:STDOUT: }
  804. // CHECK:STDOUT: %p: %ptr = value_binding p, %p.param
  805. // CHECK:STDOUT: }
  806. // CHECK:STDOUT: }
  807. // CHECK:STDOUT:
  808. // CHECK:STDOUT: interface @Instance1 {
  809. // CHECK:STDOUT: %Self: %Instance1.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  810. // CHECK:STDOUT: %Instance1.WithSelf.decl = interface_with_self_decl @Instance1 [concrete]
  811. // CHECK:STDOUT:
  812. // CHECK:STDOUT: !with Self:
  813. // CHECK:STDOUT: %Instance1.WithSelf.G1.decl: @Instance1.WithSelf.%Instance1.WithSelf.G1.type (%Instance1.WithSelf.G1.type.291) = fn_decl @Instance1.WithSelf.G1 [symbolic = @Instance1.WithSelf.%Instance1.WithSelf.G1 (constants.%Instance1.WithSelf.G1.db7)] {
  814. // CHECK:STDOUT: %self.param_patt: @Instance1.WithSelf.G1.%pattern_type (%pattern_type.97b) = value_param_pattern [concrete]
  815. // CHECK:STDOUT: %self.patt: @Instance1.WithSelf.G1.%pattern_type (%pattern_type.97b) = at_binding_pattern self, %self.param_patt [concrete]
  816. // CHECK:STDOUT: } {
  817. // CHECK:STDOUT: %self.param: @Instance1.WithSelf.G1.%Self.binding.as_type (%Self.binding.as_type) = value_param call_param0
  818. // CHECK:STDOUT: %.loc4_15.1: type = splice_block %.loc4_15.2 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] {
  819. // CHECK:STDOUT: %Self.ref: %Instance1.type = name_ref Self, @Instance1.%Self [symbolic = %Self (constants.%Self)]
  820. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.ref [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  821. // CHECK:STDOUT: %.loc4_15.2: type = converted %Self.ref, %Self.as_type [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  822. // CHECK:STDOUT: }
  823. // CHECK:STDOUT: %self: @Instance1.WithSelf.G1.%Self.binding.as_type (%Self.binding.as_type) = value_binding self, %self.param
  824. // CHECK:STDOUT: }
  825. // CHECK:STDOUT: %assoc0: %Instance1.assoc_type = assoc_entity element0, %Instance1.WithSelf.G1.decl [concrete = constants.%assoc0]
  826. // CHECK:STDOUT:
  827. // CHECK:STDOUT: !members:
  828. // CHECK:STDOUT: .Self = %Self
  829. // CHECK:STDOUT: .G1 = @Instance1.WithSelf.%assoc0
  830. // CHECK:STDOUT: witness = (@Instance1.WithSelf.%Instance1.WithSelf.G1.decl)
  831. // CHECK:STDOUT:
  832. // CHECK:STDOUT: !requires:
  833. // CHECK:STDOUT: }
  834. // CHECK:STDOUT:
  835. // CHECK:STDOUT: impl @struct_type.d.as.Instance1.impl: %struct_type.d as %Instance1.ref {
  836. // CHECK:STDOUT: %struct_type.d.as.Instance1.impl.G1.decl: %struct_type.d.as.Instance1.impl.G1.type = fn_decl @struct_type.d.as.Instance1.impl.G1 [concrete = constants.%struct_type.d.as.Instance1.impl.G1] {
  837. // CHECK:STDOUT: %self.param_patt: %pattern_type.515 = value_param_pattern [concrete]
  838. // CHECK:STDOUT: %self.patt: %pattern_type.515 = at_binding_pattern self, %self.param_patt [concrete]
  839. // CHECK:STDOUT: } {
  840. // CHECK:STDOUT: %self.param: %struct_type.d = value_param call_param0
  841. // CHECK:STDOUT: %Self.ref: type = name_ref Self, @struct_type.d.as.Instance1.impl.%struct_type.d [concrete = constants.%struct_type.d]
  842. // CHECK:STDOUT: %self: %struct_type.d = value_binding self, %self.param
  843. // CHECK:STDOUT: }
  844. // CHECK:STDOUT: %Instance1.impl_witness_table = impl_witness_table (%struct_type.d.as.Instance1.impl.G1.decl), @struct_type.d.as.Instance1.impl [concrete]
  845. // CHECK:STDOUT: %Instance1.impl_witness: <witness> = impl_witness %Instance1.impl_witness_table [concrete = constants.%Instance1.impl_witness]
  846. // CHECK:STDOUT:
  847. // CHECK:STDOUT: !members:
  848. // CHECK:STDOUT: .G1 = %struct_type.d.as.Instance1.impl.G1.decl
  849. // CHECK:STDOUT: witness = %Instance1.impl_witness
  850. // CHECK:STDOUT: }
  851. // CHECK:STDOUT:
  852. // CHECK:STDOUT: generic fn @Instance1.WithSelf.G1(@Instance1.%Self: %Instance1.type) {
  853. // CHECK:STDOUT: %Self: %Instance1.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self)]
  854. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  855. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type (constants.%pattern_type.97b)]
  856. // CHECK:STDOUT:
  857. // CHECK:STDOUT: fn(%self.param: @Instance1.WithSelf.G1.%Self.binding.as_type (%Self.binding.as_type));
  858. // CHECK:STDOUT: }
  859. // CHECK:STDOUT:
  860. // CHECK:STDOUT: fn @struct_type.d.as.Instance1.impl.G1(%self.param: %struct_type.d) {
  861. // CHECK:STDOUT: !entry:
  862. // CHECK:STDOUT: return
  863. // CHECK:STDOUT: }
  864. // CHECK:STDOUT:
  865. // CHECK:STDOUT: fn @InstanceCall(%n.param: %struct_type.d) {
  866. // CHECK:STDOUT: !entry:
  867. // CHECK:STDOUT: %n.ref: %struct_type.d = name_ref n, %n
  868. // CHECK:STDOUT: %Instance1.ref: type = name_ref Instance1, file.%Instance1.decl [concrete = constants.%Instance1.type]
  869. // CHECK:STDOUT: %G1.ref: %Instance1.assoc_type = name_ref G1, @Instance1.WithSelf.%assoc0 [concrete = constants.%assoc0]
  870. // CHECK:STDOUT: %impl.elem0: %.276 = impl_witness_access constants.%Instance1.impl_witness, element0 [concrete = constants.%struct_type.d.as.Instance1.impl.G1]
  871. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %n.ref, %impl.elem0
  872. // CHECK:STDOUT: %struct_type.d.as.Instance1.impl.G1.call: init %empty_tuple.type = call %bound_method(%n.ref)
  873. // CHECK:STDOUT: return
  874. // CHECK:STDOUT: }
  875. // CHECK:STDOUT:
  876. // CHECK:STDOUT: fn @InstanceCallIndirect(%p.param: %ptr) {
  877. // CHECK:STDOUT: !entry:
  878. // CHECK:STDOUT: %p.ref: %ptr = name_ref p, %p
  879. // CHECK:STDOUT: %Instance1.ref: type = name_ref Instance1, file.%Instance1.decl [concrete = constants.%Instance1.type]
  880. // CHECK:STDOUT: %G1.ref: %Instance1.assoc_type = name_ref G1, @Instance1.WithSelf.%assoc0 [concrete = constants.%assoc0]
  881. // CHECK:STDOUT: %.loc16_4.1: ref %struct_type.d = deref %p.ref
  882. // CHECK:STDOUT: %impl.elem0: %.276 = impl_witness_access constants.%Instance1.impl_witness, element0 [concrete = constants.%struct_type.d.as.Instance1.impl.G1]
  883. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %.loc16_4.1, %impl.elem0
  884. // CHECK:STDOUT: %.loc16_4.2: ref %empty_tuple.type = struct_access %.loc16_4.1, element0
  885. // CHECK:STDOUT: %tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple]
  886. // CHECK:STDOUT: %.loc16_4.3: %empty_tuple.type = converted %.loc16_4.2, %tuple [concrete = constants.%empty_tuple]
  887. // CHECK:STDOUT: %struct: %struct_type.d = struct_value (%.loc16_4.3) [concrete = constants.%struct]
  888. // CHECK:STDOUT: %.loc16_4.4: %struct_type.d = converted %.loc16_4.1, %struct [concrete = constants.%struct]
  889. // CHECK:STDOUT: %struct_type.d.as.Instance1.impl.G1.call: init %empty_tuple.type = call %bound_method(%.loc16_4.4)
  890. // CHECK:STDOUT: return
  891. // CHECK:STDOUT: }
  892. // CHECK:STDOUT:
  893. // CHECK:STDOUT: specific @Instance1.WithSelf(constants.%Self) {
  894. // CHECK:STDOUT: !definition:
  895. // CHECK:STDOUT: %Self => constants.%Self
  896. // CHECK:STDOUT: %Instance1.WithSelf.G1.type => constants.%Instance1.WithSelf.G1.type.291
  897. // CHECK:STDOUT: %Instance1.WithSelf.G1 => constants.%Instance1.WithSelf.G1.db7
  898. // CHECK:STDOUT: }
  899. // CHECK:STDOUT:
  900. // CHECK:STDOUT: specific @Instance1.WithSelf.G1(constants.%Self) {
  901. // CHECK:STDOUT: %Self => constants.%Self
  902. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  903. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.97b
  904. // CHECK:STDOUT: }
  905. // CHECK:STDOUT:
  906. // CHECK:STDOUT: specific @Instance1.WithSelf(constants.%Instance1.facet) {
  907. // CHECK:STDOUT: !definition:
  908. // CHECK:STDOUT: %Self => constants.%Instance1.facet
  909. // CHECK:STDOUT: %Instance1.WithSelf.G1.type => constants.%Instance1.WithSelf.G1.type.ba6
  910. // CHECK:STDOUT: %Instance1.WithSelf.G1 => constants.%Instance1.WithSelf.G1.ceb
  911. // CHECK:STDOUT: }
  912. // CHECK:STDOUT:
  913. // CHECK:STDOUT: specific @Instance1.WithSelf.G1(constants.%Instance1.facet) {
  914. // CHECK:STDOUT: %Self => constants.%Instance1.facet
  915. // CHECK:STDOUT: %Self.binding.as_type => constants.%struct_type.d
  916. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.515
  917. // CHECK:STDOUT: }
  918. // CHECK:STDOUT:
  919. // CHECK:STDOUT: --- fail_instance.carbon
  920. // CHECK:STDOUT:
  921. // CHECK:STDOUT: constants {
  922. // CHECK:STDOUT: %Instance2.type: type = facet_type <@Instance2> [concrete]
  923. // CHECK:STDOUT: %Self: %Instance2.type = symbolic_binding Self, 0 [symbolic]
  924. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic]
  925. // CHECK:STDOUT: %pattern_type.a35: type = pattern_type %Self.binding.as_type [symbolic]
  926. // CHECK:STDOUT: %Instance2.WithSelf.G2.type.e15: type = fn_type @Instance2.WithSelf.G2, @Instance2.WithSelf(%Self) [symbolic]
  927. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  928. // CHECK:STDOUT: %Instance2.WithSelf.G2.6c8: %Instance2.WithSelf.G2.type.e15 = struct_value () [symbolic]
  929. // CHECK:STDOUT: %Instance2.assoc_type: type = assoc_entity_type @Instance2 [concrete]
  930. // CHECK:STDOUT: %assoc0: %Instance2.assoc_type = assoc_entity element0, @Instance2.WithSelf.%Instance2.WithSelf.G2.decl [concrete]
  931. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  932. // CHECK:STDOUT: %struct_type.e: type = struct_type {.e: %empty_tuple.type} [concrete]
  933. // CHECK:STDOUT: %Instance2.impl_witness: <witness> = impl_witness @struct_type.e.as.Instance2.impl.%Instance2.impl_witness_table [concrete]
  934. // CHECK:STDOUT: %pattern_type.efd: type = pattern_type %struct_type.e [concrete]
  935. // CHECK:STDOUT: %struct_type.e.as.Instance2.impl.G2.type: type = fn_type @struct_type.e.as.Instance2.impl.G2 [concrete]
  936. // CHECK:STDOUT: %struct_type.e.as.Instance2.impl.G2: %struct_type.e.as.Instance2.impl.G2.type = struct_value () [concrete]
  937. // CHECK:STDOUT: %Instance2.facet: %Instance2.type = facet_value %struct_type.e, (%Instance2.impl_witness) [concrete]
  938. // CHECK:STDOUT: %Instance2.WithSelf.G2.type.008: type = fn_type @Instance2.WithSelf.G2, @Instance2.WithSelf(%Instance2.facet) [concrete]
  939. // CHECK:STDOUT: %Instance2.WithSelf.G2.f23: %Instance2.WithSelf.G2.type.008 = struct_value () [concrete]
  940. // CHECK:STDOUT: %InstanceCallFail.type: type = fn_type @InstanceCallFail [concrete]
  941. // CHECK:STDOUT: %InstanceCallFail: %InstanceCallFail.type = struct_value () [concrete]
  942. // CHECK:STDOUT: }
  943. // CHECK:STDOUT:
  944. // CHECK:STDOUT: file {
  945. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  946. // CHECK:STDOUT: .Instance2 = %Instance2.decl
  947. // CHECK:STDOUT: .InstanceCallFail = %InstanceCallFail.decl
  948. // CHECK:STDOUT: }
  949. // CHECK:STDOUT: %Instance2.decl: type = interface_decl @Instance2 [concrete = constants.%Instance2.type] {} {}
  950. // CHECK:STDOUT: impl_decl @struct_type.e.as.Instance2.impl [concrete] {} {
  951. // CHECK:STDOUT: %.loc7_12.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  952. // CHECK:STDOUT: %.loc7_12.2: type = converted %.loc7_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  953. // CHECK:STDOUT: %struct_type.e: type = struct_type {.e: %empty_tuple.type} [concrete = constants.%struct_type.e]
  954. // CHECK:STDOUT: %Instance2.ref: type = name_ref Instance2, file.%Instance2.decl [concrete = constants.%Instance2.type]
  955. // CHECK:STDOUT: }
  956. // CHECK:STDOUT: %InstanceCallFail.decl: %InstanceCallFail.type = fn_decl @InstanceCallFail [concrete = constants.%InstanceCallFail] {} {}
  957. // CHECK:STDOUT: }
  958. // CHECK:STDOUT:
  959. // CHECK:STDOUT: interface @Instance2 {
  960. // CHECK:STDOUT: %Self: %Instance2.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  961. // CHECK:STDOUT: %Instance2.WithSelf.decl = interface_with_self_decl @Instance2 [concrete]
  962. // CHECK:STDOUT:
  963. // CHECK:STDOUT: !with Self:
  964. // CHECK:STDOUT: %Instance2.WithSelf.G2.decl: @Instance2.WithSelf.%Instance2.WithSelf.G2.type (%Instance2.WithSelf.G2.type.e15) = fn_decl @Instance2.WithSelf.G2 [symbolic = @Instance2.WithSelf.%Instance2.WithSelf.G2 (constants.%Instance2.WithSelf.G2.6c8)] {
  965. // CHECK:STDOUT: %self.param_patt: @Instance2.WithSelf.G2.%pattern_type (%pattern_type.a35) = value_param_pattern [concrete]
  966. // CHECK:STDOUT: %self.patt: @Instance2.WithSelf.G2.%pattern_type (%pattern_type.a35) = at_binding_pattern self, %self.param_patt [concrete]
  967. // CHECK:STDOUT: } {
  968. // CHECK:STDOUT: %self.param: @Instance2.WithSelf.G2.%Self.binding.as_type (%Self.binding.as_type) = value_param call_param0
  969. // CHECK:STDOUT: %.loc4_15.1: type = splice_block %.loc4_15.2 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] {
  970. // CHECK:STDOUT: %Self.ref: %Instance2.type = name_ref Self, @Instance2.%Self [symbolic = %Self (constants.%Self)]
  971. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.ref [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  972. // CHECK:STDOUT: %.loc4_15.2: type = converted %Self.ref, %Self.as_type [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  973. // CHECK:STDOUT: }
  974. // CHECK:STDOUT: %self: @Instance2.WithSelf.G2.%Self.binding.as_type (%Self.binding.as_type) = value_binding self, %self.param
  975. // CHECK:STDOUT: }
  976. // CHECK:STDOUT: %assoc0: %Instance2.assoc_type = assoc_entity element0, %Instance2.WithSelf.G2.decl [concrete = constants.%assoc0]
  977. // CHECK:STDOUT:
  978. // CHECK:STDOUT: !members:
  979. // CHECK:STDOUT: .Self = %Self
  980. // CHECK:STDOUT: .G2 = @Instance2.WithSelf.%assoc0
  981. // CHECK:STDOUT: witness = (@Instance2.WithSelf.%Instance2.WithSelf.G2.decl)
  982. // CHECK:STDOUT:
  983. // CHECK:STDOUT: !requires:
  984. // CHECK:STDOUT: }
  985. // CHECK:STDOUT:
  986. // CHECK:STDOUT: impl @struct_type.e.as.Instance2.impl: %struct_type.e as %Instance2.ref {
  987. // CHECK:STDOUT: %struct_type.e.as.Instance2.impl.G2.decl: %struct_type.e.as.Instance2.impl.G2.type = fn_decl @struct_type.e.as.Instance2.impl.G2 [concrete = constants.%struct_type.e.as.Instance2.impl.G2] {
  988. // CHECK:STDOUT: %self.param_patt: %pattern_type.efd = value_param_pattern [concrete]
  989. // CHECK:STDOUT: %self.patt: %pattern_type.efd = at_binding_pattern self, %self.param_patt [concrete]
  990. // CHECK:STDOUT: } {
  991. // CHECK:STDOUT: %self.param: %struct_type.e = value_param call_param0
  992. // CHECK:STDOUT: %Self.ref: type = name_ref Self, @struct_type.e.as.Instance2.impl.%struct_type.e [concrete = constants.%struct_type.e]
  993. // CHECK:STDOUT: %self: %struct_type.e = value_binding self, %self.param
  994. // CHECK:STDOUT: }
  995. // CHECK:STDOUT: %Instance2.impl_witness_table = impl_witness_table (%struct_type.e.as.Instance2.impl.G2.decl), @struct_type.e.as.Instance2.impl [concrete]
  996. // CHECK:STDOUT: %Instance2.impl_witness: <witness> = impl_witness %Instance2.impl_witness_table [concrete = constants.%Instance2.impl_witness]
  997. // CHECK:STDOUT:
  998. // CHECK:STDOUT: !members:
  999. // CHECK:STDOUT: .G2 = %struct_type.e.as.Instance2.impl.G2.decl
  1000. // CHECK:STDOUT: witness = %Instance2.impl_witness
  1001. // CHECK:STDOUT: }
  1002. // CHECK:STDOUT:
  1003. // CHECK:STDOUT: generic fn @Instance2.WithSelf.G2(@Instance2.%Self: %Instance2.type) {
  1004. // CHECK:STDOUT: %Self: %Instance2.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self)]
  1005. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  1006. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type (constants.%pattern_type.a35)]
  1007. // CHECK:STDOUT:
  1008. // CHECK:STDOUT: fn(%self.param: @Instance2.WithSelf.G2.%Self.binding.as_type (%Self.binding.as_type));
  1009. // CHECK:STDOUT: }
  1010. // CHECK:STDOUT:
  1011. // CHECK:STDOUT: fn @struct_type.e.as.Instance2.impl.G2(%self.param: %struct_type.e) {
  1012. // CHECK:STDOUT: !entry:
  1013. // CHECK:STDOUT: return
  1014. // CHECK:STDOUT: }
  1015. // CHECK:STDOUT:
  1016. // CHECK:STDOUT: fn @InstanceCallFail() {
  1017. // CHECK:STDOUT: !entry:
  1018. // CHECK:STDOUT: %.loc16_9.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  1019. // CHECK:STDOUT: %.loc16_9.2: type = converted %.loc16_9.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  1020. // CHECK:STDOUT: %struct_type.e: type = struct_type {.e: %empty_tuple.type} [concrete = constants.%struct_type.e]
  1021. // CHECK:STDOUT: %Instance2.ref: type = name_ref Instance2, file.%Instance2.decl [concrete = constants.%Instance2.type]
  1022. // CHECK:STDOUT: %G2.ref: %Instance2.assoc_type = name_ref G2, @Instance2.WithSelf.%assoc0 [concrete = constants.%assoc0]
  1023. // CHECK:STDOUT: return
  1024. // CHECK:STDOUT: }
  1025. // CHECK:STDOUT:
  1026. // CHECK:STDOUT: specific @Instance2.WithSelf(constants.%Self) {
  1027. // CHECK:STDOUT: !definition:
  1028. // CHECK:STDOUT: %Self => constants.%Self
  1029. // CHECK:STDOUT: %Instance2.WithSelf.G2.type => constants.%Instance2.WithSelf.G2.type.e15
  1030. // CHECK:STDOUT: %Instance2.WithSelf.G2 => constants.%Instance2.WithSelf.G2.6c8
  1031. // CHECK:STDOUT: }
  1032. // CHECK:STDOUT:
  1033. // CHECK:STDOUT: specific @Instance2.WithSelf.G2(constants.%Self) {
  1034. // CHECK:STDOUT: %Self => constants.%Self
  1035. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  1036. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.a35
  1037. // CHECK:STDOUT: }
  1038. // CHECK:STDOUT:
  1039. // CHECK:STDOUT: specific @Instance2.WithSelf(constants.%Instance2.facet) {
  1040. // CHECK:STDOUT: !definition:
  1041. // CHECK:STDOUT: %Self => constants.%Instance2.facet
  1042. // CHECK:STDOUT: %Instance2.WithSelf.G2.type => constants.%Instance2.WithSelf.G2.type.008
  1043. // CHECK:STDOUT: %Instance2.WithSelf.G2 => constants.%Instance2.WithSelf.G2.f23
  1044. // CHECK:STDOUT: }
  1045. // CHECK:STDOUT:
  1046. // CHECK:STDOUT: specific @Instance2.WithSelf.G2(constants.%Instance2.facet) {
  1047. // CHECK:STDOUT: %Self => constants.%Instance2.facet
  1048. // CHECK:STDOUT: %Self.binding.as_type => constants.%struct_type.e
  1049. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.efd
  1050. // CHECK:STDOUT: }
  1051. // CHECK:STDOUT: