fail_impl_bad_assoc_fn.carbon 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  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. interface I { fn F(); }
  7. class NoF {
  8. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+6]]:3: ERROR: Missing implementation of F in impl of interface I.
  9. // CHECK:STDERR: impl as I {}
  10. // CHECK:STDERR: ^~~~~~~~~~~
  11. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-6]]:15: Associated function F declared here.
  12. // CHECK:STDERR: interface I { fn F(); }
  13. // CHECK:STDERR: ^~~~~~~
  14. impl as I {}
  15. }
  16. class FNotFunction {
  17. impl as I {
  18. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+6]]:5: ERROR: Associated function F implemented by non-function.
  19. // CHECK:STDERR: class F;
  20. // CHECK:STDERR: ^~~~~~~~
  21. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-17]]:15: Associated function F declared here.
  22. // CHECK:STDERR: interface I { fn F(); }
  23. // CHECK:STDERR: ^~~~~~~
  24. class F;
  25. }
  26. }
  27. fn PossiblyF();
  28. // TODO: Should this be permitted?
  29. class FAlias {
  30. impl as I {
  31. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+6]]:11: ERROR: Associated function F implemented by non-function.
  32. // CHECK:STDERR: alias F = PossiblyF;
  33. // CHECK:STDERR: ^
  34. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-32]]:15: Associated function F declared here.
  35. // CHECK:STDERR: interface I { fn F(); }
  36. // CHECK:STDERR: ^~~~~~~
  37. alias F = PossiblyF;
  38. }
  39. }
  40. class FExtraParam {
  41. impl as I {
  42. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+6]]:5: ERROR: Function redeclaration differs because of parameter count of 1.
  43. // CHECK:STDERR: fn F(b: bool);
  44. // CHECK:STDERR: ^~~~~~~~~~~~~~
  45. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-44]]:15: Previously declared with parameter count of 0.
  46. // CHECK:STDERR: interface I { fn F(); }
  47. // CHECK:STDERR: ^~~~~~~
  48. fn F(b: bool);
  49. }
  50. }
  51. class FExtraImplicitParam {
  52. impl as I {
  53. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+6]]:5: ERROR: Function redeclaration differs because of implicit parameter count of 1.
  54. // CHECK:STDERR: fn F[self: Self]();
  55. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
  56. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-56]]:15: Previously declared with implicit parameter count of 0.
  57. // CHECK:STDERR: interface I { fn F(); }
  58. // CHECK:STDERR: ^~~~~~~
  59. fn F[self: Self]();
  60. }
  61. }
  62. // TODO: Should this be permitted?
  63. class FExtraReturnType {
  64. impl as I {
  65. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+6]]:5: ERROR: Function redeclaration differs because return type is `bool`.
  66. // CHECK:STDERR: fn F() -> bool;
  67. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  68. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-69]]:15: Previously declared with no return type.
  69. // CHECK:STDERR: interface I { fn F(); }
  70. // CHECK:STDERR: ^~~~~~~
  71. fn F() -> bool;
  72. }
  73. }
  74. interface J { fn F[self: bool](b: bool) -> bool; }
  75. class FMissingParam {
  76. impl as J {
  77. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+6]]:5: ERROR: Function redeclaration differs because of parameter count of 0.
  78. // CHECK:STDERR: fn F[self: bool]() -> bool;
  79. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  80. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-7]]:15: Previously declared with parameter count of 1.
  81. // CHECK:STDERR: interface J { fn F[self: bool](b: bool) -> bool; }
  82. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  83. fn F[self: bool]() -> bool;
  84. }
  85. }
  86. class FMissingImplicitParam {
  87. impl as J {
  88. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+6]]:5: ERROR: Function redeclaration differs because of implicit parameter count of 0.
  89. // CHECK:STDERR: fn F(b: bool) -> bool;
  90. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~
  91. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-19]]:15: Previously declared with implicit parameter count of 1.
  92. // CHECK:STDERR: interface J { fn F[self: bool](b: bool) -> bool; }
  93. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  94. fn F(b: bool) -> bool;
  95. }
  96. }
  97. class FMissingReturnType {
  98. impl as J {
  99. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+6]]:5: ERROR: Function redeclaration differs because no return type is provided.
  100. // CHECK:STDERR: fn F[self: bool](b: bool);
  101. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
  102. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-31]]:15: Previously declared with return type `bool`.
  103. // CHECK:STDERR: interface J { fn F[self: bool](b: bool) -> bool; }
  104. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  105. fn F[self: bool](b: bool);
  106. }
  107. }
  108. class FDifferentParamType {
  109. impl as J {
  110. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+6]]:22: ERROR: Function redeclaration differs at parameter 1.
  111. // CHECK:STDERR: fn F[self: bool](b: Self) -> bool;
  112. // CHECK:STDERR: ^
  113. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-43]]:32: Previous declaration's corresponding parameter here.
  114. // CHECK:STDERR: interface J { fn F[self: bool](b: bool) -> bool; }
  115. // CHECK:STDERR: ^
  116. fn F[self: bool](b: Self) -> bool;
  117. }
  118. }
  119. class FDifferentImplicitParamType {
  120. impl as J {
  121. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+6]]:10: ERROR: Function redeclaration differs at implicit parameter 1.
  122. // CHECK:STDERR: fn F[self: Self](b: bool) -> bool;
  123. // CHECK:STDERR: ^~~~
  124. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-55]]:20: Previous declaration's corresponding implicit parameter here.
  125. // CHECK:STDERR: interface J { fn F[self: bool](b: bool) -> bool; }
  126. // CHECK:STDERR: ^~~~
  127. fn F[self: Self](b: bool) -> bool;
  128. }
  129. }
  130. class FDifferentReturnType {
  131. impl as J {
  132. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+6]]:31: ERROR: Function returns incomplete type `FDifferentReturnType`.
  133. // CHECK:STDERR: fn F[self: bool](b: bool) -> Self;
  134. // CHECK:STDERR: ^~~~~~~
  135. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-5]]:1: Class is incomplete within its definition.
  136. // CHECK:STDERR: class FDifferentReturnType {
  137. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  138. fn F[self: bool](b: bool) -> Self;
  139. }
  140. }
  141. // TODO: This should probably be permitted.
  142. class FDifferentParamName {
  143. impl as J {
  144. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+6]]:22: ERROR: Function redeclaration differs at parameter 1.
  145. // CHECK:STDERR: fn F[self: bool](not_b: bool) -> bool;
  146. // CHECK:STDERR: ^~~~~
  147. // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-80]]:32: Previous declaration's corresponding parameter here.
  148. // CHECK:STDERR: interface J { fn F[self: bool](b: bool) -> bool; }
  149. // CHECK:STDERR: ^
  150. fn F[self: bool](not_b: bool) -> bool;
  151. }
  152. }
  153. // CHECK:STDOUT: --- fail_impl_bad_assoc_fn.carbon
  154. // CHECK:STDOUT:
  155. // CHECK:STDOUT: constants {
  156. // CHECK:STDOUT: %.1: type = interface_type @I [template]
  157. // CHECK:STDOUT: %.2: type = assoc_entity_type @I, <function> [template]
  158. // CHECK:STDOUT: %.3: <associated <function> in I> = assoc_entity element0, @I.%F [template]
  159. // CHECK:STDOUT: %NoF: type = class_type @NoF [template]
  160. // CHECK:STDOUT: %.4: type = struct_type {} [template]
  161. // CHECK:STDOUT: %FNotFunction: type = class_type @FNotFunction [template]
  162. // CHECK:STDOUT: %F: type = class_type @F.13 [template]
  163. // CHECK:STDOUT: %FAlias: type = class_type @FAlias [template]
  164. // CHECK:STDOUT: %FExtraParam: type = class_type @FExtraParam [template]
  165. // CHECK:STDOUT: %FExtraImplicitParam: type = class_type @FExtraImplicitParam [template]
  166. // CHECK:STDOUT: %FExtraReturnType: type = class_type @FExtraReturnType [template]
  167. // CHECK:STDOUT: %.5: type = interface_type @J [template]
  168. // CHECK:STDOUT: %.6: type = assoc_entity_type @J, <function> [template]
  169. // CHECK:STDOUT: %.7: <associated <function> in J> = assoc_entity element0, @J.%F [template]
  170. // CHECK:STDOUT: %FMissingParam: type = class_type @FMissingParam [template]
  171. // CHECK:STDOUT: %FMissingImplicitParam: type = class_type @FMissingImplicitParam [template]
  172. // CHECK:STDOUT: %FMissingReturnType: type = class_type @FMissingReturnType [template]
  173. // CHECK:STDOUT: %FDifferentParamType: type = class_type @FDifferentParamType [template]
  174. // CHECK:STDOUT: %FDifferentImplicitParamType: type = class_type @FDifferentImplicitParamType [template]
  175. // CHECK:STDOUT: %FDifferentReturnType: type = class_type @FDifferentReturnType [template]
  176. // CHECK:STDOUT: %FDifferentParamName: type = class_type @FDifferentParamName [template]
  177. // CHECK:STDOUT: }
  178. // CHECK:STDOUT:
  179. // CHECK:STDOUT: file {
  180. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  181. // CHECK:STDOUT: .I = %I.decl
  182. // CHECK:STDOUT: .NoF = %NoF.decl
  183. // CHECK:STDOUT: .FNotFunction = %FNotFunction.decl
  184. // CHECK:STDOUT: .PossiblyF = %PossiblyF
  185. // CHECK:STDOUT: .FAlias = %FAlias.decl
  186. // CHECK:STDOUT: .FExtraParam = %FExtraParam.decl
  187. // CHECK:STDOUT: .FExtraImplicitParam = %FExtraImplicitParam.decl
  188. // CHECK:STDOUT: .FExtraReturnType = %FExtraReturnType.decl
  189. // CHECK:STDOUT: .J = %J.decl
  190. // CHECK:STDOUT: .FMissingParam = %FMissingParam.decl
  191. // CHECK:STDOUT: .FMissingImplicitParam = %FMissingImplicitParam.decl
  192. // CHECK:STDOUT: .FMissingReturnType = %FMissingReturnType.decl
  193. // CHECK:STDOUT: .FDifferentParamType = %FDifferentParamType.decl
  194. // CHECK:STDOUT: .FDifferentImplicitParamType = %FDifferentImplicitParamType.decl
  195. // CHECK:STDOUT: .FDifferentReturnType = %FDifferentReturnType.decl
  196. // CHECK:STDOUT: .FDifferentParamName = %FDifferentParamName.decl
  197. // CHECK:STDOUT: }
  198. // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {}
  199. // CHECK:STDOUT: %NoF.decl: type = class_decl @NoF [template = constants.%NoF] {}
  200. // CHECK:STDOUT: %FNotFunction.decl: type = class_decl @FNotFunction [template = constants.%FNotFunction] {}
  201. // CHECK:STDOUT: %PossiblyF: <function> = fn_decl @PossiblyF [template] {}
  202. // CHECK:STDOUT: %FAlias.decl: type = class_decl @FAlias [template = constants.%FAlias] {}
  203. // CHECK:STDOUT: %FExtraParam.decl: type = class_decl @FExtraParam [template = constants.%FExtraParam] {}
  204. // CHECK:STDOUT: %FExtraImplicitParam.decl: type = class_decl @FExtraImplicitParam [template = constants.%FExtraImplicitParam] {}
  205. // CHECK:STDOUT: %FExtraReturnType.decl: type = class_decl @FExtraReturnType [template = constants.%FExtraReturnType] {}
  206. // CHECK:STDOUT: %J.decl: type = interface_decl @J [template = constants.%.5] {}
  207. // CHECK:STDOUT: %FMissingParam.decl: type = class_decl @FMissingParam [template = constants.%FMissingParam] {}
  208. // CHECK:STDOUT: %FMissingImplicitParam.decl: type = class_decl @FMissingImplicitParam [template = constants.%FMissingImplicitParam] {}
  209. // CHECK:STDOUT: %FMissingReturnType.decl: type = class_decl @FMissingReturnType [template = constants.%FMissingReturnType] {}
  210. // CHECK:STDOUT: %FDifferentParamType.decl: type = class_decl @FDifferentParamType [template = constants.%FDifferentParamType] {}
  211. // CHECK:STDOUT: %FDifferentImplicitParamType.decl: type = class_decl @FDifferentImplicitParamType [template = constants.%FDifferentImplicitParamType] {}
  212. // CHECK:STDOUT: %FDifferentReturnType.decl: type = class_decl @FDifferentReturnType [template = constants.%FDifferentReturnType] {}
  213. // CHECK:STDOUT: %FDifferentParamName.decl: type = class_decl @FDifferentParamName [template = constants.%FDifferentParamName] {}
  214. // CHECK:STDOUT: }
  215. // CHECK:STDOUT:
  216. // CHECK:STDOUT: interface @I {
  217. // CHECK:STDOUT: %Self: I = bind_symbolic_name Self [symbolic]
  218. // CHECK:STDOUT: %F: <function> = fn_decl @F.1 [template] {}
  219. // CHECK:STDOUT: %.loc7: <associated <function> in I> = assoc_entity element0, %F [template = constants.%.3]
  220. // CHECK:STDOUT:
  221. // CHECK:STDOUT: !members:
  222. // CHECK:STDOUT: .Self = %Self
  223. // CHECK:STDOUT: .F = %.loc7
  224. // CHECK:STDOUT: witness = (%F)
  225. // CHECK:STDOUT: }
  226. // CHECK:STDOUT:
  227. // CHECK:STDOUT: interface @J {
  228. // CHECK:STDOUT: %Self: J = bind_symbolic_name Self [symbolic]
  229. // CHECK:STDOUT: %F: <function> = fn_decl @F.5 [template] {
  230. // CHECK:STDOUT: %self.loc83_20.1: bool = param self
  231. // CHECK:STDOUT: %self.loc83_20.2: bool = bind_name self, %self.loc83_20.1
  232. // CHECK:STDOUT: %b.loc83_32.1: bool = param b
  233. // CHECK:STDOUT: %b.loc83_32.2: bool = bind_name b, %b.loc83_32.1
  234. // CHECK:STDOUT: %return.var: ref bool = var <return slot>
  235. // CHECK:STDOUT: }
  236. // CHECK:STDOUT: %.loc83: <associated <function> in J> = assoc_entity element0, %F [template = constants.%.7]
  237. // CHECK:STDOUT:
  238. // CHECK:STDOUT: !members:
  239. // CHECK:STDOUT: .Self = %Self
  240. // CHECK:STDOUT: .F = %.loc83
  241. // CHECK:STDOUT: witness = (%F)
  242. // CHECK:STDOUT: }
  243. // CHECK:STDOUT:
  244. // CHECK:STDOUT: impl @impl.1: NoF as I {
  245. // CHECK:STDOUT: %.1: <witness> = interface_witness @I, (<error>) [template = <error>]
  246. // CHECK:STDOUT:
  247. // CHECK:STDOUT: !members:
  248. // CHECK:STDOUT: witness = %.1
  249. // CHECK:STDOUT: }
  250. // CHECK:STDOUT:
  251. // CHECK:STDOUT: impl @impl.2: FNotFunction as I {
  252. // CHECK:STDOUT: %F.decl: type = class_decl @F.13 [template = constants.%F] {}
  253. // CHECK:STDOUT: %.1: <witness> = interface_witness @I, (<error>) [template = <error>]
  254. // CHECK:STDOUT:
  255. // CHECK:STDOUT: !members:
  256. // CHECK:STDOUT: .F = %F.decl
  257. // CHECK:STDOUT: witness = %.1
  258. // CHECK:STDOUT: }
  259. // CHECK:STDOUT:
  260. // CHECK:STDOUT: impl @impl.3: FAlias as I {
  261. // CHECK:STDOUT: %PossiblyF.ref: <function> = name_ref PossiblyF, file.%PossiblyF [template = file.%PossiblyF]
  262. // CHECK:STDOUT: %F: <function> = bind_alias F, file.%PossiblyF [template = file.%PossiblyF]
  263. // CHECK:STDOUT: %.1: <witness> = interface_witness @I, (<error>) [template = <error>]
  264. // CHECK:STDOUT:
  265. // CHECK:STDOUT: !members:
  266. // CHECK:STDOUT: .F = %F
  267. // CHECK:STDOUT: witness = %.1
  268. // CHECK:STDOUT: }
  269. // CHECK:STDOUT:
  270. // CHECK:STDOUT: impl @impl.4: FExtraParam as I {
  271. // CHECK:STDOUT: %F: <function> = fn_decl @F.2 [template] {
  272. // CHECK:STDOUT: %b.loc54_10.1: bool = param b
  273. // CHECK:STDOUT: %b.loc54_10.2: bool = bind_name b, %b.loc54_10.1
  274. // CHECK:STDOUT: }
  275. // CHECK:STDOUT: %.1: <witness> = interface_witness @I, (<error>) [template = <error>]
  276. // CHECK:STDOUT:
  277. // CHECK:STDOUT: !members:
  278. // CHECK:STDOUT: .F = %F
  279. // CHECK:STDOUT: witness = %.1
  280. // CHECK:STDOUT: }
  281. // CHECK:STDOUT:
  282. // CHECK:STDOUT: impl @impl.5: FExtraImplicitParam as I {
  283. // CHECK:STDOUT: %F: <function> = fn_decl @F.3 [template] {
  284. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FExtraImplicitParam [template = constants.%FExtraImplicitParam]
  285. // CHECK:STDOUT: %self.loc66_10.1: FExtraImplicitParam = param self
  286. // CHECK:STDOUT: %self.loc66_10.2: FExtraImplicitParam = bind_name self, %self.loc66_10.1
  287. // CHECK:STDOUT: }
  288. // CHECK:STDOUT: %.1: <witness> = interface_witness @I, (<error>) [template = <error>]
  289. // CHECK:STDOUT:
  290. // CHECK:STDOUT: !members:
  291. // CHECK:STDOUT: .F = %F
  292. // CHECK:STDOUT: witness = %.1
  293. // CHECK:STDOUT: }
  294. // CHECK:STDOUT:
  295. // CHECK:STDOUT: impl @impl.6: FExtraReturnType as I {
  296. // CHECK:STDOUT: %F: <function> = fn_decl @F.4 [template] {
  297. // CHECK:STDOUT: %return.var: ref bool = var <return slot>
  298. // CHECK:STDOUT: }
  299. // CHECK:STDOUT: %.1: <witness> = interface_witness @I, (<error>) [template = <error>]
  300. // CHECK:STDOUT:
  301. // CHECK:STDOUT: !members:
  302. // CHECK:STDOUT: .F = %F
  303. // CHECK:STDOUT: witness = %.1
  304. // CHECK:STDOUT: }
  305. // CHECK:STDOUT:
  306. // CHECK:STDOUT: impl @impl.7: FMissingParam as J {
  307. // CHECK:STDOUT: %F: <function> = fn_decl @F.6 [template] {
  308. // CHECK:STDOUT: %self.loc93_10.1: bool = param self
  309. // CHECK:STDOUT: %self.loc93_10.2: bool = bind_name self, %self.loc93_10.1
  310. // CHECK:STDOUT: %return.var: ref bool = var <return slot>
  311. // CHECK:STDOUT: }
  312. // CHECK:STDOUT: %.1: <witness> = interface_witness @J, (<error>) [template = <error>]
  313. // CHECK:STDOUT:
  314. // CHECK:STDOUT: !members:
  315. // CHECK:STDOUT: .F = %F
  316. // CHECK:STDOUT: witness = %.1
  317. // CHECK:STDOUT: }
  318. // CHECK:STDOUT:
  319. // CHECK:STDOUT: impl @impl.8: FMissingImplicitParam as J {
  320. // CHECK:STDOUT: %F: <function> = fn_decl @F.7 [template] {
  321. // CHECK:STDOUT: %b.loc105_10.1: bool = param b
  322. // CHECK:STDOUT: %b.loc105_10.2: bool = bind_name b, %b.loc105_10.1
  323. // CHECK:STDOUT: %return.var: ref bool = var <return slot>
  324. // CHECK:STDOUT: }
  325. // CHECK:STDOUT: %.1: <witness> = interface_witness @J, (<error>) [template = <error>]
  326. // CHECK:STDOUT:
  327. // CHECK:STDOUT: !members:
  328. // CHECK:STDOUT: .F = %F
  329. // CHECK:STDOUT: witness = %.1
  330. // CHECK:STDOUT: }
  331. // CHECK:STDOUT:
  332. // CHECK:STDOUT: impl @impl.9: FMissingReturnType as J {
  333. // CHECK:STDOUT: %F: <function> = fn_decl @F.8 [template] {
  334. // CHECK:STDOUT: %self.loc117_10.1: bool = param self
  335. // CHECK:STDOUT: %self.loc117_10.2: bool = bind_name self, %self.loc117_10.1
  336. // CHECK:STDOUT: %b.loc117_22.1: bool = param b
  337. // CHECK:STDOUT: %b.loc117_22.2: bool = bind_name b, %b.loc117_22.1
  338. // CHECK:STDOUT: }
  339. // CHECK:STDOUT: %.1: <witness> = interface_witness @J, (<error>) [template = <error>]
  340. // CHECK:STDOUT:
  341. // CHECK:STDOUT: !members:
  342. // CHECK:STDOUT: .F = %F
  343. // CHECK:STDOUT: witness = %.1
  344. // CHECK:STDOUT: }
  345. // CHECK:STDOUT:
  346. // CHECK:STDOUT: impl @impl.10: FDifferentParamType as J {
  347. // CHECK:STDOUT: %F: <function> = fn_decl @F.9 [template] {
  348. // CHECK:STDOUT: %self.loc129_10.1: bool = param self
  349. // CHECK:STDOUT: %self.loc129_10.2: bool = bind_name self, %self.loc129_10.1
  350. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FDifferentParamType [template = constants.%FDifferentParamType]
  351. // CHECK:STDOUT: %b.loc129_22.1: FDifferentParamType = param b
  352. // CHECK:STDOUT: %b.loc129_22.2: FDifferentParamType = bind_name b, %b.loc129_22.1
  353. // CHECK:STDOUT: %return.var: ref bool = var <return slot>
  354. // CHECK:STDOUT: }
  355. // CHECK:STDOUT: %.1: <witness> = interface_witness @J, (<error>) [template = <error>]
  356. // CHECK:STDOUT:
  357. // CHECK:STDOUT: !members:
  358. // CHECK:STDOUT: .F = %F
  359. // CHECK:STDOUT: witness = %.1
  360. // CHECK:STDOUT: }
  361. // CHECK:STDOUT:
  362. // CHECK:STDOUT: impl @impl.11: FDifferentImplicitParamType as J {
  363. // CHECK:STDOUT: %F: <function> = fn_decl @F.10 [template] {
  364. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FDifferentImplicitParamType [template = constants.%FDifferentImplicitParamType]
  365. // CHECK:STDOUT: %self.loc141_10.1: FDifferentImplicitParamType = param self
  366. // CHECK:STDOUT: %self.loc141_10.2: FDifferentImplicitParamType = bind_name self, %self.loc141_10.1
  367. // CHECK:STDOUT: %b.loc141_22.1: bool = param b
  368. // CHECK:STDOUT: %b.loc141_22.2: bool = bind_name b, %b.loc141_22.1
  369. // CHECK:STDOUT: %return.var: ref bool = var <return slot>
  370. // CHECK:STDOUT: }
  371. // CHECK:STDOUT: %.1: <witness> = interface_witness @J, (<error>) [template = <error>]
  372. // CHECK:STDOUT:
  373. // CHECK:STDOUT: !members:
  374. // CHECK:STDOUT: .F = %F
  375. // CHECK:STDOUT: witness = %.1
  376. // CHECK:STDOUT: }
  377. // CHECK:STDOUT:
  378. // CHECK:STDOUT: impl @impl.12: FDifferentReturnType as J {
  379. // CHECK:STDOUT: %F: <function> = fn_decl @F.11 [template] {
  380. // CHECK:STDOUT: %self.loc153_10.1: bool = param self
  381. // CHECK:STDOUT: %self.loc153_10.2: bool = bind_name self, %self.loc153_10.1
  382. // CHECK:STDOUT: %b.loc153_22.1: bool = param b
  383. // CHECK:STDOUT: %b.loc153_22.2: bool = bind_name b, %b.loc153_22.1
  384. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FDifferentReturnType [template = constants.%FDifferentReturnType]
  385. // CHECK:STDOUT: %return.var: ref FDifferentReturnType = var <return slot>
  386. // CHECK:STDOUT: }
  387. // CHECK:STDOUT: %.1: <witness> = interface_witness @J, (<error>) [template = <error>]
  388. // CHECK:STDOUT:
  389. // CHECK:STDOUT: !members:
  390. // CHECK:STDOUT: .F = %F
  391. // CHECK:STDOUT: witness = %.1
  392. // CHECK:STDOUT: }
  393. // CHECK:STDOUT:
  394. // CHECK:STDOUT: impl @impl.13: FDifferentParamName as J {
  395. // CHECK:STDOUT: %F: <function> = fn_decl @F.12 [template] {
  396. // CHECK:STDOUT: %self.loc166_10.1: bool = param self
  397. // CHECK:STDOUT: %self.loc166_10.2: bool = bind_name self, %self.loc166_10.1
  398. // CHECK:STDOUT: %not_b.loc166_22.1: bool = param not_b
  399. // CHECK:STDOUT: %not_b.loc166_22.2: bool = bind_name not_b, %not_b.loc166_22.1
  400. // CHECK:STDOUT: %return.var: ref bool = var <return slot>
  401. // CHECK:STDOUT: }
  402. // CHECK:STDOUT: %.1: <witness> = interface_witness @J, (<error>) [template = <error>]
  403. // CHECK:STDOUT:
  404. // CHECK:STDOUT: !members:
  405. // CHECK:STDOUT: .F = %F
  406. // CHECK:STDOUT: witness = %.1
  407. // CHECK:STDOUT: }
  408. // CHECK:STDOUT:
  409. // CHECK:STDOUT: class @NoF {
  410. // CHECK:STDOUT: impl_decl @impl.1 {
  411. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%.1]
  412. // CHECK:STDOUT: }
  413. // CHECK:STDOUT:
  414. // CHECK:STDOUT: !members:
  415. // CHECK:STDOUT: .Self = constants.%NoF
  416. // CHECK:STDOUT: }
  417. // CHECK:STDOUT:
  418. // CHECK:STDOUT: class @FNotFunction {
  419. // CHECK:STDOUT: impl_decl @impl.2 {
  420. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%.1]
  421. // CHECK:STDOUT: }
  422. // CHECK:STDOUT:
  423. // CHECK:STDOUT: !members:
  424. // CHECK:STDOUT: .Self = constants.%FNotFunction
  425. // CHECK:STDOUT: }
  426. // CHECK:STDOUT:
  427. // CHECK:STDOUT: class @F.13;
  428. // CHECK:STDOUT:
  429. // CHECK:STDOUT: class @FAlias {
  430. // CHECK:STDOUT: impl_decl @impl.3 {
  431. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%.1]
  432. // CHECK:STDOUT: }
  433. // CHECK:STDOUT:
  434. // CHECK:STDOUT: !members:
  435. // CHECK:STDOUT: .Self = constants.%FAlias
  436. // CHECK:STDOUT: }
  437. // CHECK:STDOUT:
  438. // CHECK:STDOUT: class @FExtraParam {
  439. // CHECK:STDOUT: impl_decl @impl.4 {
  440. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%.1]
  441. // CHECK:STDOUT: }
  442. // CHECK:STDOUT:
  443. // CHECK:STDOUT: !members:
  444. // CHECK:STDOUT: .Self = constants.%FExtraParam
  445. // CHECK:STDOUT: }
  446. // CHECK:STDOUT:
  447. // CHECK:STDOUT: class @FExtraImplicitParam {
  448. // CHECK:STDOUT: impl_decl @impl.5 {
  449. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%.1]
  450. // CHECK:STDOUT: }
  451. // CHECK:STDOUT:
  452. // CHECK:STDOUT: !members:
  453. // CHECK:STDOUT: .Self = constants.%FExtraImplicitParam
  454. // CHECK:STDOUT: }
  455. // CHECK:STDOUT:
  456. // CHECK:STDOUT: class @FExtraReturnType {
  457. // CHECK:STDOUT: impl_decl @impl.6 {
  458. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%.1]
  459. // CHECK:STDOUT: }
  460. // CHECK:STDOUT:
  461. // CHECK:STDOUT: !members:
  462. // CHECK:STDOUT: .Self = constants.%FExtraReturnType
  463. // CHECK:STDOUT: }
  464. // CHECK:STDOUT:
  465. // CHECK:STDOUT: class @FMissingParam {
  466. // CHECK:STDOUT: impl_decl @impl.7 {
  467. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%.5]
  468. // CHECK:STDOUT: }
  469. // CHECK:STDOUT:
  470. // CHECK:STDOUT: !members:
  471. // CHECK:STDOUT: .Self = constants.%FMissingParam
  472. // CHECK:STDOUT: }
  473. // CHECK:STDOUT:
  474. // CHECK:STDOUT: class @FMissingImplicitParam {
  475. // CHECK:STDOUT: impl_decl @impl.8 {
  476. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%.5]
  477. // CHECK:STDOUT: }
  478. // CHECK:STDOUT:
  479. // CHECK:STDOUT: !members:
  480. // CHECK:STDOUT: .Self = constants.%FMissingImplicitParam
  481. // CHECK:STDOUT: }
  482. // CHECK:STDOUT:
  483. // CHECK:STDOUT: class @FMissingReturnType {
  484. // CHECK:STDOUT: impl_decl @impl.9 {
  485. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%.5]
  486. // CHECK:STDOUT: }
  487. // CHECK:STDOUT:
  488. // CHECK:STDOUT: !members:
  489. // CHECK:STDOUT: .Self = constants.%FMissingReturnType
  490. // CHECK:STDOUT: }
  491. // CHECK:STDOUT:
  492. // CHECK:STDOUT: class @FDifferentParamType {
  493. // CHECK:STDOUT: impl_decl @impl.10 {
  494. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%.5]
  495. // CHECK:STDOUT: }
  496. // CHECK:STDOUT:
  497. // CHECK:STDOUT: !members:
  498. // CHECK:STDOUT: .Self = constants.%FDifferentParamType
  499. // CHECK:STDOUT: }
  500. // CHECK:STDOUT:
  501. // CHECK:STDOUT: class @FDifferentImplicitParamType {
  502. // CHECK:STDOUT: impl_decl @impl.11 {
  503. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%.5]
  504. // CHECK:STDOUT: }
  505. // CHECK:STDOUT:
  506. // CHECK:STDOUT: !members:
  507. // CHECK:STDOUT: .Self = constants.%FDifferentImplicitParamType
  508. // CHECK:STDOUT: }
  509. // CHECK:STDOUT:
  510. // CHECK:STDOUT: class @FDifferentReturnType {
  511. // CHECK:STDOUT: impl_decl @impl.12 {
  512. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%.5]
  513. // CHECK:STDOUT: }
  514. // CHECK:STDOUT:
  515. // CHECK:STDOUT: !members:
  516. // CHECK:STDOUT: .Self = constants.%FDifferentReturnType
  517. // CHECK:STDOUT: }
  518. // CHECK:STDOUT:
  519. // CHECK:STDOUT: class @FDifferentParamName {
  520. // CHECK:STDOUT: impl_decl @impl.13 {
  521. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%.5]
  522. // CHECK:STDOUT: }
  523. // CHECK:STDOUT:
  524. // CHECK:STDOUT: !members:
  525. // CHECK:STDOUT: .Self = constants.%FDifferentParamName
  526. // CHECK:STDOUT: }
  527. // CHECK:STDOUT:
  528. // CHECK:STDOUT: fn @F.1();
  529. // CHECK:STDOUT:
  530. // CHECK:STDOUT: fn @PossiblyF();
  531. // CHECK:STDOUT:
  532. // CHECK:STDOUT: fn @F.2(@impl.4.%b.loc54_10.2: bool);
  533. // CHECK:STDOUT:
  534. // CHECK:STDOUT: fn @F.3[@impl.5.%self.loc66_10.2: FExtraImplicitParam]();
  535. // CHECK:STDOUT:
  536. // CHECK:STDOUT: fn @F.4() -> bool;
  537. // CHECK:STDOUT:
  538. // CHECK:STDOUT: fn @F.5[@J.%self.loc83_20.2: bool](@J.%b.loc83_32.2: bool) -> bool;
  539. // CHECK:STDOUT:
  540. // CHECK:STDOUT: fn @F.6[@impl.7.%self.loc93_10.2: bool]() -> bool;
  541. // CHECK:STDOUT:
  542. // CHECK:STDOUT: fn @F.7(@impl.8.%b.loc105_10.2: bool) -> bool;
  543. // CHECK:STDOUT:
  544. // CHECK:STDOUT: fn @F.8[@impl.9.%self.loc117_10.2: bool](@impl.9.%b.loc117_22.2: bool);
  545. // CHECK:STDOUT:
  546. // CHECK:STDOUT: fn @F.9[@impl.10.%self.loc129_10.2: bool](@impl.10.%b.loc129_22.2: FDifferentParamType) -> bool;
  547. // CHECK:STDOUT:
  548. // CHECK:STDOUT: fn @F.10[@impl.11.%self.loc141_10.2: FDifferentImplicitParamType](@impl.11.%b.loc141_22.2: bool) -> bool;
  549. // CHECK:STDOUT:
  550. // CHECK:STDOUT: fn @F.11[@impl.12.%self.loc153_10.2: bool](@impl.12.%b.loc153_22.2: bool) -> <error>;
  551. // CHECK:STDOUT:
  552. // CHECK:STDOUT: fn @F.12[@impl.13.%self.loc166_10.2: bool](@impl.13.%not_b.loc166_22.2: bool) -> bool;
  553. // CHECK:STDOUT: