compound.carbon 65 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959
  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)` [MissingImplInMemberAccessNote]
  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)` [MissingImplInMemberAccessNote]
  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[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[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: %Dest: type = symbolic_binding Dest, 0 [symbolic]
  103. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  104. // CHECK:STDOUT: %ImplicitAs.type.96f: type = generic_interface_type @ImplicitAs [concrete]
  105. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.96f = struct_value () [concrete]
  106. // CHECK:STDOUT: %ImplicitAs.type.841: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic]
  107. // CHECK:STDOUT: %Self: %ImplicitAs.type.841 = 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.4e2: type = pattern_type %Self.binding.as_type [symbolic]
  110. // CHECK:STDOUT: %pattern_type.e68: type = pattern_type %Dest [symbolic]
  111. // CHECK:STDOUT: %ImplicitAs.Convert.type: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%Dest) [symbolic]
  112. // CHECK:STDOUT: %ImplicitAs.Convert: %ImplicitAs.Convert.type = struct_value () [symbolic]
  113. // CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic]
  114. // CHECK:STDOUT: %assoc0: %ImplicitAs.assoc_type = assoc_entity element0, @ImplicitAs.%ImplicitAs.Convert.decl [symbolic]
  115. // CHECK:STDOUT: }
  116. // CHECK:STDOUT:
  117. // CHECK:STDOUT: file {
  118. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  119. // CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl
  120. // CHECK:STDOUT: }
  121. // CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.96f = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] {
  122. // CHECK:STDOUT: %Dest.patt: %pattern_type.98f = symbolic_binding_pattern Dest, 0 [concrete]
  123. // CHECK:STDOUT: } {
  124. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  125. // CHECK:STDOUT: %Dest.loc3_22.2: type = symbolic_binding Dest, 0 [symbolic = %Dest.loc3_22.1 (constants.%Dest)]
  126. // CHECK:STDOUT: }
  127. // CHECK:STDOUT: }
  128. // CHECK:STDOUT:
  129. // CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc3_22.2: type) {
  130. // CHECK:STDOUT: %Dest.loc3_22.1: type = symbolic_binding Dest, 0 [symbolic = %Dest.loc3_22.1 (constants.%Dest)]
  131. // CHECK:STDOUT:
  132. // CHECK:STDOUT: !definition:
  133. // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc3_22.1)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.841)]
  134. // CHECK:STDOUT: %Self.loc3_35.2: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.841) = symbolic_binding Self, 1 [symbolic = %Self.loc3_35.2 (constants.%Self)]
  135. // CHECK:STDOUT: %ImplicitAs.Convert.type: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%Dest.loc3_22.1) [symbolic = %ImplicitAs.Convert.type (constants.%ImplicitAs.Convert.type)]
  136. // CHECK:STDOUT: %ImplicitAs.Convert: @ImplicitAs.%ImplicitAs.Convert.type (%ImplicitAs.Convert.type) = struct_value () [symbolic = %ImplicitAs.Convert (constants.%ImplicitAs.Convert)]
  137. // CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs, @ImplicitAs(%Dest.loc3_22.1) [symbolic = %ImplicitAs.assoc_type (constants.%ImplicitAs.assoc_type)]
  138. // 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)]
  139. // CHECK:STDOUT:
  140. // CHECK:STDOUT: interface {
  141. // CHECK:STDOUT: %Self.loc3_35.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.841) = symbolic_binding Self, 1 [symbolic = %Self.loc3_35.2 (constants.%Self)]
  142. // CHECK:STDOUT: %ImplicitAs.Convert.decl: @ImplicitAs.%ImplicitAs.Convert.type (%ImplicitAs.Convert.type) = fn_decl @ImplicitAs.Convert [symbolic = @ImplicitAs.%ImplicitAs.Convert (constants.%ImplicitAs.Convert)] {
  143. // CHECK:STDOUT: %self.patt: @ImplicitAs.Convert.%pattern_type.loc4_14 (%pattern_type.4e2) = value_binding_pattern self [concrete]
  144. // CHECK:STDOUT: %self.param_patt: @ImplicitAs.Convert.%pattern_type.loc4_14 (%pattern_type.4e2) = value_param_pattern %self.patt, call_param0 [concrete]
  145. // CHECK:STDOUT: %return.patt: @ImplicitAs.Convert.%pattern_type.loc4_28 (%pattern_type.e68) = return_slot_pattern [concrete]
  146. // CHECK:STDOUT: %return.param_patt: @ImplicitAs.Convert.%pattern_type.loc4_28 (%pattern_type.e68) = out_param_pattern %return.patt, call_param1 [concrete]
  147. // CHECK:STDOUT: } {
  148. // CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc3_22.2 [symbolic = %Dest (constants.%Dest)]
  149. // CHECK:STDOUT: %self.param: @ImplicitAs.Convert.%Self.binding.as_type (%Self.binding.as_type) = value_param call_param0
  150. // CHECK:STDOUT: %.loc4_20.1: type = splice_block %.loc4_20.3 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] {
  151. // CHECK:STDOUT: %.loc4_20.2: @ImplicitAs.Convert.%ImplicitAs.type (%ImplicitAs.type.841) = specific_constant @ImplicitAs.%Self.loc3_35.1, @ImplicitAs(constants.%Dest) [symbolic = %Self (constants.%Self)]
  152. // CHECK:STDOUT: %Self.ref: @ImplicitAs.Convert.%ImplicitAs.type (%ImplicitAs.type.841) = name_ref Self, %.loc4_20.2 [symbolic = %Self (constants.%Self)]
  153. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.ref [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  154. // CHECK:STDOUT: %.loc4_20.3: type = converted %Self.ref, %Self.as_type [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  155. // CHECK:STDOUT: }
  156. // CHECK:STDOUT: %self: @ImplicitAs.Convert.%Self.binding.as_type (%Self.binding.as_type) = value_binding self, %self.param
  157. // CHECK:STDOUT: %return.param: ref @ImplicitAs.Convert.%Dest (%Dest) = out_param call_param1
  158. // CHECK:STDOUT: %return: ref @ImplicitAs.Convert.%Dest (%Dest) = return_slot %return.param
  159. // CHECK:STDOUT: }
  160. // 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)]
  161. // CHECK:STDOUT:
  162. // CHECK:STDOUT: !members:
  163. // CHECK:STDOUT: .Self = %Self.loc3_35.1
  164. // CHECK:STDOUT: .Dest = <poisoned>
  165. // CHECK:STDOUT: .Convert = %assoc0.loc4_35.1
  166. // CHECK:STDOUT: witness = (%ImplicitAs.Convert.decl)
  167. // CHECK:STDOUT:
  168. // CHECK:STDOUT: !requires:
  169. // CHECK:STDOUT: }
  170. // CHECK:STDOUT: }
  171. // CHECK:STDOUT:
  172. // CHECK:STDOUT: generic fn @ImplicitAs.Convert(@ImplicitAs.%Dest.loc3_22.2: type, @ImplicitAs.%Self.loc3_35.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.841)) {
  173. // CHECK:STDOUT: %Dest: type = symbolic_binding Dest, 0 [symbolic = %Dest (constants.%Dest)]
  174. // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.841)]
  175. // CHECK:STDOUT: %Self: @ImplicitAs.Convert.%ImplicitAs.type (%ImplicitAs.type.841) = symbolic_binding Self, 1 [symbolic = %Self (constants.%Self)]
  176. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  177. // CHECK:STDOUT: %pattern_type.loc4_14: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type.loc4_14 (constants.%pattern_type.4e2)]
  178. // CHECK:STDOUT: %pattern_type.loc4_28: type = pattern_type %Dest [symbolic = %pattern_type.loc4_28 (constants.%pattern_type.e68)]
  179. // CHECK:STDOUT:
  180. // CHECK:STDOUT: fn(%self.param: @ImplicitAs.Convert.%Self.binding.as_type (%Self.binding.as_type)) -> @ImplicitAs.Convert.%Dest (%Dest);
  181. // CHECK:STDOUT: }
  182. // CHECK:STDOUT:
  183. // CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) {
  184. // CHECK:STDOUT: %Dest.loc3_22.1 => constants.%Dest
  185. // CHECK:STDOUT: }
  186. // CHECK:STDOUT:
  187. // CHECK:STDOUT: specific @ImplicitAs.Convert(constants.%Dest, constants.%Self) {
  188. // CHECK:STDOUT: %Dest => constants.%Dest
  189. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.841
  190. // CHECK:STDOUT: %Self => constants.%Self
  191. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  192. // CHECK:STDOUT: %pattern_type.loc4_14 => constants.%pattern_type.4e2
  193. // CHECK:STDOUT: %pattern_type.loc4_28 => constants.%pattern_type.e68
  194. // CHECK:STDOUT: }
  195. // CHECK:STDOUT:
  196. // CHECK:STDOUT: --- non-instance_success.carbon
  197. // CHECK:STDOUT:
  198. // CHECK:STDOUT: constants {
  199. // CHECK:STDOUT: %NonInstance1.type: type = facet_type <@NonInstance1> [concrete]
  200. // CHECK:STDOUT: %Self: %NonInstance1.type = symbolic_binding Self, 0 [symbolic]
  201. // CHECK:STDOUT: %NonInstance1.F1.type: type = fn_type @NonInstance1.F1 [concrete]
  202. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  203. // CHECK:STDOUT: %NonInstance1.F1: %NonInstance1.F1.type = struct_value () [concrete]
  204. // CHECK:STDOUT: %NonInstance1.assoc_type: type = assoc_entity_type @NonInstance1 [concrete]
  205. // CHECK:STDOUT: %assoc0: %NonInstance1.assoc_type = assoc_entity element0, @NonInstance1.%NonInstance1.F1.decl [concrete]
  206. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  207. // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %empty_tuple.type} [concrete]
  208. // CHECK:STDOUT: %NonInstance1.impl_witness: <witness> = impl_witness file.%NonInstance1.impl_witness_table [concrete]
  209. // CHECK:STDOUT: %struct_type.a.as.NonInstance1.impl.F1.type: type = fn_type @struct_type.a.as.NonInstance1.impl.F1 [concrete]
  210. // CHECK:STDOUT: %struct_type.a.as.NonInstance1.impl.F1: %struct_type.a.as.NonInstance1.impl.F1.type = struct_value () [concrete]
  211. // CHECK:STDOUT: %NonInstance1.facet: %NonInstance1.type = facet_value %struct_type.a, (%NonInstance1.impl_witness) [concrete]
  212. // CHECK:STDOUT: %NonInstanceCall1.type: type = fn_type @NonInstanceCall1 [concrete]
  213. // CHECK:STDOUT: %NonInstanceCall1: %NonInstanceCall1.type = struct_value () [concrete]
  214. // CHECK:STDOUT: %.ced: type = fn_type_with_self_type %NonInstance1.F1.type, %NonInstance1.facet [concrete]
  215. // CHECK:STDOUT: }
  216. // CHECK:STDOUT:
  217. // CHECK:STDOUT: file {
  218. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  219. // CHECK:STDOUT: .NonInstance1 = %NonInstance1.decl
  220. // CHECK:STDOUT: .NonInstanceCall1 = %NonInstanceCall1.decl
  221. // CHECK:STDOUT: }
  222. // CHECK:STDOUT: %NonInstance1.decl: type = interface_decl @NonInstance1 [concrete = constants.%NonInstance1.type] {} {}
  223. // CHECK:STDOUT: impl_decl @struct_type.a.as.NonInstance1.impl [concrete] {} {
  224. // CHECK:STDOUT: %.loc7_12.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  225. // CHECK:STDOUT: %.loc7_12.2: type = converted %.loc7_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  226. // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %empty_tuple.type} [concrete = constants.%struct_type.a]
  227. // CHECK:STDOUT: %NonInstance1.ref: type = name_ref NonInstance1, file.%NonInstance1.decl [concrete = constants.%NonInstance1.type]
  228. // CHECK:STDOUT: }
  229. // CHECK:STDOUT: %NonInstance1.impl_witness_table = impl_witness_table (@struct_type.a.as.NonInstance1.impl.%struct_type.a.as.NonInstance1.impl.F1.decl), @struct_type.a.as.NonInstance1.impl [concrete]
  230. // CHECK:STDOUT: %NonInstance1.impl_witness: <witness> = impl_witness %NonInstance1.impl_witness_table [concrete = constants.%NonInstance1.impl_witness]
  231. // CHECK:STDOUT: %NonInstanceCall1.decl: %NonInstanceCall1.type = fn_decl @NonInstanceCall1 [concrete = constants.%NonInstanceCall1] {} {}
  232. // CHECK:STDOUT: }
  233. // CHECK:STDOUT:
  234. // CHECK:STDOUT: interface @NonInstance1 {
  235. // CHECK:STDOUT: %Self: %NonInstance1.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  236. // CHECK:STDOUT: %NonInstance1.F1.decl: %NonInstance1.F1.type = fn_decl @NonInstance1.F1 [concrete = constants.%NonInstance1.F1] {} {}
  237. // CHECK:STDOUT: %assoc0: %NonInstance1.assoc_type = assoc_entity element0, %NonInstance1.F1.decl [concrete = constants.%assoc0]
  238. // CHECK:STDOUT:
  239. // CHECK:STDOUT: !members:
  240. // CHECK:STDOUT: .Self = %Self
  241. // CHECK:STDOUT: .F1 = %assoc0
  242. // CHECK:STDOUT: witness = (%NonInstance1.F1.decl)
  243. // CHECK:STDOUT:
  244. // CHECK:STDOUT: !requires:
  245. // CHECK:STDOUT: }
  246. // CHECK:STDOUT:
  247. // CHECK:STDOUT: impl @struct_type.a.as.NonInstance1.impl: %struct_type.a as %NonInstance1.ref {
  248. // 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] {} {}
  249. // CHECK:STDOUT:
  250. // CHECK:STDOUT: !members:
  251. // CHECK:STDOUT: .F1 = %struct_type.a.as.NonInstance1.impl.F1.decl
  252. // CHECK:STDOUT: witness = file.%NonInstance1.impl_witness
  253. // CHECK:STDOUT: }
  254. // CHECK:STDOUT:
  255. // CHECK:STDOUT: generic fn @NonInstance1.F1(@NonInstance1.%Self: %NonInstance1.type) {
  256. // CHECK:STDOUT: fn();
  257. // CHECK:STDOUT: }
  258. // CHECK:STDOUT:
  259. // CHECK:STDOUT: fn @struct_type.a.as.NonInstance1.impl.F1() {
  260. // CHECK:STDOUT: !entry:
  261. // CHECK:STDOUT: return
  262. // CHECK:STDOUT: }
  263. // CHECK:STDOUT:
  264. // CHECK:STDOUT: fn @NonInstanceCall1() {
  265. // CHECK:STDOUT: !entry:
  266. // CHECK:STDOUT: %.loc12_9.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  267. // CHECK:STDOUT: %.loc12_9.2: type = converted %.loc12_9.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  268. // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %empty_tuple.type} [concrete = constants.%struct_type.a]
  269. // CHECK:STDOUT: %NonInstance1.ref: type = name_ref NonInstance1, file.%NonInstance1.decl [concrete = constants.%NonInstance1.type]
  270. // CHECK:STDOUT: %F1.ref: %NonInstance1.assoc_type = name_ref F1, @NonInstance1.%assoc0 [concrete = constants.%assoc0]
  271. // CHECK:STDOUT: %NonInstance1.facet: %NonInstance1.type = facet_value %struct_type.a, (constants.%NonInstance1.impl_witness) [concrete = constants.%NonInstance1.facet]
  272. // CHECK:STDOUT: %.loc12_11: %NonInstance1.type = converted %struct_type.a, %NonInstance1.facet [concrete = constants.%NonInstance1.facet]
  273. // CHECK:STDOUT: %impl.elem0: %.ced = impl_witness_access constants.%NonInstance1.impl_witness, element0 [concrete = constants.%struct_type.a.as.NonInstance1.impl.F1]
  274. // CHECK:STDOUT: %struct_type.a.as.NonInstance1.impl.F1.call: init %empty_tuple.type = call %impl.elem0()
  275. // CHECK:STDOUT: return
  276. // CHECK:STDOUT: }
  277. // CHECK:STDOUT:
  278. // CHECK:STDOUT: specific @NonInstance1.F1(constants.%Self) {}
  279. // CHECK:STDOUT:
  280. // CHECK:STDOUT: specific @NonInstance1.F1(constants.%NonInstance1.facet) {}
  281. // CHECK:STDOUT:
  282. // CHECK:STDOUT: --- fail_non-instance.carbon
  283. // CHECK:STDOUT:
  284. // CHECK:STDOUT: constants {
  285. // CHECK:STDOUT: %NonInstance2.type: type = facet_type <@NonInstance2> [concrete]
  286. // CHECK:STDOUT: %Self.2eb: %NonInstance2.type = symbolic_binding Self, 0 [symbolic]
  287. // CHECK:STDOUT: %NonInstance2.F2.type: type = fn_type @NonInstance2.F2 [concrete]
  288. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  289. // CHECK:STDOUT: %NonInstance2.F2: %NonInstance2.F2.type = struct_value () [concrete]
  290. // CHECK:STDOUT: %NonInstance2.assoc_type: type = assoc_entity_type @NonInstance2 [concrete]
  291. // CHECK:STDOUT: %assoc0.92e: %NonInstance2.assoc_type = assoc_entity element0, @NonInstance2.%NonInstance2.F2.decl [concrete]
  292. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  293. // CHECK:STDOUT: %struct_type.b: type = struct_type {.b: %empty_tuple.type} [concrete]
  294. // CHECK:STDOUT: %NonInstance2.impl_witness: <witness> = impl_witness file.%NonInstance2.impl_witness_table [concrete]
  295. // CHECK:STDOUT: %struct_type.b.as.NonInstance2.impl.F2.type: type = fn_type @struct_type.b.as.NonInstance2.impl.F2 [concrete]
  296. // CHECK:STDOUT: %struct_type.b.as.NonInstance2.impl.F2: %struct_type.b.as.NonInstance2.impl.F2.type = struct_value () [concrete]
  297. // CHECK:STDOUT: %NonInstance2.facet: %NonInstance2.type = facet_value %struct_type.b, (%NonInstance2.impl_witness) [concrete]
  298. // CHECK:STDOUT: %pattern_type.d5c: type = pattern_type %struct_type.b [concrete]
  299. // CHECK:STDOUT: %NonInstanceCall2.type: type = fn_type @NonInstanceCall2 [concrete]
  300. // CHECK:STDOUT: %NonInstanceCall2: %NonInstanceCall2.type = struct_value () [concrete]
  301. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  302. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  303. // CHECK:STDOUT: %Dest: type = symbolic_binding Dest, 0 [symbolic]
  304. // CHECK:STDOUT: %ImplicitAs.type.2d9: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic]
  305. // CHECK:STDOUT: %Self.4f1: %ImplicitAs.type.2d9 = symbolic_binding Self, 1 [symbolic]
  306. // CHECK:STDOUT: %ImplicitAs.Convert.type.4c8: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%Dest) [symbolic]
  307. // CHECK:STDOUT: %ImplicitAs.Convert.e9f: %ImplicitAs.Convert.type.4c8 = struct_value () [symbolic]
  308. // CHECK:STDOUT: %pattern_type.e68: type = pattern_type %Dest [symbolic]
  309. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self.4f1 [symbolic]
  310. // CHECK:STDOUT: %pattern_type.c40: type = pattern_type %Self.binding.as_type [symbolic]
  311. // CHECK:STDOUT: %ImplicitAs.assoc_type.8b5: type = assoc_entity_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic]
  312. // CHECK:STDOUT: %assoc0.f64: %ImplicitAs.assoc_type.8b5 = assoc_entity element0, imports.%Core.import_ref.b91 [symbolic]
  313. // CHECK:STDOUT: %ImplicitAs.type.d3c: type = facet_type <@ImplicitAs, @ImplicitAs(%NonInstance2.type)> [concrete]
  314. // CHECK:STDOUT: %Self.29a: %ImplicitAs.type.d3c = symbolic_binding Self, 1 [symbolic]
  315. // CHECK:STDOUT: %ImplicitAs.Convert.type.de0: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%NonInstance2.type) [concrete]
  316. // CHECK:STDOUT: %ImplicitAs.Convert.a1a: %ImplicitAs.Convert.type.de0 = struct_value () [concrete]
  317. // CHECK:STDOUT: %ImplicitAs.assoc_type.926: type = assoc_entity_type @ImplicitAs, @ImplicitAs(%NonInstance2.type) [concrete]
  318. // CHECK:STDOUT: %assoc0.af3: %ImplicitAs.assoc_type.926 = assoc_entity element0, imports.%Core.import_ref.b91 [concrete]
  319. // CHECK:STDOUT: %assoc0.7b6: %ImplicitAs.assoc_type.8b5 = assoc_entity element0, imports.%Core.import_ref.d11 [symbolic]
  320. // CHECK:STDOUT: }
  321. // CHECK:STDOUT:
  322. // CHECK:STDOUT: imports {
  323. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  324. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  325. // CHECK:STDOUT: import Core//default
  326. // CHECK:STDOUT: }
  327. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//default, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  328. // CHECK:STDOUT: %Core.import_ref.efcd44.1: type = import_ref Core//default, loc{{\d+_\d+}}, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)]
  329. // CHECK:STDOUT: %Core.import_ref.d6f = import_ref Core//default, loc{{\d+_\d+}}, unloaded
  330. // CHECK:STDOUT: %Core.import_ref.b9c: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.8b5) = import_ref Core//default, loc{{\d+_\d+}}, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.7b6)]
  331. // CHECK:STDOUT: %Core.Convert = import_ref Core//default, Convert, unloaded
  332. // CHECK:STDOUT: %Core.import_ref.efcd44.2: type = import_ref Core//default, loc{{\d+_\d+}}, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)]
  333. // CHECK:STDOUT: %Core.import_ref.4ff: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2d9) = import_ref Core//default, loc{{\d+_\d+}}, loaded [symbolic = @ImplicitAs.%Self (constants.%Self.4f1)]
  334. // CHECK:STDOUT: %Core.import_ref.b91: @ImplicitAs.%ImplicitAs.Convert.type (%ImplicitAs.Convert.type.4c8) = import_ref Core//default, loc{{\d+_\d+}}, loaded [symbolic = @ImplicitAs.%ImplicitAs.Convert (constants.%ImplicitAs.Convert.e9f)]
  335. // CHECK:STDOUT: %Core.import_ref.d11 = import_ref Core//default, loc{{\d+_\d+}}, unloaded
  336. // CHECK:STDOUT: }
  337. // CHECK:STDOUT:
  338. // CHECK:STDOUT: file {
  339. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  340. // CHECK:STDOUT: .Core = imports.%Core
  341. // CHECK:STDOUT: .NonInstance2 = %NonInstance2.decl
  342. // CHECK:STDOUT: .NonInstanceCall2 = %NonInstanceCall2.decl
  343. // CHECK:STDOUT: }
  344. // CHECK:STDOUT: %Core.import = import Core
  345. // CHECK:STDOUT: %NonInstance2.decl: type = interface_decl @NonInstance2 [concrete = constants.%NonInstance2.type] {} {}
  346. // CHECK:STDOUT: impl_decl @struct_type.b.as.NonInstance2.impl [concrete] {} {
  347. // CHECK:STDOUT: %.loc9_12.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  348. // CHECK:STDOUT: %.loc9_12.2: type = converted %.loc9_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  349. // CHECK:STDOUT: %struct_type.b: type = struct_type {.b: %empty_tuple.type} [concrete = constants.%struct_type.b]
  350. // CHECK:STDOUT: %NonInstance2.ref: type = name_ref NonInstance2, file.%NonInstance2.decl [concrete = constants.%NonInstance2.type]
  351. // CHECK:STDOUT: }
  352. // CHECK:STDOUT: %NonInstance2.impl_witness_table = impl_witness_table (@struct_type.b.as.NonInstance2.impl.%struct_type.b.as.NonInstance2.impl.F2.decl), @struct_type.b.as.NonInstance2.impl [concrete]
  353. // CHECK:STDOUT: %NonInstance2.impl_witness: <witness> = impl_witness %NonInstance2.impl_witness_table [concrete = constants.%NonInstance2.impl_witness]
  354. // CHECK:STDOUT: %NonInstanceCall2.decl: %NonInstanceCall2.type = fn_decl @NonInstanceCall2 [concrete = constants.%NonInstanceCall2] {
  355. // CHECK:STDOUT: %n.patt: %pattern_type.d5c = value_binding_pattern n [concrete]
  356. // CHECK:STDOUT: %n.param_patt: %pattern_type.d5c = value_param_pattern %n.patt, call_param0 [concrete]
  357. // CHECK:STDOUT: } {
  358. // CHECK:STDOUT: %n.param: %struct_type.b = value_param call_param0
  359. // CHECK:STDOUT: %.loc13_31: type = splice_block %struct_type.b [concrete = constants.%struct_type.b] {
  360. // CHECK:STDOUT: %.loc13_30.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  361. // CHECK:STDOUT: %.loc13_30.2: type = converted %.loc13_30.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  362. // CHECK:STDOUT: %struct_type.b: type = struct_type {.b: %empty_tuple.type} [concrete = constants.%struct_type.b]
  363. // CHECK:STDOUT: }
  364. // CHECK:STDOUT: %n: %struct_type.b = value_binding n, %n.param
  365. // CHECK:STDOUT: }
  366. // CHECK:STDOUT: }
  367. // CHECK:STDOUT:
  368. // CHECK:STDOUT: interface @NonInstance2 {
  369. // CHECK:STDOUT: %Self: %NonInstance2.type = symbolic_binding Self, 0 [symbolic = constants.%Self.2eb]
  370. // CHECK:STDOUT: %NonInstance2.F2.decl: %NonInstance2.F2.type = fn_decl @NonInstance2.F2 [concrete = constants.%NonInstance2.F2] {} {}
  371. // CHECK:STDOUT: %assoc0: %NonInstance2.assoc_type = assoc_entity element0, %NonInstance2.F2.decl [concrete = constants.%assoc0.92e]
  372. // CHECK:STDOUT:
  373. // CHECK:STDOUT: !members:
  374. // CHECK:STDOUT: .Self = %Self
  375. // CHECK:STDOUT: .F2 = %assoc0
  376. // CHECK:STDOUT: witness = (%NonInstance2.F2.decl)
  377. // CHECK:STDOUT:
  378. // CHECK:STDOUT: !requires:
  379. // CHECK:STDOUT: }
  380. // CHECK:STDOUT:
  381. // CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.efcd44.1: type) [from "core.carbon"] {
  382. // CHECK:STDOUT: %Dest: type = symbolic_binding Dest, 0 [symbolic = %Dest (constants.%Dest)]
  383. // CHECK:STDOUT:
  384. // CHECK:STDOUT: !definition:
  385. // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2d9)]
  386. // CHECK:STDOUT: %Self: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2d9) = symbolic_binding Self, 1 [symbolic = %Self (constants.%Self.4f1)]
  387. // CHECK:STDOUT: %ImplicitAs.Convert.type: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.Convert.type (constants.%ImplicitAs.Convert.type.4c8)]
  388. // CHECK:STDOUT: %ImplicitAs.Convert: @ImplicitAs.%ImplicitAs.Convert.type (%ImplicitAs.Convert.type.4c8) = struct_value () [symbolic = %ImplicitAs.Convert (constants.%ImplicitAs.Convert.e9f)]
  389. // CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.assoc_type (constants.%ImplicitAs.assoc_type.8b5)]
  390. // CHECK:STDOUT: %assoc0: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.8b5) = assoc_entity element0, imports.%Core.import_ref.b91 [symbolic = %assoc0 (constants.%assoc0.f64)]
  391. // CHECK:STDOUT:
  392. // CHECK:STDOUT: interface {
  393. // CHECK:STDOUT: !members:
  394. // CHECK:STDOUT: .Self = imports.%Core.import_ref.d6f
  395. // CHECK:STDOUT: .Convert = imports.%Core.import_ref.b9c
  396. // CHECK:STDOUT: witness = (imports.%Core.Convert)
  397. // CHECK:STDOUT:
  398. // CHECK:STDOUT: !requires:
  399. // CHECK:STDOUT: }
  400. // CHECK:STDOUT: }
  401. // CHECK:STDOUT:
  402. // CHECK:STDOUT: impl @struct_type.b.as.NonInstance2.impl: %struct_type.b as %NonInstance2.ref {
  403. // 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] {} {}
  404. // CHECK:STDOUT:
  405. // CHECK:STDOUT: !members:
  406. // CHECK:STDOUT: .F2 = %struct_type.b.as.NonInstance2.impl.F2.decl
  407. // CHECK:STDOUT: witness = file.%NonInstance2.impl_witness
  408. // CHECK:STDOUT: }
  409. // CHECK:STDOUT:
  410. // CHECK:STDOUT: generic fn @NonInstance2.F2(@NonInstance2.%Self: %NonInstance2.type) {
  411. // CHECK:STDOUT: fn();
  412. // CHECK:STDOUT: }
  413. // CHECK:STDOUT:
  414. // CHECK:STDOUT: fn @struct_type.b.as.NonInstance2.impl.F2() {
  415. // CHECK:STDOUT: !entry:
  416. // CHECK:STDOUT: return
  417. // CHECK:STDOUT: }
  418. // CHECK:STDOUT:
  419. // CHECK:STDOUT: fn @NonInstanceCall2(%n.param: %struct_type.b) {
  420. // CHECK:STDOUT: !entry:
  421. // CHECK:STDOUT: %n.ref: %struct_type.b = name_ref n, %n
  422. // CHECK:STDOUT: %NonInstance2.ref: type = name_ref NonInstance2, file.%NonInstance2.decl [concrete = constants.%NonInstance2.type]
  423. // CHECK:STDOUT: %F2.ref: %NonInstance2.assoc_type = name_ref F2, @NonInstance2.%assoc0 [concrete = constants.%assoc0.92e]
  424. // CHECK:STDOUT: %.loc21: %NonInstance2.type = converted %n.ref, <error> [concrete = <error>]
  425. // CHECK:STDOUT: return
  426. // CHECK:STDOUT: }
  427. // CHECK:STDOUT:
  428. // CHECK:STDOUT: generic fn @ImplicitAs.Convert(imports.%Core.import_ref.efcd44.2: type, imports.%Core.import_ref.4ff: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2d9)) [from "core.carbon"] {
  429. // CHECK:STDOUT: %Dest: type = symbolic_binding Dest, 0 [symbolic = %Dest (constants.%Dest)]
  430. // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2d9)]
  431. // CHECK:STDOUT: %Self: @ImplicitAs.Convert.%ImplicitAs.type (%ImplicitAs.type.2d9) = symbolic_binding Self, 1 [symbolic = %Self (constants.%Self.4f1)]
  432. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  433. // CHECK:STDOUT: %pattern_type.1: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type.1 (constants.%pattern_type.c40)]
  434. // CHECK:STDOUT: %pattern_type.2: type = pattern_type %Dest [symbolic = %pattern_type.2 (constants.%pattern_type.e68)]
  435. // CHECK:STDOUT:
  436. // CHECK:STDOUT: fn;
  437. // CHECK:STDOUT: }
  438. // CHECK:STDOUT:
  439. // CHECK:STDOUT: specific @NonInstance2.F2(constants.%Self.2eb) {}
  440. // CHECK:STDOUT:
  441. // CHECK:STDOUT: specific @NonInstance2.F2(constants.%NonInstance2.facet) {}
  442. // CHECK:STDOUT:
  443. // CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) {
  444. // CHECK:STDOUT: %Dest => constants.%Dest
  445. // CHECK:STDOUT: }
  446. // CHECK:STDOUT:
  447. // CHECK:STDOUT: specific @ImplicitAs.Convert(constants.%Dest, constants.%Self.4f1) {
  448. // CHECK:STDOUT: %Dest => constants.%Dest
  449. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2d9
  450. // CHECK:STDOUT: %Self => constants.%Self.4f1
  451. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  452. // CHECK:STDOUT: %pattern_type.1 => constants.%pattern_type.c40
  453. // CHECK:STDOUT: %pattern_type.2 => constants.%pattern_type.e68
  454. // CHECK:STDOUT: }
  455. // CHECK:STDOUT:
  456. // CHECK:STDOUT: specific @ImplicitAs(constants.%NonInstance2.type) {
  457. // CHECK:STDOUT: %Dest => constants.%NonInstance2.type
  458. // CHECK:STDOUT:
  459. // CHECK:STDOUT: !definition:
  460. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.d3c
  461. // CHECK:STDOUT: %Self => constants.%Self.29a
  462. // CHECK:STDOUT: %ImplicitAs.Convert.type => constants.%ImplicitAs.Convert.type.de0
  463. // CHECK:STDOUT: %ImplicitAs.Convert => constants.%ImplicitAs.Convert.a1a
  464. // CHECK:STDOUT: %ImplicitAs.assoc_type => constants.%ImplicitAs.assoc_type.926
  465. // CHECK:STDOUT: %assoc0 => constants.%assoc0.af3
  466. // CHECK:STDOUT: }
  467. // CHECK:STDOUT:
  468. // CHECK:STDOUT: --- fail_non-instance_indirect.carbon
  469. // CHECK:STDOUT:
  470. // CHECK:STDOUT: constants {
  471. // CHECK:STDOUT: %NonInstance3.type: type = facet_type <@NonInstance3> [concrete]
  472. // CHECK:STDOUT: %Self.e5f: %NonInstance3.type = symbolic_binding Self, 0 [symbolic]
  473. // CHECK:STDOUT: %NonInstance3.F3.type: type = fn_type @NonInstance3.F3 [concrete]
  474. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  475. // CHECK:STDOUT: %NonInstance3.F3: %NonInstance3.F3.type = struct_value () [concrete]
  476. // CHECK:STDOUT: %NonInstance3.assoc_type: type = assoc_entity_type @NonInstance3 [concrete]
  477. // CHECK:STDOUT: %assoc0.2f5: %NonInstance3.assoc_type = assoc_entity element0, @NonInstance3.%NonInstance3.F3.decl [concrete]
  478. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  479. // CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %empty_tuple.type} [concrete]
  480. // CHECK:STDOUT: %NonInstance3.impl_witness: <witness> = impl_witness file.%NonInstance3.impl_witness_table [concrete]
  481. // CHECK:STDOUT: %struct_type.c.as.NonInstance3.impl.F3.type: type = fn_type @struct_type.c.as.NonInstance3.impl.F3 [concrete]
  482. // CHECK:STDOUT: %struct_type.c.as.NonInstance3.impl.F3: %struct_type.c.as.NonInstance3.impl.F3.type = struct_value () [concrete]
  483. // CHECK:STDOUT: %NonInstance3.facet: %NonInstance3.type = facet_value %struct_type.c, (%NonInstance3.impl_witness) [concrete]
  484. // CHECK:STDOUT: %ptr: type = ptr_type %struct_type.c [concrete]
  485. // CHECK:STDOUT: %pattern_type.5f5: type = pattern_type %ptr [concrete]
  486. // CHECK:STDOUT: %NonInstanceCallIndirect.type: type = fn_type @NonInstanceCallIndirect [concrete]
  487. // CHECK:STDOUT: %NonInstanceCallIndirect: %NonInstanceCallIndirect.type = struct_value () [concrete]
  488. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  489. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  490. // CHECK:STDOUT: %Dest: type = symbolic_binding Dest, 0 [symbolic]
  491. // CHECK:STDOUT: %ImplicitAs.type.2d9: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic]
  492. // CHECK:STDOUT: %Self.4f1: %ImplicitAs.type.2d9 = symbolic_binding Self, 1 [symbolic]
  493. // CHECK:STDOUT: %ImplicitAs.Convert.type.4c8: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%Dest) [symbolic]
  494. // CHECK:STDOUT: %ImplicitAs.Convert.e9f: %ImplicitAs.Convert.type.4c8 = struct_value () [symbolic]
  495. // CHECK:STDOUT: %pattern_type.e68: type = pattern_type %Dest [symbolic]
  496. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self.4f1 [symbolic]
  497. // CHECK:STDOUT: %pattern_type.c40: type = pattern_type %Self.binding.as_type [symbolic]
  498. // CHECK:STDOUT: %ImplicitAs.assoc_type.8b5: type = assoc_entity_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic]
  499. // CHECK:STDOUT: %assoc0.f64: %ImplicitAs.assoc_type.8b5 = assoc_entity element0, imports.%Core.import_ref.b91 [symbolic]
  500. // CHECK:STDOUT: %ImplicitAs.type.2b7: type = facet_type <@ImplicitAs, @ImplicitAs(%NonInstance3.type)> [concrete]
  501. // CHECK:STDOUT: %Self.919: %ImplicitAs.type.2b7 = symbolic_binding Self, 1 [symbolic]
  502. // CHECK:STDOUT: %ImplicitAs.Convert.type.162: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%NonInstance3.type) [concrete]
  503. // CHECK:STDOUT: %ImplicitAs.Convert.af3: %ImplicitAs.Convert.type.162 = struct_value () [concrete]
  504. // CHECK:STDOUT: %ImplicitAs.assoc_type.f78: type = assoc_entity_type @ImplicitAs, @ImplicitAs(%NonInstance3.type) [concrete]
  505. // CHECK:STDOUT: %assoc0.da1: %ImplicitAs.assoc_type.f78 = assoc_entity element0, imports.%Core.import_ref.b91 [concrete]
  506. // CHECK:STDOUT: %assoc0.7b6: %ImplicitAs.assoc_type.8b5 = assoc_entity element0, imports.%Core.import_ref.d11 [symbolic]
  507. // CHECK:STDOUT: }
  508. // CHECK:STDOUT:
  509. // CHECK:STDOUT: imports {
  510. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  511. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  512. // CHECK:STDOUT: import Core//default
  513. // CHECK:STDOUT: }
  514. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//default, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  515. // CHECK:STDOUT: %Core.import_ref.efcd44.1: type = import_ref Core//default, loc{{\d+_\d+}}, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)]
  516. // CHECK:STDOUT: %Core.import_ref.d6f = import_ref Core//default, loc{{\d+_\d+}}, unloaded
  517. // CHECK:STDOUT: %Core.import_ref.b9c: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.8b5) = import_ref Core//default, loc{{\d+_\d+}}, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.7b6)]
  518. // CHECK:STDOUT: %Core.Convert = import_ref Core//default, Convert, unloaded
  519. // CHECK:STDOUT: %Core.import_ref.efcd44.2: type = import_ref Core//default, loc{{\d+_\d+}}, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)]
  520. // CHECK:STDOUT: %Core.import_ref.4ff: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2d9) = import_ref Core//default, loc{{\d+_\d+}}, loaded [symbolic = @ImplicitAs.%Self (constants.%Self.4f1)]
  521. // CHECK:STDOUT: %Core.import_ref.b91: @ImplicitAs.%ImplicitAs.Convert.type (%ImplicitAs.Convert.type.4c8) = import_ref Core//default, loc{{\d+_\d+}}, loaded [symbolic = @ImplicitAs.%ImplicitAs.Convert (constants.%ImplicitAs.Convert.e9f)]
  522. // CHECK:STDOUT: %Core.import_ref.d11 = import_ref Core//default, loc{{\d+_\d+}}, unloaded
  523. // CHECK:STDOUT: }
  524. // CHECK:STDOUT:
  525. // CHECK:STDOUT: file {
  526. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  527. // CHECK:STDOUT: .Core = imports.%Core
  528. // CHECK:STDOUT: .NonInstance3 = %NonInstance3.decl
  529. // CHECK:STDOUT: .NonInstanceCallIndirect = %NonInstanceCallIndirect.decl
  530. // CHECK:STDOUT: }
  531. // CHECK:STDOUT: %Core.import = import Core
  532. // CHECK:STDOUT: %NonInstance3.decl: type = interface_decl @NonInstance3 [concrete = constants.%NonInstance3.type] {} {}
  533. // CHECK:STDOUT: impl_decl @struct_type.c.as.NonInstance3.impl [concrete] {} {
  534. // CHECK:STDOUT: %.loc9_12.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  535. // CHECK:STDOUT: %.loc9_12.2: type = converted %.loc9_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  536. // CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %empty_tuple.type} [concrete = constants.%struct_type.c]
  537. // CHECK:STDOUT: %NonInstance3.ref: type = name_ref NonInstance3, file.%NonInstance3.decl [concrete = constants.%NonInstance3.type]
  538. // CHECK:STDOUT: }
  539. // CHECK:STDOUT: %NonInstance3.impl_witness_table = impl_witness_table (@struct_type.c.as.NonInstance3.impl.%struct_type.c.as.NonInstance3.impl.F3.decl), @struct_type.c.as.NonInstance3.impl [concrete]
  540. // CHECK:STDOUT: %NonInstance3.impl_witness: <witness> = impl_witness %NonInstance3.impl_witness_table [concrete = constants.%NonInstance3.impl_witness]
  541. // CHECK:STDOUT: %NonInstanceCallIndirect.decl: %NonInstanceCallIndirect.type = fn_decl @NonInstanceCallIndirect [concrete = constants.%NonInstanceCallIndirect] {
  542. // CHECK:STDOUT: %p.patt: %pattern_type.5f5 = value_binding_pattern p [concrete]
  543. // CHECK:STDOUT: %p.param_patt: %pattern_type.5f5 = value_param_pattern %p.patt, call_param0 [concrete]
  544. // CHECK:STDOUT: } {
  545. // CHECK:STDOUT: %p.param: %ptr = value_param call_param0
  546. // CHECK:STDOUT: %.loc13_39: type = splice_block %ptr [concrete = constants.%ptr] {
  547. // CHECK:STDOUT: %.loc13_37.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  548. // CHECK:STDOUT: %.loc13_37.2: type = converted %.loc13_37.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  549. // CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %empty_tuple.type} [concrete = constants.%struct_type.c]
  550. // CHECK:STDOUT: %ptr: type = ptr_type %struct_type.c [concrete = constants.%ptr]
  551. // CHECK:STDOUT: }
  552. // CHECK:STDOUT: %p: %ptr = value_binding p, %p.param
  553. // CHECK:STDOUT: }
  554. // CHECK:STDOUT: }
  555. // CHECK:STDOUT:
  556. // CHECK:STDOUT: interface @NonInstance3 {
  557. // CHECK:STDOUT: %Self: %NonInstance3.type = symbolic_binding Self, 0 [symbolic = constants.%Self.e5f]
  558. // CHECK:STDOUT: %NonInstance3.F3.decl: %NonInstance3.F3.type = fn_decl @NonInstance3.F3 [concrete = constants.%NonInstance3.F3] {} {}
  559. // CHECK:STDOUT: %assoc0: %NonInstance3.assoc_type = assoc_entity element0, %NonInstance3.F3.decl [concrete = constants.%assoc0.2f5]
  560. // CHECK:STDOUT:
  561. // CHECK:STDOUT: !members:
  562. // CHECK:STDOUT: .Self = %Self
  563. // CHECK:STDOUT: .F3 = %assoc0
  564. // CHECK:STDOUT: witness = (%NonInstance3.F3.decl)
  565. // CHECK:STDOUT:
  566. // CHECK:STDOUT: !requires:
  567. // CHECK:STDOUT: }
  568. // CHECK:STDOUT:
  569. // CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.efcd44.1: type) [from "core.carbon"] {
  570. // CHECK:STDOUT: %Dest: type = symbolic_binding Dest, 0 [symbolic = %Dest (constants.%Dest)]
  571. // CHECK:STDOUT:
  572. // CHECK:STDOUT: !definition:
  573. // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2d9)]
  574. // CHECK:STDOUT: %Self: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2d9) = symbolic_binding Self, 1 [symbolic = %Self (constants.%Self.4f1)]
  575. // CHECK:STDOUT: %ImplicitAs.Convert.type: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.Convert.type (constants.%ImplicitAs.Convert.type.4c8)]
  576. // CHECK:STDOUT: %ImplicitAs.Convert: @ImplicitAs.%ImplicitAs.Convert.type (%ImplicitAs.Convert.type.4c8) = struct_value () [symbolic = %ImplicitAs.Convert (constants.%ImplicitAs.Convert.e9f)]
  577. // CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.assoc_type (constants.%ImplicitAs.assoc_type.8b5)]
  578. // CHECK:STDOUT: %assoc0: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.8b5) = assoc_entity element0, imports.%Core.import_ref.b91 [symbolic = %assoc0 (constants.%assoc0.f64)]
  579. // CHECK:STDOUT:
  580. // CHECK:STDOUT: interface {
  581. // CHECK:STDOUT: !members:
  582. // CHECK:STDOUT: .Self = imports.%Core.import_ref.d6f
  583. // CHECK:STDOUT: .Convert = imports.%Core.import_ref.b9c
  584. // CHECK:STDOUT: witness = (imports.%Core.Convert)
  585. // CHECK:STDOUT:
  586. // CHECK:STDOUT: !requires:
  587. // CHECK:STDOUT: }
  588. // CHECK:STDOUT: }
  589. // CHECK:STDOUT:
  590. // CHECK:STDOUT: impl @struct_type.c.as.NonInstance3.impl: %struct_type.c as %NonInstance3.ref {
  591. // 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] {} {}
  592. // CHECK:STDOUT:
  593. // CHECK:STDOUT: !members:
  594. // CHECK:STDOUT: .F3 = %struct_type.c.as.NonInstance3.impl.F3.decl
  595. // CHECK:STDOUT: witness = file.%NonInstance3.impl_witness
  596. // CHECK:STDOUT: }
  597. // CHECK:STDOUT:
  598. // CHECK:STDOUT: generic fn @NonInstance3.F3(@NonInstance3.%Self: %NonInstance3.type) {
  599. // CHECK:STDOUT: fn();
  600. // CHECK:STDOUT: }
  601. // CHECK:STDOUT:
  602. // CHECK:STDOUT: fn @struct_type.c.as.NonInstance3.impl.F3() {
  603. // CHECK:STDOUT: !entry:
  604. // CHECK:STDOUT: return
  605. // CHECK:STDOUT: }
  606. // CHECK:STDOUT:
  607. // CHECK:STDOUT: fn @NonInstanceCallIndirect(%p.param: %ptr) {
  608. // CHECK:STDOUT: !entry:
  609. // CHECK:STDOUT: %p.ref: %ptr = name_ref p, %p
  610. // CHECK:STDOUT: %NonInstance3.ref: type = name_ref NonInstance3, file.%NonInstance3.decl [concrete = constants.%NonInstance3.type]
  611. // CHECK:STDOUT: %F3.ref: %NonInstance3.assoc_type = name_ref F3, @NonInstance3.%assoc0 [concrete = constants.%assoc0.2f5]
  612. // CHECK:STDOUT: %.loc21_4.1: ref %struct_type.c = deref %p.ref
  613. // CHECK:STDOUT: %.loc21_4.2: %NonInstance3.type = converted %.loc21_4.1, <error> [concrete = <error>]
  614. // CHECK:STDOUT: return
  615. // CHECK:STDOUT: }
  616. // CHECK:STDOUT:
  617. // CHECK:STDOUT: generic fn @ImplicitAs.Convert(imports.%Core.import_ref.efcd44.2: type, imports.%Core.import_ref.4ff: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2d9)) [from "core.carbon"] {
  618. // CHECK:STDOUT: %Dest: type = symbolic_binding Dest, 0 [symbolic = %Dest (constants.%Dest)]
  619. // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2d9)]
  620. // CHECK:STDOUT: %Self: @ImplicitAs.Convert.%ImplicitAs.type (%ImplicitAs.type.2d9) = symbolic_binding Self, 1 [symbolic = %Self (constants.%Self.4f1)]
  621. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  622. // CHECK:STDOUT: %pattern_type.1: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type.1 (constants.%pattern_type.c40)]
  623. // CHECK:STDOUT: %pattern_type.2: type = pattern_type %Dest [symbolic = %pattern_type.2 (constants.%pattern_type.e68)]
  624. // CHECK:STDOUT:
  625. // CHECK:STDOUT: fn;
  626. // CHECK:STDOUT: }
  627. // CHECK:STDOUT:
  628. // CHECK:STDOUT: specific @NonInstance3.F3(constants.%Self.e5f) {}
  629. // CHECK:STDOUT:
  630. // CHECK:STDOUT: specific @NonInstance3.F3(constants.%NonInstance3.facet) {}
  631. // CHECK:STDOUT:
  632. // CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) {
  633. // CHECK:STDOUT: %Dest => constants.%Dest
  634. // CHECK:STDOUT: }
  635. // CHECK:STDOUT:
  636. // CHECK:STDOUT: specific @ImplicitAs.Convert(constants.%Dest, constants.%Self.4f1) {
  637. // CHECK:STDOUT: %Dest => constants.%Dest
  638. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2d9
  639. // CHECK:STDOUT: %Self => constants.%Self.4f1
  640. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  641. // CHECK:STDOUT: %pattern_type.1 => constants.%pattern_type.c40
  642. // CHECK:STDOUT: %pattern_type.2 => constants.%pattern_type.e68
  643. // CHECK:STDOUT: }
  644. // CHECK:STDOUT:
  645. // CHECK:STDOUT: specific @ImplicitAs(constants.%NonInstance3.type) {
  646. // CHECK:STDOUT: %Dest => constants.%NonInstance3.type
  647. // CHECK:STDOUT:
  648. // CHECK:STDOUT: !definition:
  649. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2b7
  650. // CHECK:STDOUT: %Self => constants.%Self.919
  651. // CHECK:STDOUT: %ImplicitAs.Convert.type => constants.%ImplicitAs.Convert.type.162
  652. // CHECK:STDOUT: %ImplicitAs.Convert => constants.%ImplicitAs.Convert.af3
  653. // CHECK:STDOUT: %ImplicitAs.assoc_type => constants.%ImplicitAs.assoc_type.f78
  654. // CHECK:STDOUT: %assoc0 => constants.%assoc0.da1
  655. // CHECK:STDOUT: }
  656. // CHECK:STDOUT:
  657. // CHECK:STDOUT: --- instance_success.carbon
  658. // CHECK:STDOUT:
  659. // CHECK:STDOUT: constants {
  660. // CHECK:STDOUT: %Instance1.type: type = facet_type <@Instance1> [concrete]
  661. // CHECK:STDOUT: %Self: %Instance1.type = symbolic_binding Self, 0 [symbolic]
  662. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic]
  663. // CHECK:STDOUT: %pattern_type.19d: type = pattern_type %Self.binding.as_type [symbolic]
  664. // CHECK:STDOUT: %Instance1.G1.type: type = fn_type @Instance1.G1 [concrete]
  665. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  666. // CHECK:STDOUT: %Instance1.G1: %Instance1.G1.type = struct_value () [concrete]
  667. // CHECK:STDOUT: %Instance1.assoc_type: type = assoc_entity_type @Instance1 [concrete]
  668. // CHECK:STDOUT: %assoc0: %Instance1.assoc_type = assoc_entity element0, @Instance1.%Instance1.G1.decl [concrete]
  669. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  670. // CHECK:STDOUT: %struct_type.d: type = struct_type {.d: %empty_tuple.type} [concrete]
  671. // CHECK:STDOUT: %Instance1.impl_witness: <witness> = impl_witness file.%Instance1.impl_witness_table [concrete]
  672. // CHECK:STDOUT: %pattern_type.515: type = pattern_type %struct_type.d [concrete]
  673. // CHECK:STDOUT: %struct_type.d.as.Instance1.impl.G1.type: type = fn_type @struct_type.d.as.Instance1.impl.G1 [concrete]
  674. // CHECK:STDOUT: %struct_type.d.as.Instance1.impl.G1: %struct_type.d.as.Instance1.impl.G1.type = struct_value () [concrete]
  675. // CHECK:STDOUT: %Instance1.facet: %Instance1.type = facet_value %struct_type.d, (%Instance1.impl_witness) [concrete]
  676. // CHECK:STDOUT: %InstanceCall.type: type = fn_type @InstanceCall [concrete]
  677. // CHECK:STDOUT: %InstanceCall: %InstanceCall.type = struct_value () [concrete]
  678. // CHECK:STDOUT: %.e61: type = fn_type_with_self_type %Instance1.G1.type, %Instance1.facet [concrete]
  679. // CHECK:STDOUT: %ptr: type = ptr_type %struct_type.d [concrete]
  680. // CHECK:STDOUT: %pattern_type.8d6: type = pattern_type %ptr [concrete]
  681. // CHECK:STDOUT: %InstanceCallIndirect.type: type = fn_type @InstanceCallIndirect [concrete]
  682. // CHECK:STDOUT: %InstanceCallIndirect: %InstanceCallIndirect.type = struct_value () [concrete]
  683. // CHECK:STDOUT: %struct: %struct_type.d = struct_value (%empty_tuple) [concrete]
  684. // CHECK:STDOUT: }
  685. // CHECK:STDOUT:
  686. // CHECK:STDOUT: file {
  687. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  688. // CHECK:STDOUT: .Instance1 = %Instance1.decl
  689. // CHECK:STDOUT: .InstanceCall = %InstanceCall.decl
  690. // CHECK:STDOUT: .InstanceCallIndirect = %InstanceCallIndirect.decl
  691. // CHECK:STDOUT: }
  692. // CHECK:STDOUT: %Instance1.decl: type = interface_decl @Instance1 [concrete = constants.%Instance1.type] {} {}
  693. // CHECK:STDOUT: impl_decl @struct_type.d.as.Instance1.impl [concrete] {} {
  694. // CHECK:STDOUT: %.loc7_12.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  695. // CHECK:STDOUT: %.loc7_12.2: type = converted %.loc7_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  696. // CHECK:STDOUT: %struct_type.d: type = struct_type {.d: %empty_tuple.type} [concrete = constants.%struct_type.d]
  697. // CHECK:STDOUT: %Instance1.ref: type = name_ref Instance1, file.%Instance1.decl [concrete = constants.%Instance1.type]
  698. // CHECK:STDOUT: }
  699. // CHECK:STDOUT: %Instance1.impl_witness_table = impl_witness_table (@struct_type.d.as.Instance1.impl.%struct_type.d.as.Instance1.impl.G1.decl), @struct_type.d.as.Instance1.impl [concrete]
  700. // CHECK:STDOUT: %Instance1.impl_witness: <witness> = impl_witness %Instance1.impl_witness_table [concrete = constants.%Instance1.impl_witness]
  701. // CHECK:STDOUT: %InstanceCall.decl: %InstanceCall.type = fn_decl @InstanceCall [concrete = constants.%InstanceCall] {
  702. // CHECK:STDOUT: %n.patt: %pattern_type.515 = value_binding_pattern n [concrete]
  703. // CHECK:STDOUT: %n.param_patt: %pattern_type.515 = value_param_pattern %n.patt, call_param0 [concrete]
  704. // CHECK:STDOUT: } {
  705. // CHECK:STDOUT: %n.param: %struct_type.d = value_param call_param0
  706. // CHECK:STDOUT: %.loc11_27: type = splice_block %struct_type.d [concrete = constants.%struct_type.d] {
  707. // CHECK:STDOUT: %.loc11_26.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  708. // CHECK:STDOUT: %.loc11_26.2: type = converted %.loc11_26.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  709. // CHECK:STDOUT: %struct_type.d: type = struct_type {.d: %empty_tuple.type} [concrete = constants.%struct_type.d]
  710. // CHECK:STDOUT: }
  711. // CHECK:STDOUT: %n: %struct_type.d = value_binding n, %n.param
  712. // CHECK:STDOUT: }
  713. // CHECK:STDOUT: %InstanceCallIndirect.decl: %InstanceCallIndirect.type = fn_decl @InstanceCallIndirect [concrete = constants.%InstanceCallIndirect] {
  714. // CHECK:STDOUT: %p.patt: %pattern_type.8d6 = value_binding_pattern p [concrete]
  715. // CHECK:STDOUT: %p.param_patt: %pattern_type.8d6 = value_param_pattern %p.patt, call_param0 [concrete]
  716. // CHECK:STDOUT: } {
  717. // CHECK:STDOUT: %p.param: %ptr = value_param call_param0
  718. // CHECK:STDOUT: %.loc15_36: type = splice_block %ptr [concrete = constants.%ptr] {
  719. // CHECK:STDOUT: %.loc15_34.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  720. // CHECK:STDOUT: %.loc15_34.2: type = converted %.loc15_34.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  721. // CHECK:STDOUT: %struct_type.d: type = struct_type {.d: %empty_tuple.type} [concrete = constants.%struct_type.d]
  722. // CHECK:STDOUT: %ptr: type = ptr_type %struct_type.d [concrete = constants.%ptr]
  723. // CHECK:STDOUT: }
  724. // CHECK:STDOUT: %p: %ptr = value_binding p, %p.param
  725. // CHECK:STDOUT: }
  726. // CHECK:STDOUT: }
  727. // CHECK:STDOUT:
  728. // CHECK:STDOUT: interface @Instance1 {
  729. // CHECK:STDOUT: %Self: %Instance1.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  730. // CHECK:STDOUT: %Instance1.G1.decl: %Instance1.G1.type = fn_decl @Instance1.G1 [concrete = constants.%Instance1.G1] {
  731. // CHECK:STDOUT: %self.patt: @Instance1.G1.%pattern_type (%pattern_type.19d) = value_binding_pattern self [concrete]
  732. // CHECK:STDOUT: %self.param_patt: @Instance1.G1.%pattern_type (%pattern_type.19d) = value_param_pattern %self.patt, call_param0 [concrete]
  733. // CHECK:STDOUT: } {
  734. // CHECK:STDOUT: %self.param: @Instance1.G1.%Self.binding.as_type (%Self.binding.as_type) = value_param call_param0
  735. // CHECK:STDOUT: %.loc4_15.1: type = splice_block %.loc4_15.2 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] {
  736. // CHECK:STDOUT: %Self.ref: %Instance1.type = name_ref Self, @Instance1.%Self [symbolic = %Self (constants.%Self)]
  737. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.ref [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  738. // CHECK:STDOUT: %.loc4_15.2: type = converted %Self.ref, %Self.as_type [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  739. // CHECK:STDOUT: }
  740. // CHECK:STDOUT: %self: @Instance1.G1.%Self.binding.as_type (%Self.binding.as_type) = value_binding self, %self.param
  741. // CHECK:STDOUT: }
  742. // CHECK:STDOUT: %assoc0: %Instance1.assoc_type = assoc_entity element0, %Instance1.G1.decl [concrete = constants.%assoc0]
  743. // CHECK:STDOUT:
  744. // CHECK:STDOUT: !members:
  745. // CHECK:STDOUT: .Self = %Self
  746. // CHECK:STDOUT: .G1 = %assoc0
  747. // CHECK:STDOUT: witness = (%Instance1.G1.decl)
  748. // CHECK:STDOUT:
  749. // CHECK:STDOUT: !requires:
  750. // CHECK:STDOUT: }
  751. // CHECK:STDOUT:
  752. // CHECK:STDOUT: impl @struct_type.d.as.Instance1.impl: %struct_type.d as %Instance1.ref {
  753. // 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] {
  754. // CHECK:STDOUT: %self.patt: %pattern_type.515 = value_binding_pattern self [concrete]
  755. // CHECK:STDOUT: %self.param_patt: %pattern_type.515 = value_param_pattern %self.patt, call_param0 [concrete]
  756. // CHECK:STDOUT: } {
  757. // CHECK:STDOUT: %self.param: %struct_type.d = value_param call_param0
  758. // CHECK:STDOUT: %Self.ref: type = name_ref Self, @struct_type.d.as.Instance1.impl.%struct_type.d [concrete = constants.%struct_type.d]
  759. // CHECK:STDOUT: %self: %struct_type.d = value_binding self, %self.param
  760. // CHECK:STDOUT: }
  761. // CHECK:STDOUT:
  762. // CHECK:STDOUT: !members:
  763. // CHECK:STDOUT: .G1 = %struct_type.d.as.Instance1.impl.G1.decl
  764. // CHECK:STDOUT: witness = file.%Instance1.impl_witness
  765. // CHECK:STDOUT: }
  766. // CHECK:STDOUT:
  767. // CHECK:STDOUT: generic fn @Instance1.G1(@Instance1.%Self: %Instance1.type) {
  768. // CHECK:STDOUT: %Self: %Instance1.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self)]
  769. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  770. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type (constants.%pattern_type.19d)]
  771. // CHECK:STDOUT:
  772. // CHECK:STDOUT: fn(%self.param: @Instance1.G1.%Self.binding.as_type (%Self.binding.as_type));
  773. // CHECK:STDOUT: }
  774. // CHECK:STDOUT:
  775. // CHECK:STDOUT: fn @struct_type.d.as.Instance1.impl.G1(%self.param: %struct_type.d) {
  776. // CHECK:STDOUT: !entry:
  777. // CHECK:STDOUT: return
  778. // CHECK:STDOUT: }
  779. // CHECK:STDOUT:
  780. // CHECK:STDOUT: fn @InstanceCall(%n.param: %struct_type.d) {
  781. // CHECK:STDOUT: !entry:
  782. // CHECK:STDOUT: %n.ref: %struct_type.d = name_ref n, %n
  783. // CHECK:STDOUT: %Instance1.ref: type = name_ref Instance1, file.%Instance1.decl [concrete = constants.%Instance1.type]
  784. // CHECK:STDOUT: %G1.ref: %Instance1.assoc_type = name_ref G1, @Instance1.%assoc0 [concrete = constants.%assoc0]
  785. // CHECK:STDOUT: %impl.elem0: %.e61 = impl_witness_access constants.%Instance1.impl_witness, element0 [concrete = constants.%struct_type.d.as.Instance1.impl.G1]
  786. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %n.ref, %impl.elem0
  787. // CHECK:STDOUT: %struct_type.d.as.Instance1.impl.G1.call: init %empty_tuple.type = call %bound_method(%n.ref)
  788. // CHECK:STDOUT: return
  789. // CHECK:STDOUT: }
  790. // CHECK:STDOUT:
  791. // CHECK:STDOUT: fn @InstanceCallIndirect(%p.param: %ptr) {
  792. // CHECK:STDOUT: !entry:
  793. // CHECK:STDOUT: %p.ref: %ptr = name_ref p, %p
  794. // CHECK:STDOUT: %Instance1.ref: type = name_ref Instance1, file.%Instance1.decl [concrete = constants.%Instance1.type]
  795. // CHECK:STDOUT: %G1.ref: %Instance1.assoc_type = name_ref G1, @Instance1.%assoc0 [concrete = constants.%assoc0]
  796. // CHECK:STDOUT: %.loc16_4.1: ref %struct_type.d = deref %p.ref
  797. // CHECK:STDOUT: %impl.elem0: %.e61 = impl_witness_access constants.%Instance1.impl_witness, element0 [concrete = constants.%struct_type.d.as.Instance1.impl.G1]
  798. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %.loc16_4.1, %impl.elem0
  799. // CHECK:STDOUT: %.loc16_4.2: ref %empty_tuple.type = struct_access %.loc16_4.1, element0
  800. // CHECK:STDOUT: %tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple]
  801. // CHECK:STDOUT: %.loc16_4.3: %empty_tuple.type = converted %.loc16_4.2, %tuple [concrete = constants.%empty_tuple]
  802. // CHECK:STDOUT: %struct: %struct_type.d = struct_value (%.loc16_4.3) [concrete = constants.%struct]
  803. // CHECK:STDOUT: %.loc16_4.4: %struct_type.d = converted %.loc16_4.1, %struct [concrete = constants.%struct]
  804. // CHECK:STDOUT: %struct_type.d.as.Instance1.impl.G1.call: init %empty_tuple.type = call %bound_method(%.loc16_4.4)
  805. // CHECK:STDOUT: return
  806. // CHECK:STDOUT: }
  807. // CHECK:STDOUT:
  808. // CHECK:STDOUT: specific @Instance1.G1(constants.%Self) {
  809. // CHECK:STDOUT: %Self => constants.%Self
  810. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  811. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.19d
  812. // CHECK:STDOUT: }
  813. // CHECK:STDOUT:
  814. // CHECK:STDOUT: specific @Instance1.G1(constants.%Instance1.facet) {
  815. // CHECK:STDOUT: %Self => constants.%Instance1.facet
  816. // CHECK:STDOUT: %Self.binding.as_type => constants.%struct_type.d
  817. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.515
  818. // CHECK:STDOUT: }
  819. // CHECK:STDOUT:
  820. // CHECK:STDOUT: --- fail_instance.carbon
  821. // CHECK:STDOUT:
  822. // CHECK:STDOUT: constants {
  823. // CHECK:STDOUT: %Instance2.type: type = facet_type <@Instance2> [concrete]
  824. // CHECK:STDOUT: %Self: %Instance2.type = symbolic_binding Self, 0 [symbolic]
  825. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic]
  826. // CHECK:STDOUT: %pattern_type.e9c: type = pattern_type %Self.binding.as_type [symbolic]
  827. // CHECK:STDOUT: %Instance2.G2.type: type = fn_type @Instance2.G2 [concrete]
  828. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  829. // CHECK:STDOUT: %Instance2.G2: %Instance2.G2.type = struct_value () [concrete]
  830. // CHECK:STDOUT: %Instance2.assoc_type: type = assoc_entity_type @Instance2 [concrete]
  831. // CHECK:STDOUT: %assoc0: %Instance2.assoc_type = assoc_entity element0, @Instance2.%Instance2.G2.decl [concrete]
  832. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  833. // CHECK:STDOUT: %struct_type.e: type = struct_type {.e: %empty_tuple.type} [concrete]
  834. // CHECK:STDOUT: %Instance2.impl_witness: <witness> = impl_witness file.%Instance2.impl_witness_table [concrete]
  835. // CHECK:STDOUT: %pattern_type.efd: type = pattern_type %struct_type.e [concrete]
  836. // CHECK:STDOUT: %struct_type.e.as.Instance2.impl.G2.type: type = fn_type @struct_type.e.as.Instance2.impl.G2 [concrete]
  837. // CHECK:STDOUT: %struct_type.e.as.Instance2.impl.G2: %struct_type.e.as.Instance2.impl.G2.type = struct_value () [concrete]
  838. // CHECK:STDOUT: %Instance2.facet: %Instance2.type = facet_value %struct_type.e, (%Instance2.impl_witness) [concrete]
  839. // CHECK:STDOUT: %InstanceCallFail.type: type = fn_type @InstanceCallFail [concrete]
  840. // CHECK:STDOUT: %InstanceCallFail: %InstanceCallFail.type = struct_value () [concrete]
  841. // CHECK:STDOUT: }
  842. // CHECK:STDOUT:
  843. // CHECK:STDOUT: file {
  844. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  845. // CHECK:STDOUT: .Instance2 = %Instance2.decl
  846. // CHECK:STDOUT: .InstanceCallFail = %InstanceCallFail.decl
  847. // CHECK:STDOUT: }
  848. // CHECK:STDOUT: %Instance2.decl: type = interface_decl @Instance2 [concrete = constants.%Instance2.type] {} {}
  849. // CHECK:STDOUT: impl_decl @struct_type.e.as.Instance2.impl [concrete] {} {
  850. // CHECK:STDOUT: %.loc7_12.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  851. // CHECK:STDOUT: %.loc7_12.2: type = converted %.loc7_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  852. // CHECK:STDOUT: %struct_type.e: type = struct_type {.e: %empty_tuple.type} [concrete = constants.%struct_type.e]
  853. // CHECK:STDOUT: %Instance2.ref: type = name_ref Instance2, file.%Instance2.decl [concrete = constants.%Instance2.type]
  854. // CHECK:STDOUT: }
  855. // CHECK:STDOUT: %Instance2.impl_witness_table = impl_witness_table (@struct_type.e.as.Instance2.impl.%struct_type.e.as.Instance2.impl.G2.decl), @struct_type.e.as.Instance2.impl [concrete]
  856. // CHECK:STDOUT: %Instance2.impl_witness: <witness> = impl_witness %Instance2.impl_witness_table [concrete = constants.%Instance2.impl_witness]
  857. // CHECK:STDOUT: %InstanceCallFail.decl: %InstanceCallFail.type = fn_decl @InstanceCallFail [concrete = constants.%InstanceCallFail] {} {}
  858. // CHECK:STDOUT: }
  859. // CHECK:STDOUT:
  860. // CHECK:STDOUT: interface @Instance2 {
  861. // CHECK:STDOUT: %Self: %Instance2.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  862. // CHECK:STDOUT: %Instance2.G2.decl: %Instance2.G2.type = fn_decl @Instance2.G2 [concrete = constants.%Instance2.G2] {
  863. // CHECK:STDOUT: %self.patt: @Instance2.G2.%pattern_type (%pattern_type.e9c) = value_binding_pattern self [concrete]
  864. // CHECK:STDOUT: %self.param_patt: @Instance2.G2.%pattern_type (%pattern_type.e9c) = value_param_pattern %self.patt, call_param0 [concrete]
  865. // CHECK:STDOUT: } {
  866. // CHECK:STDOUT: %self.param: @Instance2.G2.%Self.binding.as_type (%Self.binding.as_type) = value_param call_param0
  867. // CHECK:STDOUT: %.loc4_15.1: type = splice_block %.loc4_15.2 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] {
  868. // CHECK:STDOUT: %Self.ref: %Instance2.type = name_ref Self, @Instance2.%Self [symbolic = %Self (constants.%Self)]
  869. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.ref [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  870. // CHECK:STDOUT: %.loc4_15.2: type = converted %Self.ref, %Self.as_type [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  871. // CHECK:STDOUT: }
  872. // CHECK:STDOUT: %self: @Instance2.G2.%Self.binding.as_type (%Self.binding.as_type) = value_binding self, %self.param
  873. // CHECK:STDOUT: }
  874. // CHECK:STDOUT: %assoc0: %Instance2.assoc_type = assoc_entity element0, %Instance2.G2.decl [concrete = constants.%assoc0]
  875. // CHECK:STDOUT:
  876. // CHECK:STDOUT: !members:
  877. // CHECK:STDOUT: .Self = %Self
  878. // CHECK:STDOUT: .G2 = %assoc0
  879. // CHECK:STDOUT: witness = (%Instance2.G2.decl)
  880. // CHECK:STDOUT:
  881. // CHECK:STDOUT: !requires:
  882. // CHECK:STDOUT: }
  883. // CHECK:STDOUT:
  884. // CHECK:STDOUT: impl @struct_type.e.as.Instance2.impl: %struct_type.e as %Instance2.ref {
  885. // 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] {
  886. // CHECK:STDOUT: %self.patt: %pattern_type.efd = value_binding_pattern self [concrete]
  887. // CHECK:STDOUT: %self.param_patt: %pattern_type.efd = value_param_pattern %self.patt, call_param0 [concrete]
  888. // CHECK:STDOUT: } {
  889. // CHECK:STDOUT: %self.param: %struct_type.e = value_param call_param0
  890. // CHECK:STDOUT: %Self.ref: type = name_ref Self, @struct_type.e.as.Instance2.impl.%struct_type.e [concrete = constants.%struct_type.e]
  891. // CHECK:STDOUT: %self: %struct_type.e = value_binding self, %self.param
  892. // CHECK:STDOUT: }
  893. // CHECK:STDOUT:
  894. // CHECK:STDOUT: !members:
  895. // CHECK:STDOUT: .G2 = %struct_type.e.as.Instance2.impl.G2.decl
  896. // CHECK:STDOUT: witness = file.%Instance2.impl_witness
  897. // CHECK:STDOUT: }
  898. // CHECK:STDOUT:
  899. // CHECK:STDOUT: generic fn @Instance2.G2(@Instance2.%Self: %Instance2.type) {
  900. // CHECK:STDOUT: %Self: %Instance2.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self)]
  901. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  902. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type (constants.%pattern_type.e9c)]
  903. // CHECK:STDOUT:
  904. // CHECK:STDOUT: fn(%self.param: @Instance2.G2.%Self.binding.as_type (%Self.binding.as_type));
  905. // CHECK:STDOUT: }
  906. // CHECK:STDOUT:
  907. // CHECK:STDOUT: fn @struct_type.e.as.Instance2.impl.G2(%self.param: %struct_type.e) {
  908. // CHECK:STDOUT: !entry:
  909. // CHECK:STDOUT: return
  910. // CHECK:STDOUT: }
  911. // CHECK:STDOUT:
  912. // CHECK:STDOUT: fn @InstanceCallFail() {
  913. // CHECK:STDOUT: !entry:
  914. // CHECK:STDOUT: %.loc16_9.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  915. // CHECK:STDOUT: %.loc16_9.2: type = converted %.loc16_9.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  916. // CHECK:STDOUT: %struct_type.e: type = struct_type {.e: %empty_tuple.type} [concrete = constants.%struct_type.e]
  917. // CHECK:STDOUT: %Instance2.ref: type = name_ref Instance2, file.%Instance2.decl [concrete = constants.%Instance2.type]
  918. // CHECK:STDOUT: %G2.ref: %Instance2.assoc_type = name_ref G2, @Instance2.%assoc0 [concrete = constants.%assoc0]
  919. // CHECK:STDOUT: return
  920. // CHECK:STDOUT: }
  921. // CHECK:STDOUT:
  922. // CHECK:STDOUT: specific @Instance2.G2(constants.%Self) {
  923. // CHECK:STDOUT: %Self => constants.%Self
  924. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  925. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.e9c
  926. // CHECK:STDOUT: }
  927. // CHECK:STDOUT:
  928. // CHECK:STDOUT: specific @Instance2.G2(constants.%Instance2.facet) {
  929. // CHECK:STDOUT: %Self => constants.%Instance2.facet
  930. // CHECK:STDOUT: %Self.binding.as_type => constants.%struct_type.e
  931. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.efd
  932. // CHECK:STDOUT: }
  933. // CHECK:STDOUT: