basics.carbon 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  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. // EXTRA-ARGS: --no-prelude-import
  6. //
  7. // AUTOUPDATE
  8. // TIP: To test this file alone, run:
  9. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/array/basics.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/basics.carbon
  12. // --- assign_var.carbon
  13. library "[[@TEST_NAME]]";
  14. var a: ((), (), ());
  15. //@dump-sem-ir-begin
  16. var b: array((), 3) = a;
  17. //@dump-sem-ir-end
  18. // --- assign_arity.carbon
  19. var a0: array((), 0) = ();
  20. var a1: array((), 1) = ((),);
  21. var a2: array((), 2) = ((), ());
  22. // --- array_in_place.carbon
  23. library "[[@TEST_NAME]]";
  24. class C {}
  25. fn F() -> (C, C, C);
  26. fn G() {
  27. //@dump-sem-ir-begin
  28. var v: array((C, C, C), 2) = (F(), F());
  29. //@dump-sem-ir-end
  30. }
  31. // --- array_vs_tuple.carbon
  32. library "[[@TEST_NAME]]";
  33. fn G() {
  34. // These should have two different constant values.
  35. //@dump-sem-ir-begin
  36. var a: array((), 3);
  37. var b: ((), (), ());
  38. //@dump-sem-ir-end
  39. }
  40. // --- assign_return_value.carbon
  41. library "[[@TEST_NAME]]";
  42. fn F() -> ((),) { return ((),); }
  43. fn Run() {
  44. //@dump-sem-ir-begin
  45. var t: array((), 1) = F();
  46. //@dump-sem-ir-end
  47. }
  48. // --- nine_elements.carbon
  49. library "[[@TEST_NAME]]";
  50. var a: ((), (), (), (), (), (), (), (), ()) =
  51. ((), (), (), (), (), (), (), (), ());
  52. // Regression test for APInt handling.
  53. //@dump-sem-ir-begin
  54. var b: array((), 9) = a;
  55. //@dump-sem-ir-end
  56. // --- fail_incomplete_element.carbon
  57. library "[[@TEST_NAME]]";
  58. class Incomplete;
  59. // CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE+7]]:8: error: binding pattern has incomplete type `array(Incomplete, 1)` in name binding declaration [IncompleteTypeInBindingDecl]
  60. // CHECK:STDERR: var a: array(Incomplete, 1);
  61. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
  62. // CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE-5]]:1: note: class was forward declared here [ClassForwardDeclaredHere]
  63. // CHECK:STDERR: class Incomplete;
  64. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~
  65. // CHECK:STDERR:
  66. var a: array(Incomplete, 1);
  67. var p: Incomplete* = &a[0];
  68. // --- fail_invalid_element.carbon
  69. library "[[@TEST_NAME]]";
  70. // CHECK:STDERR: fail_invalid_element.carbon:[[@LINE+4]]:14: error: `Core.ImplicitAs` implicitly referenced here, but package `Core` not found [CoreNotFound]
  71. // CHECK:STDERR: var a: array(1, 1);
  72. // CHECK:STDERR: ^
  73. // CHECK:STDERR:
  74. var a: array(1, 1);
  75. // CHECK:STDOUT: --- assign_var.carbon
  76. // CHECK:STDOUT:
  77. // CHECK:STDOUT: constants {
  78. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  79. // CHECK:STDOUT: %tuple.type: type = tuple_type (%empty_tuple.type, %empty_tuple.type, %empty_tuple.type) [concrete]
  80. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete]
  81. // CHECK:STDOUT: %array_type: type = array_type %int_3, %empty_tuple.type [concrete]
  82. // CHECK:STDOUT: %pattern_type.035: type = pattern_type %array_type [concrete]
  83. // CHECK:STDOUT: %tuple.elem0: ref %empty_tuple.type = tuple_access file.%a.var, element0 [concrete]
  84. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete]
  85. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  86. // CHECK:STDOUT: %tuple.elem1: ref %empty_tuple.type = tuple_access file.%a.var, element1 [concrete]
  87. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete]
  88. // CHECK:STDOUT: %tuple.elem2: ref %empty_tuple.type = tuple_access file.%a.var, element2 [concrete]
  89. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete]
  90. // CHECK:STDOUT: %array: %array_type = tuple_value (%empty_tuple, %empty_tuple, %empty_tuple) [concrete]
  91. // CHECK:STDOUT: }
  92. // CHECK:STDOUT:
  93. // CHECK:STDOUT: file {
  94. // CHECK:STDOUT: name_binding_decl {
  95. // CHECK:STDOUT: %b.patt: %pattern_type.035 = binding_pattern b [concrete]
  96. // CHECK:STDOUT: %b.var_patt: %pattern_type.035 = var_pattern %b.patt [concrete]
  97. // CHECK:STDOUT: }
  98. // CHECK:STDOUT: %b.var: ref %array_type = var %b.var_patt [concrete]
  99. // CHECK:STDOUT: %.loc6_19: type = splice_block %array_type [concrete = constants.%array_type] {
  100. // CHECK:STDOUT: %.loc6_15.1: %empty_tuple.type = tuple_literal ()
  101. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3]
  102. // CHECK:STDOUT: %.loc6_15.2: type = converted %.loc6_15.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  103. // CHECK:STDOUT: %array_type: type = array_type %int_3, %.loc6_15.2 [concrete = constants.%array_type]
  104. // CHECK:STDOUT: }
  105. // CHECK:STDOUT: %b: ref %array_type = bind_name b, %b.var [concrete = %b.var]
  106. // CHECK:STDOUT: }
  107. // CHECK:STDOUT:
  108. // CHECK:STDOUT: fn @__global_init() {
  109. // CHECK:STDOUT: !entry:
  110. // CHECK:STDOUT: %a.ref: ref %tuple.type = name_ref a, file.%a [concrete = file.%a.var]
  111. // CHECK:STDOUT: %tuple.elem0: ref %empty_tuple.type = tuple_access %a.ref, element0 [concrete = constants.%tuple.elem0]
  112. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0]
  113. // CHECK:STDOUT: %.loc6_23.1: ref %empty_tuple.type = array_index file.%b.var, %int_0
  114. // CHECK:STDOUT: %.loc6_23.2: init %empty_tuple.type = tuple_init () to %.loc6_23.1 [concrete = constants.%empty_tuple]
  115. // CHECK:STDOUT: %.loc6_23.3: init %empty_tuple.type = converted %tuple.elem0, %.loc6_23.2 [concrete = constants.%empty_tuple]
  116. // CHECK:STDOUT: %tuple.elem1: ref %empty_tuple.type = tuple_access %a.ref, element1 [concrete = constants.%tuple.elem1]
  117. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
  118. // CHECK:STDOUT: %.loc6_23.4: ref %empty_tuple.type = array_index file.%b.var, %int_1
  119. // CHECK:STDOUT: %.loc6_23.5: init %empty_tuple.type = tuple_init () to %.loc6_23.4 [concrete = constants.%empty_tuple]
  120. // CHECK:STDOUT: %.loc6_23.6: init %empty_tuple.type = converted %tuple.elem1, %.loc6_23.5 [concrete = constants.%empty_tuple]
  121. // CHECK:STDOUT: %tuple.elem2: ref %empty_tuple.type = tuple_access %a.ref, element2 [concrete = constants.%tuple.elem2]
  122. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2]
  123. // CHECK:STDOUT: %.loc6_23.7: ref %empty_tuple.type = array_index file.%b.var, %int_2
  124. // CHECK:STDOUT: %.loc6_23.8: init %empty_tuple.type = tuple_init () to %.loc6_23.7 [concrete = constants.%empty_tuple]
  125. // CHECK:STDOUT: %.loc6_23.9: init %empty_tuple.type = converted %tuple.elem2, %.loc6_23.8 [concrete = constants.%empty_tuple]
  126. // CHECK:STDOUT: %.loc6_23.10: init %array_type = array_init (%.loc6_23.3, %.loc6_23.6, %.loc6_23.9) to file.%b.var [concrete = constants.%array]
  127. // CHECK:STDOUT: %.loc6_1: init %array_type = converted %a.ref, %.loc6_23.10 [concrete = constants.%array]
  128. // CHECK:STDOUT: assign file.%b.var, %.loc6_1
  129. // CHECK:STDOUT: <elided>
  130. // CHECK:STDOUT: }
  131. // CHECK:STDOUT:
  132. // CHECK:STDOUT: --- array_in_place.carbon
  133. // CHECK:STDOUT:
  134. // CHECK:STDOUT: constants {
  135. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  136. // CHECK:STDOUT: %tuple.type.ff9: type = tuple_type (type, type, type) [concrete]
  137. // CHECK:STDOUT: %tuple.type.734: type = tuple_type (%C, %C, %C) [concrete]
  138. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  139. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  140. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete]
  141. // CHECK:STDOUT: %array_type: type = array_type %int_2, %tuple.type.734 [concrete]
  142. // CHECK:STDOUT: %pattern_type.e0b: type = pattern_type %array_type [concrete]
  143. // CHECK:STDOUT: %tuple.type.14a: type = tuple_type (%tuple.type.734, %tuple.type.734) [concrete]
  144. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete]
  145. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete]
  146. // CHECK:STDOUT: }
  147. // CHECK:STDOUT:
  148. // CHECK:STDOUT: fn @G() {
  149. // CHECK:STDOUT: !entry:
  150. // CHECK:STDOUT: name_binding_decl {
  151. // CHECK:STDOUT: %v.patt: %pattern_type.e0b = binding_pattern v [concrete]
  152. // CHECK:STDOUT: %v.var_patt: %pattern_type.e0b = var_pattern %v.patt [concrete]
  153. // CHECK:STDOUT: }
  154. // CHECK:STDOUT: %v.var: ref %array_type = var %v.var_patt
  155. // CHECK:STDOUT: %F.ref.loc10_33: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
  156. // CHECK:STDOUT: %.loc10_41.1: ref %tuple.type.734 = splice_block %.loc10_41.2 {
  157. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0]
  158. // CHECK:STDOUT: %.loc10_41.2: ref %tuple.type.734 = array_index %v.var, %int_0
  159. // CHECK:STDOUT: }
  160. // CHECK:STDOUT: %F.call.loc10_35: init %tuple.type.734 = call %F.ref.loc10_33() to %.loc10_41.1
  161. // CHECK:STDOUT: %F.ref.loc10_38: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
  162. // CHECK:STDOUT: %.loc10_41.3: ref %tuple.type.734 = splice_block %.loc10_41.4 {
  163. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
  164. // CHECK:STDOUT: %.loc10_41.4: ref %tuple.type.734 = array_index %v.var, %int_1
  165. // CHECK:STDOUT: }
  166. // CHECK:STDOUT: %F.call.loc10_40: init %tuple.type.734 = call %F.ref.loc10_38() to %.loc10_41.3
  167. // CHECK:STDOUT: %.loc10_41.5: %tuple.type.14a = tuple_literal (%F.call.loc10_35, %F.call.loc10_40)
  168. // CHECK:STDOUT: %.loc10_41.6: init %array_type = array_init (%F.call.loc10_35, %F.call.loc10_40) to %v.var
  169. // CHECK:STDOUT: %.loc10_3: init %array_type = converted %.loc10_41.5, %.loc10_41.6
  170. // CHECK:STDOUT: assign %v.var, %.loc10_3
  171. // CHECK:STDOUT: %.loc10_28: type = splice_block %array_type [concrete = constants.%array_type] {
  172. // CHECK:STDOUT: %C.ref.loc10_17: type = name_ref C, file.%C.decl [concrete = constants.%C]
  173. // CHECK:STDOUT: %C.ref.loc10_20: type = name_ref C, file.%C.decl [concrete = constants.%C]
  174. // CHECK:STDOUT: %C.ref.loc10_23: type = name_ref C, file.%C.decl [concrete = constants.%C]
  175. // CHECK:STDOUT: %.loc10_24.1: %tuple.type.ff9 = tuple_literal (%C.ref.loc10_17, %C.ref.loc10_20, %C.ref.loc10_23)
  176. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2]
  177. // CHECK:STDOUT: %.loc10_24.2: type = converted %.loc10_24.1, constants.%tuple.type.734 [concrete = constants.%tuple.type.734]
  178. // CHECK:STDOUT: %array_type: type = array_type %int_2, %.loc10_24.2 [concrete = constants.%array_type]
  179. // CHECK:STDOUT: }
  180. // CHECK:STDOUT: %v: ref %array_type = bind_name v, %v.var
  181. // CHECK:STDOUT: <elided>
  182. // CHECK:STDOUT: }
  183. // CHECK:STDOUT:
  184. // CHECK:STDOUT: --- array_vs_tuple.carbon
  185. // CHECK:STDOUT:
  186. // CHECK:STDOUT: constants {
  187. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  188. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete]
  189. // CHECK:STDOUT: %array_type: type = array_type %int_3, %empty_tuple.type [concrete]
  190. // CHECK:STDOUT: %pattern_type.035: type = pattern_type %array_type [concrete]
  191. // CHECK:STDOUT: %tuple.type: type = tuple_type (%empty_tuple.type, %empty_tuple.type, %empty_tuple.type) [concrete]
  192. // CHECK:STDOUT: %pattern_type.8c1: type = pattern_type %tuple.type [concrete]
  193. // CHECK:STDOUT: }
  194. // CHECK:STDOUT:
  195. // CHECK:STDOUT: fn @G() {
  196. // CHECK:STDOUT: !entry:
  197. // CHECK:STDOUT: name_binding_decl {
  198. // CHECK:STDOUT: %a.patt: %pattern_type.035 = binding_pattern a [concrete]
  199. // CHECK:STDOUT: %a.var_patt: %pattern_type.035 = var_pattern %a.patt [concrete]
  200. // CHECK:STDOUT: }
  201. // CHECK:STDOUT: %a.var: ref %array_type = var %a.var_patt
  202. // CHECK:STDOUT: %.loc7_21: type = splice_block %array_type [concrete = constants.%array_type] {
  203. // CHECK:STDOUT: %.loc7_17.1: %empty_tuple.type = tuple_literal ()
  204. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3]
  205. // CHECK:STDOUT: %.loc7_17.2: type = converted %.loc7_17.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  206. // CHECK:STDOUT: %array_type: type = array_type %int_3, %.loc7_17.2 [concrete = constants.%array_type]
  207. // CHECK:STDOUT: }
  208. // CHECK:STDOUT: %a: ref %array_type = bind_name a, %a.var
  209. // CHECK:STDOUT: name_binding_decl {
  210. // CHECK:STDOUT: %b.patt: %pattern_type.8c1 = binding_pattern b [concrete]
  211. // CHECK:STDOUT: %b.var_patt: %pattern_type.8c1 = var_pattern %b.patt [concrete]
  212. // CHECK:STDOUT: }
  213. // CHECK:STDOUT: %b.var: ref %tuple.type = var %b.var_patt
  214. // CHECK:STDOUT: %.loc8_21.1: type = splice_block %.loc8_21.6 [concrete = constants.%tuple.type] {
  215. // CHECK:STDOUT: %.loc8_12: %empty_tuple.type = tuple_literal ()
  216. // CHECK:STDOUT: %.loc8_16: %empty_tuple.type = tuple_literal ()
  217. // CHECK:STDOUT: %.loc8_20: %empty_tuple.type = tuple_literal ()
  218. // CHECK:STDOUT: %.loc8_21.2: %tuple.type = tuple_literal (%.loc8_12, %.loc8_16, %.loc8_20)
  219. // CHECK:STDOUT: %.loc8_21.3: type = converted %.loc8_12, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  220. // CHECK:STDOUT: %.loc8_21.4: type = converted %.loc8_16, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  221. // CHECK:STDOUT: %.loc8_21.5: type = converted %.loc8_20, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  222. // CHECK:STDOUT: %.loc8_21.6: type = converted %.loc8_21.2, constants.%tuple.type [concrete = constants.%tuple.type]
  223. // CHECK:STDOUT: }
  224. // CHECK:STDOUT: %b: ref %tuple.type = bind_name b, %b.var
  225. // CHECK:STDOUT: <elided>
  226. // CHECK:STDOUT: }
  227. // CHECK:STDOUT:
  228. // CHECK:STDOUT: --- assign_return_value.carbon
  229. // CHECK:STDOUT:
  230. // CHECK:STDOUT: constants {
  231. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  232. // CHECK:STDOUT: %tuple.type: type = tuple_type (%empty_tuple.type) [concrete]
  233. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  234. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  235. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  236. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete]
  237. // CHECK:STDOUT: %array_type: type = array_type %int_1, %empty_tuple.type [concrete]
  238. // CHECK:STDOUT: %pattern_type.fe8: type = pattern_type %array_type [concrete]
  239. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete]
  240. // CHECK:STDOUT: %array: %array_type = tuple_value (%empty_tuple) [concrete]
  241. // CHECK:STDOUT: }
  242. // CHECK:STDOUT:
  243. // CHECK:STDOUT: fn @Run() {
  244. // CHECK:STDOUT: !entry:
  245. // CHECK:STDOUT: name_binding_decl {
  246. // CHECK:STDOUT: %t.patt: %pattern_type.fe8 = binding_pattern t [concrete]
  247. // CHECK:STDOUT: %t.var_patt: %pattern_type.fe8 = var_pattern %t.patt [concrete]
  248. // CHECK:STDOUT: }
  249. // CHECK:STDOUT: %t.var: ref %array_type = var %t.var_patt
  250. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
  251. // CHECK:STDOUT: %F.call: init %tuple.type = call %F.ref()
  252. // CHECK:STDOUT: %.loc8_27.1: ref %tuple.type = temporary_storage
  253. // CHECK:STDOUT: %.loc8_27.2: ref %tuple.type = temporary %.loc8_27.1, %F.call
  254. // CHECK:STDOUT: %tuple.elem0: ref %empty_tuple.type = tuple_access %.loc8_27.2, element0
  255. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0]
  256. // CHECK:STDOUT: %.loc8_27.3: ref %empty_tuple.type = array_index %t.var, %int_0
  257. // CHECK:STDOUT: %.loc8_27.4: init %empty_tuple.type = tuple_init () to %.loc8_27.3 [concrete = constants.%empty_tuple]
  258. // CHECK:STDOUT: %.loc8_27.5: init %empty_tuple.type = converted %tuple.elem0, %.loc8_27.4 [concrete = constants.%empty_tuple]
  259. // CHECK:STDOUT: %.loc8_27.6: init %array_type = array_init (%.loc8_27.5) to %t.var [concrete = constants.%array]
  260. // CHECK:STDOUT: %.loc8_3: init %array_type = converted %F.call, %.loc8_27.6 [concrete = constants.%array]
  261. // CHECK:STDOUT: assign %t.var, %.loc8_3
  262. // CHECK:STDOUT: %.loc8_21: type = splice_block %array_type [concrete = constants.%array_type] {
  263. // CHECK:STDOUT: %.loc8_17.1: %empty_tuple.type = tuple_literal ()
  264. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
  265. // CHECK:STDOUT: %.loc8_17.2: type = converted %.loc8_17.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  266. // CHECK:STDOUT: %array_type: type = array_type %int_1, %.loc8_17.2 [concrete = constants.%array_type]
  267. // CHECK:STDOUT: }
  268. // CHECK:STDOUT: %t: ref %array_type = bind_name t, %t.var
  269. // CHECK:STDOUT: <elided>
  270. // CHECK:STDOUT: }
  271. // CHECK:STDOUT:
  272. // CHECK:STDOUT: --- nine_elements.carbon
  273. // CHECK:STDOUT:
  274. // CHECK:STDOUT: constants {
  275. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  276. // CHECK:STDOUT: %tuple.type: type = tuple_type (%empty_tuple.type, %empty_tuple.type, %empty_tuple.type, %empty_tuple.type, %empty_tuple.type, %empty_tuple.type, %empty_tuple.type, %empty_tuple.type, %empty_tuple.type) [concrete]
  277. // CHECK:STDOUT: %tuple.elem0: ref %empty_tuple.type = tuple_access file.%a.var, element0 [concrete]
  278. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  279. // CHECK:STDOUT: %tuple.elem1: ref %empty_tuple.type = tuple_access file.%a.var, element1 [concrete]
  280. // CHECK:STDOUT: %tuple.elem2: ref %empty_tuple.type = tuple_access file.%a.var, element2 [concrete]
  281. // CHECK:STDOUT: %tuple.elem3: ref %empty_tuple.type = tuple_access file.%a.var, element3 [concrete]
  282. // CHECK:STDOUT: %tuple.elem4: ref %empty_tuple.type = tuple_access file.%a.var, element4 [concrete]
  283. // CHECK:STDOUT: %tuple.elem5: ref %empty_tuple.type = tuple_access file.%a.var, element5 [concrete]
  284. // CHECK:STDOUT: %tuple.elem6: ref %empty_tuple.type = tuple_access file.%a.var, element6 [concrete]
  285. // CHECK:STDOUT: %tuple.elem7: ref %empty_tuple.type = tuple_access file.%a.var, element7 [concrete]
  286. // CHECK:STDOUT: %tuple.elem8: ref %empty_tuple.type = tuple_access file.%a.var, element8 [concrete]
  287. // CHECK:STDOUT: %int_9: Core.IntLiteral = int_value 9 [concrete]
  288. // CHECK:STDOUT: %array_type: type = array_type %int_9, %empty_tuple.type [concrete]
  289. // CHECK:STDOUT: %pattern_type.3db: type = pattern_type %array_type [concrete]
  290. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete]
  291. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete]
  292. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete]
  293. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete]
  294. // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete]
  295. // CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [concrete]
  296. // CHECK:STDOUT: %int_6: Core.IntLiteral = int_value 6 [concrete]
  297. // CHECK:STDOUT: %int_7: Core.IntLiteral = int_value 7 [concrete]
  298. // CHECK:STDOUT: %int_8: Core.IntLiteral = int_value 8 [concrete]
  299. // CHECK:STDOUT: %array: %array_type = tuple_value (%empty_tuple, %empty_tuple, %empty_tuple, %empty_tuple, %empty_tuple, %empty_tuple, %empty_tuple, %empty_tuple, %empty_tuple) [concrete]
  300. // CHECK:STDOUT: }
  301. // CHECK:STDOUT:
  302. // CHECK:STDOUT: file {
  303. // CHECK:STDOUT: name_binding_decl {
  304. // CHECK:STDOUT: %b.patt: %pattern_type.3db = binding_pattern b [concrete]
  305. // CHECK:STDOUT: %b.var_patt: %pattern_type.3db = var_pattern %b.patt [concrete]
  306. // CHECK:STDOUT: }
  307. // CHECK:STDOUT: %b.var: ref %array_type = var %b.var_patt [concrete]
  308. // CHECK:STDOUT: %.loc9_19: type = splice_block %array_type [concrete = constants.%array_type] {
  309. // CHECK:STDOUT: %.loc9_15.1: %empty_tuple.type = tuple_literal ()
  310. // CHECK:STDOUT: %int_9: Core.IntLiteral = int_value 9 [concrete = constants.%int_9]
  311. // CHECK:STDOUT: %.loc9_15.2: type = converted %.loc9_15.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  312. // CHECK:STDOUT: %array_type: type = array_type %int_9, %.loc9_15.2 [concrete = constants.%array_type]
  313. // CHECK:STDOUT: }
  314. // CHECK:STDOUT: %b: ref %array_type = bind_name b, %b.var [concrete = %b.var]
  315. // CHECK:STDOUT: }
  316. // CHECK:STDOUT:
  317. // CHECK:STDOUT: fn @__global_init() {
  318. // CHECK:STDOUT: !entry:
  319. // CHECK:STDOUT: <elided>
  320. // CHECK:STDOUT: %a.ref: ref %tuple.type = name_ref a, file.%a [concrete = file.%a.var]
  321. // CHECK:STDOUT: %tuple.elem0.loc9: ref %empty_tuple.type = tuple_access %a.ref, element0 [concrete = constants.%tuple.elem0]
  322. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0]
  323. // CHECK:STDOUT: %.loc9_23.1: ref %empty_tuple.type = array_index file.%b.var, %int_0
  324. // CHECK:STDOUT: %.loc9_23.2: init %empty_tuple.type = tuple_init () to %.loc9_23.1 [concrete = constants.%empty_tuple]
  325. // CHECK:STDOUT: %.loc9_23.3: init %empty_tuple.type = converted %tuple.elem0.loc9, %.loc9_23.2 [concrete = constants.%empty_tuple]
  326. // CHECK:STDOUT: %tuple.elem1.loc9: ref %empty_tuple.type = tuple_access %a.ref, element1 [concrete = constants.%tuple.elem1]
  327. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
  328. // CHECK:STDOUT: %.loc9_23.4: ref %empty_tuple.type = array_index file.%b.var, %int_1
  329. // CHECK:STDOUT: %.loc9_23.5: init %empty_tuple.type = tuple_init () to %.loc9_23.4 [concrete = constants.%empty_tuple]
  330. // CHECK:STDOUT: %.loc9_23.6: init %empty_tuple.type = converted %tuple.elem1.loc9, %.loc9_23.5 [concrete = constants.%empty_tuple]
  331. // CHECK:STDOUT: %tuple.elem2.loc9: ref %empty_tuple.type = tuple_access %a.ref, element2 [concrete = constants.%tuple.elem2]
  332. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2]
  333. // CHECK:STDOUT: %.loc9_23.7: ref %empty_tuple.type = array_index file.%b.var, %int_2
  334. // CHECK:STDOUT: %.loc9_23.8: init %empty_tuple.type = tuple_init () to %.loc9_23.7 [concrete = constants.%empty_tuple]
  335. // CHECK:STDOUT: %.loc9_23.9: init %empty_tuple.type = converted %tuple.elem2.loc9, %.loc9_23.8 [concrete = constants.%empty_tuple]
  336. // CHECK:STDOUT: %tuple.elem3.loc9: ref %empty_tuple.type = tuple_access %a.ref, element3 [concrete = constants.%tuple.elem3]
  337. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3]
  338. // CHECK:STDOUT: %.loc9_23.10: ref %empty_tuple.type = array_index file.%b.var, %int_3
  339. // CHECK:STDOUT: %.loc9_23.11: init %empty_tuple.type = tuple_init () to %.loc9_23.10 [concrete = constants.%empty_tuple]
  340. // CHECK:STDOUT: %.loc9_23.12: init %empty_tuple.type = converted %tuple.elem3.loc9, %.loc9_23.11 [concrete = constants.%empty_tuple]
  341. // CHECK:STDOUT: %tuple.elem4.loc9: ref %empty_tuple.type = tuple_access %a.ref, element4 [concrete = constants.%tuple.elem4]
  342. // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4]
  343. // CHECK:STDOUT: %.loc9_23.13: ref %empty_tuple.type = array_index file.%b.var, %int_4
  344. // CHECK:STDOUT: %.loc9_23.14: init %empty_tuple.type = tuple_init () to %.loc9_23.13 [concrete = constants.%empty_tuple]
  345. // CHECK:STDOUT: %.loc9_23.15: init %empty_tuple.type = converted %tuple.elem4.loc9, %.loc9_23.14 [concrete = constants.%empty_tuple]
  346. // CHECK:STDOUT: %tuple.elem5.loc9: ref %empty_tuple.type = tuple_access %a.ref, element5 [concrete = constants.%tuple.elem5]
  347. // CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [concrete = constants.%int_5]
  348. // CHECK:STDOUT: %.loc9_23.16: ref %empty_tuple.type = array_index file.%b.var, %int_5
  349. // CHECK:STDOUT: %.loc9_23.17: init %empty_tuple.type = tuple_init () to %.loc9_23.16 [concrete = constants.%empty_tuple]
  350. // CHECK:STDOUT: %.loc9_23.18: init %empty_tuple.type = converted %tuple.elem5.loc9, %.loc9_23.17 [concrete = constants.%empty_tuple]
  351. // CHECK:STDOUT: %tuple.elem6.loc9: ref %empty_tuple.type = tuple_access %a.ref, element6 [concrete = constants.%tuple.elem6]
  352. // CHECK:STDOUT: %int_6: Core.IntLiteral = int_value 6 [concrete = constants.%int_6]
  353. // CHECK:STDOUT: %.loc9_23.19: ref %empty_tuple.type = array_index file.%b.var, %int_6
  354. // CHECK:STDOUT: %.loc9_23.20: init %empty_tuple.type = tuple_init () to %.loc9_23.19 [concrete = constants.%empty_tuple]
  355. // CHECK:STDOUT: %.loc9_23.21: init %empty_tuple.type = converted %tuple.elem6.loc9, %.loc9_23.20 [concrete = constants.%empty_tuple]
  356. // CHECK:STDOUT: %tuple.elem7.loc9: ref %empty_tuple.type = tuple_access %a.ref, element7 [concrete = constants.%tuple.elem7]
  357. // CHECK:STDOUT: %int_7: Core.IntLiteral = int_value 7 [concrete = constants.%int_7]
  358. // CHECK:STDOUT: %.loc9_23.22: ref %empty_tuple.type = array_index file.%b.var, %int_7
  359. // CHECK:STDOUT: %.loc9_23.23: init %empty_tuple.type = tuple_init () to %.loc9_23.22 [concrete = constants.%empty_tuple]
  360. // CHECK:STDOUT: %.loc9_23.24: init %empty_tuple.type = converted %tuple.elem7.loc9, %.loc9_23.23 [concrete = constants.%empty_tuple]
  361. // CHECK:STDOUT: %tuple.elem8.loc9: ref %empty_tuple.type = tuple_access %a.ref, element8 [concrete = constants.%tuple.elem8]
  362. // CHECK:STDOUT: %int_8: Core.IntLiteral = int_value 8 [concrete = constants.%int_8]
  363. // CHECK:STDOUT: %.loc9_23.25: ref %empty_tuple.type = array_index file.%b.var, %int_8
  364. // CHECK:STDOUT: %.loc9_23.26: init %empty_tuple.type = tuple_init () to %.loc9_23.25 [concrete = constants.%empty_tuple]
  365. // CHECK:STDOUT: %.loc9_23.27: init %empty_tuple.type = converted %tuple.elem8.loc9, %.loc9_23.26 [concrete = constants.%empty_tuple]
  366. // CHECK:STDOUT: %.loc9_23.28: init %array_type = array_init (%.loc9_23.3, %.loc9_23.6, %.loc9_23.9, %.loc9_23.12, %.loc9_23.15, %.loc9_23.18, %.loc9_23.21, %.loc9_23.24, %.loc9_23.27) to file.%b.var [concrete = constants.%array]
  367. // CHECK:STDOUT: %.loc9_1: init %array_type = converted %a.ref, %.loc9_23.28 [concrete = constants.%array]
  368. // CHECK:STDOUT: assign file.%b.var, %.loc9_1
  369. // CHECK:STDOUT: <elided>
  370. // CHECK:STDOUT: }
  371. // CHECK:STDOUT: