ordered.carbon 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  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/operators/overloaded/ordered.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/overloaded/ordered.carbon
  10. // --- user.carbon
  11. package User;
  12. class C {};
  13. impl C as Core.Ordered {
  14. fn Less[self: C](other: C) -> bool;
  15. fn LessOrEquivalent[self: C](other: C) -> bool;
  16. fn Greater[self: C](other: C) -> bool;
  17. fn GreaterOrEquivalent[self: C](other: C) -> bool;
  18. }
  19. fn TestLess(a: C, b: C) -> bool {
  20. return a < b;
  21. }
  22. fn TestLessEqual(a: C, b: C) -> bool {
  23. return a <= b;
  24. }
  25. fn TestGreater(a: C, b: C) -> bool {
  26. return a > b;
  27. }
  28. fn TestGreaterEqual(a: C, b: C) -> bool {
  29. return a >= b;
  30. }
  31. // --- fail_no_impl.carbon
  32. package FailNoImpl;
  33. class D {};
  34. fn TestLess(a: D, b: D) -> bool {
  35. // 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.
  36. // CHECK:STDERR: return a < b;
  37. // CHECK:STDERR: ^~~~~
  38. // CHECK:STDERR:
  39. return a < b;
  40. }
  41. fn TestLessEqual(a: D, b: D) -> bool {
  42. // 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.
  43. // CHECK:STDERR: return a <= b;
  44. // CHECK:STDERR: ^~~~~~
  45. // CHECK:STDERR:
  46. return a <= b;
  47. }
  48. fn TestGreater(a: D, b: D) -> bool {
  49. // 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.
  50. // CHECK:STDERR: return a > b;
  51. // CHECK:STDERR: ^~~~~
  52. // CHECK:STDERR:
  53. return a > b;
  54. }
  55. fn TestGreaterEqual(a: D, b: D) -> bool {
  56. // 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.
  57. // CHECK:STDERR: return a >= b;
  58. // CHECK:STDERR: ^~~~~~
  59. return a >= b;
  60. }
  61. // CHECK:STDOUT: --- user.carbon
  62. // CHECK:STDOUT:
  63. // CHECK:STDOUT: constants {
  64. // CHECK:STDOUT: %C: type = class_type @C [template]
  65. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  66. // CHECK:STDOUT: %.2: type = interface_type @Ordered [template]
  67. // CHECK:STDOUT: %Self: %.2 = bind_symbolic_name Self 0 [symbolic]
  68. // CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template]
  69. // CHECK:STDOUT: %.3: type = tuple_type () [template]
  70. // CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template]
  71. // CHECK:STDOUT: %Less.type.1: type = fn_type @Less.1 [template]
  72. // CHECK:STDOUT: %Less.1: %Less.type.1 = struct_value () [template]
  73. // CHECK:STDOUT: %LessOrEquivalent.type.1: type = fn_type @LessOrEquivalent.1 [template]
  74. // CHECK:STDOUT: %LessOrEquivalent.1: %LessOrEquivalent.type.1 = struct_value () [template]
  75. // CHECK:STDOUT: %Greater.type.1: type = fn_type @Greater.1 [template]
  76. // CHECK:STDOUT: %Greater.1: %Greater.type.1 = struct_value () [template]
  77. // CHECK:STDOUT: %GreaterOrEquivalent.type.1: type = fn_type @GreaterOrEquivalent.1 [template]
  78. // CHECK:STDOUT: %GreaterOrEquivalent.1: %GreaterOrEquivalent.type.1 = struct_value () [template]
  79. // CHECK:STDOUT: %Less.type.2: type = fn_type @Less.2 [template]
  80. // CHECK:STDOUT: %Less.2: %Less.type.2 = struct_value () [template]
  81. // CHECK:STDOUT: %LessOrEquivalent.type.2: type = fn_type @LessOrEquivalent.2 [template]
  82. // CHECK:STDOUT: %LessOrEquivalent.2: %LessOrEquivalent.type.2 = struct_value () [template]
  83. // CHECK:STDOUT: %Greater.type.2: type = fn_type @Greater.2 [template]
  84. // CHECK:STDOUT: %Greater.2: %Greater.type.2 = struct_value () [template]
  85. // CHECK:STDOUT: %GreaterOrEquivalent.type.2: type = fn_type @GreaterOrEquivalent.2 [template]
  86. // CHECK:STDOUT: %GreaterOrEquivalent.2: %GreaterOrEquivalent.type.2 = struct_value () [template]
  87. // CHECK:STDOUT: %.4: <witness> = interface_witness (%Less.1, %LessOrEquivalent.1, %Greater.1, %GreaterOrEquivalent.1) [template]
  88. // CHECK:STDOUT: %TestLess.type: type = fn_type @TestLess [template]
  89. // CHECK:STDOUT: %TestLess: %TestLess.type = struct_value () [template]
  90. // CHECK:STDOUT: %.5: type = ptr_type %.1 [template]
  91. // CHECK:STDOUT: %.6: type = assoc_entity_type %.2, %Less.type.2 [template]
  92. // CHECK:STDOUT: %.7: %.6 = assoc_entity element0, imports.%import_ref.12 [template]
  93. // CHECK:STDOUT: %TestLessEqual.type: type = fn_type @TestLessEqual [template]
  94. // CHECK:STDOUT: %TestLessEqual: %TestLessEqual.type = struct_value () [template]
  95. // CHECK:STDOUT: %.8: type = assoc_entity_type %.2, %LessOrEquivalent.type.2 [template]
  96. // CHECK:STDOUT: %.9: %.8 = assoc_entity element1, imports.%import_ref.13 [template]
  97. // CHECK:STDOUT: %TestGreater.type: type = fn_type @TestGreater [template]
  98. // CHECK:STDOUT: %TestGreater: %TestGreater.type = struct_value () [template]
  99. // CHECK:STDOUT: %.10: type = assoc_entity_type %.2, %Greater.type.2 [template]
  100. // CHECK:STDOUT: %.11: %.10 = assoc_entity element2, imports.%import_ref.14 [template]
  101. // CHECK:STDOUT: %TestGreaterEqual.type: type = fn_type @TestGreaterEqual [template]
  102. // CHECK:STDOUT: %TestGreaterEqual: %TestGreaterEqual.type = struct_value () [template]
  103. // CHECK:STDOUT: %.12: type = assoc_entity_type %.2, %GreaterOrEquivalent.type.2 [template]
  104. // CHECK:STDOUT: %.13: %.12 = assoc_entity element3, imports.%import_ref.15 [template]
  105. // CHECK:STDOUT: }
  106. // CHECK:STDOUT:
  107. // CHECK:STDOUT: imports {
  108. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  109. // CHECK:STDOUT: .Ordered = %import_ref.1
  110. // CHECK:STDOUT: .Bool = %import_ref.11
  111. // CHECK:STDOUT: import Core//prelude
  112. // CHECK:STDOUT: import Core//prelude/operators
  113. // CHECK:STDOUT: import Core//prelude/types
  114. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  115. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  116. // CHECK:STDOUT: import Core//prelude/operators/comparison
  117. // CHECK:STDOUT: import Core//prelude/types/bool
  118. // CHECK:STDOUT: }
  119. // CHECK:STDOUT: %import_ref.1: type = import_ref Core//prelude/operators/comparison, inst+54, loaded [template = constants.%.2]
  120. // CHECK:STDOUT: %import_ref.2 = import_ref Core//prelude/operators/comparison, inst+56, unloaded
  121. // CHECK:STDOUT: %import_ref.3: %.6 = import_ref Core//prelude/operators/comparison, inst+77, loaded [template = constants.%.7]
  122. // CHECK:STDOUT: %import_ref.4: %.8 = import_ref Core//prelude/operators/comparison, inst+98, loaded [template = constants.%.9]
  123. // CHECK:STDOUT: %import_ref.5: %.10 = import_ref Core//prelude/operators/comparison, inst+119, loaded [template = constants.%.11]
  124. // CHECK:STDOUT: %import_ref.6: %.12 = import_ref Core//prelude/operators/comparison, inst+140, loaded [template = constants.%.13]
  125. // CHECK:STDOUT: %import_ref.7: %Less.type.2 = import_ref Core//prelude/operators/comparison, inst+72, loaded [template = constants.%Less.2]
  126. // CHECK:STDOUT: %import_ref.8: %LessOrEquivalent.type.2 = import_ref Core//prelude/operators/comparison, inst+93, loaded [template = constants.%LessOrEquivalent.2]
  127. // CHECK:STDOUT: %import_ref.9: %Greater.type.2 = import_ref Core//prelude/operators/comparison, inst+114, loaded [template = constants.%Greater.2]
  128. // CHECK:STDOUT: %import_ref.10: %GreaterOrEquivalent.type.2 = import_ref Core//prelude/operators/comparison, inst+135, loaded [template = constants.%GreaterOrEquivalent.2]
  129. // CHECK:STDOUT: %import_ref.11: %Bool.type = import_ref Core//prelude/types/bool, inst+2, loaded [template = constants.%Bool]
  130. // CHECK:STDOUT: %import_ref.12 = import_ref Core//prelude/operators/comparison, inst+72, unloaded
  131. // CHECK:STDOUT: %import_ref.13 = import_ref Core//prelude/operators/comparison, inst+93, unloaded
  132. // CHECK:STDOUT: %import_ref.14 = import_ref Core//prelude/operators/comparison, inst+114, unloaded
  133. // CHECK:STDOUT: %import_ref.15 = import_ref Core//prelude/operators/comparison, inst+135, unloaded
  134. // CHECK:STDOUT: }
  135. // CHECK:STDOUT:
  136. // CHECK:STDOUT: file {
  137. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  138. // CHECK:STDOUT: .Core = imports.%Core
  139. // CHECK:STDOUT: .C = %C.decl
  140. // CHECK:STDOUT: .TestLess = %TestLess.decl
  141. // CHECK:STDOUT: .TestLessEqual = %TestLessEqual.decl
  142. // CHECK:STDOUT: .TestGreater = %TestGreater.decl
  143. // CHECK:STDOUT: .TestGreaterEqual = %TestGreaterEqual.decl
  144. // CHECK:STDOUT: }
  145. // CHECK:STDOUT: %Core.import = import Core
  146. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {}
  147. // CHECK:STDOUT: impl_decl @impl {
  148. // CHECK:STDOUT: %C.ref.loc6: type = name_ref C, %C.decl [template = constants.%C]
  149. // CHECK:STDOUT: %Core.ref: <namespace> = name_ref Core, imports.%Core [template = imports.%Core]
  150. // CHECK:STDOUT: %Ordered.ref: type = name_ref Ordered, imports.%import_ref.1 [template = constants.%.2]
  151. // CHECK:STDOUT: }
  152. // CHECK:STDOUT: %TestLess.decl: %TestLess.type = fn_decl @TestLess [template = constants.%TestLess] {
  153. // CHECK:STDOUT: %C.ref.loc13_16: type = name_ref C, %C.decl [template = constants.%C]
  154. // CHECK:STDOUT: %a.loc13_13.1: %C = param a
  155. // CHECK:STDOUT: @TestLess.%a: %C = bind_name a, %a.loc13_13.1
  156. // CHECK:STDOUT: %C.ref.loc13_22: type = name_ref C, %C.decl [template = constants.%C]
  157. // CHECK:STDOUT: %b.loc13_19.1: %C = param b
  158. // CHECK:STDOUT: @TestLess.%b: %C = bind_name b, %b.loc13_19.1
  159. // CHECK:STDOUT: %bool.make_type.loc13: init type = call constants.%Bool() [template = bool]
  160. // CHECK:STDOUT: %.loc13_28.1: type = value_of_initializer %bool.make_type.loc13 [template = bool]
  161. // CHECK:STDOUT: %.loc13_28.2: type = converted %bool.make_type.loc13, %.loc13_28.1 [template = bool]
  162. // CHECK:STDOUT: @TestLess.%return: ref bool = var <return slot>
  163. // CHECK:STDOUT: }
  164. // CHECK:STDOUT: %TestLessEqual.decl: %TestLessEqual.type = fn_decl @TestLessEqual [template = constants.%TestLessEqual] {
  165. // CHECK:STDOUT: %C.ref.loc17_21: type = name_ref C, %C.decl [template = constants.%C]
  166. // CHECK:STDOUT: %a.loc17_18.1: %C = param a
  167. // CHECK:STDOUT: @TestLessEqual.%a: %C = bind_name a, %a.loc17_18.1
  168. // CHECK:STDOUT: %C.ref.loc17_27: type = name_ref C, %C.decl [template = constants.%C]
  169. // CHECK:STDOUT: %b.loc17_24.1: %C = param b
  170. // CHECK:STDOUT: @TestLessEqual.%b: %C = bind_name b, %b.loc17_24.1
  171. // CHECK:STDOUT: %bool.make_type.loc17: init type = call constants.%Bool() [template = bool]
  172. // CHECK:STDOUT: %.loc17_33.1: type = value_of_initializer %bool.make_type.loc17 [template = bool]
  173. // CHECK:STDOUT: %.loc17_33.2: type = converted %bool.make_type.loc17, %.loc17_33.1 [template = bool]
  174. // CHECK:STDOUT: @TestLessEqual.%return: ref bool = var <return slot>
  175. // CHECK:STDOUT: }
  176. // CHECK:STDOUT: %TestGreater.decl: %TestGreater.type = fn_decl @TestGreater [template = constants.%TestGreater] {
  177. // CHECK:STDOUT: %C.ref.loc21_19: type = name_ref C, %C.decl [template = constants.%C]
  178. // CHECK:STDOUT: %a.loc21_16.1: %C = param a
  179. // CHECK:STDOUT: @TestGreater.%a: %C = bind_name a, %a.loc21_16.1
  180. // CHECK:STDOUT: %C.ref.loc21_25: type = name_ref C, %C.decl [template = constants.%C]
  181. // CHECK:STDOUT: %b.loc21_22.1: %C = param b
  182. // CHECK:STDOUT: @TestGreater.%b: %C = bind_name b, %b.loc21_22.1
  183. // CHECK:STDOUT: %bool.make_type.loc21: init type = call constants.%Bool() [template = bool]
  184. // CHECK:STDOUT: %.loc21_31.1: type = value_of_initializer %bool.make_type.loc21 [template = bool]
  185. // CHECK:STDOUT: %.loc21_31.2: type = converted %bool.make_type.loc21, %.loc21_31.1 [template = bool]
  186. // CHECK:STDOUT: @TestGreater.%return: ref bool = var <return slot>
  187. // CHECK:STDOUT: }
  188. // CHECK:STDOUT: %TestGreaterEqual.decl: %TestGreaterEqual.type = fn_decl @TestGreaterEqual [template = constants.%TestGreaterEqual] {
  189. // CHECK:STDOUT: %C.ref.loc25_24: type = name_ref C, %C.decl [template = constants.%C]
  190. // CHECK:STDOUT: %a.loc25_21.1: %C = param a
  191. // CHECK:STDOUT: @TestGreaterEqual.%a: %C = bind_name a, %a.loc25_21.1
  192. // CHECK:STDOUT: %C.ref.loc25_30: type = name_ref C, %C.decl [template = constants.%C]
  193. // CHECK:STDOUT: %b.loc25_27.1: %C = param b
  194. // CHECK:STDOUT: @TestGreaterEqual.%b: %C = bind_name b, %b.loc25_27.1
  195. // CHECK:STDOUT: %bool.make_type.loc25: init type = call constants.%Bool() [template = bool]
  196. // CHECK:STDOUT: %.loc25_36.1: type = value_of_initializer %bool.make_type.loc25 [template = bool]
  197. // CHECK:STDOUT: %.loc25_36.2: type = converted %bool.make_type.loc25, %.loc25_36.1 [template = bool]
  198. // CHECK:STDOUT: @TestGreaterEqual.%return: ref bool = var <return slot>
  199. // CHECK:STDOUT: }
  200. // CHECK:STDOUT: }
  201. // CHECK:STDOUT:
  202. // CHECK:STDOUT: interface @Ordered {
  203. // CHECK:STDOUT: !members:
  204. // CHECK:STDOUT: .Self = imports.%import_ref.2
  205. // CHECK:STDOUT: .Less = imports.%import_ref.3
  206. // CHECK:STDOUT: .LessOrEquivalent = imports.%import_ref.4
  207. // CHECK:STDOUT: .Greater = imports.%import_ref.5
  208. // CHECK:STDOUT: .GreaterOrEquivalent = imports.%import_ref.6
  209. // CHECK:STDOUT: witness = (imports.%import_ref.7, imports.%import_ref.8, imports.%import_ref.9, imports.%import_ref.10)
  210. // CHECK:STDOUT: }
  211. // CHECK:STDOUT:
  212. // CHECK:STDOUT: impl @impl: %C as %.2 {
  213. // CHECK:STDOUT: %Less.decl: %Less.type.1 = fn_decl @Less.1 [template = constants.%Less.1] {
  214. // CHECK:STDOUT: %C.ref.loc7_17: type = name_ref C, file.%C.decl [template = constants.%C]
  215. // CHECK:STDOUT: %self.loc7_11.1: %C = param self
  216. // CHECK:STDOUT: %self.loc7_11.2: %C = bind_name self, %self.loc7_11.1
  217. // CHECK:STDOUT: %C.ref.loc7_27: type = name_ref C, file.%C.decl [template = constants.%C]
  218. // CHECK:STDOUT: %other.loc7_20.1: %C = param other
  219. // CHECK:STDOUT: %other.loc7_20.2: %C = bind_name other, %other.loc7_20.1
  220. // CHECK:STDOUT: %bool.make_type.loc7: init type = call constants.%Bool() [template = bool]
  221. // CHECK:STDOUT: %.loc7_33.1: type = value_of_initializer %bool.make_type.loc7 [template = bool]
  222. // CHECK:STDOUT: %.loc7_33.2: type = converted %bool.make_type.loc7, %.loc7_33.1 [template = bool]
  223. // CHECK:STDOUT: %return.var.loc7: ref bool = var <return slot>
  224. // CHECK:STDOUT: }
  225. // CHECK:STDOUT: %LessOrEquivalent.decl: %LessOrEquivalent.type.1 = fn_decl @LessOrEquivalent.1 [template = constants.%LessOrEquivalent.1] {
  226. // CHECK:STDOUT: %C.ref.loc8_29: type = name_ref C, file.%C.decl [template = constants.%C]
  227. // CHECK:STDOUT: %self.loc8_23.1: %C = param self
  228. // CHECK:STDOUT: %self.loc8_23.2: %C = bind_name self, %self.loc8_23.1
  229. // CHECK:STDOUT: %C.ref.loc8_39: type = name_ref C, file.%C.decl [template = constants.%C]
  230. // CHECK:STDOUT: %other.loc8_32.1: %C = param other
  231. // CHECK:STDOUT: %other.loc8_32.2: %C = bind_name other, %other.loc8_32.1
  232. // CHECK:STDOUT: %bool.make_type.loc8: init type = call constants.%Bool() [template = bool]
  233. // CHECK:STDOUT: %.loc8_45.1: type = value_of_initializer %bool.make_type.loc8 [template = bool]
  234. // CHECK:STDOUT: %.loc8_45.2: type = converted %bool.make_type.loc8, %.loc8_45.1 [template = bool]
  235. // CHECK:STDOUT: %return.var.loc8: ref bool = var <return slot>
  236. // CHECK:STDOUT: }
  237. // CHECK:STDOUT: %Greater.decl: %Greater.type.1 = fn_decl @Greater.1 [template = constants.%Greater.1] {
  238. // CHECK:STDOUT: %C.ref.loc9_20: type = name_ref C, file.%C.decl [template = constants.%C]
  239. // CHECK:STDOUT: %self.loc9_14.1: %C = param self
  240. // CHECK:STDOUT: %self.loc9_14.2: %C = bind_name self, %self.loc9_14.1
  241. // CHECK:STDOUT: %C.ref.loc9_30: type = name_ref C, file.%C.decl [template = constants.%C]
  242. // CHECK:STDOUT: %other.loc9_23.1: %C = param other
  243. // CHECK:STDOUT: %other.loc9_23.2: %C = bind_name other, %other.loc9_23.1
  244. // CHECK:STDOUT: %bool.make_type.loc9: init type = call constants.%Bool() [template = bool]
  245. // CHECK:STDOUT: %.loc9_36.1: type = value_of_initializer %bool.make_type.loc9 [template = bool]
  246. // CHECK:STDOUT: %.loc9_36.2: type = converted %bool.make_type.loc9, %.loc9_36.1 [template = bool]
  247. // CHECK:STDOUT: %return.var.loc9: ref bool = var <return slot>
  248. // CHECK:STDOUT: }
  249. // CHECK:STDOUT: %GreaterOrEquivalent.decl: %GreaterOrEquivalent.type.1 = fn_decl @GreaterOrEquivalent.1 [template = constants.%GreaterOrEquivalent.1] {
  250. // CHECK:STDOUT: %C.ref.loc10_32: type = name_ref C, file.%C.decl [template = constants.%C]
  251. // CHECK:STDOUT: %self.loc10_26.1: %C = param self
  252. // CHECK:STDOUT: %self.loc10_26.2: %C = bind_name self, %self.loc10_26.1
  253. // CHECK:STDOUT: %C.ref.loc10_42: type = name_ref C, file.%C.decl [template = constants.%C]
  254. // CHECK:STDOUT: %other.loc10_35.1: %C = param other
  255. // CHECK:STDOUT: %other.loc10_35.2: %C = bind_name other, %other.loc10_35.1
  256. // CHECK:STDOUT: %bool.make_type.loc10: init type = call constants.%Bool() [template = bool]
  257. // CHECK:STDOUT: %.loc10_48.1: type = value_of_initializer %bool.make_type.loc10 [template = bool]
  258. // CHECK:STDOUT: %.loc10_48.2: type = converted %bool.make_type.loc10, %.loc10_48.1 [template = bool]
  259. // CHECK:STDOUT: %return.var.loc10: ref bool = var <return slot>
  260. // CHECK:STDOUT: }
  261. // CHECK:STDOUT: %.1: <witness> = interface_witness (%Less.decl, %LessOrEquivalent.decl, %Greater.decl, %GreaterOrEquivalent.decl) [template = constants.%.4]
  262. // CHECK:STDOUT:
  263. // CHECK:STDOUT: !members:
  264. // CHECK:STDOUT: .Less = %Less.decl
  265. // CHECK:STDOUT: .LessOrEquivalent = %LessOrEquivalent.decl
  266. // CHECK:STDOUT: .Greater = %Greater.decl
  267. // CHECK:STDOUT: .GreaterOrEquivalent = %GreaterOrEquivalent.decl
  268. // CHECK:STDOUT: witness = %.1
  269. // CHECK:STDOUT: }
  270. // CHECK:STDOUT:
  271. // CHECK:STDOUT: class @C {
  272. // CHECK:STDOUT: !members:
  273. // CHECK:STDOUT: .Self = constants.%C
  274. // CHECK:STDOUT: }
  275. // CHECK:STDOUT:
  276. // CHECK:STDOUT: fn @Bool() -> type = "bool.make_type";
  277. // CHECK:STDOUT:
  278. // CHECK:STDOUT: fn @Less.1[@impl.%self.loc7_11.2: %C](@impl.%other.loc7_20.2: %C) -> bool;
  279. // CHECK:STDOUT:
  280. // CHECK:STDOUT: fn @LessOrEquivalent.1[@impl.%self.loc8_23.2: %C](@impl.%other.loc8_32.2: %C) -> bool;
  281. // CHECK:STDOUT:
  282. // CHECK:STDOUT: fn @Greater.1[@impl.%self.loc9_14.2: %C](@impl.%other.loc9_23.2: %C) -> bool;
  283. // CHECK:STDOUT:
  284. // CHECK:STDOUT: fn @GreaterOrEquivalent.1[@impl.%self.loc10_26.2: %C](@impl.%other.loc10_35.2: %C) -> bool;
  285. // CHECK:STDOUT:
  286. // CHECK:STDOUT: generic fn @Less.2(constants.%Self: %.2) {
  287. // CHECK:STDOUT: %Self: %.2 = bind_symbolic_name Self 0 [symbolic = %Self (constants.%Self)]
  288. // CHECK:STDOUT:
  289. // CHECK:STDOUT: fn[%self: @Less.2.%Self (%Self)](%other: @Less.2.%Self (%Self)) -> bool;
  290. // CHECK:STDOUT: }
  291. // CHECK:STDOUT:
  292. // CHECK:STDOUT: generic fn @LessOrEquivalent.2(constants.%Self: %.2) {
  293. // CHECK:STDOUT: %Self: %.2 = bind_symbolic_name Self 0 [symbolic = %Self (constants.%Self)]
  294. // CHECK:STDOUT:
  295. // CHECK:STDOUT: fn[%self: @LessOrEquivalent.2.%Self (%Self)](%other: @LessOrEquivalent.2.%Self (%Self)) -> bool;
  296. // CHECK:STDOUT: }
  297. // CHECK:STDOUT:
  298. // CHECK:STDOUT: generic fn @Greater.2(constants.%Self: %.2) {
  299. // CHECK:STDOUT: %Self: %.2 = bind_symbolic_name Self 0 [symbolic = %Self (constants.%Self)]
  300. // CHECK:STDOUT:
  301. // CHECK:STDOUT: fn[%self: @Greater.2.%Self (%Self)](%other: @Greater.2.%Self (%Self)) -> bool;
  302. // CHECK:STDOUT: }
  303. // CHECK:STDOUT:
  304. // CHECK:STDOUT: generic fn @GreaterOrEquivalent.2(constants.%Self: %.2) {
  305. // CHECK:STDOUT: %Self: %.2 = bind_symbolic_name Self 0 [symbolic = %Self (constants.%Self)]
  306. // CHECK:STDOUT:
  307. // CHECK:STDOUT: fn[%self: @GreaterOrEquivalent.2.%Self (%Self)](%other: @GreaterOrEquivalent.2.%Self (%Self)) -> bool;
  308. // CHECK:STDOUT: }
  309. // CHECK:STDOUT:
  310. // CHECK:STDOUT: fn @TestLess(%a: %C, %b: %C) -> bool {
  311. // CHECK:STDOUT: !entry:
  312. // CHECK:STDOUT: %a.ref: %C = name_ref a, %a
  313. // CHECK:STDOUT: %b.ref: %C = name_ref b, %b
  314. // CHECK:STDOUT: %.1: %Less.type.2 = interface_witness_access @impl.%.1, element0 [template = constants.%Less.1]
  315. // CHECK:STDOUT: %.loc14_12: <bound method> = bound_method %a.ref, %.1
  316. // CHECK:STDOUT: %Less.call: init bool = call %.loc14_12(%a.ref, %b.ref)
  317. // CHECK:STDOUT: %.loc14_15.1: bool = value_of_initializer %Less.call
  318. // CHECK:STDOUT: %.loc14_15.2: bool = converted %Less.call, %.loc14_15.1
  319. // CHECK:STDOUT: return %.loc14_15.2
  320. // CHECK:STDOUT: }
  321. // CHECK:STDOUT:
  322. // CHECK:STDOUT: fn @TestLessEqual(%a: %C, %b: %C) -> bool {
  323. // CHECK:STDOUT: !entry:
  324. // CHECK:STDOUT: %a.ref: %C = name_ref a, %a
  325. // CHECK:STDOUT: %b.ref: %C = name_ref b, %b
  326. // CHECK:STDOUT: %.1: %LessOrEquivalent.type.2 = interface_witness_access @impl.%.1, element1 [template = constants.%LessOrEquivalent.1]
  327. // CHECK:STDOUT: %.loc18_12: <bound method> = bound_method %a.ref, %.1
  328. // CHECK:STDOUT: %LessOrEquivalent.call: init bool = call %.loc18_12(%a.ref, %b.ref)
  329. // CHECK:STDOUT: %.loc18_16.1: bool = value_of_initializer %LessOrEquivalent.call
  330. // CHECK:STDOUT: %.loc18_16.2: bool = converted %LessOrEquivalent.call, %.loc18_16.1
  331. // CHECK:STDOUT: return %.loc18_16.2
  332. // CHECK:STDOUT: }
  333. // CHECK:STDOUT:
  334. // CHECK:STDOUT: fn @TestGreater(%a: %C, %b: %C) -> bool {
  335. // CHECK:STDOUT: !entry:
  336. // CHECK:STDOUT: %a.ref: %C = name_ref a, %a
  337. // CHECK:STDOUT: %b.ref: %C = name_ref b, %b
  338. // CHECK:STDOUT: %.1: %Greater.type.2 = interface_witness_access @impl.%.1, element2 [template = constants.%Greater.1]
  339. // CHECK:STDOUT: %.loc22_12: <bound method> = bound_method %a.ref, %.1
  340. // CHECK:STDOUT: %Greater.call: init bool = call %.loc22_12(%a.ref, %b.ref)
  341. // CHECK:STDOUT: %.loc22_15.1: bool = value_of_initializer %Greater.call
  342. // CHECK:STDOUT: %.loc22_15.2: bool = converted %Greater.call, %.loc22_15.1
  343. // CHECK:STDOUT: return %.loc22_15.2
  344. // CHECK:STDOUT: }
  345. // CHECK:STDOUT:
  346. // CHECK:STDOUT: fn @TestGreaterEqual(%a: %C, %b: %C) -> bool {
  347. // CHECK:STDOUT: !entry:
  348. // CHECK:STDOUT: %a.ref: %C = name_ref a, %a
  349. // CHECK:STDOUT: %b.ref: %C = name_ref b, %b
  350. // CHECK:STDOUT: %.1: %GreaterOrEquivalent.type.2 = interface_witness_access @impl.%.1, element3 [template = constants.%GreaterOrEquivalent.1]
  351. // CHECK:STDOUT: %.loc26_12: <bound method> = bound_method %a.ref, %.1
  352. // CHECK:STDOUT: %GreaterOrEquivalent.call: init bool = call %.loc26_12(%a.ref, %b.ref)
  353. // CHECK:STDOUT: %.loc26_16.1: bool = value_of_initializer %GreaterOrEquivalent.call
  354. // CHECK:STDOUT: %.loc26_16.2: bool = converted %GreaterOrEquivalent.call, %.loc26_16.1
  355. // CHECK:STDOUT: return %.loc26_16.2
  356. // CHECK:STDOUT: }
  357. // CHECK:STDOUT:
  358. // CHECK:STDOUT: specific @Less.2(constants.%Self) {
  359. // CHECK:STDOUT: %Self => constants.%Self
  360. // CHECK:STDOUT: }
  361. // CHECK:STDOUT:
  362. // CHECK:STDOUT: specific @Less.2(constants.%C) {
  363. // CHECK:STDOUT: %Self => constants.%C
  364. // CHECK:STDOUT: }
  365. // CHECK:STDOUT:
  366. // CHECK:STDOUT: specific @LessOrEquivalent.2(constants.%Self) {
  367. // CHECK:STDOUT: %Self => constants.%Self
  368. // CHECK:STDOUT: }
  369. // CHECK:STDOUT:
  370. // CHECK:STDOUT: specific @LessOrEquivalent.2(constants.%C) {
  371. // CHECK:STDOUT: %Self => constants.%C
  372. // CHECK:STDOUT: }
  373. // CHECK:STDOUT:
  374. // CHECK:STDOUT: specific @Greater.2(constants.%Self) {
  375. // CHECK:STDOUT: %Self => constants.%Self
  376. // CHECK:STDOUT: }
  377. // CHECK:STDOUT:
  378. // CHECK:STDOUT: specific @Greater.2(constants.%C) {
  379. // CHECK:STDOUT: %Self => constants.%C
  380. // CHECK:STDOUT: }
  381. // CHECK:STDOUT:
  382. // CHECK:STDOUT: specific @GreaterOrEquivalent.2(constants.%Self) {
  383. // CHECK:STDOUT: %Self => constants.%Self
  384. // CHECK:STDOUT: }
  385. // CHECK:STDOUT:
  386. // CHECK:STDOUT: specific @GreaterOrEquivalent.2(constants.%C) {
  387. // CHECK:STDOUT: %Self => constants.%C
  388. // CHECK:STDOUT: }
  389. // CHECK:STDOUT:
  390. // CHECK:STDOUT: --- fail_no_impl.carbon
  391. // CHECK:STDOUT:
  392. // CHECK:STDOUT: constants {
  393. // CHECK:STDOUT: %D: type = class_type @D [template]
  394. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  395. // CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template]
  396. // CHECK:STDOUT: %.2: type = tuple_type () [template]
  397. // CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template]
  398. // CHECK:STDOUT: %TestLess.type: type = fn_type @TestLess [template]
  399. // CHECK:STDOUT: %TestLess: %TestLess.type = struct_value () [template]
  400. // CHECK:STDOUT: %.3: type = ptr_type %.1 [template]
  401. // CHECK:STDOUT: %.4: type = interface_type @Ordered [template]
  402. // CHECK:STDOUT: %Self: %.4 = bind_symbolic_name Self 0 [symbolic]
  403. // CHECK:STDOUT: %Less.type: type = fn_type @Less [template]
  404. // CHECK:STDOUT: %Less: %Less.type = struct_value () [template]
  405. // CHECK:STDOUT: %.5: type = assoc_entity_type %.4, %Less.type [template]
  406. // CHECK:STDOUT: %.6: %.5 = assoc_entity element0, imports.%import_ref.12 [template]
  407. // CHECK:STDOUT: %TestLessEqual.type: type = fn_type @TestLessEqual [template]
  408. // CHECK:STDOUT: %TestLessEqual: %TestLessEqual.type = struct_value () [template]
  409. // CHECK:STDOUT: %LessOrEquivalent.type: type = fn_type @LessOrEquivalent [template]
  410. // CHECK:STDOUT: %LessOrEquivalent: %LessOrEquivalent.type = struct_value () [template]
  411. // CHECK:STDOUT: %.7: type = assoc_entity_type %.4, %LessOrEquivalent.type [template]
  412. // CHECK:STDOUT: %.8: %.7 = assoc_entity element1, imports.%import_ref.13 [template]
  413. // CHECK:STDOUT: %TestGreater.type: type = fn_type @TestGreater [template]
  414. // CHECK:STDOUT: %TestGreater: %TestGreater.type = struct_value () [template]
  415. // CHECK:STDOUT: %Greater.type: type = fn_type @Greater [template]
  416. // CHECK:STDOUT: %Greater: %Greater.type = struct_value () [template]
  417. // CHECK:STDOUT: %.9: type = assoc_entity_type %.4, %Greater.type [template]
  418. // CHECK:STDOUT: %.10: %.9 = assoc_entity element2, imports.%import_ref.14 [template]
  419. // CHECK:STDOUT: %TestGreaterEqual.type: type = fn_type @TestGreaterEqual [template]
  420. // CHECK:STDOUT: %TestGreaterEqual: %TestGreaterEqual.type = struct_value () [template]
  421. // CHECK:STDOUT: %GreaterOrEquivalent.type: type = fn_type @GreaterOrEquivalent [template]
  422. // CHECK:STDOUT: %GreaterOrEquivalent: %GreaterOrEquivalent.type = struct_value () [template]
  423. // CHECK:STDOUT: %.11: type = assoc_entity_type %.4, %GreaterOrEquivalent.type [template]
  424. // CHECK:STDOUT: %.12: %.11 = assoc_entity element3, imports.%import_ref.15 [template]
  425. // CHECK:STDOUT: }
  426. // CHECK:STDOUT:
  427. // CHECK:STDOUT: imports {
  428. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  429. // CHECK:STDOUT: .Bool = %import_ref.1
  430. // CHECK:STDOUT: .Ordered = %import_ref.2
  431. // CHECK:STDOUT: import Core//prelude
  432. // CHECK:STDOUT: import Core//prelude/operators
  433. // CHECK:STDOUT: import Core//prelude/types
  434. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  435. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  436. // CHECK:STDOUT: import Core//prelude/operators/comparison
  437. // CHECK:STDOUT: import Core//prelude/types/bool
  438. // CHECK:STDOUT: }
  439. // CHECK:STDOUT: %import_ref.1: %Bool.type = import_ref Core//prelude/types/bool, inst+2, loaded [template = constants.%Bool]
  440. // CHECK:STDOUT: %import_ref.2: type = import_ref Core//prelude/operators/comparison, inst+54, loaded [template = constants.%.4]
  441. // CHECK:STDOUT: %import_ref.3 = import_ref Core//prelude/operators/comparison, inst+56, unloaded
  442. // CHECK:STDOUT: %import_ref.4: %.5 = import_ref Core//prelude/operators/comparison, inst+77, loaded [template = constants.%.6]
  443. // CHECK:STDOUT: %import_ref.5: %.7 = import_ref Core//prelude/operators/comparison, inst+98, loaded [template = constants.%.8]
  444. // CHECK:STDOUT: %import_ref.6: %.9 = import_ref Core//prelude/operators/comparison, inst+119, loaded [template = constants.%.10]
  445. // CHECK:STDOUT: %import_ref.7: %.11 = import_ref Core//prelude/operators/comparison, inst+140, loaded [template = constants.%.12]
  446. // CHECK:STDOUT: %import_ref.8 = import_ref Core//prelude/operators/comparison, inst+72, unloaded
  447. // CHECK:STDOUT: %import_ref.9 = import_ref Core//prelude/operators/comparison, inst+93, unloaded
  448. // CHECK:STDOUT: %import_ref.10 = import_ref Core//prelude/operators/comparison, inst+114, unloaded
  449. // CHECK:STDOUT: %import_ref.11 = import_ref Core//prelude/operators/comparison, inst+135, unloaded
  450. // CHECK:STDOUT: %import_ref.12 = import_ref Core//prelude/operators/comparison, inst+72, unloaded
  451. // CHECK:STDOUT: %import_ref.13 = import_ref Core//prelude/operators/comparison, inst+93, unloaded
  452. // CHECK:STDOUT: %import_ref.14 = import_ref Core//prelude/operators/comparison, inst+114, unloaded
  453. // CHECK:STDOUT: %import_ref.15 = import_ref Core//prelude/operators/comparison, inst+135, unloaded
  454. // CHECK:STDOUT: }
  455. // CHECK:STDOUT:
  456. // CHECK:STDOUT: file {
  457. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  458. // CHECK:STDOUT: .Core = imports.%Core
  459. // CHECK:STDOUT: .D = %D.decl
  460. // CHECK:STDOUT: .TestLess = %TestLess.decl
  461. // CHECK:STDOUT: .TestLessEqual = %TestLessEqual.decl
  462. // CHECK:STDOUT: .TestGreater = %TestGreater.decl
  463. // CHECK:STDOUT: .TestGreaterEqual = %TestGreaterEqual.decl
  464. // CHECK:STDOUT: }
  465. // CHECK:STDOUT: %Core.import = import Core
  466. // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {}
  467. // CHECK:STDOUT: %TestLess.decl: %TestLess.type = fn_decl @TestLess [template = constants.%TestLess] {
  468. // CHECK:STDOUT: %D.ref.loc6_16: type = name_ref D, %D.decl [template = constants.%D]
  469. // CHECK:STDOUT: %a.loc6_13.1: %D = param a
  470. // CHECK:STDOUT: @TestLess.%a: %D = bind_name a, %a.loc6_13.1
  471. // CHECK:STDOUT: %D.ref.loc6_22: type = name_ref D, %D.decl [template = constants.%D]
  472. // CHECK:STDOUT: %b.loc6_19.1: %D = param b
  473. // CHECK:STDOUT: @TestLess.%b: %D = bind_name b, %b.loc6_19.1
  474. // CHECK:STDOUT: %bool.make_type.loc6: init type = call constants.%Bool() [template = bool]
  475. // CHECK:STDOUT: %.loc6_28.1: type = value_of_initializer %bool.make_type.loc6 [template = bool]
  476. // CHECK:STDOUT: %.loc6_28.2: type = converted %bool.make_type.loc6, %.loc6_28.1 [template = bool]
  477. // CHECK:STDOUT: @TestLess.%return: ref bool = var <return slot>
  478. // CHECK:STDOUT: }
  479. // CHECK:STDOUT: %TestLessEqual.decl: %TestLessEqual.type = fn_decl @TestLessEqual [template = constants.%TestLessEqual] {
  480. // CHECK:STDOUT: %D.ref.loc14_21: type = name_ref D, %D.decl [template = constants.%D]
  481. // CHECK:STDOUT: %a.loc14_18.1: %D = param a
  482. // CHECK:STDOUT: @TestLessEqual.%a: %D = bind_name a, %a.loc14_18.1
  483. // CHECK:STDOUT: %D.ref.loc14_27: type = name_ref D, %D.decl [template = constants.%D]
  484. // CHECK:STDOUT: %b.loc14_24.1: %D = param b
  485. // CHECK:STDOUT: @TestLessEqual.%b: %D = bind_name b, %b.loc14_24.1
  486. // CHECK:STDOUT: %bool.make_type.loc14: init type = call constants.%Bool() [template = bool]
  487. // CHECK:STDOUT: %.loc14_33.1: type = value_of_initializer %bool.make_type.loc14 [template = bool]
  488. // CHECK:STDOUT: %.loc14_33.2: type = converted %bool.make_type.loc14, %.loc14_33.1 [template = bool]
  489. // CHECK:STDOUT: @TestLessEqual.%return: ref bool = var <return slot>
  490. // CHECK:STDOUT: }
  491. // CHECK:STDOUT: %TestGreater.decl: %TestGreater.type = fn_decl @TestGreater [template = constants.%TestGreater] {
  492. // CHECK:STDOUT: %D.ref.loc22_19: type = name_ref D, %D.decl [template = constants.%D]
  493. // CHECK:STDOUT: %a.loc22_16.1: %D = param a
  494. // CHECK:STDOUT: @TestGreater.%a: %D = bind_name a, %a.loc22_16.1
  495. // CHECK:STDOUT: %D.ref.loc22_25: type = name_ref D, %D.decl [template = constants.%D]
  496. // CHECK:STDOUT: %b.loc22_22.1: %D = param b
  497. // CHECK:STDOUT: @TestGreater.%b: %D = bind_name b, %b.loc22_22.1
  498. // CHECK:STDOUT: %bool.make_type.loc22: init type = call constants.%Bool() [template = bool]
  499. // CHECK:STDOUT: %.loc22_31.1: type = value_of_initializer %bool.make_type.loc22 [template = bool]
  500. // CHECK:STDOUT: %.loc22_31.2: type = converted %bool.make_type.loc22, %.loc22_31.1 [template = bool]
  501. // CHECK:STDOUT: @TestGreater.%return: ref bool = var <return slot>
  502. // CHECK:STDOUT: }
  503. // CHECK:STDOUT: %TestGreaterEqual.decl: %TestGreaterEqual.type = fn_decl @TestGreaterEqual [template = constants.%TestGreaterEqual] {
  504. // CHECK:STDOUT: %D.ref.loc30_24: type = name_ref D, %D.decl [template = constants.%D]
  505. // CHECK:STDOUT: %a.loc30_21.1: %D = param a
  506. // CHECK:STDOUT: @TestGreaterEqual.%a: %D = bind_name a, %a.loc30_21.1
  507. // CHECK:STDOUT: %D.ref.loc30_30: type = name_ref D, %D.decl [template = constants.%D]
  508. // CHECK:STDOUT: %b.loc30_27.1: %D = param b
  509. // CHECK:STDOUT: @TestGreaterEqual.%b: %D = bind_name b, %b.loc30_27.1
  510. // CHECK:STDOUT: %bool.make_type.loc30: init type = call constants.%Bool() [template = bool]
  511. // CHECK:STDOUT: %.loc30_36.1: type = value_of_initializer %bool.make_type.loc30 [template = bool]
  512. // CHECK:STDOUT: %.loc30_36.2: type = converted %bool.make_type.loc30, %.loc30_36.1 [template = bool]
  513. // CHECK:STDOUT: @TestGreaterEqual.%return: ref bool = var <return slot>
  514. // CHECK:STDOUT: }
  515. // CHECK:STDOUT: }
  516. // CHECK:STDOUT:
  517. // CHECK:STDOUT: interface @Ordered {
  518. // CHECK:STDOUT: !members:
  519. // CHECK:STDOUT: .Self = imports.%import_ref.3
  520. // CHECK:STDOUT: .Less = imports.%import_ref.4
  521. // CHECK:STDOUT: .LessOrEquivalent = imports.%import_ref.5
  522. // CHECK:STDOUT: .Greater = imports.%import_ref.6
  523. // CHECK:STDOUT: .GreaterOrEquivalent = imports.%import_ref.7
  524. // CHECK:STDOUT: witness = (imports.%import_ref.8, imports.%import_ref.9, imports.%import_ref.10, imports.%import_ref.11)
  525. // CHECK:STDOUT: }
  526. // CHECK:STDOUT:
  527. // CHECK:STDOUT: class @D {
  528. // CHECK:STDOUT: !members:
  529. // CHECK:STDOUT: .Self = constants.%D
  530. // CHECK:STDOUT: }
  531. // CHECK:STDOUT:
  532. // CHECK:STDOUT: fn @Bool() -> type = "bool.make_type";
  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: generic fn @Less(constants.%Self: %.4) {
  542. // CHECK:STDOUT: %Self: %.4 = bind_symbolic_name Self 0 [symbolic = %Self (constants.%Self)]
  543. // CHECK:STDOUT:
  544. // CHECK:STDOUT: fn[%self: @Less.%Self (%Self)](%other: @Less.%Self (%Self)) -> bool;
  545. // CHECK:STDOUT: }
  546. // CHECK:STDOUT:
  547. // CHECK:STDOUT: fn @TestLessEqual(%a: %D, %b: %D) -> bool {
  548. // CHECK:STDOUT: !entry:
  549. // CHECK:STDOUT: %a.ref: %D = name_ref a, %a
  550. // CHECK:STDOUT: %b.ref: %D = name_ref b, %b
  551. // CHECK:STDOUT: return <error>
  552. // CHECK:STDOUT: }
  553. // CHECK:STDOUT:
  554. // CHECK:STDOUT: generic fn @LessOrEquivalent(constants.%Self: %.4) {
  555. // CHECK:STDOUT: %Self: %.4 = bind_symbolic_name Self 0 [symbolic = %Self (constants.%Self)]
  556. // CHECK:STDOUT:
  557. // CHECK:STDOUT: fn[%self: @LessOrEquivalent.%Self (%Self)](%other: @LessOrEquivalent.%Self (%Self)) -> bool;
  558. // CHECK:STDOUT: }
  559. // CHECK:STDOUT:
  560. // CHECK:STDOUT: fn @TestGreater(%a: %D, %b: %D) -> bool {
  561. // CHECK:STDOUT: !entry:
  562. // CHECK:STDOUT: %a.ref: %D = name_ref a, %a
  563. // CHECK:STDOUT: %b.ref: %D = name_ref b, %b
  564. // CHECK:STDOUT: return <error>
  565. // CHECK:STDOUT: }
  566. // CHECK:STDOUT:
  567. // CHECK:STDOUT: generic fn @Greater(constants.%Self: %.4) {
  568. // CHECK:STDOUT: %Self: %.4 = bind_symbolic_name Self 0 [symbolic = %Self (constants.%Self)]
  569. // CHECK:STDOUT:
  570. // CHECK:STDOUT: fn[%self: @Greater.%Self (%Self)](%other: @Greater.%Self (%Self)) -> bool;
  571. // CHECK:STDOUT: }
  572. // CHECK:STDOUT:
  573. // CHECK:STDOUT: fn @TestGreaterEqual(%a: %D, %b: %D) -> bool {
  574. // CHECK:STDOUT: !entry:
  575. // CHECK:STDOUT: %a.ref: %D = name_ref a, %a
  576. // CHECK:STDOUT: %b.ref: %D = name_ref b, %b
  577. // CHECK:STDOUT: return <error>
  578. // CHECK:STDOUT: }
  579. // CHECK:STDOUT:
  580. // CHECK:STDOUT: generic fn @GreaterOrEquivalent(constants.%Self: %.4) {
  581. // CHECK:STDOUT: %Self: %.4 = bind_symbolic_name Self 0 [symbolic = %Self (constants.%Self)]
  582. // CHECK:STDOUT:
  583. // CHECK:STDOUT: fn[%self: @GreaterOrEquivalent.%Self (%Self)](%other: @GreaterOrEquivalent.%Self (%Self)) -> bool;
  584. // CHECK:STDOUT: }
  585. // CHECK:STDOUT:
  586. // CHECK:STDOUT: specific @Less(constants.%Self) {
  587. // CHECK:STDOUT: %Self => constants.%Self
  588. // CHECK:STDOUT: }
  589. // CHECK:STDOUT:
  590. // CHECK:STDOUT: specific @LessOrEquivalent(constants.%Self) {
  591. // CHECK:STDOUT: %Self => constants.%Self
  592. // CHECK:STDOUT: }
  593. // CHECK:STDOUT:
  594. // CHECK:STDOUT: specific @Greater(constants.%Self) {
  595. // CHECK:STDOUT: %Self => constants.%Self
  596. // CHECK:STDOUT: }
  597. // CHECK:STDOUT:
  598. // CHECK:STDOUT: specific @GreaterOrEquivalent(constants.%Self) {
  599. // CHECK:STDOUT: %Self => constants.%Self
  600. // CHECK:STDOUT: }
  601. // CHECK:STDOUT: