generic.carbon 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon
  6. // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
  7. // EXTRA-ARGS: --dump-sem-ir-ranges=if-present
  8. //
  9. // AUTOUPDATE
  10. // TIP: To test this file alone, run:
  11. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/generic.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/generic.carbon
  14. // --- generic.carbon
  15. library "[[@TEST_NAME]]";
  16. interface Simple(T:! type) {}
  17. class X {}
  18. interface WithAssocFn(T:! type) {
  19. // TODO: Take `Self`, return `T`, once that works.
  20. fn F() -> X;
  21. }
  22. class C {
  23. impl as Simple(C) {}
  24. impl as WithAssocFn(C) {
  25. fn F() -> X {
  26. return {};
  27. }
  28. }
  29. }
  30. interface WithImplicitArgs[T:! type](N:! T);
  31. fn Receive(unused T:! Simple(C)) {}
  32. fn Pass(T:! Simple(C)) {
  33. Receive(T);
  34. }
  35. // --- fail_mismatched_args.carbon
  36. library "[[@TEST_NAME]]";
  37. interface Generic(T:! type) {}
  38. class A {}
  39. class B {}
  40. fn F(T:! Generic(A));
  41. fn G(T:! Generic(B)) {
  42. // CHECK:STDERR: fail_mismatched_args.carbon:[[@LINE+7]]:3: error: cannot convert type `T` that implements `Generic(B)` into type implementing `Generic(A)` [ConversionFailureFacetToFacet]
  43. // CHECK:STDERR: F(T);
  44. // CHECK:STDERR: ^~~~
  45. // CHECK:STDERR: fail_mismatched_args.carbon:[[@LINE-5]]:6: note: initializing generic parameter `T` declared here [InitializingGenericParam]
  46. // CHECK:STDERR: fn F(T:! Generic(A));
  47. // CHECK:STDERR: ^~~~~~~~~~~~~~
  48. // CHECK:STDERR:
  49. F(T);
  50. }
  51. // --- fail_args_count_mismatch.carbon
  52. library "[[@TEST_NAME]]";
  53. interface Generic(T:! type) {}
  54. // CHECK:STDERR: fail_args_count_mismatch.carbon:[[@LINE+7]]:17: error: 2 arguments passed to generic interface expecting 1 argument [CallArgCountMismatch]
  55. // CHECK:STDERR: fn F(unused T:! Generic((), ())) {}
  56. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  57. // CHECK:STDERR: fail_args_count_mismatch.carbon:[[@LINE-5]]:1: note: calling generic interface declared here [InCallToEntity]
  58. // CHECK:STDERR: interface Generic(T:! type) {}
  59. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  60. // CHECK:STDERR:
  61. fn F(unused T:! Generic((), ())) {}
  62. // CHECK:STDOUT: --- generic.carbon
  63. // CHECK:STDOUT:
  64. // CHECK:STDOUT: constants {
  65. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  66. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self]
  67. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  68. // CHECK:STDOUT: %T.67d: type = symbolic_binding T, 0 [symbolic]
  69. // CHECK:STDOUT: %Simple.type.673: type = generic_interface_type @Simple [concrete]
  70. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  71. // CHECK:STDOUT: %Simple.generic: %Simple.type.673 = struct_value () [concrete]
  72. // CHECK:STDOUT: %Simple.type.e29: type = facet_type <@Simple, @Simple(%T.67d)> [symbolic]
  73. // CHECK:STDOUT: %Self.862: %Simple.type.e29 = symbolic_binding Self, 1 [symbolic]
  74. // CHECK:STDOUT: %X: type = class_type @X [concrete]
  75. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  76. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  77. // CHECK:STDOUT: %WithAssocFn.type.daa: type = generic_interface_type @WithAssocFn [concrete]
  78. // CHECK:STDOUT: %WithAssocFn.generic: %WithAssocFn.type.daa = struct_value () [concrete]
  79. // CHECK:STDOUT: %WithAssocFn.type.d36: type = facet_type <@WithAssocFn, @WithAssocFn(%T.67d)> [symbolic]
  80. // CHECK:STDOUT: %Self.629: %WithAssocFn.type.d36 = symbolic_binding Self, 1 [symbolic]
  81. // CHECK:STDOUT: %.a1b: Core.Form = init_form %X [concrete]
  82. // CHECK:STDOUT: %pattern_type.05f: type = pattern_type %X [concrete]
  83. // CHECK:STDOUT: %WithAssocFn.WithSelf.F.type.6c9: type = fn_type @WithAssocFn.WithSelf.F, @WithAssocFn.WithSelf(%T.67d, %Self.629) [symbolic]
  84. // CHECK:STDOUT: %WithAssocFn.WithSelf.F.6d9: %WithAssocFn.WithSelf.F.type.6c9 = struct_value () [symbolic]
  85. // CHECK:STDOUT: %WithAssocFn.assoc_type.b93: type = assoc_entity_type @WithAssocFn, @WithAssocFn(%T.67d) [symbolic]
  86. // CHECK:STDOUT: %assoc0.395: %WithAssocFn.assoc_type.b93 = assoc_entity element0, @WithAssocFn.WithSelf.%WithAssocFn.WithSelf.F.decl [symbolic]
  87. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  88. // CHECK:STDOUT: %Simple.type.12a: type = facet_type <@Simple, @Simple(%C)> [concrete]
  89. // CHECK:STDOUT: %Simple.impl_witness: <witness> = impl_witness @C.as.Simple.impl.%Simple.impl_witness_table [concrete]
  90. // CHECK:STDOUT: %Self.0b4: %Simple.type.12a = symbolic_binding Self, 1 [symbolic]
  91. // CHECK:STDOUT: %Simple.facet: %Simple.type.12a = facet_value %C, (%Simple.impl_witness) [concrete]
  92. // CHECK:STDOUT: %WithAssocFn.type.19d: type = facet_type <@WithAssocFn, @WithAssocFn(%C)> [concrete]
  93. // CHECK:STDOUT: %WithAssocFn.impl_witness: <witness> = impl_witness @C.as.WithAssocFn.impl.%WithAssocFn.impl_witness_table [concrete]
  94. // CHECK:STDOUT: %Self.63e: %WithAssocFn.type.19d = symbolic_binding Self, 1 [symbolic]
  95. // CHECK:STDOUT: %WithAssocFn.WithSelf.F.type.836: type = fn_type @WithAssocFn.WithSelf.F, @WithAssocFn.WithSelf(%C, %Self.629) [symbolic]
  96. // CHECK:STDOUT: %WithAssocFn.WithSelf.F.a5a: %WithAssocFn.WithSelf.F.type.836 = struct_value () [symbolic]
  97. // CHECK:STDOUT: %WithAssocFn.assoc_type.cc0: type = assoc_entity_type @WithAssocFn, @WithAssocFn(%C) [concrete]
  98. // CHECK:STDOUT: %assoc0.50d: %WithAssocFn.assoc_type.cc0 = assoc_entity element0, @WithAssocFn.WithSelf.%WithAssocFn.WithSelf.F.decl [concrete]
  99. // CHECK:STDOUT: %C.as.WithAssocFn.impl.F.type: type = fn_type @C.as.WithAssocFn.impl.F [concrete]
  100. // CHECK:STDOUT: %C.as.WithAssocFn.impl.F: %C.as.WithAssocFn.impl.F.type = struct_value () [concrete]
  101. // CHECK:STDOUT: %WithAssocFn.facet: %WithAssocFn.type.19d = facet_value %C, (%WithAssocFn.impl_witness) [concrete]
  102. // CHECK:STDOUT: %WithAssocFn.WithSelf.F.type.a47: type = fn_type @WithAssocFn.WithSelf.F, @WithAssocFn.WithSelf(%C, %WithAssocFn.facet) [concrete]
  103. // CHECK:STDOUT: %WithAssocFn.WithSelf.F.975: %WithAssocFn.WithSelf.F.type.a47 = struct_value () [concrete]
  104. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  105. // CHECK:STDOUT: %X.val: %X = struct_value () [concrete]
  106. // CHECK:STDOUT: %pattern_type.51d: type = pattern_type %T.67d [symbolic]
  107. // CHECK:STDOUT: %N: %T.67d = symbolic_binding N, 1 [symbolic]
  108. // CHECK:STDOUT: %WithImplicitArgs.type: type = generic_interface_type @WithImplicitArgs [concrete]
  109. // CHECK:STDOUT: %WithImplicitArgs.generic: %WithImplicitArgs.type = struct_value () [concrete]
  110. // CHECK:STDOUT: %pattern_type.08a: type = pattern_type %Simple.type.12a [concrete]
  111. // CHECK:STDOUT: %T.7608f6.1: %Simple.type.12a = symbolic_binding T, 0 [symbolic]
  112. // CHECK:STDOUT: %T.7608f6.2: %Simple.type.12a = symbolic_binding T, 0 [symbolic]
  113. // CHECK:STDOUT: %Receive.type: type = fn_type @Receive [concrete]
  114. // CHECK:STDOUT: %Receive: %Receive.type = struct_value () [concrete]
  115. // CHECK:STDOUT: %Pass.type: type = fn_type @Pass [concrete]
  116. // CHECK:STDOUT: %Pass: %Pass.type = struct_value () [concrete]
  117. // CHECK:STDOUT: %Receive.specific_fn: <specific function> = specific_function %Receive, @Receive(%T.7608f6.1) [symbolic]
  118. // CHECK:STDOUT: }
  119. // CHECK:STDOUT:
  120. // CHECK:STDOUT: file {
  121. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  122. // CHECK:STDOUT: .Simple = %Simple.decl
  123. // CHECK:STDOUT: .X = %X.decl
  124. // CHECK:STDOUT: .WithAssocFn = %WithAssocFn.decl
  125. // CHECK:STDOUT: .C = %C.decl
  126. // CHECK:STDOUT: .WithImplicitArgs = %WithImplicitArgs.decl
  127. // CHECK:STDOUT: .Receive = %Receive.decl
  128. // CHECK:STDOUT: .Pass = %Pass.decl
  129. // CHECK:STDOUT: }
  130. // CHECK:STDOUT: %Simple.decl: %Simple.type.673 = interface_decl @Simple [concrete = constants.%Simple.generic] {
  131. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  132. // CHECK:STDOUT: } {
  133. // CHECK:STDOUT: %.loc4_22.1: type = splice_block %.loc4_22.2 [concrete = type] {
  134. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  135. // CHECK:STDOUT: %.loc4_22.2: type = type_literal type [concrete = type]
  136. // CHECK:STDOUT: }
  137. // CHECK:STDOUT: %T.loc4_19.2: type = symbolic_binding T, 0 [symbolic = %T.loc4_19.1 (constants.%T.67d)]
  138. // CHECK:STDOUT: }
  139. // CHECK:STDOUT: %X.decl: type = class_decl @X [concrete = constants.%X] {} {}
  140. // CHECK:STDOUT: %WithAssocFn.decl: %WithAssocFn.type.daa = interface_decl @WithAssocFn [concrete = constants.%WithAssocFn.generic] {
  141. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  142. // CHECK:STDOUT: } {
  143. // CHECK:STDOUT: %.loc8_27.1: type = splice_block %.loc8_27.2 [concrete = type] {
  144. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  145. // CHECK:STDOUT: %.loc8_27.2: type = type_literal type [concrete = type]
  146. // CHECK:STDOUT: }
  147. // CHECK:STDOUT: %T.loc8_24.2: type = symbolic_binding T, 0 [symbolic = %T.loc8_24.1 (constants.%T.67d)]
  148. // CHECK:STDOUT: }
  149. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  150. // CHECK:STDOUT: %WithImplicitArgs.decl: %WithImplicitArgs.type = interface_decl @WithImplicitArgs [concrete = constants.%WithImplicitArgs.generic] {
  151. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  152. // CHECK:STDOUT: %N.patt: @WithImplicitArgs.%pattern_type (%pattern_type.51d) = symbolic_binding_pattern N, 1 [concrete]
  153. // CHECK:STDOUT: } {
  154. // CHECK:STDOUT: %.loc22_32.1: type = splice_block %.loc22_32.2 [concrete = type] {
  155. // CHECK:STDOUT: %.Self.2: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  156. // CHECK:STDOUT: %.loc22_32.2: type = type_literal type [concrete = type]
  157. // CHECK:STDOUT: }
  158. // CHECK:STDOUT: %T.loc22_29.2: type = symbolic_binding T, 0 [symbolic = %T.loc22_29.1 (constants.%T.67d)]
  159. // CHECK:STDOUT: %.loc22_42: type = splice_block %T.ref [symbolic = %T.loc22_29.1 (constants.%T.67d)] {
  160. // CHECK:STDOUT: %.Self.1: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  161. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc22_29.2 [symbolic = %T.loc22_29.1 (constants.%T.67d)]
  162. // CHECK:STDOUT: }
  163. // CHECK:STDOUT: %N.loc22_39.2: @WithImplicitArgs.%T.loc22_29.1 (%T.67d) = symbolic_binding N, 1 [symbolic = %N.loc22_39.1 (constants.%N)]
  164. // CHECK:STDOUT: }
  165. // CHECK:STDOUT: %Receive.decl: %Receive.type = fn_decl @Receive [concrete = constants.%Receive] {
  166. // CHECK:STDOUT: %T.patt: %pattern_type.08a = symbolic_binding_pattern T, 0 [concrete]
  167. // CHECK:STDOUT: } {
  168. // CHECK:STDOUT: %.loc24: type = splice_block %Simple.type [concrete = constants.%Simple.type.12a] {
  169. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  170. // CHECK:STDOUT: %Simple.ref: %Simple.type.673 = name_ref Simple, file.%Simple.decl [concrete = constants.%Simple.generic]
  171. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  172. // CHECK:STDOUT: %Simple.type: type = facet_type <@Simple, @Simple(constants.%C)> [concrete = constants.%Simple.type.12a]
  173. // CHECK:STDOUT: }
  174. // CHECK:STDOUT: %T.loc24_20.3: %Simple.type.12a = symbolic_binding T, 0 [symbolic = %T.loc24_20.2 (constants.%T.7608f6.2)]
  175. // CHECK:STDOUT: }
  176. // CHECK:STDOUT: %Pass.decl: %Pass.type = fn_decl @Pass [concrete = constants.%Pass] {
  177. // CHECK:STDOUT: %T.patt: %pattern_type.08a = symbolic_binding_pattern T, 0 [concrete]
  178. // CHECK:STDOUT: } {
  179. // CHECK:STDOUT: %.loc25: type = splice_block %Simple.type [concrete = constants.%Simple.type.12a] {
  180. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  181. // CHECK:STDOUT: %Simple.ref: %Simple.type.673 = name_ref Simple, file.%Simple.decl [concrete = constants.%Simple.generic]
  182. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  183. // CHECK:STDOUT: %Simple.type: type = facet_type <@Simple, @Simple(constants.%C)> [concrete = constants.%Simple.type.12a]
  184. // CHECK:STDOUT: }
  185. // CHECK:STDOUT: %T.loc25_10.2: %Simple.type.12a = symbolic_binding T, 0 [symbolic = %T.loc25_10.1 (constants.%T.7608f6.1)]
  186. // CHECK:STDOUT: }
  187. // CHECK:STDOUT: }
  188. // CHECK:STDOUT:
  189. // CHECK:STDOUT: generic interface @Simple(%T.loc4_19.2: type) {
  190. // CHECK:STDOUT: %T.loc4_19.1: type = symbolic_binding T, 0 [symbolic = %T.loc4_19.1 (constants.%T.67d)]
  191. // CHECK:STDOUT:
  192. // CHECK:STDOUT: !definition:
  193. // CHECK:STDOUT: %Simple.type: type = facet_type <@Simple, @Simple(%T.loc4_19.1)> [symbolic = %Simple.type (constants.%Simple.type.e29)]
  194. // CHECK:STDOUT: %Self.loc4_28.2: @Simple.%Simple.type (%Simple.type.e29) = symbolic_binding Self, 1 [symbolic = %Self.loc4_28.2 (constants.%Self.862)]
  195. // CHECK:STDOUT:
  196. // CHECK:STDOUT: interface {
  197. // CHECK:STDOUT: %Self.loc4_28.1: @Simple.%Simple.type (%Simple.type.e29) = symbolic_binding Self, 1 [symbolic = %Self.loc4_28.2 (constants.%Self.862)]
  198. // CHECK:STDOUT: %Simple.WithSelf.decl = interface_with_self_decl @Simple [concrete]
  199. // CHECK:STDOUT:
  200. // CHECK:STDOUT: !members:
  201. // CHECK:STDOUT: .Self = %Self.loc4_28.1
  202. // CHECK:STDOUT: witness = ()
  203. // CHECK:STDOUT:
  204. // CHECK:STDOUT: !requires:
  205. // CHECK:STDOUT: }
  206. // CHECK:STDOUT: }
  207. // CHECK:STDOUT:
  208. // CHECK:STDOUT: generic interface @WithAssocFn(%T.loc8_24.2: type) {
  209. // CHECK:STDOUT: %T.loc8_24.1: type = symbolic_binding T, 0 [symbolic = %T.loc8_24.1 (constants.%T.67d)]
  210. // CHECK:STDOUT:
  211. // CHECK:STDOUT: !definition:
  212. // CHECK:STDOUT: %WithAssocFn.type: type = facet_type <@WithAssocFn, @WithAssocFn(%T.loc8_24.1)> [symbolic = %WithAssocFn.type (constants.%WithAssocFn.type.d36)]
  213. // CHECK:STDOUT: %Self.loc8_33.2: @WithAssocFn.%WithAssocFn.type (%WithAssocFn.type.d36) = symbolic_binding Self, 1 [symbolic = %Self.loc8_33.2 (constants.%Self.629)]
  214. // CHECK:STDOUT:
  215. // CHECK:STDOUT: interface {
  216. // CHECK:STDOUT: %Self.loc8_33.1: @WithAssocFn.%WithAssocFn.type (%WithAssocFn.type.d36) = symbolic_binding Self, 1 [symbolic = %Self.loc8_33.2 (constants.%Self.629)]
  217. // CHECK:STDOUT: %WithAssocFn.WithSelf.decl = interface_with_self_decl @WithAssocFn [concrete]
  218. // CHECK:STDOUT:
  219. // CHECK:STDOUT: !with Self:
  220. // CHECK:STDOUT: %WithAssocFn.WithSelf.F.decl: @WithAssocFn.WithSelf.%WithAssocFn.WithSelf.F.type (%WithAssocFn.WithSelf.F.type.6c9) = fn_decl @WithAssocFn.WithSelf.F [symbolic = @WithAssocFn.WithSelf.%WithAssocFn.WithSelf.F (constants.%WithAssocFn.WithSelf.F.6d9)] {
  221. // CHECK:STDOUT: %return.param_patt: %pattern_type.05f = out_param_pattern [concrete]
  222. // CHECK:STDOUT: %return.patt: %pattern_type.05f = return_slot_pattern %return.param_patt, %X.ref [concrete]
  223. // CHECK:STDOUT: } {
  224. // CHECK:STDOUT: %X.ref: type = name_ref X, file.%X.decl [concrete = constants.%X]
  225. // CHECK:STDOUT: %.loc10: Core.Form = init_form %X.ref [concrete = constants.%.a1b]
  226. // CHECK:STDOUT: %return.param: ref %X = out_param call_param0
  227. // CHECK:STDOUT: %return: ref %X = return_slot %return.param
  228. // CHECK:STDOUT: }
  229. // CHECK:STDOUT: %assoc0.loc10_14.1: @WithAssocFn.WithSelf.%WithAssocFn.assoc_type (%WithAssocFn.assoc_type.b93) = assoc_entity element0, %WithAssocFn.WithSelf.F.decl [symbolic = %assoc0.loc10_14.2 (constants.%assoc0.395)]
  230. // CHECK:STDOUT:
  231. // CHECK:STDOUT: !members:
  232. // CHECK:STDOUT: .Self = %Self.loc8_33.1
  233. // CHECK:STDOUT: .X = <poisoned>
  234. // CHECK:STDOUT: .X = <poisoned>
  235. // CHECK:STDOUT: .F = @WithAssocFn.WithSelf.%assoc0.loc10_14.1
  236. // CHECK:STDOUT: witness = (@WithAssocFn.WithSelf.%WithAssocFn.WithSelf.F.decl)
  237. // CHECK:STDOUT:
  238. // CHECK:STDOUT: !requires:
  239. // CHECK:STDOUT: }
  240. // CHECK:STDOUT: }
  241. // CHECK:STDOUT:
  242. // CHECK:STDOUT: generic interface @WithImplicitArgs(%T.loc22_29.2: type, %N.loc22_39.2: @WithImplicitArgs.%T.loc22_29.1 (%T.67d)) {
  243. // CHECK:STDOUT: %T.loc22_29.1: type = symbolic_binding T, 0 [symbolic = %T.loc22_29.1 (constants.%T.67d)]
  244. // CHECK:STDOUT: %N.loc22_39.1: @WithImplicitArgs.%T.loc22_29.1 (%T.67d) = symbolic_binding N, 1 [symbolic = %N.loc22_39.1 (constants.%N)]
  245. // CHECK:STDOUT: %pattern_type: type = pattern_type %T.loc22_29.1 [symbolic = %pattern_type (constants.%pattern_type.51d)]
  246. // CHECK:STDOUT:
  247. // CHECK:STDOUT: interface;
  248. // CHECK:STDOUT: }
  249. // CHECK:STDOUT:
  250. // CHECK:STDOUT: impl @C.as.Simple.impl: %Self.ref as %Simple.type {
  251. // CHECK:STDOUT: %Simple.impl_witness_table = impl_witness_table (), @C.as.Simple.impl [concrete]
  252. // CHECK:STDOUT: %Simple.impl_witness: <witness> = impl_witness %Simple.impl_witness_table [concrete = constants.%Simple.impl_witness]
  253. // CHECK:STDOUT:
  254. // CHECK:STDOUT: !members:
  255. // CHECK:STDOUT: witness = %Simple.impl_witness
  256. // CHECK:STDOUT: }
  257. // CHECK:STDOUT:
  258. // CHECK:STDOUT: impl @C.as.WithAssocFn.impl: %Self.ref as %WithAssocFn.type {
  259. // CHECK:STDOUT: %C.as.WithAssocFn.impl.F.decl: %C.as.WithAssocFn.impl.F.type = fn_decl @C.as.WithAssocFn.impl.F [concrete = constants.%C.as.WithAssocFn.impl.F] {
  260. // CHECK:STDOUT: %return.param_patt: %pattern_type.05f = out_param_pattern [concrete]
  261. // CHECK:STDOUT: %return.patt: %pattern_type.05f = return_slot_pattern %return.param_patt, %X.ref [concrete]
  262. // CHECK:STDOUT: } {
  263. // CHECK:STDOUT: %X.ref: type = name_ref X, file.%X.decl [concrete = constants.%X]
  264. // CHECK:STDOUT: %.loc16: Core.Form = init_form %X.ref [concrete = constants.%.a1b]
  265. // CHECK:STDOUT: %return.param: ref %X = out_param call_param0
  266. // CHECK:STDOUT: %return: ref %X = return_slot %return.param
  267. // CHECK:STDOUT: }
  268. // CHECK:STDOUT: %WithAssocFn.impl_witness_table = impl_witness_table (%C.as.WithAssocFn.impl.F.decl), @C.as.WithAssocFn.impl [concrete]
  269. // CHECK:STDOUT: %WithAssocFn.impl_witness: <witness> = impl_witness %WithAssocFn.impl_witness_table [concrete = constants.%WithAssocFn.impl_witness]
  270. // CHECK:STDOUT:
  271. // CHECK:STDOUT: !members:
  272. // CHECK:STDOUT: .X = <poisoned>
  273. // CHECK:STDOUT: .F = %C.as.WithAssocFn.impl.F.decl
  274. // CHECK:STDOUT: witness = %WithAssocFn.impl_witness
  275. // CHECK:STDOUT: }
  276. // CHECK:STDOUT:
  277. // CHECK:STDOUT: class @X {
  278. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  279. // CHECK:STDOUT: complete_type_witness = %complete_type
  280. // CHECK:STDOUT:
  281. // CHECK:STDOUT: !members:
  282. // CHECK:STDOUT: .Self = constants.%X
  283. // CHECK:STDOUT: }
  284. // CHECK:STDOUT:
  285. // CHECK:STDOUT: class @C {
  286. // CHECK:STDOUT: impl_decl @C.as.Simple.impl [concrete] {} {
  287. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [concrete = constants.%C]
  288. // CHECK:STDOUT: %Simple.ref: %Simple.type.673 = name_ref Simple, file.%Simple.decl [concrete = constants.%Simple.generic]
  289. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  290. // CHECK:STDOUT: %Simple.type: type = facet_type <@Simple, @Simple(constants.%C)> [concrete = constants.%Simple.type.12a]
  291. // CHECK:STDOUT: }
  292. // CHECK:STDOUT: impl_decl @C.as.WithAssocFn.impl [concrete] {} {
  293. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [concrete = constants.%C]
  294. // CHECK:STDOUT: %WithAssocFn.ref: %WithAssocFn.type.daa = name_ref WithAssocFn, file.%WithAssocFn.decl [concrete = constants.%WithAssocFn.generic]
  295. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  296. // CHECK:STDOUT: %WithAssocFn.type: type = facet_type <@WithAssocFn, @WithAssocFn(constants.%C)> [concrete = constants.%WithAssocFn.type.19d]
  297. // CHECK:STDOUT: }
  298. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  299. // CHECK:STDOUT: complete_type_witness = %complete_type
  300. // CHECK:STDOUT:
  301. // CHECK:STDOUT: !members:
  302. // CHECK:STDOUT: .Self = constants.%C
  303. // CHECK:STDOUT: .Simple = <poisoned>
  304. // CHECK:STDOUT: .C = <poisoned>
  305. // CHECK:STDOUT: .WithAssocFn = <poisoned>
  306. // CHECK:STDOUT: .X = <poisoned>
  307. // CHECK:STDOUT: }
  308. // CHECK:STDOUT:
  309. // CHECK:STDOUT: generic fn @WithAssocFn.WithSelf.F(@WithAssocFn.%T.loc8_24.2: type, @WithAssocFn.%Self.loc8_33.1: @WithAssocFn.%WithAssocFn.type (%WithAssocFn.type.d36)) {
  310. // CHECK:STDOUT: fn() -> out %return.param: %X;
  311. // CHECK:STDOUT: }
  312. // CHECK:STDOUT:
  313. // CHECK:STDOUT: fn @C.as.WithAssocFn.impl.F() -> out %return.param: %X {
  314. // CHECK:STDOUT: !entry:
  315. // CHECK:STDOUT: %.loc17_15.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  316. // CHECK:STDOUT: %.loc17_15.2: init %X to %return.param = class_init () [concrete = constants.%X.val]
  317. // CHECK:STDOUT: %.loc17_16: init %X = converted %.loc17_15.1, %.loc17_15.2 [concrete = constants.%X.val]
  318. // CHECK:STDOUT: return %.loc17_16 to %return.param
  319. // CHECK:STDOUT: }
  320. // CHECK:STDOUT:
  321. // CHECK:STDOUT: generic fn @Receive(%T.loc24_20.3: %Simple.type.12a) {
  322. // CHECK:STDOUT: %T.loc24_20.1: %Simple.type.12a = symbolic_binding T, 0 [symbolic = %T.loc24_20.1 (constants.%T.7608f6.1)]
  323. // CHECK:STDOUT: %T.loc24_20.2: %Simple.type.12a = symbolic_binding T, 0 [symbolic = %T.loc24_20.2 (constants.%T.7608f6.2)]
  324. // CHECK:STDOUT:
  325. // CHECK:STDOUT: !definition:
  326. // CHECK:STDOUT:
  327. // CHECK:STDOUT: fn() {
  328. // CHECK:STDOUT: !entry:
  329. // CHECK:STDOUT: return
  330. // CHECK:STDOUT: }
  331. // CHECK:STDOUT: }
  332. // CHECK:STDOUT:
  333. // CHECK:STDOUT: generic fn @Pass(%T.loc25_10.2: %Simple.type.12a) {
  334. // CHECK:STDOUT: %T.loc25_10.1: %Simple.type.12a = symbolic_binding T, 0 [symbolic = %T.loc25_10.1 (constants.%T.7608f6.1)]
  335. // CHECK:STDOUT:
  336. // CHECK:STDOUT: !definition:
  337. // CHECK:STDOUT: %Receive.specific_fn.loc26_3.2: <specific function> = specific_function constants.%Receive, @Receive(%T.loc25_10.1) [symbolic = %Receive.specific_fn.loc26_3.2 (constants.%Receive.specific_fn)]
  338. // CHECK:STDOUT:
  339. // CHECK:STDOUT: fn() {
  340. // CHECK:STDOUT: !entry:
  341. // CHECK:STDOUT: %Receive.ref: %Receive.type = name_ref Receive, file.%Receive.decl [concrete = constants.%Receive]
  342. // CHECK:STDOUT: %T.ref: %Simple.type.12a = name_ref T, %T.loc25_10.2 [symbolic = %T.loc25_10.1 (constants.%T.7608f6.1)]
  343. // CHECK:STDOUT: %Receive.specific_fn.loc26_3.1: <specific function> = specific_function %Receive.ref, @Receive(constants.%T.7608f6.1) [symbolic = %Receive.specific_fn.loc26_3.2 (constants.%Receive.specific_fn)]
  344. // CHECK:STDOUT: %Receive.call: init %empty_tuple.type = call %Receive.specific_fn.loc26_3.1()
  345. // CHECK:STDOUT: return
  346. // CHECK:STDOUT: }
  347. // CHECK:STDOUT: }
  348. // CHECK:STDOUT:
  349. // CHECK:STDOUT: specific @Simple(constants.%T.67d) {
  350. // CHECK:STDOUT: %T.loc4_19.1 => constants.%T.67d
  351. // CHECK:STDOUT: }
  352. // CHECK:STDOUT:
  353. // CHECK:STDOUT: specific @Simple.WithSelf(constants.%T.67d, constants.%Self.862) {}
  354. // CHECK:STDOUT:
  355. // CHECK:STDOUT: specific @WithAssocFn(constants.%T.67d) {
  356. // CHECK:STDOUT: %T.loc8_24.1 => constants.%T.67d
  357. // CHECK:STDOUT: }
  358. // CHECK:STDOUT:
  359. // CHECK:STDOUT: specific @WithAssocFn.WithSelf(constants.%T.67d, constants.%Self.629) {}
  360. // CHECK:STDOUT:
  361. // CHECK:STDOUT: specific @WithAssocFn.WithSelf.F(constants.%T.67d, constants.%Self.629) {}
  362. // CHECK:STDOUT:
  363. // CHECK:STDOUT: specific @Simple(constants.%C) {
  364. // CHECK:STDOUT: %T.loc4_19.1 => constants.%C
  365. // CHECK:STDOUT:
  366. // CHECK:STDOUT: !definition:
  367. // CHECK:STDOUT: %Simple.type => constants.%Simple.type.12a
  368. // CHECK:STDOUT: %Self.loc4_28.2 => constants.%Self.0b4
  369. // CHECK:STDOUT: }
  370. // CHECK:STDOUT:
  371. // CHECK:STDOUT: specific @Simple.WithSelf(constants.%C, constants.%Self.862) {
  372. // CHECK:STDOUT: !definition:
  373. // CHECK:STDOUT: }
  374. // CHECK:STDOUT:
  375. // CHECK:STDOUT: specific @Simple.WithSelf(constants.%C, constants.%Simple.facet) {
  376. // CHECK:STDOUT: !definition:
  377. // CHECK:STDOUT: }
  378. // CHECK:STDOUT:
  379. // CHECK:STDOUT: specific @WithAssocFn(constants.%C) {
  380. // CHECK:STDOUT: %T.loc8_24.1 => constants.%C
  381. // CHECK:STDOUT:
  382. // CHECK:STDOUT: !definition:
  383. // CHECK:STDOUT: %WithAssocFn.type => constants.%WithAssocFn.type.19d
  384. // CHECK:STDOUT: %Self.loc8_33.2 => constants.%Self.63e
  385. // CHECK:STDOUT: }
  386. // CHECK:STDOUT:
  387. // CHECK:STDOUT: specific @WithAssocFn.WithSelf(constants.%C, constants.%Self.629) {
  388. // CHECK:STDOUT: !definition:
  389. // CHECK:STDOUT: %T => constants.%C
  390. // CHECK:STDOUT: %WithAssocFn.type => constants.%WithAssocFn.type.19d
  391. // CHECK:STDOUT: %Self => constants.%Self.629
  392. // CHECK:STDOUT: %WithAssocFn.WithSelf.F.type => constants.%WithAssocFn.WithSelf.F.type.836
  393. // CHECK:STDOUT: %WithAssocFn.WithSelf.F => constants.%WithAssocFn.WithSelf.F.a5a
  394. // CHECK:STDOUT: %WithAssocFn.assoc_type => constants.%WithAssocFn.assoc_type.cc0
  395. // CHECK:STDOUT: %assoc0.loc10_14.2 => constants.%assoc0.50d
  396. // CHECK:STDOUT: }
  397. // CHECK:STDOUT:
  398. // CHECK:STDOUT: specific @WithAssocFn.WithSelf(constants.%C, constants.%WithAssocFn.facet) {
  399. // CHECK:STDOUT: !definition:
  400. // CHECK:STDOUT: %T => constants.%C
  401. // CHECK:STDOUT: %WithAssocFn.type => constants.%WithAssocFn.type.19d
  402. // CHECK:STDOUT: %Self => constants.%WithAssocFn.facet
  403. // CHECK:STDOUT: %WithAssocFn.WithSelf.F.type => constants.%WithAssocFn.WithSelf.F.type.a47
  404. // CHECK:STDOUT: %WithAssocFn.WithSelf.F => constants.%WithAssocFn.WithSelf.F.975
  405. // CHECK:STDOUT: %WithAssocFn.assoc_type => constants.%WithAssocFn.assoc_type.cc0
  406. // CHECK:STDOUT: %assoc0.loc10_14.2 => constants.%assoc0.50d
  407. // CHECK:STDOUT: }
  408. // CHECK:STDOUT:
  409. // CHECK:STDOUT: specific @WithAssocFn.WithSelf.F(constants.%C, constants.%WithAssocFn.facet) {}
  410. // CHECK:STDOUT:
  411. // CHECK:STDOUT: specific @WithImplicitArgs(constants.%T.67d, constants.%N) {
  412. // CHECK:STDOUT: %T.loc22_29.1 => constants.%T.67d
  413. // CHECK:STDOUT: %N.loc22_39.1 => constants.%N
  414. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.51d
  415. // CHECK:STDOUT: }
  416. // CHECK:STDOUT:
  417. // CHECK:STDOUT: specific @Receive(constants.%T.7608f6.2) {
  418. // CHECK:STDOUT: %T.loc24_20.1 => constants.%T.7608f6.2
  419. // CHECK:STDOUT: %T.loc24_20.2 => constants.%T.7608f6.2
  420. // CHECK:STDOUT: }
  421. // CHECK:STDOUT:
  422. // CHECK:STDOUT: specific @Pass(constants.%T.7608f6.1) {
  423. // CHECK:STDOUT: %T.loc25_10.1 => constants.%T.7608f6.1
  424. // CHECK:STDOUT: }
  425. // CHECK:STDOUT:
  426. // CHECK:STDOUT: specific @Receive(constants.%T.7608f6.1) {
  427. // CHECK:STDOUT: %T.loc24_20.1 => constants.%T.7608f6.1
  428. // CHECK:STDOUT: %T.loc24_20.2 => constants.%T.7608f6.1
  429. // CHECK:STDOUT:
  430. // CHECK:STDOUT: !definition:
  431. // CHECK:STDOUT: }
  432. // CHECK:STDOUT:
  433. // CHECK:STDOUT: --- fail_mismatched_args.carbon
  434. // CHECK:STDOUT:
  435. // CHECK:STDOUT: constants {
  436. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  437. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self]
  438. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  439. // CHECK:STDOUT: %T.67d: type = symbolic_binding T, 0 [symbolic]
  440. // CHECK:STDOUT: %Generic.type.835: type = generic_interface_type @Generic [concrete]
  441. // CHECK:STDOUT: %Generic.generic: %Generic.type.835 = struct_value () [concrete]
  442. // CHECK:STDOUT: %Generic.type.03d: type = facet_type <@Generic, @Generic(%T.67d)> [symbolic]
  443. // CHECK:STDOUT: %Self.15d: %Generic.type.03d = symbolic_binding Self, 1 [symbolic]
  444. // CHECK:STDOUT: %A: type = class_type @A [concrete]
  445. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  446. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  447. // CHECK:STDOUT: %B: type = class_type @B [concrete]
  448. // CHECK:STDOUT: %Generic.type.478: type = facet_type <@Generic, @Generic(%A)> [concrete]
  449. // CHECK:STDOUT: %pattern_type.708: type = pattern_type %Generic.type.478 [concrete]
  450. // CHECK:STDOUT: %T.c1d: %Generic.type.478 = symbolic_binding T, 0 [symbolic]
  451. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  452. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  453. // CHECK:STDOUT: %Generic.type.cb7: type = facet_type <@Generic, @Generic(%B)> [concrete]
  454. // CHECK:STDOUT: %pattern_type.0c9: type = pattern_type %Generic.type.cb7 [concrete]
  455. // CHECK:STDOUT: %T.3ee: %Generic.type.cb7 = symbolic_binding T, 0 [symbolic]
  456. // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
  457. // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
  458. // CHECK:STDOUT: %Self.b24: %Generic.type.cb7 = symbolic_binding Self, 1 [symbolic]
  459. // CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T.3ee [symbolic]
  460. // CHECK:STDOUT: }
  461. // CHECK:STDOUT:
  462. // CHECK:STDOUT: file {
  463. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  464. // CHECK:STDOUT: .Generic = %Generic.decl
  465. // CHECK:STDOUT: .A = %A.decl
  466. // CHECK:STDOUT: .B = %B.decl
  467. // CHECK:STDOUT: .F = %F.decl
  468. // CHECK:STDOUT: .G = %G.decl
  469. // CHECK:STDOUT: }
  470. // CHECK:STDOUT: %Generic.decl: %Generic.type.835 = interface_decl @Generic [concrete = constants.%Generic.generic] {
  471. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  472. // CHECK:STDOUT: } {
  473. // CHECK:STDOUT: %.loc4_23.1: type = splice_block %.loc4_23.2 [concrete = type] {
  474. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  475. // CHECK:STDOUT: %.loc4_23.2: type = type_literal type [concrete = type]
  476. // CHECK:STDOUT: }
  477. // CHECK:STDOUT: %T.loc4_20.2: type = symbolic_binding T, 0 [symbolic = %T.loc4_20.1 (constants.%T.67d)]
  478. // CHECK:STDOUT: }
  479. // CHECK:STDOUT: %A.decl: type = class_decl @A [concrete = constants.%A] {} {}
  480. // CHECK:STDOUT: %B.decl: type = class_decl @B [concrete = constants.%B] {} {}
  481. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  482. // CHECK:STDOUT: %T.patt: %pattern_type.708 = symbolic_binding_pattern T, 0 [concrete]
  483. // CHECK:STDOUT: } {
  484. // CHECK:STDOUT: %.loc9: type = splice_block %Generic.type [concrete = constants.%Generic.type.478] {
  485. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  486. // CHECK:STDOUT: %Generic.ref: %Generic.type.835 = name_ref Generic, file.%Generic.decl [concrete = constants.%Generic.generic]
  487. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A]
  488. // CHECK:STDOUT: %Generic.type: type = facet_type <@Generic, @Generic(constants.%A)> [concrete = constants.%Generic.type.478]
  489. // CHECK:STDOUT: }
  490. // CHECK:STDOUT: %T.loc9_7.2: %Generic.type.478 = symbolic_binding T, 0 [symbolic = %T.loc9_7.1 (constants.%T.c1d)]
  491. // CHECK:STDOUT: }
  492. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {
  493. // CHECK:STDOUT: %T.patt: %pattern_type.0c9 = symbolic_binding_pattern T, 0 [concrete]
  494. // CHECK:STDOUT: } {
  495. // CHECK:STDOUT: %.loc10: type = splice_block %Generic.type [concrete = constants.%Generic.type.cb7] {
  496. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  497. // CHECK:STDOUT: %Generic.ref: %Generic.type.835 = name_ref Generic, file.%Generic.decl [concrete = constants.%Generic.generic]
  498. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B]
  499. // CHECK:STDOUT: %Generic.type: type = facet_type <@Generic, @Generic(constants.%B)> [concrete = constants.%Generic.type.cb7]
  500. // CHECK:STDOUT: }
  501. // CHECK:STDOUT: %T.loc10_7.2: %Generic.type.cb7 = symbolic_binding T, 0 [symbolic = %T.loc10_7.1 (constants.%T.3ee)]
  502. // CHECK:STDOUT: }
  503. // CHECK:STDOUT: }
  504. // CHECK:STDOUT:
  505. // CHECK:STDOUT: generic interface @Generic(%T.loc4_20.2: type) {
  506. // CHECK:STDOUT: %T.loc4_20.1: type = symbolic_binding T, 0 [symbolic = %T.loc4_20.1 (constants.%T.67d)]
  507. // CHECK:STDOUT:
  508. // CHECK:STDOUT: !definition:
  509. // CHECK:STDOUT: %Generic.type: type = facet_type <@Generic, @Generic(%T.loc4_20.1)> [symbolic = %Generic.type (constants.%Generic.type.03d)]
  510. // CHECK:STDOUT: %Self.loc4_29.2: @Generic.%Generic.type (%Generic.type.03d) = symbolic_binding Self, 1 [symbolic = %Self.loc4_29.2 (constants.%Self.15d)]
  511. // CHECK:STDOUT:
  512. // CHECK:STDOUT: interface {
  513. // CHECK:STDOUT: %Self.loc4_29.1: @Generic.%Generic.type (%Generic.type.03d) = symbolic_binding Self, 1 [symbolic = %Self.loc4_29.2 (constants.%Self.15d)]
  514. // CHECK:STDOUT: %Generic.WithSelf.decl = interface_with_self_decl @Generic [concrete]
  515. // CHECK:STDOUT:
  516. // CHECK:STDOUT: !members:
  517. // CHECK:STDOUT: .Self = %Self.loc4_29.1
  518. // CHECK:STDOUT: witness = ()
  519. // CHECK:STDOUT:
  520. // CHECK:STDOUT: !requires:
  521. // CHECK:STDOUT: }
  522. // CHECK:STDOUT: }
  523. // CHECK:STDOUT:
  524. // CHECK:STDOUT: class @A {
  525. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  526. // CHECK:STDOUT: complete_type_witness = %complete_type
  527. // CHECK:STDOUT:
  528. // CHECK:STDOUT: !members:
  529. // CHECK:STDOUT: .Self = constants.%A
  530. // CHECK:STDOUT: }
  531. // CHECK:STDOUT:
  532. // CHECK:STDOUT: class @B {
  533. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  534. // CHECK:STDOUT: complete_type_witness = %complete_type
  535. // CHECK:STDOUT:
  536. // CHECK:STDOUT: !members:
  537. // CHECK:STDOUT: .Self = constants.%B
  538. // CHECK:STDOUT: }
  539. // CHECK:STDOUT:
  540. // CHECK:STDOUT: generic fn @F(%T.loc9_7.2: %Generic.type.478) {
  541. // CHECK:STDOUT: %T.loc9_7.1: %Generic.type.478 = symbolic_binding T, 0 [symbolic = %T.loc9_7.1 (constants.%T.c1d)]
  542. // CHECK:STDOUT:
  543. // CHECK:STDOUT: fn();
  544. // CHECK:STDOUT: }
  545. // CHECK:STDOUT:
  546. // CHECK:STDOUT: generic fn @G(%T.loc10_7.2: %Generic.type.cb7) {
  547. // CHECK:STDOUT: %T.loc10_7.1: %Generic.type.cb7 = symbolic_binding T, 0 [symbolic = %T.loc10_7.1 (constants.%T.3ee)]
  548. // CHECK:STDOUT:
  549. // CHECK:STDOUT: !definition:
  550. // CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T.loc10_7.1 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)]
  551. // CHECK:STDOUT:
  552. // CHECK:STDOUT: fn() {
  553. // CHECK:STDOUT: !entry:
  554. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
  555. // CHECK:STDOUT: %T.ref: %Generic.type.cb7 = name_ref T, %T.loc10_7.2 [symbolic = %T.loc10_7.1 (constants.%T.3ee)]
  556. // CHECK:STDOUT: %T.as_type: type = facet_access_type %T.ref [symbolic = %T.binding.as_type (constants.%T.binding.as_type)]
  557. // CHECK:STDOUT: return
  558. // CHECK:STDOUT: }
  559. // CHECK:STDOUT: }
  560. // CHECK:STDOUT:
  561. // CHECK:STDOUT: specific @Generic(constants.%T.67d) {
  562. // CHECK:STDOUT: %T.loc4_20.1 => constants.%T.67d
  563. // CHECK:STDOUT: }
  564. // CHECK:STDOUT:
  565. // CHECK:STDOUT: specific @Generic.WithSelf(constants.%T.67d, constants.%Self.15d) {}
  566. // CHECK:STDOUT:
  567. // CHECK:STDOUT: specific @Generic(constants.%A) {
  568. // CHECK:STDOUT: %T.loc4_20.1 => constants.%A
  569. // CHECK:STDOUT: }
  570. // CHECK:STDOUT:
  571. // CHECK:STDOUT: specific @F(constants.%T.c1d) {
  572. // CHECK:STDOUT: %T.loc9_7.1 => constants.%T.c1d
  573. // CHECK:STDOUT: }
  574. // CHECK:STDOUT:
  575. // CHECK:STDOUT: specific @Generic(constants.%B) {
  576. // CHECK:STDOUT: %T.loc4_20.1 => constants.%B
  577. // CHECK:STDOUT:
  578. // CHECK:STDOUT: !definition:
  579. // CHECK:STDOUT: %Generic.type => constants.%Generic.type.cb7
  580. // CHECK:STDOUT: %Self.loc4_29.2 => constants.%Self.b24
  581. // CHECK:STDOUT: }
  582. // CHECK:STDOUT:
  583. // CHECK:STDOUT: specific @G(constants.%T.3ee) {
  584. // CHECK:STDOUT: %T.loc10_7.1 => constants.%T.3ee
  585. // CHECK:STDOUT: }
  586. // CHECK:STDOUT:
  587. // CHECK:STDOUT: specific @Generic.WithSelf(constants.%B, constants.%Self.15d) {
  588. // CHECK:STDOUT: !definition:
  589. // CHECK:STDOUT: }
  590. // CHECK:STDOUT:
  591. // CHECK:STDOUT: --- fail_args_count_mismatch.carbon
  592. // CHECK:STDOUT:
  593. // CHECK:STDOUT: constants {
  594. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  595. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self]
  596. // CHECK:STDOUT: %pattern_type: type = pattern_type type [concrete]
  597. // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic]
  598. // CHECK:STDOUT: %Generic.type.835: type = generic_interface_type @Generic [concrete]
  599. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  600. // CHECK:STDOUT: %Generic.generic: %Generic.type.835 = struct_value () [concrete]
  601. // CHECK:STDOUT: %Generic.type.03d: type = facet_type <@Generic, @Generic(%T)> [symbolic]
  602. // CHECK:STDOUT: %Self: %Generic.type.03d = symbolic_binding Self, 1 [symbolic]
  603. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  604. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  605. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  606. // CHECK:STDOUT: }
  607. // CHECK:STDOUT:
  608. // CHECK:STDOUT: file {
  609. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  610. // CHECK:STDOUT: .Generic = %Generic.decl
  611. // CHECK:STDOUT: .F = %F.decl
  612. // CHECK:STDOUT: }
  613. // CHECK:STDOUT: %Generic.decl: %Generic.type.835 = interface_decl @Generic [concrete = constants.%Generic.generic] {
  614. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  615. // CHECK:STDOUT: } {
  616. // CHECK:STDOUT: %.loc3_23.1: type = splice_block %.loc3_23.2 [concrete = type] {
  617. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  618. // CHECK:STDOUT: %.loc3_23.2: type = type_literal type [concrete = type]
  619. // CHECK:STDOUT: }
  620. // CHECK:STDOUT: %T.loc3_20.2: type = symbolic_binding T, 0 [symbolic = %T.loc3_20.1 (constants.%T)]
  621. // CHECK:STDOUT: }
  622. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  623. // CHECK:STDOUT: %T.patt: <error> = symbolic_binding_pattern T, 0 [concrete]
  624. // CHECK:STDOUT: } {
  625. // CHECK:STDOUT: %.1: <error> = splice_block <error> [concrete = <error>] {
  626. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  627. // CHECK:STDOUT: %Generic.ref: %Generic.type.835 = name_ref Generic, file.%Generic.decl [concrete = constants.%Generic.generic]
  628. // CHECK:STDOUT: %.loc12_26: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  629. // CHECK:STDOUT: %.loc12_30: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  630. // CHECK:STDOUT: }
  631. // CHECK:STDOUT: %T: <error> = symbolic_binding T, 0 [concrete = <error>]
  632. // CHECK:STDOUT: }
  633. // CHECK:STDOUT: }
  634. // CHECK:STDOUT:
  635. // CHECK:STDOUT: generic interface @Generic(%T.loc3_20.2: type) {
  636. // CHECK:STDOUT: %T.loc3_20.1: type = symbolic_binding T, 0 [symbolic = %T.loc3_20.1 (constants.%T)]
  637. // CHECK:STDOUT:
  638. // CHECK:STDOUT: !definition:
  639. // CHECK:STDOUT: %Generic.type: type = facet_type <@Generic, @Generic(%T.loc3_20.1)> [symbolic = %Generic.type (constants.%Generic.type.03d)]
  640. // CHECK:STDOUT: %Self.loc3_29.2: @Generic.%Generic.type (%Generic.type.03d) = symbolic_binding Self, 1 [symbolic = %Self.loc3_29.2 (constants.%Self)]
  641. // CHECK:STDOUT:
  642. // CHECK:STDOUT: interface {
  643. // CHECK:STDOUT: %Self.loc3_29.1: @Generic.%Generic.type (%Generic.type.03d) = symbolic_binding Self, 1 [symbolic = %Self.loc3_29.2 (constants.%Self)]
  644. // CHECK:STDOUT: %Generic.WithSelf.decl = interface_with_self_decl @Generic [concrete]
  645. // CHECK:STDOUT:
  646. // CHECK:STDOUT: !members:
  647. // CHECK:STDOUT: .Self = %Self.loc3_29.1
  648. // CHECK:STDOUT: witness = ()
  649. // CHECK:STDOUT:
  650. // CHECK:STDOUT: !requires:
  651. // CHECK:STDOUT: }
  652. // CHECK:STDOUT: }
  653. // CHECK:STDOUT:
  654. // CHECK:STDOUT: generic fn @F(%T: <error>) {
  655. // CHECK:STDOUT: !definition:
  656. // CHECK:STDOUT:
  657. // CHECK:STDOUT: fn() {
  658. // CHECK:STDOUT: !entry:
  659. // CHECK:STDOUT: return
  660. // CHECK:STDOUT: }
  661. // CHECK:STDOUT: }
  662. // CHECK:STDOUT:
  663. // CHECK:STDOUT: specific @Generic(constants.%T) {
  664. // CHECK:STDOUT: %T.loc3_20.1 => constants.%T
  665. // CHECK:STDOUT: }
  666. // CHECK:STDOUT:
  667. // CHECK:STDOUT: specific @Generic.WithSelf(constants.%T, constants.%Self) {}
  668. // CHECK:STDOUT:
  669. // CHECK:STDOUT: specific @F(<error>) {}
  670. // CHECK:STDOUT: