tuple_pattern.carbon 37 KB

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