fail_impl_bad_assoc_fn.carbon 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885
  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. // AUTOUPDATE
  6. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon
  10. interface I { fn F(); }
  11. class NoF {
  12. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:3: ERROR: Missing implementation of F in impl of interface I.
  13. // CHECK:STDERR: impl as I {}
  14. // CHECK:STDERR: ^~~~~~~~~~~
  15. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-6]]:15: Associated function F declared here.
  16. // CHECK:STDERR: interface I { fn F(); }
  17. // CHECK:STDERR: ^~~~~~~
  18. // CHECK:STDERR:
  19. impl as I {}
  20. }
  21. class FNotFunction {
  22. impl as I {
  23. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: ERROR: Associated function F implemented by non-function.
  24. // CHECK:STDERR: class F;
  25. // CHECK:STDERR: ^~~~~~~~
  26. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-18]]:15: Associated function F declared here.
  27. // CHECK:STDERR: interface I { fn F(); }
  28. // CHECK:STDERR: ^~~~~~~
  29. // CHECK:STDERR:
  30. class F;
  31. }
  32. }
  33. fn PossiblyF();
  34. // TODO: Should this be permitted?
  35. class FAlias {
  36. impl as I {
  37. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:11: ERROR: Associated function F implemented by non-function.
  38. // CHECK:STDERR: alias F = PossiblyF;
  39. // CHECK:STDERR: ^
  40. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-34]]:15: Associated function F declared here.
  41. // CHECK:STDERR: interface I { fn F(); }
  42. // CHECK:STDERR: ^~~~~~~
  43. // CHECK:STDERR:
  44. alias F = PossiblyF;
  45. }
  46. }
  47. class FExtraParam {
  48. impl as I {
  49. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: ERROR: Redeclaration differs because of parameter count of 1.
  50. // CHECK:STDERR: fn F(b: bool);
  51. // CHECK:STDERR: ^~~~~~~~~~~~~~
  52. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-47]]:15: Previously declared with parameter count of 0.
  53. // CHECK:STDERR: interface I { fn F(); }
  54. // CHECK:STDERR: ^~~~~~~
  55. // CHECK:STDERR:
  56. fn F(b: bool);
  57. }
  58. }
  59. class FExtraImplicitParam {
  60. impl as I {
  61. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: ERROR: Redeclaration differs because of implicit parameter list.
  62. // CHECK:STDERR: fn F[self: Self]();
  63. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
  64. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-60]]:15: Previously declared without implicit parameter list.
  65. // CHECK:STDERR: interface I { fn F(); }
  66. // CHECK:STDERR: ^~~~~~~
  67. // CHECK:STDERR:
  68. fn F[self: Self]();
  69. }
  70. }
  71. // TODO: Should this be permitted?
  72. class FExtraReturnType {
  73. impl as I {
  74. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: ERROR: Function redeclaration differs because return type is `bool`.
  75. // CHECK:STDERR: fn F() -> bool;
  76. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  77. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-74]]:15: Previously declared with no return type.
  78. // CHECK:STDERR: interface I { fn F(); }
  79. // CHECK:STDERR: ^~~~~~~
  80. // CHECK:STDERR:
  81. fn F() -> bool;
  82. }
  83. }
  84. interface J { fn F[self: bool](b: bool) -> bool; }
  85. class FMissingParam {
  86. impl as J {
  87. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: ERROR: Redeclaration differs because of parameter count of 0.
  88. // CHECK:STDERR: fn F[self: bool]() -> bool;
  89. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  90. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-7]]:15: Previously declared with parameter count of 1.
  91. // CHECK:STDERR: interface J { fn F[self: bool](b: bool) -> bool; }
  92. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  93. // CHECK:STDERR:
  94. fn F[self: bool]() -> bool;
  95. }
  96. }
  97. class FMissingImplicitParam {
  98. impl as J {
  99. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: ERROR: Redeclaration differs because of missing implicit parameter list.
  100. // CHECK:STDERR: fn F(b: bool) -> bool;
  101. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~
  102. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-20]]:15: Previously declared with implicit parameter list.
  103. // CHECK:STDERR: interface J { fn F[self: bool](b: bool) -> bool; }
  104. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  105. // CHECK:STDERR:
  106. fn F(b: bool) -> bool;
  107. }
  108. }
  109. class FMissingReturnType {
  110. impl as J {
  111. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: ERROR: Function redeclaration differs because no return type is provided.
  112. // CHECK:STDERR: fn F[self: bool](b: bool);
  113. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
  114. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-33]]:15: Previously declared with return type `bool`.
  115. // CHECK:STDERR: interface J { fn F[self: bool](b: bool) -> bool; }
  116. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  117. // CHECK:STDERR:
  118. fn F[self: bool](b: bool);
  119. }
  120. }
  121. class FDifferentParamType {
  122. impl as J {
  123. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:22: ERROR: Redeclaration differs at parameter 1.
  124. // CHECK:STDERR: fn F[self: bool](b: Self) -> bool;
  125. // CHECK:STDERR: ^
  126. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-46]]:32: Previous declaration's corresponding parameter here.
  127. // CHECK:STDERR: interface J { fn F[self: bool](b: bool) -> bool; }
  128. // CHECK:STDERR: ^
  129. // CHECK:STDERR:
  130. fn F[self: bool](b: Self) -> bool;
  131. }
  132. }
  133. class FDifferentImplicitParamType {
  134. impl as J {
  135. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:10: ERROR: Redeclaration differs at implicit parameter 1.
  136. // CHECK:STDERR: fn F[self: Self](b: bool) -> bool;
  137. // CHECK:STDERR: ^~~~
  138. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-59]]:20: Previous declaration's corresponding implicit parameter here.
  139. // CHECK:STDERR: interface J { fn F[self: bool](b: bool) -> bool; }
  140. // CHECK:STDERR: ^~~~
  141. // CHECK:STDERR:
  142. fn F[self: Self](b: bool) -> bool;
  143. }
  144. }
  145. class FDifferentReturnType {
  146. impl as J {
  147. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: ERROR: Function redeclaration differs because return type is `FDifferentReturnType`.
  148. // CHECK:STDERR: fn F[self: bool](b: bool) -> Self;
  149. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  150. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-72]]:15: Previously declared with return type `bool`.
  151. // CHECK:STDERR: interface J { fn F[self: bool](b: bool) -> bool; }
  152. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  153. // CHECK:STDERR:
  154. fn F[self: bool](b: bool) -> Self;
  155. }
  156. }
  157. // TODO: This should probably be permitted.
  158. class FDifferentParamName {
  159. impl as J {
  160. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:22: ERROR: Redeclaration differs at parameter 1.
  161. // CHECK:STDERR: fn F[self: bool](not_b: bool) -> bool;
  162. // CHECK:STDERR: ^~~~~
  163. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-86]]:32: Previous declaration's corresponding parameter here.
  164. // CHECK:STDERR: interface J { fn F[self: bool](b: bool) -> bool; }
  165. // CHECK:STDERR: ^
  166. // CHECK:STDERR:
  167. fn F[self: bool](not_b: bool) -> bool;
  168. }
  169. }
  170. interface SelfNested {
  171. fn F(x: (Self*, {.x: Self, .y: i32})) -> [Self; 4];
  172. }
  173. class SelfNestedBadParam {
  174. impl as SelfNested {
  175. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:10: ERROR: Redeclaration differs at parameter 1.
  176. // CHECK:STDERR: fn F(x: (SelfNestedBadParam*, {.x: i32, .y: i32})) -> [SelfNestedBadParam; 4];
  177. // CHECK:STDERR: ^
  178. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-8]]:8: Previous declaration's corresponding parameter here.
  179. // CHECK:STDERR: fn F(x: (Self*, {.x: Self, .y: i32})) -> [Self; 4];
  180. // CHECK:STDERR: ^
  181. // CHECK:STDERR:
  182. fn F(x: (SelfNestedBadParam*, {.x: i32, .y: i32})) -> [SelfNestedBadParam; 4];
  183. }
  184. }
  185. class SelfNestedBadReturnType {
  186. impl as SelfNested {
  187. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+6]]:5: ERROR: Function redeclaration differs because return type is `[SelfNestedBadParam; 4]`.
  188. // CHECK:STDERR: fn F(x: (SelfNestedBadReturnType*, {.x: SelfNestedBadReturnType, .y: i32})) -> [SelfNestedBadParam; 4];
  189. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  190. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-21]]:3: Previously declared with return type `[SelfNestedBadReturnType; 4]`.
  191. // CHECK:STDERR: fn F(x: (Self*, {.x: Self, .y: i32})) -> [Self; 4];
  192. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  193. fn F(x: (SelfNestedBadReturnType*, {.x: SelfNestedBadReturnType, .y: i32})) -> [SelfNestedBadParam; 4];
  194. }
  195. }
  196. // CHECK:STDOUT: --- fail_impl_bad_assoc_fn.carbon
  197. // CHECK:STDOUT:
  198. // CHECK:STDOUT: constants {
  199. // CHECK:STDOUT: %.1: type = interface_type @I [template]
  200. // CHECK:STDOUT: %Self.1: %.1 = bind_symbolic_name Self 0 [symbolic]
  201. // CHECK:STDOUT: %F.type.1: type = fn_type @F.1 [template]
  202. // CHECK:STDOUT: %.2: type = tuple_type () [template]
  203. // CHECK:STDOUT: %F.1: %F.type.1 = struct_value () [template]
  204. // CHECK:STDOUT: %.3: type = assoc_entity_type @I, %F.type.1 [template]
  205. // CHECK:STDOUT: %.4: %.3 = assoc_entity element0, @I.%F.decl [template]
  206. // CHECK:STDOUT: %NoF: type = class_type @NoF [template]
  207. // CHECK:STDOUT: %.5: type = struct_type {} [template]
  208. // CHECK:STDOUT: %FNotFunction: type = class_type @FNotFunction [template]
  209. // CHECK:STDOUT: %F.2: type = class_type @F.16 [template]
  210. // CHECK:STDOUT: %PossiblyF.type: type = fn_type @PossiblyF [template]
  211. // CHECK:STDOUT: %PossiblyF: %PossiblyF.type = struct_value () [template]
  212. // CHECK:STDOUT: %FAlias: type = class_type @FAlias [template]
  213. // CHECK:STDOUT: %FExtraParam: type = class_type @FExtraParam [template]
  214. // CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template]
  215. // CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template]
  216. // CHECK:STDOUT: %F.type.2: type = fn_type @F.2 [template]
  217. // CHECK:STDOUT: %F.3: %F.type.2 = struct_value () [template]
  218. // CHECK:STDOUT: %FExtraImplicitParam: type = class_type @FExtraImplicitParam [template]
  219. // CHECK:STDOUT: %F.type.3: type = fn_type @F.3 [template]
  220. // CHECK:STDOUT: %F.4: %F.type.3 = struct_value () [template]
  221. // CHECK:STDOUT: %FExtraReturnType: type = class_type @FExtraReturnType [template]
  222. // CHECK:STDOUT: %F.type.4: type = fn_type @F.4 [template]
  223. // CHECK:STDOUT: %F.5: %F.type.4 = struct_value () [template]
  224. // CHECK:STDOUT: %.6: type = interface_type @J [template]
  225. // CHECK:STDOUT: %Self.2: %.6 = bind_symbolic_name Self 0 [symbolic]
  226. // CHECK:STDOUT: %F.type.5: type = fn_type @F.5 [template]
  227. // CHECK:STDOUT: %F.6: %F.type.5 = struct_value () [template]
  228. // CHECK:STDOUT: %.7: type = assoc_entity_type @J, %F.type.5 [template]
  229. // CHECK:STDOUT: %.8: %.7 = assoc_entity element0, @J.%F.decl [template]
  230. // CHECK:STDOUT: %FMissingParam: type = class_type @FMissingParam [template]
  231. // CHECK:STDOUT: %F.type.6: type = fn_type @F.6 [template]
  232. // CHECK:STDOUT: %F.7: %F.type.6 = struct_value () [template]
  233. // CHECK:STDOUT: %FMissingImplicitParam: type = class_type @FMissingImplicitParam [template]
  234. // CHECK:STDOUT: %F.type.7: type = fn_type @F.7 [template]
  235. // CHECK:STDOUT: %F.8: %F.type.7 = struct_value () [template]
  236. // CHECK:STDOUT: %FMissingReturnType: type = class_type @FMissingReturnType [template]
  237. // CHECK:STDOUT: %F.type.8: type = fn_type @F.8 [template]
  238. // CHECK:STDOUT: %F.9: %F.type.8 = struct_value () [template]
  239. // CHECK:STDOUT: %FDifferentParamType: type = class_type @FDifferentParamType [template]
  240. // CHECK:STDOUT: %F.type.9: type = fn_type @F.9 [template]
  241. // CHECK:STDOUT: %F.10: %F.type.9 = struct_value () [template]
  242. // CHECK:STDOUT: %FDifferentImplicitParamType: type = class_type @FDifferentImplicitParamType [template]
  243. // CHECK:STDOUT: %F.type.10: type = fn_type @F.10 [template]
  244. // CHECK:STDOUT: %F.11: %F.type.10 = struct_value () [template]
  245. // CHECK:STDOUT: %FDifferentReturnType: type = class_type @FDifferentReturnType [template]
  246. // CHECK:STDOUT: %F.type.11: type = fn_type @F.11 [template]
  247. // CHECK:STDOUT: %F.12: %F.type.11 = struct_value () [template]
  248. // CHECK:STDOUT: %FDifferentParamName: type = class_type @FDifferentParamName [template]
  249. // CHECK:STDOUT: %F.type.12: type = fn_type @F.12 [template]
  250. // CHECK:STDOUT: %F.13: %F.type.12 = struct_value () [template]
  251. // CHECK:STDOUT: %.9: type = interface_type @SelfNested [template]
  252. // CHECK:STDOUT: %Self.3: %.9 = bind_symbolic_name Self 0 [symbolic]
  253. // CHECK:STDOUT: %.10: type = ptr_type %Self.3 [symbolic]
  254. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  255. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  256. // CHECK:STDOUT: %.11: type = struct_type {.x: %Self.3, .y: i32} [symbolic]
  257. // CHECK:STDOUT: %.12: type = tuple_type (type, type) [template]
  258. // CHECK:STDOUT: %.13: type = tuple_type (%.10, %.11) [symbolic]
  259. // CHECK:STDOUT: %.14: i32 = int_literal 4 [template]
  260. // CHECK:STDOUT: %.15: type = array_type %.14, %Self.3 [symbolic]
  261. // CHECK:STDOUT: %F.type.13: type = fn_type @F.13 [template]
  262. // CHECK:STDOUT: %F.14: %F.type.13 = struct_value () [template]
  263. // CHECK:STDOUT: %.16: type = assoc_entity_type @SelfNested, %F.type.13 [template]
  264. // CHECK:STDOUT: %.17: %.16 = assoc_entity element0, @SelfNested.%F.decl [template]
  265. // CHECK:STDOUT: %SelfNestedBadParam: type = class_type @SelfNestedBadParam [template]
  266. // CHECK:STDOUT: %.18: type = ptr_type %SelfNestedBadParam [template]
  267. // CHECK:STDOUT: %.19: type = struct_type {.x: i32, .y: i32} [template]
  268. // CHECK:STDOUT: %.20: type = tuple_type (%.18, %.19) [template]
  269. // CHECK:STDOUT: %.21: type = array_type %.14, %SelfNestedBadParam [template]
  270. // CHECK:STDOUT: %F.type.14: type = fn_type @F.14 [template]
  271. // CHECK:STDOUT: %F.15: %F.type.14 = struct_value () [template]
  272. // CHECK:STDOUT: %.22: type = struct_type {.x: %SelfNestedBadParam, .y: i32} [template]
  273. // CHECK:STDOUT: %.23: type = tuple_type (%.18, %.22) [template]
  274. // CHECK:STDOUT: %SelfNestedBadReturnType: type = class_type @SelfNestedBadReturnType [template]
  275. // CHECK:STDOUT: %.24: type = ptr_type %SelfNestedBadReturnType [template]
  276. // CHECK:STDOUT: %.25: type = struct_type {.x: %SelfNestedBadReturnType, .y: i32} [template]
  277. // CHECK:STDOUT: %.26: type = tuple_type (%.24, %.25) [template]
  278. // CHECK:STDOUT: %F.type.15: type = fn_type @F.15 [template]
  279. // CHECK:STDOUT: %F.16: %F.type.15 = struct_value () [template]
  280. // CHECK:STDOUT: %.27: type = array_type %.14, %SelfNestedBadReturnType [template]
  281. // CHECK:STDOUT: }
  282. // CHECK:STDOUT:
  283. // CHECK:STDOUT: file {
  284. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  285. // CHECK:STDOUT: .Core = %Core
  286. // CHECK:STDOUT: .I = %I.decl
  287. // CHECK:STDOUT: .NoF = %NoF.decl
  288. // CHECK:STDOUT: .FNotFunction = %FNotFunction.decl
  289. // CHECK:STDOUT: .PossiblyF = %PossiblyF.decl
  290. // CHECK:STDOUT: .FAlias = %FAlias.decl
  291. // CHECK:STDOUT: .FExtraParam = %FExtraParam.decl
  292. // CHECK:STDOUT: .FExtraImplicitParam = %FExtraImplicitParam.decl
  293. // CHECK:STDOUT: .FExtraReturnType = %FExtraReturnType.decl
  294. // CHECK:STDOUT: .J = %J.decl
  295. // CHECK:STDOUT: .FMissingParam = %FMissingParam.decl
  296. // CHECK:STDOUT: .FMissingImplicitParam = %FMissingImplicitParam.decl
  297. // CHECK:STDOUT: .FMissingReturnType = %FMissingReturnType.decl
  298. // CHECK:STDOUT: .FDifferentParamType = %FDifferentParamType.decl
  299. // CHECK:STDOUT: .FDifferentImplicitParamType = %FDifferentImplicitParamType.decl
  300. // CHECK:STDOUT: .FDifferentReturnType = %FDifferentReturnType.decl
  301. // CHECK:STDOUT: .FDifferentParamName = %FDifferentParamName.decl
  302. // CHECK:STDOUT: .SelfNested = %SelfNested.decl
  303. // CHECK:STDOUT: .SelfNestedBadParam = %SelfNestedBadParam.decl
  304. // CHECK:STDOUT: .SelfNestedBadReturnType = %SelfNestedBadReturnType.decl
  305. // CHECK:STDOUT: }
  306. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  307. // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {}
  308. // CHECK:STDOUT: %NoF.decl: type = class_decl @NoF [template = constants.%NoF] {}
  309. // CHECK:STDOUT: %FNotFunction.decl: type = class_decl @FNotFunction [template = constants.%FNotFunction] {}
  310. // CHECK:STDOUT: %PossiblyF.decl: %PossiblyF.type = fn_decl @PossiblyF [template = constants.%PossiblyF] {}
  311. // CHECK:STDOUT: %FAlias.decl: type = class_decl @FAlias [template = constants.%FAlias] {}
  312. // CHECK:STDOUT: %FExtraParam.decl: type = class_decl @FExtraParam [template = constants.%FExtraParam] {}
  313. // CHECK:STDOUT: %import_ref.1: %Bool.type = import_ref ir7, inst+2, loaded [template = constants.%Bool]
  314. // CHECK:STDOUT: %FExtraImplicitParam.decl: type = class_decl @FExtraImplicitParam [template = constants.%FExtraImplicitParam] {}
  315. // CHECK:STDOUT: %FExtraReturnType.decl: type = class_decl @FExtraReturnType [template = constants.%FExtraReturnType] {}
  316. // CHECK:STDOUT: %import_ref.2: %Bool.type = import_ref ir7, inst+2, loaded [template = constants.%Bool]
  317. // CHECK:STDOUT: %J.decl: type = interface_decl @J [template = constants.%.6] {}
  318. // CHECK:STDOUT: %import_ref.3: %Bool.type = import_ref ir7, inst+2, loaded [template = constants.%Bool]
  319. // CHECK:STDOUT: %import_ref.4: %Bool.type = import_ref ir7, inst+2, loaded [template = constants.%Bool]
  320. // CHECK:STDOUT: %import_ref.5: %Bool.type = import_ref ir7, inst+2, loaded [template = constants.%Bool]
  321. // CHECK:STDOUT: %FMissingParam.decl: type = class_decl @FMissingParam [template = constants.%FMissingParam] {}
  322. // CHECK:STDOUT: %import_ref.6: %Bool.type = import_ref ir7, inst+2, loaded [template = constants.%Bool]
  323. // CHECK:STDOUT: %import_ref.7: %Bool.type = import_ref ir7, inst+2, loaded [template = constants.%Bool]
  324. // CHECK:STDOUT: %FMissingImplicitParam.decl: type = class_decl @FMissingImplicitParam [template = constants.%FMissingImplicitParam] {}
  325. // CHECK:STDOUT: %import_ref.8: %Bool.type = import_ref ir7, inst+2, loaded [template = constants.%Bool]
  326. // CHECK:STDOUT: %import_ref.9: %Bool.type = import_ref ir7, inst+2, loaded [template = constants.%Bool]
  327. // CHECK:STDOUT: %FMissingReturnType.decl: type = class_decl @FMissingReturnType [template = constants.%FMissingReturnType] {}
  328. // CHECK:STDOUT: %import_ref.10: %Bool.type = import_ref ir7, inst+2, loaded [template = constants.%Bool]
  329. // CHECK:STDOUT: %import_ref.11: %Bool.type = import_ref ir7, inst+2, loaded [template = constants.%Bool]
  330. // CHECK:STDOUT: %FDifferentParamType.decl: type = class_decl @FDifferentParamType [template = constants.%FDifferentParamType] {}
  331. // CHECK:STDOUT: %import_ref.12: %Bool.type = import_ref ir7, inst+2, loaded [template = constants.%Bool]
  332. // CHECK:STDOUT: %import_ref.13: %Bool.type = import_ref ir7, inst+2, loaded [template = constants.%Bool]
  333. // CHECK:STDOUT: %FDifferentImplicitParamType.decl: type = class_decl @FDifferentImplicitParamType [template = constants.%FDifferentImplicitParamType] {}
  334. // CHECK:STDOUT: %import_ref.14: %Bool.type = import_ref ir7, inst+2, loaded [template = constants.%Bool]
  335. // CHECK:STDOUT: %import_ref.15: %Bool.type = import_ref ir7, inst+2, loaded [template = constants.%Bool]
  336. // CHECK:STDOUT: %FDifferentReturnType.decl: type = class_decl @FDifferentReturnType [template = constants.%FDifferentReturnType] {}
  337. // CHECK:STDOUT: %import_ref.16: %Bool.type = import_ref ir7, inst+2, loaded [template = constants.%Bool]
  338. // CHECK:STDOUT: %import_ref.17: %Bool.type = import_ref ir7, inst+2, loaded [template = constants.%Bool]
  339. // CHECK:STDOUT: %FDifferentParamName.decl: type = class_decl @FDifferentParamName [template = constants.%FDifferentParamName] {}
  340. // CHECK:STDOUT: %import_ref.18: %Bool.type = import_ref ir7, inst+2, loaded [template = constants.%Bool]
  341. // CHECK:STDOUT: %import_ref.19: %Bool.type = import_ref ir7, inst+2, loaded [template = constants.%Bool]
  342. // CHECK:STDOUT: %import_ref.20: %Bool.type = import_ref ir7, inst+2, loaded [template = constants.%Bool]
  343. // CHECK:STDOUT: %SelfNested.decl: type = interface_decl @SelfNested [template = constants.%.9] {}
  344. // CHECK:STDOUT: %import_ref.21: %Int32.type = import_ref ir3, inst+3, loaded [template = constants.%Int32]
  345. // CHECK:STDOUT: %SelfNestedBadParam.decl: type = class_decl @SelfNestedBadParam [template = constants.%SelfNestedBadParam] {}
  346. // CHECK:STDOUT: %import_ref.22: %Int32.type = import_ref ir3, inst+3, loaded [template = constants.%Int32]
  347. // CHECK:STDOUT: %import_ref.23: %Int32.type = import_ref ir3, inst+3, loaded [template = constants.%Int32]
  348. // CHECK:STDOUT: %SelfNestedBadReturnType.decl: type = class_decl @SelfNestedBadReturnType [template = constants.%SelfNestedBadReturnType] {}
  349. // CHECK:STDOUT: %import_ref.24: %Int32.type = import_ref ir3, inst+3, loaded [template = constants.%Int32]
  350. // CHECK:STDOUT: }
  351. // CHECK:STDOUT:
  352. // CHECK:STDOUT: interface @I {
  353. // CHECK:STDOUT: %Self: %.1 = bind_symbolic_name Self 0 [symbolic = constants.%Self.1]
  354. // CHECK:STDOUT: %F.decl: %F.type.1 = fn_decl @F.1 [template = constants.%F.1] {}
  355. // CHECK:STDOUT: %.loc11: %.3 = assoc_entity element0, %F.decl [template = constants.%.4]
  356. // CHECK:STDOUT:
  357. // CHECK:STDOUT: !members:
  358. // CHECK:STDOUT: .Self = %Self
  359. // CHECK:STDOUT: .F = %.loc11
  360. // CHECK:STDOUT: witness = (%F.decl)
  361. // CHECK:STDOUT: }
  362. // CHECK:STDOUT:
  363. // CHECK:STDOUT: interface @J {
  364. // CHECK:STDOUT: %Self: %.6 = bind_symbolic_name Self 0 [symbolic = constants.%Self.2]
  365. // CHECK:STDOUT: %F.decl: %F.type.5 = fn_decl @F.5 [template = constants.%F.6] {
  366. // CHECK:STDOUT: %bool.make_type.loc93_26: init type = call constants.%Bool() [template = bool]
  367. // CHECK:STDOUT: %.loc93_26.1: type = value_of_initializer %bool.make_type.loc93_26 [template = bool]
  368. // CHECK:STDOUT: %.loc93_26.2: type = converted %bool.make_type.loc93_26, %.loc93_26.1 [template = bool]
  369. // CHECK:STDOUT: %self.loc93_20.1: bool = param self
  370. // CHECK:STDOUT: %self.loc93_20.2: bool = bind_name self, %self.loc93_20.1
  371. // CHECK:STDOUT: %bool.make_type.loc93_35: init type = call constants.%Bool() [template = bool]
  372. // CHECK:STDOUT: %.loc93_35.1: type = value_of_initializer %bool.make_type.loc93_35 [template = bool]
  373. // CHECK:STDOUT: %.loc93_35.2: type = converted %bool.make_type.loc93_35, %.loc93_35.1 [template = bool]
  374. // CHECK:STDOUT: %b.loc93_32.1: bool = param b
  375. // CHECK:STDOUT: %b.loc93_32.2: bool = bind_name b, %b.loc93_32.1
  376. // CHECK:STDOUT: %bool.make_type.loc93_44: init type = call constants.%Bool() [template = bool]
  377. // CHECK:STDOUT: %.loc93_44.1: type = value_of_initializer %bool.make_type.loc93_44 [template = bool]
  378. // CHECK:STDOUT: %.loc93_44.2: type = converted %bool.make_type.loc93_44, %.loc93_44.1 [template = bool]
  379. // CHECK:STDOUT: %return.var: ref bool = var <return slot>
  380. // CHECK:STDOUT: }
  381. // CHECK:STDOUT: %.loc93_48: %.7 = assoc_entity element0, %F.decl [template = constants.%.8]
  382. // CHECK:STDOUT:
  383. // CHECK:STDOUT: !members:
  384. // CHECK:STDOUT: .Self = %Self
  385. // CHECK:STDOUT: .F = %.loc93_48
  386. // CHECK:STDOUT: witness = (%F.decl)
  387. // CHECK:STDOUT: }
  388. // CHECK:STDOUT:
  389. // CHECK:STDOUT: interface @SelfNested {
  390. // CHECK:STDOUT: %Self: %.9 = bind_symbolic_name Self 0 [symbolic = constants.%Self.3]
  391. // CHECK:STDOUT: %F.decl: %F.type.13 = fn_decl @F.13 [template = constants.%F.14] {
  392. // CHECK:STDOUT: %Self.ref.loc188_12: %.9 = name_ref Self, %Self [symbolic = constants.%Self.3]
  393. // CHECK:STDOUT: %.loc188_16.1: type = facet_type_access %Self.ref.loc188_12 [symbolic = constants.%Self.3]
  394. // CHECK:STDOUT: %.loc188_16.2: type = converted %Self.ref.loc188_12, %.loc188_16.1 [symbolic = constants.%Self.3]
  395. // CHECK:STDOUT: %.loc188_16.3: type = ptr_type %Self.3 [symbolic = constants.%.10]
  396. // CHECK:STDOUT: %Self.ref.loc188_24: %.9 = name_ref Self, %Self [symbolic = constants.%Self.3]
  397. // CHECK:STDOUT: %.loc188_24.1: type = facet_type_access %Self.ref.loc188_24 [symbolic = constants.%Self.3]
  398. // CHECK:STDOUT: %.loc188_24.2: type = converted %Self.ref.loc188_24, %.loc188_24.1 [symbolic = constants.%Self.3]
  399. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  400. // CHECK:STDOUT: %.loc188_34.1: type = value_of_initializer %int.make_type_32 [template = i32]
  401. // CHECK:STDOUT: %.loc188_34.2: type = converted %int.make_type_32, %.loc188_34.1 [template = i32]
  402. // CHECK:STDOUT: %.loc188_37: type = struct_type {.x: %Self.3, .y: i32} [symbolic = constants.%.11]
  403. // CHECK:STDOUT: %.loc188_38.1: %.12 = tuple_literal (%.loc188_16.3, %.loc188_37)
  404. // CHECK:STDOUT: %.loc188_38.2: type = converted %.loc188_38.1, constants.%.13 [symbolic = constants.%.13]
  405. // CHECK:STDOUT: %x.loc188_8.1: %.13 = param x
  406. // CHECK:STDOUT: %x.loc188_8.2: %.13 = bind_name x, %x.loc188_8.1
  407. // CHECK:STDOUT: %Self.ref.loc188_45: %.9 = name_ref Self, %Self [symbolic = constants.%Self.3]
  408. // CHECK:STDOUT: %.loc188_51: i32 = int_literal 4 [template = constants.%.14]
  409. // CHECK:STDOUT: %.loc188_45.1: type = facet_type_access %Self.ref.loc188_45 [symbolic = constants.%Self.3]
  410. // CHECK:STDOUT: %.loc188_45.2: type = converted %Self.ref.loc188_45, %.loc188_45.1 [symbolic = constants.%Self.3]
  411. // CHECK:STDOUT: %.loc188_52: type = array_type %.loc188_51, %Self.3 [symbolic = constants.%.15]
  412. // CHECK:STDOUT: %return.var: ref %.15 = var <return slot>
  413. // CHECK:STDOUT: }
  414. // CHECK:STDOUT: %.loc188_53: %.16 = assoc_entity element0, %F.decl [template = constants.%.17]
  415. // CHECK:STDOUT:
  416. // CHECK:STDOUT: !members:
  417. // CHECK:STDOUT: .Self = %Self
  418. // CHECK:STDOUT: .F = %.loc188_53
  419. // CHECK:STDOUT: witness = (%F.decl)
  420. // CHECK:STDOUT: }
  421. // CHECK:STDOUT:
  422. // CHECK:STDOUT: impl @impl.1: %NoF as %.1 {
  423. // CHECK:STDOUT: %.1: <witness> = interface_witness (<error>) [template = <error>]
  424. // CHECK:STDOUT:
  425. // CHECK:STDOUT: !members:
  426. // CHECK:STDOUT: witness = %.1
  427. // CHECK:STDOUT: }
  428. // CHECK:STDOUT:
  429. // CHECK:STDOUT: impl @impl.2: %FNotFunction as %.1 {
  430. // CHECK:STDOUT: %F.decl: type = class_decl @F.16 [template = constants.%F.2] {}
  431. // CHECK:STDOUT: %.1: <witness> = interface_witness (<error>) [template = <error>]
  432. // CHECK:STDOUT:
  433. // CHECK:STDOUT: !members:
  434. // CHECK:STDOUT: .F = %F.decl
  435. // CHECK:STDOUT: witness = %.1
  436. // CHECK:STDOUT: }
  437. // CHECK:STDOUT:
  438. // CHECK:STDOUT: impl @impl.3: %FAlias as %.1 {
  439. // CHECK:STDOUT: %PossiblyF.ref: %PossiblyF.type = name_ref PossiblyF, file.%PossiblyF.decl [template = constants.%PossiblyF]
  440. // CHECK:STDOUT: %F: %PossiblyF.type = bind_alias F, file.%PossiblyF.decl [template = constants.%PossiblyF]
  441. // CHECK:STDOUT: %.1: <witness> = interface_witness (<error>) [template = <error>]
  442. // CHECK:STDOUT:
  443. // CHECK:STDOUT: !members:
  444. // CHECK:STDOUT: .F = %F
  445. // CHECK:STDOUT: witness = %.1
  446. // CHECK:STDOUT: }
  447. // CHECK:STDOUT:
  448. // CHECK:STDOUT: impl @impl.4: %FExtraParam as %.1 {
  449. // CHECK:STDOUT: %F.decl: %F.type.2 = fn_decl @F.2 [template = constants.%F.3] {
  450. // CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool]
  451. // CHECK:STDOUT: %.loc62_13.1: type = value_of_initializer %bool.make_type [template = bool]
  452. // CHECK:STDOUT: %.loc62_13.2: type = converted %bool.make_type, %.loc62_13.1 [template = bool]
  453. // CHECK:STDOUT: %b.loc62_10.1: bool = param b
  454. // CHECK:STDOUT: %b.loc62_10.2: bool = bind_name b, %b.loc62_10.1
  455. // CHECK:STDOUT: }
  456. // CHECK:STDOUT: %.1: <witness> = interface_witness (<error>) [template = <error>]
  457. // CHECK:STDOUT:
  458. // CHECK:STDOUT: !members:
  459. // CHECK:STDOUT: .F = %F.decl
  460. // CHECK:STDOUT: witness = %.1
  461. // CHECK:STDOUT: }
  462. // CHECK:STDOUT:
  463. // CHECK:STDOUT: impl @impl.5: %FExtraImplicitParam as %.1 {
  464. // CHECK:STDOUT: %F.decl: %F.type.3 = fn_decl @F.3 [template = constants.%F.4] {
  465. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FExtraImplicitParam [template = constants.%FExtraImplicitParam]
  466. // CHECK:STDOUT: %self.loc75_10.1: %FExtraImplicitParam = param self
  467. // CHECK:STDOUT: %self.loc75_10.2: %FExtraImplicitParam = bind_name self, %self.loc75_10.1
  468. // CHECK:STDOUT: }
  469. // CHECK:STDOUT: %.1: <witness> = interface_witness (<error>) [template = <error>]
  470. // CHECK:STDOUT:
  471. // CHECK:STDOUT: !members:
  472. // CHECK:STDOUT: .F = %F.decl
  473. // CHECK:STDOUT: witness = %.1
  474. // CHECK:STDOUT: }
  475. // CHECK:STDOUT:
  476. // CHECK:STDOUT: impl @impl.6: %FExtraReturnType as %.1 {
  477. // CHECK:STDOUT: %F.decl: %F.type.4 = fn_decl @F.4 [template = constants.%F.5] {
  478. // CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool]
  479. // CHECK:STDOUT: %.loc89_15.1: type = value_of_initializer %bool.make_type [template = bool]
  480. // CHECK:STDOUT: %.loc89_15.2: type = converted %bool.make_type, %.loc89_15.1 [template = bool]
  481. // CHECK:STDOUT: %return.var: ref bool = var <return slot>
  482. // CHECK:STDOUT: }
  483. // CHECK:STDOUT: %.1: <witness> = interface_witness (<error>) [template = <error>]
  484. // CHECK:STDOUT:
  485. // CHECK:STDOUT: !members:
  486. // CHECK:STDOUT: .F = %F.decl
  487. // CHECK:STDOUT: witness = %.1
  488. // CHECK:STDOUT: }
  489. // CHECK:STDOUT:
  490. // CHECK:STDOUT: impl @impl.7: %FMissingParam as %.6 {
  491. // CHECK:STDOUT: %F.decl: %F.type.6 = fn_decl @F.6 [template = constants.%F.7] {
  492. // CHECK:STDOUT: %bool.make_type.loc104_16: init type = call constants.%Bool() [template = bool]
  493. // CHECK:STDOUT: %.loc104_16.1: type = value_of_initializer %bool.make_type.loc104_16 [template = bool]
  494. // CHECK:STDOUT: %.loc104_16.2: type = converted %bool.make_type.loc104_16, %.loc104_16.1 [template = bool]
  495. // CHECK:STDOUT: %self.loc104_10.1: bool = param self
  496. // CHECK:STDOUT: %self.loc104_10.2: bool = bind_name self, %self.loc104_10.1
  497. // CHECK:STDOUT: %bool.make_type.loc104_27: init type = call constants.%Bool() [template = bool]
  498. // CHECK:STDOUT: %.loc104_27.1: type = value_of_initializer %bool.make_type.loc104_27 [template = bool]
  499. // CHECK:STDOUT: %.loc104_27.2: type = converted %bool.make_type.loc104_27, %.loc104_27.1 [template = bool]
  500. // CHECK:STDOUT: %return.var: ref bool = var <return slot>
  501. // CHECK:STDOUT: }
  502. // CHECK:STDOUT: %.1: <witness> = interface_witness (<error>) [template = <error>]
  503. // CHECK:STDOUT:
  504. // CHECK:STDOUT: !members:
  505. // CHECK:STDOUT: .F = %F.decl
  506. // CHECK:STDOUT: witness = %.1
  507. // CHECK:STDOUT: }
  508. // CHECK:STDOUT:
  509. // CHECK:STDOUT: impl @impl.8: %FMissingImplicitParam as %.6 {
  510. // CHECK:STDOUT: %F.decl: %F.type.7 = fn_decl @F.7 [template = constants.%F.8] {
  511. // CHECK:STDOUT: %bool.make_type.loc117_13: init type = call constants.%Bool() [template = bool]
  512. // CHECK:STDOUT: %.loc117_13.1: type = value_of_initializer %bool.make_type.loc117_13 [template = bool]
  513. // CHECK:STDOUT: %.loc117_13.2: type = converted %bool.make_type.loc117_13, %.loc117_13.1 [template = bool]
  514. // CHECK:STDOUT: %b.loc117_10.1: bool = param b
  515. // CHECK:STDOUT: %b.loc117_10.2: bool = bind_name b, %b.loc117_10.1
  516. // CHECK:STDOUT: %bool.make_type.loc117_22: init type = call constants.%Bool() [template = bool]
  517. // CHECK:STDOUT: %.loc117_22.1: type = value_of_initializer %bool.make_type.loc117_22 [template = bool]
  518. // CHECK:STDOUT: %.loc117_22.2: type = converted %bool.make_type.loc117_22, %.loc117_22.1 [template = bool]
  519. // CHECK:STDOUT: %return.var: ref bool = var <return slot>
  520. // CHECK:STDOUT: }
  521. // CHECK:STDOUT: %.1: <witness> = interface_witness (<error>) [template = <error>]
  522. // CHECK:STDOUT:
  523. // CHECK:STDOUT: !members:
  524. // CHECK:STDOUT: .F = %F.decl
  525. // CHECK:STDOUT: witness = %.1
  526. // CHECK:STDOUT: }
  527. // CHECK:STDOUT:
  528. // CHECK:STDOUT: impl @impl.9: %FMissingReturnType as %.6 {
  529. // CHECK:STDOUT: %F.decl: %F.type.8 = fn_decl @F.8 [template = constants.%F.9] {
  530. // CHECK:STDOUT: %bool.make_type.loc130_16: init type = call constants.%Bool() [template = bool]
  531. // CHECK:STDOUT: %.loc130_16.1: type = value_of_initializer %bool.make_type.loc130_16 [template = bool]
  532. // CHECK:STDOUT: %.loc130_16.2: type = converted %bool.make_type.loc130_16, %.loc130_16.1 [template = bool]
  533. // CHECK:STDOUT: %self.loc130_10.1: bool = param self
  534. // CHECK:STDOUT: %self.loc130_10.2: bool = bind_name self, %self.loc130_10.1
  535. // CHECK:STDOUT: %bool.make_type.loc130_25: init type = call constants.%Bool() [template = bool]
  536. // CHECK:STDOUT: %.loc130_25.1: type = value_of_initializer %bool.make_type.loc130_25 [template = bool]
  537. // CHECK:STDOUT: %.loc130_25.2: type = converted %bool.make_type.loc130_25, %.loc130_25.1 [template = bool]
  538. // CHECK:STDOUT: %b.loc130_22.1: bool = param b
  539. // CHECK:STDOUT: %b.loc130_22.2: bool = bind_name b, %b.loc130_22.1
  540. // CHECK:STDOUT: }
  541. // CHECK:STDOUT: %.1: <witness> = interface_witness (<error>) [template = <error>]
  542. // CHECK:STDOUT:
  543. // CHECK:STDOUT: !members:
  544. // CHECK:STDOUT: .F = %F.decl
  545. // CHECK:STDOUT: witness = %.1
  546. // CHECK:STDOUT: }
  547. // CHECK:STDOUT:
  548. // CHECK:STDOUT: impl @impl.10: %FDifferentParamType as %.6 {
  549. // CHECK:STDOUT: %F.decl: %F.type.9 = fn_decl @F.9 [template = constants.%F.10] {
  550. // CHECK:STDOUT: %bool.make_type.loc143_16: init type = call constants.%Bool() [template = bool]
  551. // CHECK:STDOUT: %.loc143_16.1: type = value_of_initializer %bool.make_type.loc143_16 [template = bool]
  552. // CHECK:STDOUT: %.loc143_16.2: type = converted %bool.make_type.loc143_16, %.loc143_16.1 [template = bool]
  553. // CHECK:STDOUT: %self.loc143_10.1: bool = param self
  554. // CHECK:STDOUT: %self.loc143_10.2: bool = bind_name self, %self.loc143_10.1
  555. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FDifferentParamType [template = constants.%FDifferentParamType]
  556. // CHECK:STDOUT: %b.loc143_22.1: %FDifferentParamType = param b
  557. // CHECK:STDOUT: %b.loc143_22.2: %FDifferentParamType = bind_name b, %b.loc143_22.1
  558. // CHECK:STDOUT: %bool.make_type.loc143_34: init type = call constants.%Bool() [template = bool]
  559. // CHECK:STDOUT: %.loc143_34.1: type = value_of_initializer %bool.make_type.loc143_34 [template = bool]
  560. // CHECK:STDOUT: %.loc143_34.2: type = converted %bool.make_type.loc143_34, %.loc143_34.1 [template = bool]
  561. // CHECK:STDOUT: %return.var: ref bool = var <return slot>
  562. // CHECK:STDOUT: }
  563. // CHECK:STDOUT: %.1: <witness> = interface_witness (<error>) [template = <error>]
  564. // CHECK:STDOUT:
  565. // CHECK:STDOUT: !members:
  566. // CHECK:STDOUT: .F = %F.decl
  567. // CHECK:STDOUT: witness = %.1
  568. // CHECK:STDOUT: }
  569. // CHECK:STDOUT:
  570. // CHECK:STDOUT: impl @impl.11: %FDifferentImplicitParamType as %.6 {
  571. // CHECK:STDOUT: %F.decl: %F.type.10 = fn_decl @F.10 [template = constants.%F.11] {
  572. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FDifferentImplicitParamType [template = constants.%FDifferentImplicitParamType]
  573. // CHECK:STDOUT: %self.loc156_10.1: %FDifferentImplicitParamType = param self
  574. // CHECK:STDOUT: %self.loc156_10.2: %FDifferentImplicitParamType = bind_name self, %self.loc156_10.1
  575. // CHECK:STDOUT: %bool.make_type.loc156_25: init type = call constants.%Bool() [template = bool]
  576. // CHECK:STDOUT: %.loc156_25.1: type = value_of_initializer %bool.make_type.loc156_25 [template = bool]
  577. // CHECK:STDOUT: %.loc156_25.2: type = converted %bool.make_type.loc156_25, %.loc156_25.1 [template = bool]
  578. // CHECK:STDOUT: %b.loc156_22.1: bool = param b
  579. // CHECK:STDOUT: %b.loc156_22.2: bool = bind_name b, %b.loc156_22.1
  580. // CHECK:STDOUT: %bool.make_type.loc156_34: init type = call constants.%Bool() [template = bool]
  581. // CHECK:STDOUT: %.loc156_34.1: type = value_of_initializer %bool.make_type.loc156_34 [template = bool]
  582. // CHECK:STDOUT: %.loc156_34.2: type = converted %bool.make_type.loc156_34, %.loc156_34.1 [template = bool]
  583. // CHECK:STDOUT: %return.var: ref bool = var <return slot>
  584. // CHECK:STDOUT: }
  585. // CHECK:STDOUT: %.1: <witness> = interface_witness (<error>) [template = <error>]
  586. // CHECK:STDOUT:
  587. // CHECK:STDOUT: !members:
  588. // CHECK:STDOUT: .F = %F.decl
  589. // CHECK:STDOUT: witness = %.1
  590. // CHECK:STDOUT: }
  591. // CHECK:STDOUT:
  592. // CHECK:STDOUT: impl @impl.12: %FDifferentReturnType as %.6 {
  593. // CHECK:STDOUT: %F.decl: %F.type.11 = fn_decl @F.11 [template = constants.%F.12] {
  594. // CHECK:STDOUT: %bool.make_type.loc169_16: init type = call constants.%Bool() [template = bool]
  595. // CHECK:STDOUT: %.loc169_16.1: type = value_of_initializer %bool.make_type.loc169_16 [template = bool]
  596. // CHECK:STDOUT: %.loc169_16.2: type = converted %bool.make_type.loc169_16, %.loc169_16.1 [template = bool]
  597. // CHECK:STDOUT: %self.loc169_10.1: bool = param self
  598. // CHECK:STDOUT: %self.loc169_10.2: bool = bind_name self, %self.loc169_10.1
  599. // CHECK:STDOUT: %bool.make_type.loc169_25: init type = call constants.%Bool() [template = bool]
  600. // CHECK:STDOUT: %.loc169_25.1: type = value_of_initializer %bool.make_type.loc169_25 [template = bool]
  601. // CHECK:STDOUT: %.loc169_25.2: type = converted %bool.make_type.loc169_25, %.loc169_25.1 [template = bool]
  602. // CHECK:STDOUT: %b.loc169_22.1: bool = param b
  603. // CHECK:STDOUT: %b.loc169_22.2: bool = bind_name b, %b.loc169_22.1
  604. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FDifferentReturnType [template = constants.%FDifferentReturnType]
  605. // CHECK:STDOUT: %return.var: ref %FDifferentReturnType = var <return slot>
  606. // CHECK:STDOUT: }
  607. // CHECK:STDOUT: %.1: <witness> = interface_witness (<error>) [template = <error>]
  608. // CHECK:STDOUT:
  609. // CHECK:STDOUT: !members:
  610. // CHECK:STDOUT: .F = %F.decl
  611. // CHECK:STDOUT: witness = %.1
  612. // CHECK:STDOUT: }
  613. // CHECK:STDOUT:
  614. // CHECK:STDOUT: impl @impl.13: %FDifferentParamName as %.6 {
  615. // CHECK:STDOUT: %F.decl: %F.type.12 = fn_decl @F.12 [template = constants.%F.13] {
  616. // CHECK:STDOUT: %bool.make_type.loc183_16: init type = call constants.%Bool() [template = bool]
  617. // CHECK:STDOUT: %.loc183_16.1: type = value_of_initializer %bool.make_type.loc183_16 [template = bool]
  618. // CHECK:STDOUT: %.loc183_16.2: type = converted %bool.make_type.loc183_16, %.loc183_16.1 [template = bool]
  619. // CHECK:STDOUT: %self.loc183_10.1: bool = param self
  620. // CHECK:STDOUT: %self.loc183_10.2: bool = bind_name self, %self.loc183_10.1
  621. // CHECK:STDOUT: %bool.make_type.loc183_29: init type = call constants.%Bool() [template = bool]
  622. // CHECK:STDOUT: %.loc183_29.1: type = value_of_initializer %bool.make_type.loc183_29 [template = bool]
  623. // CHECK:STDOUT: %.loc183_29.2: type = converted %bool.make_type.loc183_29, %.loc183_29.1 [template = bool]
  624. // CHECK:STDOUT: %not_b.loc183_22.1: bool = param not_b
  625. // CHECK:STDOUT: %not_b.loc183_22.2: bool = bind_name not_b, %not_b.loc183_22.1
  626. // CHECK:STDOUT: %bool.make_type.loc183_38: init type = call constants.%Bool() [template = bool]
  627. // CHECK:STDOUT: %.loc183_38.1: type = value_of_initializer %bool.make_type.loc183_38 [template = bool]
  628. // CHECK:STDOUT: %.loc183_38.2: type = converted %bool.make_type.loc183_38, %.loc183_38.1 [template = bool]
  629. // CHECK:STDOUT: %return.var: ref bool = var <return slot>
  630. // CHECK:STDOUT: }
  631. // CHECK:STDOUT: %.1: <witness> = interface_witness (<error>) [template = <error>]
  632. // CHECK:STDOUT:
  633. // CHECK:STDOUT: !members:
  634. // CHECK:STDOUT: .F = %F.decl
  635. // CHECK:STDOUT: witness = %.1
  636. // CHECK:STDOUT: }
  637. // CHECK:STDOUT:
  638. // CHECK:STDOUT: impl @impl.14: %SelfNestedBadParam as %.9 {
  639. // CHECK:STDOUT: %F.decl: %F.type.14 = fn_decl @F.14 [template = constants.%F.15] {
  640. // CHECK:STDOUT: %SelfNestedBadParam.ref.loc200_14: type = name_ref SelfNestedBadParam, file.%SelfNestedBadParam.decl [template = constants.%SelfNestedBadParam]
  641. // CHECK:STDOUT: %.loc200_32: type = ptr_type %SelfNestedBadParam [template = constants.%.18]
  642. // CHECK:STDOUT: %int.make_type_32.loc200_40: init type = call constants.%Int32() [template = i32]
  643. // CHECK:STDOUT: %.loc200_40.1: type = value_of_initializer %int.make_type_32.loc200_40 [template = i32]
  644. // CHECK:STDOUT: %.loc200_40.2: type = converted %int.make_type_32.loc200_40, %.loc200_40.1 [template = i32]
  645. // CHECK:STDOUT: %int.make_type_32.loc200_49: init type = call constants.%Int32() [template = i32]
  646. // CHECK:STDOUT: %.loc200_49.1: type = value_of_initializer %int.make_type_32.loc200_49 [template = i32]
  647. // CHECK:STDOUT: %.loc200_49.2: type = converted %int.make_type_32.loc200_49, %.loc200_49.1 [template = i32]
  648. // CHECK:STDOUT: %.loc200_52: type = struct_type {.x: i32, .y: i32} [template = constants.%.19]
  649. // CHECK:STDOUT: %.loc200_53.1: %.12 = tuple_literal (%.loc200_32, %.loc200_52)
  650. // CHECK:STDOUT: %.loc200_53.2: type = converted %.loc200_53.1, constants.%.20 [template = constants.%.20]
  651. // CHECK:STDOUT: %x.loc200_10.1: %.20 = param x
  652. // CHECK:STDOUT: %x.loc200_10.2: %.20 = bind_name x, %x.loc200_10.1
  653. // CHECK:STDOUT: %SelfNestedBadParam.ref.loc200_60: type = name_ref SelfNestedBadParam, file.%SelfNestedBadParam.decl [template = constants.%SelfNestedBadParam]
  654. // CHECK:STDOUT: %.loc200_80: i32 = int_literal 4 [template = constants.%.14]
  655. // CHECK:STDOUT: %.loc200_81: type = array_type %.loc200_80, %SelfNestedBadParam [template = constants.%.21]
  656. // CHECK:STDOUT: %return.var: ref %.21 = var <return slot>
  657. // CHECK:STDOUT: }
  658. // CHECK:STDOUT: %.1: <witness> = interface_witness (<error>) [template = <error>]
  659. // CHECK:STDOUT:
  660. // CHECK:STDOUT: !members:
  661. // CHECK:STDOUT: .F = %F.decl
  662. // CHECK:STDOUT: witness = %.1
  663. // CHECK:STDOUT: }
  664. // CHECK:STDOUT:
  665. // CHECK:STDOUT: impl @impl.15: %SelfNestedBadReturnType as %.9 {
  666. // CHECK:STDOUT: %F.decl: %F.type.15 = fn_decl @F.15 [template = constants.%F.16] {
  667. // CHECK:STDOUT: %SelfNestedBadReturnType.ref.loc212_14: type = name_ref SelfNestedBadReturnType, file.%SelfNestedBadReturnType.decl [template = constants.%SelfNestedBadReturnType]
  668. // CHECK:STDOUT: %.loc212_37: type = ptr_type %SelfNestedBadReturnType [template = constants.%.24]
  669. // CHECK:STDOUT: %SelfNestedBadReturnType.ref.loc212_45: type = name_ref SelfNestedBadReturnType, file.%SelfNestedBadReturnType.decl [template = constants.%SelfNestedBadReturnType]
  670. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  671. // CHECK:STDOUT: %.loc212_74.1: type = value_of_initializer %int.make_type_32 [template = i32]
  672. // CHECK:STDOUT: %.loc212_74.2: type = converted %int.make_type_32, %.loc212_74.1 [template = i32]
  673. // CHECK:STDOUT: %.loc212_77: type = struct_type {.x: %SelfNestedBadReturnType, .y: i32} [template = constants.%.25]
  674. // CHECK:STDOUT: %.loc212_78.1: %.12 = tuple_literal (%.loc212_37, %.loc212_77)
  675. // CHECK:STDOUT: %.loc212_78.2: type = converted %.loc212_78.1, constants.%.26 [template = constants.%.26]
  676. // CHECK:STDOUT: %x.loc212_10.1: %.26 = param x
  677. // CHECK:STDOUT: %x.loc212_10.2: %.26 = bind_name x, %x.loc212_10.1
  678. // CHECK:STDOUT: %SelfNestedBadParam.ref: type = name_ref SelfNestedBadParam, file.%SelfNestedBadParam.decl [template = constants.%SelfNestedBadParam]
  679. // CHECK:STDOUT: %.loc212_105: i32 = int_literal 4 [template = constants.%.14]
  680. // CHECK:STDOUT: %.loc212_106: type = array_type %.loc212_105, %SelfNestedBadParam [template = constants.%.21]
  681. // CHECK:STDOUT: %return.var: ref %.21 = var <return slot>
  682. // CHECK:STDOUT: }
  683. // CHECK:STDOUT: %.1: <witness> = interface_witness (<error>) [template = <error>]
  684. // CHECK:STDOUT:
  685. // CHECK:STDOUT: !members:
  686. // CHECK:STDOUT: .F = %F.decl
  687. // CHECK:STDOUT: witness = %.1
  688. // CHECK:STDOUT: }
  689. // CHECK:STDOUT:
  690. // CHECK:STDOUT: class @NoF {
  691. // CHECK:STDOUT: impl_decl @impl.1 {
  692. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%.1]
  693. // CHECK:STDOUT: }
  694. // CHECK:STDOUT:
  695. // CHECK:STDOUT: !members:
  696. // CHECK:STDOUT: .Self = constants.%NoF
  697. // CHECK:STDOUT: }
  698. // CHECK:STDOUT:
  699. // CHECK:STDOUT: class @FNotFunction {
  700. // CHECK:STDOUT: impl_decl @impl.2 {
  701. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%.1]
  702. // CHECK:STDOUT: }
  703. // CHECK:STDOUT:
  704. // CHECK:STDOUT: !members:
  705. // CHECK:STDOUT: .Self = constants.%FNotFunction
  706. // CHECK:STDOUT: }
  707. // CHECK:STDOUT:
  708. // CHECK:STDOUT: class @F.16;
  709. // CHECK:STDOUT:
  710. // CHECK:STDOUT: class @FAlias {
  711. // CHECK:STDOUT: impl_decl @impl.3 {
  712. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%.1]
  713. // CHECK:STDOUT: }
  714. // CHECK:STDOUT:
  715. // CHECK:STDOUT: !members:
  716. // CHECK:STDOUT: .Self = constants.%FAlias
  717. // CHECK:STDOUT: }
  718. // CHECK:STDOUT:
  719. // CHECK:STDOUT: class @FExtraParam {
  720. // CHECK:STDOUT: impl_decl @impl.4 {
  721. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%.1]
  722. // CHECK:STDOUT: }
  723. // CHECK:STDOUT:
  724. // CHECK:STDOUT: !members:
  725. // CHECK:STDOUT: .Self = constants.%FExtraParam
  726. // CHECK:STDOUT: }
  727. // CHECK:STDOUT:
  728. // CHECK:STDOUT: class @FExtraImplicitParam {
  729. // CHECK:STDOUT: impl_decl @impl.5 {
  730. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%.1]
  731. // CHECK:STDOUT: }
  732. // CHECK:STDOUT:
  733. // CHECK:STDOUT: !members:
  734. // CHECK:STDOUT: .Self = constants.%FExtraImplicitParam
  735. // CHECK:STDOUT: }
  736. // CHECK:STDOUT:
  737. // CHECK:STDOUT: class @FExtraReturnType {
  738. // CHECK:STDOUT: impl_decl @impl.6 {
  739. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%.1]
  740. // CHECK:STDOUT: }
  741. // CHECK:STDOUT:
  742. // CHECK:STDOUT: !members:
  743. // CHECK:STDOUT: .Self = constants.%FExtraReturnType
  744. // CHECK:STDOUT: }
  745. // CHECK:STDOUT:
  746. // CHECK:STDOUT: class @FMissingParam {
  747. // CHECK:STDOUT: impl_decl @impl.7 {
  748. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%.6]
  749. // CHECK:STDOUT: }
  750. // CHECK:STDOUT:
  751. // CHECK:STDOUT: !members:
  752. // CHECK:STDOUT: .Self = constants.%FMissingParam
  753. // CHECK:STDOUT: }
  754. // CHECK:STDOUT:
  755. // CHECK:STDOUT: class @FMissingImplicitParam {
  756. // CHECK:STDOUT: impl_decl @impl.8 {
  757. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%.6]
  758. // CHECK:STDOUT: }
  759. // CHECK:STDOUT:
  760. // CHECK:STDOUT: !members:
  761. // CHECK:STDOUT: .Self = constants.%FMissingImplicitParam
  762. // CHECK:STDOUT: }
  763. // CHECK:STDOUT:
  764. // CHECK:STDOUT: class @FMissingReturnType {
  765. // CHECK:STDOUT: impl_decl @impl.9 {
  766. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%.6]
  767. // CHECK:STDOUT: }
  768. // CHECK:STDOUT:
  769. // CHECK:STDOUT: !members:
  770. // CHECK:STDOUT: .Self = constants.%FMissingReturnType
  771. // CHECK:STDOUT: }
  772. // CHECK:STDOUT:
  773. // CHECK:STDOUT: class @FDifferentParamType {
  774. // CHECK:STDOUT: impl_decl @impl.10 {
  775. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%.6]
  776. // CHECK:STDOUT: }
  777. // CHECK:STDOUT:
  778. // CHECK:STDOUT: !members:
  779. // CHECK:STDOUT: .Self = constants.%FDifferentParamType
  780. // CHECK:STDOUT: }
  781. // CHECK:STDOUT:
  782. // CHECK:STDOUT: class @FDifferentImplicitParamType {
  783. // CHECK:STDOUT: impl_decl @impl.11 {
  784. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%.6]
  785. // CHECK:STDOUT: }
  786. // CHECK:STDOUT:
  787. // CHECK:STDOUT: !members:
  788. // CHECK:STDOUT: .Self = constants.%FDifferentImplicitParamType
  789. // CHECK:STDOUT: }
  790. // CHECK:STDOUT:
  791. // CHECK:STDOUT: class @FDifferentReturnType {
  792. // CHECK:STDOUT: impl_decl @impl.12 {
  793. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%.6]
  794. // CHECK:STDOUT: }
  795. // CHECK:STDOUT:
  796. // CHECK:STDOUT: !members:
  797. // CHECK:STDOUT: .Self = constants.%FDifferentReturnType
  798. // CHECK:STDOUT: }
  799. // CHECK:STDOUT:
  800. // CHECK:STDOUT: class @FDifferentParamName {
  801. // CHECK:STDOUT: impl_decl @impl.13 {
  802. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%.6]
  803. // CHECK:STDOUT: }
  804. // CHECK:STDOUT:
  805. // CHECK:STDOUT: !members:
  806. // CHECK:STDOUT: .Self = constants.%FDifferentParamName
  807. // CHECK:STDOUT: }
  808. // CHECK:STDOUT:
  809. // CHECK:STDOUT: class @SelfNestedBadParam {
  810. // CHECK:STDOUT: impl_decl @impl.14 {
  811. // CHECK:STDOUT: %SelfNested.ref: type = name_ref SelfNested, file.%SelfNested.decl [template = constants.%.9]
  812. // CHECK:STDOUT: }
  813. // CHECK:STDOUT:
  814. // CHECK:STDOUT: !members:
  815. // CHECK:STDOUT: .Self = constants.%SelfNestedBadParam
  816. // CHECK:STDOUT: }
  817. // CHECK:STDOUT:
  818. // CHECK:STDOUT: class @SelfNestedBadReturnType {
  819. // CHECK:STDOUT: impl_decl @impl.15 {
  820. // CHECK:STDOUT: %SelfNested.ref: type = name_ref SelfNested, file.%SelfNested.decl [template = constants.%.9]
  821. // CHECK:STDOUT: }
  822. // CHECK:STDOUT:
  823. // CHECK:STDOUT: !members:
  824. // CHECK:STDOUT: .Self = constants.%SelfNestedBadReturnType
  825. // CHECK:STDOUT: }
  826. // CHECK:STDOUT:
  827. // CHECK:STDOUT: fn @F.1()
  828. // CHECK:STDOUT: generic [@I.%Self: %.1];
  829. // CHECK:STDOUT:
  830. // CHECK:STDOUT: fn @PossiblyF();
  831. // CHECK:STDOUT:
  832. // CHECK:STDOUT: fn @Bool() -> type = "bool.make_type";
  833. // CHECK:STDOUT:
  834. // CHECK:STDOUT: fn @F.2(@impl.4.%b.loc62_10.2: bool);
  835. // CHECK:STDOUT:
  836. // CHECK:STDOUT: fn @F.3[@impl.5.%self.loc75_10.2: %FExtraImplicitParam]();
  837. // CHECK:STDOUT:
  838. // CHECK:STDOUT: fn @F.4() -> bool;
  839. // CHECK:STDOUT:
  840. // CHECK:STDOUT: fn @F.5[@J.%self.loc93_20.2: bool](@J.%b.loc93_32.2: bool) -> bool
  841. // CHECK:STDOUT: generic [@J.%Self: %.6];
  842. // CHECK:STDOUT:
  843. // CHECK:STDOUT: fn @F.6[@impl.7.%self.loc104_10.2: bool]() -> bool;
  844. // CHECK:STDOUT:
  845. // CHECK:STDOUT: fn @F.7(@impl.8.%b.loc117_10.2: bool) -> bool;
  846. // CHECK:STDOUT:
  847. // CHECK:STDOUT: fn @F.8[@impl.9.%self.loc130_10.2: bool](@impl.9.%b.loc130_22.2: bool);
  848. // CHECK:STDOUT:
  849. // CHECK:STDOUT: fn @F.9[@impl.10.%self.loc143_10.2: bool](@impl.10.%b.loc143_22.2: %FDifferentParamType) -> bool;
  850. // CHECK:STDOUT:
  851. // CHECK:STDOUT: fn @F.10[@impl.11.%self.loc156_10.2: %FDifferentImplicitParamType](@impl.11.%b.loc156_22.2: bool) -> bool;
  852. // CHECK:STDOUT:
  853. // CHECK:STDOUT: fn @F.11[@impl.12.%self.loc169_10.2: bool](@impl.12.%b.loc169_22.2: bool) -> %FDifferentReturnType;
  854. // CHECK:STDOUT:
  855. // CHECK:STDOUT: fn @F.12[@impl.13.%self.loc183_10.2: bool](@impl.13.%not_b.loc183_22.2: bool) -> bool;
  856. // CHECK:STDOUT:
  857. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  858. // CHECK:STDOUT:
  859. // CHECK:STDOUT: fn @F.13(@SelfNested.%x.loc188_8.2: %.13) -> %.15
  860. // CHECK:STDOUT: generic [@SelfNested.%Self: %.9];
  861. // CHECK:STDOUT:
  862. // CHECK:STDOUT: fn @F.14(@impl.14.%x.loc200_10.2: %.20) -> %.21;
  863. // CHECK:STDOUT:
  864. // CHECK:STDOUT: fn @F.15(@impl.15.%x.loc212_10.2: %.26) -> %.21;
  865. // CHECK:STDOUT: