tuple_pattern.carbon 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  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. // INCLUDE-FILE: toolchain/testing/min_prelude/destroy.carbon
  6. // EXTRA-ARGS: --custom-core
  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/tuple/min_prelude/tuple_pattern.carbon
  11. // TIP: To dump output, run:
  12. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/tuple/min_prelude/tuple_pattern.carbon
  13. // --- basic.carbon
  14. library "[[@TEST_NAME]]";
  15. fn F() {
  16. let (x: {}, y: {}) = ({}, {});
  17. var (a: {}, b: {});
  18. var (c: {}, d: {}) = ({}, {});
  19. }
  20. // --- variable.carbon
  21. library "[[@TEST_NAME]]";
  22. fn F() {
  23. var tuple: ({}, {}) = ({}, {});
  24. var (x: {}, y: {}) = tuple;
  25. }
  26. fn G() {
  27. let tuple: ({}, {}) = ({}, {});
  28. var (x: {}, y: {}) = tuple;
  29. }
  30. fn MakeTuple() -> ({}, {});
  31. fn H() {
  32. var (x: {}, y: {}) = MakeTuple();
  33. }
  34. // --- nested.carbon
  35. library "[[@TEST_NAME]]";
  36. fn F() {
  37. let (x: {}, (y: {}, z: {})) = ({}, ({}, {}));
  38. }
  39. // --- package_scope.carbon
  40. library "[[@TEST_NAME]]";
  41. let (x: {}, y: {}) = ({}, {});
  42. // --- fail_in_interface.carbon
  43. library "[[@TEST_NAME]]";
  44. interface I {
  45. // CHECK:STDERR: fail_in_interface.carbon:[[@LINE+12]]:8: error: found runtime binding pattern in associated constant declaration; expected a `:!` binding [ExpectedSymbolicBindingInAssociatedConstant]
  46. // CHECK:STDERR: let (x: {}, y: {});
  47. // CHECK:STDERR: ^~~~~
  48. // CHECK:STDERR:
  49. // CHECK:STDERR: fail_in_interface.carbon:[[@LINE+8]]:15: error: found runtime binding pattern in associated constant declaration; expected a `:!` binding [ExpectedSymbolicBindingInAssociatedConstant]
  50. // CHECK:STDERR: let (x: {}, y: {});
  51. // CHECK:STDERR: ^~~~~
  52. // CHECK:STDERR:
  53. // CHECK:STDERR: fail_in_interface.carbon:[[@LINE+4]]:7: error: found tuple pattern in associated constant declaration; expected symbolic binding pattern [ExpectedSingleBindingInAssociatedConstant]
  54. // CHECK:STDERR: let (x: {}, y: {});
  55. // CHECK:STDERR: ^~~~~~~~~~~~~~
  56. // CHECK:STDERR:
  57. let (x: {}, y: {});
  58. }
  59. // --- fail_in_class.carbon
  60. library "[[@TEST_NAME]]";
  61. class C {
  62. // CHECK:STDERR: fail_in_class.carbon:[[@LINE+8]]:7: error: expected identifier in field declaration [ExpectedFieldIdentifier]
  63. // CHECK:STDERR: var (x: {}, y: {});
  64. // CHECK:STDERR: ^
  65. // CHECK:STDERR:
  66. // CHECK:STDERR: fail_in_class.carbon:[[@LINE+4]]:3: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
  67. // CHECK:STDERR: var (x: {}, y: {});
  68. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
  69. // CHECK:STDERR:
  70. var (x: {}, y: {});
  71. }
  72. // --- fail_initializer_mismatch.carbon
  73. library "[[@TEST_NAME]]";
  74. // CHECK:STDERR: fail_initializer_mismatch.carbon:[[@LINE+4]]:5: error: tuple pattern expects 2 elements, but tuple literal has 1 [TuplePatternSizeDoesntMatchLiteral]
  75. // CHECK:STDERR: let (x: {}, y: {}) = ({},);
  76. // CHECK:STDERR: ^~~~~~~~~~~~~~
  77. // CHECK:STDERR:
  78. let (x: {}, y: {}) = ({},);
  79. // CHECK:STDERR: fail_initializer_mismatch.carbon:[[@LINE+4]]:5: error: tuple pattern expects 2 elements, but tuple literal has 3 [TuplePatternSizeDoesntMatchLiteral]
  80. // CHECK:STDERR: let (a: {}, b: {}) = ({}, {}, {});
  81. // CHECK:STDERR: ^~~~~~~~~~~~~~
  82. // CHECK:STDERR:
  83. let (a: {}, b: {}) = ({}, {}, {});
  84. // CHECK:STDOUT: --- basic.carbon
  85. // CHECK:STDOUT:
  86. // CHECK:STDOUT: constants {
  87. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  88. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  89. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  90. // CHECK:STDOUT: %pattern_type.a96: type = pattern_type %empty_struct_type [concrete]
  91. // CHECK:STDOUT: %tuple.type.b6b: type = tuple_type (%empty_struct_type, %empty_struct_type) [concrete]
  92. // CHECK:STDOUT: %pattern_type.de4: type = pattern_type %tuple.type.b6b [concrete]
  93. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  94. // CHECK:STDOUT: %tuple: %tuple.type.b6b = tuple_value (%empty_struct, %empty_struct) [concrete]
  95. // CHECK:STDOUT: }
  96. // CHECK:STDOUT:
  97. // CHECK:STDOUT: imports {
  98. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  99. // CHECK:STDOUT: import Core//prelude
  100. // CHECK:STDOUT: }
  101. // CHECK:STDOUT: }
  102. // CHECK:STDOUT:
  103. // CHECK:STDOUT: file {
  104. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  105. // CHECK:STDOUT: .Core = imports.%Core
  106. // CHECK:STDOUT: .F = %F.decl
  107. // CHECK:STDOUT: }
  108. // CHECK:STDOUT: %Core.import = import Core
  109. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  110. // CHECK:STDOUT: }
  111. // CHECK:STDOUT:
  112. // CHECK:STDOUT: fn @F() {
  113. // CHECK:STDOUT: !entry:
  114. // CHECK:STDOUT: name_binding_decl {
  115. // CHECK:STDOUT: %x.patt: %pattern_type.a96 = binding_pattern x [concrete]
  116. // CHECK:STDOUT: %y.patt: %pattern_type.a96 = binding_pattern y [concrete]
  117. // CHECK:STDOUT: %.loc5_20: %pattern_type.de4 = tuple_pattern (%x.patt, %y.patt) [concrete]
  118. // CHECK:STDOUT: }
  119. // CHECK:STDOUT: %.loc5_26.1: %empty_struct_type = struct_literal ()
  120. // CHECK:STDOUT: %.loc5_30.1: %empty_struct_type = struct_literal ()
  121. // CHECK:STDOUT: %.loc5_31: %tuple.type.b6b = tuple_literal (%.loc5_26.1, %.loc5_30.1)
  122. // CHECK:STDOUT: %.loc5_12.1: type = splice_block %.loc5_12.3 [concrete = constants.%empty_struct_type] {
  123. // CHECK:STDOUT: %.loc5_12.2: %empty_struct_type = struct_literal ()
  124. // CHECK:STDOUT: %.loc5_12.3: type = converted %.loc5_12.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  125. // CHECK:STDOUT: }
  126. // CHECK:STDOUT: %empty_struct.loc5_26: %empty_struct_type = struct_value () [concrete = constants.%empty_struct]
  127. // CHECK:STDOUT: %.loc5_26.2: %empty_struct_type = converted %.loc5_26.1, %empty_struct.loc5_26 [concrete = constants.%empty_struct]
  128. // CHECK:STDOUT: %x: %empty_struct_type = bind_name x, %.loc5_26.2
  129. // CHECK:STDOUT: %.loc5_19.1: type = splice_block %.loc5_19.3 [concrete = constants.%empty_struct_type] {
  130. // CHECK:STDOUT: %.loc5_19.2: %empty_struct_type = struct_literal ()
  131. // CHECK:STDOUT: %.loc5_19.3: type = converted %.loc5_19.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  132. // CHECK:STDOUT: }
  133. // CHECK:STDOUT: %empty_struct.loc5_30: %empty_struct_type = struct_value () [concrete = constants.%empty_struct]
  134. // CHECK:STDOUT: %.loc5_30.2: %empty_struct_type = converted %.loc5_30.1, %empty_struct.loc5_30 [concrete = constants.%empty_struct]
  135. // CHECK:STDOUT: %y: %empty_struct_type = bind_name y, %.loc5_30.2
  136. // CHECK:STDOUT: name_binding_decl {
  137. // CHECK:STDOUT: %a.patt: %pattern_type.a96 = binding_pattern a [concrete]
  138. // CHECK:STDOUT: %b.patt: %pattern_type.a96 = binding_pattern b [concrete]
  139. // CHECK:STDOUT: %.loc6_20: %pattern_type.de4 = tuple_pattern (%a.patt, %b.patt) [concrete]
  140. // CHECK:STDOUT: %.loc6_3: %pattern_type.de4 = var_pattern %.loc6_20 [concrete]
  141. // CHECK:STDOUT: }
  142. // CHECK:STDOUT: %.var.loc6: ref %tuple.type.b6b = var <none>
  143. // CHECK:STDOUT: %tuple.elem0.loc6: ref %empty_struct_type = tuple_access %.var.loc6, element0
  144. // CHECK:STDOUT: %tuple.elem1.loc6: ref %empty_struct_type = tuple_access %.var.loc6, element1
  145. // CHECK:STDOUT: %.loc6_12.1: type = splice_block %.loc6_12.3 [concrete = constants.%empty_struct_type] {
  146. // CHECK:STDOUT: %.loc6_12.2: %empty_struct_type = struct_literal ()
  147. // CHECK:STDOUT: %.loc6_12.3: type = converted %.loc6_12.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  148. // CHECK:STDOUT: }
  149. // CHECK:STDOUT: %a: ref %empty_struct_type = bind_name a, %tuple.elem0.loc6
  150. // CHECK:STDOUT: %.loc6_19.1: type = splice_block %.loc6_19.3 [concrete = constants.%empty_struct_type] {
  151. // CHECK:STDOUT: %.loc6_19.2: %empty_struct_type = struct_literal ()
  152. // CHECK:STDOUT: %.loc6_19.3: type = converted %.loc6_19.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  153. // CHECK:STDOUT: }
  154. // CHECK:STDOUT: %b: ref %empty_struct_type = bind_name b, %tuple.elem1.loc6
  155. // CHECK:STDOUT: name_binding_decl {
  156. // CHECK:STDOUT: %c.patt: %pattern_type.a96 = binding_pattern c [concrete]
  157. // CHECK:STDOUT: %d.patt: %pattern_type.a96 = binding_pattern d [concrete]
  158. // CHECK:STDOUT: %.loc7_20: %pattern_type.de4 = tuple_pattern (%c.patt, %d.patt) [concrete]
  159. // CHECK:STDOUT: %.loc7_3.1: %pattern_type.de4 = var_pattern %.loc7_20 [concrete]
  160. // CHECK:STDOUT: }
  161. // CHECK:STDOUT: %.var.loc7: ref %tuple.type.b6b = var <none>
  162. // CHECK:STDOUT: %.loc7_26.1: %empty_struct_type = struct_literal ()
  163. // CHECK:STDOUT: %.loc7_30.1: %empty_struct_type = struct_literal ()
  164. // CHECK:STDOUT: %.loc7_31.1: %tuple.type.b6b = tuple_literal (%.loc7_26.1, %.loc7_30.1)
  165. // CHECK:STDOUT: %tuple.elem0.loc7_31: ref %empty_struct_type = tuple_access %.var.loc7, element0
  166. // CHECK:STDOUT: %.loc7_26.2: init %empty_struct_type = struct_init () to %tuple.elem0.loc7_31 [concrete = constants.%empty_struct]
  167. // CHECK:STDOUT: %.loc7_31.2: init %empty_struct_type = converted %.loc7_26.1, %.loc7_26.2 [concrete = constants.%empty_struct]
  168. // CHECK:STDOUT: %tuple.elem1.loc7_31: ref %empty_struct_type = tuple_access %.var.loc7, element1
  169. // CHECK:STDOUT: %.loc7_30.2: init %empty_struct_type = struct_init () to %tuple.elem1.loc7_31 [concrete = constants.%empty_struct]
  170. // CHECK:STDOUT: %.loc7_31.3: init %empty_struct_type = converted %.loc7_30.1, %.loc7_30.2 [concrete = constants.%empty_struct]
  171. // CHECK:STDOUT: %.loc7_31.4: init %tuple.type.b6b = tuple_init (%.loc7_31.2, %.loc7_31.3) to %.var.loc7 [concrete = constants.%tuple]
  172. // CHECK:STDOUT: %.loc7_3.2: init %tuple.type.b6b = converted %.loc7_31.1, %.loc7_31.4 [concrete = constants.%tuple]
  173. // CHECK:STDOUT: assign %.var.loc7, %.loc7_3.2
  174. // CHECK:STDOUT: %tuple.elem0.loc7_3: ref %empty_struct_type = tuple_access %.var.loc7, element0
  175. // CHECK:STDOUT: %tuple.elem1.loc7_3: ref %empty_struct_type = tuple_access %.var.loc7, element1
  176. // CHECK:STDOUT: %.loc7_12.1: type = splice_block %.loc7_12.3 [concrete = constants.%empty_struct_type] {
  177. // CHECK:STDOUT: %.loc7_12.2: %empty_struct_type = struct_literal ()
  178. // CHECK:STDOUT: %.loc7_12.3: type = converted %.loc7_12.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  179. // CHECK:STDOUT: }
  180. // CHECK:STDOUT: %c: ref %empty_struct_type = bind_name c, %tuple.elem0.loc7_3
  181. // CHECK:STDOUT: %.loc7_19.1: type = splice_block %.loc7_19.3 [concrete = constants.%empty_struct_type] {
  182. // CHECK:STDOUT: %.loc7_19.2: %empty_struct_type = struct_literal ()
  183. // CHECK:STDOUT: %.loc7_19.3: type = converted %.loc7_19.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  184. // CHECK:STDOUT: }
  185. // CHECK:STDOUT: %d: ref %empty_struct_type = bind_name d, %tuple.elem1.loc7_3
  186. // CHECK:STDOUT: return
  187. // CHECK:STDOUT: }
  188. // CHECK:STDOUT:
  189. // CHECK:STDOUT: --- variable.carbon
  190. // CHECK:STDOUT:
  191. // CHECK:STDOUT: constants {
  192. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  193. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  194. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  195. // CHECK:STDOUT: %tuple.type.b6b: type = tuple_type (%empty_struct_type, %empty_struct_type) [concrete]
  196. // CHECK:STDOUT: %pattern_type.de4: type = pattern_type %tuple.type.b6b [concrete]
  197. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  198. // CHECK:STDOUT: %tuple: %tuple.type.b6b = tuple_value (%empty_struct, %empty_struct) [concrete]
  199. // CHECK:STDOUT: %pattern_type.a96: type = pattern_type %empty_struct_type [concrete]
  200. // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
  201. // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
  202. // CHECK:STDOUT: %MakeTuple.type: type = fn_type @MakeTuple [concrete]
  203. // CHECK:STDOUT: %MakeTuple: %MakeTuple.type = struct_value () [concrete]
  204. // CHECK:STDOUT: %H.type: type = fn_type @H [concrete]
  205. // CHECK:STDOUT: %H: %H.type = struct_value () [concrete]
  206. // CHECK:STDOUT: }
  207. // CHECK:STDOUT:
  208. // CHECK:STDOUT: imports {
  209. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  210. // CHECK:STDOUT: import Core//prelude
  211. // CHECK:STDOUT: }
  212. // CHECK:STDOUT: }
  213. // CHECK:STDOUT:
  214. // CHECK:STDOUT: file {
  215. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  216. // CHECK:STDOUT: .Core = imports.%Core
  217. // CHECK:STDOUT: .F = %F.decl
  218. // CHECK:STDOUT: .G = %G.decl
  219. // CHECK:STDOUT: .MakeTuple = %MakeTuple.decl
  220. // CHECK:STDOUT: .H = %H.decl
  221. // CHECK:STDOUT: }
  222. // CHECK:STDOUT: %Core.import = import Core
  223. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  224. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {} {}
  225. // CHECK:STDOUT: %MakeTuple.decl: %MakeTuple.type = fn_decl @MakeTuple [concrete = constants.%MakeTuple] {
  226. // CHECK:STDOUT: %return.patt: %pattern_type.de4 = return_slot_pattern [concrete]
  227. // CHECK:STDOUT: %return.param_patt: %pattern_type.de4 = out_param_pattern %return.patt, call_param0 [concrete]
  228. // CHECK:STDOUT: } {
  229. // CHECK:STDOUT: %.loc14_21: %empty_struct_type = struct_literal ()
  230. // CHECK:STDOUT: %.loc14_25: %empty_struct_type = struct_literal ()
  231. // CHECK:STDOUT: %.loc14_26.1: %tuple.type.b6b = tuple_literal (%.loc14_21, %.loc14_25)
  232. // CHECK:STDOUT: %.loc14_26.2: type = converted %.loc14_21, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  233. // CHECK:STDOUT: %.loc14_26.3: type = converted %.loc14_25, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  234. // CHECK:STDOUT: %.loc14_26.4: type = converted %.loc14_26.1, constants.%tuple.type.b6b [concrete = constants.%tuple.type.b6b]
  235. // CHECK:STDOUT: %return.param: ref %tuple.type.b6b = out_param call_param0
  236. // CHECK:STDOUT: %return: ref %tuple.type.b6b = return_slot %return.param
  237. // CHECK:STDOUT: }
  238. // CHECK:STDOUT: %H.decl: %H.type = fn_decl @H [concrete = constants.%H] {} {}
  239. // CHECK:STDOUT: }
  240. // CHECK:STDOUT:
  241. // CHECK:STDOUT: fn @F() {
  242. // CHECK:STDOUT: !entry:
  243. // CHECK:STDOUT: name_binding_decl {
  244. // CHECK:STDOUT: %tuple.patt: %pattern_type.de4 = binding_pattern tuple [concrete]
  245. // CHECK:STDOUT: %.loc5_3.1: %pattern_type.de4 = var_pattern %tuple.patt [concrete]
  246. // CHECK:STDOUT: }
  247. // CHECK:STDOUT: %tuple.var: ref %tuple.type.b6b = var tuple
  248. // CHECK:STDOUT: %.loc5_27.1: %empty_struct_type = struct_literal ()
  249. // CHECK:STDOUT: %.loc5_31.1: %empty_struct_type = struct_literal ()
  250. // CHECK:STDOUT: %.loc5_32.1: %tuple.type.b6b = tuple_literal (%.loc5_27.1, %.loc5_31.1)
  251. // CHECK:STDOUT: %tuple.elem0.loc5: ref %empty_struct_type = tuple_access %tuple.var, element0
  252. // CHECK:STDOUT: %.loc5_27.2: init %empty_struct_type = struct_init () to %tuple.elem0.loc5 [concrete = constants.%empty_struct]
  253. // CHECK:STDOUT: %.loc5_32.2: init %empty_struct_type = converted %.loc5_27.1, %.loc5_27.2 [concrete = constants.%empty_struct]
  254. // CHECK:STDOUT: %tuple.elem1.loc5: ref %empty_struct_type = tuple_access %tuple.var, element1
  255. // CHECK:STDOUT: %.loc5_31.2: init %empty_struct_type = struct_init () to %tuple.elem1.loc5 [concrete = constants.%empty_struct]
  256. // CHECK:STDOUT: %.loc5_32.3: init %empty_struct_type = converted %.loc5_31.1, %.loc5_31.2 [concrete = constants.%empty_struct]
  257. // CHECK:STDOUT: %.loc5_32.4: init %tuple.type.b6b = tuple_init (%.loc5_32.2, %.loc5_32.3) to %tuple.var [concrete = constants.%tuple]
  258. // CHECK:STDOUT: %.loc5_3.2: init %tuple.type.b6b = converted %.loc5_32.1, %.loc5_32.4 [concrete = constants.%tuple]
  259. // CHECK:STDOUT: assign %tuple.var, %.loc5_3.2
  260. // CHECK:STDOUT: %.loc5_21.1: type = splice_block %.loc5_21.5 [concrete = constants.%tuple.type.b6b] {
  261. // CHECK:STDOUT: %.loc5_16: %empty_struct_type = struct_literal ()
  262. // CHECK:STDOUT: %.loc5_20: %empty_struct_type = struct_literal ()
  263. // CHECK:STDOUT: %.loc5_21.2: %tuple.type.b6b = tuple_literal (%.loc5_16, %.loc5_20)
  264. // CHECK:STDOUT: %.loc5_21.3: type = converted %.loc5_16, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  265. // CHECK:STDOUT: %.loc5_21.4: type = converted %.loc5_20, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  266. // CHECK:STDOUT: %.loc5_21.5: type = converted %.loc5_21.2, constants.%tuple.type.b6b [concrete = constants.%tuple.type.b6b]
  267. // CHECK:STDOUT: }
  268. // CHECK:STDOUT: %tuple: ref %tuple.type.b6b = bind_name tuple, %tuple.var
  269. // CHECK:STDOUT: name_binding_decl {
  270. // CHECK:STDOUT: %x.patt: %pattern_type.a96 = binding_pattern x [concrete]
  271. // CHECK:STDOUT: %y.patt: %pattern_type.a96 = binding_pattern y [concrete]
  272. // CHECK:STDOUT: %.loc6_20: %pattern_type.de4 = tuple_pattern (%x.patt, %y.patt) [concrete]
  273. // CHECK:STDOUT: %.loc6_3.1: %pattern_type.de4 = var_pattern %.loc6_20 [concrete]
  274. // CHECK:STDOUT: }
  275. // CHECK:STDOUT: %.var: ref %tuple.type.b6b = var <none>
  276. // CHECK:STDOUT: %tuple.ref: ref %tuple.type.b6b = name_ref tuple, %tuple
  277. // CHECK:STDOUT: %tuple.elem0.loc6_24.1: ref %empty_struct_type = tuple_access %tuple.ref, element0
  278. // CHECK:STDOUT: %tuple.elem0.loc6_24.2: ref %empty_struct_type = tuple_access %.var, element0
  279. // CHECK:STDOUT: %.loc6_24.1: init %empty_struct_type = struct_init () to %tuple.elem0.loc6_24.2 [concrete = constants.%empty_struct]
  280. // CHECK:STDOUT: %.loc6_24.2: init %empty_struct_type = converted %tuple.elem0.loc6_24.1, %.loc6_24.1 [concrete = constants.%empty_struct]
  281. // CHECK:STDOUT: %tuple.elem1.loc6_24.1: ref %empty_struct_type = tuple_access %tuple.ref, element1
  282. // CHECK:STDOUT: %tuple.elem1.loc6_24.2: ref %empty_struct_type = tuple_access %.var, element1
  283. // CHECK:STDOUT: %.loc6_24.3: init %empty_struct_type = struct_init () to %tuple.elem1.loc6_24.2 [concrete = constants.%empty_struct]
  284. // CHECK:STDOUT: %.loc6_24.4: init %empty_struct_type = converted %tuple.elem1.loc6_24.1, %.loc6_24.3 [concrete = constants.%empty_struct]
  285. // CHECK:STDOUT: %.loc6_24.5: init %tuple.type.b6b = tuple_init (%.loc6_24.2, %.loc6_24.4) to %.var [concrete = constants.%tuple]
  286. // CHECK:STDOUT: %.loc6_3.2: init %tuple.type.b6b = converted %tuple.ref, %.loc6_24.5 [concrete = constants.%tuple]
  287. // CHECK:STDOUT: assign %.var, %.loc6_3.2
  288. // CHECK:STDOUT: %tuple.elem0.loc6_3: ref %empty_struct_type = tuple_access %.var, element0
  289. // CHECK:STDOUT: %tuple.elem1.loc6_3: ref %empty_struct_type = tuple_access %.var, element1
  290. // CHECK:STDOUT: %.loc6_12.1: type = splice_block %.loc6_12.3 [concrete = constants.%empty_struct_type] {
  291. // CHECK:STDOUT: %.loc6_12.2: %empty_struct_type = struct_literal ()
  292. // CHECK:STDOUT: %.loc6_12.3: type = converted %.loc6_12.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  293. // CHECK:STDOUT: }
  294. // CHECK:STDOUT: %x: ref %empty_struct_type = bind_name x, %tuple.elem0.loc6_3
  295. // CHECK:STDOUT: %.loc6_19.1: type = splice_block %.loc6_19.3 [concrete = constants.%empty_struct_type] {
  296. // CHECK:STDOUT: %.loc6_19.2: %empty_struct_type = struct_literal ()
  297. // CHECK:STDOUT: %.loc6_19.3: type = converted %.loc6_19.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  298. // CHECK:STDOUT: }
  299. // CHECK:STDOUT: %y: ref %empty_struct_type = bind_name y, %tuple.elem1.loc6_3
  300. // CHECK:STDOUT: return
  301. // CHECK:STDOUT: }
  302. // CHECK:STDOUT:
  303. // CHECK:STDOUT: fn @G() {
  304. // CHECK:STDOUT: !entry:
  305. // CHECK:STDOUT: name_binding_decl {
  306. // CHECK:STDOUT: %tuple.patt: %pattern_type.de4 = binding_pattern tuple [concrete]
  307. // CHECK:STDOUT: }
  308. // CHECK:STDOUT: %.loc10_27: %empty_struct_type = struct_literal ()
  309. // CHECK:STDOUT: %.loc10_31: %empty_struct_type = struct_literal ()
  310. // CHECK:STDOUT: %.loc10_32.1: %tuple.type.b6b = tuple_literal (%.loc10_27, %.loc10_31)
  311. // CHECK:STDOUT: %.loc10_21.1: type = splice_block %.loc10_21.5 [concrete = constants.%tuple.type.b6b] {
  312. // CHECK:STDOUT: %.loc10_16: %empty_struct_type = struct_literal ()
  313. // CHECK:STDOUT: %.loc10_20: %empty_struct_type = struct_literal ()
  314. // CHECK:STDOUT: %.loc10_21.2: %tuple.type.b6b = tuple_literal (%.loc10_16, %.loc10_20)
  315. // CHECK:STDOUT: %.loc10_21.3: type = converted %.loc10_16, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  316. // CHECK:STDOUT: %.loc10_21.4: type = converted %.loc10_20, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  317. // CHECK:STDOUT: %.loc10_21.5: type = converted %.loc10_21.2, constants.%tuple.type.b6b [concrete = constants.%tuple.type.b6b]
  318. // CHECK:STDOUT: }
  319. // CHECK:STDOUT: %empty_struct.loc10_27: %empty_struct_type = struct_value () [concrete = constants.%empty_struct]
  320. // CHECK:STDOUT: %.loc10_32.2: %empty_struct_type = converted %.loc10_27, %empty_struct.loc10_27 [concrete = constants.%empty_struct]
  321. // CHECK:STDOUT: %empty_struct.loc10_31: %empty_struct_type = struct_value () [concrete = constants.%empty_struct]
  322. // CHECK:STDOUT: %.loc10_32.3: %empty_struct_type = converted %.loc10_31, %empty_struct.loc10_31 [concrete = constants.%empty_struct]
  323. // CHECK:STDOUT: %tuple.loc10_32: %tuple.type.b6b = tuple_value (%.loc10_32.2, %.loc10_32.3) [concrete = constants.%tuple]
  324. // CHECK:STDOUT: %.loc10_32.4: %tuple.type.b6b = converted %.loc10_32.1, %tuple.loc10_32 [concrete = constants.%tuple]
  325. // CHECK:STDOUT: %tuple.loc10_7: %tuple.type.b6b = bind_name tuple, %.loc10_32.4
  326. // CHECK:STDOUT: name_binding_decl {
  327. // CHECK:STDOUT: %x.patt: %pattern_type.a96 = binding_pattern x [concrete]
  328. // CHECK:STDOUT: %y.patt: %pattern_type.a96 = binding_pattern y [concrete]
  329. // CHECK:STDOUT: %.loc11_20: %pattern_type.de4 = tuple_pattern (%x.patt, %y.patt) [concrete]
  330. // CHECK:STDOUT: %.loc11_3.1: %pattern_type.de4 = var_pattern %.loc11_20 [concrete]
  331. // CHECK:STDOUT: }
  332. // CHECK:STDOUT: %.var: ref %tuple.type.b6b = var <none>
  333. // CHECK:STDOUT: %tuple.ref: %tuple.type.b6b = name_ref tuple, %tuple.loc10_7
  334. // CHECK:STDOUT: %tuple.elem0.loc11_24.1: %empty_struct_type = tuple_access %tuple.ref, element0
  335. // CHECK:STDOUT: %tuple.elem0.loc11_24.2: ref %empty_struct_type = tuple_access %.var, element0
  336. // CHECK:STDOUT: %.loc11_24.1: init %empty_struct_type = struct_init () to %tuple.elem0.loc11_24.2 [concrete = constants.%empty_struct]
  337. // CHECK:STDOUT: %.loc11_24.2: init %empty_struct_type = converted %tuple.elem0.loc11_24.1, %.loc11_24.1 [concrete = constants.%empty_struct]
  338. // CHECK:STDOUT: %tuple.elem1.loc11_24.1: %empty_struct_type = tuple_access %tuple.ref, element1
  339. // CHECK:STDOUT: %tuple.elem1.loc11_24.2: ref %empty_struct_type = tuple_access %.var, element1
  340. // CHECK:STDOUT: %.loc11_24.3: init %empty_struct_type = struct_init () to %tuple.elem1.loc11_24.2 [concrete = constants.%empty_struct]
  341. // CHECK:STDOUT: %.loc11_24.4: init %empty_struct_type = converted %tuple.elem1.loc11_24.1, %.loc11_24.3 [concrete = constants.%empty_struct]
  342. // CHECK:STDOUT: %.loc11_24.5: init %tuple.type.b6b = tuple_init (%.loc11_24.2, %.loc11_24.4) to %.var [concrete = constants.%tuple]
  343. // CHECK:STDOUT: %.loc11_3.2: init %tuple.type.b6b = converted %tuple.ref, %.loc11_24.5 [concrete = constants.%tuple]
  344. // CHECK:STDOUT: assign %.var, %.loc11_3.2
  345. // CHECK:STDOUT: %tuple.elem0.loc11_3: ref %empty_struct_type = tuple_access %.var, element0
  346. // CHECK:STDOUT: %tuple.elem1.loc11_3: ref %empty_struct_type = tuple_access %.var, element1
  347. // CHECK:STDOUT: %.loc11_12.1: type = splice_block %.loc11_12.3 [concrete = constants.%empty_struct_type] {
  348. // CHECK:STDOUT: %.loc11_12.2: %empty_struct_type = struct_literal ()
  349. // CHECK:STDOUT: %.loc11_12.3: type = converted %.loc11_12.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  350. // CHECK:STDOUT: }
  351. // CHECK:STDOUT: %x: ref %empty_struct_type = bind_name x, %tuple.elem0.loc11_3
  352. // CHECK:STDOUT: %.loc11_19.1: type = splice_block %.loc11_19.3 [concrete = constants.%empty_struct_type] {
  353. // CHECK:STDOUT: %.loc11_19.2: %empty_struct_type = struct_literal ()
  354. // CHECK:STDOUT: %.loc11_19.3: type = converted %.loc11_19.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  355. // CHECK:STDOUT: }
  356. // CHECK:STDOUT: %y: ref %empty_struct_type = bind_name y, %tuple.elem1.loc11_3
  357. // CHECK:STDOUT: return
  358. // CHECK:STDOUT: }
  359. // CHECK:STDOUT:
  360. // CHECK:STDOUT: fn @MakeTuple() -> %return.param: %tuple.type.b6b;
  361. // CHECK:STDOUT:
  362. // CHECK:STDOUT: fn @H() {
  363. // CHECK:STDOUT: !entry:
  364. // CHECK:STDOUT: name_binding_decl {
  365. // CHECK:STDOUT: %x.patt: %pattern_type.a96 = binding_pattern x [concrete]
  366. // CHECK:STDOUT: %y.patt: %pattern_type.a96 = binding_pattern y [concrete]
  367. // CHECK:STDOUT: %.loc17_20: %pattern_type.de4 = tuple_pattern (%x.patt, %y.patt) [concrete]
  368. // CHECK:STDOUT: %.loc17_3.1: %pattern_type.de4 = var_pattern %.loc17_20 [concrete]
  369. // CHECK:STDOUT: }
  370. // CHECK:STDOUT: %.var: ref %tuple.type.b6b = var <none>
  371. // CHECK:STDOUT: %MakeTuple.ref: %MakeTuple.type = name_ref MakeTuple, file.%MakeTuple.decl [concrete = constants.%MakeTuple]
  372. // CHECK:STDOUT: %.loc17_3.2: ref %tuple.type.b6b = splice_block %.var {}
  373. // CHECK:STDOUT: %MakeTuple.call: init %tuple.type.b6b = call %MakeTuple.ref() to %.loc17_3.2
  374. // CHECK:STDOUT: assign %.var, %MakeTuple.call
  375. // CHECK:STDOUT: %tuple.elem0: ref %empty_struct_type = tuple_access %.var, element0
  376. // CHECK:STDOUT: %tuple.elem1: ref %empty_struct_type = tuple_access %.var, element1
  377. // CHECK:STDOUT: %.loc17_12.1: type = splice_block %.loc17_12.3 [concrete = constants.%empty_struct_type] {
  378. // CHECK:STDOUT: %.loc17_12.2: %empty_struct_type = struct_literal ()
  379. // CHECK:STDOUT: %.loc17_12.3: type = converted %.loc17_12.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  380. // CHECK:STDOUT: }
  381. // CHECK:STDOUT: %x: ref %empty_struct_type = bind_name x, %tuple.elem0
  382. // CHECK:STDOUT: %.loc17_19.1: type = splice_block %.loc17_19.3 [concrete = constants.%empty_struct_type] {
  383. // CHECK:STDOUT: %.loc17_19.2: %empty_struct_type = struct_literal ()
  384. // CHECK:STDOUT: %.loc17_19.3: type = converted %.loc17_19.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  385. // CHECK:STDOUT: }
  386. // CHECK:STDOUT: %y: ref %empty_struct_type = bind_name y, %tuple.elem1
  387. // CHECK:STDOUT: return
  388. // CHECK:STDOUT: }
  389. // CHECK:STDOUT:
  390. // CHECK:STDOUT: --- nested.carbon
  391. // CHECK:STDOUT:
  392. // CHECK:STDOUT: constants {
  393. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  394. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  395. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  396. // CHECK:STDOUT: %pattern_type.a96: type = pattern_type %empty_struct_type [concrete]
  397. // CHECK:STDOUT: %tuple.type.b6b: type = tuple_type (%empty_struct_type, %empty_struct_type) [concrete]
  398. // CHECK:STDOUT: %pattern_type.de4: type = pattern_type %tuple.type.b6b [concrete]
  399. // CHECK:STDOUT: %tuple.type.6ca: type = tuple_type (%empty_struct_type, %tuple.type.b6b) [concrete]
  400. // CHECK:STDOUT: %pattern_type.361: type = pattern_type %tuple.type.6ca [concrete]
  401. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  402. // CHECK:STDOUT: }
  403. // CHECK:STDOUT:
  404. // CHECK:STDOUT: imports {
  405. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  406. // CHECK:STDOUT: import Core//prelude
  407. // CHECK:STDOUT: }
  408. // CHECK:STDOUT: }
  409. // CHECK:STDOUT:
  410. // CHECK:STDOUT: file {
  411. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  412. // CHECK:STDOUT: .Core = imports.%Core
  413. // CHECK:STDOUT: .F = %F.decl
  414. // CHECK:STDOUT: }
  415. // CHECK:STDOUT: %Core.import = import Core
  416. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  417. // CHECK:STDOUT: }
  418. // CHECK:STDOUT:
  419. // CHECK:STDOUT: fn @F() {
  420. // CHECK:STDOUT: !entry:
  421. // CHECK:STDOUT: name_binding_decl {
  422. // CHECK:STDOUT: %x.patt: %pattern_type.a96 = binding_pattern x [concrete]
  423. // CHECK:STDOUT: %y.patt: %pattern_type.a96 = binding_pattern y [concrete]
  424. // CHECK:STDOUT: %z.patt: %pattern_type.a96 = binding_pattern z [concrete]
  425. // CHECK:STDOUT: %.loc5_28: %pattern_type.de4 = tuple_pattern (%y.patt, %z.patt) [concrete]
  426. // CHECK:STDOUT: %.loc5_29: %pattern_type.361 = tuple_pattern (%x.patt, %.loc5_28) [concrete]
  427. // CHECK:STDOUT: }
  428. // CHECK:STDOUT: %.loc5_35.1: %empty_struct_type = struct_literal ()
  429. // CHECK:STDOUT: %.loc5_40.1: %empty_struct_type = struct_literal ()
  430. // CHECK:STDOUT: %.loc5_44.1: %empty_struct_type = struct_literal ()
  431. // CHECK:STDOUT: %.loc5_45: %tuple.type.b6b = tuple_literal (%.loc5_40.1, %.loc5_44.1)
  432. // CHECK:STDOUT: %.loc5_46: %tuple.type.6ca = tuple_literal (%.loc5_35.1, %.loc5_45)
  433. // CHECK:STDOUT: %.loc5_12.1: type = splice_block %.loc5_12.3 [concrete = constants.%empty_struct_type] {
  434. // CHECK:STDOUT: %.loc5_12.2: %empty_struct_type = struct_literal ()
  435. // CHECK:STDOUT: %.loc5_12.3: type = converted %.loc5_12.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  436. // CHECK:STDOUT: }
  437. // CHECK:STDOUT: %empty_struct.loc5_35: %empty_struct_type = struct_value () [concrete = constants.%empty_struct]
  438. // CHECK:STDOUT: %.loc5_35.2: %empty_struct_type = converted %.loc5_35.1, %empty_struct.loc5_35 [concrete = constants.%empty_struct]
  439. // CHECK:STDOUT: %x: %empty_struct_type = bind_name x, %.loc5_35.2
  440. // CHECK:STDOUT: %.loc5_20.1: type = splice_block %.loc5_20.3 [concrete = constants.%empty_struct_type] {
  441. // CHECK:STDOUT: %.loc5_20.2: %empty_struct_type = struct_literal ()
  442. // CHECK:STDOUT: %.loc5_20.3: type = converted %.loc5_20.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  443. // CHECK:STDOUT: }
  444. // CHECK:STDOUT: %empty_struct.loc5_40: %empty_struct_type = struct_value () [concrete = constants.%empty_struct]
  445. // CHECK:STDOUT: %.loc5_40.2: %empty_struct_type = converted %.loc5_40.1, %empty_struct.loc5_40 [concrete = constants.%empty_struct]
  446. // CHECK:STDOUT: %y: %empty_struct_type = bind_name y, %.loc5_40.2
  447. // CHECK:STDOUT: %.loc5_27.1: type = splice_block %.loc5_27.3 [concrete = constants.%empty_struct_type] {
  448. // CHECK:STDOUT: %.loc5_27.2: %empty_struct_type = struct_literal ()
  449. // CHECK:STDOUT: %.loc5_27.3: type = converted %.loc5_27.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  450. // CHECK:STDOUT: }
  451. // CHECK:STDOUT: %empty_struct.loc5_44: %empty_struct_type = struct_value () [concrete = constants.%empty_struct]
  452. // CHECK:STDOUT: %.loc5_44.2: %empty_struct_type = converted %.loc5_44.1, %empty_struct.loc5_44 [concrete = constants.%empty_struct]
  453. // CHECK:STDOUT: %z: %empty_struct_type = bind_name z, %.loc5_44.2
  454. // CHECK:STDOUT: return
  455. // CHECK:STDOUT: }
  456. // CHECK:STDOUT:
  457. // CHECK:STDOUT: --- package_scope.carbon
  458. // CHECK:STDOUT:
  459. // CHECK:STDOUT: constants {
  460. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  461. // CHECK:STDOUT: %pattern_type.a96: type = pattern_type %empty_struct_type [concrete]
  462. // CHECK:STDOUT: %tuple.type: type = tuple_type (%empty_struct_type, %empty_struct_type) [concrete]
  463. // CHECK:STDOUT: %pattern_type.de4: type = pattern_type %tuple.type [concrete]
  464. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  465. // CHECK:STDOUT: }
  466. // CHECK:STDOUT:
  467. // CHECK:STDOUT: imports {
  468. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  469. // CHECK:STDOUT: import Core//prelude
  470. // CHECK:STDOUT: }
  471. // CHECK:STDOUT: }
  472. // CHECK:STDOUT:
  473. // CHECK:STDOUT: file {
  474. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  475. // CHECK:STDOUT: .Core = imports.%Core
  476. // CHECK:STDOUT: .x = %x
  477. // CHECK:STDOUT: .y = %y
  478. // CHECK:STDOUT: }
  479. // CHECK:STDOUT: %Core.import = import Core
  480. // CHECK:STDOUT: name_binding_decl {
  481. // CHECK:STDOUT: %x.patt: %pattern_type.a96 = binding_pattern x [concrete]
  482. // CHECK:STDOUT: %y.patt: %pattern_type.a96 = binding_pattern y [concrete]
  483. // CHECK:STDOUT: %.loc4_18: %pattern_type.de4 = tuple_pattern (%x.patt, %y.patt) [concrete]
  484. // CHECK:STDOUT: }
  485. // CHECK:STDOUT: %.loc4_10.1: type = splice_block %.loc4_10.3 [concrete = constants.%empty_struct_type] {
  486. // CHECK:STDOUT: %.loc4_10.2: %empty_struct_type = struct_literal ()
  487. // CHECK:STDOUT: %.loc4_10.3: type = converted %.loc4_10.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  488. // CHECK:STDOUT: }
  489. // CHECK:STDOUT: %empty_struct.loc4_24: %empty_struct_type = struct_value () [concrete = constants.%empty_struct]
  490. // CHECK:STDOUT: %.loc4_24: %empty_struct_type = converted @__global_init.%.loc4_24, %empty_struct.loc4_24 [concrete = constants.%empty_struct]
  491. // CHECK:STDOUT: %x: %empty_struct_type = bind_name x, %.loc4_24
  492. // CHECK:STDOUT: %.loc4_17.1: type = splice_block %.loc4_17.3 [concrete = constants.%empty_struct_type] {
  493. // CHECK:STDOUT: %.loc4_17.2: %empty_struct_type = struct_literal ()
  494. // CHECK:STDOUT: %.loc4_17.3: type = converted %.loc4_17.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  495. // CHECK:STDOUT: }
  496. // CHECK:STDOUT: %empty_struct.loc4_28: %empty_struct_type = struct_value () [concrete = constants.%empty_struct]
  497. // CHECK:STDOUT: %.loc4_28: %empty_struct_type = converted @__global_init.%.loc4_28, %empty_struct.loc4_28 [concrete = constants.%empty_struct]
  498. // CHECK:STDOUT: %y: %empty_struct_type = bind_name y, %.loc4_28
  499. // CHECK:STDOUT: }
  500. // CHECK:STDOUT:
  501. // CHECK:STDOUT: fn @__global_init() {
  502. // CHECK:STDOUT: !entry:
  503. // CHECK:STDOUT: %.loc4_24: %empty_struct_type = struct_literal ()
  504. // CHECK:STDOUT: %.loc4_28: %empty_struct_type = struct_literal ()
  505. // CHECK:STDOUT: %.loc4_29: %tuple.type = tuple_literal (%.loc4_24, %.loc4_28)
  506. // CHECK:STDOUT: return
  507. // CHECK:STDOUT: }
  508. // CHECK:STDOUT:
  509. // CHECK:STDOUT: --- fail_in_interface.carbon
  510. // CHECK:STDOUT:
  511. // CHECK:STDOUT: constants {
  512. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  513. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  514. // CHECK:STDOUT: }
  515. // CHECK:STDOUT:
  516. // CHECK:STDOUT: imports {
  517. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  518. // CHECK:STDOUT: import Core//prelude
  519. // CHECK:STDOUT: }
  520. // CHECK:STDOUT: }
  521. // CHECK:STDOUT:
  522. // CHECK:STDOUT: file {
  523. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  524. // CHECK:STDOUT: .Core = imports.%Core
  525. // CHECK:STDOUT: .I = %I.decl
  526. // CHECK:STDOUT: }
  527. // CHECK:STDOUT: %Core.import = import Core
  528. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  529. // CHECK:STDOUT: }
  530. // CHECK:STDOUT:
  531. // CHECK:STDOUT: interface @I {
  532. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  533. // CHECK:STDOUT:
  534. // CHECK:STDOUT: !members:
  535. // CHECK:STDOUT: .Self = %Self
  536. // CHECK:STDOUT: has_error
  537. // CHECK:STDOUT: witness = ()
  538. // CHECK:STDOUT: }
  539. // CHECK:STDOUT:
  540. // CHECK:STDOUT: --- fail_in_class.carbon
  541. // CHECK:STDOUT:
  542. // CHECK:STDOUT: constants {
  543. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  544. // CHECK:STDOUT: }
  545. // CHECK:STDOUT:
  546. // CHECK:STDOUT: file {}
  547. // CHECK:STDOUT:
  548. // CHECK:STDOUT: class @C {
  549. // CHECK:STDOUT: complete_type_witness = invalid
  550. // CHECK:STDOUT:
  551. // CHECK:STDOUT: !members:
  552. // CHECK:STDOUT: .Self = constants.%C
  553. // CHECK:STDOUT: }
  554. // CHECK:STDOUT:
  555. // CHECK:STDOUT: --- fail_initializer_mismatch.carbon
  556. // CHECK:STDOUT:
  557. // CHECK:STDOUT: constants {
  558. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  559. // CHECK:STDOUT: %pattern_type.a96: type = pattern_type %empty_struct_type [concrete]
  560. // CHECK:STDOUT: %tuple.type.b6b: type = tuple_type (%empty_struct_type, %empty_struct_type) [concrete]
  561. // CHECK:STDOUT: %pattern_type.de4: type = pattern_type %tuple.type.b6b [concrete]
  562. // CHECK:STDOUT: %tuple.type.572: type = tuple_type (%empty_struct_type) [concrete]
  563. // CHECK:STDOUT: %tuple.type.8d4: type = tuple_type (%empty_struct_type, %empty_struct_type, %empty_struct_type) [concrete]
  564. // CHECK:STDOUT: }
  565. // CHECK:STDOUT:
  566. // CHECK:STDOUT: imports {
  567. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  568. // CHECK:STDOUT: import Core//prelude
  569. // CHECK:STDOUT: }
  570. // CHECK:STDOUT: }
  571. // CHECK:STDOUT:
  572. // CHECK:STDOUT: file {
  573. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  574. // CHECK:STDOUT: .Core = imports.%Core
  575. // CHECK:STDOUT: .x = <unexpected>.inst21.loc8_6
  576. // CHECK:STDOUT: .y = <unexpected>.inst26.loc8_13
  577. // CHECK:STDOUT: .a = <unexpected>.inst37.loc14_6
  578. // CHECK:STDOUT: .b = <unexpected>.inst41.loc14_13
  579. // CHECK:STDOUT: }
  580. // CHECK:STDOUT: %Core.import = import Core
  581. // CHECK:STDOUT: name_binding_decl {
  582. // CHECK:STDOUT: %x.patt: %pattern_type.a96 = binding_pattern x [concrete]
  583. // CHECK:STDOUT: %y.patt: %pattern_type.a96 = binding_pattern y [concrete]
  584. // CHECK:STDOUT: %.loc8: %pattern_type.de4 = tuple_pattern (%x.patt, %y.patt) [concrete]
  585. // CHECK:STDOUT: }
  586. // CHECK:STDOUT: name_binding_decl {
  587. // CHECK:STDOUT: %a.patt: %pattern_type.a96 = binding_pattern a [concrete]
  588. // CHECK:STDOUT: %b.patt: %pattern_type.a96 = binding_pattern b [concrete]
  589. // CHECK:STDOUT: %.loc14: %pattern_type.de4 = tuple_pattern (%a.patt, %b.patt) [concrete]
  590. // CHECK:STDOUT: }
  591. // CHECK:STDOUT: }
  592. // CHECK:STDOUT:
  593. // CHECK:STDOUT: fn @__global_init() {
  594. // CHECK:STDOUT: !entry:
  595. // CHECK:STDOUT: %.loc8_24: %empty_struct_type = struct_literal ()
  596. // CHECK:STDOUT: %.loc8_26: %tuple.type.572 = tuple_literal (%.loc8_24)
  597. // CHECK:STDOUT: %.loc14_24: %empty_struct_type = struct_literal ()
  598. // CHECK:STDOUT: %.loc14_28: %empty_struct_type = struct_literal ()
  599. // CHECK:STDOUT: %.loc14_32: %empty_struct_type = struct_literal ()
  600. // CHECK:STDOUT: %.loc14_33: %tuple.type.8d4 = tuple_literal (%.loc14_24, %.loc14_28, %.loc14_32)
  601. // CHECK:STDOUT: return
  602. // CHECK:STDOUT: }
  603. // CHECK:STDOUT:
  604. // CHECK:STDOUT: --- include_files/destroy.carbon
  605. // CHECK:STDOUT:
  606. // CHECK:STDOUT: file {
  607. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {}
  608. // CHECK:STDOUT: }
  609. // CHECK:STDOUT: