assoc_const_self.carbon 58 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869
  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/int.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/assoc_const_self.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/assoc_const_self.carbon
  14. // --- assoc_const_self.carbon
  15. library "[[@TEST_NAME]]";
  16. interface I {
  17. let V:! Self;
  18. }
  19. impl {} as I where .V = {} {}
  20. impl i32 as I where .V = 0 {}
  21. // --- fail_assoc_const_mismatch.carbon
  22. library "[[@TEST_NAME]]";
  23. interface I {
  24. let V:! Self;
  25. }
  26. // CHECK:STDERR: fail_assoc_const_mismatch.carbon:[[@LINE+7]]:12: error: cannot implicitly convert expression of type `Core.IntLiteral` to `{}` [ConversionFailure]
  27. // CHECK:STDERR: impl {} as I where .V = 0 {}
  28. // CHECK:STDERR: ^~~~~~~~~~~~~~
  29. // CHECK:STDERR: fail_assoc_const_mismatch.carbon:[[@LINE+4]]:12: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs({})` [MissingImplInMemberAccessNote]
  30. // CHECK:STDERR: impl {} as I where .V = 0 {}
  31. // CHECK:STDERR: ^~~~~~~~~~~~~~
  32. // CHECK:STDERR:
  33. impl {} as I where .V = 0 {}
  34. // --- fail_assoc_const_not_constant_after_conversion.carbon
  35. library "[[@TEST_NAME]]";
  36. interface I {
  37. let V:! Self;
  38. }
  39. class C {}
  40. impl () as Core.ImplicitAs(C) {
  41. fn Convert[self: ()]() -> C { return {}; }
  42. }
  43. // CHECK:STDERR: fail_assoc_const_not_constant_after_conversion.carbon:[[@LINE+4]]:11: error: associated constant V given value `()` that is not constant after conversion to `C` [AssociatedConstantNotConstantAfterConversion]
  44. // CHECK:STDERR: impl C as I where .V = () {}
  45. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  46. // CHECK:STDERR:
  47. impl C as I where .V = () {}
  48. // --- fail_monomorphization_failure.carbon
  49. library "[[@TEST_NAME]]";
  50. interface I(N:! Core.IntLiteral()) {
  51. // CHECK:STDERR: fail_monomorphization_failure.carbon:[[@LINE+3]]:17: error: array bound of -1 is negative [ArrayBoundNegative]
  52. // CHECK:STDERR: let V:! array(Self, N);
  53. // CHECK:STDERR: ^~~~
  54. let V:! array(Self, N);
  55. }
  56. // CHECK:STDERR: fail_monomorphization_failure.carbon:[[@LINE+4]]:24: note: in `V` used here [ResolvingSpecificHere]
  57. // CHECK:STDERR: impl {} as I(-1) where .V = () {}
  58. // CHECK:STDERR: ^~
  59. // CHECK:STDERR:
  60. impl {} as I(-1) where .V = () {}
  61. // --- fail_todo_constrained_fn.carbon
  62. library "[[@TEST_NAME]]";
  63. interface I {
  64. let V:! Self;
  65. }
  66. fn F(T:! I where {} impls Core.ImplicitAs(.Self) and .V = {});
  67. fn CallF() {
  68. // TODO: This call should eventually work.
  69. // CHECK:STDERR: fail_todo_constrained_fn.carbon:[[@LINE+7]]:3: error: cannot convert type `{}` into type implementing `I where .(I.V) = {} and...` [ConversionFailureTypeToFacet]
  70. // CHECK:STDERR: F({});
  71. // CHECK:STDERR: ^~~~~
  72. // CHECK:STDERR: fail_todo_constrained_fn.carbon:[[@LINE-7]]:6: note: initializing generic parameter `T` declared here [InitializingGenericParam]
  73. // CHECK:STDERR: fn F(T:! I where {} impls Core.ImplicitAs(.Self) and .V = {});
  74. // CHECK:STDERR: ^
  75. // CHECK:STDERR:
  76. F({});
  77. }
  78. // CHECK:STDOUT: --- assoc_const_self.carbon
  79. // CHECK:STDOUT:
  80. // CHECK:STDOUT: constants {
  81. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  82. // CHECK:STDOUT: %Self.9f2: %I.type = symbolic_binding Self, 0 [symbolic]
  83. // CHECK:STDOUT: %Self.binding.as_type.bcb: type = symbolic_binding_type Self, 0, %Self.9f2 [symbolic]
  84. // CHECK:STDOUT: %require_complete.e1b: <witness> = require_complete_type %Self.binding.as_type.bcb [symbolic]
  85. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  86. // CHECK:STDOUT: %assoc0.1aa: %I.assoc_type = assoc_entity element0, @I.%V [concrete]
  87. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  88. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  89. // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self]
  90. // CHECK:STDOUT: %.Self.binding.as_type: type = symbolic_binding_type .Self, %.Self [symbolic_self]
  91. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %.Self, @I [symbolic_self]
  92. // CHECK:STDOUT: %require_complete.d2d: <witness> = require_complete_type %.Self.binding.as_type [symbolic_self]
  93. // CHECK:STDOUT: %impl.elem0: %.Self.binding.as_type = impl_witness_access %I.lookup_impl_witness, element0 [symbolic_self]
  94. // CHECK:STDOUT: %I_where.type.df2: type = facet_type <@I where %impl.elem0 = %empty_struct> [concrete]
  95. // CHECK:STDOUT: %I.impl_witness.0bd: <witness> = impl_witness file.%I.impl_witness_table.loc8 [concrete]
  96. // CHECK:STDOUT: %I.facet.c9b: %I.type = facet_value %empty_struct_type, (%I.impl_witness.0bd) [concrete]
  97. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  98. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  99. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  100. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  101. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  102. // CHECK:STDOUT: %int_0.5c6: Core.IntLiteral = int_value 0 [concrete]
  103. // CHECK:STDOUT: %I_where.type.e54: type = facet_type <@I where %impl.elem0 = %int_0.5c6> [concrete]
  104. // CHECK:STDOUT: %I.impl_witness.bdd: <witness> = impl_witness file.%I.impl_witness_table.loc10 [concrete]
  105. // CHECK:STDOUT: %I.facet.5dc: %I.type = facet_value %i32, (%I.impl_witness.bdd) [concrete]
  106. // CHECK:STDOUT: %i32.builtin: type = int_type signed, %int_32 [concrete]
  107. // CHECK:STDOUT: %complete_type.f8a: <witness> = complete_type_witness %i32.builtin [concrete]
  108. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  109. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  110. // CHECK:STDOUT: %ImplicitAs.type.d14: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  111. // CHECK:STDOUT: %ImplicitAs.Convert.type.1b6: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%i32) [concrete]
  112. // CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
  113. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.f51: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%To) [symbolic]
  114. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.2a1: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.f51 = struct_value () [symbolic]
  115. // CHECK:STDOUT: %ImplicitAs.impl_witness.bc9: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.132, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  116. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.51e: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  117. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.51e = struct_value () [concrete]
  118. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.d14 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.bc9) [concrete]
  119. // CHECK:STDOUT: %.322: type = fn_type_with_self_type %ImplicitAs.Convert.type.1b6, %ImplicitAs.facet [concrete]
  120. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound: <bound method> = bound_method %int_0.5c6, %Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b [concrete]
  121. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b, @Core.IntLiteral.as.ImplicitAs.impl.Convert(%int_32) [concrete]
  122. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_0.5c6, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
  123. // CHECK:STDOUT: %int_0.6a9: %i32 = int_value 0 [concrete]
  124. // CHECK:STDOUT: }
  125. // CHECK:STDOUT:
  126. // CHECK:STDOUT: imports {
  127. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  128. // CHECK:STDOUT: .Int = %Core.Int
  129. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  130. // CHECK:STDOUT: import Core//prelude
  131. // CHECK:STDOUT: import Core//prelude/...
  132. // CHECK:STDOUT: }
  133. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  134. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  135. // CHECK:STDOUT: %Core.import_ref.e24: @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert.type (%Core.IntLiteral.as.ImplicitAs.impl.Convert.type.f51) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert (constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.2a1)]
  136. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.132 = impl_witness_table (%Core.import_ref.e24), @Core.IntLiteral.as.ImplicitAs.impl [concrete]
  137. // CHECK:STDOUT: }
  138. // CHECK:STDOUT:
  139. // CHECK:STDOUT: file {
  140. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  141. // CHECK:STDOUT: .Core = imports.%Core
  142. // CHECK:STDOUT: .I = %I.decl
  143. // CHECK:STDOUT: }
  144. // CHECK:STDOUT: %Core.import = import Core
  145. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  146. // CHECK:STDOUT: impl_decl @empty_struct_type.as.I.impl [concrete] {} {
  147. // CHECK:STDOUT: %.loc8_7.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  148. // CHECK:STDOUT: %.loc8_7.2: type = converted %.loc8_7.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  149. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  150. // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  151. // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  152. // CHECK:STDOUT: %V.ref: %I.assoc_type = name_ref V, @V.%assoc0 [concrete = constants.%assoc0.1aa]
  153. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.binding.as_type]
  154. // CHECK:STDOUT: %.loc8_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.binding.as_type]
  155. // CHECK:STDOUT: %impl.elem0: %.Self.binding.as_type = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  156. // CHECK:STDOUT: %.loc8_26.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  157. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete = constants.%empty_struct]
  158. // CHECK:STDOUT: %.loc8_26.2: %empty_struct_type = converted %.loc8_26.1, %empty_struct [concrete = constants.%empty_struct]
  159. // CHECK:STDOUT: %.loc8_14: type = where_expr %.Self [concrete = constants.%I_where.type.df2] {
  160. // CHECK:STDOUT: requirement_base_facet_type constants.%I.type
  161. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc8_26.2
  162. // CHECK:STDOUT: }
  163. // CHECK:STDOUT: }
  164. // CHECK:STDOUT: %I.impl_witness_table.loc8 = impl_witness_table (%impl_witness_assoc_constant.loc8), @empty_struct_type.as.I.impl [concrete]
  165. // CHECK:STDOUT: %I.impl_witness.loc8: <witness> = impl_witness %I.impl_witness_table.loc8 [concrete = constants.%I.impl_witness.0bd]
  166. // CHECK:STDOUT: %impl_witness_assoc_constant.loc8: %empty_struct_type = impl_witness_assoc_constant constants.%empty_struct [concrete = constants.%empty_struct]
  167. // CHECK:STDOUT: impl_decl @i32.as.I.impl [concrete] {} {
  168. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  169. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  170. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  171. // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  172. // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  173. // CHECK:STDOUT: %V.ref: %I.assoc_type = name_ref V, @V.%assoc0 [concrete = constants.%assoc0.1aa]
  174. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.binding.as_type]
  175. // CHECK:STDOUT: %.loc10_21: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.binding.as_type]
  176. // CHECK:STDOUT: %impl.elem0: %.Self.binding.as_type = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  177. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
  178. // CHECK:STDOUT: %.loc10_15: type = where_expr %.Self [concrete = constants.%I_where.type.e54] {
  179. // CHECK:STDOUT: requirement_base_facet_type constants.%I.type
  180. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %int_0
  181. // CHECK:STDOUT: }
  182. // CHECK:STDOUT: }
  183. // CHECK:STDOUT: %I.impl_witness_table.loc10 = impl_witness_table (%impl_witness_assoc_constant.loc10), @i32.as.I.impl [concrete]
  184. // CHECK:STDOUT: %I.impl_witness.loc10: <witness> = impl_witness %I.impl_witness_table.loc10 [concrete = constants.%I.impl_witness.bdd]
  185. // CHECK:STDOUT: %impl.elem0: %.322 = impl_witness_access constants.%ImplicitAs.impl_witness.bc9, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b]
  186. // CHECK:STDOUT: %bound_method.loc10_15.1: <bound method> = bound_method constants.%int_0.5c6, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
  187. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  188. // CHECK:STDOUT: %bound_method.loc10_15.2: <bound method> = bound_method constants.%int_0.5c6, %specific_fn [concrete = constants.%bound_method]
  189. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc10_15.2(constants.%int_0.5c6) [concrete = constants.%int_0.6a9]
  190. // CHECK:STDOUT: %.loc10_15.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_0.6a9]
  191. // CHECK:STDOUT: %.loc10_15.2: %i32 = converted constants.%int_0.5c6, %.loc10_15.1 [concrete = constants.%int_0.6a9]
  192. // CHECK:STDOUT: %impl_witness_assoc_constant.loc10: %i32 = impl_witness_assoc_constant constants.%int_0.6a9 [concrete = constants.%int_0.6a9]
  193. // CHECK:STDOUT: }
  194. // CHECK:STDOUT:
  195. // CHECK:STDOUT: interface @I {
  196. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = constants.%Self.9f2]
  197. // CHECK:STDOUT: %V: @V.%Self.binding.as_type (%Self.binding.as_type.bcb) = assoc_const_decl @V [concrete] {
  198. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%V [concrete = constants.%assoc0.1aa]
  199. // CHECK:STDOUT: }
  200. // CHECK:STDOUT:
  201. // CHECK:STDOUT: !members:
  202. // CHECK:STDOUT: .Self = %Self
  203. // CHECK:STDOUT: .V = @V.%assoc0
  204. // CHECK:STDOUT: witness = (%V)
  205. // CHECK:STDOUT:
  206. // CHECK:STDOUT: !requires:
  207. // CHECK:STDOUT: }
  208. // CHECK:STDOUT:
  209. // CHECK:STDOUT: generic assoc_const @V(@I.%Self: %I.type) {
  210. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.9f2)]
  211. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.bcb)]
  212. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %Self.binding.as_type [symbolic = %require_complete (constants.%require_complete.e1b)]
  213. // CHECK:STDOUT:
  214. // CHECK:STDOUT: assoc_const V:! @V.%Self.binding.as_type (%Self.binding.as_type.bcb);
  215. // CHECK:STDOUT: }
  216. // CHECK:STDOUT:
  217. // CHECK:STDOUT: impl @empty_struct_type.as.I.impl: %.loc8_7.2 as %.loc8_14 {
  218. // CHECK:STDOUT: !members:
  219. // CHECK:STDOUT: witness = file.%I.impl_witness.loc8
  220. // CHECK:STDOUT: }
  221. // CHECK:STDOUT:
  222. // CHECK:STDOUT: impl @i32.as.I.impl: %i32 as %.loc10_15 {
  223. // CHECK:STDOUT: !members:
  224. // CHECK:STDOUT: witness = file.%I.impl_witness.loc10
  225. // CHECK:STDOUT: }
  226. // CHECK:STDOUT:
  227. // CHECK:STDOUT: specific @V(constants.%Self.9f2) {
  228. // CHECK:STDOUT: %Self => constants.%Self.9f2
  229. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type.bcb
  230. // CHECK:STDOUT: %require_complete => constants.%require_complete.e1b
  231. // CHECK:STDOUT: }
  232. // CHECK:STDOUT:
  233. // CHECK:STDOUT: specific @V(constants.%.Self) {
  234. // CHECK:STDOUT: %Self => constants.%.Self
  235. // CHECK:STDOUT: %Self.binding.as_type => constants.%.Self.binding.as_type
  236. // CHECK:STDOUT: %require_complete => constants.%require_complete.d2d
  237. // CHECK:STDOUT: }
  238. // CHECK:STDOUT:
  239. // CHECK:STDOUT: specific @V(constants.%I.facet.c9b) {
  240. // CHECK:STDOUT: %Self => constants.%I.facet.c9b
  241. // CHECK:STDOUT: %Self.binding.as_type => constants.%empty_struct_type
  242. // CHECK:STDOUT: %require_complete => constants.%complete_type.357
  243. // CHECK:STDOUT: }
  244. // CHECK:STDOUT:
  245. // CHECK:STDOUT: specific @V(constants.%I.facet.5dc) {
  246. // CHECK:STDOUT: %Self => constants.%I.facet.5dc
  247. // CHECK:STDOUT: %Self.binding.as_type => constants.%i32
  248. // CHECK:STDOUT: %require_complete => constants.%complete_type.f8a
  249. // CHECK:STDOUT: }
  250. // CHECK:STDOUT:
  251. // CHECK:STDOUT: --- fail_assoc_const_mismatch.carbon
  252. // CHECK:STDOUT:
  253. // CHECK:STDOUT: constants {
  254. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  255. // CHECK:STDOUT: %Self.9f2: %I.type = symbolic_binding Self, 0 [symbolic]
  256. // CHECK:STDOUT: %Self.binding.as_type.bcb: type = symbolic_binding_type Self, 0, %Self.9f2 [symbolic]
  257. // CHECK:STDOUT: %require_complete.e1b: <witness> = require_complete_type %Self.binding.as_type.bcb [symbolic]
  258. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  259. // CHECK:STDOUT: %assoc0.1aa: %I.assoc_type = assoc_entity element0, @I.%V [concrete]
  260. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  261. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  262. // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self]
  263. // CHECK:STDOUT: %.Self.binding.as_type: type = symbolic_binding_type .Self, %.Self [symbolic_self]
  264. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %.Self, @I [symbolic_self]
  265. // CHECK:STDOUT: %require_complete.d2d: <witness> = require_complete_type %.Self.binding.as_type [symbolic_self]
  266. // CHECK:STDOUT: %impl.elem0: %.Self.binding.as_type = impl_witness_access %I.lookup_impl_witness, element0 [symbolic_self]
  267. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete]
  268. // CHECK:STDOUT: %I_where.type: type = facet_type <@I where %impl.elem0 = %int_0> [concrete]
  269. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness file.%I.impl_witness_table [concrete]
  270. // CHECK:STDOUT: %I.facet: %I.type = facet_value %empty_struct_type, (%I.impl_witness) [concrete]
  271. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  272. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  273. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  274. // CHECK:STDOUT: }
  275. // CHECK:STDOUT:
  276. // CHECK:STDOUT: imports {
  277. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  278. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  279. // CHECK:STDOUT: import Core//prelude
  280. // CHECK:STDOUT: import Core//prelude/...
  281. // CHECK:STDOUT: }
  282. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  283. // CHECK:STDOUT: }
  284. // CHECK:STDOUT:
  285. // CHECK:STDOUT: file {
  286. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  287. // CHECK:STDOUT: .Core = imports.%Core
  288. // CHECK:STDOUT: .I = %I.decl
  289. // CHECK:STDOUT: }
  290. // CHECK:STDOUT: %Core.import = import Core
  291. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  292. // CHECK:STDOUT: impl_decl @empty_struct_type.as.I.impl [concrete] {} {
  293. // CHECK:STDOUT: %.loc15_7.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  294. // CHECK:STDOUT: %.loc15_7.2: type = converted %.loc15_7.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  295. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  296. // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  297. // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  298. // CHECK:STDOUT: %V.ref: %I.assoc_type = name_ref V, @V.%assoc0 [concrete = constants.%assoc0.1aa]
  299. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.binding.as_type]
  300. // CHECK:STDOUT: %.loc15_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.binding.as_type]
  301. // CHECK:STDOUT: %impl.elem0: %.Self.binding.as_type = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  302. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0]
  303. // CHECK:STDOUT: %.loc15_14: type = where_expr %.Self [concrete = constants.%I_where.type] {
  304. // CHECK:STDOUT: requirement_base_facet_type constants.%I.type
  305. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %int_0
  306. // CHECK:STDOUT: }
  307. // CHECK:STDOUT: }
  308. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%impl_witness_assoc_constant), @empty_struct_type.as.I.impl [concrete]
  309. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness]
  310. // CHECK:STDOUT: %.loc15: %empty_struct_type = converted constants.%int_0, <error> [concrete = <error>]
  311. // CHECK:STDOUT: %impl_witness_assoc_constant: <error> = impl_witness_assoc_constant <error> [concrete = <error>]
  312. // CHECK:STDOUT: }
  313. // CHECK:STDOUT:
  314. // CHECK:STDOUT: interface @I {
  315. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = constants.%Self.9f2]
  316. // CHECK:STDOUT: %V: @V.%Self.binding.as_type (%Self.binding.as_type.bcb) = assoc_const_decl @V [concrete] {
  317. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%V [concrete = constants.%assoc0.1aa]
  318. // CHECK:STDOUT: }
  319. // CHECK:STDOUT:
  320. // CHECK:STDOUT: !members:
  321. // CHECK:STDOUT: .Self = %Self
  322. // CHECK:STDOUT: .V = @V.%assoc0
  323. // CHECK:STDOUT: witness = (%V)
  324. // CHECK:STDOUT:
  325. // CHECK:STDOUT: !requires:
  326. // CHECK:STDOUT: }
  327. // CHECK:STDOUT:
  328. // CHECK:STDOUT: generic assoc_const @V(@I.%Self: %I.type) {
  329. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.9f2)]
  330. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.bcb)]
  331. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %Self.binding.as_type [symbolic = %require_complete (constants.%require_complete.e1b)]
  332. // CHECK:STDOUT:
  333. // CHECK:STDOUT: assoc_const V:! @V.%Self.binding.as_type (%Self.binding.as_type.bcb);
  334. // CHECK:STDOUT: }
  335. // CHECK:STDOUT:
  336. // CHECK:STDOUT: impl @empty_struct_type.as.I.impl: %.loc15_7.2 as %.loc15_14 {
  337. // CHECK:STDOUT: !members:
  338. // CHECK:STDOUT: witness = file.%I.impl_witness
  339. // CHECK:STDOUT: }
  340. // CHECK:STDOUT:
  341. // CHECK:STDOUT: specific @V(constants.%Self.9f2) {
  342. // CHECK:STDOUT: %Self => constants.%Self.9f2
  343. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type.bcb
  344. // CHECK:STDOUT: %require_complete => constants.%require_complete.e1b
  345. // CHECK:STDOUT: }
  346. // CHECK:STDOUT:
  347. // CHECK:STDOUT: specific @V(constants.%.Self) {
  348. // CHECK:STDOUT: %Self => constants.%.Self
  349. // CHECK:STDOUT: %Self.binding.as_type => constants.%.Self.binding.as_type
  350. // CHECK:STDOUT: %require_complete => constants.%require_complete.d2d
  351. // CHECK:STDOUT: }
  352. // CHECK:STDOUT:
  353. // CHECK:STDOUT: specific @V(constants.%I.facet) {
  354. // CHECK:STDOUT: %Self => constants.%I.facet
  355. // CHECK:STDOUT: %Self.binding.as_type => constants.%empty_struct_type
  356. // CHECK:STDOUT: %require_complete => constants.%complete_type
  357. // CHECK:STDOUT: }
  358. // CHECK:STDOUT:
  359. // CHECK:STDOUT: --- fail_assoc_const_not_constant_after_conversion.carbon
  360. // CHECK:STDOUT:
  361. // CHECK:STDOUT: constants {
  362. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  363. // CHECK:STDOUT: %Self.9f2: %I.type = symbolic_binding Self, 0 [symbolic]
  364. // CHECK:STDOUT: %Self.binding.as_type.bcb: type = symbolic_binding_type Self, 0, %Self.9f2 [symbolic]
  365. // CHECK:STDOUT: %require_complete.e1b: <witness> = require_complete_type %Self.binding.as_type.bcb [symbolic]
  366. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  367. // CHECK:STDOUT: %assoc0.1aa: %I.assoc_type = assoc_entity element0, @I.%V [concrete]
  368. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  369. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  370. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  371. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  372. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  373. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  374. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  375. // CHECK:STDOUT: %ImplicitAs.type.396: type = facet_type <@ImplicitAs, @ImplicitAs(%C)> [concrete]
  376. // CHECK:STDOUT: %ImplicitAs.Convert.type.56d: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%C) [concrete]
  377. // CHECK:STDOUT: %ImplicitAs.impl_witness: <witness> = impl_witness file.%ImplicitAs.impl_witness_table [concrete]
  378. // CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete]
  379. // CHECK:STDOUT: %pattern_type.c48: type = pattern_type %C [concrete]
  380. // CHECK:STDOUT: %empty_tuple.type.as.ImplicitAs.impl.Convert.type: type = fn_type @empty_tuple.type.as.ImplicitAs.impl.Convert [concrete]
  381. // CHECK:STDOUT: %empty_tuple.type.as.ImplicitAs.impl.Convert: %empty_tuple.type.as.ImplicitAs.impl.Convert.type = struct_value () [concrete]
  382. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.396 = facet_value %empty_tuple.type, (%ImplicitAs.impl_witness) [concrete]
  383. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  384. // CHECK:STDOUT: %C.val: %C = struct_value () [concrete]
  385. // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self]
  386. // CHECK:STDOUT: %.Self.binding.as_type: type = symbolic_binding_type .Self, %.Self [symbolic_self]
  387. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %.Self, @I [symbolic_self]
  388. // CHECK:STDOUT: %require_complete.d2d: <witness> = require_complete_type %.Self.binding.as_type [symbolic_self]
  389. // CHECK:STDOUT: %impl.elem0: %.Self.binding.as_type = impl_witness_access %I.lookup_impl_witness, element0 [symbolic_self]
  390. // CHECK:STDOUT: %I_where.type: type = facet_type <@I where %impl.elem0 = %empty_tuple> [concrete]
  391. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness file.%I.impl_witness_table [concrete]
  392. // CHECK:STDOUT: %I.facet: %I.type = facet_value %C, (%I.impl_witness) [concrete]
  393. // CHECK:STDOUT: %.77a: type = fn_type_with_self_type %ImplicitAs.Convert.type.56d, %ImplicitAs.facet [concrete]
  394. // CHECK:STDOUT: %empty_tuple.type.as.ImplicitAs.impl.Convert.bound: <bound method> = bound_method %empty_tuple, %empty_tuple.type.as.ImplicitAs.impl.Convert [concrete]
  395. // CHECK:STDOUT: }
  396. // CHECK:STDOUT:
  397. // CHECK:STDOUT: imports {
  398. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  399. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  400. // CHECK:STDOUT: import Core//prelude
  401. // CHECK:STDOUT: import Core//prelude/...
  402. // CHECK:STDOUT: }
  403. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  404. // CHECK:STDOUT: }
  405. // CHECK:STDOUT:
  406. // CHECK:STDOUT: file {
  407. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  408. // CHECK:STDOUT: .Core = imports.%Core
  409. // CHECK:STDOUT: .I = %I.decl
  410. // CHECK:STDOUT: .C = %C.decl
  411. // CHECK:STDOUT: }
  412. // CHECK:STDOUT: %Core.import = import Core
  413. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  414. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  415. // CHECK:STDOUT: impl_decl @empty_tuple.type.as.ImplicitAs.impl [concrete] {} {
  416. // CHECK:STDOUT: %.loc10_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  417. // CHECK:STDOUT: %.loc10_7.2: type = converted %.loc10_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  418. // CHECK:STDOUT: %Core.ref: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
  419. // CHECK:STDOUT: %ImplicitAs.ref: %ImplicitAs.type.cc7 = name_ref ImplicitAs, imports.%Core.ImplicitAs [concrete = constants.%ImplicitAs.generic]
  420. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  421. // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%C)> [concrete = constants.%ImplicitAs.type.396]
  422. // CHECK:STDOUT: }
  423. // CHECK:STDOUT: %ImplicitAs.impl_witness_table = impl_witness_table (@empty_tuple.type.as.ImplicitAs.impl.%empty_tuple.type.as.ImplicitAs.impl.Convert.decl), @empty_tuple.type.as.ImplicitAs.impl [concrete]
  424. // CHECK:STDOUT: %ImplicitAs.impl_witness: <witness> = impl_witness %ImplicitAs.impl_witness_table [concrete = constants.%ImplicitAs.impl_witness]
  425. // CHECK:STDOUT: impl_decl @C.as.I.impl [concrete] {} {
  426. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  427. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  428. // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  429. // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  430. // CHECK:STDOUT: %V.ref: %I.assoc_type = name_ref V, @V.%assoc0 [concrete = constants.%assoc0.1aa]
  431. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.binding.as_type]
  432. // CHECK:STDOUT: %.loc18_19: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.binding.as_type]
  433. // CHECK:STDOUT: %impl.elem0: %.Self.binding.as_type = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  434. // CHECK:STDOUT: %.loc18_25.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  435. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple]
  436. // CHECK:STDOUT: %.loc18_25.2: %empty_tuple.type = converted %.loc18_25.1, %empty_tuple [concrete = constants.%empty_tuple]
  437. // CHECK:STDOUT: %.loc18_13: type = where_expr %.Self [concrete = constants.%I_where.type] {
  438. // CHECK:STDOUT: requirement_base_facet_type constants.%I.type
  439. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc18_25.2
  440. // CHECK:STDOUT: }
  441. // CHECK:STDOUT: }
  442. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%impl_witness_assoc_constant), @C.as.I.impl [concrete]
  443. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness]
  444. // CHECK:STDOUT: %impl.elem0: %.77a = impl_witness_access constants.%ImplicitAs.impl_witness, element0 [concrete = constants.%empty_tuple.type.as.ImplicitAs.impl.Convert]
  445. // CHECK:STDOUT: %bound_method: <bound method> = bound_method constants.%empty_tuple, %impl.elem0 [concrete = constants.%empty_tuple.type.as.ImplicitAs.impl.Convert.bound]
  446. // CHECK:STDOUT: %.loc18_13.1: ref %C = temporary_storage
  447. // CHECK:STDOUT: %empty_tuple.type.as.ImplicitAs.impl.Convert.call: init %C = call %bound_method(constants.%empty_tuple) to %.loc18_13.1
  448. // CHECK:STDOUT: %.loc18_13.2: init %C = converted constants.%empty_tuple, %empty_tuple.type.as.ImplicitAs.impl.Convert.call
  449. // CHECK:STDOUT: %.loc18_13.3: ref %C = temporary %.loc18_13.1, %.loc18_13.2
  450. // CHECK:STDOUT: %.loc18_13.4: %C = acquire_value %.loc18_13.3
  451. // CHECK:STDOUT: %impl_witness_assoc_constant: <error> = impl_witness_assoc_constant <error> [concrete = <error>]
  452. // CHECK:STDOUT: }
  453. // CHECK:STDOUT:
  454. // CHECK:STDOUT: interface @I {
  455. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = constants.%Self.9f2]
  456. // CHECK:STDOUT: %V: @V.%Self.binding.as_type (%Self.binding.as_type.bcb) = assoc_const_decl @V [concrete] {
  457. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%V [concrete = constants.%assoc0.1aa]
  458. // CHECK:STDOUT: }
  459. // CHECK:STDOUT:
  460. // CHECK:STDOUT: !members:
  461. // CHECK:STDOUT: .Self = %Self
  462. // CHECK:STDOUT: .V = @V.%assoc0
  463. // CHECK:STDOUT: witness = (%V)
  464. // CHECK:STDOUT:
  465. // CHECK:STDOUT: !requires:
  466. // CHECK:STDOUT: }
  467. // CHECK:STDOUT:
  468. // CHECK:STDOUT: generic assoc_const @V(@I.%Self: %I.type) {
  469. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.9f2)]
  470. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.bcb)]
  471. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %Self.binding.as_type [symbolic = %require_complete (constants.%require_complete.e1b)]
  472. // CHECK:STDOUT:
  473. // CHECK:STDOUT: assoc_const V:! @V.%Self.binding.as_type (%Self.binding.as_type.bcb);
  474. // CHECK:STDOUT: }
  475. // CHECK:STDOUT:
  476. // CHECK:STDOUT: impl @empty_tuple.type.as.ImplicitAs.impl: %.loc10_7.2 as %ImplicitAs.type {
  477. // CHECK:STDOUT: %empty_tuple.type.as.ImplicitAs.impl.Convert.decl: %empty_tuple.type.as.ImplicitAs.impl.Convert.type = fn_decl @empty_tuple.type.as.ImplicitAs.impl.Convert [concrete = constants.%empty_tuple.type.as.ImplicitAs.impl.Convert] {
  478. // CHECK:STDOUT: %self.patt: %pattern_type.cb1 = value_binding_pattern self [concrete]
  479. // CHECK:STDOUT: %self.param_patt: %pattern_type.cb1 = value_param_pattern %self.patt, call_param0 [concrete]
  480. // CHECK:STDOUT: %return.patt: %pattern_type.c48 = return_slot_pattern [concrete]
  481. // CHECK:STDOUT: %return.param_patt: %pattern_type.c48 = out_param_pattern %return.patt, call_param1 [concrete]
  482. // CHECK:STDOUT: } {
  483. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  484. // CHECK:STDOUT: %self.param: %empty_tuple.type = value_param call_param0
  485. // CHECK:STDOUT: %.loc11_21.1: type = splice_block %.loc11_21.3 [concrete = constants.%empty_tuple.type] {
  486. // CHECK:STDOUT: %.loc11_21.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  487. // CHECK:STDOUT: %.loc11_21.3: type = converted %.loc11_21.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  488. // CHECK:STDOUT: }
  489. // CHECK:STDOUT: %self: %empty_tuple.type = value_binding self, %self.param
  490. // CHECK:STDOUT: %return.param: ref %C = out_param call_param1
  491. // CHECK:STDOUT: %return: ref %C = return_slot %return.param
  492. // CHECK:STDOUT: }
  493. // CHECK:STDOUT:
  494. // CHECK:STDOUT: !members:
  495. // CHECK:STDOUT: .C = <poisoned>
  496. // CHECK:STDOUT: .Convert = %empty_tuple.type.as.ImplicitAs.impl.Convert.decl
  497. // CHECK:STDOUT: witness = file.%ImplicitAs.impl_witness
  498. // CHECK:STDOUT: }
  499. // CHECK:STDOUT:
  500. // CHECK:STDOUT: impl @C.as.I.impl: %C.ref as %.loc18_13 {
  501. // CHECK:STDOUT: !members:
  502. // CHECK:STDOUT: witness = file.%I.impl_witness
  503. // CHECK:STDOUT: }
  504. // CHECK:STDOUT:
  505. // CHECK:STDOUT: class @C {
  506. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  507. // CHECK:STDOUT: complete_type_witness = %complete_type
  508. // CHECK:STDOUT:
  509. // CHECK:STDOUT: !members:
  510. // CHECK:STDOUT: .Self = constants.%C
  511. // CHECK:STDOUT: }
  512. // CHECK:STDOUT:
  513. // CHECK:STDOUT: fn @empty_tuple.type.as.ImplicitAs.impl.Convert(%self.param: %empty_tuple.type) -> %return.param: %C {
  514. // CHECK:STDOUT: !entry:
  515. // CHECK:STDOUT: %.loc11_41.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  516. // CHECK:STDOUT: %.loc11_41.2: init %C = class_init (), %return [concrete = constants.%C.val]
  517. // CHECK:STDOUT: %.loc11_42: init %C = converted %.loc11_41.1, %.loc11_41.2 [concrete = constants.%C.val]
  518. // CHECK:STDOUT: return %.loc11_42 to %return
  519. // CHECK:STDOUT: }
  520. // CHECK:STDOUT:
  521. // CHECK:STDOUT: specific @V(constants.%Self.9f2) {
  522. // CHECK:STDOUT: %Self => constants.%Self.9f2
  523. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type.bcb
  524. // CHECK:STDOUT: %require_complete => constants.%require_complete.e1b
  525. // CHECK:STDOUT: }
  526. // CHECK:STDOUT:
  527. // CHECK:STDOUT: specific @V(constants.%.Self) {
  528. // CHECK:STDOUT: %Self => constants.%.Self
  529. // CHECK:STDOUT: %Self.binding.as_type => constants.%.Self.binding.as_type
  530. // CHECK:STDOUT: %require_complete => constants.%require_complete.d2d
  531. // CHECK:STDOUT: }
  532. // CHECK:STDOUT:
  533. // CHECK:STDOUT: specific @V(constants.%I.facet) {
  534. // CHECK:STDOUT: %Self => constants.%I.facet
  535. // CHECK:STDOUT: %Self.binding.as_type => constants.%C
  536. // CHECK:STDOUT: %require_complete => constants.%complete_type
  537. // CHECK:STDOUT: }
  538. // CHECK:STDOUT:
  539. // CHECK:STDOUT: --- fail_monomorphization_failure.carbon
  540. // CHECK:STDOUT:
  541. // CHECK:STDOUT: constants {
  542. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  543. // CHECK:STDOUT: %.Self.3b7: %type = symbolic_binding .Self [symbolic_self]
  544. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  545. // CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [concrete]
  546. // CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [concrete]
  547. // CHECK:STDOUT: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic]
  548. // CHECK:STDOUT: %pattern_type.dc0: type = pattern_type Core.IntLiteral [concrete]
  549. // CHECK:STDOUT: %I.type.dac: type = generic_interface_type @I [concrete]
  550. // CHECK:STDOUT: %I.generic: %I.type.dac = struct_value () [concrete]
  551. // CHECK:STDOUT: %I.type.f7b: type = facet_type <@I, @I(%N)> [symbolic]
  552. // CHECK:STDOUT: %Self.d78: %I.type.f7b = symbolic_binding Self, 1 [symbolic]
  553. // CHECK:STDOUT: %Self.binding.as_type.e44: type = symbolic_binding_type Self, 1, %Self.d78 [symbolic]
  554. // CHECK:STDOUT: %array_type: type = array_type %N, %Self.binding.as_type.e44 [symbolic]
  555. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %array_type [symbolic]
  556. // CHECK:STDOUT: %I.assoc_type.44f: type = assoc_entity_type @I, @I(%N) [symbolic]
  557. // CHECK:STDOUT: %assoc0.8bd: %I.assoc_type.44f = assoc_entity element0, @I.%V [symbolic]
  558. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  559. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  560. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete]
  561. // CHECK:STDOUT: %Negate.type: type = facet_type <@Negate> [concrete]
  562. // CHECK:STDOUT: %Negate.Op.type: type = fn_type @Negate.Op [concrete]
  563. // CHECK:STDOUT: %Negate.impl_witness: <witness> = impl_witness imports.%Negate.impl_witness_table [concrete]
  564. // CHECK:STDOUT: %Negate.facet: %Negate.type = facet_value Core.IntLiteral, (%Negate.impl_witness) [concrete]
  565. // CHECK:STDOUT: %.6a1: type = fn_type_with_self_type %Negate.Op.type, %Negate.facet [concrete]
  566. // CHECK:STDOUT: %Core.IntLiteral.as.Negate.impl.Op.type: type = fn_type @Core.IntLiteral.as.Negate.impl.Op [concrete]
  567. // CHECK:STDOUT: %Core.IntLiteral.as.Negate.impl.Op: %Core.IntLiteral.as.Negate.impl.Op.type = struct_value () [concrete]
  568. // CHECK:STDOUT: %Core.IntLiteral.as.Negate.impl.Op.bound: <bound method> = bound_method %int_1, %Core.IntLiteral.as.Negate.impl.Op [concrete]
  569. // CHECK:STDOUT: %int_-1: Core.IntLiteral = int_value -1 [concrete]
  570. // CHECK:STDOUT: %I.type.f11: type = facet_type <@I, @I(%int_-1)> [concrete]
  571. // CHECK:STDOUT: %.Self.687: %I.type.f11 = symbolic_binding .Self [symbolic_self]
  572. // CHECK:STDOUT: %Self.623: %I.type.f11 = symbolic_binding Self, 1 [symbolic]
  573. // CHECK:STDOUT: %I.assoc_type.247: type = assoc_entity_type @I, @I(%int_-1) [concrete]
  574. // CHECK:STDOUT: %assoc0.63a: %I.assoc_type.247 = assoc_entity element0, @I.%V [concrete]
  575. // CHECK:STDOUT: %.Self.binding.as_type: type = symbolic_binding_type .Self, %.Self.687 [symbolic_self]
  576. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %.Self.687, @I, @I(%int_-1) [symbolic_self]
  577. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  578. // CHECK:STDOUT: }
  579. // CHECK:STDOUT:
  580. // CHECK:STDOUT: imports {
  581. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  582. // CHECK:STDOUT: .IntLiteral = %Core.IntLiteral
  583. // CHECK:STDOUT: .Negate = %Core.Negate
  584. // CHECK:STDOUT: import Core//prelude
  585. // CHECK:STDOUT: import Core//prelude/...
  586. // CHECK:STDOUT: }
  587. // CHECK:STDOUT: %Core.IntLiteral: %IntLiteral.type = import_ref Core//prelude/parts/int_literal, IntLiteral, loaded [concrete = constants.%IntLiteral]
  588. // CHECK:STDOUT: %Core.Negate: type = import_ref Core//prelude/parts/int_literal, Negate, loaded [concrete = constants.%Negate.type]
  589. // CHECK:STDOUT: %Core.import_ref.abd = import_ref Core//prelude/parts/int_literal, loc{{\d+_\d+}}, unloaded
  590. // CHECK:STDOUT: %Core.import_ref.b9e: %Core.IntLiteral.as.Negate.impl.Op.type = import_ref Core//prelude/parts/int_literal, loc{{\d+_\d+}}, loaded [concrete = constants.%Core.IntLiteral.as.Negate.impl.Op]
  591. // CHECK:STDOUT: %Negate.impl_witness_table = impl_witness_table (%Core.import_ref.abd, %Core.import_ref.b9e), @Core.IntLiteral.as.Negate.impl [concrete]
  592. // CHECK:STDOUT: }
  593. // CHECK:STDOUT:
  594. // CHECK:STDOUT: file {
  595. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  596. // CHECK:STDOUT: .Core = imports.%Core
  597. // CHECK:STDOUT: .I = %I.decl
  598. // CHECK:STDOUT: }
  599. // CHECK:STDOUT: %Core.import = import Core
  600. // CHECK:STDOUT: %I.decl: %I.type.dac = interface_decl @I [concrete = constants.%I.generic] {
  601. // CHECK:STDOUT: %N.patt: %pattern_type.dc0 = symbolic_binding_pattern N, 0 [concrete]
  602. // CHECK:STDOUT: } {
  603. // CHECK:STDOUT: %.loc4_33.1: type = splice_block %.loc4_33.3 [concrete = Core.IntLiteral] {
  604. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.3b7]
  605. // CHECK:STDOUT: %Core.ref: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
  606. // CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%Core.IntLiteral [concrete = constants.%IntLiteral]
  607. // CHECK:STDOUT: %IntLiteral.call: init type = call %IntLiteral.ref() [concrete = Core.IntLiteral]
  608. // CHECK:STDOUT: %.loc4_33.2: type = value_of_initializer %IntLiteral.call [concrete = Core.IntLiteral]
  609. // CHECK:STDOUT: %.loc4_33.3: type = converted %IntLiteral.call, %.loc4_33.2 [concrete = Core.IntLiteral]
  610. // CHECK:STDOUT: }
  611. // CHECK:STDOUT: %N.loc4_13.2: Core.IntLiteral = symbolic_binding N, 0 [symbolic = %N.loc4_13.1 (constants.%N)]
  612. // CHECK:STDOUT: }
  613. // CHECK:STDOUT: impl_decl @empty_struct_type.as.<error>.impl [concrete] {} {
  614. // CHECK:STDOUT: %.loc15_7.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  615. // CHECK:STDOUT: %.loc15_7.2: type = converted %.loc15_7.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  616. // CHECK:STDOUT: %I.ref: %I.type.dac = name_ref I, file.%I.decl [concrete = constants.%I.generic]
  617. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
  618. // CHECK:STDOUT: %impl.elem1: %.6a1 = impl_witness_access constants.%Negate.impl_witness, element1 [concrete = constants.%Core.IntLiteral.as.Negate.impl.Op]
  619. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1, %impl.elem1 [concrete = constants.%Core.IntLiteral.as.Negate.impl.Op.bound]
  620. // CHECK:STDOUT: %Core.IntLiteral.as.Negate.impl.Op.call: init Core.IntLiteral = call %bound_method(%int_1) [concrete = constants.%int_-1]
  621. // CHECK:STDOUT: %.loc15_16.1: Core.IntLiteral = value_of_initializer %Core.IntLiteral.as.Negate.impl.Op.call [concrete = constants.%int_-1]
  622. // CHECK:STDOUT: %.loc15_16.2: Core.IntLiteral = converted %Core.IntLiteral.as.Negate.impl.Op.call, %.loc15_16.1 [concrete = constants.%int_-1]
  623. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(constants.%int_-1)> [concrete = constants.%I.type.f11]
  624. // CHECK:STDOUT: %.Self: %I.type.f11 = symbolic_binding .Self [symbolic_self = constants.%.Self.687]
  625. // CHECK:STDOUT: %.Self.ref: %I.type.f11 = name_ref .Self, %.Self [symbolic_self = constants.%.Self.687]
  626. // CHECK:STDOUT: %.loc15_24.1: %I.assoc_type.247 = specific_constant @V.%assoc0, @I(constants.%int_-1) [concrete = constants.%assoc0.63a]
  627. // CHECK:STDOUT: %V.ref: %I.assoc_type.247 = name_ref V, %.loc15_24.1 [concrete = constants.%assoc0.63a]
  628. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.binding.as_type]
  629. // CHECK:STDOUT: %.loc15_24.2: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.binding.as_type]
  630. // CHECK:STDOUT: %impl.elem0: <error> = impl_witness_access constants.%I.lookup_impl_witness, element0 [concrete = <error>]
  631. // CHECK:STDOUT: %.loc15_30: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  632. // CHECK:STDOUT: %.loc15_18: type = where_expr %.Self [concrete = <error>] {
  633. // CHECK:STDOUT: requirement_base_facet_type constants.%I.type.f11
  634. // CHECK:STDOUT: requirement_rewrite %impl.elem0, <error>
  635. // CHECK:STDOUT: }
  636. // CHECK:STDOUT: }
  637. // CHECK:STDOUT: }
  638. // CHECK:STDOUT:
  639. // CHECK:STDOUT: generic interface @I(%N.loc4_13.2: Core.IntLiteral) {
  640. // CHECK:STDOUT: %N.loc4_13.1: Core.IntLiteral = symbolic_binding N, 0 [symbolic = %N.loc4_13.1 (constants.%N)]
  641. // CHECK:STDOUT:
  642. // CHECK:STDOUT: !definition:
  643. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%N.loc4_13.1)> [symbolic = %I.type (constants.%I.type.f7b)]
  644. // CHECK:STDOUT: %Self.loc4_36.2: @I.%I.type (%I.type.f7b) = symbolic_binding Self, 1 [symbolic = %Self.loc4_36.2 (constants.%Self.d78)]
  645. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I, @I(%N.loc4_13.1) [symbolic = %I.assoc_type (constants.%I.assoc_type.44f)]
  646. // CHECK:STDOUT: %assoc0: @I.%I.assoc_type (%I.assoc_type.44f) = assoc_entity element0, %V [symbolic = %assoc0 (constants.%assoc0.8bd)]
  647. // CHECK:STDOUT:
  648. // CHECK:STDOUT: interface {
  649. // CHECK:STDOUT: %Self.loc4_36.1: @I.%I.type (%I.type.f7b) = symbolic_binding Self, 1 [symbolic = %Self.loc4_36.2 (constants.%Self.d78)]
  650. // CHECK:STDOUT: %V: @V.%array_type (%array_type) = assoc_const_decl @V [concrete] {
  651. // CHECK:STDOUT: %assoc0: @I.%I.assoc_type (%I.assoc_type.44f) = assoc_entity element0, @I.%V [symbolic = @I.%assoc0 (constants.%assoc0.8bd)]
  652. // CHECK:STDOUT: }
  653. // CHECK:STDOUT:
  654. // CHECK:STDOUT: !members:
  655. // CHECK:STDOUT: .Self = %Self.loc4_36.1
  656. // CHECK:STDOUT: .N = <poisoned>
  657. // CHECK:STDOUT: .V = @V.%assoc0
  658. // CHECK:STDOUT: witness = (%V)
  659. // CHECK:STDOUT:
  660. // CHECK:STDOUT: !requires:
  661. // CHECK:STDOUT: }
  662. // CHECK:STDOUT: }
  663. // CHECK:STDOUT:
  664. // CHECK:STDOUT: generic assoc_const @V(@I.%N.loc4_13.2: Core.IntLiteral, @I.%Self.loc4_36.1: @I.%I.type (%I.type.f7b)) {
  665. // CHECK:STDOUT: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic = %N (constants.%N)]
  666. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%N)> [symbolic = %I.type (constants.%I.type.f7b)]
  667. // CHECK:STDOUT: %Self: @V.%I.type (%I.type.f7b) = symbolic_binding Self, 1 [symbolic = %Self (constants.%Self.d78)]
  668. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.e44)]
  669. // CHECK:STDOUT: %array_type: type = array_type %N, %Self.binding.as_type [symbolic = %array_type (constants.%array_type)]
  670. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %array_type [symbolic = %require_complete (constants.%require_complete)]
  671. // CHECK:STDOUT:
  672. // CHECK:STDOUT: assoc_const V:! @V.%array_type (%array_type);
  673. // CHECK:STDOUT: }
  674. // CHECK:STDOUT:
  675. // CHECK:STDOUT: impl @empty_struct_type.as.<error>.impl: %.loc15_7.2 as %.loc15_18 {
  676. // CHECK:STDOUT: !members:
  677. // CHECK:STDOUT: witness = <error>
  678. // CHECK:STDOUT: }
  679. // CHECK:STDOUT:
  680. // CHECK:STDOUT: specific @I(constants.%N) {
  681. // CHECK:STDOUT: %N.loc4_13.1 => constants.%N
  682. // CHECK:STDOUT: }
  683. // CHECK:STDOUT:
  684. // CHECK:STDOUT: specific @V(constants.%N, constants.%Self.d78) {
  685. // CHECK:STDOUT: %N => constants.%N
  686. // CHECK:STDOUT: %I.type => constants.%I.type.f7b
  687. // CHECK:STDOUT: %Self => constants.%Self.d78
  688. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type.e44
  689. // CHECK:STDOUT: %array_type => constants.%array_type
  690. // CHECK:STDOUT: %require_complete => constants.%require_complete
  691. // CHECK:STDOUT: }
  692. // CHECK:STDOUT:
  693. // CHECK:STDOUT: specific @I(constants.%int_-1) {
  694. // CHECK:STDOUT: %N.loc4_13.1 => constants.%int_-1
  695. // CHECK:STDOUT:
  696. // CHECK:STDOUT: !definition:
  697. // CHECK:STDOUT: %I.type => constants.%I.type.f11
  698. // CHECK:STDOUT: %Self.loc4_36.2 => constants.%Self.623
  699. // CHECK:STDOUT: %I.assoc_type => constants.%I.assoc_type.247
  700. // CHECK:STDOUT: %assoc0 => constants.%assoc0.63a
  701. // CHECK:STDOUT: }
  702. // CHECK:STDOUT:
  703. // CHECK:STDOUT: specific @V(constants.%int_-1, constants.%.Self.687) {
  704. // CHECK:STDOUT: %N => constants.%int_-1
  705. // CHECK:STDOUT: %I.type => constants.%I.type.f11
  706. // CHECK:STDOUT: %Self => constants.%.Self.687
  707. // CHECK:STDOUT: %Self.binding.as_type => constants.%.Self.binding.as_type
  708. // CHECK:STDOUT: %array_type => <error>
  709. // CHECK:STDOUT: %require_complete => <error>
  710. // CHECK:STDOUT: }
  711. // CHECK:STDOUT:
  712. // CHECK:STDOUT: --- fail_todo_constrained_fn.carbon
  713. // CHECK:STDOUT:
  714. // CHECK:STDOUT: constants {
  715. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  716. // CHECK:STDOUT: %Self.9f2: %I.type = symbolic_binding Self, 0 [symbolic]
  717. // CHECK:STDOUT: %Self.binding.as_type.bcb: type = symbolic_binding_type Self, 0, %Self.9f2 [symbolic]
  718. // CHECK:STDOUT: %require_complete.e1b: <witness> = require_complete_type %Self.binding.as_type.bcb [symbolic]
  719. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  720. // CHECK:STDOUT: %assoc0.1aa: %I.assoc_type = assoc_entity element0, @I.%V [concrete]
  721. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  722. // CHECK:STDOUT: %.Self.3b7: %type = symbolic_binding .Self [symbolic_self]
  723. // CHECK:STDOUT: %.Self.420: %I.type = symbolic_binding .Self [symbolic_self]
  724. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  725. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  726. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  727. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  728. // CHECK:STDOUT: %.Self.binding.as_type: type = symbolic_binding_type .Self, %.Self.420 [symbolic_self]
  729. // CHECK:STDOUT: %ImplicitAs.type.164: type = facet_type <@ImplicitAs, @ImplicitAs(%.Self.binding.as_type)> [symbolic_self]
  730. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %.Self.420, @I [symbolic_self]
  731. // CHECK:STDOUT: %require_complete.d2d: <witness> = require_complete_type %.Self.binding.as_type [symbolic_self]
  732. // CHECK:STDOUT: %impl.elem0: %.Self.binding.as_type = impl_witness_access %I.lookup_impl_witness, element0 [symbolic_self]
  733. // CHECK:STDOUT: %I_where.type: type = facet_type <@I where %impl.elem0 = %empty_struct and TODO> [concrete]
  734. // CHECK:STDOUT: %T: %I_where.type = symbolic_binding T, 0 [symbolic]
  735. // CHECK:STDOUT: %pattern_type.a47: type = pattern_type %I_where.type [concrete]
  736. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  737. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  738. // CHECK:STDOUT: %CallF.type: type = fn_type @CallF [concrete]
  739. // CHECK:STDOUT: %CallF: %CallF.type = struct_value () [concrete]
  740. // CHECK:STDOUT: }
  741. // CHECK:STDOUT:
  742. // CHECK:STDOUT: imports {
  743. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  744. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  745. // CHECK:STDOUT: import Core//prelude
  746. // CHECK:STDOUT: import Core//prelude/...
  747. // CHECK:STDOUT: }
  748. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  749. // CHECK:STDOUT: }
  750. // CHECK:STDOUT:
  751. // CHECK:STDOUT: file {
  752. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  753. // CHECK:STDOUT: .Core = imports.%Core
  754. // CHECK:STDOUT: .I = %I.decl
  755. // CHECK:STDOUT: .F = %F.decl
  756. // CHECK:STDOUT: .CallF = %CallF.decl
  757. // CHECK:STDOUT: }
  758. // CHECK:STDOUT: %Core.import = import Core
  759. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  760. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  761. // CHECK:STDOUT: %T.patt: %pattern_type.a47 = symbolic_binding_pattern T, 0 [concrete]
  762. // CHECK:STDOUT: } {
  763. // CHECK:STDOUT: %.loc8_12.1: type = splice_block %.loc8_12.2 [concrete = constants.%I_where.type] {
  764. // CHECK:STDOUT: %.Self.1: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.3b7]
  765. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  766. // CHECK:STDOUT: %.Self.2: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.420]
  767. // CHECK:STDOUT: %.loc8_19.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  768. // CHECK:STDOUT: %Core.ref: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
  769. // CHECK:STDOUT: %ImplicitAs.ref: %ImplicitAs.type.cc7 = name_ref ImplicitAs, imports.%Core.ImplicitAs [concrete = constants.%ImplicitAs.generic]
  770. // CHECK:STDOUT: %.Self.ref.loc8_43: %I.type = name_ref .Self, %.Self.2 [symbolic_self = constants.%.Self.420]
  771. // CHECK:STDOUT: %.Self.as_type.loc8_48: type = facet_access_type %.Self.ref.loc8_43 [symbolic_self = constants.%.Self.binding.as_type]
  772. // CHECK:STDOUT: %.loc8_48: type = converted %.Self.ref.loc8_43, %.Self.as_type.loc8_48 [symbolic_self = constants.%.Self.binding.as_type]
  773. // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%.Self.binding.as_type)> [symbolic_self = constants.%ImplicitAs.type.164]
  774. // CHECK:STDOUT: %.loc8_19.2: type = converted %.loc8_19.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  775. // CHECK:STDOUT: %.Self.ref.loc8_54: %I.type = name_ref .Self, %.Self.2 [symbolic_self = constants.%.Self.420]
  776. // CHECK:STDOUT: %V.ref: %I.assoc_type = name_ref V, @V.%assoc0 [concrete = constants.%assoc0.1aa]
  777. // CHECK:STDOUT: %.Self.as_type.loc8_54: type = facet_access_type %.Self.ref.loc8_54 [symbolic_self = constants.%.Self.binding.as_type]
  778. // CHECK:STDOUT: %.loc8_54: type = converted %.Self.ref.loc8_54, %.Self.as_type.loc8_54 [symbolic_self = constants.%.Self.binding.as_type]
  779. // CHECK:STDOUT: %impl.elem0: %.Self.binding.as_type = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  780. // CHECK:STDOUT: %.loc8_60.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  781. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete = constants.%empty_struct]
  782. // CHECK:STDOUT: %.loc8_60.2: %empty_struct_type = converted %.loc8_60.1, %empty_struct [concrete = constants.%empty_struct]
  783. // CHECK:STDOUT: %.loc8_12.2: type = where_expr %.Self.2 [concrete = constants.%I_where.type] {
  784. // CHECK:STDOUT: requirement_base_facet_type constants.%I.type
  785. // CHECK:STDOUT: requirement_impls %.loc8_19.2, %ImplicitAs.type
  786. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc8_60.2
  787. // CHECK:STDOUT: }
  788. // CHECK:STDOUT: }
  789. // CHECK:STDOUT: %T.loc8_6.2: %I_where.type = symbolic_binding T, 0 [symbolic = %T.loc8_6.1 (constants.%T)]
  790. // CHECK:STDOUT: }
  791. // CHECK:STDOUT: %CallF.decl: %CallF.type = fn_decl @CallF [concrete = constants.%CallF] {} {}
  792. // CHECK:STDOUT: }
  793. // CHECK:STDOUT:
  794. // CHECK:STDOUT: interface @I {
  795. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = constants.%Self.9f2]
  796. // CHECK:STDOUT: %V: @V.%Self.binding.as_type (%Self.binding.as_type.bcb) = assoc_const_decl @V [concrete] {
  797. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%V [concrete = constants.%assoc0.1aa]
  798. // CHECK:STDOUT: }
  799. // CHECK:STDOUT:
  800. // CHECK:STDOUT: !members:
  801. // CHECK:STDOUT: .Self = %Self
  802. // CHECK:STDOUT: .V = @V.%assoc0
  803. // CHECK:STDOUT: witness = (%V)
  804. // CHECK:STDOUT:
  805. // CHECK:STDOUT: !requires:
  806. // CHECK:STDOUT: }
  807. // CHECK:STDOUT:
  808. // CHECK:STDOUT: generic assoc_const @V(@I.%Self: %I.type) {
  809. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.9f2)]
  810. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.bcb)]
  811. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %Self.binding.as_type [symbolic = %require_complete (constants.%require_complete.e1b)]
  812. // CHECK:STDOUT:
  813. // CHECK:STDOUT: assoc_const V:! @V.%Self.binding.as_type (%Self.binding.as_type.bcb);
  814. // CHECK:STDOUT: }
  815. // CHECK:STDOUT:
  816. // CHECK:STDOUT: generic fn @F(%T.loc8_6.2: %I_where.type) {
  817. // CHECK:STDOUT: %T.loc8_6.1: %I_where.type = symbolic_binding T, 0 [symbolic = %T.loc8_6.1 (constants.%T)]
  818. // CHECK:STDOUT:
  819. // CHECK:STDOUT: fn();
  820. // CHECK:STDOUT: }
  821. // CHECK:STDOUT:
  822. // CHECK:STDOUT: fn @CallF() {
  823. // CHECK:STDOUT: !entry:
  824. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
  825. // CHECK:STDOUT: %.loc19: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  826. // CHECK:STDOUT: return
  827. // CHECK:STDOUT: }
  828. // CHECK:STDOUT:
  829. // CHECK:STDOUT: specific @V(constants.%Self.9f2) {
  830. // CHECK:STDOUT: %Self => constants.%Self.9f2
  831. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type.bcb
  832. // CHECK:STDOUT: %require_complete => constants.%require_complete.e1b
  833. // CHECK:STDOUT: }
  834. // CHECK:STDOUT:
  835. // CHECK:STDOUT: specific @V(constants.%.Self.420) {
  836. // CHECK:STDOUT: %Self => constants.%.Self.420
  837. // CHECK:STDOUT: %Self.binding.as_type => constants.%.Self.binding.as_type
  838. // CHECK:STDOUT: %require_complete => constants.%require_complete.d2d
  839. // CHECK:STDOUT: }
  840. // CHECK:STDOUT:
  841. // CHECK:STDOUT: specific @F(constants.%T) {
  842. // CHECK:STDOUT: %T.loc8_6.1 => constants.%T
  843. // CHECK:STDOUT: }
  844. // CHECK:STDOUT: