neq.carbon 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  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/builtins/bool/neq.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/bool/neq.carbon
  10. // --- builtin_call.carbon
  11. library "[[@TEST_NAME]]";
  12. fn Neq(a: bool, b: bool) -> bool = "bool.neq";
  13. class C(B:! bool) {}
  14. fn True() -> C(true);
  15. fn False() -> C(false);
  16. var a: C(Neq(true, true)) = False();
  17. var b: C(Neq(true, false)) = True();
  18. var c: C(Neq(false, true)) = True();
  19. var d: C(Neq(false, false)) = False();
  20. // --- prelude.carbon
  21. library "[[@TEST_NAME]]";
  22. class C(B:! bool) {}
  23. fn True() -> C(true);
  24. fn False() -> C(false);
  25. var a: C(true != true) = False();
  26. var b: C(true != false) = True();
  27. var c: C(false != true) = True();
  28. var d: C(false != false) = False();
  29. // CHECK:STDOUT: --- builtin_call.carbon
  30. // CHECK:STDOUT:
  31. // CHECK:STDOUT: constants {
  32. // CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template]
  33. // CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template]
  34. // CHECK:STDOUT: %Neq.type: type = fn_type @Neq [template]
  35. // CHECK:STDOUT: %Neq: %Neq.type = struct_value () [template]
  36. // CHECK:STDOUT: %B: bool = bind_symbolic_name B, 0 [symbolic]
  37. // CHECK:STDOUT: %B.patt: bool = symbolic_binding_pattern B, 0 [symbolic]
  38. // CHECK:STDOUT: %C.type: type = generic_class_type @C [template]
  39. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [template]
  40. // CHECK:STDOUT: %C.342: type = class_type @C, @C(%B) [symbolic]
  41. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  42. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  43. // CHECK:STDOUT: %true: bool = bool_literal true [template]
  44. // CHECK:STDOUT: %C.a14: type = class_type @C, @C(%true) [template]
  45. // CHECK:STDOUT: %True.type: type = fn_type @True [template]
  46. // CHECK:STDOUT: %True: %True.type = struct_value () [template]
  47. // CHECK:STDOUT: %false: bool = bool_literal false [template]
  48. // CHECK:STDOUT: %C.2ba: type = class_type @C, @C(%false) [template]
  49. // CHECK:STDOUT: %False.type: type = fn_type @False [template]
  50. // CHECK:STDOUT: %False: %False.type = struct_value () [template]
  51. // CHECK:STDOUT: }
  52. // CHECK:STDOUT:
  53. // CHECK:STDOUT: imports {
  54. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  55. // CHECK:STDOUT: .Bool = %Core.Bool
  56. // CHECK:STDOUT: import Core//prelude
  57. // CHECK:STDOUT: import Core//prelude/...
  58. // CHECK:STDOUT: }
  59. // CHECK:STDOUT: }
  60. // CHECK:STDOUT:
  61. // CHECK:STDOUT: file {
  62. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  63. // CHECK:STDOUT: .Core = imports.%Core
  64. // CHECK:STDOUT: .Neq = %Neq.decl
  65. // CHECK:STDOUT: .C = %C.decl
  66. // CHECK:STDOUT: .True = %True.decl
  67. // CHECK:STDOUT: .False = %False.decl
  68. // CHECK:STDOUT: .a = %a
  69. // CHECK:STDOUT: .b = %b
  70. // CHECK:STDOUT: .c = %c
  71. // CHECK:STDOUT: .d = %d
  72. // CHECK:STDOUT: }
  73. // CHECK:STDOUT: %Core.import = import Core
  74. // CHECK:STDOUT: %Neq.decl: %Neq.type = fn_decl @Neq [template = constants.%Neq] {
  75. // CHECK:STDOUT: %a.patt: bool = binding_pattern a
  76. // CHECK:STDOUT: %a.param_patt: bool = value_param_pattern %a.patt, runtime_param0
  77. // CHECK:STDOUT: %b.patt: bool = binding_pattern b
  78. // CHECK:STDOUT: %b.param_patt: bool = value_param_pattern %b.patt, runtime_param1
  79. // CHECK:STDOUT: %return.patt: bool = return_slot_pattern
  80. // CHECK:STDOUT: %return.param_patt: bool = out_param_pattern %return.patt, runtime_param2
  81. // CHECK:STDOUT: } {
  82. // CHECK:STDOUT: %bool.make_type.loc4_29: init type = call constants.%Bool() [template = bool]
  83. // CHECK:STDOUT: %.loc4_29.1: type = value_of_initializer %bool.make_type.loc4_29 [template = bool]
  84. // CHECK:STDOUT: %.loc4_29.2: type = converted %bool.make_type.loc4_29, %.loc4_29.1 [template = bool]
  85. // CHECK:STDOUT: %a.param: bool = value_param runtime_param0
  86. // CHECK:STDOUT: %.loc4_11.1: type = splice_block %.loc4_11.3 [template = bool] {
  87. // CHECK:STDOUT: %bool.make_type.loc4_11: init type = call constants.%Bool() [template = bool]
  88. // CHECK:STDOUT: %.loc4_11.2: type = value_of_initializer %bool.make_type.loc4_11 [template = bool]
  89. // CHECK:STDOUT: %.loc4_11.3: type = converted %bool.make_type.loc4_11, %.loc4_11.2 [template = bool]
  90. // CHECK:STDOUT: }
  91. // CHECK:STDOUT: %a: bool = bind_name a, %a.param
  92. // CHECK:STDOUT: %b.param: bool = value_param runtime_param1
  93. // CHECK:STDOUT: %.loc4_20.1: type = splice_block %.loc4_20.3 [template = bool] {
  94. // CHECK:STDOUT: %bool.make_type.loc4_20: init type = call constants.%Bool() [template = bool]
  95. // CHECK:STDOUT: %.loc4_20.2: type = value_of_initializer %bool.make_type.loc4_20 [template = bool]
  96. // CHECK:STDOUT: %.loc4_20.3: type = converted %bool.make_type.loc4_20, %.loc4_20.2 [template = bool]
  97. // CHECK:STDOUT: }
  98. // CHECK:STDOUT: %b: bool = bind_name b, %b.param
  99. // CHECK:STDOUT: %return.param: ref bool = out_param runtime_param2
  100. // CHECK:STDOUT: %return: ref bool = return_slot %return.param
  101. // CHECK:STDOUT: }
  102. // CHECK:STDOUT: %C.decl: %C.type = class_decl @C [template = constants.%C.generic] {
  103. // CHECK:STDOUT: %B.patt.loc6_9.1: bool = symbolic_binding_pattern B, 0 [symbolic = %B.patt.loc6_9.2 (constants.%B.patt)]
  104. // CHECK:STDOUT: %B.param_patt: bool = value_param_pattern %B.patt.loc6_9.1, runtime_param<none> [symbolic = %B.patt.loc6_9.2 (constants.%B.patt)]
  105. // CHECK:STDOUT: } {
  106. // CHECK:STDOUT: %B.param: bool = value_param runtime_param<none>
  107. // CHECK:STDOUT: %.loc6_13.1: type = splice_block %.loc6_13.3 [template = bool] {
  108. // CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool]
  109. // CHECK:STDOUT: %.loc6_13.2: type = value_of_initializer %bool.make_type [template = bool]
  110. // CHECK:STDOUT: %.loc6_13.3: type = converted %bool.make_type, %.loc6_13.2 [template = bool]
  111. // CHECK:STDOUT: }
  112. // CHECK:STDOUT: %B.loc6_9.1: bool = bind_symbolic_name B, 0, %B.param [symbolic = %B.loc6_9.2 (constants.%B)]
  113. // CHECK:STDOUT: }
  114. // CHECK:STDOUT: %True.decl: %True.type = fn_decl @True [template = constants.%True] {
  115. // CHECK:STDOUT: %return.patt: %C.a14 = return_slot_pattern
  116. // CHECK:STDOUT: %return.param_patt: %C.a14 = out_param_pattern %return.patt, runtime_param0
  117. // CHECK:STDOUT: } {
  118. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [template = constants.%C.generic]
  119. // CHECK:STDOUT: %true: bool = bool_literal true [template = constants.%true]
  120. // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%true) [template = constants.%C.a14]
  121. // CHECK:STDOUT: %return.param: ref %C.a14 = out_param runtime_param0
  122. // CHECK:STDOUT: %return: ref %C.a14 = return_slot %return.param
  123. // CHECK:STDOUT: }
  124. // CHECK:STDOUT: %False.decl: %False.type = fn_decl @False [template = constants.%False] {
  125. // CHECK:STDOUT: %return.patt: %C.2ba = return_slot_pattern
  126. // CHECK:STDOUT: %return.param_patt: %C.2ba = out_param_pattern %return.patt, runtime_param0
  127. // CHECK:STDOUT: } {
  128. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [template = constants.%C.generic]
  129. // CHECK:STDOUT: %false: bool = bool_literal false [template = constants.%false]
  130. // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%false) [template = constants.%C.2ba]
  131. // CHECK:STDOUT: %return.param: ref %C.2ba = out_param runtime_param0
  132. // CHECK:STDOUT: %return: ref %C.2ba = return_slot %return.param
  133. // CHECK:STDOUT: }
  134. // CHECK:STDOUT: name_binding_decl {
  135. // CHECK:STDOUT: %a.patt: %C.2ba = binding_pattern a
  136. // CHECK:STDOUT: %.loc11_1: %C.2ba = var_pattern %a.patt
  137. // CHECK:STDOUT: }
  138. // CHECK:STDOUT: %a.var: ref %C.2ba = var a
  139. // CHECK:STDOUT: %.loc11_25.1: type = splice_block %C.loc11 [template = constants.%C.2ba] {
  140. // CHECK:STDOUT: %C.ref.loc11: %C.type = name_ref C, %C.decl [template = constants.%C.generic]
  141. // CHECK:STDOUT: %Neq.ref.loc11: %Neq.type = name_ref Neq, %Neq.decl [template = constants.%Neq]
  142. // CHECK:STDOUT: %true.loc11_14: bool = bool_literal true [template = constants.%true]
  143. // CHECK:STDOUT: %true.loc11_20: bool = bool_literal true [template = constants.%true]
  144. // CHECK:STDOUT: %bool.neq.loc11: init bool = call %Neq.ref.loc11(%true.loc11_14, %true.loc11_20) [template = constants.%false]
  145. // CHECK:STDOUT: %.loc11_25.2: bool = value_of_initializer %bool.neq.loc11 [template = constants.%false]
  146. // CHECK:STDOUT: %.loc11_25.3: bool = converted %bool.neq.loc11, %.loc11_25.2 [template = constants.%false]
  147. // CHECK:STDOUT: %C.loc11: type = class_type @C, @C(constants.%false) [template = constants.%C.2ba]
  148. // CHECK:STDOUT: }
  149. // CHECK:STDOUT: %a: ref %C.2ba = bind_name a, %a.var
  150. // CHECK:STDOUT: name_binding_decl {
  151. // CHECK:STDOUT: %b.patt: %C.a14 = binding_pattern b
  152. // CHECK:STDOUT: %.loc12_1: %C.a14 = var_pattern %b.patt
  153. // CHECK:STDOUT: }
  154. // CHECK:STDOUT: %b.var: ref %C.a14 = var b
  155. // CHECK:STDOUT: %.loc12_26.1: type = splice_block %C.loc12 [template = constants.%C.a14] {
  156. // CHECK:STDOUT: %C.ref.loc12: %C.type = name_ref C, %C.decl [template = constants.%C.generic]
  157. // CHECK:STDOUT: %Neq.ref.loc12: %Neq.type = name_ref Neq, %Neq.decl [template = constants.%Neq]
  158. // CHECK:STDOUT: %true.loc12: bool = bool_literal true [template = constants.%true]
  159. // CHECK:STDOUT: %false.loc12: bool = bool_literal false [template = constants.%false]
  160. // CHECK:STDOUT: %bool.neq.loc12: init bool = call %Neq.ref.loc12(%true.loc12, %false.loc12) [template = constants.%true]
  161. // CHECK:STDOUT: %.loc12_26.2: bool = value_of_initializer %bool.neq.loc12 [template = constants.%true]
  162. // CHECK:STDOUT: %.loc12_26.3: bool = converted %bool.neq.loc12, %.loc12_26.2 [template = constants.%true]
  163. // CHECK:STDOUT: %C.loc12: type = class_type @C, @C(constants.%true) [template = constants.%C.a14]
  164. // CHECK:STDOUT: }
  165. // CHECK:STDOUT: %b: ref %C.a14 = bind_name b, %b.var
  166. // CHECK:STDOUT: name_binding_decl {
  167. // CHECK:STDOUT: %c.patt: %C.a14 = binding_pattern c
  168. // CHECK:STDOUT: %.loc13_1: %C.a14 = var_pattern %c.patt
  169. // CHECK:STDOUT: }
  170. // CHECK:STDOUT: %c.var: ref %C.a14 = var c
  171. // CHECK:STDOUT: %.loc13_26.1: type = splice_block %C.loc13 [template = constants.%C.a14] {
  172. // CHECK:STDOUT: %C.ref.loc13: %C.type = name_ref C, %C.decl [template = constants.%C.generic]
  173. // CHECK:STDOUT: %Neq.ref.loc13: %Neq.type = name_ref Neq, %Neq.decl [template = constants.%Neq]
  174. // CHECK:STDOUT: %false.loc13: bool = bool_literal false [template = constants.%false]
  175. // CHECK:STDOUT: %true.loc13: bool = bool_literal true [template = constants.%true]
  176. // CHECK:STDOUT: %bool.neq.loc13: init bool = call %Neq.ref.loc13(%false.loc13, %true.loc13) [template = constants.%true]
  177. // CHECK:STDOUT: %.loc13_26.2: bool = value_of_initializer %bool.neq.loc13 [template = constants.%true]
  178. // CHECK:STDOUT: %.loc13_26.3: bool = converted %bool.neq.loc13, %.loc13_26.2 [template = constants.%true]
  179. // CHECK:STDOUT: %C.loc13: type = class_type @C, @C(constants.%true) [template = constants.%C.a14]
  180. // CHECK:STDOUT: }
  181. // CHECK:STDOUT: %c: ref %C.a14 = bind_name c, %c.var
  182. // CHECK:STDOUT: name_binding_decl {
  183. // CHECK:STDOUT: %d.patt: %C.2ba = binding_pattern d
  184. // CHECK:STDOUT: %.loc14_1: %C.2ba = var_pattern %d.patt
  185. // CHECK:STDOUT: }
  186. // CHECK:STDOUT: %d.var: ref %C.2ba = var d
  187. // CHECK:STDOUT: %.loc14_27.1: type = splice_block %C.loc14 [template = constants.%C.2ba] {
  188. // CHECK:STDOUT: %C.ref.loc14: %C.type = name_ref C, %C.decl [template = constants.%C.generic]
  189. // CHECK:STDOUT: %Neq.ref.loc14: %Neq.type = name_ref Neq, %Neq.decl [template = constants.%Neq]
  190. // CHECK:STDOUT: %false.loc14_14: bool = bool_literal false [template = constants.%false]
  191. // CHECK:STDOUT: %false.loc14_21: bool = bool_literal false [template = constants.%false]
  192. // CHECK:STDOUT: %bool.neq.loc14: init bool = call %Neq.ref.loc14(%false.loc14_14, %false.loc14_21) [template = constants.%false]
  193. // CHECK:STDOUT: %.loc14_27.2: bool = value_of_initializer %bool.neq.loc14 [template = constants.%false]
  194. // CHECK:STDOUT: %.loc14_27.3: bool = converted %bool.neq.loc14, %.loc14_27.2 [template = constants.%false]
  195. // CHECK:STDOUT: %C.loc14: type = class_type @C, @C(constants.%false) [template = constants.%C.2ba]
  196. // CHECK:STDOUT: }
  197. // CHECK:STDOUT: %d: ref %C.2ba = bind_name d, %d.var
  198. // CHECK:STDOUT: }
  199. // CHECK:STDOUT:
  200. // CHECK:STDOUT: generic class @C(%B.loc6_9.1: bool) {
  201. // CHECK:STDOUT: %B.loc6_9.2: bool = bind_symbolic_name B, 0 [symbolic = %B.loc6_9.2 (constants.%B)]
  202. // CHECK:STDOUT: %B.patt.loc6_9.2: bool = symbolic_binding_pattern B, 0 [symbolic = %B.patt.loc6_9.2 (constants.%B.patt)]
  203. // CHECK:STDOUT:
  204. // CHECK:STDOUT: !definition:
  205. // CHECK:STDOUT:
  206. // CHECK:STDOUT: class {
  207. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  208. // CHECK:STDOUT: complete_type_witness = %complete_type
  209. // CHECK:STDOUT:
  210. // CHECK:STDOUT: !members:
  211. // CHECK:STDOUT: .Self = constants.%C.342
  212. // CHECK:STDOUT: }
  213. // CHECK:STDOUT: }
  214. // CHECK:STDOUT:
  215. // CHECK:STDOUT: fn @Neq(%a.param_patt: bool, %b.param_patt: bool) -> bool = "bool.neq";
  216. // CHECK:STDOUT:
  217. // CHECK:STDOUT: fn @True() -> %C.a14;
  218. // CHECK:STDOUT:
  219. // CHECK:STDOUT: fn @False() -> %C.2ba;
  220. // CHECK:STDOUT:
  221. // CHECK:STDOUT: fn @__global_init() {
  222. // CHECK:STDOUT: !entry:
  223. // CHECK:STDOUT: %False.ref.loc11: %False.type = name_ref False, file.%False.decl [template = constants.%False]
  224. // CHECK:STDOUT: %.loc11: ref %C.2ba = splice_block file.%a.var {}
  225. // CHECK:STDOUT: %False.call.loc11: init %C.2ba = call %False.ref.loc11() to %.loc11
  226. // CHECK:STDOUT: assign file.%a.var, %False.call.loc11
  227. // CHECK:STDOUT: %True.ref.loc12: %True.type = name_ref True, file.%True.decl [template = constants.%True]
  228. // CHECK:STDOUT: %.loc12: ref %C.a14 = splice_block file.%b.var {}
  229. // CHECK:STDOUT: %True.call.loc12: init %C.a14 = call %True.ref.loc12() to %.loc12
  230. // CHECK:STDOUT: assign file.%b.var, %True.call.loc12
  231. // CHECK:STDOUT: %True.ref.loc13: %True.type = name_ref True, file.%True.decl [template = constants.%True]
  232. // CHECK:STDOUT: %.loc13: ref %C.a14 = splice_block file.%c.var {}
  233. // CHECK:STDOUT: %True.call.loc13: init %C.a14 = call %True.ref.loc13() to %.loc13
  234. // CHECK:STDOUT: assign file.%c.var, %True.call.loc13
  235. // CHECK:STDOUT: %False.ref.loc14: %False.type = name_ref False, file.%False.decl [template = constants.%False]
  236. // CHECK:STDOUT: %.loc14: ref %C.2ba = splice_block file.%d.var {}
  237. // CHECK:STDOUT: %False.call.loc14: init %C.2ba = call %False.ref.loc14() to %.loc14
  238. // CHECK:STDOUT: assign file.%d.var, %False.call.loc14
  239. // CHECK:STDOUT: return
  240. // CHECK:STDOUT: }
  241. // CHECK:STDOUT:
  242. // CHECK:STDOUT: specific @C(constants.%B) {
  243. // CHECK:STDOUT: %B.loc6_9.2 => constants.%B
  244. // CHECK:STDOUT: %B.patt.loc6_9.2 => constants.%B
  245. // CHECK:STDOUT: }
  246. // CHECK:STDOUT:
  247. // CHECK:STDOUT: specific @C(constants.%true) {
  248. // CHECK:STDOUT: %B.loc6_9.2 => constants.%true
  249. // CHECK:STDOUT: %B.patt.loc6_9.2 => constants.%true
  250. // CHECK:STDOUT:
  251. // CHECK:STDOUT: !definition:
  252. // CHECK:STDOUT: }
  253. // CHECK:STDOUT:
  254. // CHECK:STDOUT: specific @C(constants.%false) {
  255. // CHECK:STDOUT: %B.loc6_9.2 => constants.%false
  256. // CHECK:STDOUT: %B.patt.loc6_9.2 => constants.%false
  257. // CHECK:STDOUT:
  258. // CHECK:STDOUT: !definition:
  259. // CHECK:STDOUT: }
  260. // CHECK:STDOUT:
  261. // CHECK:STDOUT: --- prelude.carbon
  262. // CHECK:STDOUT:
  263. // CHECK:STDOUT: constants {
  264. // CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template]
  265. // CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template]
  266. // CHECK:STDOUT: %B: bool = bind_symbolic_name B, 0 [symbolic]
  267. // CHECK:STDOUT: %B.patt: bool = symbolic_binding_pattern B, 0 [symbolic]
  268. // CHECK:STDOUT: %C.type: type = generic_class_type @C [template]
  269. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [template]
  270. // CHECK:STDOUT: %C.342: type = class_type @C, @C(%B) [symbolic]
  271. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  272. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  273. // CHECK:STDOUT: %true: bool = bool_literal true [template]
  274. // CHECK:STDOUT: %C.a14: type = class_type @C, @C(%true) [template]
  275. // CHECK:STDOUT: %True.type: type = fn_type @True [template]
  276. // CHECK:STDOUT: %True: %True.type = struct_value () [template]
  277. // CHECK:STDOUT: %false: bool = bool_literal false [template]
  278. // CHECK:STDOUT: %C.2ba: type = class_type @C, @C(%false) [template]
  279. // CHECK:STDOUT: %False.type: type = fn_type @False [template]
  280. // CHECK:STDOUT: %False: %False.type = struct_value () [template]
  281. // CHECK:STDOUT: %Eq.type: type = facet_type <@Eq> [template]
  282. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (imports.%Core.import_ref.85b, imports.%Core.import_ref.67a) [template]
  283. // CHECK:STDOUT: %NotEqual.type.e6c: type = fn_type @NotEqual.1 [template]
  284. // CHECK:STDOUT: %Eq.facet: %Eq.type = facet_value bool, %impl_witness [template]
  285. // CHECK:STDOUT: %.8b5: type = fn_type_with_self_type %NotEqual.type.e6c, %Eq.facet [template]
  286. // CHECK:STDOUT: %NotEqual.type.c0e: type = fn_type @NotEqual.2 [template]
  287. // CHECK:STDOUT: %NotEqual.bf4: %NotEqual.type.c0e = struct_value () [template]
  288. // CHECK:STDOUT: %NotEqual.bound.542: <bound method> = bound_method %true, %NotEqual.bf4 [template]
  289. // CHECK:STDOUT: %NotEqual.bound.5a9: <bound method> = bound_method %false, %NotEqual.bf4 [template]
  290. // CHECK:STDOUT: }
  291. // CHECK:STDOUT:
  292. // CHECK:STDOUT: imports {
  293. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  294. // CHECK:STDOUT: .Bool = %Core.Bool
  295. // CHECK:STDOUT: .Eq = %Core.Eq
  296. // CHECK:STDOUT: import Core//prelude
  297. // CHECK:STDOUT: import Core//prelude/...
  298. // CHECK:STDOUT: }
  299. // CHECK:STDOUT: }
  300. // CHECK:STDOUT:
  301. // CHECK:STDOUT: file {
  302. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  303. // CHECK:STDOUT: .Core = imports.%Core
  304. // CHECK:STDOUT: .C = %C.decl
  305. // CHECK:STDOUT: .True = %True.decl
  306. // CHECK:STDOUT: .False = %False.decl
  307. // CHECK:STDOUT: .a = %a
  308. // CHECK:STDOUT: .b = %b
  309. // CHECK:STDOUT: .c = %c
  310. // CHECK:STDOUT: .d = %d
  311. // CHECK:STDOUT: }
  312. // CHECK:STDOUT: %Core.import = import Core
  313. // CHECK:STDOUT: %C.decl: %C.type = class_decl @C [template = constants.%C.generic] {
  314. // CHECK:STDOUT: %B.patt.loc4_9.1: bool = symbolic_binding_pattern B, 0 [symbolic = %B.patt.loc4_9.2 (constants.%B.patt)]
  315. // CHECK:STDOUT: %B.param_patt: bool = value_param_pattern %B.patt.loc4_9.1, runtime_param<none> [symbolic = %B.patt.loc4_9.2 (constants.%B.patt)]
  316. // CHECK:STDOUT: } {
  317. // CHECK:STDOUT: %B.param: bool = value_param runtime_param<none>
  318. // CHECK:STDOUT: %.loc4_13.1: type = splice_block %.loc4_13.3 [template = bool] {
  319. // CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool]
  320. // CHECK:STDOUT: %.loc4_13.2: type = value_of_initializer %bool.make_type [template = bool]
  321. // CHECK:STDOUT: %.loc4_13.3: type = converted %bool.make_type, %.loc4_13.2 [template = bool]
  322. // CHECK:STDOUT: }
  323. // CHECK:STDOUT: %B.loc4_9.1: bool = bind_symbolic_name B, 0, %B.param [symbolic = %B.loc4_9.2 (constants.%B)]
  324. // CHECK:STDOUT: }
  325. // CHECK:STDOUT: %True.decl: %True.type = fn_decl @True [template = constants.%True] {
  326. // CHECK:STDOUT: %return.patt: %C.a14 = return_slot_pattern
  327. // CHECK:STDOUT: %return.param_patt: %C.a14 = out_param_pattern %return.patt, runtime_param0
  328. // CHECK:STDOUT: } {
  329. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [template = constants.%C.generic]
  330. // CHECK:STDOUT: %true: bool = bool_literal true [template = constants.%true]
  331. // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%true) [template = constants.%C.a14]
  332. // CHECK:STDOUT: %return.param: ref %C.a14 = out_param runtime_param0
  333. // CHECK:STDOUT: %return: ref %C.a14 = return_slot %return.param
  334. // CHECK:STDOUT: }
  335. // CHECK:STDOUT: %False.decl: %False.type = fn_decl @False [template = constants.%False] {
  336. // CHECK:STDOUT: %return.patt: %C.2ba = return_slot_pattern
  337. // CHECK:STDOUT: %return.param_patt: %C.2ba = out_param_pattern %return.patt, runtime_param0
  338. // CHECK:STDOUT: } {
  339. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [template = constants.%C.generic]
  340. // CHECK:STDOUT: %false: bool = bool_literal false [template = constants.%false]
  341. // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%false) [template = constants.%C.2ba]
  342. // CHECK:STDOUT: %return.param: ref %C.2ba = out_param runtime_param0
  343. // CHECK:STDOUT: %return: ref %C.2ba = return_slot %return.param
  344. // CHECK:STDOUT: }
  345. // CHECK:STDOUT: name_binding_decl {
  346. // CHECK:STDOUT: %a.patt: %C.2ba = binding_pattern a
  347. // CHECK:STDOUT: %.loc9_1: %C.2ba = var_pattern %a.patt
  348. // CHECK:STDOUT: }
  349. // CHECK:STDOUT: %a.var: ref %C.2ba = var a
  350. // CHECK:STDOUT: %.loc9_22.1: type = splice_block %C.loc9 [template = constants.%C.2ba] {
  351. // CHECK:STDOUT: %C.ref.loc9: %C.type = name_ref C, %C.decl [template = constants.%C.generic]
  352. // CHECK:STDOUT: %true.loc9_10: bool = bool_literal true [template = constants.%true]
  353. // CHECK:STDOUT: %true.loc9_18: bool = bool_literal true [template = constants.%true]
  354. // CHECK:STDOUT: %impl.elem1.loc9: %.8b5 = impl_witness_access constants.%impl_witness, element1 [template = constants.%NotEqual.bf4]
  355. // CHECK:STDOUT: %bound_method.loc9: <bound method> = bound_method %true.loc9_10, %impl.elem1.loc9 [template = constants.%NotEqual.bound.542]
  356. // CHECK:STDOUT: %bool.neq.loc9: init bool = call %bound_method.loc9(%true.loc9_10, %true.loc9_18) [template = constants.%false]
  357. // CHECK:STDOUT: %.loc9_22.2: bool = value_of_initializer %bool.neq.loc9 [template = constants.%false]
  358. // CHECK:STDOUT: %.loc9_22.3: bool = converted %bool.neq.loc9, %.loc9_22.2 [template = constants.%false]
  359. // CHECK:STDOUT: %C.loc9: type = class_type @C, @C(constants.%false) [template = constants.%C.2ba]
  360. // CHECK:STDOUT: }
  361. // CHECK:STDOUT: %a: ref %C.2ba = bind_name a, %a.var
  362. // CHECK:STDOUT: name_binding_decl {
  363. // CHECK:STDOUT: %b.patt: %C.a14 = binding_pattern b
  364. // CHECK:STDOUT: %.loc10_1: %C.a14 = var_pattern %b.patt
  365. // CHECK:STDOUT: }
  366. // CHECK:STDOUT: %b.var: ref %C.a14 = var b
  367. // CHECK:STDOUT: %.loc10_23.1: type = splice_block %C.loc10 [template = constants.%C.a14] {
  368. // CHECK:STDOUT: %C.ref.loc10: %C.type = name_ref C, %C.decl [template = constants.%C.generic]
  369. // CHECK:STDOUT: %true.loc10: bool = bool_literal true [template = constants.%true]
  370. // CHECK:STDOUT: %false.loc10: bool = bool_literal false [template = constants.%false]
  371. // CHECK:STDOUT: %impl.elem1.loc10: %.8b5 = impl_witness_access constants.%impl_witness, element1 [template = constants.%NotEqual.bf4]
  372. // CHECK:STDOUT: %bound_method.loc10: <bound method> = bound_method %true.loc10, %impl.elem1.loc10 [template = constants.%NotEqual.bound.542]
  373. // CHECK:STDOUT: %bool.neq.loc10: init bool = call %bound_method.loc10(%true.loc10, %false.loc10) [template = constants.%true]
  374. // CHECK:STDOUT: %.loc10_23.2: bool = value_of_initializer %bool.neq.loc10 [template = constants.%true]
  375. // CHECK:STDOUT: %.loc10_23.3: bool = converted %bool.neq.loc10, %.loc10_23.2 [template = constants.%true]
  376. // CHECK:STDOUT: %C.loc10: type = class_type @C, @C(constants.%true) [template = constants.%C.a14]
  377. // CHECK:STDOUT: }
  378. // CHECK:STDOUT: %b: ref %C.a14 = bind_name b, %b.var
  379. // CHECK:STDOUT: name_binding_decl {
  380. // CHECK:STDOUT: %c.patt: %C.a14 = binding_pattern c
  381. // CHECK:STDOUT: %.loc11_1: %C.a14 = var_pattern %c.patt
  382. // CHECK:STDOUT: }
  383. // CHECK:STDOUT: %c.var: ref %C.a14 = var c
  384. // CHECK:STDOUT: %.loc11_23.1: type = splice_block %C.loc11 [template = constants.%C.a14] {
  385. // CHECK:STDOUT: %C.ref.loc11: %C.type = name_ref C, %C.decl [template = constants.%C.generic]
  386. // CHECK:STDOUT: %false.loc11: bool = bool_literal false [template = constants.%false]
  387. // CHECK:STDOUT: %true.loc11: bool = bool_literal true [template = constants.%true]
  388. // CHECK:STDOUT: %impl.elem1.loc11: %.8b5 = impl_witness_access constants.%impl_witness, element1 [template = constants.%NotEqual.bf4]
  389. // CHECK:STDOUT: %bound_method.loc11: <bound method> = bound_method %false.loc11, %impl.elem1.loc11 [template = constants.%NotEqual.bound.5a9]
  390. // CHECK:STDOUT: %bool.neq.loc11: init bool = call %bound_method.loc11(%false.loc11, %true.loc11) [template = constants.%true]
  391. // CHECK:STDOUT: %.loc11_23.2: bool = value_of_initializer %bool.neq.loc11 [template = constants.%true]
  392. // CHECK:STDOUT: %.loc11_23.3: bool = converted %bool.neq.loc11, %.loc11_23.2 [template = constants.%true]
  393. // CHECK:STDOUT: %C.loc11: type = class_type @C, @C(constants.%true) [template = constants.%C.a14]
  394. // CHECK:STDOUT: }
  395. // CHECK:STDOUT: %c: ref %C.a14 = bind_name c, %c.var
  396. // CHECK:STDOUT: name_binding_decl {
  397. // CHECK:STDOUT: %d.patt: %C.2ba = binding_pattern d
  398. // CHECK:STDOUT: %.loc12_1: %C.2ba = var_pattern %d.patt
  399. // CHECK:STDOUT: }
  400. // CHECK:STDOUT: %d.var: ref %C.2ba = var d
  401. // CHECK:STDOUT: %.loc12_24.1: type = splice_block %C.loc12 [template = constants.%C.2ba] {
  402. // CHECK:STDOUT: %C.ref.loc12: %C.type = name_ref C, %C.decl [template = constants.%C.generic]
  403. // CHECK:STDOUT: %false.loc12_10: bool = bool_literal false [template = constants.%false]
  404. // CHECK:STDOUT: %false.loc12_19: bool = bool_literal false [template = constants.%false]
  405. // CHECK:STDOUT: %impl.elem1.loc12: %.8b5 = impl_witness_access constants.%impl_witness, element1 [template = constants.%NotEqual.bf4]
  406. // CHECK:STDOUT: %bound_method.loc12: <bound method> = bound_method %false.loc12_10, %impl.elem1.loc12 [template = constants.%NotEqual.bound.5a9]
  407. // CHECK:STDOUT: %bool.neq.loc12: init bool = call %bound_method.loc12(%false.loc12_10, %false.loc12_19) [template = constants.%false]
  408. // CHECK:STDOUT: %.loc12_24.2: bool = value_of_initializer %bool.neq.loc12 [template = constants.%false]
  409. // CHECK:STDOUT: %.loc12_24.3: bool = converted %bool.neq.loc12, %.loc12_24.2 [template = constants.%false]
  410. // CHECK:STDOUT: %C.loc12: type = class_type @C, @C(constants.%false) [template = constants.%C.2ba]
  411. // CHECK:STDOUT: }
  412. // CHECK:STDOUT: %d: ref %C.2ba = bind_name d, %d.var
  413. // CHECK:STDOUT: }
  414. // CHECK:STDOUT:
  415. // CHECK:STDOUT: generic class @C(%B.loc4_9.1: bool) {
  416. // CHECK:STDOUT: %B.loc4_9.2: bool = bind_symbolic_name B, 0 [symbolic = %B.loc4_9.2 (constants.%B)]
  417. // CHECK:STDOUT: %B.patt.loc4_9.2: bool = symbolic_binding_pattern B, 0 [symbolic = %B.patt.loc4_9.2 (constants.%B.patt)]
  418. // CHECK:STDOUT:
  419. // CHECK:STDOUT: !definition:
  420. // CHECK:STDOUT:
  421. // CHECK:STDOUT: class {
  422. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  423. // CHECK:STDOUT: complete_type_witness = %complete_type
  424. // CHECK:STDOUT:
  425. // CHECK:STDOUT: !members:
  426. // CHECK:STDOUT: .Self = constants.%C.342
  427. // CHECK:STDOUT: }
  428. // CHECK:STDOUT: }
  429. // CHECK:STDOUT:
  430. // CHECK:STDOUT: fn @True() -> %C.a14;
  431. // CHECK:STDOUT:
  432. // CHECK:STDOUT: fn @False() -> %C.2ba;
  433. // CHECK:STDOUT:
  434. // CHECK:STDOUT: fn @__global_init() {
  435. // CHECK:STDOUT: !entry:
  436. // CHECK:STDOUT: %False.ref.loc9: %False.type = name_ref False, file.%False.decl [template = constants.%False]
  437. // CHECK:STDOUT: %.loc9: ref %C.2ba = splice_block file.%a.var {}
  438. // CHECK:STDOUT: %False.call.loc9: init %C.2ba = call %False.ref.loc9() to %.loc9
  439. // CHECK:STDOUT: assign file.%a.var, %False.call.loc9
  440. // CHECK:STDOUT: %True.ref.loc10: %True.type = name_ref True, file.%True.decl [template = constants.%True]
  441. // CHECK:STDOUT: %.loc10: ref %C.a14 = splice_block file.%b.var {}
  442. // CHECK:STDOUT: %True.call.loc10: init %C.a14 = call %True.ref.loc10() to %.loc10
  443. // CHECK:STDOUT: assign file.%b.var, %True.call.loc10
  444. // CHECK:STDOUT: %True.ref.loc11: %True.type = name_ref True, file.%True.decl [template = constants.%True]
  445. // CHECK:STDOUT: %.loc11: ref %C.a14 = splice_block file.%c.var {}
  446. // CHECK:STDOUT: %True.call.loc11: init %C.a14 = call %True.ref.loc11() to %.loc11
  447. // CHECK:STDOUT: assign file.%c.var, %True.call.loc11
  448. // CHECK:STDOUT: %False.ref.loc12: %False.type = name_ref False, file.%False.decl [template = constants.%False]
  449. // CHECK:STDOUT: %.loc12: ref %C.2ba = splice_block file.%d.var {}
  450. // CHECK:STDOUT: %False.call.loc12: init %C.2ba = call %False.ref.loc12() to %.loc12
  451. // CHECK:STDOUT: assign file.%d.var, %False.call.loc12
  452. // CHECK:STDOUT: return
  453. // CHECK:STDOUT: }
  454. // CHECK:STDOUT:
  455. // CHECK:STDOUT: specific @C(constants.%B) {
  456. // CHECK:STDOUT: %B.loc4_9.2 => constants.%B
  457. // CHECK:STDOUT: %B.patt.loc4_9.2 => constants.%B
  458. // CHECK:STDOUT: }
  459. // CHECK:STDOUT:
  460. // CHECK:STDOUT: specific @C(constants.%true) {
  461. // CHECK:STDOUT: %B.loc4_9.2 => constants.%true
  462. // CHECK:STDOUT: %B.patt.loc4_9.2 => constants.%true
  463. // CHECK:STDOUT:
  464. // CHECK:STDOUT: !definition:
  465. // CHECK:STDOUT: }
  466. // CHECK:STDOUT:
  467. // CHECK:STDOUT: specific @C(constants.%false) {
  468. // CHECK:STDOUT: %B.loc4_9.2 => constants.%false
  469. // CHECK:STDOUT: %B.patt.loc4_9.2 => constants.%false
  470. // CHECK:STDOUT:
  471. // CHECK:STDOUT: !definition:
  472. // CHECK:STDOUT: }
  473. // CHECK:STDOUT: