compile_time_bindings.carbon 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989
  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. // This is mostly checking against crashes for compile time bindings in
  6. // difficult contexts.
  7. //
  8. // AUTOUPDATE
  9. // TIP: To test this file alone, run:
  10. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/let/compile_time_bindings.carbon
  11. // TIP: To dump output, run:
  12. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/let/compile_time_bindings.carbon
  13. // --- fail_let_after.carbon
  14. library "[[@TEST_NAME]]";
  15. class C {
  16. fn F() -> () { return x; }
  17. // CHECK:STDERR: fail_let_after.carbon:[[@LINE+4]]:7: error: semantics TODO: ``let` compile time binding outside function or interface`
  18. // CHECK:STDERR: let x:! () = ();
  19. // CHECK:STDERR: ^~~~~~
  20. // CHECK:STDERR:
  21. let x:! () = ();
  22. }
  23. // --- fail_let_before.carbon
  24. library "[[@TEST_NAME]]";
  25. class C {
  26. // CHECK:STDERR: fail_let_before.carbon:[[@LINE+4]]:7: error: semantics TODO: ``let` compile time binding outside function or interface`
  27. // CHECK:STDERR: let x:! () = ();
  28. // CHECK:STDERR: ^~~~~~
  29. // CHECK:STDERR:
  30. let x:! () = ();
  31. fn F() -> () { return x; }
  32. }
  33. // --- fail_multiple_lets.carbon
  34. library "[[@TEST_NAME]]";
  35. class C {
  36. // CHECK:STDERR: fail_multiple_lets.carbon:[[@LINE+4]]:7: error: semantics TODO: ``let` compile time binding outside function or interface`
  37. // CHECK:STDERR: let a:! () = ();
  38. // CHECK:STDERR: ^~~~~~
  39. // CHECK:STDERR:
  40. let a:! () = ();
  41. fn F(b:! ((),)) {
  42. let c:! ((), ()) = ((), ());
  43. var a1: () = a;
  44. var b1: ((),) = b;
  45. var c1: ((), ()) = c;
  46. var d1: ((), (), ()) = d;
  47. }
  48. // CHECK:STDERR: fail_multiple_lets.carbon:[[@LINE+4]]:7: error: semantics TODO: ``let` compile time binding outside function or interface`
  49. // CHECK:STDERR: let d:! ((), (), ()) = ((), (), ());
  50. // CHECK:STDERR: ^~~~~~~~~~~~~~~~
  51. // CHECK:STDERR:
  52. let d:! ((), (), ()) = ((), (), ());
  53. }
  54. // --- fail_invalid_let_after.carbon
  55. library "[[@TEST_NAME]]";
  56. class C {
  57. fn F() -> () { return x; }
  58. // CHECK:STDERR: fail_invalid_let_after.carbon:[[@LINE+8]]:7: error: semantics TODO: ``let` compile time binding outside function or interface`
  59. // CHECK:STDERR: let x:! ();
  60. // CHECK:STDERR: ^~~~~~
  61. // CHECK:STDERR:
  62. // CHECK:STDERR: fail_invalid_let_after.carbon:[[@LINE+4]]:13: error: expected `=`; `let` declaration must have an initializer
  63. // CHECK:STDERR: let x:! ();
  64. // CHECK:STDERR: ^
  65. // CHECK:STDERR:
  66. let x:! ();
  67. }
  68. // --- use_in_function.carbon
  69. library "[[@TEST_NAME]]";
  70. fn F() -> i32 {
  71. let Zero:! i32 = 0;
  72. return Zero;
  73. }
  74. // --- use_in_block.carbon
  75. library "[[@TEST_NAME]]";
  76. fn F() -> i32 {
  77. if (true) {
  78. let Zero:! i32 = 0;
  79. return Zero;
  80. }
  81. return 1;
  82. }
  83. // --- fail_return_in_interface.carbon
  84. library "[[@TEST_NAME]]";
  85. interface I {
  86. let T:! type = i32;
  87. // CHECK:STDERR: fail_return_in_interface.carbon:[[@LINE+7]]:13: error: cannot implicitly convert from `<associated type in I>` to `type`
  88. // CHECK:STDERR: fn F() -> T;
  89. // CHECK:STDERR: ^
  90. // CHECK:STDERR: fail_return_in_interface.carbon:[[@LINE+4]]:13: note: type `<associated type in I>` does not implement interface `ImplicitAs`
  91. // CHECK:STDERR: fn F() -> T;
  92. // CHECK:STDERR: ^
  93. // CHECK:STDERR:
  94. fn F() -> T;
  95. }
  96. // --- fail_return_in_class.carbon
  97. library "[[@TEST_NAME]]";
  98. class I {
  99. // CHECK:STDERR: fail_return_in_class.carbon:[[@LINE+4]]:7: error: semantics TODO: ``let` compile time binding outside function or interface`
  100. // CHECK:STDERR: let T:! type = i32;
  101. // CHECK:STDERR: ^~~~~~~~
  102. // CHECK:STDERR:
  103. let T:! type = i32;
  104. // CHECK:STDERR: fail_return_in_class.carbon:[[@LINE+4]]:13: error: cannot evaluate type expression
  105. // CHECK:STDERR: fn F() -> T;
  106. // CHECK:STDERR: ^
  107. // CHECK:STDERR:
  108. fn F() -> T;
  109. }
  110. // --- fail_return_in_package_scope.carbon
  111. library "[[@TEST_NAME]]";
  112. // CHECK:STDERR: fail_return_in_package_scope.carbon:[[@LINE+4]]:5: error: semantics TODO: ``let` compile time binding outside function or interface`
  113. // CHECK:STDERR: let T:! type = i32;
  114. // CHECK:STDERR: ^~~~~~~~
  115. // CHECK:STDERR:
  116. let T:! type = i32;
  117. // CHECK:STDERR: fail_return_in_package_scope.carbon:[[@LINE+4]]:11: error: cannot evaluate type expression
  118. // CHECK:STDERR: fn F() -> T;
  119. // CHECK:STDERR: ^
  120. // CHECK:STDERR:
  121. fn F() -> T;
  122. // --- fail_use_in_impl.carbon
  123. library "[[@TEST_NAME]]";
  124. interface Empty {}
  125. impl i32 as Empty {
  126. // CHECK:STDERR: fail_use_in_impl.carbon:[[@LINE+3]]:7: error: semantics TODO: ``let` compile time binding outside function or interface`
  127. // CHECK:STDERR: let Zero:! i32 = 0;
  128. // CHECK:STDERR: ^~~~~~~~~~
  129. let Zero:! i32 = 0;
  130. }
  131. // CHECK:STDOUT: --- fail_let_after.carbon
  132. // CHECK:STDOUT:
  133. // CHECK:STDOUT: constants {
  134. // CHECK:STDOUT: %C: type = class_type @C [template]
  135. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  136. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  137. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  138. // CHECK:STDOUT: %tuple: %.1 = tuple_value () [template]
  139. // CHECK:STDOUT: %.2: type = struct_type {} [template]
  140. // CHECK:STDOUT: %.3: <witness> = complete_type_witness %.2 [template]
  141. // CHECK:STDOUT: }
  142. // CHECK:STDOUT:
  143. // CHECK:STDOUT: imports {
  144. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  145. // CHECK:STDOUT: import Core//prelude
  146. // CHECK:STDOUT: import Core//prelude/operators
  147. // CHECK:STDOUT: import Core//prelude/types
  148. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  149. // CHECK:STDOUT: import Core//prelude/operators/as
  150. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  151. // CHECK:STDOUT: import Core//prelude/operators/comparison
  152. // CHECK:STDOUT: import Core//prelude/types/bool
  153. // CHECK:STDOUT: }
  154. // CHECK:STDOUT: }
  155. // CHECK:STDOUT:
  156. // CHECK:STDOUT: file {
  157. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  158. // CHECK:STDOUT: .Core = imports.%Core
  159. // CHECK:STDOUT: .C = %C.decl
  160. // CHECK:STDOUT: }
  161. // CHECK:STDOUT: %Core.import = import Core
  162. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  163. // CHECK:STDOUT: }
  164. // CHECK:STDOUT:
  165. // CHECK:STDOUT: class @C {
  166. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {
  167. // CHECK:STDOUT: %.loc5_14.1: %.1 = tuple_literal ()
  168. // CHECK:STDOUT: %.loc5_14.2: type = converted %.loc5_14.1, constants.%.1 [template = constants.%.1]
  169. // CHECK:STDOUT: %return: ref %.1 = var <return slot>
  170. // CHECK:STDOUT: }
  171. // CHECK:STDOUT: %.loc10_12.1: %.1 = tuple_literal ()
  172. // CHECK:STDOUT: %.loc10_12.2: type = converted %.loc10_12.1, constants.%.1 [template = constants.%.1]
  173. // CHECK:STDOUT: %.loc10_17: %.1 = tuple_literal ()
  174. // CHECK:STDOUT: %tuple: %.1 = tuple_value () [template = constants.%tuple]
  175. // CHECK:STDOUT: %.loc10_18: %.1 = converted %.loc10_17, %tuple [template = constants.%tuple]
  176. // CHECK:STDOUT: %x: %.1 = bind_name x, %.loc10_18
  177. // CHECK:STDOUT: %.loc11: <witness> = complete_type_witness %.2 [template = constants.%.3]
  178. // CHECK:STDOUT:
  179. // CHECK:STDOUT: !members:
  180. // CHECK:STDOUT: .Self = constants.%C
  181. // CHECK:STDOUT: .F = %F.decl
  182. // CHECK:STDOUT: .x = %x
  183. // CHECK:STDOUT: }
  184. // CHECK:STDOUT:
  185. // CHECK:STDOUT: fn @F() -> %.1 {
  186. // CHECK:STDOUT: !entry:
  187. // CHECK:STDOUT: %x.ref: %.1 = name_ref x, @C.%x
  188. // CHECK:STDOUT: return %x.ref
  189. // CHECK:STDOUT: }
  190. // CHECK:STDOUT:
  191. // CHECK:STDOUT: --- fail_let_before.carbon
  192. // CHECK:STDOUT:
  193. // CHECK:STDOUT: constants {
  194. // CHECK:STDOUT: %C: type = class_type @C [template]
  195. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  196. // CHECK:STDOUT: %tuple: %.1 = tuple_value () [template]
  197. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  198. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  199. // CHECK:STDOUT: %.2: type = struct_type {} [template]
  200. // CHECK:STDOUT: %.3: <witness> = complete_type_witness %.2 [template]
  201. // CHECK:STDOUT: }
  202. // CHECK:STDOUT:
  203. // CHECK:STDOUT: imports {
  204. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  205. // CHECK:STDOUT: import Core//prelude
  206. // CHECK:STDOUT: import Core//prelude/operators
  207. // CHECK:STDOUT: import Core//prelude/types
  208. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  209. // CHECK:STDOUT: import Core//prelude/operators/as
  210. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  211. // CHECK:STDOUT: import Core//prelude/operators/comparison
  212. // CHECK:STDOUT: import Core//prelude/types/bool
  213. // CHECK:STDOUT: }
  214. // CHECK:STDOUT: }
  215. // CHECK:STDOUT:
  216. // CHECK:STDOUT: file {
  217. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  218. // CHECK:STDOUT: .Core = imports.%Core
  219. // CHECK:STDOUT: .C = %C.decl
  220. // CHECK:STDOUT: }
  221. // CHECK:STDOUT: %Core.import = import Core
  222. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  223. // CHECK:STDOUT: }
  224. // CHECK:STDOUT:
  225. // CHECK:STDOUT: class @C {
  226. // CHECK:STDOUT: %.loc9_12.1: %.1 = tuple_literal ()
  227. // CHECK:STDOUT: %.loc9_12.2: type = converted %.loc9_12.1, constants.%.1 [template = constants.%.1]
  228. // CHECK:STDOUT: %.loc9_17: %.1 = tuple_literal ()
  229. // CHECK:STDOUT: %tuple: %.1 = tuple_value () [template = constants.%tuple]
  230. // CHECK:STDOUT: %.loc9_18: %.1 = converted %.loc9_17, %tuple [template = constants.%tuple]
  231. // CHECK:STDOUT: %x: %.1 = bind_name x, %.loc9_18
  232. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {
  233. // CHECK:STDOUT: %.loc10_14.1: %.1 = tuple_literal ()
  234. // CHECK:STDOUT: %.loc10_14.2: type = converted %.loc10_14.1, constants.%.1 [template = constants.%.1]
  235. // CHECK:STDOUT: %return: ref %.1 = var <return slot>
  236. // CHECK:STDOUT: }
  237. // CHECK:STDOUT: %.loc11: <witness> = complete_type_witness %.2 [template = constants.%.3]
  238. // CHECK:STDOUT:
  239. // CHECK:STDOUT: !members:
  240. // CHECK:STDOUT: .Self = constants.%C
  241. // CHECK:STDOUT: .x = %x
  242. // CHECK:STDOUT: .F = %F.decl
  243. // CHECK:STDOUT: }
  244. // CHECK:STDOUT:
  245. // CHECK:STDOUT: fn @F() -> %.1 {
  246. // CHECK:STDOUT: !entry:
  247. // CHECK:STDOUT: %x.ref: %.1 = name_ref x, @C.%x
  248. // CHECK:STDOUT: return %x.ref
  249. // CHECK:STDOUT: }
  250. // CHECK:STDOUT:
  251. // CHECK:STDOUT: --- fail_multiple_lets.carbon
  252. // CHECK:STDOUT:
  253. // CHECK:STDOUT: constants {
  254. // CHECK:STDOUT: %C: type = class_type @C [template]
  255. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  256. // CHECK:STDOUT: %tuple.1: %.1 = tuple_value () [template]
  257. // CHECK:STDOUT: %.2: type = tuple_type (%.1) [template]
  258. // CHECK:STDOUT: %b: %.2 = bind_symbolic_name b, 0 [symbolic]
  259. // CHECK:STDOUT: %b.patt: %.2 = symbolic_binding_pattern b, 0 [symbolic]
  260. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  261. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  262. // CHECK:STDOUT: %.3: type = tuple_type (%.1, %.1, %.1) [template]
  263. // CHECK:STDOUT: %.4: type = ptr_type %.3 [template]
  264. // CHECK:STDOUT: %tuple.2: %.3 = tuple_value (%tuple.1, %tuple.1, %tuple.1) [template]
  265. // CHECK:STDOUT: %.5: type = struct_type {} [template]
  266. // CHECK:STDOUT: %.6: <witness> = complete_type_witness %.5 [template]
  267. // CHECK:STDOUT: %.7: type = tuple_type (%.1, %.1) [template]
  268. // CHECK:STDOUT: %.8: type = ptr_type %.7 [template]
  269. // CHECK:STDOUT: %tuple.3: %.7 = tuple_value (%tuple.1, %tuple.1) [template]
  270. // CHECK:STDOUT: %c: %.7 = bind_symbolic_name c, 1 [symbolic]
  271. // CHECK:STDOUT: %tuple.4: %.2 = tuple_value (%tuple.1) [template]
  272. // CHECK:STDOUT: }
  273. // CHECK:STDOUT:
  274. // CHECK:STDOUT: imports {
  275. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  276. // CHECK:STDOUT: import Core//prelude
  277. // CHECK:STDOUT: import Core//prelude/operators
  278. // CHECK:STDOUT: import Core//prelude/types
  279. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  280. // CHECK:STDOUT: import Core//prelude/operators/as
  281. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  282. // CHECK:STDOUT: import Core//prelude/operators/comparison
  283. // CHECK:STDOUT: import Core//prelude/types/bool
  284. // CHECK:STDOUT: }
  285. // CHECK:STDOUT: }
  286. // CHECK:STDOUT:
  287. // CHECK:STDOUT: file {
  288. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  289. // CHECK:STDOUT: .Core = imports.%Core
  290. // CHECK:STDOUT: .C = %C.decl
  291. // CHECK:STDOUT: }
  292. // CHECK:STDOUT: %Core.import = import Core
  293. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  294. // CHECK:STDOUT: }
  295. // CHECK:STDOUT:
  296. // CHECK:STDOUT: class @C {
  297. // CHECK:STDOUT: %.loc9_12.1: %.1 = tuple_literal ()
  298. // CHECK:STDOUT: %.loc9_12.2: type = converted %.loc9_12.1, constants.%.1 [template = constants.%.1]
  299. // CHECK:STDOUT: %.loc9_17: %.1 = tuple_literal ()
  300. // CHECK:STDOUT: %tuple.loc9: %.1 = tuple_value () [template = constants.%tuple.1]
  301. // CHECK:STDOUT: %.loc9_18: %.1 = converted %.loc9_17, %tuple.loc9 [template = constants.%tuple.1]
  302. // CHECK:STDOUT: %a: %.1 = bind_name a, %.loc9_18
  303. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
  304. // CHECK:STDOUT: %b.patt.loc10_8.2: %.2 = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc10_8.1 (constants.%b.patt)]
  305. // CHECK:STDOUT: %b.param_patt: %.2 = param_pattern %b.patt.loc10_8.2, runtime_param<invalid> [symbolic = %b.patt.loc10_8.1 (constants.%b.patt)]
  306. // CHECK:STDOUT: } {
  307. // CHECK:STDOUT: %.loc10_14: %.1 = tuple_literal ()
  308. // CHECK:STDOUT: %.loc10_16.1: %.2 = tuple_literal (%.loc10_14)
  309. // CHECK:STDOUT: %.loc10_16.2: type = converted %.loc10_14, constants.%.1 [template = constants.%.1]
  310. // CHECK:STDOUT: %.loc10_16.3: type = converted %.loc10_16.1, constants.%.2 [template = constants.%.2]
  311. // CHECK:STDOUT: %param: %.2 = param runtime_param<invalid>
  312. // CHECK:STDOUT: %b.loc10_8.2: %.2 = bind_symbolic_name b, 0, %param [symbolic = %b.loc10_8.1 (constants.%b)]
  313. // CHECK:STDOUT: }
  314. // CHECK:STDOUT: %.loc22_13: %.1 = tuple_literal ()
  315. // CHECK:STDOUT: %.loc22_17: %.1 = tuple_literal ()
  316. // CHECK:STDOUT: %.loc22_21: %.1 = tuple_literal ()
  317. // CHECK:STDOUT: %.loc22_22.1: %.3 = tuple_literal (%.loc22_13, %.loc22_17, %.loc22_21)
  318. // CHECK:STDOUT: %.loc22_22.2: type = converted %.loc22_13, constants.%.1 [template = constants.%.1]
  319. // CHECK:STDOUT: %.loc22_22.3: type = converted %.loc22_17, constants.%.1 [template = constants.%.1]
  320. // CHECK:STDOUT: %.loc22_22.4: type = converted %.loc22_21, constants.%.1 [template = constants.%.1]
  321. // CHECK:STDOUT: %.loc22_22.5: type = converted %.loc22_22.1, constants.%.3 [template = constants.%.3]
  322. // CHECK:STDOUT: %.loc22_28: %.1 = tuple_literal ()
  323. // CHECK:STDOUT: %.loc22_32: %.1 = tuple_literal ()
  324. // CHECK:STDOUT: %.loc22_36: %.1 = tuple_literal ()
  325. // CHECK:STDOUT: %.loc22_37.1: %.3 = tuple_literal (%.loc22_28, %.loc22_32, %.loc22_36)
  326. // CHECK:STDOUT: %tuple.loc22_28: %.1 = tuple_value () [template = constants.%tuple.1]
  327. // CHECK:STDOUT: %.loc22_37.2: %.1 = converted %.loc22_28, %tuple.loc22_28 [template = constants.%tuple.1]
  328. // CHECK:STDOUT: %tuple.loc22_32: %.1 = tuple_value () [template = constants.%tuple.1]
  329. // CHECK:STDOUT: %.loc22_37.3: %.1 = converted %.loc22_32, %tuple.loc22_32 [template = constants.%tuple.1]
  330. // CHECK:STDOUT: %tuple.loc22_36: %.1 = tuple_value () [template = constants.%tuple.1]
  331. // CHECK:STDOUT: %.loc22_37.4: %.1 = converted %.loc22_36, %tuple.loc22_36 [template = constants.%tuple.1]
  332. // CHECK:STDOUT: %tuple.loc22_37: %.3 = tuple_value (%.loc22_37.2, %.loc22_37.3, %.loc22_37.4) [template = constants.%tuple.2]
  333. // CHECK:STDOUT: %.loc22_38: %.3 = converted %.loc22_37.1, %tuple.loc22_37 [template = constants.%tuple.2]
  334. // CHECK:STDOUT: %d: %.3 = bind_name d, %.loc22_38
  335. // CHECK:STDOUT: %.loc23: <witness> = complete_type_witness %.5 [template = constants.%.6]
  336. // CHECK:STDOUT:
  337. // CHECK:STDOUT: !members:
  338. // CHECK:STDOUT: .Self = constants.%C
  339. // CHECK:STDOUT: .a = %a
  340. // CHECK:STDOUT: .F = %F.decl
  341. // CHECK:STDOUT: .d = %d
  342. // CHECK:STDOUT: }
  343. // CHECK:STDOUT:
  344. // CHECK:STDOUT: generic fn @F(%b.loc10_8.2: %.2) {
  345. // CHECK:STDOUT: %b.loc10_8.1: %.2 = bind_symbolic_name b, 0 [symbolic = %b.loc10_8.1 (constants.%b)]
  346. // CHECK:STDOUT: %b.patt.loc10_8.1: %.2 = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc10_8.1 (constants.%b.patt)]
  347. // CHECK:STDOUT:
  348. // CHECK:STDOUT: !definition:
  349. // CHECK:STDOUT: %c.loc11_9.2: %.7 = bind_symbolic_name c, 1 [symbolic = %c.loc11_9.2 (constants.%c)]
  350. // CHECK:STDOUT:
  351. // CHECK:STDOUT: fn(%b.param_patt: %.2) {
  352. // CHECK:STDOUT: !entry:
  353. // CHECK:STDOUT: %.loc11_15: %.1 = tuple_literal ()
  354. // CHECK:STDOUT: %.loc11_19: %.1 = tuple_literal ()
  355. // CHECK:STDOUT: %.loc11_20.1: %.7 = tuple_literal (%.loc11_15, %.loc11_19)
  356. // CHECK:STDOUT: %.loc11_20.2: type = converted %.loc11_15, constants.%.1 [template = constants.%.1]
  357. // CHECK:STDOUT: %.loc11_20.3: type = converted %.loc11_19, constants.%.1 [template = constants.%.1]
  358. // CHECK:STDOUT: %.loc11_20.4: type = converted %.loc11_20.1, constants.%.7 [template = constants.%.7]
  359. // CHECK:STDOUT: %.loc11_26: %.1 = tuple_literal ()
  360. // CHECK:STDOUT: %.loc11_30: %.1 = tuple_literal ()
  361. // CHECK:STDOUT: %.loc11_31.1: %.7 = tuple_literal (%.loc11_26, %.loc11_30)
  362. // CHECK:STDOUT: %tuple.loc11_26: %.1 = tuple_value () [template = constants.%tuple.1]
  363. // CHECK:STDOUT: %.loc11_31.2: %.1 = converted %.loc11_26, %tuple.loc11_26 [template = constants.%tuple.1]
  364. // CHECK:STDOUT: %tuple.loc11_30: %.1 = tuple_value () [template = constants.%tuple.1]
  365. // CHECK:STDOUT: %.loc11_31.3: %.1 = converted %.loc11_30, %tuple.loc11_30 [template = constants.%tuple.1]
  366. // CHECK:STDOUT: %tuple.loc11_31: %.7 = tuple_value (%.loc11_31.2, %.loc11_31.3) [template = constants.%tuple.3]
  367. // CHECK:STDOUT: %.loc11_32: %.7 = converted %.loc11_31.1, %tuple.loc11_31 [template = constants.%tuple.3]
  368. // CHECK:STDOUT: %c.loc11_9.1: %.7 = bind_symbolic_name c, 1, %.loc11_32 [symbolic = %c.loc11_9.2 (constants.%c)]
  369. // CHECK:STDOUT: %.loc13_14.1: %.1 = tuple_literal ()
  370. // CHECK:STDOUT: %.loc13_14.2: type = converted %.loc13_14.1, constants.%.1 [template = constants.%.1]
  371. // CHECK:STDOUT: %a1.var: ref %.1 = var a1
  372. // CHECK:STDOUT: %a1: ref %.1 = bind_name a1, %a1.var
  373. // CHECK:STDOUT: %a.ref: %.1 = name_ref a, @C.%a
  374. // CHECK:STDOUT: %.loc13_18: init %.1 = tuple_init () to %a1.var [template = constants.%tuple.1]
  375. // CHECK:STDOUT: %.loc13_19: init %.1 = converted %a.ref, %.loc13_18 [template = constants.%tuple.1]
  376. // CHECK:STDOUT: assign %a1.var, %.loc13_19
  377. // CHECK:STDOUT: %.loc14_15: %.1 = tuple_literal ()
  378. // CHECK:STDOUT: %.loc14_17.1: %.2 = tuple_literal (%.loc14_15)
  379. // CHECK:STDOUT: %.loc14_17.2: type = converted %.loc14_15, constants.%.1 [template = constants.%.1]
  380. // CHECK:STDOUT: %.loc14_17.3: type = converted %.loc14_17.1, constants.%.2 [template = constants.%.2]
  381. // CHECK:STDOUT: %b1.var: ref %.2 = var b1
  382. // CHECK:STDOUT: %b1: ref %.2 = bind_name b1, %b1.var
  383. // CHECK:STDOUT: %b.ref: %.2 = name_ref b, %b.loc10_8.2 [symbolic = %b.loc10_8.1 (constants.%b)]
  384. // CHECK:STDOUT: %.loc14_21.1: %.1 = tuple_access %b.ref, element0
  385. // CHECK:STDOUT: %.loc14_21.2: ref %.1 = tuple_access %b1.var, element0
  386. // CHECK:STDOUT: %.loc14_21.3: init %.1 = tuple_init () to %.loc14_21.2 [template = constants.%tuple.1]
  387. // CHECK:STDOUT: %.loc14_21.4: init %.1 = converted %.loc14_21.1, %.loc14_21.3 [template = constants.%tuple.1]
  388. // CHECK:STDOUT: %.loc14_21.5: init %.2 = tuple_init (%.loc14_21.4) to %b1.var [template = constants.%tuple.4]
  389. // CHECK:STDOUT: %.loc14_22: init %.2 = converted %b.ref, %.loc14_21.5 [template = constants.%tuple.4]
  390. // CHECK:STDOUT: assign %b1.var, %.loc14_22
  391. // CHECK:STDOUT: %.loc15_15: %.1 = tuple_literal ()
  392. // CHECK:STDOUT: %.loc15_19: %.1 = tuple_literal ()
  393. // CHECK:STDOUT: %.loc15_20.1: %.7 = tuple_literal (%.loc15_15, %.loc15_19)
  394. // CHECK:STDOUT: %.loc15_20.2: type = converted %.loc15_15, constants.%.1 [template = constants.%.1]
  395. // CHECK:STDOUT: %.loc15_20.3: type = converted %.loc15_19, constants.%.1 [template = constants.%.1]
  396. // CHECK:STDOUT: %.loc15_20.4: type = converted %.loc15_20.1, constants.%.7 [template = constants.%.7]
  397. // CHECK:STDOUT: %c1.var: ref %.7 = var c1
  398. // CHECK:STDOUT: %c1: ref %.7 = bind_name c1, %c1.var
  399. // CHECK:STDOUT: %c.ref: %.7 = name_ref c, %c.loc11_9.1 [symbolic = %c.loc11_9.2 (constants.%c)]
  400. // CHECK:STDOUT: %.loc15_24.1: %.1 = tuple_access %c.ref, element0
  401. // CHECK:STDOUT: %.loc15_24.2: ref %.1 = tuple_access %c1.var, element0
  402. // CHECK:STDOUT: %.loc15_24.3: init %.1 = tuple_init () to %.loc15_24.2 [template = constants.%tuple.1]
  403. // CHECK:STDOUT: %.loc15_24.4: init %.1 = converted %.loc15_24.1, %.loc15_24.3 [template = constants.%tuple.1]
  404. // CHECK:STDOUT: %.loc15_24.5: %.1 = tuple_access %c.ref, element1
  405. // CHECK:STDOUT: %.loc15_24.6: ref %.1 = tuple_access %c1.var, element1
  406. // CHECK:STDOUT: %.loc15_24.7: init %.1 = tuple_init () to %.loc15_24.6 [template = constants.%tuple.1]
  407. // CHECK:STDOUT: %.loc15_24.8: init %.1 = converted %.loc15_24.5, %.loc15_24.7 [template = constants.%tuple.1]
  408. // CHECK:STDOUT: %.loc15_24.9: init %.7 = tuple_init (%.loc15_24.4, %.loc15_24.8) to %c1.var [template = constants.%tuple.3]
  409. // CHECK:STDOUT: %.loc15_25: init %.7 = converted %c.ref, %.loc15_24.9 [template = constants.%tuple.3]
  410. // CHECK:STDOUT: assign %c1.var, %.loc15_25
  411. // CHECK:STDOUT: %.loc16_15: %.1 = tuple_literal ()
  412. // CHECK:STDOUT: %.loc16_19: %.1 = tuple_literal ()
  413. // CHECK:STDOUT: %.loc16_23: %.1 = tuple_literal ()
  414. // CHECK:STDOUT: %.loc16_24.1: %.3 = tuple_literal (%.loc16_15, %.loc16_19, %.loc16_23)
  415. // CHECK:STDOUT: %.loc16_24.2: type = converted %.loc16_15, constants.%.1 [template = constants.%.1]
  416. // CHECK:STDOUT: %.loc16_24.3: type = converted %.loc16_19, constants.%.1 [template = constants.%.1]
  417. // CHECK:STDOUT: %.loc16_24.4: type = converted %.loc16_23, constants.%.1 [template = constants.%.1]
  418. // CHECK:STDOUT: %.loc16_24.5: type = converted %.loc16_24.1, constants.%.3 [template = constants.%.3]
  419. // CHECK:STDOUT: %d1.var: ref %.3 = var d1
  420. // CHECK:STDOUT: %d1: ref %.3 = bind_name d1, %d1.var
  421. // CHECK:STDOUT: %d.ref: %.3 = name_ref d, @C.%d
  422. // CHECK:STDOUT: %.loc16_28.1: %.1 = tuple_access %d.ref, element0
  423. // CHECK:STDOUT: %.loc16_28.2: ref %.1 = tuple_access %d1.var, element0
  424. // CHECK:STDOUT: %.loc16_28.3: init %.1 = tuple_init () to %.loc16_28.2 [template = constants.%tuple.1]
  425. // CHECK:STDOUT: %.loc16_28.4: init %.1 = converted %.loc16_28.1, %.loc16_28.3 [template = constants.%tuple.1]
  426. // CHECK:STDOUT: %.loc16_28.5: %.1 = tuple_access %d.ref, element1
  427. // CHECK:STDOUT: %.loc16_28.6: ref %.1 = tuple_access %d1.var, element1
  428. // CHECK:STDOUT: %.loc16_28.7: init %.1 = tuple_init () to %.loc16_28.6 [template = constants.%tuple.1]
  429. // CHECK:STDOUT: %.loc16_28.8: init %.1 = converted %.loc16_28.5, %.loc16_28.7 [template = constants.%tuple.1]
  430. // CHECK:STDOUT: %.loc16_28.9: %.1 = tuple_access %d.ref, element2
  431. // CHECK:STDOUT: %.loc16_28.10: ref %.1 = tuple_access %d1.var, element2
  432. // CHECK:STDOUT: %.loc16_28.11: init %.1 = tuple_init () to %.loc16_28.10 [template = constants.%tuple.1]
  433. // CHECK:STDOUT: %.loc16_28.12: init %.1 = converted %.loc16_28.9, %.loc16_28.11 [template = constants.%tuple.1]
  434. // CHECK:STDOUT: %.loc16_28.13: init %.3 = tuple_init (%.loc16_28.4, %.loc16_28.8, %.loc16_28.12) to %d1.var [template = constants.%tuple.2]
  435. // CHECK:STDOUT: %.loc16_29: init %.3 = converted %d.ref, %.loc16_28.13 [template = constants.%tuple.2]
  436. // CHECK:STDOUT: assign %d1.var, %.loc16_29
  437. // CHECK:STDOUT: return
  438. // CHECK:STDOUT: }
  439. // CHECK:STDOUT: }
  440. // CHECK:STDOUT:
  441. // CHECK:STDOUT: specific @F(constants.%b) {
  442. // CHECK:STDOUT: %b.loc10_8.1 => constants.%b
  443. // CHECK:STDOUT: %b.patt.loc10_8.1 => constants.%b
  444. // CHECK:STDOUT: }
  445. // CHECK:STDOUT:
  446. // CHECK:STDOUT: --- fail_invalid_let_after.carbon
  447. // CHECK:STDOUT:
  448. // CHECK:STDOUT: constants {
  449. // CHECK:STDOUT: %C: type = class_type @C [template]
  450. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  451. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  452. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  453. // CHECK:STDOUT: %.2: type = struct_type {} [template]
  454. // CHECK:STDOUT: %.3: <witness> = complete_type_witness %.2 [template]
  455. // CHECK:STDOUT: %tuple: %.1 = tuple_value () [template]
  456. // CHECK:STDOUT: }
  457. // CHECK:STDOUT:
  458. // CHECK:STDOUT: imports {
  459. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  460. // CHECK:STDOUT: import Core//prelude
  461. // CHECK:STDOUT: import Core//prelude/operators
  462. // CHECK:STDOUT: import Core//prelude/types
  463. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  464. // CHECK:STDOUT: import Core//prelude/operators/as
  465. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  466. // CHECK:STDOUT: import Core//prelude/operators/comparison
  467. // CHECK:STDOUT: import Core//prelude/types/bool
  468. // CHECK:STDOUT: }
  469. // CHECK:STDOUT: }
  470. // CHECK:STDOUT:
  471. // CHECK:STDOUT: file {
  472. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  473. // CHECK:STDOUT: .Core = imports.%Core
  474. // CHECK:STDOUT: .C = %C.decl
  475. // CHECK:STDOUT: }
  476. // CHECK:STDOUT: %Core.import = import Core
  477. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  478. // CHECK:STDOUT: }
  479. // CHECK:STDOUT:
  480. // CHECK:STDOUT: class @C {
  481. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {
  482. // CHECK:STDOUT: %.loc5_14.1: %.1 = tuple_literal ()
  483. // CHECK:STDOUT: %.loc5_14.2: type = converted %.loc5_14.1, constants.%.1 [template = constants.%.1]
  484. // CHECK:STDOUT: %return: ref %.1 = var <return slot>
  485. // CHECK:STDOUT: }
  486. // CHECK:STDOUT: %.loc14_12.1: %.1 = tuple_literal ()
  487. // CHECK:STDOUT: %.loc14_12.2: type = converted %.loc14_12.1, constants.%.1 [template = constants.%.1]
  488. // CHECK:STDOUT: %x: %.1 = bind_name x, <error>
  489. // CHECK:STDOUT: %.loc15: <witness> = complete_type_witness %.2 [template = constants.%.3]
  490. // CHECK:STDOUT:
  491. // CHECK:STDOUT: !members:
  492. // CHECK:STDOUT: .Self = constants.%C
  493. // CHECK:STDOUT: .F = %F.decl
  494. // CHECK:STDOUT: .x = %x
  495. // CHECK:STDOUT: }
  496. // CHECK:STDOUT:
  497. // CHECK:STDOUT: fn @F() -> %.1 {
  498. // CHECK:STDOUT: !entry:
  499. // CHECK:STDOUT: %x.ref: %.1 = name_ref x, @C.%x
  500. // CHECK:STDOUT: %tuple: %.1 = tuple_value () [template = constants.%tuple]
  501. // CHECK:STDOUT: %.loc5_26: %.1 = converted %x.ref, %tuple [template = constants.%tuple]
  502. // CHECK:STDOUT: return %.loc5_26
  503. // CHECK:STDOUT: }
  504. // CHECK:STDOUT:
  505. // CHECK:STDOUT: --- use_in_function.carbon
  506. // CHECK:STDOUT:
  507. // CHECK:STDOUT: constants {
  508. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  509. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  510. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  511. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  512. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  513. // CHECK:STDOUT: %.2: i32 = int_literal 0 [template]
  514. // CHECK:STDOUT: %Zero: i32 = bind_symbolic_name Zero, 0 [symbolic]
  515. // CHECK:STDOUT: }
  516. // CHECK:STDOUT:
  517. // CHECK:STDOUT: imports {
  518. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  519. // CHECK:STDOUT: .Int32 = %import_ref
  520. // CHECK:STDOUT: import Core//prelude
  521. // CHECK:STDOUT: import Core//prelude/operators
  522. // CHECK:STDOUT: import Core//prelude/types
  523. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  524. // CHECK:STDOUT: import Core//prelude/operators/as
  525. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  526. // CHECK:STDOUT: import Core//prelude/operators/comparison
  527. // CHECK:STDOUT: import Core//prelude/types/bool
  528. // CHECK:STDOUT: }
  529. // CHECK:STDOUT: %import_ref: %Int32.type = import_ref Core//prelude/types, inst+9, loaded [template = constants.%Int32]
  530. // CHECK:STDOUT: }
  531. // CHECK:STDOUT:
  532. // CHECK:STDOUT: file {
  533. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  534. // CHECK:STDOUT: .Core = imports.%Core
  535. // CHECK:STDOUT: .F = %F.decl
  536. // CHECK:STDOUT: }
  537. // CHECK:STDOUT: %Core.import = import Core
  538. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {
  539. // CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%Int32() [template = i32]
  540. // CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32]
  541. // CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32]
  542. // CHECK:STDOUT: %return: ref i32 = var <return slot>
  543. // CHECK:STDOUT: }
  544. // CHECK:STDOUT: }
  545. // CHECK:STDOUT:
  546. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  547. // CHECK:STDOUT:
  548. // CHECK:STDOUT: fn @F() -> i32 {
  549. // CHECK:STDOUT: !entry:
  550. // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32]
  551. // CHECK:STDOUT: %.loc5_14.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32]
  552. // CHECK:STDOUT: %.loc5_14.2: type = converted %int.make_type_32.loc5, %.loc5_14.1 [template = i32]
  553. // CHECK:STDOUT: %.loc5_20: i32 = int_literal 0 [template = constants.%.2]
  554. // CHECK:STDOUT: %Zero: i32 = bind_symbolic_name Zero, 0, %.loc5_20 [symbolic = constants.%Zero]
  555. // CHECK:STDOUT: %Zero.ref: i32 = name_ref Zero, %Zero [symbolic = constants.%Zero]
  556. // CHECK:STDOUT: return %Zero.ref
  557. // CHECK:STDOUT: }
  558. // CHECK:STDOUT:
  559. // CHECK:STDOUT: --- use_in_block.carbon
  560. // CHECK:STDOUT:
  561. // CHECK:STDOUT: constants {
  562. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  563. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  564. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  565. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  566. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  567. // CHECK:STDOUT: %.2: bool = bool_literal true [template]
  568. // CHECK:STDOUT: %.3: i32 = int_literal 0 [template]
  569. // CHECK:STDOUT: %Zero: i32 = bind_symbolic_name Zero, 0 [symbolic]
  570. // CHECK:STDOUT: %.4: i32 = int_literal 1 [template]
  571. // CHECK:STDOUT: }
  572. // CHECK:STDOUT:
  573. // CHECK:STDOUT: imports {
  574. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  575. // CHECK:STDOUT: .Int32 = %import_ref
  576. // CHECK:STDOUT: import Core//prelude
  577. // CHECK:STDOUT: import Core//prelude/operators
  578. // CHECK:STDOUT: import Core//prelude/types
  579. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  580. // CHECK:STDOUT: import Core//prelude/operators/as
  581. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  582. // CHECK:STDOUT: import Core//prelude/operators/comparison
  583. // CHECK:STDOUT: import Core//prelude/types/bool
  584. // CHECK:STDOUT: }
  585. // CHECK:STDOUT: %import_ref: %Int32.type = import_ref Core//prelude/types, inst+9, loaded [template = constants.%Int32]
  586. // CHECK:STDOUT: }
  587. // CHECK:STDOUT:
  588. // CHECK:STDOUT: file {
  589. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  590. // CHECK:STDOUT: .Core = imports.%Core
  591. // CHECK:STDOUT: .F = %F.decl
  592. // CHECK:STDOUT: }
  593. // CHECK:STDOUT: %Core.import = import Core
  594. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {
  595. // CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%Int32() [template = i32]
  596. // CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32]
  597. // CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32]
  598. // CHECK:STDOUT: %return: ref i32 = var <return slot>
  599. // CHECK:STDOUT: }
  600. // CHECK:STDOUT: }
  601. // CHECK:STDOUT:
  602. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  603. // CHECK:STDOUT:
  604. // CHECK:STDOUT: fn @F() -> i32 {
  605. // CHECK:STDOUT: !entry:
  606. // CHECK:STDOUT: %.loc5: bool = bool_literal true [template = constants.%.2]
  607. // CHECK:STDOUT: if %.loc5 br !if.then else br !if.else
  608. // CHECK:STDOUT:
  609. // CHECK:STDOUT: !if.then:
  610. // CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%Int32() [template = i32]
  611. // CHECK:STDOUT: %.loc6_16.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32]
  612. // CHECK:STDOUT: %.loc6_16.2: type = converted %int.make_type_32.loc6, %.loc6_16.1 [template = i32]
  613. // CHECK:STDOUT: %.loc6_22: i32 = int_literal 0 [template = constants.%.3]
  614. // CHECK:STDOUT: %Zero: i32 = bind_symbolic_name Zero, 0, %.loc6_22 [symbolic = constants.%Zero]
  615. // CHECK:STDOUT: %Zero.ref: i32 = name_ref Zero, %Zero [symbolic = constants.%Zero]
  616. // CHECK:STDOUT: return %Zero.ref
  617. // CHECK:STDOUT:
  618. // CHECK:STDOUT: !if.else:
  619. // CHECK:STDOUT: %.loc9: i32 = int_literal 1 [template = constants.%.4]
  620. // CHECK:STDOUT: return %.loc9
  621. // CHECK:STDOUT: }
  622. // CHECK:STDOUT:
  623. // CHECK:STDOUT: --- fail_return_in_interface.carbon
  624. // CHECK:STDOUT:
  625. // CHECK:STDOUT: constants {
  626. // CHECK:STDOUT: %I.type: type = interface_type @I [template]
  627. // CHECK:STDOUT: %Self.1: %I.type = bind_symbolic_name Self, 0 [symbolic]
  628. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  629. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  630. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  631. // CHECK:STDOUT: %.2: type = assoc_entity_type %I.type, type [template]
  632. // CHECK:STDOUT: %.3: %.2 = assoc_entity element0, @I.%T [template]
  633. // CHECK:STDOUT: %ImplicitAs.type.1: type = generic_interface_type @ImplicitAs [template]
  634. // CHECK:STDOUT: %ImplicitAs: %ImplicitAs.type.1 = struct_value () [template]
  635. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic]
  636. // CHECK:STDOUT: %ImplicitAs.type.2: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic]
  637. // CHECK:STDOUT: %Self.2: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2) = bind_symbolic_name Self, 1 [symbolic]
  638. // CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic]
  639. // CHECK:STDOUT: %Self.3: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic]
  640. // CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic]
  641. // CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic]
  642. // CHECK:STDOUT: %.4: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.1 [symbolic]
  643. // CHECK:STDOUT: %.5: %.4 = assoc_entity element0, imports.%import_ref.6 [symbolic]
  644. // CHECK:STDOUT: %ImplicitAs.type.3: type = interface_type @ImplicitAs, @ImplicitAs(type) [template]
  645. // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert, @ImplicitAs(type) [template]
  646. // CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template]
  647. // CHECK:STDOUT: %.6: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.2 [template]
  648. // CHECK:STDOUT: %.7: %.6 = assoc_entity element0, imports.%import_ref.6 [template]
  649. // CHECK:STDOUT: %.8: %.4 = assoc_entity element0, imports.%import_ref.7 [symbolic]
  650. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  651. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  652. // CHECK:STDOUT: %.9: type = assoc_entity_type %I.type, %F.type [template]
  653. // CHECK:STDOUT: %.10: %.9 = assoc_entity element1, @I.%F.decl [template]
  654. // CHECK:STDOUT: }
  655. // CHECK:STDOUT:
  656. // CHECK:STDOUT: imports {
  657. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  658. // CHECK:STDOUT: .Int32 = %import_ref.1
  659. // CHECK:STDOUT: .ImplicitAs = %import_ref.2
  660. // CHECK:STDOUT: import Core//prelude
  661. // CHECK:STDOUT: import Core//prelude/operators
  662. // CHECK:STDOUT: import Core//prelude/types
  663. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  664. // CHECK:STDOUT: import Core//prelude/operators/as
  665. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  666. // CHECK:STDOUT: import Core//prelude/operators/comparison
  667. // CHECK:STDOUT: import Core//prelude/types/bool
  668. // CHECK:STDOUT: }
  669. // CHECK:STDOUT: %import_ref.1: %Int32.type = import_ref Core//prelude/types, inst+9, loaded [template = constants.%Int32]
  670. // CHECK:STDOUT: %import_ref.2: %ImplicitAs.type.1 = import_ref Core//prelude/operators/as, inst+46, loaded [template = constants.%ImplicitAs]
  671. // CHECK:STDOUT: %import_ref.3 = import_ref Core//prelude/operators/as, inst+52, unloaded
  672. // CHECK:STDOUT: %import_ref.4: @ImplicitAs.%.1 (%.4) = import_ref Core//prelude/operators/as, inst+71, loaded [symbolic = @ImplicitAs.%.2 (constants.%.8)]
  673. // CHECK:STDOUT: %import_ref.5 = import_ref Core//prelude/operators/as, inst+64, unloaded
  674. // CHECK:STDOUT: %import_ref.6 = import_ref Core//prelude/operators/as, inst+64, unloaded
  675. // CHECK:STDOUT: %import_ref.7 = import_ref Core//prelude/operators/as, inst+64, unloaded
  676. // CHECK:STDOUT: }
  677. // CHECK:STDOUT:
  678. // CHECK:STDOUT: file {
  679. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  680. // CHECK:STDOUT: .Core = imports.%Core
  681. // CHECK:STDOUT: .I = %I.decl
  682. // CHECK:STDOUT: }
  683. // CHECK:STDOUT: %Core.import = import Core
  684. // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%I.type] {} {}
  685. // CHECK:STDOUT: }
  686. // CHECK:STDOUT:
  687. // CHECK:STDOUT: interface @I {
  688. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.1]
  689. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  690. // CHECK:STDOUT: %.loc5_21.1: type = value_of_initializer %int.make_type_32 [template = i32]
  691. // CHECK:STDOUT: %.loc5_21.2: type = converted %int.make_type_32, %.loc5_21.1 [template = i32]
  692. // CHECK:STDOUT: %T: type = assoc_const_decl T [template]
  693. // CHECK:STDOUT: %.loc5_21.3: %.2 = assoc_entity element0, %T [template = constants.%.3]
  694. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {
  695. // CHECK:STDOUT: %T.ref: %.2 = name_ref T, @I.%.loc5_21.3 [template = constants.%.3]
  696. // CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(type) [template = constants.%ImplicitAs.type.3]
  697. // CHECK:STDOUT: %.loc13_13.1: %.6 = specific_constant imports.%import_ref.4, @ImplicitAs(type) [template = constants.%.7]
  698. // CHECK:STDOUT: %Convert.ref: %.6 = name_ref Convert, %.loc13_13.1 [template = constants.%.7]
  699. // CHECK:STDOUT: %.loc13_13.2: type = converted %T.ref, <error> [template = <error>]
  700. // CHECK:STDOUT: %return: ref <error> = var <return slot>
  701. // CHECK:STDOUT: }
  702. // CHECK:STDOUT: %.loc13: %.9 = assoc_entity element1, %F.decl [template = constants.%.10]
  703. // CHECK:STDOUT:
  704. // CHECK:STDOUT: !members:
  705. // CHECK:STDOUT: .Self = %Self
  706. // CHECK:STDOUT: .T = %.loc5_21.3
  707. // CHECK:STDOUT: .F = %.loc13
  708. // CHECK:STDOUT: witness = (%T, %F.decl)
  709. // CHECK:STDOUT: }
  710. // CHECK:STDOUT:
  711. // CHECK:STDOUT: generic interface @ImplicitAs(constants.%Dest: type) {
  712. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
  713. // CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)]
  714. // CHECK:STDOUT:
  715. // CHECK:STDOUT: !definition:
  716. // CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)]
  717. // CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.3)]
  718. // CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.1)]
  719. // CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.1) = struct_value () [symbolic = %Convert (constants.%Convert.1)]
  720. // CHECK:STDOUT: %.1: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.1 (constants.%.4)]
  721. // CHECK:STDOUT: %.2: @ImplicitAs.%.1 (%.4) = assoc_entity element0, imports.%import_ref.6 [symbolic = %.2 (constants.%.5)]
  722. // CHECK:STDOUT:
  723. // CHECK:STDOUT: interface {
  724. // CHECK:STDOUT: !members:
  725. // CHECK:STDOUT: .Self = imports.%import_ref.3
  726. // CHECK:STDOUT: .Convert = imports.%import_ref.4
  727. // CHECK:STDOUT: witness = (imports.%import_ref.5)
  728. // CHECK:STDOUT: }
  729. // CHECK:STDOUT: }
  730. // CHECK:STDOUT:
  731. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  732. // CHECK:STDOUT:
  733. // CHECK:STDOUT: generic fn @Convert(constants.%Dest: type, constants.%Self.2: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2)) {
  734. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
  735. // CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)]
  736. // CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.3)]
  737. // CHECK:STDOUT:
  738. // CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self (%Self.3)]() -> @Convert.%Dest (%Dest);
  739. // CHECK:STDOUT: }
  740. // CHECK:STDOUT:
  741. // CHECK:STDOUT: generic fn @F(@I.%Self: %I.type) {
  742. // CHECK:STDOUT:
  743. // CHECK:STDOUT: fn() -> <error>;
  744. // CHECK:STDOUT: }
  745. // CHECK:STDOUT:
  746. // CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) {
  747. // CHECK:STDOUT: %Dest => constants.%Dest
  748. // CHECK:STDOUT: %Dest.patt => constants.%Dest
  749. // CHECK:STDOUT: }
  750. // CHECK:STDOUT:
  751. // CHECK:STDOUT: specific @ImplicitAs(@ImplicitAs.%Dest) {
  752. // CHECK:STDOUT: %Dest => constants.%Dest
  753. // CHECK:STDOUT: %Dest.patt => constants.%Dest
  754. // CHECK:STDOUT: }
  755. // CHECK:STDOUT:
  756. // CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {
  757. // CHECK:STDOUT: %Dest => constants.%Dest
  758. // CHECK:STDOUT: %Dest.patt => constants.%Dest
  759. // CHECK:STDOUT: }
  760. // CHECK:STDOUT:
  761. // CHECK:STDOUT: specific @Convert(constants.%Dest, constants.%Self.2) {
  762. // CHECK:STDOUT: %Dest => constants.%Dest
  763. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2
  764. // CHECK:STDOUT: %Self => constants.%Self.2
  765. // CHECK:STDOUT: }
  766. // CHECK:STDOUT:
  767. // CHECK:STDOUT: specific @ImplicitAs(type) {
  768. // CHECK:STDOUT: %Dest => type
  769. // CHECK:STDOUT: %Dest.patt => type
  770. // CHECK:STDOUT:
  771. // CHECK:STDOUT: !definition:
  772. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3
  773. // CHECK:STDOUT: %Self => constants.%Self.3
  774. // CHECK:STDOUT: %Convert.type => constants.%Convert.type.2
  775. // CHECK:STDOUT: %Convert => constants.%Convert.2
  776. // CHECK:STDOUT: %.1 => constants.%.6
  777. // CHECK:STDOUT: %.2 => constants.%.7
  778. // CHECK:STDOUT: }
  779. // CHECK:STDOUT:
  780. // CHECK:STDOUT: specific @F(constants.%Self.1) {}
  781. // CHECK:STDOUT:
  782. // CHECK:STDOUT: --- fail_return_in_class.carbon
  783. // CHECK:STDOUT:
  784. // CHECK:STDOUT: constants {
  785. // CHECK:STDOUT: %I: type = class_type @I [template]
  786. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  787. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  788. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  789. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  790. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  791. // CHECK:STDOUT: %.2: type = struct_type {} [template]
  792. // CHECK:STDOUT: %.3: <witness> = complete_type_witness %.2 [template]
  793. // CHECK:STDOUT: }
  794. // CHECK:STDOUT:
  795. // CHECK:STDOUT: imports {
  796. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  797. // CHECK:STDOUT: .Int32 = %import_ref
  798. // CHECK:STDOUT: import Core//prelude
  799. // CHECK:STDOUT: import Core//prelude/operators
  800. // CHECK:STDOUT: import Core//prelude/types
  801. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  802. // CHECK:STDOUT: import Core//prelude/operators/as
  803. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  804. // CHECK:STDOUT: import Core//prelude/operators/comparison
  805. // CHECK:STDOUT: import Core//prelude/types/bool
  806. // CHECK:STDOUT: }
  807. // CHECK:STDOUT: %import_ref: %Int32.type = import_ref Core//prelude/types, inst+9, loaded [template = constants.%Int32]
  808. // CHECK:STDOUT: }
  809. // CHECK:STDOUT:
  810. // CHECK:STDOUT: file {
  811. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  812. // CHECK:STDOUT: .Core = imports.%Core
  813. // CHECK:STDOUT: .I = %I.decl
  814. // CHECK:STDOUT: }
  815. // CHECK:STDOUT: %Core.import = import Core
  816. // CHECK:STDOUT: %I.decl: type = class_decl @I [template = constants.%I] {} {}
  817. // CHECK:STDOUT: }
  818. // CHECK:STDOUT:
  819. // CHECK:STDOUT: class @I {
  820. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  821. // CHECK:STDOUT: %.loc9_21.1: type = value_of_initializer %int.make_type_32 [template = i32]
  822. // CHECK:STDOUT: %.loc9_21.2: type = converted %int.make_type_32, %.loc9_21.1 [template = i32]
  823. // CHECK:STDOUT: %T: type = bind_name T, %.loc9_21.2
  824. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {
  825. // CHECK:STDOUT: %T.ref: type = name_ref T, @I.%T
  826. // CHECK:STDOUT: %return: ref <error> = var <return slot>
  827. // CHECK:STDOUT: }
  828. // CHECK:STDOUT: %.loc15: <witness> = complete_type_witness %.2 [template = constants.%.3]
  829. // CHECK:STDOUT:
  830. // CHECK:STDOUT: !members:
  831. // CHECK:STDOUT: .Self = constants.%I
  832. // CHECK:STDOUT: .T = %T
  833. // CHECK:STDOUT: .F = %F.decl
  834. // CHECK:STDOUT: }
  835. // CHECK:STDOUT:
  836. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  837. // CHECK:STDOUT:
  838. // CHECK:STDOUT: fn @F() -> <error>;
  839. // CHECK:STDOUT:
  840. // CHECK:STDOUT: --- fail_return_in_package_scope.carbon
  841. // CHECK:STDOUT:
  842. // CHECK:STDOUT: constants {
  843. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  844. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  845. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  846. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  847. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  848. // CHECK:STDOUT: }
  849. // CHECK:STDOUT:
  850. // CHECK:STDOUT: imports {
  851. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  852. // CHECK:STDOUT: .Int32 = %import_ref
  853. // CHECK:STDOUT: import Core//prelude
  854. // CHECK:STDOUT: import Core//prelude/operators
  855. // CHECK:STDOUT: import Core//prelude/types
  856. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  857. // CHECK:STDOUT: import Core//prelude/operators/as
  858. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  859. // CHECK:STDOUT: import Core//prelude/operators/comparison
  860. // CHECK:STDOUT: import Core//prelude/types/bool
  861. // CHECK:STDOUT: }
  862. // CHECK:STDOUT: %import_ref: %Int32.type = import_ref Core//prelude/types, inst+9, loaded [template = constants.%Int32]
  863. // CHECK:STDOUT: }
  864. // CHECK:STDOUT:
  865. // CHECK:STDOUT: file {
  866. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  867. // CHECK:STDOUT: .Core = imports.%Core
  868. // CHECK:STDOUT: .T = @__global_init.%T
  869. // CHECK:STDOUT: .F = %F.decl
  870. // CHECK:STDOUT: }
  871. // CHECK:STDOUT: %Core.import = import Core
  872. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {
  873. // CHECK:STDOUT: %T.ref: type = name_ref T, @__global_init.%T
  874. // CHECK:STDOUT: %return: ref <error> = var <return slot>
  875. // CHECK:STDOUT: }
  876. // CHECK:STDOUT: }
  877. // CHECK:STDOUT:
  878. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  879. // CHECK:STDOUT:
  880. // CHECK:STDOUT: fn @F() -> <error>;
  881. // CHECK:STDOUT:
  882. // CHECK:STDOUT: fn @__global_init() {
  883. // CHECK:STDOUT: !entry:
  884. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  885. // CHECK:STDOUT: %.loc8_19.1: type = value_of_initializer %int.make_type_32 [template = i32]
  886. // CHECK:STDOUT: %.loc8_19.2: type = converted %int.make_type_32, %.loc8_19.1 [template = i32]
  887. // CHECK:STDOUT: %T: type = bind_name T, %.loc8_19.2
  888. // CHECK:STDOUT: return
  889. // CHECK:STDOUT: }
  890. // CHECK:STDOUT:
  891. // CHECK:STDOUT: --- fail_use_in_impl.carbon
  892. // CHECK:STDOUT:
  893. // CHECK:STDOUT: constants {
  894. // CHECK:STDOUT: %Empty.type: type = interface_type @Empty [template]
  895. // CHECK:STDOUT: %Self: %Empty.type = bind_symbolic_name Self, 0 [symbolic]
  896. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  897. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  898. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  899. // CHECK:STDOUT: %.2: i32 = int_literal 0 [template]
  900. // CHECK:STDOUT: %.3: <witness> = interface_witness () [template]
  901. // CHECK:STDOUT: }
  902. // CHECK:STDOUT:
  903. // CHECK:STDOUT: imports {
  904. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  905. // CHECK:STDOUT: .Int32 = %import_ref
  906. // CHECK:STDOUT: import Core//prelude
  907. // CHECK:STDOUT: import Core//prelude/operators
  908. // CHECK:STDOUT: import Core//prelude/types
  909. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  910. // CHECK:STDOUT: import Core//prelude/operators/as
  911. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  912. // CHECK:STDOUT: import Core//prelude/operators/comparison
  913. // CHECK:STDOUT: import Core//prelude/types/bool
  914. // CHECK:STDOUT: }
  915. // CHECK:STDOUT: %import_ref: %Int32.type = import_ref Core//prelude/types, inst+9, loaded [template = constants.%Int32]
  916. // CHECK:STDOUT: }
  917. // CHECK:STDOUT:
  918. // CHECK:STDOUT: file {
  919. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  920. // CHECK:STDOUT: .Core = imports.%Core
  921. // CHECK:STDOUT: .Empty = %Empty.decl
  922. // CHECK:STDOUT: }
  923. // CHECK:STDOUT: %Core.import = import Core
  924. // CHECK:STDOUT: %Empty.decl: type = interface_decl @Empty [template = constants.%Empty.type] {} {}
  925. // CHECK:STDOUT: impl_decl @impl [template] {} {
  926. // CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%Int32() [template = i32]
  927. // CHECK:STDOUT: %.loc6_6.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32]
  928. // CHECK:STDOUT: %.loc6_6.2: type = converted %int.make_type_32.loc6, %.loc6_6.1 [template = i32]
  929. // CHECK:STDOUT: %Empty.ref: type = name_ref Empty, file.%Empty.decl [template = constants.%Empty.type]
  930. // CHECK:STDOUT: }
  931. // CHECK:STDOUT: }
  932. // CHECK:STDOUT:
  933. // CHECK:STDOUT: interface @Empty {
  934. // CHECK:STDOUT: %Self: %Empty.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  935. // CHECK:STDOUT:
  936. // CHECK:STDOUT: !members:
  937. // CHECK:STDOUT: .Self = %Self
  938. // CHECK:STDOUT: witness = ()
  939. // CHECK:STDOUT: }
  940. // CHECK:STDOUT:
  941. // CHECK:STDOUT: impl @impl: %.loc6_6.2 as %Empty.ref {
  942. // CHECK:STDOUT: %int.make_type_32.loc10: init type = call constants.%Int32() [template = i32]
  943. // CHECK:STDOUT: %.loc10_14.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32]
  944. // CHECK:STDOUT: %.loc10_14.2: type = converted %int.make_type_32.loc10, %.loc10_14.1 [template = i32]
  945. // CHECK:STDOUT: %.loc10_20: i32 = int_literal 0 [template = constants.%.2]
  946. // CHECK:STDOUT: %Zero: i32 = bind_name Zero, %.loc10_20
  947. // CHECK:STDOUT: %.loc6_19: <witness> = interface_witness () [template = constants.%.3]
  948. // CHECK:STDOUT:
  949. // CHECK:STDOUT: !members:
  950. // CHECK:STDOUT: .Zero = %Zero
  951. // CHECK:STDOUT: witness = %.loc6_19
  952. // CHECK:STDOUT: }
  953. // CHECK:STDOUT:
  954. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  955. // CHECK:STDOUT: