ordered.carbon 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  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. // --- prelude.carbon
  7. package Core api;
  8. import library "prelude";
  9. interface Ordered {
  10. // TODO: fn Compare
  11. fn Less[self: Self](other: Self) -> bool;
  12. fn LessOrEquivalent[self: Self](other: Self) -> bool;
  13. fn Greater[self: Self](other: Self) -> bool;
  14. fn GreaterOrEquivalent[self: Self](other: Self) -> bool;
  15. }
  16. // --- user.carbon
  17. package User api;
  18. import Core;
  19. class C {};
  20. impl C as Core.Ordered {
  21. fn Less[self: C](other: C) -> bool;
  22. fn LessOrEquivalent[self: C](other: C) -> bool;
  23. fn Greater[self: C](other: C) -> bool;
  24. fn GreaterOrEquivalent[self: C](other: C) -> bool;
  25. }
  26. fn TestLess(a: C, b: C) -> bool {
  27. return a < b;
  28. }
  29. fn TestLessEqual(a: C, b: C) -> bool {
  30. return a <= b;
  31. }
  32. fn TestGreater(a: C, b: C) -> bool {
  33. return a > b;
  34. }
  35. fn TestGreaterEqual(a: C, b: C) -> bool {
  36. return a >= b;
  37. }
  38. // --- fail_no_impl.carbon
  39. package FailNoImpl api;
  40. import Core;
  41. class D {};
  42. fn TestLess(a: D, b: D) -> bool {
  43. // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+4]]:10: ERROR: Cannot access member of interface Ordered in type D that does not implement that interface.
  44. // CHECK:STDERR: return a < b;
  45. // CHECK:STDERR: ^~~~~
  46. // CHECK:STDERR:
  47. return a < b;
  48. }
  49. fn TestLessEqual(a: D, b: D) -> bool {
  50. // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+4]]:10: ERROR: Cannot access member of interface Ordered in type D that does not implement that interface.
  51. // CHECK:STDERR: return a <= b;
  52. // CHECK:STDERR: ^~~~~~
  53. // CHECK:STDERR:
  54. return a <= b;
  55. }
  56. fn TestGreater(a: D, b: D) -> bool {
  57. // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+4]]:10: ERROR: Cannot access member of interface Ordered in type D that does not implement that interface.
  58. // CHECK:STDERR: return a > b;
  59. // CHECK:STDERR: ^~~~~
  60. // CHECK:STDERR:
  61. return a > b;
  62. }
  63. fn TestGreaterEqual(a: D, b: D) -> bool {
  64. // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+3]]:10: ERROR: Cannot access member of interface Ordered in type D that does not implement that interface.
  65. // CHECK:STDERR: return a >= b;
  66. // CHECK:STDERR: ^~~~~~
  67. return a >= b;
  68. }
  69. // CHECK:STDOUT: --- prelude.carbon
  70. // CHECK:STDOUT:
  71. // CHECK:STDOUT: constants {
  72. // CHECK:STDOUT: %.1: type = interface_type @Ordered [template]
  73. // CHECK:STDOUT: %Self: Ordered = bind_symbolic_name Self 0 [symbolic]
  74. // CHECK:STDOUT: %Less: type = fn_type @Less [template]
  75. // CHECK:STDOUT: %.2: type = tuple_type () [template]
  76. // CHECK:STDOUT: %struct.1: Less = struct_value () [template]
  77. // CHECK:STDOUT: %.3: type = assoc_entity_type @Ordered, Less [template]
  78. // CHECK:STDOUT: %.4: <associated Less in Ordered> = assoc_entity element0, @Ordered.%Less.decl [template]
  79. // CHECK:STDOUT: %LessOrEquivalent: type = fn_type @LessOrEquivalent [template]
  80. // CHECK:STDOUT: %struct.2: LessOrEquivalent = struct_value () [template]
  81. // CHECK:STDOUT: %.5: type = assoc_entity_type @Ordered, LessOrEquivalent [template]
  82. // CHECK:STDOUT: %.6: <associated LessOrEquivalent in Ordered> = assoc_entity element1, @Ordered.%LessOrEquivalent.decl [template]
  83. // CHECK:STDOUT: %Greater: type = fn_type @Greater [template]
  84. // CHECK:STDOUT: %struct.3: Greater = struct_value () [template]
  85. // CHECK:STDOUT: %.7: type = assoc_entity_type @Ordered, Greater [template]
  86. // CHECK:STDOUT: %.8: <associated Greater in Ordered> = assoc_entity element2, @Ordered.%Greater.decl [template]
  87. // CHECK:STDOUT: %GreaterOrEquivalent: type = fn_type @GreaterOrEquivalent [template]
  88. // CHECK:STDOUT: %struct.4: GreaterOrEquivalent = struct_value () [template]
  89. // CHECK:STDOUT: %.9: type = assoc_entity_type @Ordered, GreaterOrEquivalent [template]
  90. // CHECK:STDOUT: %.10: <associated GreaterOrEquivalent in Ordered> = assoc_entity element3, @Ordered.%GreaterOrEquivalent.decl [template]
  91. // CHECK:STDOUT: }
  92. // CHECK:STDOUT:
  93. // CHECK:STDOUT: file {
  94. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  95. // CHECK:STDOUT: .Ordered = %Ordered.decl
  96. // CHECK:STDOUT: }
  97. // CHECK:STDOUT: %Ordered.decl: type = interface_decl @Ordered [template = constants.%.1] {}
  98. // CHECK:STDOUT: }
  99. // CHECK:STDOUT:
  100. // CHECK:STDOUT: interface @Ordered {
  101. // CHECK:STDOUT: %Self: Ordered = bind_symbolic_name Self 0 [symbolic = constants.%Self]
  102. // CHECK:STDOUT: %Less.decl: Less = fn_decl @Less [template = constants.%struct.1] {
  103. // CHECK:STDOUT: %Self.ref.loc8_17: Ordered = name_ref Self, %Self [symbolic = constants.%Self]
  104. // CHECK:STDOUT: %.loc8_17.1: type = facet_type_access %Self.ref.loc8_17 [symbolic = constants.%Self]
  105. // CHECK:STDOUT: %.loc8_17.2: type = converted %Self.ref.loc8_17, %.loc8_17.1 [symbolic = constants.%Self]
  106. // CHECK:STDOUT: %self.loc8_11.1: Self = param self
  107. // CHECK:STDOUT: %self.loc8_11.2: Self = bind_name self, %self.loc8_11.1
  108. // CHECK:STDOUT: %Self.ref.loc8_30: Ordered = name_ref Self, %Self [symbolic = constants.%Self]
  109. // CHECK:STDOUT: %.loc8_30.1: type = facet_type_access %Self.ref.loc8_30 [symbolic = constants.%Self]
  110. // CHECK:STDOUT: %.loc8_30.2: type = converted %Self.ref.loc8_30, %.loc8_30.1 [symbolic = constants.%Self]
  111. // CHECK:STDOUT: %other.loc8_23.1: Self = param other
  112. // CHECK:STDOUT: %other.loc8_23.2: Self = bind_name other, %other.loc8_23.1
  113. // CHECK:STDOUT: %return.var.loc8: ref bool = var <return slot>
  114. // CHECK:STDOUT: }
  115. // CHECK:STDOUT: %.loc8_43: <associated Less in Ordered> = assoc_entity element0, %Less.decl [template = constants.%.4]
  116. // CHECK:STDOUT: %LessOrEquivalent.decl: LessOrEquivalent = fn_decl @LessOrEquivalent [template = constants.%struct.2] {
  117. // CHECK:STDOUT: %Self.ref.loc9_29: Ordered = name_ref Self, %Self [symbolic = constants.%Self]
  118. // CHECK:STDOUT: %.loc9_29.1: type = facet_type_access %Self.ref.loc9_29 [symbolic = constants.%Self]
  119. // CHECK:STDOUT: %.loc9_29.2: type = converted %Self.ref.loc9_29, %.loc9_29.1 [symbolic = constants.%Self]
  120. // CHECK:STDOUT: %self.loc9_23.1: Self = param self
  121. // CHECK:STDOUT: %self.loc9_23.2: Self = bind_name self, %self.loc9_23.1
  122. // CHECK:STDOUT: %Self.ref.loc9_42: Ordered = name_ref Self, %Self [symbolic = constants.%Self]
  123. // CHECK:STDOUT: %.loc9_42.1: type = facet_type_access %Self.ref.loc9_42 [symbolic = constants.%Self]
  124. // CHECK:STDOUT: %.loc9_42.2: type = converted %Self.ref.loc9_42, %.loc9_42.1 [symbolic = constants.%Self]
  125. // CHECK:STDOUT: %other.loc9_35.1: Self = param other
  126. // CHECK:STDOUT: %other.loc9_35.2: Self = bind_name other, %other.loc9_35.1
  127. // CHECK:STDOUT: %return.var.loc9: ref bool = var <return slot>
  128. // CHECK:STDOUT: }
  129. // CHECK:STDOUT: %.loc9_55: <associated LessOrEquivalent in Ordered> = assoc_entity element1, %LessOrEquivalent.decl [template = constants.%.6]
  130. // CHECK:STDOUT: %Greater.decl: Greater = fn_decl @Greater [template = constants.%struct.3] {
  131. // CHECK:STDOUT: %Self.ref.loc10_20: Ordered = name_ref Self, %Self [symbolic = constants.%Self]
  132. // CHECK:STDOUT: %.loc10_20.1: type = facet_type_access %Self.ref.loc10_20 [symbolic = constants.%Self]
  133. // CHECK:STDOUT: %.loc10_20.2: type = converted %Self.ref.loc10_20, %.loc10_20.1 [symbolic = constants.%Self]
  134. // CHECK:STDOUT: %self.loc10_14.1: Self = param self
  135. // CHECK:STDOUT: %self.loc10_14.2: Self = bind_name self, %self.loc10_14.1
  136. // CHECK:STDOUT: %Self.ref.loc10_33: Ordered = name_ref Self, %Self [symbolic = constants.%Self]
  137. // CHECK:STDOUT: %.loc10_33.1: type = facet_type_access %Self.ref.loc10_33 [symbolic = constants.%Self]
  138. // CHECK:STDOUT: %.loc10_33.2: type = converted %Self.ref.loc10_33, %.loc10_33.1 [symbolic = constants.%Self]
  139. // CHECK:STDOUT: %other.loc10_26.1: Self = param other
  140. // CHECK:STDOUT: %other.loc10_26.2: Self = bind_name other, %other.loc10_26.1
  141. // CHECK:STDOUT: %return.var.loc10: ref bool = var <return slot>
  142. // CHECK:STDOUT: }
  143. // CHECK:STDOUT: %.loc10_46: <associated Greater in Ordered> = assoc_entity element2, %Greater.decl [template = constants.%.8]
  144. // CHECK:STDOUT: %GreaterOrEquivalent.decl: GreaterOrEquivalent = fn_decl @GreaterOrEquivalent [template = constants.%struct.4] {
  145. // CHECK:STDOUT: %Self.ref.loc11_32: Ordered = name_ref Self, %Self [symbolic = constants.%Self]
  146. // CHECK:STDOUT: %.loc11_32.1: type = facet_type_access %Self.ref.loc11_32 [symbolic = constants.%Self]
  147. // CHECK:STDOUT: %.loc11_32.2: type = converted %Self.ref.loc11_32, %.loc11_32.1 [symbolic = constants.%Self]
  148. // CHECK:STDOUT: %self.loc11_26.1: Self = param self
  149. // CHECK:STDOUT: %self.loc11_26.2: Self = bind_name self, %self.loc11_26.1
  150. // CHECK:STDOUT: %Self.ref.loc11_45: Ordered = name_ref Self, %Self [symbolic = constants.%Self]
  151. // CHECK:STDOUT: %.loc11_45.1: type = facet_type_access %Self.ref.loc11_45 [symbolic = constants.%Self]
  152. // CHECK:STDOUT: %.loc11_45.2: type = converted %Self.ref.loc11_45, %.loc11_45.1 [symbolic = constants.%Self]
  153. // CHECK:STDOUT: %other.loc11_38.1: Self = param other
  154. // CHECK:STDOUT: %other.loc11_38.2: Self = bind_name other, %other.loc11_38.1
  155. // CHECK:STDOUT: %return.var.loc11: ref bool = var <return slot>
  156. // CHECK:STDOUT: }
  157. // CHECK:STDOUT: %.loc11_58: <associated GreaterOrEquivalent in Ordered> = assoc_entity element3, %GreaterOrEquivalent.decl [template = constants.%.10]
  158. // CHECK:STDOUT:
  159. // CHECK:STDOUT: !members:
  160. // CHECK:STDOUT: .Self = %Self
  161. // CHECK:STDOUT: .Less = %.loc8_43
  162. // CHECK:STDOUT: .LessOrEquivalent = %.loc9_55
  163. // CHECK:STDOUT: .Greater = %.loc10_46
  164. // CHECK:STDOUT: .GreaterOrEquivalent = %.loc11_58
  165. // CHECK:STDOUT: witness = (%Less.decl, %LessOrEquivalent.decl, %Greater.decl, %GreaterOrEquivalent.decl)
  166. // CHECK:STDOUT: }
  167. // CHECK:STDOUT:
  168. // CHECK:STDOUT: fn @Less[@Ordered.%self.loc8_11.2: Self](@Ordered.%other.loc8_23.2: Self) -> bool;
  169. // CHECK:STDOUT:
  170. // CHECK:STDOUT: fn @LessOrEquivalent[@Ordered.%self.loc9_23.2: Self](@Ordered.%other.loc9_35.2: Self) -> bool;
  171. // CHECK:STDOUT:
  172. // CHECK:STDOUT: fn @Greater[@Ordered.%self.loc10_14.2: Self](@Ordered.%other.loc10_26.2: Self) -> bool;
  173. // CHECK:STDOUT:
  174. // CHECK:STDOUT: fn @GreaterOrEquivalent[@Ordered.%self.loc11_26.2: Self](@Ordered.%other.loc11_38.2: Self) -> bool;
  175. // CHECK:STDOUT:
  176. // CHECK:STDOUT: --- user.carbon
  177. // CHECK:STDOUT:
  178. // CHECK:STDOUT: constants {
  179. // CHECK:STDOUT: %C: type = class_type @C [template]
  180. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  181. // CHECK:STDOUT: %.2: type = interface_type @Ordered [template]
  182. // CHECK:STDOUT: %Self: Ordered = bind_symbolic_name Self 0 [symbolic]
  183. // CHECK:STDOUT: %Less.1: type = fn_type @Less.1 [template]
  184. // CHECK:STDOUT: %.3: type = tuple_type () [template]
  185. // CHECK:STDOUT: %struct.1: Less = struct_value () [template]
  186. // CHECK:STDOUT: %LessOrEquivalent.1: type = fn_type @LessOrEquivalent.1 [template]
  187. // CHECK:STDOUT: %struct.2: LessOrEquivalent = struct_value () [template]
  188. // CHECK:STDOUT: %Greater.1: type = fn_type @Greater.1 [template]
  189. // CHECK:STDOUT: %struct.3: Greater = struct_value () [template]
  190. // CHECK:STDOUT: %GreaterOrEquivalent.1: type = fn_type @GreaterOrEquivalent.1 [template]
  191. // CHECK:STDOUT: %struct.4: GreaterOrEquivalent = struct_value () [template]
  192. // CHECK:STDOUT: %Less.2: type = fn_type @Less.2 [template]
  193. // CHECK:STDOUT: %struct.5: Less = struct_value () [template]
  194. // CHECK:STDOUT: %LessOrEquivalent.2: type = fn_type @LessOrEquivalent.2 [template]
  195. // CHECK:STDOUT: %struct.6: LessOrEquivalent = struct_value () [template]
  196. // CHECK:STDOUT: %Greater.2: type = fn_type @Greater.2 [template]
  197. // CHECK:STDOUT: %struct.7: Greater = struct_value () [template]
  198. // CHECK:STDOUT: %GreaterOrEquivalent.2: type = fn_type @GreaterOrEquivalent.2 [template]
  199. // CHECK:STDOUT: %struct.8: GreaterOrEquivalent = struct_value () [template]
  200. // CHECK:STDOUT: %.4: <witness> = interface_witness (%struct.1, %struct.2, %struct.3, %struct.4) [template]
  201. // CHECK:STDOUT: %TestLess: type = fn_type @TestLess [template]
  202. // CHECK:STDOUT: %struct.9: TestLess = struct_value () [template]
  203. // CHECK:STDOUT: %.5: type = ptr_type {} [template]
  204. // CHECK:STDOUT: %.6: type = assoc_entity_type @Ordered, Less [template]
  205. // CHECK:STDOUT: %.7: <associated Less in Ordered> = assoc_entity element0, file.%import_ref.12 [template]
  206. // CHECK:STDOUT: %TestLessEqual: type = fn_type @TestLessEqual [template]
  207. // CHECK:STDOUT: %struct.10: TestLessEqual = struct_value () [template]
  208. // CHECK:STDOUT: %.8: type = assoc_entity_type @Ordered, LessOrEquivalent [template]
  209. // CHECK:STDOUT: %.9: <associated LessOrEquivalent in Ordered> = assoc_entity element1, file.%import_ref.14 [template]
  210. // CHECK:STDOUT: %TestGreater: type = fn_type @TestGreater [template]
  211. // CHECK:STDOUT: %struct.11: TestGreater = struct_value () [template]
  212. // CHECK:STDOUT: %.10: type = assoc_entity_type @Ordered, Greater [template]
  213. // CHECK:STDOUT: %.11: <associated Greater in Ordered> = assoc_entity element2, file.%import_ref.16 [template]
  214. // CHECK:STDOUT: %TestGreaterEqual: type = fn_type @TestGreaterEqual [template]
  215. // CHECK:STDOUT: %struct.12: TestGreaterEqual = struct_value () [template]
  216. // CHECK:STDOUT: %.12: type = assoc_entity_type @Ordered, GreaterOrEquivalent [template]
  217. // CHECK:STDOUT: %.13: <associated GreaterOrEquivalent in Ordered> = assoc_entity element3, file.%import_ref.18 [template]
  218. // CHECK:STDOUT: }
  219. // CHECK:STDOUT:
  220. // CHECK:STDOUT: file {
  221. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  222. // CHECK:STDOUT: .Core = %Core
  223. // CHECK:STDOUT: .C = %C.decl
  224. // CHECK:STDOUT: .TestLess = %TestLess.decl
  225. // CHECK:STDOUT: .TestLessEqual = %TestLessEqual.decl
  226. // CHECK:STDOUT: .TestGreater = %TestGreater.decl
  227. // CHECK:STDOUT: .TestGreaterEqual = %TestGreaterEqual.decl
  228. // CHECK:STDOUT: }
  229. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  230. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {}
  231. // CHECK:STDOUT: %import_ref.1: type = import_ref ir2, inst+1, loaded [template = constants.%.2]
  232. // CHECK:STDOUT: %import_ref.2: <associated GreaterOrEquivalent in Ordered> = import_ref ir2, inst+72, loaded [template = constants.%.13]
  233. // CHECK:STDOUT: %import_ref.3 = import_ref ir2, inst+3, unloaded
  234. // CHECK:STDOUT: %import_ref.4: <associated Greater in Ordered> = import_ref ir2, inst+55, loaded [template = constants.%.11]
  235. // CHECK:STDOUT: %import_ref.5: <associated Less in Ordered> = import_ref ir2, inst+21, loaded [template = constants.%.7]
  236. // CHECK:STDOUT: %import_ref.6: <associated LessOrEquivalent in Ordered> = import_ref ir2, inst+38, loaded [template = constants.%.9]
  237. // CHECK:STDOUT: %import_ref.7: Less = import_ref ir2, inst+16, loaded [template = constants.%struct.5]
  238. // CHECK:STDOUT: %import_ref.8: LessOrEquivalent = import_ref ir2, inst+34, loaded [template = constants.%struct.6]
  239. // CHECK:STDOUT: %import_ref.9: Greater = import_ref ir2, inst+51, loaded [template = constants.%struct.7]
  240. // CHECK:STDOUT: %import_ref.10: GreaterOrEquivalent = import_ref ir2, inst+68, loaded [template = constants.%struct.8]
  241. // CHECK:STDOUT: impl_decl @impl {
  242. // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C]
  243. // CHECK:STDOUT: %Core.ref: <namespace> = name_ref Core, %Core [template = %Core]
  244. // CHECK:STDOUT: %Ordered.ref: type = name_ref Ordered, %import_ref.1 [template = constants.%.2]
  245. // CHECK:STDOUT: }
  246. // CHECK:STDOUT: %TestLess.decl: TestLess = fn_decl @TestLess [template = constants.%struct.9] {
  247. // CHECK:STDOUT: %C.ref.loc15_16: type = name_ref C, %C.decl [template = constants.%C]
  248. // CHECK:STDOUT: %a.loc15_13.1: C = param a
  249. // CHECK:STDOUT: @TestLess.%a: C = bind_name a, %a.loc15_13.1
  250. // CHECK:STDOUT: %C.ref.loc15_22: type = name_ref C, %C.decl [template = constants.%C]
  251. // CHECK:STDOUT: %b.loc15_19.1: C = param b
  252. // CHECK:STDOUT: @TestLess.%b: C = bind_name b, %b.loc15_19.1
  253. // CHECK:STDOUT: @TestLess.%return: ref bool = var <return slot>
  254. // CHECK:STDOUT: }
  255. // CHECK:STDOUT: %import_ref.11: type = import_ref ir2, inst+1, loaded [template = constants.%.2]
  256. // CHECK:STDOUT: %import_ref.12 = import_ref ir2, inst+16, unloaded
  257. // CHECK:STDOUT: %TestLessEqual.decl: TestLessEqual = fn_decl @TestLessEqual [template = constants.%struct.10] {
  258. // CHECK:STDOUT: %C.ref.loc19_21: type = name_ref C, %C.decl [template = constants.%C]
  259. // CHECK:STDOUT: %a.loc19_18.1: C = param a
  260. // CHECK:STDOUT: @TestLessEqual.%a: C = bind_name a, %a.loc19_18.1
  261. // CHECK:STDOUT: %C.ref.loc19_27: type = name_ref C, %C.decl [template = constants.%C]
  262. // CHECK:STDOUT: %b.loc19_24.1: C = param b
  263. // CHECK:STDOUT: @TestLessEqual.%b: C = bind_name b, %b.loc19_24.1
  264. // CHECK:STDOUT: @TestLessEqual.%return: ref bool = var <return slot>
  265. // CHECK:STDOUT: }
  266. // CHECK:STDOUT: %import_ref.13: type = import_ref ir2, inst+1, loaded [template = constants.%.2]
  267. // CHECK:STDOUT: %import_ref.14 = import_ref ir2, inst+34, unloaded
  268. // CHECK:STDOUT: %TestGreater.decl: TestGreater = fn_decl @TestGreater [template = constants.%struct.11] {
  269. // CHECK:STDOUT: %C.ref.loc23_19: type = name_ref C, %C.decl [template = constants.%C]
  270. // CHECK:STDOUT: %a.loc23_16.1: C = param a
  271. // CHECK:STDOUT: @TestGreater.%a: C = bind_name a, %a.loc23_16.1
  272. // CHECK:STDOUT: %C.ref.loc23_25: type = name_ref C, %C.decl [template = constants.%C]
  273. // CHECK:STDOUT: %b.loc23_22.1: C = param b
  274. // CHECK:STDOUT: @TestGreater.%b: C = bind_name b, %b.loc23_22.1
  275. // CHECK:STDOUT: @TestGreater.%return: ref bool = var <return slot>
  276. // CHECK:STDOUT: }
  277. // CHECK:STDOUT: %import_ref.15: type = import_ref ir2, inst+1, loaded [template = constants.%.2]
  278. // CHECK:STDOUT: %import_ref.16 = import_ref ir2, inst+51, unloaded
  279. // CHECK:STDOUT: %TestGreaterEqual.decl: TestGreaterEqual = fn_decl @TestGreaterEqual [template = constants.%struct.12] {
  280. // CHECK:STDOUT: %C.ref.loc27_24: type = name_ref C, %C.decl [template = constants.%C]
  281. // CHECK:STDOUT: %a.loc27_21.1: C = param a
  282. // CHECK:STDOUT: @TestGreaterEqual.%a: C = bind_name a, %a.loc27_21.1
  283. // CHECK:STDOUT: %C.ref.loc27_30: type = name_ref C, %C.decl [template = constants.%C]
  284. // CHECK:STDOUT: %b.loc27_27.1: C = param b
  285. // CHECK:STDOUT: @TestGreaterEqual.%b: C = bind_name b, %b.loc27_27.1
  286. // CHECK:STDOUT: @TestGreaterEqual.%return: ref bool = var <return slot>
  287. // CHECK:STDOUT: }
  288. // CHECK:STDOUT: %import_ref.17: type = import_ref ir2, inst+1, loaded [template = constants.%.2]
  289. // CHECK:STDOUT: %import_ref.18 = import_ref ir2, inst+68, unloaded
  290. // CHECK:STDOUT: }
  291. // CHECK:STDOUT:
  292. // CHECK:STDOUT: interface @Ordered {
  293. // CHECK:STDOUT: !members:
  294. // CHECK:STDOUT: .GreaterOrEquivalent = file.%import_ref.2
  295. // CHECK:STDOUT: .Self = file.%import_ref.3
  296. // CHECK:STDOUT: .Greater = file.%import_ref.4
  297. // CHECK:STDOUT: .Less = file.%import_ref.5
  298. // CHECK:STDOUT: .LessOrEquivalent = file.%import_ref.6
  299. // CHECK:STDOUT: witness = (file.%import_ref.7, file.%import_ref.8, file.%import_ref.9, file.%import_ref.10)
  300. // CHECK:STDOUT: }
  301. // CHECK:STDOUT:
  302. // CHECK:STDOUT: impl @impl: C as Ordered {
  303. // CHECK:STDOUT: %Less.decl: Less = fn_decl @Less.1 [template = constants.%struct.1] {
  304. // CHECK:STDOUT: %C.ref.loc9_17: type = name_ref C, file.%C.decl [template = constants.%C]
  305. // CHECK:STDOUT: %self.loc9_11.1: C = param self
  306. // CHECK:STDOUT: %self.loc9_11.2: C = bind_name self, %self.loc9_11.1
  307. // CHECK:STDOUT: %C.ref.loc9_27: type = name_ref C, file.%C.decl [template = constants.%C]
  308. // CHECK:STDOUT: %other.loc9_20.1: C = param other
  309. // CHECK:STDOUT: %other.loc9_20.2: C = bind_name other, %other.loc9_20.1
  310. // CHECK:STDOUT: %return.var.loc9: ref bool = var <return slot>
  311. // CHECK:STDOUT: }
  312. // CHECK:STDOUT: %LessOrEquivalent.decl: LessOrEquivalent = fn_decl @LessOrEquivalent.1 [template = constants.%struct.2] {
  313. // CHECK:STDOUT: %C.ref.loc10_29: type = name_ref C, file.%C.decl [template = constants.%C]
  314. // CHECK:STDOUT: %self.loc10_23.1: C = param self
  315. // CHECK:STDOUT: %self.loc10_23.2: C = bind_name self, %self.loc10_23.1
  316. // CHECK:STDOUT: %C.ref.loc10_39: type = name_ref C, file.%C.decl [template = constants.%C]
  317. // CHECK:STDOUT: %other.loc10_32.1: C = param other
  318. // CHECK:STDOUT: %other.loc10_32.2: C = bind_name other, %other.loc10_32.1
  319. // CHECK:STDOUT: %return.var.loc10: ref bool = var <return slot>
  320. // CHECK:STDOUT: }
  321. // CHECK:STDOUT: %Greater.decl: Greater = fn_decl @Greater.1 [template = constants.%struct.3] {
  322. // CHECK:STDOUT: %C.ref.loc11_20: type = name_ref C, file.%C.decl [template = constants.%C]
  323. // CHECK:STDOUT: %self.loc11_14.1: C = param self
  324. // CHECK:STDOUT: %self.loc11_14.2: C = bind_name self, %self.loc11_14.1
  325. // CHECK:STDOUT: %C.ref.loc11_30: type = name_ref C, file.%C.decl [template = constants.%C]
  326. // CHECK:STDOUT: %other.loc11_23.1: C = param other
  327. // CHECK:STDOUT: %other.loc11_23.2: C = bind_name other, %other.loc11_23.1
  328. // CHECK:STDOUT: %return.var.loc11: ref bool = var <return slot>
  329. // CHECK:STDOUT: }
  330. // CHECK:STDOUT: %GreaterOrEquivalent.decl: GreaterOrEquivalent = fn_decl @GreaterOrEquivalent.1 [template = constants.%struct.4] {
  331. // CHECK:STDOUT: %C.ref.loc12_32: type = name_ref C, file.%C.decl [template = constants.%C]
  332. // CHECK:STDOUT: %self.loc12_26.1: C = param self
  333. // CHECK:STDOUT: %self.loc12_26.2: C = bind_name self, %self.loc12_26.1
  334. // CHECK:STDOUT: %C.ref.loc12_42: type = name_ref C, file.%C.decl [template = constants.%C]
  335. // CHECK:STDOUT: %other.loc12_35.1: C = param other
  336. // CHECK:STDOUT: %other.loc12_35.2: C = bind_name other, %other.loc12_35.1
  337. // CHECK:STDOUT: %return.var.loc12: ref bool = var <return slot>
  338. // CHECK:STDOUT: }
  339. // CHECK:STDOUT: %.1: <witness> = interface_witness (%Less.decl, %LessOrEquivalent.decl, %Greater.decl, %GreaterOrEquivalent.decl) [template = constants.%.4]
  340. // CHECK:STDOUT:
  341. // CHECK:STDOUT: !members:
  342. // CHECK:STDOUT: .Less = %Less.decl
  343. // CHECK:STDOUT: .LessOrEquivalent = %LessOrEquivalent.decl
  344. // CHECK:STDOUT: .Greater = %Greater.decl
  345. // CHECK:STDOUT: .GreaterOrEquivalent = %GreaterOrEquivalent.decl
  346. // CHECK:STDOUT: witness = %.1
  347. // CHECK:STDOUT: }
  348. // CHECK:STDOUT:
  349. // CHECK:STDOUT: class @C {
  350. // CHECK:STDOUT: !members:
  351. // CHECK:STDOUT: .Self = constants.%C
  352. // CHECK:STDOUT: }
  353. // CHECK:STDOUT:
  354. // CHECK:STDOUT: fn @Less.1[@impl.%self.loc9_11.2: C](@impl.%other.loc9_20.2: C) -> bool;
  355. // CHECK:STDOUT:
  356. // CHECK:STDOUT: fn @LessOrEquivalent.1[@impl.%self.loc10_23.2: C](@impl.%other.loc10_32.2: C) -> bool;
  357. // CHECK:STDOUT:
  358. // CHECK:STDOUT: fn @Greater.1[@impl.%self.loc11_14.2: C](@impl.%other.loc11_23.2: C) -> bool;
  359. // CHECK:STDOUT:
  360. // CHECK:STDOUT: fn @GreaterOrEquivalent.1[@impl.%self.loc12_26.2: C](@impl.%other.loc12_35.2: C) -> bool;
  361. // CHECK:STDOUT:
  362. // CHECK:STDOUT: fn @Less.2[%self: Self](%other: Self) -> bool;
  363. // CHECK:STDOUT:
  364. // CHECK:STDOUT: fn @LessOrEquivalent.2[%self: Self](%other: Self) -> bool;
  365. // CHECK:STDOUT:
  366. // CHECK:STDOUT: fn @Greater.2[%self: Self](%other: Self) -> bool;
  367. // CHECK:STDOUT:
  368. // CHECK:STDOUT: fn @GreaterOrEquivalent.2[%self: Self](%other: Self) -> bool;
  369. // CHECK:STDOUT:
  370. // CHECK:STDOUT: fn @TestLess(%a: C, %b: C) -> bool {
  371. // CHECK:STDOUT: !entry:
  372. // CHECK:STDOUT: %a.ref: C = name_ref a, %a
  373. // CHECK:STDOUT: %b.ref: C = name_ref b, %b
  374. // CHECK:STDOUT: %.1: Less = interface_witness_access @impl.%.1, element0 [template = constants.%struct.1]
  375. // CHECK:STDOUT: %.loc16_12: <bound method> = bound_method %a.ref, %.1
  376. // CHECK:STDOUT: %Less.call: init bool = call %.loc16_12(%a.ref, %b.ref)
  377. // CHECK:STDOUT: %.loc16_15.1: bool = value_of_initializer %Less.call
  378. // CHECK:STDOUT: %.loc16_15.2: bool = converted %Less.call, %.loc16_15.1
  379. // CHECK:STDOUT: return %.loc16_15.2
  380. // CHECK:STDOUT: }
  381. // CHECK:STDOUT:
  382. // CHECK:STDOUT: fn @TestLessEqual(%a: C, %b: C) -> bool {
  383. // CHECK:STDOUT: !entry:
  384. // CHECK:STDOUT: %a.ref: C = name_ref a, %a
  385. // CHECK:STDOUT: %b.ref: C = name_ref b, %b
  386. // CHECK:STDOUT: %.1: LessOrEquivalent = interface_witness_access @impl.%.1, element1 [template = constants.%struct.2]
  387. // CHECK:STDOUT: %.loc20_12: <bound method> = bound_method %a.ref, %.1
  388. // CHECK:STDOUT: %LessOrEquivalent.call: init bool = call %.loc20_12(%a.ref, %b.ref)
  389. // CHECK:STDOUT: %.loc20_16.1: bool = value_of_initializer %LessOrEquivalent.call
  390. // CHECK:STDOUT: %.loc20_16.2: bool = converted %LessOrEquivalent.call, %.loc20_16.1
  391. // CHECK:STDOUT: return %.loc20_16.2
  392. // CHECK:STDOUT: }
  393. // CHECK:STDOUT:
  394. // CHECK:STDOUT: fn @TestGreater(%a: C, %b: C) -> bool {
  395. // CHECK:STDOUT: !entry:
  396. // CHECK:STDOUT: %a.ref: C = name_ref a, %a
  397. // CHECK:STDOUT: %b.ref: C = name_ref b, %b
  398. // CHECK:STDOUT: %.1: Greater = interface_witness_access @impl.%.1, element2 [template = constants.%struct.3]
  399. // CHECK:STDOUT: %.loc24_12: <bound method> = bound_method %a.ref, %.1
  400. // CHECK:STDOUT: %Greater.call: init bool = call %.loc24_12(%a.ref, %b.ref)
  401. // CHECK:STDOUT: %.loc24_15.1: bool = value_of_initializer %Greater.call
  402. // CHECK:STDOUT: %.loc24_15.2: bool = converted %Greater.call, %.loc24_15.1
  403. // CHECK:STDOUT: return %.loc24_15.2
  404. // CHECK:STDOUT: }
  405. // CHECK:STDOUT:
  406. // CHECK:STDOUT: fn @TestGreaterEqual(%a: C, %b: C) -> bool {
  407. // CHECK:STDOUT: !entry:
  408. // CHECK:STDOUT: %a.ref: C = name_ref a, %a
  409. // CHECK:STDOUT: %b.ref: C = name_ref b, %b
  410. // CHECK:STDOUT: %.1: GreaterOrEquivalent = interface_witness_access @impl.%.1, element3 [template = constants.%struct.4]
  411. // CHECK:STDOUT: %.loc28_12: <bound method> = bound_method %a.ref, %.1
  412. // CHECK:STDOUT: %GreaterOrEquivalent.call: init bool = call %.loc28_12(%a.ref, %b.ref)
  413. // CHECK:STDOUT: %.loc28_16.1: bool = value_of_initializer %GreaterOrEquivalent.call
  414. // CHECK:STDOUT: %.loc28_16.2: bool = converted %GreaterOrEquivalent.call, %.loc28_16.1
  415. // CHECK:STDOUT: return %.loc28_16.2
  416. // CHECK:STDOUT: }
  417. // CHECK:STDOUT:
  418. // CHECK:STDOUT: --- fail_no_impl.carbon
  419. // CHECK:STDOUT:
  420. // CHECK:STDOUT: constants {
  421. // CHECK:STDOUT: %D: type = class_type @D [template]
  422. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  423. // CHECK:STDOUT: %TestLess: type = fn_type @TestLess [template]
  424. // CHECK:STDOUT: %.2: type = tuple_type () [template]
  425. // CHECK:STDOUT: %struct.1: TestLess = struct_value () [template]
  426. // CHECK:STDOUT: %.3: type = ptr_type {} [template]
  427. // CHECK:STDOUT: %.4: type = interface_type @Ordered [template]
  428. // CHECK:STDOUT: %Self: Ordered = bind_symbolic_name Self 0 [symbolic]
  429. // CHECK:STDOUT: %Less: type = fn_type @Less [template]
  430. // CHECK:STDOUT: %struct.2: Less = struct_value () [template]
  431. // CHECK:STDOUT: %.5: type = assoc_entity_type @Ordered, Less [template]
  432. // CHECK:STDOUT: %.6: <associated Less in Ordered> = assoc_entity element0, file.%import_ref.11 [template]
  433. // CHECK:STDOUT: %TestLessEqual: type = fn_type @TestLessEqual [template]
  434. // CHECK:STDOUT: %struct.3: TestLessEqual = struct_value () [template]
  435. // CHECK:STDOUT: %LessOrEquivalent: type = fn_type @LessOrEquivalent [template]
  436. // CHECK:STDOUT: %struct.4: LessOrEquivalent = struct_value () [template]
  437. // CHECK:STDOUT: %.7: type = assoc_entity_type @Ordered, LessOrEquivalent [template]
  438. // CHECK:STDOUT: %.8: <associated LessOrEquivalent in Ordered> = assoc_entity element1, file.%import_ref.13 [template]
  439. // CHECK:STDOUT: %TestGreater: type = fn_type @TestGreater [template]
  440. // CHECK:STDOUT: %struct.5: TestGreater = struct_value () [template]
  441. // CHECK:STDOUT: %Greater: type = fn_type @Greater [template]
  442. // CHECK:STDOUT: %struct.6: Greater = struct_value () [template]
  443. // CHECK:STDOUT: %.9: type = assoc_entity_type @Ordered, Greater [template]
  444. // CHECK:STDOUT: %.10: <associated Greater in Ordered> = assoc_entity element2, file.%import_ref.15 [template]
  445. // CHECK:STDOUT: %TestGreaterEqual: type = fn_type @TestGreaterEqual [template]
  446. // CHECK:STDOUT: %struct.7: TestGreaterEqual = struct_value () [template]
  447. // CHECK:STDOUT: %GreaterOrEquivalent: type = fn_type @GreaterOrEquivalent [template]
  448. // CHECK:STDOUT: %struct.8: GreaterOrEquivalent = struct_value () [template]
  449. // CHECK:STDOUT: %.11: type = assoc_entity_type @Ordered, GreaterOrEquivalent [template]
  450. // CHECK:STDOUT: %.12: <associated GreaterOrEquivalent in Ordered> = assoc_entity element3, file.%import_ref.17 [template]
  451. // CHECK:STDOUT: }
  452. // CHECK:STDOUT:
  453. // CHECK:STDOUT: file {
  454. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  455. // CHECK:STDOUT: .Core = %Core
  456. // CHECK:STDOUT: .D = %D.decl
  457. // CHECK:STDOUT: .TestLess = %TestLess.decl
  458. // CHECK:STDOUT: .TestLessEqual = %TestLessEqual.decl
  459. // CHECK:STDOUT: .TestGreater = %TestGreater.decl
  460. // CHECK:STDOUT: .TestGreaterEqual = %TestGreaterEqual.decl
  461. // CHECK:STDOUT: }
  462. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  463. // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {}
  464. // CHECK:STDOUT: %TestLess.decl: TestLess = fn_decl @TestLess [template = constants.%struct.1] {
  465. // CHECK:STDOUT: %D.ref.loc8_16: type = name_ref D, %D.decl [template = constants.%D]
  466. // CHECK:STDOUT: %a.loc8_13.1: D = param a
  467. // CHECK:STDOUT: @TestLess.%a: D = bind_name a, %a.loc8_13.1
  468. // CHECK:STDOUT: %D.ref.loc8_22: type = name_ref D, %D.decl [template = constants.%D]
  469. // CHECK:STDOUT: %b.loc8_19.1: D = param b
  470. // CHECK:STDOUT: @TestLess.%b: D = bind_name b, %b.loc8_19.1
  471. // CHECK:STDOUT: @TestLess.%return: ref bool = var <return slot>
  472. // CHECK:STDOUT: }
  473. // CHECK:STDOUT: %import_ref.1: type = import_ref ir2, inst+1, loaded [template = constants.%.4]
  474. // CHECK:STDOUT: %import_ref.2: <associated GreaterOrEquivalent in Ordered> = import_ref ir2, inst+72, loaded [template = constants.%.12]
  475. // CHECK:STDOUT: %import_ref.3 = import_ref ir2, inst+3, unloaded
  476. // CHECK:STDOUT: %import_ref.4: <associated Greater in Ordered> = import_ref ir2, inst+55, loaded [template = constants.%.10]
  477. // CHECK:STDOUT: %import_ref.5: <associated Less in Ordered> = import_ref ir2, inst+21, loaded [template = constants.%.6]
  478. // CHECK:STDOUT: %import_ref.6: <associated LessOrEquivalent in Ordered> = import_ref ir2, inst+38, loaded [template = constants.%.8]
  479. // CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+16, unloaded
  480. // CHECK:STDOUT: %import_ref.8 = import_ref ir2, inst+34, unloaded
  481. // CHECK:STDOUT: %import_ref.9 = import_ref ir2, inst+51, unloaded
  482. // CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+68, unloaded
  483. // CHECK:STDOUT: %import_ref.11 = import_ref ir2, inst+16, unloaded
  484. // CHECK:STDOUT: %TestLessEqual.decl: TestLessEqual = fn_decl @TestLessEqual [template = constants.%struct.3] {
  485. // CHECK:STDOUT: %D.ref.loc16_21: type = name_ref D, %D.decl [template = constants.%D]
  486. // CHECK:STDOUT: %a.loc16_18.1: D = param a
  487. // CHECK:STDOUT: @TestLessEqual.%a: D = bind_name a, %a.loc16_18.1
  488. // CHECK:STDOUT: %D.ref.loc16_27: type = name_ref D, %D.decl [template = constants.%D]
  489. // CHECK:STDOUT: %b.loc16_24.1: D = param b
  490. // CHECK:STDOUT: @TestLessEqual.%b: D = bind_name b, %b.loc16_24.1
  491. // CHECK:STDOUT: @TestLessEqual.%return: ref bool = var <return slot>
  492. // CHECK:STDOUT: }
  493. // CHECK:STDOUT: %import_ref.12: type = import_ref ir2, inst+1, loaded [template = constants.%.4]
  494. // CHECK:STDOUT: %import_ref.13 = import_ref ir2, inst+34, unloaded
  495. // CHECK:STDOUT: %TestGreater.decl: TestGreater = fn_decl @TestGreater [template = constants.%struct.5] {
  496. // CHECK:STDOUT: %D.ref.loc24_19: type = name_ref D, %D.decl [template = constants.%D]
  497. // CHECK:STDOUT: %a.loc24_16.1: D = param a
  498. // CHECK:STDOUT: @TestGreater.%a: D = bind_name a, %a.loc24_16.1
  499. // CHECK:STDOUT: %D.ref.loc24_25: type = name_ref D, %D.decl [template = constants.%D]
  500. // CHECK:STDOUT: %b.loc24_22.1: D = param b
  501. // CHECK:STDOUT: @TestGreater.%b: D = bind_name b, %b.loc24_22.1
  502. // CHECK:STDOUT: @TestGreater.%return: ref bool = var <return slot>
  503. // CHECK:STDOUT: }
  504. // CHECK:STDOUT: %import_ref.14: type = import_ref ir2, inst+1, loaded [template = constants.%.4]
  505. // CHECK:STDOUT: %import_ref.15 = import_ref ir2, inst+51, unloaded
  506. // CHECK:STDOUT: %TestGreaterEqual.decl: TestGreaterEqual = fn_decl @TestGreaterEqual [template = constants.%struct.7] {
  507. // CHECK:STDOUT: %D.ref.loc32_24: type = name_ref D, %D.decl [template = constants.%D]
  508. // CHECK:STDOUT: %a.loc32_21.1: D = param a
  509. // CHECK:STDOUT: @TestGreaterEqual.%a: D = bind_name a, %a.loc32_21.1
  510. // CHECK:STDOUT: %D.ref.loc32_30: type = name_ref D, %D.decl [template = constants.%D]
  511. // CHECK:STDOUT: %b.loc32_27.1: D = param b
  512. // CHECK:STDOUT: @TestGreaterEqual.%b: D = bind_name b, %b.loc32_27.1
  513. // CHECK:STDOUT: @TestGreaterEqual.%return: ref bool = var <return slot>
  514. // CHECK:STDOUT: }
  515. // CHECK:STDOUT: %import_ref.16: type = import_ref ir2, inst+1, loaded [template = constants.%.4]
  516. // CHECK:STDOUT: %import_ref.17 = import_ref ir2, inst+68, unloaded
  517. // CHECK:STDOUT: }
  518. // CHECK:STDOUT:
  519. // CHECK:STDOUT: interface @Ordered {
  520. // CHECK:STDOUT: !members:
  521. // CHECK:STDOUT: .GreaterOrEquivalent = file.%import_ref.2
  522. // CHECK:STDOUT: .Self = file.%import_ref.3
  523. // CHECK:STDOUT: .Greater = file.%import_ref.4
  524. // CHECK:STDOUT: .Less = file.%import_ref.5
  525. // CHECK:STDOUT: .LessOrEquivalent = file.%import_ref.6
  526. // CHECK:STDOUT: witness = (file.%import_ref.7, file.%import_ref.8, file.%import_ref.9, file.%import_ref.10)
  527. // CHECK:STDOUT: }
  528. // CHECK:STDOUT:
  529. // CHECK:STDOUT: class @D {
  530. // CHECK:STDOUT: !members:
  531. // CHECK:STDOUT: .Self = constants.%D
  532. // CHECK:STDOUT: }
  533. // CHECK:STDOUT:
  534. // CHECK:STDOUT: fn @TestLess(%a: D, %b: D) -> bool {
  535. // CHECK:STDOUT: !entry:
  536. // CHECK:STDOUT: %a.ref: D = name_ref a, %a
  537. // CHECK:STDOUT: %b.ref: D = name_ref b, %b
  538. // CHECK:STDOUT: return <error>
  539. // CHECK:STDOUT: }
  540. // CHECK:STDOUT:
  541. // CHECK:STDOUT: fn @Less[%self: Self](%other: Self) -> bool;
  542. // CHECK:STDOUT:
  543. // CHECK:STDOUT: fn @TestLessEqual(%a: D, %b: D) -> bool {
  544. // CHECK:STDOUT: !entry:
  545. // CHECK:STDOUT: %a.ref: D = name_ref a, %a
  546. // CHECK:STDOUT: %b.ref: D = name_ref b, %b
  547. // CHECK:STDOUT: return <error>
  548. // CHECK:STDOUT: }
  549. // CHECK:STDOUT:
  550. // CHECK:STDOUT: fn @LessOrEquivalent[%self: Self](%other: Self) -> bool;
  551. // CHECK:STDOUT:
  552. // CHECK:STDOUT: fn @TestGreater(%a: D, %b: D) -> bool {
  553. // CHECK:STDOUT: !entry:
  554. // CHECK:STDOUT: %a.ref: D = name_ref a, %a
  555. // CHECK:STDOUT: %b.ref: D = name_ref b, %b
  556. // CHECK:STDOUT: return <error>
  557. // CHECK:STDOUT: }
  558. // CHECK:STDOUT:
  559. // CHECK:STDOUT: fn @Greater[%self: Self](%other: Self) -> bool;
  560. // CHECK:STDOUT:
  561. // CHECK:STDOUT: fn @TestGreaterEqual(%a: D, %b: D) -> bool {
  562. // CHECK:STDOUT: !entry:
  563. // CHECK:STDOUT: %a.ref: D = name_ref a, %a
  564. // CHECK:STDOUT: %b.ref: D = name_ref b, %b
  565. // CHECK:STDOUT: return <error>
  566. // CHECK:STDOUT: }
  567. // CHECK:STDOUT:
  568. // CHECK:STDOUT: fn @GreaterOrEquivalent[%self: Self](%other: Self) -> bool;
  569. // CHECK:STDOUT: