compile_time_bindings.carbon 57 KB

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