array.carbon 56 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896
  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. // AUTOUPDATE
  6. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/deduce/array.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/deduce/array.carbon
  10. // --- type_only.carbon
  11. library "[[@TEST_NAME]]";
  12. class C {}
  13. fn F[T:! type](a: [T; 3]) -> T { return a[0]; }
  14. fn G() -> C {
  15. var a: [C; 3] = ({}, {}, {});
  16. return F(a);
  17. }
  18. // --- fail_todo_bound_only.carbon
  19. library "[[@TEST_NAME]]";
  20. class C {}
  21. // CHECK:STDERR: fail_todo_bound_only.carbon:[[@LINE+4]]:22: error: semantics TODO: `symbolic array bound` [SemanticsTodo]
  22. // CHECK:STDERR: fn F[N:! i32](a: [C; N]) -> i32 { return N; }
  23. // CHECK:STDERR: ^
  24. // CHECK:STDERR:
  25. fn F[N:! i32](a: [C; N]) -> i32 { return N; }
  26. fn G() -> C {
  27. var a: [C; 3] = ({}, {}, {});
  28. return F(a);
  29. }
  30. // --- fail_todo_type_and_bound.carbon
  31. library "[[@TEST_NAME]]";
  32. class C {}
  33. // CHECK:STDERR: fail_todo_type_and_bound.carbon:[[@LINE+4]]:32: error: semantics TODO: `symbolic array bound` [SemanticsTodo]
  34. // CHECK:STDERR: fn F[T:! type, N:! i32](a: [T; N]) -> T;
  35. // CHECK:STDERR: ^
  36. // CHECK:STDERR:
  37. fn F[T:! type, N:! i32](a: [T; N]) -> T;
  38. fn G() -> C {
  39. var a: [C; 3] = ({}, {}, {});
  40. return F(a);
  41. }
  42. // --- fail_bound_mismatch.carbon
  43. library "[[@TEST_NAME]]";
  44. class C {}
  45. fn F[T:! type](a: [T; 2]) -> T { return a[0]; }
  46. fn G() -> C {
  47. // TODO: We succeed at deducing T here but fail to convert. Is this the right behavior?
  48. var a: [C; 3] = ({}, {}, {});
  49. // CHECK:STDERR: fail_bound_mismatch.carbon:[[@LINE+10]]:12: error: cannot implicitly convert from `[C; 3]` to `[C; 2]` [ImplicitAsConversionFailure]
  50. // CHECK:STDERR: return F(a);
  51. // CHECK:STDERR: ^
  52. // CHECK:STDERR: fail_bound_mismatch.carbon:[[@LINE+7]]:12: note: type `[C; 3]` does not implement interface `ImplicitAs([C; 2])` [MissingImplInMemberAccessNote]
  53. // CHECK:STDERR: return F(a);
  54. // CHECK:STDERR: ^
  55. // CHECK:STDERR: fail_bound_mismatch.carbon:[[@LINE-11]]:16: note: initializing function parameter [InCallToFunctionParam]
  56. // CHECK:STDERR: fn F[T:! type](a: [T; 2]) -> T { return a[0]; }
  57. // CHECK:STDERR: ^~~~~~~~~
  58. // CHECK:STDERR:
  59. return F(a);
  60. }
  61. // --- fail_type_mismatch.carbon
  62. library "[[@TEST_NAME]]";
  63. class C {}
  64. class D {}
  65. // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+3]]:22: error: semantics TODO: `symbolic array bound` [SemanticsTodo]
  66. // CHECK:STDERR: fn F[N:! i32](a: [C; N]) -> i32 { return N; }
  67. // CHECK:STDERR: ^
  68. fn F[N:! i32](a: [C; N]) -> i32 { return N; }
  69. fn G() -> C {
  70. var a: [D; 3] = ({}, {}, {});
  71. return F(a);
  72. }
  73. // CHECK:STDOUT: --- type_only.carbon
  74. // CHECK:STDOUT:
  75. // CHECK:STDOUT: constants {
  76. // CHECK:STDOUT: %C: type = class_type @C [template]
  77. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  78. // CHECK:STDOUT: %.2: <witness> = complete_type_witness %.1 [template]
  79. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  80. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  81. // CHECK:STDOUT: %.3: i32 = int_value 3 [template]
  82. // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template]
  83. // CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template]
  84. // CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template]
  85. // CHECK:STDOUT: %.27: <witness> = interface_witness (%Convert.15) [template]
  86. // CHECK:STDOUT: %.28: <bound method> = bound_method %.3, %Convert.15 [template]
  87. // CHECK:STDOUT: %.29: Core.IntLiteral = int_value 3 [template]
  88. // CHECK:STDOUT: %.30: type = array_type %.29, %T [symbolic]
  89. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  90. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  91. // CHECK:STDOUT: %.32: i32 = int_value 0 [template]
  92. // CHECK:STDOUT: %G.type: type = fn_type @G [template]
  93. // CHECK:STDOUT: %G: %G.type = struct_value () [template]
  94. // CHECK:STDOUT: %.34: type = array_type %.29, %C [template]
  95. // CHECK:STDOUT: %tuple.type: type = tuple_type (%.1, %.1, %.1) [template]
  96. // CHECK:STDOUT: %struct: %C = struct_value () [template]
  97. // CHECK:STDOUT: %.36: i32 = int_value 1 [template]
  98. // CHECK:STDOUT: %.37: i32 = int_value 2 [template]
  99. // CHECK:STDOUT: %array: %.34 = tuple_value (%struct, %struct, %struct) [template]
  100. // CHECK:STDOUT: %.38: <specific function> = specific_function %F, @F(%C) [template]
  101. // CHECK:STDOUT: }
  102. // CHECK:STDOUT:
  103. // CHECK:STDOUT: imports {
  104. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  105. // CHECK:STDOUT: .ImplicitAs = %import_ref.1
  106. // CHECK:STDOUT: import Core//prelude
  107. // CHECK:STDOUT: import Core//prelude/...
  108. // CHECK:STDOUT: }
  109. // CHECK:STDOUT: }
  110. // CHECK:STDOUT:
  111. // CHECK:STDOUT: file {
  112. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  113. // CHECK:STDOUT: .Core = imports.%Core
  114. // CHECK:STDOUT: .C = %C.decl
  115. // CHECK:STDOUT: .F = %F.decl
  116. // CHECK:STDOUT: .G = %G.decl
  117. // CHECK:STDOUT: }
  118. // CHECK:STDOUT: %Core.import = import Core
  119. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  120. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
  121. // CHECK:STDOUT: %T.patt.loc6_6.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_6.2 (constants.%T.patt)]
  122. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc6_6.1, runtime_param<invalid> [symbolic = %T.patt.loc6_6.2 (constants.%T.patt)]
  123. // CHECK:STDOUT: %a.patt: @F.%.loc6_24.2 (%.30) = binding_pattern a
  124. // CHECK:STDOUT: %a.param_patt: @F.%.loc6_24.2 (%.30) = value_param_pattern %a.patt, runtime_param0
  125. // CHECK:STDOUT: %return.patt: @F.%T.loc6_6.2 (%T) = return_slot_pattern
  126. // CHECK:STDOUT: %return.param_patt: @F.%T.loc6_6.2 (%T) = out_param_pattern %return.patt, runtime_param1
  127. // CHECK:STDOUT: } {
  128. // CHECK:STDOUT: %T.ref.loc6_20: type = name_ref T, %T.loc6_6.1 [symbolic = %T.loc6_6.2 (constants.%T)]
  129. // CHECK:STDOUT: %.loc6_23.1: i32 = int_value 3 [template = constants.%.3]
  130. // CHECK:STDOUT: %.loc6_23.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15]
  131. // CHECK:STDOUT: %.loc6_23.3: <bound method> = bound_method %.loc6_23.1, %.loc6_23.2 [template = constants.%.28]
  132. // CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc6_23.3(%.loc6_23.1) [template = constants.%.29]
  133. // CHECK:STDOUT: %.loc6_23.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.29]
  134. // CHECK:STDOUT: %.loc6_23.5: Core.IntLiteral = converted %.loc6_23.1, %.loc6_23.4 [template = constants.%.29]
  135. // CHECK:STDOUT: %.loc6_24.1: type = array_type %.loc6_23.5, %T [symbolic = %.loc6_24.2 (constants.%.30)]
  136. // CHECK:STDOUT: %T.ref.loc6_30: type = name_ref T, %T.loc6_6.1 [symbolic = %T.loc6_6.2 (constants.%T)]
  137. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  138. // CHECK:STDOUT: %T.loc6_6.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc6_6.2 (constants.%T)]
  139. // CHECK:STDOUT: %a.param: @F.%.loc6_24.2 (%.30) = value_param runtime_param0
  140. // CHECK:STDOUT: %a: @F.%.loc6_24.2 (%.30) = bind_name a, %a.param
  141. // CHECK:STDOUT: %return.param: ref @F.%T.loc6_6.2 (%T) = out_param runtime_param1
  142. // CHECK:STDOUT: %return: ref @F.%T.loc6_6.2 (%T) = return_slot %return.param
  143. // CHECK:STDOUT: }
  144. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
  145. // CHECK:STDOUT: %return.patt: %C = return_slot_pattern
  146. // CHECK:STDOUT: %return.param_patt: %C = out_param_pattern %return.patt, runtime_param0
  147. // CHECK:STDOUT: } {
  148. // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, file.%C.decl [template = constants.%C]
  149. // CHECK:STDOUT: %return.param: ref %C = out_param runtime_param0
  150. // CHECK:STDOUT: %return: ref %C = return_slot %return.param
  151. // CHECK:STDOUT: }
  152. // CHECK:STDOUT: }
  153. // CHECK:STDOUT:
  154. // CHECK:STDOUT: class @C {
  155. // CHECK:STDOUT: %.loc4: <witness> = complete_type_witness %.1 [template = constants.%.2]
  156. // CHECK:STDOUT:
  157. // CHECK:STDOUT: !members:
  158. // CHECK:STDOUT: .Self = constants.%C
  159. // CHECK:STDOUT: }
  160. // CHECK:STDOUT:
  161. // CHECK:STDOUT: generic fn @F(%T.loc6_6.1: type) {
  162. // CHECK:STDOUT: %T.loc6_6.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc6_6.2 (constants.%T)]
  163. // CHECK:STDOUT: %T.patt.loc6_6.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_6.2 (constants.%T.patt)]
  164. // CHECK:STDOUT: %.loc6_24.2: type = array_type constants.%.29, @F.%T.loc6_6.2 (%T) [symbolic = %.loc6_24.2 (constants.%.30)]
  165. // CHECK:STDOUT:
  166. // CHECK:STDOUT: !definition:
  167. // CHECK:STDOUT:
  168. // CHECK:STDOUT: fn[%T.param_patt: type](%a.param_patt: @F.%.loc6_24.2 (%.30)) -> @F.%T.loc6_6.2 (%T) {
  169. // CHECK:STDOUT: !entry:
  170. // CHECK:STDOUT: %a.ref: @F.%.loc6_24.2 (%.30) = name_ref a, %a
  171. // CHECK:STDOUT: %.loc6_43: i32 = int_value 0 [template = constants.%.32]
  172. // CHECK:STDOUT: %.loc6_44.1: ref @F.%.loc6_24.2 (%.30) = value_as_ref %a.ref
  173. // CHECK:STDOUT: %.loc6_44.2: ref @F.%T.loc6_6.2 (%T) = array_index %.loc6_44.1, %.loc6_43
  174. // CHECK:STDOUT: %.loc6_44.3: @F.%T.loc6_6.2 (%T) = bind_value %.loc6_44.2
  175. // CHECK:STDOUT: return %.loc6_44.3
  176. // CHECK:STDOUT: }
  177. // CHECK:STDOUT: }
  178. // CHECK:STDOUT:
  179. // CHECK:STDOUT: fn @G() -> %return: %C {
  180. // CHECK:STDOUT: !entry:
  181. // CHECK:STDOUT: %C.ref.loc9: type = name_ref C, file.%C.decl [template = constants.%C]
  182. // CHECK:STDOUT: %.loc9_14.1: i32 = int_value 3 [template = constants.%.3]
  183. // CHECK:STDOUT: %.loc9_14.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15]
  184. // CHECK:STDOUT: %.loc9_14.3: <bound method> = bound_method %.loc9_14.1, %.loc9_14.2 [template = constants.%.28]
  185. // CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc9_14.3(%.loc9_14.1) [template = constants.%.29]
  186. // CHECK:STDOUT: %.loc9_14.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.29]
  187. // CHECK:STDOUT: %.loc9_14.5: Core.IntLiteral = converted %.loc9_14.1, %.loc9_14.4 [template = constants.%.29]
  188. // CHECK:STDOUT: %.loc9_15: type = array_type %.loc9_14.5, %C [template = constants.%.34]
  189. // CHECK:STDOUT: %a.var: ref %.34 = var a
  190. // CHECK:STDOUT: %a: ref %.34 = bind_name a, %a.var
  191. // CHECK:STDOUT: %.loc9_21.1: %.1 = struct_literal ()
  192. // CHECK:STDOUT: %.loc9_25.1: %.1 = struct_literal ()
  193. // CHECK:STDOUT: %.loc9_29.1: %.1 = struct_literal ()
  194. // CHECK:STDOUT: %.loc9_30.1: %tuple.type = tuple_literal (%.loc9_21.1, %.loc9_25.1, %.loc9_29.1)
  195. // CHECK:STDOUT: %.loc9_30.2: i32 = int_value 0 [template = constants.%.32]
  196. // CHECK:STDOUT: %.loc9_30.3: ref %C = array_index %a.var, %.loc9_30.2
  197. // CHECK:STDOUT: %.loc9_21.2: init %C = class_init (), %.loc9_30.3 [template = constants.%struct]
  198. // CHECK:STDOUT: %.loc9_30.4: init %C = converted %.loc9_21.1, %.loc9_21.2 [template = constants.%struct]
  199. // CHECK:STDOUT: %.loc9_30.5: i32 = int_value 1 [template = constants.%.36]
  200. // CHECK:STDOUT: %.loc9_30.6: ref %C = array_index %a.var, %.loc9_30.5
  201. // CHECK:STDOUT: %.loc9_25.2: init %C = class_init (), %.loc9_30.6 [template = constants.%struct]
  202. // CHECK:STDOUT: %.loc9_30.7: init %C = converted %.loc9_25.1, %.loc9_25.2 [template = constants.%struct]
  203. // CHECK:STDOUT: %.loc9_30.8: i32 = int_value 2 [template = constants.%.37]
  204. // CHECK:STDOUT: %.loc9_30.9: ref %C = array_index %a.var, %.loc9_30.8
  205. // CHECK:STDOUT: %.loc9_29.2: init %C = class_init (), %.loc9_30.9 [template = constants.%struct]
  206. // CHECK:STDOUT: %.loc9_30.10: init %C = converted %.loc9_29.1, %.loc9_29.2 [template = constants.%struct]
  207. // CHECK:STDOUT: %.loc9_30.11: init %.34 = array_init (%.loc9_30.4, %.loc9_30.7, %.loc9_30.10) to %a.var [template = constants.%array]
  208. // CHECK:STDOUT: %.loc9_31: init %.34 = converted %.loc9_30.1, %.loc9_30.11 [template = constants.%array]
  209. // CHECK:STDOUT: assign %a.var, %.loc9_31
  210. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F]
  211. // CHECK:STDOUT: %a.ref: ref %.34 = name_ref a, %a
  212. // CHECK:STDOUT: %.loc10_10: <specific function> = specific_function %F.ref, @F(constants.%C) [template = constants.%.38]
  213. // CHECK:STDOUT: %.loc8_8.2: ref %C = splice_block %return {}
  214. // CHECK:STDOUT: %.loc10_12: %.34 = bind_value %a.ref
  215. // CHECK:STDOUT: %F.call: init %C = call %.loc10_10(%.loc10_12) to %.loc8_8.2
  216. // CHECK:STDOUT: return %F.call to %return
  217. // CHECK:STDOUT: }
  218. // CHECK:STDOUT:
  219. // CHECK:STDOUT: specific @F(constants.%T) {
  220. // CHECK:STDOUT: %T.loc6_6.2 => constants.%T
  221. // CHECK:STDOUT: %T.patt.loc6_6.2 => constants.%T
  222. // CHECK:STDOUT: %.loc6_24.2 => constants.%.30
  223. // CHECK:STDOUT: }
  224. // CHECK:STDOUT:
  225. // CHECK:STDOUT: specific @F(constants.%C) {
  226. // CHECK:STDOUT: %T.loc6_6.2 => constants.%C
  227. // CHECK:STDOUT: %T.patt.loc6_6.2 => constants.%C
  228. // CHECK:STDOUT: %.loc6_24.2 => constants.%.34
  229. // CHECK:STDOUT:
  230. // CHECK:STDOUT: !definition:
  231. // CHECK:STDOUT: }
  232. // CHECK:STDOUT:
  233. // CHECK:STDOUT: --- fail_todo_bound_only.carbon
  234. // CHECK:STDOUT:
  235. // CHECK:STDOUT: constants {
  236. // CHECK:STDOUT: %C: type = class_type @C [template]
  237. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  238. // CHECK:STDOUT: %.2: <witness> = complete_type_witness %.1 [template]
  239. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  240. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  241. // CHECK:STDOUT: %N.1: i32 = bind_symbolic_name N, 0 [symbolic]
  242. // CHECK:STDOUT: %N.patt.1: i32 = symbolic_binding_pattern N, 0 [symbolic]
  243. // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template]
  244. // CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template]
  245. // CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template]
  246. // CHECK:STDOUT: %.26: <witness> = interface_witness (%Convert.15) [template]
  247. // CHECK:STDOUT: %.27: <bound method> = bound_method %N.1, %Convert.15 [symbolic]
  248. // CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.27(%N.1) [symbolic]
  249. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  250. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  251. // CHECK:STDOUT: %G.type: type = fn_type @G [template]
  252. // CHECK:STDOUT: %G: %G.type = struct_value () [template]
  253. // CHECK:STDOUT: %.29: i32 = int_value 3 [template]
  254. // CHECK:STDOUT: %.30: <bound method> = bound_method %.29, %Convert.15 [template]
  255. // CHECK:STDOUT: %.31: Core.IntLiteral = int_value 3 [template]
  256. // CHECK:STDOUT: %.32: type = array_type %.31, %C [template]
  257. // CHECK:STDOUT: %tuple.type: type = tuple_type (%.1, %.1, %.1) [template]
  258. // CHECK:STDOUT: %.34: i32 = int_value 0 [template]
  259. // CHECK:STDOUT: %struct: %C = struct_value () [template]
  260. // CHECK:STDOUT: %.35: i32 = int_value 1 [template]
  261. // CHECK:STDOUT: %.36: i32 = int_value 2 [template]
  262. // CHECK:STDOUT: %array: %.32 = tuple_value (%struct, %struct, %struct) [template]
  263. // CHECK:STDOUT: }
  264. // CHECK:STDOUT:
  265. // CHECK:STDOUT: imports {
  266. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  267. // CHECK:STDOUT: .Int32 = %import_ref.1
  268. // CHECK:STDOUT: .ImplicitAs = %import_ref.2
  269. // CHECK:STDOUT: import Core//prelude
  270. // CHECK:STDOUT: import Core//prelude/...
  271. // CHECK:STDOUT: }
  272. // CHECK:STDOUT: }
  273. // CHECK:STDOUT:
  274. // CHECK:STDOUT: file {
  275. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  276. // CHECK:STDOUT: .Core = imports.%Core
  277. // CHECK:STDOUT: .C = %C.decl
  278. // CHECK:STDOUT: .F = %F.decl
  279. // CHECK:STDOUT: .G = %G.decl
  280. // CHECK:STDOUT: }
  281. // CHECK:STDOUT: %Core.import = import Core
  282. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  283. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
  284. // CHECK:STDOUT: %N.patt.loc10_6.1: i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc10_6.2 (constants.%N.patt.1)]
  285. // CHECK:STDOUT: %N.param_patt: i32 = value_param_pattern %N.patt.loc10_6.1, runtime_param<invalid> [symbolic = %N.patt.loc10_6.2 (constants.%N.patt.1)]
  286. // CHECK:STDOUT: %a.patt: <error> = binding_pattern a
  287. // CHECK:STDOUT: %a.param_patt: <error> = value_param_pattern %a.patt, runtime_param0
  288. // CHECK:STDOUT: %return.patt: i32 = return_slot_pattern
  289. // CHECK:STDOUT: %return.param_patt: i32 = out_param_pattern %return.patt, runtime_param1
  290. // CHECK:STDOUT: } {
  291. // CHECK:STDOUT: %int.make_type_32.loc10_10: init type = call constants.%Int32() [template = i32]
  292. // CHECK:STDOUT: %.loc10_10.1: type = value_of_initializer %int.make_type_32.loc10_10 [template = i32]
  293. // CHECK:STDOUT: %.loc10_10.2: type = converted %int.make_type_32.loc10_10, %.loc10_10.1 [template = i32]
  294. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  295. // CHECK:STDOUT: %N.ref.loc10_22: i32 = name_ref N, %N.loc10_6.1 [symbolic = %N.loc10_6.2 (constants.%N.1)]
  296. // CHECK:STDOUT: %.loc10_22.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15]
  297. // CHECK:STDOUT: %.loc10_22.2: <bound method> = bound_method %N.ref.loc10_22, %.loc10_22.1 [symbolic = %.loc10_22.5 (constants.%.27)]
  298. // CHECK:STDOUT: %int.convert_checked.loc10_22.1: init Core.IntLiteral = call %.loc10_22.2(%N.ref.loc10_22) [symbolic = %int.convert_checked.loc10_22.2 (constants.%int.convert_checked)]
  299. // CHECK:STDOUT: %.loc10_22.3: Core.IntLiteral = value_of_initializer %int.convert_checked.loc10_22.1 [symbolic = %int.convert_checked.loc10_22.2 (constants.%int.convert_checked)]
  300. // CHECK:STDOUT: %.loc10_22.4: Core.IntLiteral = converted %N.ref.loc10_22, %.loc10_22.3 [symbolic = %int.convert_checked.loc10_22.2 (constants.%int.convert_checked)]
  301. // CHECK:STDOUT: %.loc10_23: type = array_type %.loc10_22.4, %C [template = <error>]
  302. // CHECK:STDOUT: %int.make_type_32.loc10_29: init type = call constants.%Int32() [template = i32]
  303. // CHECK:STDOUT: %.loc10_29.1: type = value_of_initializer %int.make_type_32.loc10_29 [template = i32]
  304. // CHECK:STDOUT: %.loc10_29.2: type = converted %int.make_type_32.loc10_29, %.loc10_29.1 [template = i32]
  305. // CHECK:STDOUT: %N.param: i32 = value_param runtime_param<invalid>
  306. // CHECK:STDOUT: %N.loc10_6.1: i32 = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc10_6.2 (constants.%N.1)]
  307. // CHECK:STDOUT: %a.param: <error> = value_param runtime_param0
  308. // CHECK:STDOUT: %a: <error> = bind_name a, %a.param
  309. // CHECK:STDOUT: %return.param: ref i32 = out_param runtime_param1
  310. // CHECK:STDOUT: %return: ref i32 = return_slot %return.param
  311. // CHECK:STDOUT: }
  312. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
  313. // CHECK:STDOUT: %return.patt: %C = return_slot_pattern
  314. // CHECK:STDOUT: %return.param_patt: %C = out_param_pattern %return.patt, runtime_param0
  315. // CHECK:STDOUT: } {
  316. // CHECK:STDOUT: %C.ref.loc12: type = name_ref C, file.%C.decl [template = constants.%C]
  317. // CHECK:STDOUT: %return.param: ref %C = out_param runtime_param0
  318. // CHECK:STDOUT: %return: ref %C = return_slot %return.param
  319. // CHECK:STDOUT: }
  320. // CHECK:STDOUT: }
  321. // CHECK:STDOUT:
  322. // CHECK:STDOUT: class @C {
  323. // CHECK:STDOUT: %.loc4: <witness> = complete_type_witness %.1 [template = constants.%.2]
  324. // CHECK:STDOUT:
  325. // CHECK:STDOUT: !members:
  326. // CHECK:STDOUT: .Self = constants.%C
  327. // CHECK:STDOUT: }
  328. // CHECK:STDOUT:
  329. // CHECK:STDOUT: generic fn @F(%N.loc10_6.1: i32) {
  330. // CHECK:STDOUT: %N.loc10_6.2: i32 = bind_symbolic_name N, 0 [symbolic = %N.loc10_6.2 (constants.%N.1)]
  331. // CHECK:STDOUT: %N.patt.loc10_6.2: i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc10_6.2 (constants.%N.patt.1)]
  332. // CHECK:STDOUT: %.loc10_22.5: <bound method> = bound_method %N.loc10_6.2, constants.%Convert.15 [symbolic = %.loc10_22.5 (constants.%.27)]
  333. // CHECK:STDOUT: %int.convert_checked.loc10_22.2: init Core.IntLiteral = call %.loc10_22.5(%N.loc10_6.2) [symbolic = %int.convert_checked.loc10_22.2 (constants.%int.convert_checked)]
  334. // CHECK:STDOUT:
  335. // CHECK:STDOUT: !definition:
  336. // CHECK:STDOUT:
  337. // CHECK:STDOUT: fn[%N.param_patt: i32](%a.param_patt: <error>) -> i32 {
  338. // CHECK:STDOUT: !entry:
  339. // CHECK:STDOUT: %N.ref.loc10_42: i32 = name_ref N, %N.loc10_6.1 [symbolic = %N.loc10_6.2 (constants.%N.1)]
  340. // CHECK:STDOUT: return %N.ref.loc10_42
  341. // CHECK:STDOUT: }
  342. // CHECK:STDOUT: }
  343. // CHECK:STDOUT:
  344. // CHECK:STDOUT: fn @G() -> %return: %C {
  345. // CHECK:STDOUT: !entry:
  346. // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, file.%C.decl [template = constants.%C]
  347. // CHECK:STDOUT: %.loc13_14.1: i32 = int_value 3 [template = constants.%.29]
  348. // CHECK:STDOUT: %.loc13_14.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15]
  349. // CHECK:STDOUT: %.loc13_14.3: <bound method> = bound_method %.loc13_14.1, %.loc13_14.2 [template = constants.%.30]
  350. // CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc13_14.3(%.loc13_14.1) [template = constants.%.31]
  351. // CHECK:STDOUT: %.loc13_14.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.31]
  352. // CHECK:STDOUT: %.loc13_14.5: Core.IntLiteral = converted %.loc13_14.1, %.loc13_14.4 [template = constants.%.31]
  353. // CHECK:STDOUT: %.loc13_15: type = array_type %.loc13_14.5, %C [template = constants.%.32]
  354. // CHECK:STDOUT: %a.var: ref %.32 = var a
  355. // CHECK:STDOUT: %a: ref %.32 = bind_name a, %a.var
  356. // CHECK:STDOUT: %.loc13_21.1: %.1 = struct_literal ()
  357. // CHECK:STDOUT: %.loc13_25.1: %.1 = struct_literal ()
  358. // CHECK:STDOUT: %.loc13_29.1: %.1 = struct_literal ()
  359. // CHECK:STDOUT: %.loc13_30.1: %tuple.type = tuple_literal (%.loc13_21.1, %.loc13_25.1, %.loc13_29.1)
  360. // CHECK:STDOUT: %.loc13_30.2: i32 = int_value 0 [template = constants.%.34]
  361. // CHECK:STDOUT: %.loc13_30.3: ref %C = array_index %a.var, %.loc13_30.2
  362. // CHECK:STDOUT: %.loc13_21.2: init %C = class_init (), %.loc13_30.3 [template = constants.%struct]
  363. // CHECK:STDOUT: %.loc13_30.4: init %C = converted %.loc13_21.1, %.loc13_21.2 [template = constants.%struct]
  364. // CHECK:STDOUT: %.loc13_30.5: i32 = int_value 1 [template = constants.%.35]
  365. // CHECK:STDOUT: %.loc13_30.6: ref %C = array_index %a.var, %.loc13_30.5
  366. // CHECK:STDOUT: %.loc13_25.2: init %C = class_init (), %.loc13_30.6 [template = constants.%struct]
  367. // CHECK:STDOUT: %.loc13_30.7: init %C = converted %.loc13_25.1, %.loc13_25.2 [template = constants.%struct]
  368. // CHECK:STDOUT: %.loc13_30.8: i32 = int_value 2 [template = constants.%.36]
  369. // CHECK:STDOUT: %.loc13_30.9: ref %C = array_index %a.var, %.loc13_30.8
  370. // CHECK:STDOUT: %.loc13_29.2: init %C = class_init (), %.loc13_30.9 [template = constants.%struct]
  371. // CHECK:STDOUT: %.loc13_30.10: init %C = converted %.loc13_29.1, %.loc13_29.2 [template = constants.%struct]
  372. // CHECK:STDOUT: %.loc13_30.11: init %.32 = array_init (%.loc13_30.4, %.loc13_30.7, %.loc13_30.10) to %a.var [template = constants.%array]
  373. // CHECK:STDOUT: %.loc13_31: init %.32 = converted %.loc13_30.1, %.loc13_30.11 [template = constants.%array]
  374. // CHECK:STDOUT: assign %a.var, %.loc13_31
  375. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F]
  376. // CHECK:STDOUT: %a.ref: ref %.32 = name_ref a, %a
  377. // CHECK:STDOUT: return <error> to %return
  378. // CHECK:STDOUT: }
  379. // CHECK:STDOUT:
  380. // CHECK:STDOUT: specific @F(constants.%N.1) {
  381. // CHECK:STDOUT: %N.loc10_6.2 => constants.%N.1
  382. // CHECK:STDOUT: %N.patt.loc10_6.2 => constants.%N.1
  383. // CHECK:STDOUT: %.loc10_22.5 => constants.%.27
  384. // CHECK:STDOUT: %int.convert_checked.loc10_22.2 => constants.%int.convert_checked
  385. // CHECK:STDOUT: }
  386. // CHECK:STDOUT:
  387. // CHECK:STDOUT: --- fail_todo_type_and_bound.carbon
  388. // CHECK:STDOUT:
  389. // CHECK:STDOUT: constants {
  390. // CHECK:STDOUT: %C: type = class_type @C [template]
  391. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  392. // CHECK:STDOUT: %.2: <witness> = complete_type_witness %.1 [template]
  393. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  394. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  395. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  396. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  397. // CHECK:STDOUT: %N.1: i32 = bind_symbolic_name N, 1 [symbolic]
  398. // CHECK:STDOUT: %N.patt.1: i32 = symbolic_binding_pattern N, 1 [symbolic]
  399. // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template]
  400. // CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template]
  401. // CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template]
  402. // CHECK:STDOUT: %.26: <witness> = interface_witness (%Convert.15) [template]
  403. // CHECK:STDOUT: %.27: <bound method> = bound_method %N.1, %Convert.15 [symbolic]
  404. // CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.27(%N.1) [symbolic]
  405. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  406. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  407. // CHECK:STDOUT: %G.type: type = fn_type @G [template]
  408. // CHECK:STDOUT: %G: %G.type = struct_value () [template]
  409. // CHECK:STDOUT: %.29: i32 = int_value 3 [template]
  410. // CHECK:STDOUT: %.30: <bound method> = bound_method %.29, %Convert.15 [template]
  411. // CHECK:STDOUT: %.31: Core.IntLiteral = int_value 3 [template]
  412. // CHECK:STDOUT: %.32: type = array_type %.31, %C [template]
  413. // CHECK:STDOUT: %tuple.type: type = tuple_type (%.1, %.1, %.1) [template]
  414. // CHECK:STDOUT: %.34: i32 = int_value 0 [template]
  415. // CHECK:STDOUT: %struct: %C = struct_value () [template]
  416. // CHECK:STDOUT: %.35: i32 = int_value 1 [template]
  417. // CHECK:STDOUT: %.36: i32 = int_value 2 [template]
  418. // CHECK:STDOUT: %array: %.32 = tuple_value (%struct, %struct, %struct) [template]
  419. // CHECK:STDOUT: }
  420. // CHECK:STDOUT:
  421. // CHECK:STDOUT: imports {
  422. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  423. // CHECK:STDOUT: .Int32 = %import_ref.1
  424. // CHECK:STDOUT: .ImplicitAs = %import_ref.2
  425. // CHECK:STDOUT: import Core//prelude
  426. // CHECK:STDOUT: import Core//prelude/...
  427. // CHECK:STDOUT: }
  428. // CHECK:STDOUT: }
  429. // CHECK:STDOUT:
  430. // CHECK:STDOUT: file {
  431. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  432. // CHECK:STDOUT: .Core = imports.%Core
  433. // CHECK:STDOUT: .C = %C.decl
  434. // CHECK:STDOUT: .F = %F.decl
  435. // CHECK:STDOUT: .G = %G.decl
  436. // CHECK:STDOUT: }
  437. // CHECK:STDOUT: %Core.import = import Core
  438. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  439. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
  440. // CHECK:STDOUT: %T.patt.loc10_6.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_6.2 (constants.%T.patt)]
  441. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc10_6.1, runtime_param<invalid> [symbolic = %T.patt.loc10_6.2 (constants.%T.patt)]
  442. // CHECK:STDOUT: %N.patt.loc10_16.1: i32 = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc10_16.2 (constants.%N.patt.1)]
  443. // CHECK:STDOUT: %N.param_patt: i32 = value_param_pattern %N.patt.loc10_16.1, runtime_param<invalid> [symbolic = %N.patt.loc10_16.2 (constants.%N.patt.1)]
  444. // CHECK:STDOUT: %a.patt: <error> = binding_pattern a
  445. // CHECK:STDOUT: %a.param_patt: <error> = value_param_pattern %a.patt, runtime_param0
  446. // CHECK:STDOUT: %return.patt: @F.%T.loc10_6.2 (%T) = return_slot_pattern
  447. // CHECK:STDOUT: %return.param_patt: @F.%T.loc10_6.2 (%T) = out_param_pattern %return.patt, runtime_param1
  448. // CHECK:STDOUT: } {
  449. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  450. // CHECK:STDOUT: %.loc10_20.1: type = value_of_initializer %int.make_type_32 [template = i32]
  451. // CHECK:STDOUT: %.loc10_20.2: type = converted %int.make_type_32, %.loc10_20.1 [template = i32]
  452. // CHECK:STDOUT: %T.ref.loc10_29: type = name_ref T, %T.loc10_6.1 [symbolic = %T.loc10_6.2 (constants.%T)]
  453. // CHECK:STDOUT: %N.ref: i32 = name_ref N, %N.loc10_16.1 [symbolic = %N.loc10_16.2 (constants.%N.1)]
  454. // CHECK:STDOUT: %.loc10_32.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15]
  455. // CHECK:STDOUT: %.loc10_32.2: <bound method> = bound_method %N.ref, %.loc10_32.1 [symbolic = %.loc10_32.5 (constants.%.27)]
  456. // CHECK:STDOUT: %int.convert_checked.loc10_32.1: init Core.IntLiteral = call %.loc10_32.2(%N.ref) [symbolic = %int.convert_checked.loc10_32.2 (constants.%int.convert_checked)]
  457. // CHECK:STDOUT: %.loc10_32.3: Core.IntLiteral = value_of_initializer %int.convert_checked.loc10_32.1 [symbolic = %int.convert_checked.loc10_32.2 (constants.%int.convert_checked)]
  458. // CHECK:STDOUT: %.loc10_32.4: Core.IntLiteral = converted %N.ref, %.loc10_32.3 [symbolic = %int.convert_checked.loc10_32.2 (constants.%int.convert_checked)]
  459. // CHECK:STDOUT: %.loc10_33: type = array_type %.loc10_32.4, %T [template = <error>]
  460. // CHECK:STDOUT: %T.ref.loc10_39: type = name_ref T, %T.loc10_6.1 [symbolic = %T.loc10_6.2 (constants.%T)]
  461. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  462. // CHECK:STDOUT: %T.loc10_6.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc10_6.2 (constants.%T)]
  463. // CHECK:STDOUT: %N.param: i32 = value_param runtime_param<invalid>
  464. // CHECK:STDOUT: %N.loc10_16.1: i32 = bind_symbolic_name N, 1, %N.param [symbolic = %N.loc10_16.2 (constants.%N.1)]
  465. // CHECK:STDOUT: %a.param: <error> = value_param runtime_param0
  466. // CHECK:STDOUT: %a: <error> = bind_name a, %a.param
  467. // CHECK:STDOUT: %return.param: ref @F.%T.loc10_6.2 (%T) = out_param runtime_param1
  468. // CHECK:STDOUT: %return: ref @F.%T.loc10_6.2 (%T) = return_slot %return.param
  469. // CHECK:STDOUT: }
  470. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
  471. // CHECK:STDOUT: %return.patt: %C = return_slot_pattern
  472. // CHECK:STDOUT: %return.param_patt: %C = out_param_pattern %return.patt, runtime_param0
  473. // CHECK:STDOUT: } {
  474. // CHECK:STDOUT: %C.ref.loc12: type = name_ref C, file.%C.decl [template = constants.%C]
  475. // CHECK:STDOUT: %return.param: ref %C = out_param runtime_param0
  476. // CHECK:STDOUT: %return: ref %C = return_slot %return.param
  477. // CHECK:STDOUT: }
  478. // CHECK:STDOUT: }
  479. // CHECK:STDOUT:
  480. // CHECK:STDOUT: class @C {
  481. // CHECK:STDOUT: %.loc4: <witness> = complete_type_witness %.1 [template = constants.%.2]
  482. // CHECK:STDOUT:
  483. // CHECK:STDOUT: !members:
  484. // CHECK:STDOUT: .Self = constants.%C
  485. // CHECK:STDOUT: }
  486. // CHECK:STDOUT:
  487. // CHECK:STDOUT: generic fn @F(%T.loc10_6.1: type, %N.loc10_16.1: i32) {
  488. // CHECK:STDOUT: %T.loc10_6.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc10_6.2 (constants.%T)]
  489. // CHECK:STDOUT: %T.patt.loc10_6.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_6.2 (constants.%T.patt)]
  490. // CHECK:STDOUT: %N.loc10_16.2: i32 = bind_symbolic_name N, 1 [symbolic = %N.loc10_16.2 (constants.%N.1)]
  491. // CHECK:STDOUT: %N.patt.loc10_16.2: i32 = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc10_16.2 (constants.%N.patt.1)]
  492. // CHECK:STDOUT: %.loc10_32.5: <bound method> = bound_method %N.loc10_16.2, constants.%Convert.15 [symbolic = %.loc10_32.5 (constants.%.27)]
  493. // CHECK:STDOUT: %int.convert_checked.loc10_32.2: init Core.IntLiteral = call %.loc10_32.5(%N.loc10_16.2) [symbolic = %int.convert_checked.loc10_32.2 (constants.%int.convert_checked)]
  494. // CHECK:STDOUT:
  495. // CHECK:STDOUT: fn[%T.param_patt: type, %N.param_patt: i32](%a.param_patt: <error>) -> @F.%T.loc10_6.2 (%T);
  496. // CHECK:STDOUT: }
  497. // CHECK:STDOUT:
  498. // CHECK:STDOUT: fn @G() -> %return: %C {
  499. // CHECK:STDOUT: !entry:
  500. // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, file.%C.decl [template = constants.%C]
  501. // CHECK:STDOUT: %.loc13_14.1: i32 = int_value 3 [template = constants.%.29]
  502. // CHECK:STDOUT: %.loc13_14.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15]
  503. // CHECK:STDOUT: %.loc13_14.3: <bound method> = bound_method %.loc13_14.1, %.loc13_14.2 [template = constants.%.30]
  504. // CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc13_14.3(%.loc13_14.1) [template = constants.%.31]
  505. // CHECK:STDOUT: %.loc13_14.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.31]
  506. // CHECK:STDOUT: %.loc13_14.5: Core.IntLiteral = converted %.loc13_14.1, %.loc13_14.4 [template = constants.%.31]
  507. // CHECK:STDOUT: %.loc13_15: type = array_type %.loc13_14.5, %C [template = constants.%.32]
  508. // CHECK:STDOUT: %a.var: ref %.32 = var a
  509. // CHECK:STDOUT: %a: ref %.32 = bind_name a, %a.var
  510. // CHECK:STDOUT: %.loc13_21.1: %.1 = struct_literal ()
  511. // CHECK:STDOUT: %.loc13_25.1: %.1 = struct_literal ()
  512. // CHECK:STDOUT: %.loc13_29.1: %.1 = struct_literal ()
  513. // CHECK:STDOUT: %.loc13_30.1: %tuple.type = tuple_literal (%.loc13_21.1, %.loc13_25.1, %.loc13_29.1)
  514. // CHECK:STDOUT: %.loc13_30.2: i32 = int_value 0 [template = constants.%.34]
  515. // CHECK:STDOUT: %.loc13_30.3: ref %C = array_index %a.var, %.loc13_30.2
  516. // CHECK:STDOUT: %.loc13_21.2: init %C = class_init (), %.loc13_30.3 [template = constants.%struct]
  517. // CHECK:STDOUT: %.loc13_30.4: init %C = converted %.loc13_21.1, %.loc13_21.2 [template = constants.%struct]
  518. // CHECK:STDOUT: %.loc13_30.5: i32 = int_value 1 [template = constants.%.35]
  519. // CHECK:STDOUT: %.loc13_30.6: ref %C = array_index %a.var, %.loc13_30.5
  520. // CHECK:STDOUT: %.loc13_25.2: init %C = class_init (), %.loc13_30.6 [template = constants.%struct]
  521. // CHECK:STDOUT: %.loc13_30.7: init %C = converted %.loc13_25.1, %.loc13_25.2 [template = constants.%struct]
  522. // CHECK:STDOUT: %.loc13_30.8: i32 = int_value 2 [template = constants.%.36]
  523. // CHECK:STDOUT: %.loc13_30.9: ref %C = array_index %a.var, %.loc13_30.8
  524. // CHECK:STDOUT: %.loc13_29.2: init %C = class_init (), %.loc13_30.9 [template = constants.%struct]
  525. // CHECK:STDOUT: %.loc13_30.10: init %C = converted %.loc13_29.1, %.loc13_29.2 [template = constants.%struct]
  526. // CHECK:STDOUT: %.loc13_30.11: init %.32 = array_init (%.loc13_30.4, %.loc13_30.7, %.loc13_30.10) to %a.var [template = constants.%array]
  527. // CHECK:STDOUT: %.loc13_31: init %.32 = converted %.loc13_30.1, %.loc13_30.11 [template = constants.%array]
  528. // CHECK:STDOUT: assign %a.var, %.loc13_31
  529. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F]
  530. // CHECK:STDOUT: %a.ref: ref %.32 = name_ref a, %a
  531. // CHECK:STDOUT: return <error> to %return
  532. // CHECK:STDOUT: }
  533. // CHECK:STDOUT:
  534. // CHECK:STDOUT: specific @F(constants.%T, constants.%N.1) {
  535. // CHECK:STDOUT: %T.loc10_6.2 => constants.%T
  536. // CHECK:STDOUT: %T.patt.loc10_6.2 => constants.%T
  537. // CHECK:STDOUT: %N.loc10_16.2 => constants.%N.1
  538. // CHECK:STDOUT: %N.patt.loc10_16.2 => constants.%N.1
  539. // CHECK:STDOUT: %.loc10_32.5 => constants.%.27
  540. // CHECK:STDOUT: %int.convert_checked.loc10_32.2 => constants.%int.convert_checked
  541. // CHECK:STDOUT: }
  542. // CHECK:STDOUT:
  543. // CHECK:STDOUT: --- fail_bound_mismatch.carbon
  544. // CHECK:STDOUT:
  545. // CHECK:STDOUT: constants {
  546. // CHECK:STDOUT: %C: type = class_type @C [template]
  547. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  548. // CHECK:STDOUT: %.2: <witness> = complete_type_witness %.1 [template]
  549. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  550. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  551. // CHECK:STDOUT: %.3: i32 = int_value 2 [template]
  552. // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template]
  553. // CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template]
  554. // CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template]
  555. // CHECK:STDOUT: %.27: <witness> = interface_witness (%Convert.15) [template]
  556. // CHECK:STDOUT: %.28: <bound method> = bound_method %.3, %Convert.15 [template]
  557. // CHECK:STDOUT: %.29: Core.IntLiteral = int_value 2 [template]
  558. // CHECK:STDOUT: %.30: type = array_type %.29, %T [symbolic]
  559. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  560. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  561. // CHECK:STDOUT: %.32: i32 = int_value 0 [template]
  562. // CHECK:STDOUT: %G.type: type = fn_type @G [template]
  563. // CHECK:STDOUT: %G: %G.type = struct_value () [template]
  564. // CHECK:STDOUT: %.34: i32 = int_value 3 [template]
  565. // CHECK:STDOUT: %.35: <bound method> = bound_method %.34, %Convert.15 [template]
  566. // CHECK:STDOUT: %.36: Core.IntLiteral = int_value 3 [template]
  567. // CHECK:STDOUT: %.37: type = array_type %.36, %C [template]
  568. // CHECK:STDOUT: %tuple.type: type = tuple_type (%.1, %.1, %.1) [template]
  569. // CHECK:STDOUT: %struct: %C = struct_value () [template]
  570. // CHECK:STDOUT: %.39: i32 = int_value 1 [template]
  571. // CHECK:STDOUT: %array: %.37 = tuple_value (%struct, %struct, %struct) [template]
  572. // CHECK:STDOUT: %.40: type = array_type %.29, %C [template]
  573. // CHECK:STDOUT: %.41: <specific function> = specific_function %F, @F(%C) [template]
  574. // CHECK:STDOUT: }
  575. // CHECK:STDOUT:
  576. // CHECK:STDOUT: imports {
  577. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  578. // CHECK:STDOUT: .ImplicitAs = %import_ref.1
  579. // CHECK:STDOUT: import Core//prelude
  580. // CHECK:STDOUT: import Core//prelude/...
  581. // CHECK:STDOUT: }
  582. // CHECK:STDOUT: }
  583. // CHECK:STDOUT:
  584. // CHECK:STDOUT: file {
  585. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  586. // CHECK:STDOUT: .Core = imports.%Core
  587. // CHECK:STDOUT: .C = %C.decl
  588. // CHECK:STDOUT: .F = %F.decl
  589. // CHECK:STDOUT: .G = %G.decl
  590. // CHECK:STDOUT: }
  591. // CHECK:STDOUT: %Core.import = import Core
  592. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  593. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
  594. // CHECK:STDOUT: %T.patt.loc6_6.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_6.2 (constants.%T.patt)]
  595. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc6_6.1, runtime_param<invalid> [symbolic = %T.patt.loc6_6.2 (constants.%T.patt)]
  596. // CHECK:STDOUT: %a.patt: @F.%.loc6_24.2 (%.30) = binding_pattern a
  597. // CHECK:STDOUT: %a.param_patt: @F.%.loc6_24.2 (%.30) = value_param_pattern %a.patt, runtime_param0
  598. // CHECK:STDOUT: %return.patt: @F.%T.loc6_6.2 (%T) = return_slot_pattern
  599. // CHECK:STDOUT: %return.param_patt: @F.%T.loc6_6.2 (%T) = out_param_pattern %return.patt, runtime_param1
  600. // CHECK:STDOUT: } {
  601. // CHECK:STDOUT: %T.ref.loc6_20: type = name_ref T, %T.loc6_6.1 [symbolic = %T.loc6_6.2 (constants.%T)]
  602. // CHECK:STDOUT: %.loc6_23.1: i32 = int_value 2 [template = constants.%.3]
  603. // CHECK:STDOUT: %.loc6_23.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15]
  604. // CHECK:STDOUT: %.loc6_23.3: <bound method> = bound_method %.loc6_23.1, %.loc6_23.2 [template = constants.%.28]
  605. // CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc6_23.3(%.loc6_23.1) [template = constants.%.29]
  606. // CHECK:STDOUT: %.loc6_23.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.29]
  607. // CHECK:STDOUT: %.loc6_23.5: Core.IntLiteral = converted %.loc6_23.1, %.loc6_23.4 [template = constants.%.29]
  608. // CHECK:STDOUT: %.loc6_24.1: type = array_type %.loc6_23.5, %T [symbolic = %.loc6_24.2 (constants.%.30)]
  609. // CHECK:STDOUT: %T.ref.loc6_30: type = name_ref T, %T.loc6_6.1 [symbolic = %T.loc6_6.2 (constants.%T)]
  610. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  611. // CHECK:STDOUT: %T.loc6_6.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc6_6.2 (constants.%T)]
  612. // CHECK:STDOUT: %a.param: @F.%.loc6_24.2 (%.30) = value_param runtime_param0
  613. // CHECK:STDOUT: %a: @F.%.loc6_24.2 (%.30) = bind_name a, %a.param
  614. // CHECK:STDOUT: %return.param: ref @F.%T.loc6_6.2 (%T) = out_param runtime_param1
  615. // CHECK:STDOUT: %return: ref @F.%T.loc6_6.2 (%T) = return_slot %return.param
  616. // CHECK:STDOUT: }
  617. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
  618. // CHECK:STDOUT: %return.patt: %C = return_slot_pattern
  619. // CHECK:STDOUT: %return.param_patt: %C = out_param_pattern %return.patt, runtime_param0
  620. // CHECK:STDOUT: } {
  621. // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, file.%C.decl [template = constants.%C]
  622. // CHECK:STDOUT: %return.param: ref %C = out_param runtime_param0
  623. // CHECK:STDOUT: %return: ref %C = return_slot %return.param
  624. // CHECK:STDOUT: }
  625. // CHECK:STDOUT: }
  626. // CHECK:STDOUT:
  627. // CHECK:STDOUT: class @C {
  628. // CHECK:STDOUT: %.loc4: <witness> = complete_type_witness %.1 [template = constants.%.2]
  629. // CHECK:STDOUT:
  630. // CHECK:STDOUT: !members:
  631. // CHECK:STDOUT: .Self = constants.%C
  632. // CHECK:STDOUT: }
  633. // CHECK:STDOUT:
  634. // CHECK:STDOUT: generic fn @F(%T.loc6_6.1: type) {
  635. // CHECK:STDOUT: %T.loc6_6.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc6_6.2 (constants.%T)]
  636. // CHECK:STDOUT: %T.patt.loc6_6.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_6.2 (constants.%T.patt)]
  637. // CHECK:STDOUT: %.loc6_24.2: type = array_type constants.%.29, @F.%T.loc6_6.2 (%T) [symbolic = %.loc6_24.2 (constants.%.30)]
  638. // CHECK:STDOUT:
  639. // CHECK:STDOUT: !definition:
  640. // CHECK:STDOUT:
  641. // CHECK:STDOUT: fn[%T.param_patt: type](%a.param_patt: @F.%.loc6_24.2 (%.30)) -> @F.%T.loc6_6.2 (%T) {
  642. // CHECK:STDOUT: !entry:
  643. // CHECK:STDOUT: %a.ref: @F.%.loc6_24.2 (%.30) = name_ref a, %a
  644. // CHECK:STDOUT: %.loc6_43: i32 = int_value 0 [template = constants.%.32]
  645. // CHECK:STDOUT: %.loc6_44.1: ref @F.%.loc6_24.2 (%.30) = value_as_ref %a.ref
  646. // CHECK:STDOUT: %.loc6_44.2: ref @F.%T.loc6_6.2 (%T) = array_index %.loc6_44.1, %.loc6_43
  647. // CHECK:STDOUT: %.loc6_44.3: @F.%T.loc6_6.2 (%T) = bind_value %.loc6_44.2
  648. // CHECK:STDOUT: return %.loc6_44.3
  649. // CHECK:STDOUT: }
  650. // CHECK:STDOUT: }
  651. // CHECK:STDOUT:
  652. // CHECK:STDOUT: fn @G() -> %return: %C {
  653. // CHECK:STDOUT: !entry:
  654. // CHECK:STDOUT: %C.ref.loc10: type = name_ref C, file.%C.decl [template = constants.%C]
  655. // CHECK:STDOUT: %.loc10_14.1: i32 = int_value 3 [template = constants.%.34]
  656. // CHECK:STDOUT: %.loc10_14.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15]
  657. // CHECK:STDOUT: %.loc10_14.3: <bound method> = bound_method %.loc10_14.1, %.loc10_14.2 [template = constants.%.35]
  658. // CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc10_14.3(%.loc10_14.1) [template = constants.%.36]
  659. // CHECK:STDOUT: %.loc10_14.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.36]
  660. // CHECK:STDOUT: %.loc10_14.5: Core.IntLiteral = converted %.loc10_14.1, %.loc10_14.4 [template = constants.%.36]
  661. // CHECK:STDOUT: %.loc10_15: type = array_type %.loc10_14.5, %C [template = constants.%.37]
  662. // CHECK:STDOUT: %a.var: ref %.37 = var a
  663. // CHECK:STDOUT: %a: ref %.37 = bind_name a, %a.var
  664. // CHECK:STDOUT: %.loc10_21.1: %.1 = struct_literal ()
  665. // CHECK:STDOUT: %.loc10_25.1: %.1 = struct_literal ()
  666. // CHECK:STDOUT: %.loc10_29.1: %.1 = struct_literal ()
  667. // CHECK:STDOUT: %.loc10_30.1: %tuple.type = tuple_literal (%.loc10_21.1, %.loc10_25.1, %.loc10_29.1)
  668. // CHECK:STDOUT: %.loc10_30.2: i32 = int_value 0 [template = constants.%.32]
  669. // CHECK:STDOUT: %.loc10_30.3: ref %C = array_index %a.var, %.loc10_30.2
  670. // CHECK:STDOUT: %.loc10_21.2: init %C = class_init (), %.loc10_30.3 [template = constants.%struct]
  671. // CHECK:STDOUT: %.loc10_30.4: init %C = converted %.loc10_21.1, %.loc10_21.2 [template = constants.%struct]
  672. // CHECK:STDOUT: %.loc10_30.5: i32 = int_value 1 [template = constants.%.39]
  673. // CHECK:STDOUT: %.loc10_30.6: ref %C = array_index %a.var, %.loc10_30.5
  674. // CHECK:STDOUT: %.loc10_25.2: init %C = class_init (), %.loc10_30.6 [template = constants.%struct]
  675. // CHECK:STDOUT: %.loc10_30.7: init %C = converted %.loc10_25.1, %.loc10_25.2 [template = constants.%struct]
  676. // CHECK:STDOUT: %.loc10_30.8: i32 = int_value 2 [template = constants.%.3]
  677. // CHECK:STDOUT: %.loc10_30.9: ref %C = array_index %a.var, %.loc10_30.8
  678. // CHECK:STDOUT: %.loc10_29.2: init %C = class_init (), %.loc10_30.9 [template = constants.%struct]
  679. // CHECK:STDOUT: %.loc10_30.10: init %C = converted %.loc10_29.1, %.loc10_29.2 [template = constants.%struct]
  680. // CHECK:STDOUT: %.loc10_30.11: init %.37 = array_init (%.loc10_30.4, %.loc10_30.7, %.loc10_30.10) to %a.var [template = constants.%array]
  681. // CHECK:STDOUT: %.loc10_31: init %.37 = converted %.loc10_30.1, %.loc10_30.11 [template = constants.%array]
  682. // CHECK:STDOUT: assign %a.var, %.loc10_31
  683. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F]
  684. // CHECK:STDOUT: %a.ref: ref %.37 = name_ref a, %a
  685. // CHECK:STDOUT: %.loc21_10: <specific function> = specific_function %F.ref, @F(constants.%C) [template = constants.%.41]
  686. // CHECK:STDOUT: %.loc8_8.2: ref %C = splice_block %return {}
  687. // CHECK:STDOUT: %.loc21_12: %.40 = converted %a.ref, <error> [template = <error>]
  688. // CHECK:STDOUT: %F.call: init %C = call %.loc21_10(<error>) to %.loc8_8.2
  689. // CHECK:STDOUT: return %F.call to %return
  690. // CHECK:STDOUT: }
  691. // CHECK:STDOUT:
  692. // CHECK:STDOUT: specific @F(constants.%T) {
  693. // CHECK:STDOUT: %T.loc6_6.2 => constants.%T
  694. // CHECK:STDOUT: %T.patt.loc6_6.2 => constants.%T
  695. // CHECK:STDOUT: %.loc6_24.2 => constants.%.30
  696. // CHECK:STDOUT: }
  697. // CHECK:STDOUT:
  698. // CHECK:STDOUT: specific @F(constants.%C) {
  699. // CHECK:STDOUT: %T.loc6_6.2 => constants.%C
  700. // CHECK:STDOUT: %T.patt.loc6_6.2 => constants.%C
  701. // CHECK:STDOUT: %.loc6_24.2 => constants.%.40
  702. // CHECK:STDOUT:
  703. // CHECK:STDOUT: !definition:
  704. // CHECK:STDOUT: }
  705. // CHECK:STDOUT:
  706. // CHECK:STDOUT: --- fail_type_mismatch.carbon
  707. // CHECK:STDOUT:
  708. // CHECK:STDOUT: constants {
  709. // CHECK:STDOUT: %C: type = class_type @C [template]
  710. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  711. // CHECK:STDOUT: %.2: <witness> = complete_type_witness %.1 [template]
  712. // CHECK:STDOUT: %D: type = class_type @D [template]
  713. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  714. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  715. // CHECK:STDOUT: %N.1: i32 = bind_symbolic_name N, 0 [symbolic]
  716. // CHECK:STDOUT: %N.patt.1: i32 = symbolic_binding_pattern N, 0 [symbolic]
  717. // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template]
  718. // CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template]
  719. // CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template]
  720. // CHECK:STDOUT: %.26: <witness> = interface_witness (%Convert.15) [template]
  721. // CHECK:STDOUT: %.27: <bound method> = bound_method %N.1, %Convert.15 [symbolic]
  722. // CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.27(%N.1) [symbolic]
  723. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  724. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  725. // CHECK:STDOUT: %G.type: type = fn_type @G [template]
  726. // CHECK:STDOUT: %G: %G.type = struct_value () [template]
  727. // CHECK:STDOUT: %.29: i32 = int_value 3 [template]
  728. // CHECK:STDOUT: %.30: <bound method> = bound_method %.29, %Convert.15 [template]
  729. // CHECK:STDOUT: %.31: Core.IntLiteral = int_value 3 [template]
  730. // CHECK:STDOUT: %.32: type = array_type %.31, %D [template]
  731. // CHECK:STDOUT: %tuple.type: type = tuple_type (%.1, %.1, %.1) [template]
  732. // CHECK:STDOUT: %.34: i32 = int_value 0 [template]
  733. // CHECK:STDOUT: %struct: %D = struct_value () [template]
  734. // CHECK:STDOUT: %.35: i32 = int_value 1 [template]
  735. // CHECK:STDOUT: %.36: i32 = int_value 2 [template]
  736. // CHECK:STDOUT: %array: %.32 = tuple_value (%struct, %struct, %struct) [template]
  737. // CHECK:STDOUT: }
  738. // CHECK:STDOUT:
  739. // CHECK:STDOUT: imports {
  740. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  741. // CHECK:STDOUT: .Int32 = %import_ref.1
  742. // CHECK:STDOUT: .ImplicitAs = %import_ref.2
  743. // CHECK:STDOUT: import Core//prelude
  744. // CHECK:STDOUT: import Core//prelude/...
  745. // CHECK:STDOUT: }
  746. // CHECK:STDOUT: }
  747. // CHECK:STDOUT:
  748. // CHECK:STDOUT: file {
  749. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  750. // CHECK:STDOUT: .Core = imports.%Core
  751. // CHECK:STDOUT: .C = %C.decl
  752. // CHECK:STDOUT: .D = %D.decl
  753. // CHECK:STDOUT: .F = %F.decl
  754. // CHECK:STDOUT: .G = %G.decl
  755. // CHECK:STDOUT: }
  756. // CHECK:STDOUT: %Core.import = import Core
  757. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  758. // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} {}
  759. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
  760. // CHECK:STDOUT: %N.patt.loc10_6.1: i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc10_6.2 (constants.%N.patt.1)]
  761. // CHECK:STDOUT: %N.param_patt: i32 = value_param_pattern %N.patt.loc10_6.1, runtime_param<invalid> [symbolic = %N.patt.loc10_6.2 (constants.%N.patt.1)]
  762. // CHECK:STDOUT: %a.patt: <error> = binding_pattern a
  763. // CHECK:STDOUT: %a.param_patt: <error> = value_param_pattern %a.patt, runtime_param0
  764. // CHECK:STDOUT: %return.patt: i32 = return_slot_pattern
  765. // CHECK:STDOUT: %return.param_patt: i32 = out_param_pattern %return.patt, runtime_param1
  766. // CHECK:STDOUT: } {
  767. // CHECK:STDOUT: %int.make_type_32.loc10_10: init type = call constants.%Int32() [template = i32]
  768. // CHECK:STDOUT: %.loc10_10.1: type = value_of_initializer %int.make_type_32.loc10_10 [template = i32]
  769. // CHECK:STDOUT: %.loc10_10.2: type = converted %int.make_type_32.loc10_10, %.loc10_10.1 [template = i32]
  770. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  771. // CHECK:STDOUT: %N.ref.loc10_22: i32 = name_ref N, %N.loc10_6.1 [symbolic = %N.loc10_6.2 (constants.%N.1)]
  772. // CHECK:STDOUT: %.loc10_22.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15]
  773. // CHECK:STDOUT: %.loc10_22.2: <bound method> = bound_method %N.ref.loc10_22, %.loc10_22.1 [symbolic = %.loc10_22.5 (constants.%.27)]
  774. // CHECK:STDOUT: %int.convert_checked.loc10_22.1: init Core.IntLiteral = call %.loc10_22.2(%N.ref.loc10_22) [symbolic = %int.convert_checked.loc10_22.2 (constants.%int.convert_checked)]
  775. // CHECK:STDOUT: %.loc10_22.3: Core.IntLiteral = value_of_initializer %int.convert_checked.loc10_22.1 [symbolic = %int.convert_checked.loc10_22.2 (constants.%int.convert_checked)]
  776. // CHECK:STDOUT: %.loc10_22.4: Core.IntLiteral = converted %N.ref.loc10_22, %.loc10_22.3 [symbolic = %int.convert_checked.loc10_22.2 (constants.%int.convert_checked)]
  777. // CHECK:STDOUT: %.loc10_23: type = array_type %.loc10_22.4, %C [template = <error>]
  778. // CHECK:STDOUT: %int.make_type_32.loc10_29: init type = call constants.%Int32() [template = i32]
  779. // CHECK:STDOUT: %.loc10_29.1: type = value_of_initializer %int.make_type_32.loc10_29 [template = i32]
  780. // CHECK:STDOUT: %.loc10_29.2: type = converted %int.make_type_32.loc10_29, %.loc10_29.1 [template = i32]
  781. // CHECK:STDOUT: %N.param: i32 = value_param runtime_param<invalid>
  782. // CHECK:STDOUT: %N.loc10_6.1: i32 = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc10_6.2 (constants.%N.1)]
  783. // CHECK:STDOUT: %a.param: <error> = value_param runtime_param0
  784. // CHECK:STDOUT: %a: <error> = bind_name a, %a.param
  785. // CHECK:STDOUT: %return.param: ref i32 = out_param runtime_param1
  786. // CHECK:STDOUT: %return: ref i32 = return_slot %return.param
  787. // CHECK:STDOUT: }
  788. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
  789. // CHECK:STDOUT: %return.patt: %C = return_slot_pattern
  790. // CHECK:STDOUT: %return.param_patt: %C = out_param_pattern %return.patt, runtime_param0
  791. // CHECK:STDOUT: } {
  792. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  793. // CHECK:STDOUT: %return.param: ref %C = out_param runtime_param0
  794. // CHECK:STDOUT: %return: ref %C = return_slot %return.param
  795. // CHECK:STDOUT: }
  796. // CHECK:STDOUT: }
  797. // CHECK:STDOUT:
  798. // CHECK:STDOUT: class @C {
  799. // CHECK:STDOUT: %.loc4: <witness> = complete_type_witness %.1 [template = constants.%.2]
  800. // CHECK:STDOUT:
  801. // CHECK:STDOUT: !members:
  802. // CHECK:STDOUT: .Self = constants.%C
  803. // CHECK:STDOUT: }
  804. // CHECK:STDOUT:
  805. // CHECK:STDOUT: class @D {
  806. // CHECK:STDOUT: %.loc5: <witness> = complete_type_witness %.1 [template = constants.%.2]
  807. // CHECK:STDOUT:
  808. // CHECK:STDOUT: !members:
  809. // CHECK:STDOUT: .Self = constants.%D
  810. // CHECK:STDOUT: }
  811. // CHECK:STDOUT:
  812. // CHECK:STDOUT: generic fn @F(%N.loc10_6.1: i32) {
  813. // CHECK:STDOUT: %N.loc10_6.2: i32 = bind_symbolic_name N, 0 [symbolic = %N.loc10_6.2 (constants.%N.1)]
  814. // CHECK:STDOUT: %N.patt.loc10_6.2: i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc10_6.2 (constants.%N.patt.1)]
  815. // CHECK:STDOUT: %.loc10_22.5: <bound method> = bound_method %N.loc10_6.2, constants.%Convert.15 [symbolic = %.loc10_22.5 (constants.%.27)]
  816. // CHECK:STDOUT: %int.convert_checked.loc10_22.2: init Core.IntLiteral = call %.loc10_22.5(%N.loc10_6.2) [symbolic = %int.convert_checked.loc10_22.2 (constants.%int.convert_checked)]
  817. // CHECK:STDOUT:
  818. // CHECK:STDOUT: !definition:
  819. // CHECK:STDOUT:
  820. // CHECK:STDOUT: fn[%N.param_patt: i32](%a.param_patt: <error>) -> i32 {
  821. // CHECK:STDOUT: !entry:
  822. // CHECK:STDOUT: %N.ref.loc10_42: i32 = name_ref N, %N.loc10_6.1 [symbolic = %N.loc10_6.2 (constants.%N.1)]
  823. // CHECK:STDOUT: return %N.ref.loc10_42
  824. // CHECK:STDOUT: }
  825. // CHECK:STDOUT: }
  826. // CHECK:STDOUT:
  827. // CHECK:STDOUT: fn @G() -> %return: %C {
  828. // CHECK:STDOUT: !entry:
  829. // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [template = constants.%D]
  830. // CHECK:STDOUT: %.loc13_14.1: i32 = int_value 3 [template = constants.%.29]
  831. // CHECK:STDOUT: %.loc13_14.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15]
  832. // CHECK:STDOUT: %.loc13_14.3: <bound method> = bound_method %.loc13_14.1, %.loc13_14.2 [template = constants.%.30]
  833. // CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc13_14.3(%.loc13_14.1) [template = constants.%.31]
  834. // CHECK:STDOUT: %.loc13_14.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.31]
  835. // CHECK:STDOUT: %.loc13_14.5: Core.IntLiteral = converted %.loc13_14.1, %.loc13_14.4 [template = constants.%.31]
  836. // CHECK:STDOUT: %.loc13_15: type = array_type %.loc13_14.5, %D [template = constants.%.32]
  837. // CHECK:STDOUT: %a.var: ref %.32 = var a
  838. // CHECK:STDOUT: %a: ref %.32 = bind_name a, %a.var
  839. // CHECK:STDOUT: %.loc13_21.1: %.1 = struct_literal ()
  840. // CHECK:STDOUT: %.loc13_25.1: %.1 = struct_literal ()
  841. // CHECK:STDOUT: %.loc13_29.1: %.1 = struct_literal ()
  842. // CHECK:STDOUT: %.loc13_30.1: %tuple.type = tuple_literal (%.loc13_21.1, %.loc13_25.1, %.loc13_29.1)
  843. // CHECK:STDOUT: %.loc13_30.2: i32 = int_value 0 [template = constants.%.34]
  844. // CHECK:STDOUT: %.loc13_30.3: ref %D = array_index %a.var, %.loc13_30.2
  845. // CHECK:STDOUT: %.loc13_21.2: init %D = class_init (), %.loc13_30.3 [template = constants.%struct]
  846. // CHECK:STDOUT: %.loc13_30.4: init %D = converted %.loc13_21.1, %.loc13_21.2 [template = constants.%struct]
  847. // CHECK:STDOUT: %.loc13_30.5: i32 = int_value 1 [template = constants.%.35]
  848. // CHECK:STDOUT: %.loc13_30.6: ref %D = array_index %a.var, %.loc13_30.5
  849. // CHECK:STDOUT: %.loc13_25.2: init %D = class_init (), %.loc13_30.6 [template = constants.%struct]
  850. // CHECK:STDOUT: %.loc13_30.7: init %D = converted %.loc13_25.1, %.loc13_25.2 [template = constants.%struct]
  851. // CHECK:STDOUT: %.loc13_30.8: i32 = int_value 2 [template = constants.%.36]
  852. // CHECK:STDOUT: %.loc13_30.9: ref %D = array_index %a.var, %.loc13_30.8
  853. // CHECK:STDOUT: %.loc13_29.2: init %D = class_init (), %.loc13_30.9 [template = constants.%struct]
  854. // CHECK:STDOUT: %.loc13_30.10: init %D = converted %.loc13_29.1, %.loc13_29.2 [template = constants.%struct]
  855. // CHECK:STDOUT: %.loc13_30.11: init %.32 = array_init (%.loc13_30.4, %.loc13_30.7, %.loc13_30.10) to %a.var [template = constants.%array]
  856. // CHECK:STDOUT: %.loc13_31: init %.32 = converted %.loc13_30.1, %.loc13_30.11 [template = constants.%array]
  857. // CHECK:STDOUT: assign %a.var, %.loc13_31
  858. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F]
  859. // CHECK:STDOUT: %a.ref: ref %.32 = name_ref a, %a
  860. // CHECK:STDOUT: return <error> to %return
  861. // CHECK:STDOUT: }
  862. // CHECK:STDOUT:
  863. // CHECK:STDOUT: specific @F(constants.%N.1) {
  864. // CHECK:STDOUT: %N.loc10_6.2 => constants.%N.1
  865. // CHECK:STDOUT: %N.patt.loc10_6.2 => constants.%N.1
  866. // CHECK:STDOUT: %.loc10_22.5 => constants.%.27
  867. // CHECK:STDOUT: %int.convert_checked.loc10_22.2 => constants.%int.convert_checked
  868. // CHECK:STDOUT: }
  869. // CHECK:STDOUT: