assoc_const_self.carbon 54 KB

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