assoc_const_self.carbon 58 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875
  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.ab9: %I.type = symbolic_binding Self, 0 [symbolic]
  83. // CHECK:STDOUT: %Self.binding.as_type.d31: type = symbolic_binding_type Self, 0, %Self.ab9 [symbolic]
  84. // CHECK:STDOUT: %require_complete.4df: <witness> = require_complete_type %Self.binding.as_type.d31 [symbolic]
  85. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  86. // CHECK:STDOUT: %assoc0.8a1: %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.716: <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.ec3: type = facet_type <@I where %impl.elem0 = %empty_struct> [concrete]
  95. // CHECK:STDOUT: %I.impl_witness.df7: <witness> = impl_witness @empty_struct_type.as.I.impl.%I.impl_witness_table [concrete]
  96. // CHECK:STDOUT: %I.facet.47f: %I.type = facet_value %empty_struct_type, (%I.impl_witness.df7) [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.b52: type = facet_type <@I where %impl.elem0 = %int_0.5c6> [concrete]
  104. // CHECK:STDOUT: %I.impl_witness.550: <witness> = impl_witness @i32.as.I.impl.%I.impl_witness_table [concrete]
  105. // CHECK:STDOUT: %I.facet.608: %I.type = facet_value %i32, (%I.impl_witness.550) [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.e8c: 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.4e6: 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.3c2: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.4e6 = struct_value () [symbolic]
  115. // CHECK:STDOUT: %ImplicitAs.impl_witness.6bc: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.74f, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  116. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.e0d: 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.0b5: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.e0d = struct_value () [concrete]
  118. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.e8c = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.6bc) [concrete]
  119. // CHECK:STDOUT: %.863: 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.0b5 [concrete]
  121. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5, @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.42d: @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert.type (%Core.IntLiteral.as.ImplicitAs.impl.Convert.type.4e6) = 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.3c2)]
  136. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.74f = impl_witness_table (%Core.import_ref.42d), @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.8a1]
  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.ec3] {
  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: impl_decl @i32.as.I.impl [concrete] {} {
  165. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  166. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  167. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  168. // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  169. // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  170. // CHECK:STDOUT: %V.ref: %I.assoc_type = name_ref V, @V.%assoc0 [concrete = constants.%assoc0.8a1]
  171. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.binding.as_type]
  172. // CHECK:STDOUT: %.loc10_21: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.binding.as_type]
  173. // CHECK:STDOUT: %impl.elem0.loc10_21: %.Self.binding.as_type = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  174. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
  175. // CHECK:STDOUT: %.loc10_15.1: type = where_expr %.Self [concrete = constants.%I_where.type.b52] {
  176. // CHECK:STDOUT: requirement_base_facet_type constants.%I.type
  177. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc10_21, %int_0
  178. // CHECK:STDOUT: }
  179. // CHECK:STDOUT: }
  180. // CHECK:STDOUT: }
  181. // CHECK:STDOUT:
  182. // CHECK:STDOUT: interface @I {
  183. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = constants.%Self.ab9]
  184. // CHECK:STDOUT: %V: @V.%Self.binding.as_type (%Self.binding.as_type.d31) = assoc_const_decl @V [concrete] {
  185. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%V [concrete = constants.%assoc0.8a1]
  186. // CHECK:STDOUT: }
  187. // CHECK:STDOUT:
  188. // CHECK:STDOUT: !members:
  189. // CHECK:STDOUT: .Self = %Self
  190. // CHECK:STDOUT: .V = @V.%assoc0
  191. // CHECK:STDOUT: witness = (%V)
  192. // CHECK:STDOUT:
  193. // CHECK:STDOUT: !requires:
  194. // CHECK:STDOUT: }
  195. // CHECK:STDOUT:
  196. // CHECK:STDOUT: generic assoc_const @V(@I.%Self: %I.type) {
  197. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.ab9)]
  198. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.d31)]
  199. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %Self.binding.as_type [symbolic = %require_complete (constants.%require_complete.4df)]
  200. // CHECK:STDOUT:
  201. // CHECK:STDOUT: assoc_const V:! @V.%Self.binding.as_type (%Self.binding.as_type.d31);
  202. // CHECK:STDOUT: }
  203. // CHECK:STDOUT:
  204. // CHECK:STDOUT: impl @empty_struct_type.as.I.impl: %.loc8_7.2 as %.loc8_14 {
  205. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%impl_witness_assoc_constant), @empty_struct_type.as.I.impl [concrete]
  206. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness.df7]
  207. // CHECK:STDOUT: %impl_witness_assoc_constant: %empty_struct_type = impl_witness_assoc_constant constants.%empty_struct [concrete = constants.%empty_struct]
  208. // CHECK:STDOUT:
  209. // CHECK:STDOUT: !members:
  210. // CHECK:STDOUT: witness = %I.impl_witness
  211. // CHECK:STDOUT: }
  212. // CHECK:STDOUT:
  213. // CHECK:STDOUT: impl @i32.as.I.impl: %i32 as %.loc10_15.1 {
  214. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%impl_witness_assoc_constant), @i32.as.I.impl [concrete]
  215. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness.550]
  216. // CHECK:STDOUT: %impl.elem0.loc10_15: %.863 = impl_witness_access constants.%ImplicitAs.impl_witness.6bc, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5]
  217. // CHECK:STDOUT: %bound_method.loc10_15.1: <bound method> = bound_method constants.%int_0.5c6, %impl.elem0.loc10_15 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
  218. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0.loc10_15, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  219. // CHECK:STDOUT: %bound_method.loc10_15.2: <bound method> = bound_method constants.%int_0.5c6, %specific_fn [concrete = constants.%bound_method]
  220. // 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]
  221. // CHECK:STDOUT: %.loc10_15.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_0.6a9]
  222. // CHECK:STDOUT: %.loc10_15.3: %i32 = converted constants.%int_0.5c6, %.loc10_15.2 [concrete = constants.%int_0.6a9]
  223. // CHECK:STDOUT: %impl_witness_assoc_constant: %i32 = impl_witness_assoc_constant constants.%int_0.6a9 [concrete = constants.%int_0.6a9]
  224. // CHECK:STDOUT:
  225. // CHECK:STDOUT: !members:
  226. // CHECK:STDOUT: witness = %I.impl_witness
  227. // CHECK:STDOUT: }
  228. // CHECK:STDOUT:
  229. // CHECK:STDOUT: specific @V(constants.%Self.ab9) {
  230. // CHECK:STDOUT: %Self => constants.%Self.ab9
  231. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type.d31
  232. // CHECK:STDOUT: %require_complete => constants.%require_complete.4df
  233. // CHECK:STDOUT: }
  234. // CHECK:STDOUT:
  235. // CHECK:STDOUT: specific @V(constants.%.Self) {
  236. // CHECK:STDOUT: %Self => constants.%.Self
  237. // CHECK:STDOUT: %Self.binding.as_type => constants.%.Self.binding.as_type
  238. // CHECK:STDOUT: %require_complete => constants.%require_complete.716
  239. // CHECK:STDOUT: }
  240. // CHECK:STDOUT:
  241. // CHECK:STDOUT: specific @V(constants.%I.facet.47f) {
  242. // CHECK:STDOUT: %Self => constants.%I.facet.47f
  243. // CHECK:STDOUT: %Self.binding.as_type => constants.%empty_struct_type
  244. // CHECK:STDOUT: %require_complete => constants.%complete_type.357
  245. // CHECK:STDOUT: }
  246. // CHECK:STDOUT:
  247. // CHECK:STDOUT: specific @V(constants.%I.facet.608) {
  248. // CHECK:STDOUT: %Self => constants.%I.facet.608
  249. // CHECK:STDOUT: %Self.binding.as_type => constants.%i32
  250. // CHECK:STDOUT: %require_complete => constants.%complete_type.f8a
  251. // CHECK:STDOUT: }
  252. // CHECK:STDOUT:
  253. // CHECK:STDOUT: --- fail_assoc_const_mismatch.carbon
  254. // CHECK:STDOUT:
  255. // CHECK:STDOUT: constants {
  256. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  257. // CHECK:STDOUT: %Self.ab9: %I.type = symbolic_binding Self, 0 [symbolic]
  258. // CHECK:STDOUT: %Self.binding.as_type.d31: type = symbolic_binding_type Self, 0, %Self.ab9 [symbolic]
  259. // CHECK:STDOUT: %require_complete.4df: <witness> = require_complete_type %Self.binding.as_type.d31 [symbolic]
  260. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  261. // CHECK:STDOUT: %assoc0.8a1: %I.assoc_type = assoc_entity element0, @I.%V [concrete]
  262. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  263. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  264. // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self]
  265. // CHECK:STDOUT: %.Self.binding.as_type: type = symbolic_binding_type .Self, %.Self [symbolic_self]
  266. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %.Self, @I [symbolic_self]
  267. // CHECK:STDOUT: %require_complete.716: <witness> = require_complete_type %.Self.binding.as_type [symbolic_self]
  268. // CHECK:STDOUT: %impl.elem0: %.Self.binding.as_type = impl_witness_access %I.lookup_impl_witness, element0 [symbolic_self]
  269. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete]
  270. // CHECK:STDOUT: %I_where.type: type = facet_type <@I where %impl.elem0 = %int_0> [concrete]
  271. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness @empty_struct_type.as.I.impl.%I.impl_witness_table [concrete]
  272. // CHECK:STDOUT: %I.facet: %I.type = facet_value %empty_struct_type, (%I.impl_witness) [concrete]
  273. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  274. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  275. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  276. // CHECK:STDOUT: }
  277. // CHECK:STDOUT:
  278. // CHECK:STDOUT: imports {
  279. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  280. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  281. // CHECK:STDOUT: import Core//prelude
  282. // CHECK:STDOUT: import Core//prelude/...
  283. // CHECK:STDOUT: }
  284. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  285. // CHECK:STDOUT: }
  286. // CHECK:STDOUT:
  287. // CHECK:STDOUT: file {
  288. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  289. // CHECK:STDOUT: .Core = imports.%Core
  290. // CHECK:STDOUT: .I = %I.decl
  291. // CHECK:STDOUT: }
  292. // CHECK:STDOUT: %Core.import = import Core
  293. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  294. // CHECK:STDOUT: impl_decl @empty_struct_type.as.I.impl [concrete] {} {
  295. // CHECK:STDOUT: %.loc15_7.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  296. // CHECK:STDOUT: %.loc15_7.2: type = converted %.loc15_7.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  297. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  298. // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  299. // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  300. // CHECK:STDOUT: %V.ref: %I.assoc_type = name_ref V, @V.%assoc0 [concrete = constants.%assoc0.8a1]
  301. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.binding.as_type]
  302. // CHECK:STDOUT: %.loc15_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.binding.as_type]
  303. // CHECK:STDOUT: %impl.elem0: %.Self.binding.as_type = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  304. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0]
  305. // CHECK:STDOUT: %.loc15_14.1: type = where_expr %.Self [concrete = constants.%I_where.type] {
  306. // CHECK:STDOUT: requirement_base_facet_type constants.%I.type
  307. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %int_0
  308. // CHECK:STDOUT: }
  309. // CHECK:STDOUT: }
  310. // CHECK:STDOUT: }
  311. // CHECK:STDOUT:
  312. // CHECK:STDOUT: interface @I {
  313. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = constants.%Self.ab9]
  314. // CHECK:STDOUT: %V: @V.%Self.binding.as_type (%Self.binding.as_type.d31) = assoc_const_decl @V [concrete] {
  315. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%V [concrete = constants.%assoc0.8a1]
  316. // CHECK:STDOUT: }
  317. // CHECK:STDOUT:
  318. // CHECK:STDOUT: !members:
  319. // CHECK:STDOUT: .Self = %Self
  320. // CHECK:STDOUT: .V = @V.%assoc0
  321. // CHECK:STDOUT: witness = (%V)
  322. // CHECK:STDOUT:
  323. // CHECK:STDOUT: !requires:
  324. // CHECK:STDOUT: }
  325. // CHECK:STDOUT:
  326. // CHECK:STDOUT: generic assoc_const @V(@I.%Self: %I.type) {
  327. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.ab9)]
  328. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.d31)]
  329. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %Self.binding.as_type [symbolic = %require_complete (constants.%require_complete.4df)]
  330. // CHECK:STDOUT:
  331. // CHECK:STDOUT: assoc_const V:! @V.%Self.binding.as_type (%Self.binding.as_type.d31);
  332. // CHECK:STDOUT: }
  333. // CHECK:STDOUT:
  334. // CHECK:STDOUT: impl @empty_struct_type.as.I.impl: %.loc15_7.2 as %.loc15_14.1 {
  335. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%impl_witness_assoc_constant), @empty_struct_type.as.I.impl [concrete]
  336. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness]
  337. // CHECK:STDOUT: %.loc15_14.2: %empty_struct_type = converted constants.%int_0, <error> [concrete = <error>]
  338. // CHECK:STDOUT: %impl_witness_assoc_constant: <error> = impl_witness_assoc_constant <error> [concrete = <error>]
  339. // CHECK:STDOUT:
  340. // CHECK:STDOUT: !members:
  341. // CHECK:STDOUT: witness = %I.impl_witness
  342. // CHECK:STDOUT: }
  343. // CHECK:STDOUT:
  344. // CHECK:STDOUT: specific @V(constants.%Self.ab9) {
  345. // CHECK:STDOUT: %Self => constants.%Self.ab9
  346. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type.d31
  347. // CHECK:STDOUT: %require_complete => constants.%require_complete.4df
  348. // CHECK:STDOUT: }
  349. // CHECK:STDOUT:
  350. // CHECK:STDOUT: specific @V(constants.%.Self) {
  351. // CHECK:STDOUT: %Self => constants.%.Self
  352. // CHECK:STDOUT: %Self.binding.as_type => constants.%.Self.binding.as_type
  353. // CHECK:STDOUT: %require_complete => constants.%require_complete.716
  354. // CHECK:STDOUT: }
  355. // CHECK:STDOUT:
  356. // CHECK:STDOUT: specific @V(constants.%I.facet) {
  357. // CHECK:STDOUT: %Self => constants.%I.facet
  358. // CHECK:STDOUT: %Self.binding.as_type => constants.%empty_struct_type
  359. // CHECK:STDOUT: %require_complete => constants.%complete_type
  360. // CHECK:STDOUT: }
  361. // CHECK:STDOUT:
  362. // CHECK:STDOUT: --- fail_assoc_const_not_constant_after_conversion.carbon
  363. // CHECK:STDOUT:
  364. // CHECK:STDOUT: constants {
  365. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  366. // CHECK:STDOUT: %Self.ab9: %I.type = symbolic_binding Self, 0 [symbolic]
  367. // CHECK:STDOUT: %Self.binding.as_type.d31: type = symbolic_binding_type Self, 0, %Self.ab9 [symbolic]
  368. // CHECK:STDOUT: %require_complete.4df: <witness> = require_complete_type %Self.binding.as_type.d31 [symbolic]
  369. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  370. // CHECK:STDOUT: %assoc0.8a1: %I.assoc_type = assoc_entity element0, @I.%V [concrete]
  371. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  372. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  373. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  374. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  375. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  376. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  377. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  378. // CHECK:STDOUT: %ImplicitAs.type.20a: type = facet_type <@ImplicitAs, @ImplicitAs(%C)> [concrete]
  379. // CHECK:STDOUT: %ImplicitAs.impl_witness: <witness> = impl_witness @empty_tuple.type.as.ImplicitAs.impl.%ImplicitAs.impl_witness_table [concrete]
  380. // CHECK:STDOUT: %ImplicitAs.Convert.type.f13: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%C) [concrete]
  381. // CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete]
  382. // CHECK:STDOUT: %.887: form = init_form %C, call_param1 [concrete]
  383. // CHECK:STDOUT: %pattern_type.7c7: type = pattern_type %C [concrete]
  384. // CHECK:STDOUT: %empty_tuple.type.as.ImplicitAs.impl.Convert.type: type = fn_type @empty_tuple.type.as.ImplicitAs.impl.Convert [concrete]
  385. // CHECK:STDOUT: %empty_tuple.type.as.ImplicitAs.impl.Convert: %empty_tuple.type.as.ImplicitAs.impl.Convert.type = struct_value () [concrete]
  386. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.20a = facet_value %empty_tuple.type, (%ImplicitAs.impl_witness) [concrete]
  387. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  388. // CHECK:STDOUT: %C.val: %C = struct_value () [concrete]
  389. // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self]
  390. // CHECK:STDOUT: %.Self.binding.as_type: type = symbolic_binding_type .Self, %.Self [symbolic_self]
  391. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %.Self, @I [symbolic_self]
  392. // CHECK:STDOUT: %require_complete.716: <witness> = require_complete_type %.Self.binding.as_type [symbolic_self]
  393. // CHECK:STDOUT: %impl.elem0: %.Self.binding.as_type = impl_witness_access %I.lookup_impl_witness, element0 [symbolic_self]
  394. // CHECK:STDOUT: %I_where.type: type = facet_type <@I where %impl.elem0 = %empty_tuple> [concrete]
  395. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness @C.as.I.impl.%I.impl_witness_table [concrete]
  396. // CHECK:STDOUT: %I.facet: %I.type = facet_value %C, (%I.impl_witness) [concrete]
  397. // CHECK:STDOUT: %.697: type = fn_type_with_self_type %ImplicitAs.Convert.type.f13, %ImplicitAs.facet [concrete]
  398. // CHECK:STDOUT: %empty_tuple.type.as.ImplicitAs.impl.Convert.bound: <bound method> = bound_method %empty_tuple, %empty_tuple.type.as.ImplicitAs.impl.Convert [concrete]
  399. // CHECK:STDOUT: }
  400. // CHECK:STDOUT:
  401. // CHECK:STDOUT: imports {
  402. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  403. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  404. // CHECK:STDOUT: import Core//prelude
  405. // CHECK:STDOUT: import Core//prelude/...
  406. // CHECK:STDOUT: }
  407. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  408. // CHECK:STDOUT: }
  409. // CHECK:STDOUT:
  410. // CHECK:STDOUT: file {
  411. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  412. // CHECK:STDOUT: .Core = imports.%Core
  413. // CHECK:STDOUT: .I = %I.decl
  414. // CHECK:STDOUT: .C = %C.decl
  415. // CHECK:STDOUT: }
  416. // CHECK:STDOUT: %Core.import = import Core
  417. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  418. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  419. // CHECK:STDOUT: impl_decl @empty_tuple.type.as.ImplicitAs.impl [concrete] {} {
  420. // CHECK:STDOUT: %.loc10_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  421. // CHECK:STDOUT: %.loc10_7.2: type = converted %.loc10_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  422. // CHECK:STDOUT: %Core.ref: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
  423. // CHECK:STDOUT: %ImplicitAs.ref: %ImplicitAs.type.cc7 = name_ref ImplicitAs, imports.%Core.ImplicitAs [concrete = constants.%ImplicitAs.generic]
  424. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  425. // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%C)> [concrete = constants.%ImplicitAs.type.20a]
  426. // CHECK:STDOUT: }
  427. // CHECK:STDOUT: impl_decl @C.as.I.impl [concrete] {} {
  428. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  429. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  430. // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  431. // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  432. // CHECK:STDOUT: %V.ref: %I.assoc_type = name_ref V, @V.%assoc0 [concrete = constants.%assoc0.8a1]
  433. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.binding.as_type]
  434. // CHECK:STDOUT: %.loc18_19: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.binding.as_type]
  435. // CHECK:STDOUT: %impl.elem0.loc18_19: %.Self.binding.as_type = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  436. // CHECK:STDOUT: %.loc18_25.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  437. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple]
  438. // CHECK:STDOUT: %.loc18_25.2: %empty_tuple.type = converted %.loc18_25.1, %empty_tuple [concrete = constants.%empty_tuple]
  439. // CHECK:STDOUT: %.loc18_13.1: type = where_expr %.Self [concrete = constants.%I_where.type] {
  440. // CHECK:STDOUT: requirement_base_facet_type constants.%I.type
  441. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc18_19, %.loc18_25.2
  442. // CHECK:STDOUT: }
  443. // CHECK:STDOUT: }
  444. // CHECK:STDOUT: }
  445. // CHECK:STDOUT:
  446. // CHECK:STDOUT: interface @I {
  447. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = constants.%Self.ab9]
  448. // CHECK:STDOUT: %V: @V.%Self.binding.as_type (%Self.binding.as_type.d31) = assoc_const_decl @V [concrete] {
  449. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%V [concrete = constants.%assoc0.8a1]
  450. // CHECK:STDOUT: }
  451. // CHECK:STDOUT:
  452. // CHECK:STDOUT: !members:
  453. // CHECK:STDOUT: .Self = %Self
  454. // CHECK:STDOUT: .V = @V.%assoc0
  455. // CHECK:STDOUT: witness = (%V)
  456. // CHECK:STDOUT:
  457. // CHECK:STDOUT: !requires:
  458. // CHECK:STDOUT: }
  459. // CHECK:STDOUT:
  460. // CHECK:STDOUT: generic assoc_const @V(@I.%Self: %I.type) {
  461. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.ab9)]
  462. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.d31)]
  463. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %Self.binding.as_type [symbolic = %require_complete (constants.%require_complete.4df)]
  464. // CHECK:STDOUT:
  465. // CHECK:STDOUT: assoc_const V:! @V.%Self.binding.as_type (%Self.binding.as_type.d31);
  466. // CHECK:STDOUT: }
  467. // CHECK:STDOUT:
  468. // CHECK:STDOUT: impl @empty_tuple.type.as.ImplicitAs.impl: %.loc10_7.2 as %ImplicitAs.type {
  469. // 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] {
  470. // CHECK:STDOUT: %self.patt: %pattern_type.cb1 = value_binding_pattern self [concrete]
  471. // CHECK:STDOUT: %self.param_patt: %pattern_type.cb1 = value_param_pattern %self.patt, call_param0 [concrete]
  472. // CHECK:STDOUT: %return.patt: %pattern_type.7c7 = return_slot_pattern [concrete]
  473. // CHECK:STDOUT: %return.param_patt: %pattern_type.7c7 = out_param_pattern %return.patt, call_param1 [concrete]
  474. // CHECK:STDOUT: } {
  475. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  476. // CHECK:STDOUT: %.loc11_29: form = init_form %C.ref, call_param1 [concrete = constants.%.887]
  477. // CHECK:STDOUT: %self.param: %empty_tuple.type = value_param call_param0
  478. // CHECK:STDOUT: %.loc11_21.1: type = splice_block %.loc11_21.3 [concrete = constants.%empty_tuple.type] {
  479. // CHECK:STDOUT: %.loc11_21.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  480. // CHECK:STDOUT: %.loc11_21.3: type = converted %.loc11_21.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  481. // CHECK:STDOUT: }
  482. // CHECK:STDOUT: %self: %empty_tuple.type = value_binding self, %self.param
  483. // CHECK:STDOUT: %return.param: ref %C = out_param call_param1
  484. // CHECK:STDOUT: %return: ref %C = return_slot %return.param
  485. // CHECK:STDOUT: }
  486. // CHECK:STDOUT: %ImplicitAs.impl_witness_table = impl_witness_table (%empty_tuple.type.as.ImplicitAs.impl.Convert.decl), @empty_tuple.type.as.ImplicitAs.impl [concrete]
  487. // CHECK:STDOUT: %ImplicitAs.impl_witness: <witness> = impl_witness %ImplicitAs.impl_witness_table [concrete = constants.%ImplicitAs.impl_witness]
  488. // CHECK:STDOUT:
  489. // CHECK:STDOUT: !members:
  490. // CHECK:STDOUT: .C = <poisoned>
  491. // CHECK:STDOUT: .Convert = %empty_tuple.type.as.ImplicitAs.impl.Convert.decl
  492. // CHECK:STDOUT: witness = %ImplicitAs.impl_witness
  493. // CHECK:STDOUT: }
  494. // CHECK:STDOUT:
  495. // CHECK:STDOUT: impl @C.as.I.impl: %C.ref as %.loc18_13.1 {
  496. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%impl_witness_assoc_constant), @C.as.I.impl [concrete]
  497. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness]
  498. // CHECK:STDOUT: %impl.elem0.loc18_13: %.697 = impl_witness_access constants.%ImplicitAs.impl_witness, element0 [concrete = constants.%empty_tuple.type.as.ImplicitAs.impl.Convert]
  499. // CHECK:STDOUT: %bound_method: <bound method> = bound_method constants.%empty_tuple, %impl.elem0.loc18_13 [concrete = constants.%empty_tuple.type.as.ImplicitAs.impl.Convert.bound]
  500. // CHECK:STDOUT: %.loc18_13.2: ref %C = temporary_storage
  501. // CHECK:STDOUT: %empty_tuple.type.as.ImplicitAs.impl.Convert.call: init %C = call %bound_method(constants.%empty_tuple) to %.loc18_13.2
  502. // CHECK:STDOUT: %.loc18_13.3: init %C = converted constants.%empty_tuple, %empty_tuple.type.as.ImplicitAs.impl.Convert.call
  503. // CHECK:STDOUT: %.loc18_13.4: ref %C = temporary %.loc18_13.2, %.loc18_13.3
  504. // CHECK:STDOUT: %.loc18_13.5: %C = acquire_value %.loc18_13.4
  505. // CHECK:STDOUT: %impl_witness_assoc_constant: <error> = impl_witness_assoc_constant <error> [concrete = <error>]
  506. // CHECK:STDOUT:
  507. // CHECK:STDOUT: !members:
  508. // CHECK:STDOUT: witness = %I.impl_witness
  509. // CHECK:STDOUT: }
  510. // CHECK:STDOUT:
  511. // CHECK:STDOUT: class @C {
  512. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  513. // CHECK:STDOUT: complete_type_witness = %complete_type
  514. // CHECK:STDOUT:
  515. // CHECK:STDOUT: !members:
  516. // CHECK:STDOUT: .Self = constants.%C
  517. // CHECK:STDOUT: }
  518. // CHECK:STDOUT:
  519. // CHECK:STDOUT: fn @empty_tuple.type.as.ImplicitAs.impl.Convert(%self.param: %empty_tuple.type) -> %return.param: %C {
  520. // CHECK:STDOUT: !entry:
  521. // CHECK:STDOUT: %.loc11_41.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  522. // CHECK:STDOUT: %.loc11_41.2: init %C = class_init (), %return.param [concrete = constants.%C.val]
  523. // CHECK:STDOUT: %.loc11_42: init %C = converted %.loc11_41.1, %.loc11_41.2 [concrete = constants.%C.val]
  524. // CHECK:STDOUT: return %.loc11_42 to %return.param
  525. // CHECK:STDOUT: }
  526. // CHECK:STDOUT:
  527. // CHECK:STDOUT: specific @V(constants.%Self.ab9) {
  528. // CHECK:STDOUT: %Self => constants.%Self.ab9
  529. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type.d31
  530. // CHECK:STDOUT: %require_complete => constants.%require_complete.4df
  531. // CHECK:STDOUT: }
  532. // CHECK:STDOUT:
  533. // CHECK:STDOUT: specific @V(constants.%.Self) {
  534. // CHECK:STDOUT: %Self => constants.%.Self
  535. // CHECK:STDOUT: %Self.binding.as_type => constants.%.Self.binding.as_type
  536. // CHECK:STDOUT: %require_complete => constants.%require_complete.716
  537. // CHECK:STDOUT: }
  538. // CHECK:STDOUT:
  539. // CHECK:STDOUT: specific @V(constants.%I.facet) {
  540. // CHECK:STDOUT: %Self => constants.%I.facet
  541. // CHECK:STDOUT: %Self.binding.as_type => constants.%C
  542. // CHECK:STDOUT: %require_complete => constants.%complete_type
  543. // CHECK:STDOUT: }
  544. // CHECK:STDOUT:
  545. // CHECK:STDOUT: --- fail_monomorphization_failure.carbon
  546. // CHECK:STDOUT:
  547. // CHECK:STDOUT: constants {
  548. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  549. // CHECK:STDOUT: %.Self.c39: %type = symbolic_binding .Self [symbolic_self]
  550. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  551. // CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [concrete]
  552. // CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [concrete]
  553. // CHECK:STDOUT: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic]
  554. // CHECK:STDOUT: %pattern_type.dc0: type = pattern_type Core.IntLiteral [concrete]
  555. // CHECK:STDOUT: %I.type.609: type = generic_interface_type @I [concrete]
  556. // CHECK:STDOUT: %I.generic: %I.type.609 = struct_value () [concrete]
  557. // CHECK:STDOUT: %I.type.68b: type = facet_type <@I, @I(%N)> [symbolic]
  558. // CHECK:STDOUT: %Self.cad: %I.type.68b = symbolic_binding Self, 1 [symbolic]
  559. // CHECK:STDOUT: %Self.binding.as_type.6f3: type = symbolic_binding_type Self, 1, %Self.cad [symbolic]
  560. // CHECK:STDOUT: %array_type: type = array_type %N, %Self.binding.as_type.6f3 [symbolic]
  561. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %array_type [symbolic]
  562. // CHECK:STDOUT: %I.assoc_type.223: type = assoc_entity_type @I, @I(%N) [symbolic]
  563. // CHECK:STDOUT: %assoc0.e69: %I.assoc_type.223 = assoc_entity element0, @I.%V [symbolic]
  564. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  565. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  566. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete]
  567. // CHECK:STDOUT: %Negate.type: type = facet_type <@Negate> [concrete]
  568. // CHECK:STDOUT: %Negate.Op.type: type = fn_type @Negate.Op [concrete]
  569. // CHECK:STDOUT: %Negate.impl_witness: <witness> = impl_witness imports.%Negate.impl_witness_table [concrete]
  570. // CHECK:STDOUT: %Negate.facet: %Negate.type = facet_value Core.IntLiteral, (%Negate.impl_witness) [concrete]
  571. // CHECK:STDOUT: %.826: type = fn_type_with_self_type %Negate.Op.type, %Negate.facet [concrete]
  572. // CHECK:STDOUT: %Core.IntLiteral.as.Negate.impl.Op.type: type = fn_type @Core.IntLiteral.as.Negate.impl.Op [concrete]
  573. // CHECK:STDOUT: %Core.IntLiteral.as.Negate.impl.Op: %Core.IntLiteral.as.Negate.impl.Op.type = struct_value () [concrete]
  574. // CHECK:STDOUT: %Core.IntLiteral.as.Negate.impl.Op.bound: <bound method> = bound_method %int_1, %Core.IntLiteral.as.Negate.impl.Op [concrete]
  575. // CHECK:STDOUT: %int_-1: Core.IntLiteral = int_value -1 [concrete]
  576. // CHECK:STDOUT: %I.type.54b: type = facet_type <@I, @I(%int_-1)> [concrete]
  577. // CHECK:STDOUT: %.Self.6e0: %I.type.54b = symbolic_binding .Self [symbolic_self]
  578. // CHECK:STDOUT: %Self.575: %I.type.54b = symbolic_binding Self, 1 [symbolic]
  579. // CHECK:STDOUT: %I.assoc_type.e1a: type = assoc_entity_type @I, @I(%int_-1) [concrete]
  580. // CHECK:STDOUT: %assoc0.209: %I.assoc_type.e1a = assoc_entity element0, @I.%V [concrete]
  581. // CHECK:STDOUT: %.Self.binding.as_type: type = symbolic_binding_type .Self, %.Self.6e0 [symbolic_self]
  582. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %.Self.6e0, @I, @I(%int_-1) [symbolic_self]
  583. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  584. // CHECK:STDOUT: }
  585. // CHECK:STDOUT:
  586. // CHECK:STDOUT: imports {
  587. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  588. // CHECK:STDOUT: .IntLiteral = %Core.IntLiteral
  589. // CHECK:STDOUT: .Negate = %Core.Negate
  590. // CHECK:STDOUT: import Core//prelude
  591. // CHECK:STDOUT: import Core//prelude/...
  592. // CHECK:STDOUT: }
  593. // CHECK:STDOUT: %Core.IntLiteral: %IntLiteral.type = import_ref Core//prelude/parts/int_literal, IntLiteral, loaded [concrete = constants.%IntLiteral]
  594. // CHECK:STDOUT: %Core.Negate: type = import_ref Core//prelude/parts/int_literal, Negate, loaded [concrete = constants.%Negate.type]
  595. // CHECK:STDOUT: %Core.import_ref.abd = import_ref Core//prelude/parts/int_literal, loc{{\d+_\d+}}, unloaded
  596. // CHECK:STDOUT: %Core.import_ref.82e: %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]
  597. // CHECK:STDOUT: %Negate.impl_witness_table = impl_witness_table (%Core.import_ref.abd, %Core.import_ref.82e), @Core.IntLiteral.as.Negate.impl [concrete]
  598. // CHECK:STDOUT: }
  599. // CHECK:STDOUT:
  600. // CHECK:STDOUT: file {
  601. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  602. // CHECK:STDOUT: .Core = imports.%Core
  603. // CHECK:STDOUT: .I = %I.decl
  604. // CHECK:STDOUT: }
  605. // CHECK:STDOUT: %Core.import = import Core
  606. // CHECK:STDOUT: %I.decl: %I.type.609 = interface_decl @I [concrete = constants.%I.generic] {
  607. // CHECK:STDOUT: %N.patt: %pattern_type.dc0 = symbolic_binding_pattern N, 0 [concrete]
  608. // CHECK:STDOUT: } {
  609. // CHECK:STDOUT: %.loc4_33.1: type = splice_block %.loc4_33.3 [concrete = Core.IntLiteral] {
  610. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.c39]
  611. // CHECK:STDOUT: %Core.ref: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
  612. // CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%Core.IntLiteral [concrete = constants.%IntLiteral]
  613. // CHECK:STDOUT: %IntLiteral.call: init type = call %IntLiteral.ref() [concrete = Core.IntLiteral]
  614. // CHECK:STDOUT: %.loc4_33.2: type = value_of_initializer %IntLiteral.call [concrete = Core.IntLiteral]
  615. // CHECK:STDOUT: %.loc4_33.3: type = converted %IntLiteral.call, %.loc4_33.2 [concrete = Core.IntLiteral]
  616. // CHECK:STDOUT: }
  617. // CHECK:STDOUT: %N.loc4_13.2: Core.IntLiteral = symbolic_binding N, 0 [symbolic = %N.loc4_13.1 (constants.%N)]
  618. // CHECK:STDOUT: }
  619. // CHECK:STDOUT: impl_decl @empty_struct_type.as.<error>.impl [concrete] {} {
  620. // CHECK:STDOUT: %.loc15_7.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  621. // CHECK:STDOUT: %.loc15_7.2: type = converted %.loc15_7.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  622. // CHECK:STDOUT: %I.ref: %I.type.609 = name_ref I, file.%I.decl [concrete = constants.%I.generic]
  623. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
  624. // CHECK:STDOUT: %impl.elem1: %.826 = impl_witness_access constants.%Negate.impl_witness, element1 [concrete = constants.%Core.IntLiteral.as.Negate.impl.Op]
  625. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1, %impl.elem1 [concrete = constants.%Core.IntLiteral.as.Negate.impl.Op.bound]
  626. // CHECK:STDOUT: %Core.IntLiteral.as.Negate.impl.Op.call: init Core.IntLiteral = call %bound_method(%int_1) [concrete = constants.%int_-1]
  627. // CHECK:STDOUT: %.loc15_16.1: Core.IntLiteral = value_of_initializer %Core.IntLiteral.as.Negate.impl.Op.call [concrete = constants.%int_-1]
  628. // CHECK:STDOUT: %.loc15_16.2: Core.IntLiteral = converted %Core.IntLiteral.as.Negate.impl.Op.call, %.loc15_16.1 [concrete = constants.%int_-1]
  629. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(constants.%int_-1)> [concrete = constants.%I.type.54b]
  630. // CHECK:STDOUT: %.Self: %I.type.54b = symbolic_binding .Self [symbolic_self = constants.%.Self.6e0]
  631. // CHECK:STDOUT: %.Self.ref: %I.type.54b = name_ref .Self, %.Self [symbolic_self = constants.%.Self.6e0]
  632. // CHECK:STDOUT: %.loc15_24.1: %I.assoc_type.e1a = specific_constant @V.%assoc0, @I(constants.%int_-1) [concrete = constants.%assoc0.209]
  633. // CHECK:STDOUT: %V.ref: %I.assoc_type.e1a = name_ref V, %.loc15_24.1 [concrete = constants.%assoc0.209]
  634. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.binding.as_type]
  635. // CHECK:STDOUT: %.loc15_24.2: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.binding.as_type]
  636. // CHECK:STDOUT: %impl.elem0: <error> = impl_witness_access constants.%I.lookup_impl_witness, element0 [concrete = <error>]
  637. // CHECK:STDOUT: %.loc15_30: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  638. // CHECK:STDOUT: %.loc15_18: type = where_expr %.Self [concrete = <error>] {
  639. // CHECK:STDOUT: requirement_base_facet_type constants.%I.type.54b
  640. // CHECK:STDOUT: requirement_rewrite %impl.elem0, <error>
  641. // CHECK:STDOUT: }
  642. // CHECK:STDOUT: }
  643. // CHECK:STDOUT: }
  644. // CHECK:STDOUT:
  645. // CHECK:STDOUT: generic interface @I(%N.loc4_13.2: Core.IntLiteral) {
  646. // CHECK:STDOUT: %N.loc4_13.1: Core.IntLiteral = symbolic_binding N, 0 [symbolic = %N.loc4_13.1 (constants.%N)]
  647. // CHECK:STDOUT:
  648. // CHECK:STDOUT: !definition:
  649. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%N.loc4_13.1)> [symbolic = %I.type (constants.%I.type.68b)]
  650. // CHECK:STDOUT: %Self.loc4_36.2: @I.%I.type (%I.type.68b) = symbolic_binding Self, 1 [symbolic = %Self.loc4_36.2 (constants.%Self.cad)]
  651. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I, @I(%N.loc4_13.1) [symbolic = %I.assoc_type (constants.%I.assoc_type.223)]
  652. // CHECK:STDOUT: %assoc0: @I.%I.assoc_type (%I.assoc_type.223) = assoc_entity element0, %V [symbolic = %assoc0 (constants.%assoc0.e69)]
  653. // CHECK:STDOUT:
  654. // CHECK:STDOUT: interface {
  655. // CHECK:STDOUT: %Self.loc4_36.1: @I.%I.type (%I.type.68b) = symbolic_binding Self, 1 [symbolic = %Self.loc4_36.2 (constants.%Self.cad)]
  656. // CHECK:STDOUT: %V: @V.%array_type (%array_type) = assoc_const_decl @V [concrete] {
  657. // CHECK:STDOUT: %assoc0: @I.%I.assoc_type (%I.assoc_type.223) = assoc_entity element0, @I.%V [symbolic = @I.%assoc0 (constants.%assoc0.e69)]
  658. // CHECK:STDOUT: }
  659. // CHECK:STDOUT:
  660. // CHECK:STDOUT: !members:
  661. // CHECK:STDOUT: .Self = %Self.loc4_36.1
  662. // CHECK:STDOUT: .N = <poisoned>
  663. // CHECK:STDOUT: .V = @V.%assoc0
  664. // CHECK:STDOUT: witness = (%V)
  665. // CHECK:STDOUT:
  666. // CHECK:STDOUT: !requires:
  667. // CHECK:STDOUT: }
  668. // CHECK:STDOUT: }
  669. // CHECK:STDOUT:
  670. // CHECK:STDOUT: generic assoc_const @V(@I.%N.loc4_13.2: Core.IntLiteral, @I.%Self.loc4_36.1: @I.%I.type (%I.type.68b)) {
  671. // CHECK:STDOUT: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic = %N (constants.%N)]
  672. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%N)> [symbolic = %I.type (constants.%I.type.68b)]
  673. // CHECK:STDOUT: %Self: @V.%I.type (%I.type.68b) = symbolic_binding Self, 1 [symbolic = %Self (constants.%Self.cad)]
  674. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.6f3)]
  675. // CHECK:STDOUT: %array_type: type = array_type %N, %Self.binding.as_type [symbolic = %array_type (constants.%array_type)]
  676. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %array_type [symbolic = %require_complete (constants.%require_complete)]
  677. // CHECK:STDOUT:
  678. // CHECK:STDOUT: assoc_const V:! @V.%array_type (%array_type);
  679. // CHECK:STDOUT: }
  680. // CHECK:STDOUT:
  681. // CHECK:STDOUT: impl @empty_struct_type.as.<error>.impl: %.loc15_7.2 as %.loc15_18 {
  682. // CHECK:STDOUT: !members:
  683. // CHECK:STDOUT: witness = <error>
  684. // CHECK:STDOUT: }
  685. // CHECK:STDOUT:
  686. // CHECK:STDOUT: specific @I(constants.%N) {
  687. // CHECK:STDOUT: %N.loc4_13.1 => constants.%N
  688. // CHECK:STDOUT: }
  689. // CHECK:STDOUT:
  690. // CHECK:STDOUT: specific @V(constants.%N, constants.%Self.cad) {
  691. // CHECK:STDOUT: %N => constants.%N
  692. // CHECK:STDOUT: %I.type => constants.%I.type.68b
  693. // CHECK:STDOUT: %Self => constants.%Self.cad
  694. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type.6f3
  695. // CHECK:STDOUT: %array_type => constants.%array_type
  696. // CHECK:STDOUT: %require_complete => constants.%require_complete
  697. // CHECK:STDOUT: }
  698. // CHECK:STDOUT:
  699. // CHECK:STDOUT: specific @I(constants.%int_-1) {
  700. // CHECK:STDOUT: %N.loc4_13.1 => constants.%int_-1
  701. // CHECK:STDOUT:
  702. // CHECK:STDOUT: !definition:
  703. // CHECK:STDOUT: %I.type => constants.%I.type.54b
  704. // CHECK:STDOUT: %Self.loc4_36.2 => constants.%Self.575
  705. // CHECK:STDOUT: %I.assoc_type => constants.%I.assoc_type.e1a
  706. // CHECK:STDOUT: %assoc0 => constants.%assoc0.209
  707. // CHECK:STDOUT: }
  708. // CHECK:STDOUT:
  709. // CHECK:STDOUT: specific @V(constants.%int_-1, constants.%.Self.6e0) {
  710. // CHECK:STDOUT: %N => constants.%int_-1
  711. // CHECK:STDOUT: %I.type => constants.%I.type.54b
  712. // CHECK:STDOUT: %Self => constants.%.Self.6e0
  713. // CHECK:STDOUT: %Self.binding.as_type => constants.%.Self.binding.as_type
  714. // CHECK:STDOUT: %array_type => <error>
  715. // CHECK:STDOUT: %require_complete => <error>
  716. // CHECK:STDOUT: }
  717. // CHECK:STDOUT:
  718. // CHECK:STDOUT: --- fail_todo_constrained_fn.carbon
  719. // CHECK:STDOUT:
  720. // CHECK:STDOUT: constants {
  721. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  722. // CHECK:STDOUT: %Self.ab9: %I.type = symbolic_binding Self, 0 [symbolic]
  723. // CHECK:STDOUT: %Self.binding.as_type.d31: type = symbolic_binding_type Self, 0, %Self.ab9 [symbolic]
  724. // CHECK:STDOUT: %require_complete.4df: <witness> = require_complete_type %Self.binding.as_type.d31 [symbolic]
  725. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  726. // CHECK:STDOUT: %assoc0.8a1: %I.assoc_type = assoc_entity element0, @I.%V [concrete]
  727. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  728. // CHECK:STDOUT: %.Self.c39: %type = symbolic_binding .Self [symbolic_self]
  729. // CHECK:STDOUT: %.Self.1dc: %I.type = symbolic_binding .Self [symbolic_self]
  730. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  731. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  732. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  733. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  734. // CHECK:STDOUT: %.Self.binding.as_type: type = symbolic_binding_type .Self, %.Self.1dc [symbolic_self]
  735. // CHECK:STDOUT: %ImplicitAs.type.d65: type = facet_type <@ImplicitAs, @ImplicitAs(%.Self.binding.as_type)> [symbolic_self]
  736. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %.Self.1dc, @I [symbolic_self]
  737. // CHECK:STDOUT: %require_complete.716: <witness> = require_complete_type %.Self.binding.as_type [symbolic_self]
  738. // CHECK:STDOUT: %impl.elem0: %.Self.binding.as_type = impl_witness_access %I.lookup_impl_witness, element0 [symbolic_self]
  739. // CHECK:STDOUT: %I_where.type: type = facet_type <@I where %impl.elem0 = %empty_struct and TODO> [concrete]
  740. // CHECK:STDOUT: %T: %I_where.type = symbolic_binding T, 0 [symbolic]
  741. // CHECK:STDOUT: %pattern_type.d53: type = pattern_type %I_where.type [concrete]
  742. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  743. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  744. // CHECK:STDOUT: %CallF.type: type = fn_type @CallF [concrete]
  745. // CHECK:STDOUT: %CallF: %CallF.type = struct_value () [concrete]
  746. // CHECK:STDOUT: }
  747. // CHECK:STDOUT:
  748. // CHECK:STDOUT: imports {
  749. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  750. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  751. // CHECK:STDOUT: import Core//prelude
  752. // CHECK:STDOUT: import Core//prelude/...
  753. // CHECK:STDOUT: }
  754. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  755. // CHECK:STDOUT: }
  756. // CHECK:STDOUT:
  757. // CHECK:STDOUT: file {
  758. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  759. // CHECK:STDOUT: .Core = imports.%Core
  760. // CHECK:STDOUT: .I = %I.decl
  761. // CHECK:STDOUT: .F = %F.decl
  762. // CHECK:STDOUT: .CallF = %CallF.decl
  763. // CHECK:STDOUT: }
  764. // CHECK:STDOUT: %Core.import = import Core
  765. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  766. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  767. // CHECK:STDOUT: %T.patt: %pattern_type.d53 = symbolic_binding_pattern T, 0 [concrete]
  768. // CHECK:STDOUT: } {
  769. // CHECK:STDOUT: %.loc8_12.1: type = splice_block %.loc8_12.2 [concrete = constants.%I_where.type] {
  770. // CHECK:STDOUT: %.Self.1: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.c39]
  771. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  772. // CHECK:STDOUT: %.Self.2: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.1dc]
  773. // CHECK:STDOUT: %.loc8_19.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  774. // CHECK:STDOUT: %Core.ref: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
  775. // CHECK:STDOUT: %ImplicitAs.ref: %ImplicitAs.type.cc7 = name_ref ImplicitAs, imports.%Core.ImplicitAs [concrete = constants.%ImplicitAs.generic]
  776. // CHECK:STDOUT: %.Self.ref.loc8_43: %I.type = name_ref .Self, %.Self.2 [symbolic_self = constants.%.Self.1dc]
  777. // CHECK:STDOUT: %.Self.as_type.loc8_48: type = facet_access_type %.Self.ref.loc8_43 [symbolic_self = constants.%.Self.binding.as_type]
  778. // CHECK:STDOUT: %.loc8_48: type = converted %.Self.ref.loc8_43, %.Self.as_type.loc8_48 [symbolic_self = constants.%.Self.binding.as_type]
  779. // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%.Self.binding.as_type)> [symbolic_self = constants.%ImplicitAs.type.d65]
  780. // CHECK:STDOUT: %.loc8_19.2: type = converted %.loc8_19.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  781. // CHECK:STDOUT: %.Self.ref.loc8_54: %I.type = name_ref .Self, %.Self.2 [symbolic_self = constants.%.Self.1dc]
  782. // CHECK:STDOUT: %V.ref: %I.assoc_type = name_ref V, @V.%assoc0 [concrete = constants.%assoc0.8a1]
  783. // CHECK:STDOUT: %.Self.as_type.loc8_54: type = facet_access_type %.Self.ref.loc8_54 [symbolic_self = constants.%.Self.binding.as_type]
  784. // CHECK:STDOUT: %.loc8_54: type = converted %.Self.ref.loc8_54, %.Self.as_type.loc8_54 [symbolic_self = constants.%.Self.binding.as_type]
  785. // CHECK:STDOUT: %impl.elem0: %.Self.binding.as_type = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  786. // CHECK:STDOUT: %.loc8_60.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  787. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete = constants.%empty_struct]
  788. // CHECK:STDOUT: %.loc8_60.2: %empty_struct_type = converted %.loc8_60.1, %empty_struct [concrete = constants.%empty_struct]
  789. // CHECK:STDOUT: %.loc8_12.2: type = where_expr %.Self.2 [concrete = constants.%I_where.type] {
  790. // CHECK:STDOUT: requirement_base_facet_type constants.%I.type
  791. // CHECK:STDOUT: requirement_impls %.loc8_19.2, %ImplicitAs.type
  792. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc8_60.2
  793. // CHECK:STDOUT: }
  794. // CHECK:STDOUT: }
  795. // CHECK:STDOUT: %T.loc8_6.2: %I_where.type = symbolic_binding T, 0 [symbolic = %T.loc8_6.1 (constants.%T)]
  796. // CHECK:STDOUT: }
  797. // CHECK:STDOUT: %CallF.decl: %CallF.type = fn_decl @CallF [concrete = constants.%CallF] {} {}
  798. // CHECK:STDOUT: }
  799. // CHECK:STDOUT:
  800. // CHECK:STDOUT: interface @I {
  801. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = constants.%Self.ab9]
  802. // CHECK:STDOUT: %V: @V.%Self.binding.as_type (%Self.binding.as_type.d31) = assoc_const_decl @V [concrete] {
  803. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%V [concrete = constants.%assoc0.8a1]
  804. // CHECK:STDOUT: }
  805. // CHECK:STDOUT:
  806. // CHECK:STDOUT: !members:
  807. // CHECK:STDOUT: .Self = %Self
  808. // CHECK:STDOUT: .V = @V.%assoc0
  809. // CHECK:STDOUT: witness = (%V)
  810. // CHECK:STDOUT:
  811. // CHECK:STDOUT: !requires:
  812. // CHECK:STDOUT: }
  813. // CHECK:STDOUT:
  814. // CHECK:STDOUT: generic assoc_const @V(@I.%Self: %I.type) {
  815. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.ab9)]
  816. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.d31)]
  817. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %Self.binding.as_type [symbolic = %require_complete (constants.%require_complete.4df)]
  818. // CHECK:STDOUT:
  819. // CHECK:STDOUT: assoc_const V:! @V.%Self.binding.as_type (%Self.binding.as_type.d31);
  820. // CHECK:STDOUT: }
  821. // CHECK:STDOUT:
  822. // CHECK:STDOUT: generic fn @F(%T.loc8_6.2: %I_where.type) {
  823. // CHECK:STDOUT: %T.loc8_6.1: %I_where.type = symbolic_binding T, 0 [symbolic = %T.loc8_6.1 (constants.%T)]
  824. // CHECK:STDOUT:
  825. // CHECK:STDOUT: fn();
  826. // CHECK:STDOUT: }
  827. // CHECK:STDOUT:
  828. // CHECK:STDOUT: fn @CallF() {
  829. // CHECK:STDOUT: !entry:
  830. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
  831. // CHECK:STDOUT: %.loc19: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  832. // CHECK:STDOUT: return
  833. // CHECK:STDOUT: }
  834. // CHECK:STDOUT:
  835. // CHECK:STDOUT: specific @V(constants.%Self.ab9) {
  836. // CHECK:STDOUT: %Self => constants.%Self.ab9
  837. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type.d31
  838. // CHECK:STDOUT: %require_complete => constants.%require_complete.4df
  839. // CHECK:STDOUT: }
  840. // CHECK:STDOUT:
  841. // CHECK:STDOUT: specific @V(constants.%.Self.1dc) {
  842. // CHECK:STDOUT: %Self => constants.%.Self.1dc
  843. // CHECK:STDOUT: %Self.binding.as_type => constants.%.Self.binding.as_type
  844. // CHECK:STDOUT: %require_complete => constants.%require_complete.716
  845. // CHECK:STDOUT: }
  846. // CHECK:STDOUT:
  847. // CHECK:STDOUT: specific @F(constants.%T) {
  848. // CHECK:STDOUT: %T.loc8_6.1 => constants.%T
  849. // CHECK:STDOUT: }
  850. // CHECK:STDOUT: