array.carbon 77 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149
  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. // --- bound_only.carbon
  19. library "[[@TEST_NAME]]";
  20. class C {}
  21. fn F[N:! Core.IntLiteral()](a: [C; N]) -> i32 { return N; }
  22. fn G() -> i32 {
  23. var a: [C; 3] = ({}, {}, {});
  24. return F(a);
  25. }
  26. // --- type_and_bound.carbon
  27. library "[[@TEST_NAME]]";
  28. class C {}
  29. fn F[T:! type, N:! Core.IntLiteral()](a: [T; N]) {}
  30. fn G() {
  31. var a: [C; 3] = ({}, {}, {});
  32. F(a);
  33. }
  34. // --- fail_bound_mismatch.carbon
  35. library "[[@TEST_NAME]]";
  36. class C {}
  37. fn F[T:! type](a: [T; 2]) -> T { return a[0]; }
  38. fn G() -> C {
  39. // TODO: We succeed at deducing T here but fail to convert. Is this the right behavior?
  40. var a: [C; 3] = ({}, {}, {});
  41. // CHECK:STDERR: fail_bound_mismatch.carbon:[[@LINE+10]]:12: error: cannot implicitly convert from `[C; 3]` to `[C; 2]` [ImplicitAsConversionFailure]
  42. // CHECK:STDERR: return F(a);
  43. // CHECK:STDERR: ^
  44. // CHECK:STDERR: fail_bound_mismatch.carbon:[[@LINE+7]]:12: note: type `[C; 3]` does not implement interface `Core.ImplicitAs([C; 2])` [MissingImplInMemberAccessNote]
  45. // CHECK:STDERR: return F(a);
  46. // CHECK:STDERR: ^
  47. // CHECK:STDERR: fail_bound_mismatch.carbon:[[@LINE-11]]:16: note: initializing function parameter [InCallToFunctionParam]
  48. // CHECK:STDERR: fn F[T:! type](a: [T; 2]) -> T { return a[0]; }
  49. // CHECK:STDERR: ^~~~~~~~~
  50. // CHECK:STDERR:
  51. return F(a);
  52. }
  53. // --- fail_type_mismatch.carbon
  54. library "[[@TEST_NAME]]";
  55. class C {}
  56. class D {}
  57. fn F[N:! Core.IntLiteral()](a: [C; N]) -> i32 { return N; }
  58. fn G() -> i32 {
  59. // TODO: We succeed at deducing N here but fail to convert. Is this the right behavior?
  60. var a: [D; 3] = ({}, {}, {});
  61. // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+10]]:12: error: cannot implicitly convert from `[D; 3]` to `[C; 3]` [ImplicitAsConversionFailure]
  62. // CHECK:STDERR: return F(a);
  63. // CHECK:STDERR: ^
  64. // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+7]]:12: note: type `[D; 3]` does not implement interface `Core.ImplicitAs([C; 3])` [MissingImplInMemberAccessNote]
  65. // CHECK:STDERR: return F(a);
  66. // CHECK:STDERR: ^
  67. // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE-11]]:29: note: initializing function parameter [InCallToFunctionParam]
  68. // CHECK:STDERR: fn F[N:! Core.IntLiteral()](a: [C; N]) -> i32 { return N; }
  69. // CHECK:STDERR: ^~~~~~~~~
  70. // CHECK:STDERR:
  71. return F(a);
  72. }
  73. // --- fail_bound_type_mismatch.carbon
  74. library "[[@TEST_NAME]]";
  75. class C {}
  76. fn F[N:! i32](a: [C; N]) -> i32 { return N; }
  77. fn G() -> i32 {
  78. var a: [C; 3] = ({}, {}, {});
  79. // TODO: This fails because the array bound in `F` is effectively
  80. // `N.(ImplicitAs(IntLiteral).Convert)()`
  81. // which we can't deduce through. We should decide if we want to support
  82. // deductions of that form. If not, it'd be nice to diagnose this situation
  83. // better.
  84. // CHECK:STDERR: fail_bound_type_mismatch.carbon:[[@LINE+6]]:10: error: cannot deduce value for generic parameter `N` [DeductionIncomplete]
  85. // CHECK:STDERR: return F(a);
  86. // CHECK:STDERR: ^~~~
  87. // CHECK:STDERR: fail_bound_type_mismatch.carbon:[[@LINE-12]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
  88. // CHECK:STDERR: fn F[N:! i32](a: [C; N]) -> i32 { return N; }
  89. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  90. return F(a);
  91. }
  92. // CHECK:STDOUT: --- type_only.carbon
  93. // CHECK:STDOUT:
  94. // CHECK:STDOUT: constants {
  95. // CHECK:STDOUT: %C: type = class_type @C [template]
  96. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  97. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [template]
  98. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  99. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  100. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template]
  101. // CHECK:STDOUT: %array_type.fa4: type = array_type %int_3, %T [symbolic]
  102. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  103. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  104. // CHECK:STDOUT: %require_complete.db1: <witness> = require_complete_type %T [symbolic]
  105. // CHECK:STDOUT: %require_complete.029: <witness> = require_complete_type %array_type.fa4 [symbolic]
  106. // CHECK:STDOUT: %int_0.5c6: Core.IntLiteral = int_value 0 [template]
  107. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
  108. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
  109. // CHECK:STDOUT: %Convert.type.cd1: type = fn_type @Convert.1, @ImplicitAs(%i32) [template]
  110. // CHECK:STDOUT: %impl_witness.5b0: <witness> = impl_witness (imports.%import_ref.723), @impl.1(%int_32) [template]
  111. // CHECK:STDOUT: %Convert.type.466: type = fn_type @Convert.2, @impl.1(%int_32) [template]
  112. // CHECK:STDOUT: %Convert.925: %Convert.type.466 = struct_value () [template]
  113. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_0.5c6, %Convert.925 [template]
  114. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.bound, @Convert.2(%int_32) [template]
  115. // CHECK:STDOUT: %int_0.f61: %i32 = int_value 0 [template]
  116. // CHECK:STDOUT: %G.type: type = fn_type @G [template]
  117. // CHECK:STDOUT: %G: %G.type = struct_value () [template]
  118. // CHECK:STDOUT: %array_type.002: type = array_type %int_3, %C [template]
  119. // CHECK:STDOUT: %tuple.type: type = tuple_type (%empty_struct_type, %empty_struct_type, %empty_struct_type) [template]
  120. // CHECK:STDOUT: %C.val: %C = struct_value () [template]
  121. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template]
  122. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template]
  123. // CHECK:STDOUT: %array: %array_type.002 = tuple_value (%C.val, %C.val, %C.val) [template]
  124. // CHECK:STDOUT: %F.specific_fn: <specific function> = specific_function %F, @F(%C) [template]
  125. // CHECK:STDOUT: %complete_type.dd1: <witness> = complete_type_witness %array_type.002 [template]
  126. // CHECK:STDOUT: }
  127. // CHECK:STDOUT:
  128. // CHECK:STDOUT: imports {
  129. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  130. // CHECK:STDOUT: .Int = %import_ref.187
  131. // CHECK:STDOUT: .ImplicitAs = %import_ref.a69
  132. // CHECK:STDOUT: import Core//prelude
  133. // CHECK:STDOUT: import Core//prelude/...
  134. // CHECK:STDOUT: }
  135. // CHECK:STDOUT: }
  136. // CHECK:STDOUT:
  137. // CHECK:STDOUT: file {
  138. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  139. // CHECK:STDOUT: .Core = imports.%Core
  140. // CHECK:STDOUT: .C = %C.decl
  141. // CHECK:STDOUT: .F = %F.decl
  142. // CHECK:STDOUT: .G = %G.decl
  143. // CHECK:STDOUT: }
  144. // CHECK:STDOUT: %Core.import = import Core
  145. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  146. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
  147. // CHECK:STDOUT: %T.patt.loc6_6.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_6.2 (constants.%T.patt)]
  148. // 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)]
  149. // CHECK:STDOUT: %a.patt: @F.%array_type.loc6_24.2 (%array_type.fa4) = binding_pattern a
  150. // CHECK:STDOUT: %a.param_patt: @F.%array_type.loc6_24.2 (%array_type.fa4) = value_param_pattern %a.patt, runtime_param0
  151. // CHECK:STDOUT: %return.patt: @F.%T.loc6_6.2 (%T) = return_slot_pattern
  152. // CHECK:STDOUT: %return.param_patt: @F.%T.loc6_6.2 (%T) = out_param_pattern %return.patt, runtime_param1
  153. // CHECK:STDOUT: } {
  154. // CHECK:STDOUT: %T.ref.loc6_30: type = name_ref T, %T.loc6_6.1 [symbolic = %T.loc6_6.2 (constants.%T)]
  155. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  156. // CHECK:STDOUT: %T.loc6_6.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc6_6.2 (constants.%T)]
  157. // CHECK:STDOUT: %a.param: @F.%array_type.loc6_24.2 (%array_type.fa4) = value_param runtime_param0
  158. // CHECK:STDOUT: %.loc6_24: type = splice_block %array_type.loc6_24.1 [symbolic = %array_type.loc6_24.2 (constants.%array_type.fa4)] {
  159. // CHECK:STDOUT: %T.ref.loc6_20: type = name_ref T, %T.loc6_6.1 [symbolic = %T.loc6_6.2 (constants.%T)]
  160. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template = constants.%int_3]
  161. // CHECK:STDOUT: %array_type.loc6_24.1: type = array_type %int_3, %T [symbolic = %array_type.loc6_24.2 (constants.%array_type.fa4)]
  162. // CHECK:STDOUT: }
  163. // CHECK:STDOUT: %a: @F.%array_type.loc6_24.2 (%array_type.fa4) = bind_name a, %a.param
  164. // CHECK:STDOUT: %return.param: ref @F.%T.loc6_6.2 (%T) = out_param runtime_param1
  165. // CHECK:STDOUT: %return: ref @F.%T.loc6_6.2 (%T) = return_slot %return.param
  166. // CHECK:STDOUT: }
  167. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
  168. // CHECK:STDOUT: %return.patt: %C = return_slot_pattern
  169. // CHECK:STDOUT: %return.param_patt: %C = out_param_pattern %return.patt, runtime_param0
  170. // CHECK:STDOUT: } {
  171. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  172. // CHECK:STDOUT: %return.param: ref %C = out_param runtime_param0
  173. // CHECK:STDOUT: %return: ref %C = return_slot %return.param
  174. // CHECK:STDOUT: }
  175. // CHECK:STDOUT: }
  176. // CHECK:STDOUT:
  177. // CHECK:STDOUT: class @C {
  178. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type.357]
  179. // CHECK:STDOUT:
  180. // CHECK:STDOUT: !members:
  181. // CHECK:STDOUT: .Self = constants.%C
  182. // CHECK:STDOUT: complete_type_witness = %complete_type
  183. // CHECK:STDOUT: }
  184. // CHECK:STDOUT:
  185. // CHECK:STDOUT: generic fn @F(%T.loc6_6.1: type) {
  186. // CHECK:STDOUT: %T.loc6_6.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc6_6.2 (constants.%T)]
  187. // CHECK:STDOUT: %T.patt.loc6_6.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_6.2 (constants.%T.patt)]
  188. // CHECK:STDOUT: %array_type.loc6_24.2: type = array_type constants.%int_3, @F.%T.loc6_6.2 (%T) [symbolic = %array_type.loc6_24.2 (constants.%array_type.fa4)]
  189. // CHECK:STDOUT:
  190. // CHECK:STDOUT: !definition:
  191. // CHECK:STDOUT: %require_complete.loc6_27: <witness> = require_complete_type @F.%T.loc6_6.2 (%T) [symbolic = %require_complete.loc6_27 (constants.%require_complete.db1)]
  192. // CHECK:STDOUT: %require_complete.loc6_17: <witness> = require_complete_type @F.%array_type.loc6_24.2 (%array_type.fa4) [symbolic = %require_complete.loc6_17 (constants.%require_complete.029)]
  193. // CHECK:STDOUT:
  194. // CHECK:STDOUT: fn[%T.param_patt: type](%a.param_patt: @F.%array_type.loc6_24.2 (%array_type.fa4)) -> @F.%T.loc6_6.2 (%T) {
  195. // CHECK:STDOUT: !entry:
  196. // CHECK:STDOUT: %a.ref: @F.%array_type.loc6_24.2 (%array_type.fa4) = name_ref a, %a
  197. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0.5c6]
  198. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  199. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  200. // CHECK:STDOUT: %impl.elem0: %Convert.type.cd1 = impl_witness_access constants.%impl_witness.5b0, element0 [template = constants.%Convert.925]
  201. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_0, %impl.elem0 [template = constants.%Convert.bound]
  202. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.bound, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn]
  203. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %Convert.specific_fn(%int_0) [template = constants.%int_0.f61]
  204. // CHECK:STDOUT: %.loc6_43.1: %i32 = value_of_initializer %int.convert_checked [template = constants.%int_0.f61]
  205. // CHECK:STDOUT: %.loc6_43.2: %i32 = converted %int_0, %.loc6_43.1 [template = constants.%int_0.f61]
  206. // CHECK:STDOUT: %.loc6_44.1: ref @F.%array_type.loc6_24.2 (%array_type.fa4) = value_as_ref %a.ref
  207. // CHECK:STDOUT: %.loc6_44.2: ref @F.%T.loc6_6.2 (%T) = array_index %.loc6_44.1, %.loc6_43.2
  208. // CHECK:STDOUT: %.loc6_44.3: @F.%T.loc6_6.2 (%T) = bind_value %.loc6_44.2
  209. // CHECK:STDOUT: return %.loc6_44.3
  210. // CHECK:STDOUT: }
  211. // CHECK:STDOUT: }
  212. // CHECK:STDOUT:
  213. // CHECK:STDOUT: fn @G() -> %return.param_patt: %C {
  214. // CHECK:STDOUT: !entry:
  215. // CHECK:STDOUT: %a.var: ref %array_type.002 = var a
  216. // CHECK:STDOUT: %a: ref %array_type.002 = bind_name a, %a.var
  217. // CHECK:STDOUT: %.loc9_21.1: %empty_struct_type = struct_literal ()
  218. // CHECK:STDOUT: %.loc9_25.1: %empty_struct_type = struct_literal ()
  219. // CHECK:STDOUT: %.loc9_29.1: %empty_struct_type = struct_literal ()
  220. // CHECK:STDOUT: %.loc9_30.1: %tuple.type = tuple_literal (%.loc9_21.1, %.loc9_25.1, %.loc9_29.1)
  221. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0.5c6]
  222. // CHECK:STDOUT: %.loc9_30.2: ref %C = array_index %a.var, %int_0
  223. // CHECK:STDOUT: %.loc9_21.2: init %C = class_init (), %.loc9_30.2 [template = constants.%C.val]
  224. // CHECK:STDOUT: %.loc9_30.3: init %C = converted %.loc9_21.1, %.loc9_21.2 [template = constants.%C.val]
  225. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1]
  226. // CHECK:STDOUT: %.loc9_30.4: ref %C = array_index %a.var, %int_1
  227. // CHECK:STDOUT: %.loc9_25.2: init %C = class_init (), %.loc9_30.4 [template = constants.%C.val]
  228. // CHECK:STDOUT: %.loc9_30.5: init %C = converted %.loc9_25.1, %.loc9_25.2 [template = constants.%C.val]
  229. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2]
  230. // CHECK:STDOUT: %.loc9_30.6: ref %C = array_index %a.var, %int_2
  231. // CHECK:STDOUT: %.loc9_29.2: init %C = class_init (), %.loc9_30.6 [template = constants.%C.val]
  232. // CHECK:STDOUT: %.loc9_30.7: init %C = converted %.loc9_29.1, %.loc9_29.2 [template = constants.%C.val]
  233. // CHECK:STDOUT: %.loc9_30.8: init %array_type.002 = array_init (%.loc9_30.3, %.loc9_30.5, %.loc9_30.7) to %a.var [template = constants.%array]
  234. // CHECK:STDOUT: %.loc9_31: init %array_type.002 = converted %.loc9_30.1, %.loc9_30.8 [template = constants.%array]
  235. // CHECK:STDOUT: assign %a.var, %.loc9_31
  236. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F]
  237. // CHECK:STDOUT: %a.ref: ref %array_type.002 = name_ref a, %a
  238. // CHECK:STDOUT: %F.specific_fn: <specific function> = specific_function %F.ref, @F(constants.%C) [template = constants.%F.specific_fn]
  239. // CHECK:STDOUT: %.loc8: ref %C = splice_block %return {}
  240. // CHECK:STDOUT: %.loc10: %array_type.002 = bind_value %a.ref
  241. // CHECK:STDOUT: %F.call: init %C = call %F.specific_fn(%.loc10) to %.loc8
  242. // CHECK:STDOUT: return %F.call to %return
  243. // CHECK:STDOUT: }
  244. // CHECK:STDOUT:
  245. // CHECK:STDOUT: specific @F(constants.%T) {
  246. // CHECK:STDOUT: %T.loc6_6.2 => constants.%T
  247. // CHECK:STDOUT: %T.patt.loc6_6.2 => constants.%T
  248. // CHECK:STDOUT: %array_type.loc6_24.2 => constants.%array_type.fa4
  249. // CHECK:STDOUT: }
  250. // CHECK:STDOUT:
  251. // CHECK:STDOUT: specific @F(constants.%C) {
  252. // CHECK:STDOUT: %T.loc6_6.2 => constants.%C
  253. // CHECK:STDOUT: %T.patt.loc6_6.2 => constants.%C
  254. // CHECK:STDOUT: %array_type.loc6_24.2 => constants.%array_type.002
  255. // CHECK:STDOUT:
  256. // CHECK:STDOUT: !definition:
  257. // CHECK:STDOUT: %require_complete.loc6_27 => constants.%complete_type.357
  258. // CHECK:STDOUT: %require_complete.loc6_17 => constants.%complete_type.dd1
  259. // CHECK:STDOUT: }
  260. // CHECK:STDOUT:
  261. // CHECK:STDOUT: --- bound_only.carbon
  262. // CHECK:STDOUT:
  263. // CHECK:STDOUT: constants {
  264. // CHECK:STDOUT: %C: type = class_type @C [template]
  265. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  266. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [template]
  267. // CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template]
  268. // CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template]
  269. // CHECK:STDOUT: %N.f0243b.1: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic]
  270. // CHECK:STDOUT: %N.patt.7d2de8.1: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic]
  271. // CHECK:STDOUT: %array_type.f81: type = array_type %N.f0243b.1, %C [symbolic]
  272. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
  273. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
  274. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  275. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  276. // CHECK:STDOUT: %require_complete.109: <witness> = require_complete_type %array_type.f81 [symbolic]
  277. // CHECK:STDOUT: %Convert.type.cd1: type = fn_type @Convert.1, @ImplicitAs(%i32) [template]
  278. // CHECK:STDOUT: %impl_witness.5b0: <witness> = impl_witness (imports.%import_ref.723), @impl.1(%int_32) [template]
  279. // CHECK:STDOUT: %Convert.type.466: type = fn_type @Convert.2, @impl.1(%int_32) [template]
  280. // CHECK:STDOUT: %Convert.925: %Convert.type.466 = struct_value () [template]
  281. // CHECK:STDOUT: %Convert.bound.2a5: <bound method> = bound_method %N.f0243b.1, %Convert.925 [symbolic]
  282. // CHECK:STDOUT: %Convert.specific_fn.660: <specific function> = specific_function %Convert.bound.2a5, @Convert.2(%int_32) [symbolic]
  283. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %Convert.specific_fn.660(%N.f0243b.1) [symbolic]
  284. // CHECK:STDOUT: %G.type: type = fn_type @G [template]
  285. // CHECK:STDOUT: %G: %G.type = struct_value () [template]
  286. // CHECK:STDOUT: %int_3.1ba: Core.IntLiteral = int_value 3 [template]
  287. // CHECK:STDOUT: %array_type.002: type = array_type %int_3.1ba, %C [template]
  288. // CHECK:STDOUT: %tuple.type: type = tuple_type (%empty_struct_type, %empty_struct_type, %empty_struct_type) [template]
  289. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template]
  290. // CHECK:STDOUT: %C.val: %C = struct_value () [template]
  291. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template]
  292. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template]
  293. // CHECK:STDOUT: %array: %array_type.002 = tuple_value (%C.val, %C.val, %C.val) [template]
  294. // CHECK:STDOUT: %F.specific_fn: <specific function> = specific_function %F, @F(%int_3.1ba) [template]
  295. // CHECK:STDOUT: %complete_type.dd1: <witness> = complete_type_witness %array_type.002 [template]
  296. // CHECK:STDOUT: %Convert.bound.0db: <bound method> = bound_method %int_3.1ba, %Convert.925 [template]
  297. // CHECK:STDOUT: %Convert.specific_fn.456: <specific function> = specific_function %Convert.bound.0db, @Convert.2(%int_32) [template]
  298. // CHECK:STDOUT: %int_3.25b: %i32 = int_value 3 [template]
  299. // CHECK:STDOUT: }
  300. // CHECK:STDOUT:
  301. // CHECK:STDOUT: imports {
  302. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  303. // CHECK:STDOUT: .IntLiteral = %import_ref.8ee
  304. // CHECK:STDOUT: .Int = %import_ref.187
  305. // CHECK:STDOUT: .ImplicitAs = %import_ref.a69
  306. // CHECK:STDOUT: import Core//prelude
  307. // CHECK:STDOUT: import Core//prelude/...
  308. // CHECK:STDOUT: }
  309. // CHECK:STDOUT: %import_ref.8ee: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral]
  310. // CHECK:STDOUT: }
  311. // CHECK:STDOUT:
  312. // CHECK:STDOUT: file {
  313. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  314. // CHECK:STDOUT: .Core = imports.%Core
  315. // CHECK:STDOUT: .C = %C.decl
  316. // CHECK:STDOUT: .F = %F.decl
  317. // CHECK:STDOUT: .G = %G.decl
  318. // CHECK:STDOUT: }
  319. // CHECK:STDOUT: %Core.import = import Core
  320. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  321. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
  322. // CHECK:STDOUT: %N.patt.loc6_6.1: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_6.2 (constants.%N.patt.7d2de8.1)]
  323. // CHECK:STDOUT: %N.param_patt: Core.IntLiteral = value_param_pattern %N.patt.loc6_6.1, runtime_param<invalid> [symbolic = %N.patt.loc6_6.2 (constants.%N.patt.7d2de8.1)]
  324. // CHECK:STDOUT: %a.patt: @F.%array_type.loc6_37.2 (%array_type.f81) = binding_pattern a
  325. // CHECK:STDOUT: %a.param_patt: @F.%array_type.loc6_37.2 (%array_type.f81) = value_param_pattern %a.patt, runtime_param0
  326. // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern
  327. // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1
  328. // CHECK:STDOUT: } {
  329. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  330. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  331. // CHECK:STDOUT: %N.param: Core.IntLiteral = value_param runtime_param<invalid>
  332. // CHECK:STDOUT: %.loc6_26.1: type = splice_block %.loc6_26.3 [template = Core.IntLiteral] {
  333. // CHECK:STDOUT: %Core.ref: <namespace> = name_ref Core, imports.%Core [template = imports.%Core]
  334. // CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.8ee [template = constants.%IntLiteral]
  335. // CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral]
  336. // CHECK:STDOUT: %.loc6_26.2: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral]
  337. // CHECK:STDOUT: %.loc6_26.3: type = converted %int_literal.make_type, %.loc6_26.2 [template = Core.IntLiteral]
  338. // CHECK:STDOUT: }
  339. // CHECK:STDOUT: %N.loc6_6.1: Core.IntLiteral = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc6_6.2 (constants.%N.f0243b.1)]
  340. // CHECK:STDOUT: %a.param: @F.%array_type.loc6_37.2 (%array_type.f81) = value_param runtime_param0
  341. // CHECK:STDOUT: %.loc6_37: type = splice_block %array_type.loc6_37.1 [symbolic = %array_type.loc6_37.2 (constants.%array_type.f81)] {
  342. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  343. // CHECK:STDOUT: %N.ref.loc6_36: Core.IntLiteral = name_ref N, %N.loc6_6.1 [symbolic = %N.loc6_6.2 (constants.%N.f0243b.1)]
  344. // CHECK:STDOUT: %array_type.loc6_37.1: type = array_type %N.ref.loc6_36, %C [symbolic = %array_type.loc6_37.2 (constants.%array_type.f81)]
  345. // CHECK:STDOUT: }
  346. // CHECK:STDOUT: %a: @F.%array_type.loc6_37.2 (%array_type.f81) = bind_name a, %a.param
  347. // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1
  348. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  349. // CHECK:STDOUT: }
  350. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
  351. // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern
  352. // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param0
  353. // CHECK:STDOUT: } {
  354. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  355. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  356. // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param0
  357. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  358. // CHECK:STDOUT: }
  359. // CHECK:STDOUT: }
  360. // CHECK:STDOUT:
  361. // CHECK:STDOUT: class @C {
  362. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type.357]
  363. // CHECK:STDOUT:
  364. // CHECK:STDOUT: !members:
  365. // CHECK:STDOUT: .Self = constants.%C
  366. // CHECK:STDOUT: complete_type_witness = %complete_type
  367. // CHECK:STDOUT: }
  368. // CHECK:STDOUT:
  369. // CHECK:STDOUT: generic fn @F(%N.loc6_6.1: Core.IntLiteral) {
  370. // CHECK:STDOUT: %N.loc6_6.2: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N.loc6_6.2 (constants.%N.f0243b.1)]
  371. // CHECK:STDOUT: %N.patt.loc6_6.2: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_6.2 (constants.%N.patt.7d2de8.1)]
  372. // CHECK:STDOUT: %array_type.loc6_37.2: type = array_type %N.loc6_6.2, %C [symbolic = %array_type.loc6_37.2 (constants.%array_type.f81)]
  373. // CHECK:STDOUT:
  374. // CHECK:STDOUT: !definition:
  375. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type @F.%array_type.loc6_37.2 (%array_type.f81) [symbolic = %require_complete (constants.%require_complete.109)]
  376. // CHECK:STDOUT: %Convert.bound.loc6_57.2: <bound method> = bound_method %N.loc6_6.2, constants.%Convert.925 [symbolic = %Convert.bound.loc6_57.2 (constants.%Convert.bound.2a5)]
  377. // CHECK:STDOUT: %Convert.specific_fn.loc6_57.2: <specific function> = specific_function %Convert.bound.loc6_57.2, @Convert.2(constants.%int_32) [symbolic = %Convert.specific_fn.loc6_57.2 (constants.%Convert.specific_fn.660)]
  378. // CHECK:STDOUT: %int.convert_checked.loc6_57.2: init %i32 = call %Convert.specific_fn.loc6_57.2(%N.loc6_6.2) [symbolic = %int.convert_checked.loc6_57.2 (constants.%int.convert_checked)]
  379. // CHECK:STDOUT:
  380. // CHECK:STDOUT: fn[%N.param_patt: Core.IntLiteral](%a.param_patt: @F.%array_type.loc6_37.2 (%array_type.f81)) -> %i32 {
  381. // CHECK:STDOUT: !entry:
  382. // CHECK:STDOUT: %N.ref.loc6_56: Core.IntLiteral = name_ref N, %N.loc6_6.1 [symbolic = %N.loc6_6.2 (constants.%N.f0243b.1)]
  383. // CHECK:STDOUT: %impl.elem0: %Convert.type.cd1 = impl_witness_access constants.%impl_witness.5b0, element0 [template = constants.%Convert.925]
  384. // CHECK:STDOUT: %Convert.bound.loc6_57.1: <bound method> = bound_method %N.ref.loc6_56, %impl.elem0 [symbolic = %Convert.bound.loc6_57.2 (constants.%Convert.bound.2a5)]
  385. // CHECK:STDOUT: %Convert.specific_fn.loc6_57.1: <specific function> = specific_function %Convert.bound.loc6_57.1, @Convert.2(constants.%int_32) [symbolic = %Convert.specific_fn.loc6_57.2 (constants.%Convert.specific_fn.660)]
  386. // CHECK:STDOUT: %int.convert_checked.loc6_57.1: init %i32 = call %Convert.specific_fn.loc6_57.1(%N.ref.loc6_56) [symbolic = %int.convert_checked.loc6_57.2 (constants.%int.convert_checked)]
  387. // CHECK:STDOUT: %.loc6_57.1: %i32 = value_of_initializer %int.convert_checked.loc6_57.1 [symbolic = %int.convert_checked.loc6_57.2 (constants.%int.convert_checked)]
  388. // CHECK:STDOUT: %.loc6_57.2: %i32 = converted %N.ref.loc6_56, %.loc6_57.1 [symbolic = %int.convert_checked.loc6_57.2 (constants.%int.convert_checked)]
  389. // CHECK:STDOUT: return %.loc6_57.2
  390. // CHECK:STDOUT: }
  391. // CHECK:STDOUT: }
  392. // CHECK:STDOUT:
  393. // CHECK:STDOUT: fn @G() -> %i32 {
  394. // CHECK:STDOUT: !entry:
  395. // CHECK:STDOUT: %a.var: ref %array_type.002 = var a
  396. // CHECK:STDOUT: %a: ref %array_type.002 = bind_name a, %a.var
  397. // CHECK:STDOUT: %.loc9_21.1: %empty_struct_type = struct_literal ()
  398. // CHECK:STDOUT: %.loc9_25.1: %empty_struct_type = struct_literal ()
  399. // CHECK:STDOUT: %.loc9_29.1: %empty_struct_type = struct_literal ()
  400. // CHECK:STDOUT: %.loc9_30.1: %tuple.type = tuple_literal (%.loc9_21.1, %.loc9_25.1, %.loc9_29.1)
  401. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0]
  402. // CHECK:STDOUT: %.loc9_30.2: ref %C = array_index %a.var, %int_0
  403. // CHECK:STDOUT: %.loc9_21.2: init %C = class_init (), %.loc9_30.2 [template = constants.%C.val]
  404. // CHECK:STDOUT: %.loc9_30.3: init %C = converted %.loc9_21.1, %.loc9_21.2 [template = constants.%C.val]
  405. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1]
  406. // CHECK:STDOUT: %.loc9_30.4: ref %C = array_index %a.var, %int_1
  407. // CHECK:STDOUT: %.loc9_25.2: init %C = class_init (), %.loc9_30.4 [template = constants.%C.val]
  408. // CHECK:STDOUT: %.loc9_30.5: init %C = converted %.loc9_25.1, %.loc9_25.2 [template = constants.%C.val]
  409. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2]
  410. // CHECK:STDOUT: %.loc9_30.6: ref %C = array_index %a.var, %int_2
  411. // CHECK:STDOUT: %.loc9_29.2: init %C = class_init (), %.loc9_30.6 [template = constants.%C.val]
  412. // CHECK:STDOUT: %.loc9_30.7: init %C = converted %.loc9_29.1, %.loc9_29.2 [template = constants.%C.val]
  413. // CHECK:STDOUT: %.loc9_30.8: init %array_type.002 = array_init (%.loc9_30.3, %.loc9_30.5, %.loc9_30.7) to %a.var [template = constants.%array]
  414. // CHECK:STDOUT: %.loc9_31: init %array_type.002 = converted %.loc9_30.1, %.loc9_30.8 [template = constants.%array]
  415. // CHECK:STDOUT: assign %a.var, %.loc9_31
  416. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F]
  417. // CHECK:STDOUT: %a.ref: ref %array_type.002 = name_ref a, %a
  418. // CHECK:STDOUT: %F.specific_fn: <specific function> = specific_function %F.ref, @F(constants.%int_3.1ba) [template = constants.%F.specific_fn]
  419. // CHECK:STDOUT: %.loc10_12: %array_type.002 = bind_value %a.ref
  420. // CHECK:STDOUT: %F.call: init %i32 = call %F.specific_fn(%.loc10_12)
  421. // CHECK:STDOUT: %.loc10_14.1: %i32 = value_of_initializer %F.call
  422. // CHECK:STDOUT: %.loc10_14.2: %i32 = converted %F.call, %.loc10_14.1
  423. // CHECK:STDOUT: return %.loc10_14.2
  424. // CHECK:STDOUT: }
  425. // CHECK:STDOUT:
  426. // CHECK:STDOUT: specific @F(constants.%N.f0243b.1) {
  427. // CHECK:STDOUT: %N.loc6_6.2 => constants.%N.f0243b.1
  428. // CHECK:STDOUT: %N.patt.loc6_6.2 => constants.%N.f0243b.1
  429. // CHECK:STDOUT: %array_type.loc6_37.2 => constants.%array_type.f81
  430. // CHECK:STDOUT: }
  431. // CHECK:STDOUT:
  432. // CHECK:STDOUT: specific @F(constants.%int_3.1ba) {
  433. // CHECK:STDOUT: %N.loc6_6.2 => constants.%int_3.1ba
  434. // CHECK:STDOUT: %N.patt.loc6_6.2 => constants.%int_3.1ba
  435. // CHECK:STDOUT: %array_type.loc6_37.2 => constants.%array_type.002
  436. // CHECK:STDOUT:
  437. // CHECK:STDOUT: !definition:
  438. // CHECK:STDOUT: %require_complete => constants.%complete_type.dd1
  439. // CHECK:STDOUT: %Convert.bound.loc6_57.2 => constants.%Convert.bound.0db
  440. // CHECK:STDOUT: %Convert.specific_fn.loc6_57.2 => constants.%Convert.specific_fn.456
  441. // CHECK:STDOUT: %int.convert_checked.loc6_57.2 => constants.%int_3.25b
  442. // CHECK:STDOUT: }
  443. // CHECK:STDOUT:
  444. // CHECK:STDOUT: --- type_and_bound.carbon
  445. // CHECK:STDOUT:
  446. // CHECK:STDOUT: constants {
  447. // CHECK:STDOUT: %C: type = class_type @C [template]
  448. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  449. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [template]
  450. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  451. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  452. // CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template]
  453. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  454. // CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template]
  455. // CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 1 [symbolic]
  456. // CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 1 [symbolic]
  457. // CHECK:STDOUT: %array_type.24b: type = array_type %N, %T [symbolic]
  458. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  459. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  460. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %array_type.24b [symbolic]
  461. // CHECK:STDOUT: %G.type: type = fn_type @G [template]
  462. // CHECK:STDOUT: %G: %G.type = struct_value () [template]
  463. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template]
  464. // CHECK:STDOUT: %array_type.002: type = array_type %int_3, %C [template]
  465. // CHECK:STDOUT: %tuple.type: type = tuple_type (%empty_struct_type, %empty_struct_type, %empty_struct_type) [template]
  466. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template]
  467. // CHECK:STDOUT: %C.val: %C = struct_value () [template]
  468. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template]
  469. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template]
  470. // CHECK:STDOUT: %array: %array_type.002 = tuple_value (%C.val, %C.val, %C.val) [template]
  471. // CHECK:STDOUT: %F.specific_fn: <specific function> = specific_function %F, @F(%C, %int_3) [template]
  472. // CHECK:STDOUT: %complete_type.dd1: <witness> = complete_type_witness %array_type.002 [template]
  473. // CHECK:STDOUT: }
  474. // CHECK:STDOUT:
  475. // CHECK:STDOUT: imports {
  476. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  477. // CHECK:STDOUT: .IntLiteral = %import_ref
  478. // CHECK:STDOUT: import Core//prelude
  479. // CHECK:STDOUT: import Core//prelude/...
  480. // CHECK:STDOUT: }
  481. // CHECK:STDOUT: %import_ref: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral]
  482. // CHECK:STDOUT: }
  483. // CHECK:STDOUT:
  484. // CHECK:STDOUT: file {
  485. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  486. // CHECK:STDOUT: .Core = imports.%Core
  487. // CHECK:STDOUT: .C = %C.decl
  488. // CHECK:STDOUT: .F = %F.decl
  489. // CHECK:STDOUT: .G = %G.decl
  490. // CHECK:STDOUT: }
  491. // CHECK:STDOUT: %Core.import = import Core
  492. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  493. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
  494. // CHECK:STDOUT: %T.patt.loc6_6.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_6.2 (constants.%T.patt)]
  495. // 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)]
  496. // CHECK:STDOUT: %N.patt.loc6_16.1: Core.IntLiteral = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc6_16.2 (constants.%N.patt)]
  497. // CHECK:STDOUT: %N.param_patt: Core.IntLiteral = value_param_pattern %N.patt.loc6_16.1, runtime_param<invalid> [symbolic = %N.patt.loc6_16.2 (constants.%N.patt)]
  498. // CHECK:STDOUT: %a.patt: @F.%array_type.loc6_47.2 (%array_type.24b) = binding_pattern a
  499. // CHECK:STDOUT: %a.param_patt: @F.%array_type.loc6_47.2 (%array_type.24b) = value_param_pattern %a.patt, runtime_param0
  500. // CHECK:STDOUT: } {
  501. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  502. // CHECK:STDOUT: %T.loc6_6.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc6_6.2 (constants.%T)]
  503. // CHECK:STDOUT: %N.param: Core.IntLiteral = value_param runtime_param<invalid>
  504. // CHECK:STDOUT: %.loc6_36.1: type = splice_block %.loc6_36.3 [template = Core.IntLiteral] {
  505. // CHECK:STDOUT: %Core.ref: <namespace> = name_ref Core, imports.%Core [template = imports.%Core]
  506. // CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref [template = constants.%IntLiteral]
  507. // CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral]
  508. // CHECK:STDOUT: %.loc6_36.2: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral]
  509. // CHECK:STDOUT: %.loc6_36.3: type = converted %int_literal.make_type, %.loc6_36.2 [template = Core.IntLiteral]
  510. // CHECK:STDOUT: }
  511. // CHECK:STDOUT: %N.loc6_16.1: Core.IntLiteral = bind_symbolic_name N, 1, %N.param [symbolic = %N.loc6_16.2 (constants.%N)]
  512. // CHECK:STDOUT: %a.param: @F.%array_type.loc6_47.2 (%array_type.24b) = value_param runtime_param0
  513. // CHECK:STDOUT: %.loc6_47: type = splice_block %array_type.loc6_47.1 [symbolic = %array_type.loc6_47.2 (constants.%array_type.24b)] {
  514. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc6_6.1 [symbolic = %T.loc6_6.2 (constants.%T)]
  515. // CHECK:STDOUT: %N.ref: Core.IntLiteral = name_ref N, %N.loc6_16.1 [symbolic = %N.loc6_16.2 (constants.%N)]
  516. // CHECK:STDOUT: %array_type.loc6_47.1: type = array_type %N.ref, %T [symbolic = %array_type.loc6_47.2 (constants.%array_type.24b)]
  517. // CHECK:STDOUT: }
  518. // CHECK:STDOUT: %a: @F.%array_type.loc6_47.2 (%array_type.24b) = bind_name a, %a.param
  519. // CHECK:STDOUT: }
  520. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {} {}
  521. // CHECK:STDOUT: }
  522. // CHECK:STDOUT:
  523. // CHECK:STDOUT: class @C {
  524. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type.357]
  525. // CHECK:STDOUT:
  526. // CHECK:STDOUT: !members:
  527. // CHECK:STDOUT: .Self = constants.%C
  528. // CHECK:STDOUT: complete_type_witness = %complete_type
  529. // CHECK:STDOUT: }
  530. // CHECK:STDOUT:
  531. // CHECK:STDOUT: generic fn @F(%T.loc6_6.1: type, %N.loc6_16.1: Core.IntLiteral) {
  532. // CHECK:STDOUT: %T.loc6_6.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc6_6.2 (constants.%T)]
  533. // CHECK:STDOUT: %T.patt.loc6_6.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_6.2 (constants.%T.patt)]
  534. // CHECK:STDOUT: %N.loc6_16.2: Core.IntLiteral = bind_symbolic_name N, 1 [symbolic = %N.loc6_16.2 (constants.%N)]
  535. // CHECK:STDOUT: %N.patt.loc6_16.2: Core.IntLiteral = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc6_16.2 (constants.%N.patt)]
  536. // CHECK:STDOUT: %array_type.loc6_47.2: type = array_type %N.loc6_16.2, @F.%T.loc6_6.2 (%T) [symbolic = %array_type.loc6_47.2 (constants.%array_type.24b)]
  537. // CHECK:STDOUT:
  538. // CHECK:STDOUT: !definition:
  539. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type @F.%array_type.loc6_47.2 (%array_type.24b) [symbolic = %require_complete (constants.%require_complete)]
  540. // CHECK:STDOUT:
  541. // CHECK:STDOUT: fn[%T.param_patt: type, %N.param_patt: Core.IntLiteral](%a.param_patt: @F.%array_type.loc6_47.2 (%array_type.24b)) {
  542. // CHECK:STDOUT: !entry:
  543. // CHECK:STDOUT: return
  544. // CHECK:STDOUT: }
  545. // CHECK:STDOUT: }
  546. // CHECK:STDOUT:
  547. // CHECK:STDOUT: fn @G() {
  548. // CHECK:STDOUT: !entry:
  549. // CHECK:STDOUT: %a.var: ref %array_type.002 = var a
  550. // CHECK:STDOUT: %a: ref %array_type.002 = bind_name a, %a.var
  551. // CHECK:STDOUT: %.loc9_21.1: %empty_struct_type = struct_literal ()
  552. // CHECK:STDOUT: %.loc9_25.1: %empty_struct_type = struct_literal ()
  553. // CHECK:STDOUT: %.loc9_29.1: %empty_struct_type = struct_literal ()
  554. // CHECK:STDOUT: %.loc9_30.1: %tuple.type = tuple_literal (%.loc9_21.1, %.loc9_25.1, %.loc9_29.1)
  555. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0]
  556. // CHECK:STDOUT: %.loc9_30.2: ref %C = array_index %a.var, %int_0
  557. // CHECK:STDOUT: %.loc9_21.2: init %C = class_init (), %.loc9_30.2 [template = constants.%C.val]
  558. // CHECK:STDOUT: %.loc9_30.3: init %C = converted %.loc9_21.1, %.loc9_21.2 [template = constants.%C.val]
  559. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1]
  560. // CHECK:STDOUT: %.loc9_30.4: ref %C = array_index %a.var, %int_1
  561. // CHECK:STDOUT: %.loc9_25.2: init %C = class_init (), %.loc9_30.4 [template = constants.%C.val]
  562. // CHECK:STDOUT: %.loc9_30.5: init %C = converted %.loc9_25.1, %.loc9_25.2 [template = constants.%C.val]
  563. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2]
  564. // CHECK:STDOUT: %.loc9_30.6: ref %C = array_index %a.var, %int_2
  565. // CHECK:STDOUT: %.loc9_29.2: init %C = class_init (), %.loc9_30.6 [template = constants.%C.val]
  566. // CHECK:STDOUT: %.loc9_30.7: init %C = converted %.loc9_29.1, %.loc9_29.2 [template = constants.%C.val]
  567. // CHECK:STDOUT: %.loc9_30.8: init %array_type.002 = array_init (%.loc9_30.3, %.loc9_30.5, %.loc9_30.7) to %a.var [template = constants.%array]
  568. // CHECK:STDOUT: %.loc9_31: init %array_type.002 = converted %.loc9_30.1, %.loc9_30.8 [template = constants.%array]
  569. // CHECK:STDOUT: assign %a.var, %.loc9_31
  570. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F]
  571. // CHECK:STDOUT: %a.ref: ref %array_type.002 = name_ref a, %a
  572. // CHECK:STDOUT: %F.specific_fn: <specific function> = specific_function %F.ref, @F(constants.%C, constants.%int_3) [template = constants.%F.specific_fn]
  573. // CHECK:STDOUT: %.loc10: %array_type.002 = bind_value %a.ref
  574. // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn(%.loc10)
  575. // CHECK:STDOUT: return
  576. // CHECK:STDOUT: }
  577. // CHECK:STDOUT:
  578. // CHECK:STDOUT: specific @F(constants.%T, constants.%N) {
  579. // CHECK:STDOUT: %T.loc6_6.2 => constants.%T
  580. // CHECK:STDOUT: %T.patt.loc6_6.2 => constants.%T
  581. // CHECK:STDOUT: %N.loc6_16.2 => constants.%N
  582. // CHECK:STDOUT: %N.patt.loc6_16.2 => constants.%N
  583. // CHECK:STDOUT: %array_type.loc6_47.2 => constants.%array_type.24b
  584. // CHECK:STDOUT: }
  585. // CHECK:STDOUT:
  586. // CHECK:STDOUT: specific @F(constants.%C, constants.%int_3) {
  587. // CHECK:STDOUT: %T.loc6_6.2 => constants.%C
  588. // CHECK:STDOUT: %T.patt.loc6_6.2 => constants.%C
  589. // CHECK:STDOUT: %N.loc6_16.2 => constants.%int_3
  590. // CHECK:STDOUT: %N.patt.loc6_16.2 => constants.%int_3
  591. // CHECK:STDOUT: %array_type.loc6_47.2 => constants.%array_type.002
  592. // CHECK:STDOUT:
  593. // CHECK:STDOUT: !definition:
  594. // CHECK:STDOUT: %require_complete => constants.%complete_type.dd1
  595. // CHECK:STDOUT: }
  596. // CHECK:STDOUT:
  597. // CHECK:STDOUT: --- fail_bound_mismatch.carbon
  598. // CHECK:STDOUT:
  599. // CHECK:STDOUT: constants {
  600. // CHECK:STDOUT: %C: type = class_type @C [template]
  601. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  602. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [template]
  603. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  604. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  605. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template]
  606. // CHECK:STDOUT: %array_type.2e9: type = array_type %int_2, %T [symbolic]
  607. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  608. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  609. // CHECK:STDOUT: %require_complete.db1: <witness> = require_complete_type %T [symbolic]
  610. // CHECK:STDOUT: %require_complete.a03: <witness> = require_complete_type %array_type.2e9 [symbolic]
  611. // CHECK:STDOUT: %int_0.5c6: Core.IntLiteral = int_value 0 [template]
  612. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
  613. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
  614. // CHECK:STDOUT: %Convert.type.cd1: type = fn_type @Convert.1, @ImplicitAs(%i32) [template]
  615. // CHECK:STDOUT: %impl_witness.5b0: <witness> = impl_witness (imports.%import_ref.723), @impl.1(%int_32) [template]
  616. // CHECK:STDOUT: %Convert.type.466: type = fn_type @Convert.2, @impl.1(%int_32) [template]
  617. // CHECK:STDOUT: %Convert.925: %Convert.type.466 = struct_value () [template]
  618. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_0.5c6, %Convert.925 [template]
  619. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.bound, @Convert.2(%int_32) [template]
  620. // CHECK:STDOUT: %int_0.f61: %i32 = int_value 0 [template]
  621. // CHECK:STDOUT: %G.type: type = fn_type @G [template]
  622. // CHECK:STDOUT: %G: %G.type = struct_value () [template]
  623. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template]
  624. // CHECK:STDOUT: %array_type.002: type = array_type %int_3, %C [template]
  625. // CHECK:STDOUT: %tuple.type: type = tuple_type (%empty_struct_type, %empty_struct_type, %empty_struct_type) [template]
  626. // CHECK:STDOUT: %C.val: %C = struct_value () [template]
  627. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template]
  628. // CHECK:STDOUT: %array: %array_type.002 = tuple_value (%C.val, %C.val, %C.val) [template]
  629. // CHECK:STDOUT: %array_type.15a: type = array_type %int_2, %C [template]
  630. // CHECK:STDOUT: %F.specific_fn: <specific function> = specific_function %F, @F(%C) [template]
  631. // CHECK:STDOUT: %complete_type.8eb: <witness> = complete_type_witness %array_type.15a [template]
  632. // CHECK:STDOUT: }
  633. // CHECK:STDOUT:
  634. // CHECK:STDOUT: imports {
  635. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  636. // CHECK:STDOUT: .Int = %import_ref.187
  637. // CHECK:STDOUT: .ImplicitAs = %import_ref.a69
  638. // CHECK:STDOUT: import Core//prelude
  639. // CHECK:STDOUT: import Core//prelude/...
  640. // CHECK:STDOUT: }
  641. // CHECK:STDOUT: }
  642. // CHECK:STDOUT:
  643. // CHECK:STDOUT: file {
  644. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  645. // CHECK:STDOUT: .Core = imports.%Core
  646. // CHECK:STDOUT: .C = %C.decl
  647. // CHECK:STDOUT: .F = %F.decl
  648. // CHECK:STDOUT: .G = %G.decl
  649. // CHECK:STDOUT: }
  650. // CHECK:STDOUT: %Core.import = import Core
  651. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  652. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
  653. // CHECK:STDOUT: %T.patt.loc6_6.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_6.2 (constants.%T.patt)]
  654. // 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)]
  655. // CHECK:STDOUT: %a.patt: @F.%array_type.loc6_24.2 (%array_type.2e9) = binding_pattern a
  656. // CHECK:STDOUT: %a.param_patt: @F.%array_type.loc6_24.2 (%array_type.2e9) = value_param_pattern %a.patt, runtime_param0
  657. // CHECK:STDOUT: %return.patt: @F.%T.loc6_6.2 (%T) = return_slot_pattern
  658. // CHECK:STDOUT: %return.param_patt: @F.%T.loc6_6.2 (%T) = out_param_pattern %return.patt, runtime_param1
  659. // CHECK:STDOUT: } {
  660. // CHECK:STDOUT: %T.ref.loc6_30: type = name_ref T, %T.loc6_6.1 [symbolic = %T.loc6_6.2 (constants.%T)]
  661. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  662. // CHECK:STDOUT: %T.loc6_6.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc6_6.2 (constants.%T)]
  663. // CHECK:STDOUT: %a.param: @F.%array_type.loc6_24.2 (%array_type.2e9) = value_param runtime_param0
  664. // CHECK:STDOUT: %.loc6_24: type = splice_block %array_type.loc6_24.1 [symbolic = %array_type.loc6_24.2 (constants.%array_type.2e9)] {
  665. // CHECK:STDOUT: %T.ref.loc6_20: type = name_ref T, %T.loc6_6.1 [symbolic = %T.loc6_6.2 (constants.%T)]
  666. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2]
  667. // CHECK:STDOUT: %array_type.loc6_24.1: type = array_type %int_2, %T [symbolic = %array_type.loc6_24.2 (constants.%array_type.2e9)]
  668. // CHECK:STDOUT: }
  669. // CHECK:STDOUT: %a: @F.%array_type.loc6_24.2 (%array_type.2e9) = bind_name a, %a.param
  670. // CHECK:STDOUT: %return.param: ref @F.%T.loc6_6.2 (%T) = out_param runtime_param1
  671. // CHECK:STDOUT: %return: ref @F.%T.loc6_6.2 (%T) = return_slot %return.param
  672. // CHECK:STDOUT: }
  673. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
  674. // CHECK:STDOUT: %return.patt: %C = return_slot_pattern
  675. // CHECK:STDOUT: %return.param_patt: %C = out_param_pattern %return.patt, runtime_param0
  676. // CHECK:STDOUT: } {
  677. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  678. // CHECK:STDOUT: %return.param: ref %C = out_param runtime_param0
  679. // CHECK:STDOUT: %return: ref %C = return_slot %return.param
  680. // CHECK:STDOUT: }
  681. // CHECK:STDOUT: }
  682. // CHECK:STDOUT:
  683. // CHECK:STDOUT: class @C {
  684. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type.357]
  685. // CHECK:STDOUT:
  686. // CHECK:STDOUT: !members:
  687. // CHECK:STDOUT: .Self = constants.%C
  688. // CHECK:STDOUT: complete_type_witness = %complete_type
  689. // CHECK:STDOUT: }
  690. // CHECK:STDOUT:
  691. // CHECK:STDOUT: generic fn @F(%T.loc6_6.1: type) {
  692. // CHECK:STDOUT: %T.loc6_6.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc6_6.2 (constants.%T)]
  693. // CHECK:STDOUT: %T.patt.loc6_6.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_6.2 (constants.%T.patt)]
  694. // CHECK:STDOUT: %array_type.loc6_24.2: type = array_type constants.%int_2, @F.%T.loc6_6.2 (%T) [symbolic = %array_type.loc6_24.2 (constants.%array_type.2e9)]
  695. // CHECK:STDOUT:
  696. // CHECK:STDOUT: !definition:
  697. // CHECK:STDOUT: %require_complete.loc6_27: <witness> = require_complete_type @F.%T.loc6_6.2 (%T) [symbolic = %require_complete.loc6_27 (constants.%require_complete.db1)]
  698. // CHECK:STDOUT: %require_complete.loc6_17: <witness> = require_complete_type @F.%array_type.loc6_24.2 (%array_type.2e9) [symbolic = %require_complete.loc6_17 (constants.%require_complete.a03)]
  699. // CHECK:STDOUT:
  700. // CHECK:STDOUT: fn[%T.param_patt: type](%a.param_patt: @F.%array_type.loc6_24.2 (%array_type.2e9)) -> @F.%T.loc6_6.2 (%T) {
  701. // CHECK:STDOUT: !entry:
  702. // CHECK:STDOUT: %a.ref: @F.%array_type.loc6_24.2 (%array_type.2e9) = name_ref a, %a
  703. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0.5c6]
  704. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  705. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  706. // CHECK:STDOUT: %impl.elem0: %Convert.type.cd1 = impl_witness_access constants.%impl_witness.5b0, element0 [template = constants.%Convert.925]
  707. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_0, %impl.elem0 [template = constants.%Convert.bound]
  708. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.bound, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn]
  709. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %Convert.specific_fn(%int_0) [template = constants.%int_0.f61]
  710. // CHECK:STDOUT: %.loc6_43.1: %i32 = value_of_initializer %int.convert_checked [template = constants.%int_0.f61]
  711. // CHECK:STDOUT: %.loc6_43.2: %i32 = converted %int_0, %.loc6_43.1 [template = constants.%int_0.f61]
  712. // CHECK:STDOUT: %.loc6_44.1: ref @F.%array_type.loc6_24.2 (%array_type.2e9) = value_as_ref %a.ref
  713. // CHECK:STDOUT: %.loc6_44.2: ref @F.%T.loc6_6.2 (%T) = array_index %.loc6_44.1, %.loc6_43.2
  714. // CHECK:STDOUT: %.loc6_44.3: @F.%T.loc6_6.2 (%T) = bind_value %.loc6_44.2
  715. // CHECK:STDOUT: return %.loc6_44.3
  716. // CHECK:STDOUT: }
  717. // CHECK:STDOUT: }
  718. // CHECK:STDOUT:
  719. // CHECK:STDOUT: fn @G() -> %return.param_patt: %C {
  720. // CHECK:STDOUT: !entry:
  721. // CHECK:STDOUT: %a.var: ref %array_type.002 = var a
  722. // CHECK:STDOUT: %a: ref %array_type.002 = bind_name a, %a.var
  723. // CHECK:STDOUT: %.loc10_21.1: %empty_struct_type = struct_literal ()
  724. // CHECK:STDOUT: %.loc10_25.1: %empty_struct_type = struct_literal ()
  725. // CHECK:STDOUT: %.loc10_29.1: %empty_struct_type = struct_literal ()
  726. // CHECK:STDOUT: %.loc10_30.1: %tuple.type = tuple_literal (%.loc10_21.1, %.loc10_25.1, %.loc10_29.1)
  727. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0.5c6]
  728. // CHECK:STDOUT: %.loc10_30.2: ref %C = array_index %a.var, %int_0
  729. // CHECK:STDOUT: %.loc10_21.2: init %C = class_init (), %.loc10_30.2 [template = constants.%C.val]
  730. // CHECK:STDOUT: %.loc10_30.3: init %C = converted %.loc10_21.1, %.loc10_21.2 [template = constants.%C.val]
  731. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1]
  732. // CHECK:STDOUT: %.loc10_30.4: ref %C = array_index %a.var, %int_1
  733. // CHECK:STDOUT: %.loc10_25.2: init %C = class_init (), %.loc10_30.4 [template = constants.%C.val]
  734. // CHECK:STDOUT: %.loc10_30.5: init %C = converted %.loc10_25.1, %.loc10_25.2 [template = constants.%C.val]
  735. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2]
  736. // CHECK:STDOUT: %.loc10_30.6: ref %C = array_index %a.var, %int_2
  737. // CHECK:STDOUT: %.loc10_29.2: init %C = class_init (), %.loc10_30.6 [template = constants.%C.val]
  738. // CHECK:STDOUT: %.loc10_30.7: init %C = converted %.loc10_29.1, %.loc10_29.2 [template = constants.%C.val]
  739. // CHECK:STDOUT: %.loc10_30.8: init %array_type.002 = array_init (%.loc10_30.3, %.loc10_30.5, %.loc10_30.7) to %a.var [template = constants.%array]
  740. // CHECK:STDOUT: %.loc10_31: init %array_type.002 = converted %.loc10_30.1, %.loc10_30.8 [template = constants.%array]
  741. // CHECK:STDOUT: assign %a.var, %.loc10_31
  742. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F]
  743. // CHECK:STDOUT: %a.ref: ref %array_type.002 = name_ref a, %a
  744. // CHECK:STDOUT: %F.specific_fn: <specific function> = specific_function %F.ref, @F(constants.%C) [template = constants.%F.specific_fn]
  745. // CHECK:STDOUT: %.loc8: ref %C = splice_block %return {}
  746. // CHECK:STDOUT: %.loc21: %array_type.15a = converted %a.ref, <error> [template = <error>]
  747. // CHECK:STDOUT: %F.call: init %C = call %F.specific_fn(<error>) to %.loc8
  748. // CHECK:STDOUT: return %F.call to %return
  749. // CHECK:STDOUT: }
  750. // CHECK:STDOUT:
  751. // CHECK:STDOUT: specific @F(constants.%T) {
  752. // CHECK:STDOUT: %T.loc6_6.2 => constants.%T
  753. // CHECK:STDOUT: %T.patt.loc6_6.2 => constants.%T
  754. // CHECK:STDOUT: %array_type.loc6_24.2 => constants.%array_type.2e9
  755. // CHECK:STDOUT: }
  756. // CHECK:STDOUT:
  757. // CHECK:STDOUT: specific @F(constants.%C) {
  758. // CHECK:STDOUT: %T.loc6_6.2 => constants.%C
  759. // CHECK:STDOUT: %T.patt.loc6_6.2 => constants.%C
  760. // CHECK:STDOUT: %array_type.loc6_24.2 => constants.%array_type.15a
  761. // CHECK:STDOUT:
  762. // CHECK:STDOUT: !definition:
  763. // CHECK:STDOUT: %require_complete.loc6_27 => constants.%complete_type.357
  764. // CHECK:STDOUT: %require_complete.loc6_17 => constants.%complete_type.8eb
  765. // CHECK:STDOUT: }
  766. // CHECK:STDOUT:
  767. // CHECK:STDOUT: --- fail_type_mismatch.carbon
  768. // CHECK:STDOUT:
  769. // CHECK:STDOUT: constants {
  770. // CHECK:STDOUT: %C: type = class_type @C [template]
  771. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  772. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [template]
  773. // CHECK:STDOUT: %D: type = class_type @D [template]
  774. // CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template]
  775. // CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template]
  776. // CHECK:STDOUT: %N.f0243b.1: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic]
  777. // CHECK:STDOUT: %N.patt.7d2de8.1: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic]
  778. // CHECK:STDOUT: %array_type.f81: type = array_type %N.f0243b.1, %C [symbolic]
  779. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
  780. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
  781. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  782. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  783. // CHECK:STDOUT: %require_complete.109: <witness> = require_complete_type %array_type.f81 [symbolic]
  784. // CHECK:STDOUT: %Convert.type.cd1: type = fn_type @Convert.1, @ImplicitAs(%i32) [template]
  785. // CHECK:STDOUT: %impl_witness.5b0: <witness> = impl_witness (imports.%import_ref.723), @impl.1(%int_32) [template]
  786. // CHECK:STDOUT: %Convert.type.466: type = fn_type @Convert.2, @impl.1(%int_32) [template]
  787. // CHECK:STDOUT: %Convert.925: %Convert.type.466 = struct_value () [template]
  788. // CHECK:STDOUT: %Convert.bound.2a5: <bound method> = bound_method %N.f0243b.1, %Convert.925 [symbolic]
  789. // CHECK:STDOUT: %Convert.specific_fn.660: <specific function> = specific_function %Convert.bound.2a5, @Convert.2(%int_32) [symbolic]
  790. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %Convert.specific_fn.660(%N.f0243b.1) [symbolic]
  791. // CHECK:STDOUT: %G.type: type = fn_type @G [template]
  792. // CHECK:STDOUT: %G: %G.type = struct_value () [template]
  793. // CHECK:STDOUT: %int_3.1ba: Core.IntLiteral = int_value 3 [template]
  794. // CHECK:STDOUT: %array_type.fe4: type = array_type %int_3.1ba, %D [template]
  795. // CHECK:STDOUT: %tuple.type: type = tuple_type (%empty_struct_type, %empty_struct_type, %empty_struct_type) [template]
  796. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template]
  797. // CHECK:STDOUT: %D.val: %D = struct_value () [template]
  798. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template]
  799. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template]
  800. // CHECK:STDOUT: %array: %array_type.fe4 = tuple_value (%D.val, %D.val, %D.val) [template]
  801. // CHECK:STDOUT: %array_type.002: type = array_type %int_3.1ba, %C [template]
  802. // CHECK:STDOUT: %F.specific_fn: <specific function> = specific_function %F, @F(%int_3.1ba) [template]
  803. // CHECK:STDOUT: %complete_type.dd1: <witness> = complete_type_witness %array_type.002 [template]
  804. // CHECK:STDOUT: %Convert.bound.0db: <bound method> = bound_method %int_3.1ba, %Convert.925 [template]
  805. // CHECK:STDOUT: %Convert.specific_fn.456: <specific function> = specific_function %Convert.bound.0db, @Convert.2(%int_32) [template]
  806. // CHECK:STDOUT: %int_3.25b: %i32 = int_value 3 [template]
  807. // CHECK:STDOUT: }
  808. // CHECK:STDOUT:
  809. // CHECK:STDOUT: imports {
  810. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  811. // CHECK:STDOUT: .IntLiteral = %import_ref.8ee
  812. // CHECK:STDOUT: .Int = %import_ref.187
  813. // CHECK:STDOUT: .ImplicitAs = %import_ref.a69
  814. // CHECK:STDOUT: import Core//prelude
  815. // CHECK:STDOUT: import Core//prelude/...
  816. // CHECK:STDOUT: }
  817. // CHECK:STDOUT: %import_ref.8ee: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral]
  818. // CHECK:STDOUT: }
  819. // CHECK:STDOUT:
  820. // CHECK:STDOUT: file {
  821. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  822. // CHECK:STDOUT: .Core = imports.%Core
  823. // CHECK:STDOUT: .C = %C.decl
  824. // CHECK:STDOUT: .D = %D.decl
  825. // CHECK:STDOUT: .F = %F.decl
  826. // CHECK:STDOUT: .G = %G.decl
  827. // CHECK:STDOUT: }
  828. // CHECK:STDOUT: %Core.import = import Core
  829. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  830. // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} {}
  831. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
  832. // CHECK:STDOUT: %N.patt.loc7_6.1: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc7_6.2 (constants.%N.patt.7d2de8.1)]
  833. // CHECK:STDOUT: %N.param_patt: Core.IntLiteral = value_param_pattern %N.patt.loc7_6.1, runtime_param<invalid> [symbolic = %N.patt.loc7_6.2 (constants.%N.patt.7d2de8.1)]
  834. // CHECK:STDOUT: %a.patt: @F.%array_type.loc7_37.2 (%array_type.f81) = binding_pattern a
  835. // CHECK:STDOUT: %a.param_patt: @F.%array_type.loc7_37.2 (%array_type.f81) = value_param_pattern %a.patt, runtime_param0
  836. // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern
  837. // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1
  838. // CHECK:STDOUT: } {
  839. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  840. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  841. // CHECK:STDOUT: %N.param: Core.IntLiteral = value_param runtime_param<invalid>
  842. // CHECK:STDOUT: %.loc7_26.1: type = splice_block %.loc7_26.3 [template = Core.IntLiteral] {
  843. // CHECK:STDOUT: %Core.ref: <namespace> = name_ref Core, imports.%Core [template = imports.%Core]
  844. // CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.8ee [template = constants.%IntLiteral]
  845. // CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral]
  846. // CHECK:STDOUT: %.loc7_26.2: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral]
  847. // CHECK:STDOUT: %.loc7_26.3: type = converted %int_literal.make_type, %.loc7_26.2 [template = Core.IntLiteral]
  848. // CHECK:STDOUT: }
  849. // CHECK:STDOUT: %N.loc7_6.1: Core.IntLiteral = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc7_6.2 (constants.%N.f0243b.1)]
  850. // CHECK:STDOUT: %a.param: @F.%array_type.loc7_37.2 (%array_type.f81) = value_param runtime_param0
  851. // CHECK:STDOUT: %.loc7_37: type = splice_block %array_type.loc7_37.1 [symbolic = %array_type.loc7_37.2 (constants.%array_type.f81)] {
  852. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  853. // CHECK:STDOUT: %N.ref.loc7_36: Core.IntLiteral = name_ref N, %N.loc7_6.1 [symbolic = %N.loc7_6.2 (constants.%N.f0243b.1)]
  854. // CHECK:STDOUT: %array_type.loc7_37.1: type = array_type %N.ref.loc7_36, %C [symbolic = %array_type.loc7_37.2 (constants.%array_type.f81)]
  855. // CHECK:STDOUT: }
  856. // CHECK:STDOUT: %a: @F.%array_type.loc7_37.2 (%array_type.f81) = bind_name a, %a.param
  857. // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1
  858. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  859. // CHECK:STDOUT: }
  860. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
  861. // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern
  862. // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param0
  863. // CHECK:STDOUT: } {
  864. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  865. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  866. // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param0
  867. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  868. // CHECK:STDOUT: }
  869. // CHECK:STDOUT: }
  870. // CHECK:STDOUT:
  871. // CHECK:STDOUT: class @C {
  872. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type.357]
  873. // CHECK:STDOUT:
  874. // CHECK:STDOUT: !members:
  875. // CHECK:STDOUT: .Self = constants.%C
  876. // CHECK:STDOUT: complete_type_witness = %complete_type
  877. // CHECK:STDOUT: }
  878. // CHECK:STDOUT:
  879. // CHECK:STDOUT: class @D {
  880. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type.357]
  881. // CHECK:STDOUT:
  882. // CHECK:STDOUT: !members:
  883. // CHECK:STDOUT: .Self = constants.%D
  884. // CHECK:STDOUT: complete_type_witness = %complete_type
  885. // CHECK:STDOUT: }
  886. // CHECK:STDOUT:
  887. // CHECK:STDOUT: generic fn @F(%N.loc7_6.1: Core.IntLiteral) {
  888. // CHECK:STDOUT: %N.loc7_6.2: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N.loc7_6.2 (constants.%N.f0243b.1)]
  889. // CHECK:STDOUT: %N.patt.loc7_6.2: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc7_6.2 (constants.%N.patt.7d2de8.1)]
  890. // CHECK:STDOUT: %array_type.loc7_37.2: type = array_type %N.loc7_6.2, %C [symbolic = %array_type.loc7_37.2 (constants.%array_type.f81)]
  891. // CHECK:STDOUT:
  892. // CHECK:STDOUT: !definition:
  893. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type @F.%array_type.loc7_37.2 (%array_type.f81) [symbolic = %require_complete (constants.%require_complete.109)]
  894. // CHECK:STDOUT: %Convert.bound.loc7_57.2: <bound method> = bound_method %N.loc7_6.2, constants.%Convert.925 [symbolic = %Convert.bound.loc7_57.2 (constants.%Convert.bound.2a5)]
  895. // CHECK:STDOUT: %Convert.specific_fn.loc7_57.2: <specific function> = specific_function %Convert.bound.loc7_57.2, @Convert.2(constants.%int_32) [symbolic = %Convert.specific_fn.loc7_57.2 (constants.%Convert.specific_fn.660)]
  896. // CHECK:STDOUT: %int.convert_checked.loc7_57.2: init %i32 = call %Convert.specific_fn.loc7_57.2(%N.loc7_6.2) [symbolic = %int.convert_checked.loc7_57.2 (constants.%int.convert_checked)]
  897. // CHECK:STDOUT:
  898. // CHECK:STDOUT: fn[%N.param_patt: Core.IntLiteral](%a.param_patt: @F.%array_type.loc7_37.2 (%array_type.f81)) -> %i32 {
  899. // CHECK:STDOUT: !entry:
  900. // CHECK:STDOUT: %N.ref.loc7_56: Core.IntLiteral = name_ref N, %N.loc7_6.1 [symbolic = %N.loc7_6.2 (constants.%N.f0243b.1)]
  901. // CHECK:STDOUT: %impl.elem0: %Convert.type.cd1 = impl_witness_access constants.%impl_witness.5b0, element0 [template = constants.%Convert.925]
  902. // CHECK:STDOUT: %Convert.bound.loc7_57.1: <bound method> = bound_method %N.ref.loc7_56, %impl.elem0 [symbolic = %Convert.bound.loc7_57.2 (constants.%Convert.bound.2a5)]
  903. // CHECK:STDOUT: %Convert.specific_fn.loc7_57.1: <specific function> = specific_function %Convert.bound.loc7_57.1, @Convert.2(constants.%int_32) [symbolic = %Convert.specific_fn.loc7_57.2 (constants.%Convert.specific_fn.660)]
  904. // CHECK:STDOUT: %int.convert_checked.loc7_57.1: init %i32 = call %Convert.specific_fn.loc7_57.1(%N.ref.loc7_56) [symbolic = %int.convert_checked.loc7_57.2 (constants.%int.convert_checked)]
  905. // CHECK:STDOUT: %.loc7_57.1: %i32 = value_of_initializer %int.convert_checked.loc7_57.1 [symbolic = %int.convert_checked.loc7_57.2 (constants.%int.convert_checked)]
  906. // CHECK:STDOUT: %.loc7_57.2: %i32 = converted %N.ref.loc7_56, %.loc7_57.1 [symbolic = %int.convert_checked.loc7_57.2 (constants.%int.convert_checked)]
  907. // CHECK:STDOUT: return %.loc7_57.2
  908. // CHECK:STDOUT: }
  909. // CHECK:STDOUT: }
  910. // CHECK:STDOUT:
  911. // CHECK:STDOUT: fn @G() -> %i32 {
  912. // CHECK:STDOUT: !entry:
  913. // CHECK:STDOUT: %a.var: ref %array_type.fe4 = var a
  914. // CHECK:STDOUT: %a: ref %array_type.fe4 = bind_name a, %a.var
  915. // CHECK:STDOUT: %.loc11_21.1: %empty_struct_type = struct_literal ()
  916. // CHECK:STDOUT: %.loc11_25.1: %empty_struct_type = struct_literal ()
  917. // CHECK:STDOUT: %.loc11_29.1: %empty_struct_type = struct_literal ()
  918. // CHECK:STDOUT: %.loc11_30.1: %tuple.type = tuple_literal (%.loc11_21.1, %.loc11_25.1, %.loc11_29.1)
  919. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0]
  920. // CHECK:STDOUT: %.loc11_30.2: ref %D = array_index %a.var, %int_0
  921. // CHECK:STDOUT: %.loc11_21.2: init %D = class_init (), %.loc11_30.2 [template = constants.%D.val]
  922. // CHECK:STDOUT: %.loc11_30.3: init %D = converted %.loc11_21.1, %.loc11_21.2 [template = constants.%D.val]
  923. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1]
  924. // CHECK:STDOUT: %.loc11_30.4: ref %D = array_index %a.var, %int_1
  925. // CHECK:STDOUT: %.loc11_25.2: init %D = class_init (), %.loc11_30.4 [template = constants.%D.val]
  926. // CHECK:STDOUT: %.loc11_30.5: init %D = converted %.loc11_25.1, %.loc11_25.2 [template = constants.%D.val]
  927. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2]
  928. // CHECK:STDOUT: %.loc11_30.6: ref %D = array_index %a.var, %int_2
  929. // CHECK:STDOUT: %.loc11_29.2: init %D = class_init (), %.loc11_30.6 [template = constants.%D.val]
  930. // CHECK:STDOUT: %.loc11_30.7: init %D = converted %.loc11_29.1, %.loc11_29.2 [template = constants.%D.val]
  931. // CHECK:STDOUT: %.loc11_30.8: init %array_type.fe4 = array_init (%.loc11_30.3, %.loc11_30.5, %.loc11_30.7) to %a.var [template = constants.%array]
  932. // CHECK:STDOUT: %.loc11_31: init %array_type.fe4 = converted %.loc11_30.1, %.loc11_30.8 [template = constants.%array]
  933. // CHECK:STDOUT: assign %a.var, %.loc11_31
  934. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F]
  935. // CHECK:STDOUT: %a.ref: ref %array_type.fe4 = name_ref a, %a
  936. // CHECK:STDOUT: %F.specific_fn: <specific function> = specific_function %F.ref, @F(constants.%int_3.1ba) [template = constants.%F.specific_fn]
  937. // CHECK:STDOUT: %.loc22_12: %array_type.002 = converted %a.ref, <error> [template = <error>]
  938. // CHECK:STDOUT: %F.call: init %i32 = call %F.specific_fn(<error>)
  939. // CHECK:STDOUT: %.loc22_14.1: %i32 = value_of_initializer %F.call
  940. // CHECK:STDOUT: %.loc22_14.2: %i32 = converted %F.call, %.loc22_14.1
  941. // CHECK:STDOUT: return %.loc22_14.2
  942. // CHECK:STDOUT: }
  943. // CHECK:STDOUT:
  944. // CHECK:STDOUT: specific @F(constants.%N.f0243b.1) {
  945. // CHECK:STDOUT: %N.loc7_6.2 => constants.%N.f0243b.1
  946. // CHECK:STDOUT: %N.patt.loc7_6.2 => constants.%N.f0243b.1
  947. // CHECK:STDOUT: %array_type.loc7_37.2 => constants.%array_type.f81
  948. // CHECK:STDOUT: }
  949. // CHECK:STDOUT:
  950. // CHECK:STDOUT: specific @F(constants.%int_3.1ba) {
  951. // CHECK:STDOUT: %N.loc7_6.2 => constants.%int_3.1ba
  952. // CHECK:STDOUT: %N.patt.loc7_6.2 => constants.%int_3.1ba
  953. // CHECK:STDOUT: %array_type.loc7_37.2 => constants.%array_type.002
  954. // CHECK:STDOUT:
  955. // CHECK:STDOUT: !definition:
  956. // CHECK:STDOUT: %require_complete => constants.%complete_type.dd1
  957. // CHECK:STDOUT: %Convert.bound.loc7_57.2 => constants.%Convert.bound.0db
  958. // CHECK:STDOUT: %Convert.specific_fn.loc7_57.2 => constants.%Convert.specific_fn.456
  959. // CHECK:STDOUT: %int.convert_checked.loc7_57.2 => constants.%int_3.25b
  960. // CHECK:STDOUT: }
  961. // CHECK:STDOUT:
  962. // CHECK:STDOUT: --- fail_bound_type_mismatch.carbon
  963. // CHECK:STDOUT:
  964. // CHECK:STDOUT: constants {
  965. // CHECK:STDOUT: %C: type = class_type @C [template]
  966. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  967. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [template]
  968. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
  969. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
  970. // CHECK:STDOUT: %N.3e4: %i32 = bind_symbolic_name N, 0 [symbolic]
  971. // CHECK:STDOUT: %N.patt.52a: %i32 = symbolic_binding_pattern N, 0 [symbolic]
  972. // CHECK:STDOUT: %Convert.type.a9b: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template]
  973. // CHECK:STDOUT: %impl_witness.dd3: <witness> = impl_witness (imports.%import_ref.a80), @impl.2(%int_32) [template]
  974. // CHECK:STDOUT: %Convert.type.d18: type = fn_type @Convert.3, @impl.2(%int_32) [template]
  975. // CHECK:STDOUT: %Convert.079: %Convert.type.d18 = struct_value () [template]
  976. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %N.3e4, %Convert.079 [symbolic]
  977. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.bound, @Convert.3(%int_32) [symbolic]
  978. // CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %Convert.specific_fn(%N.3e4) [symbolic]
  979. // CHECK:STDOUT: %array_type.044: type = array_type %int.convert_checked, %C [symbolic]
  980. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  981. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  982. // CHECK:STDOUT: %require_complete.54c: <witness> = require_complete_type %array_type.044 [symbolic]
  983. // CHECK:STDOUT: %G.type: type = fn_type @G [template]
  984. // CHECK:STDOUT: %G: %G.type = struct_value () [template]
  985. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template]
  986. // CHECK:STDOUT: %array_type.002: type = array_type %int_3, %C [template]
  987. // CHECK:STDOUT: %tuple.type: type = tuple_type (%empty_struct_type, %empty_struct_type, %empty_struct_type) [template]
  988. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template]
  989. // CHECK:STDOUT: %C.val: %C = struct_value () [template]
  990. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template]
  991. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template]
  992. // CHECK:STDOUT: %array: %array_type.002 = tuple_value (%C.val, %C.val, %C.val) [template]
  993. // CHECK:STDOUT: }
  994. // CHECK:STDOUT:
  995. // CHECK:STDOUT: imports {
  996. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  997. // CHECK:STDOUT: .Int = %import_ref.187
  998. // CHECK:STDOUT: .ImplicitAs = %import_ref.a69
  999. // CHECK:STDOUT: import Core//prelude
  1000. // CHECK:STDOUT: import Core//prelude/...
  1001. // CHECK:STDOUT: }
  1002. // CHECK:STDOUT: }
  1003. // CHECK:STDOUT:
  1004. // CHECK:STDOUT: file {
  1005. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1006. // CHECK:STDOUT: .Core = imports.%Core
  1007. // CHECK:STDOUT: .C = %C.decl
  1008. // CHECK:STDOUT: .F = %F.decl
  1009. // CHECK:STDOUT: .G = %G.decl
  1010. // CHECK:STDOUT: }
  1011. // CHECK:STDOUT: %Core.import = import Core
  1012. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  1013. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
  1014. // CHECK:STDOUT: %N.patt.loc6_6.1: %i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_6.2 (constants.%N.patt.52a)]
  1015. // CHECK:STDOUT: %N.param_patt: %i32 = value_param_pattern %N.patt.loc6_6.1, runtime_param<invalid> [symbolic = %N.patt.loc6_6.2 (constants.%N.patt.52a)]
  1016. // CHECK:STDOUT: %a.patt: @F.%array_type.loc6_23.2 (%array_type.044) = binding_pattern a
  1017. // CHECK:STDOUT: %a.param_patt: @F.%array_type.loc6_23.2 (%array_type.044) = value_param_pattern %a.patt, runtime_param0
  1018. // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern
  1019. // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1
  1020. // CHECK:STDOUT: } {
  1021. // CHECK:STDOUT: %int_32.loc6_29: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  1022. // CHECK:STDOUT: %i32.loc6_29: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  1023. // CHECK:STDOUT: %N.param: %i32 = value_param runtime_param<invalid>
  1024. // CHECK:STDOUT: %.loc6_10: type = splice_block %i32.loc6_10 [template = constants.%i32] {
  1025. // CHECK:STDOUT: %int_32.loc6_10: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  1026. // CHECK:STDOUT: %i32.loc6_10: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  1027. // CHECK:STDOUT: }
  1028. // CHECK:STDOUT: %N.loc6_6.1: %i32 = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc6_6.2 (constants.%N.3e4)]
  1029. // CHECK:STDOUT: %a.param: @F.%array_type.loc6_23.2 (%array_type.044) = value_param runtime_param0
  1030. // CHECK:STDOUT: %.loc6_23: type = splice_block %array_type.loc6_23.1 [symbolic = %array_type.loc6_23.2 (constants.%array_type.044)] {
  1031. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  1032. // CHECK:STDOUT: %N.ref.loc6_22: %i32 = name_ref N, %N.loc6_6.1 [symbolic = %N.loc6_6.2 (constants.%N.3e4)]
  1033. // CHECK:STDOUT: %impl.elem0: %Convert.type.a9b = impl_witness_access constants.%impl_witness.dd3, element0 [template = constants.%Convert.079]
  1034. // CHECK:STDOUT: %Convert.bound.loc6_22.1: <bound method> = bound_method %N.ref.loc6_22, %impl.elem0 [symbolic = %Convert.bound.loc6_22.2 (constants.%Convert.bound)]
  1035. // CHECK:STDOUT: %Convert.specific_fn.loc6_22.1: <specific function> = specific_function %Convert.bound.loc6_22.1, @Convert.3(constants.%int_32) [symbolic = %Convert.specific_fn.loc6_22.2 (constants.%Convert.specific_fn)]
  1036. // CHECK:STDOUT: %int.convert_checked.loc6_22.1: init Core.IntLiteral = call %Convert.specific_fn.loc6_22.1(%N.ref.loc6_22) [symbolic = %int.convert_checked.loc6_22.2 (constants.%int.convert_checked)]
  1037. // CHECK:STDOUT: %.loc6_22.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc6_22.1 [symbolic = %int.convert_checked.loc6_22.2 (constants.%int.convert_checked)]
  1038. // CHECK:STDOUT: %.loc6_22.2: Core.IntLiteral = converted %N.ref.loc6_22, %.loc6_22.1 [symbolic = %int.convert_checked.loc6_22.2 (constants.%int.convert_checked)]
  1039. // CHECK:STDOUT: %array_type.loc6_23.1: type = array_type %.loc6_22.2, %C [symbolic = %array_type.loc6_23.2 (constants.%array_type.044)]
  1040. // CHECK:STDOUT: }
  1041. // CHECK:STDOUT: %a: @F.%array_type.loc6_23.2 (%array_type.044) = bind_name a, %a.param
  1042. // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1
  1043. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  1044. // CHECK:STDOUT: }
  1045. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
  1046. // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern
  1047. // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param0
  1048. // CHECK:STDOUT: } {
  1049. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  1050. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  1051. // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param0
  1052. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  1053. // CHECK:STDOUT: }
  1054. // CHECK:STDOUT: }
  1055. // CHECK:STDOUT:
  1056. // CHECK:STDOUT: class @C {
  1057. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type.357]
  1058. // CHECK:STDOUT:
  1059. // CHECK:STDOUT: !members:
  1060. // CHECK:STDOUT: .Self = constants.%C
  1061. // CHECK:STDOUT: complete_type_witness = %complete_type
  1062. // CHECK:STDOUT: }
  1063. // CHECK:STDOUT:
  1064. // CHECK:STDOUT: generic fn @F(%N.loc6_6.1: %i32) {
  1065. // CHECK:STDOUT: %N.loc6_6.2: %i32 = bind_symbolic_name N, 0 [symbolic = %N.loc6_6.2 (constants.%N.3e4)]
  1066. // CHECK:STDOUT: %N.patt.loc6_6.2: %i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_6.2 (constants.%N.patt.52a)]
  1067. // CHECK:STDOUT: %Convert.bound.loc6_22.2: <bound method> = bound_method %N.loc6_6.2, constants.%Convert.079 [symbolic = %Convert.bound.loc6_22.2 (constants.%Convert.bound)]
  1068. // CHECK:STDOUT: %Convert.specific_fn.loc6_22.2: <specific function> = specific_function %Convert.bound.loc6_22.2, @Convert.3(constants.%int_32) [symbolic = %Convert.specific_fn.loc6_22.2 (constants.%Convert.specific_fn)]
  1069. // CHECK:STDOUT: %int.convert_checked.loc6_22.2: init Core.IntLiteral = call %Convert.specific_fn.loc6_22.2(%N.loc6_6.2) [symbolic = %int.convert_checked.loc6_22.2 (constants.%int.convert_checked)]
  1070. // CHECK:STDOUT: %array_type.loc6_23.2: type = array_type %int.convert_checked.loc6_22.2, %C [symbolic = %array_type.loc6_23.2 (constants.%array_type.044)]
  1071. // CHECK:STDOUT:
  1072. // CHECK:STDOUT: !definition:
  1073. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type @F.%array_type.loc6_23.2 (%array_type.044) [symbolic = %require_complete (constants.%require_complete.54c)]
  1074. // CHECK:STDOUT:
  1075. // CHECK:STDOUT: fn[%N.param_patt: %i32](%a.param_patt: @F.%array_type.loc6_23.2 (%array_type.044)) -> %i32 {
  1076. // CHECK:STDOUT: !entry:
  1077. // CHECK:STDOUT: %N.ref.loc6_42: %i32 = name_ref N, %N.loc6_6.1 [symbolic = %N.loc6_6.2 (constants.%N.3e4)]
  1078. // CHECK:STDOUT: return %N.ref.loc6_42
  1079. // CHECK:STDOUT: }
  1080. // CHECK:STDOUT: }
  1081. // CHECK:STDOUT:
  1082. // CHECK:STDOUT: fn @G() -> %i32 {
  1083. // CHECK:STDOUT: !entry:
  1084. // CHECK:STDOUT: %a.var: ref %array_type.002 = var a
  1085. // CHECK:STDOUT: %a: ref %array_type.002 = bind_name a, %a.var
  1086. // CHECK:STDOUT: %.loc9_21.1: %empty_struct_type = struct_literal ()
  1087. // CHECK:STDOUT: %.loc9_25.1: %empty_struct_type = struct_literal ()
  1088. // CHECK:STDOUT: %.loc9_29.1: %empty_struct_type = struct_literal ()
  1089. // CHECK:STDOUT: %.loc9_30.1: %tuple.type = tuple_literal (%.loc9_21.1, %.loc9_25.1, %.loc9_29.1)
  1090. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0]
  1091. // CHECK:STDOUT: %.loc9_30.2: ref %C = array_index %a.var, %int_0
  1092. // CHECK:STDOUT: %.loc9_21.2: init %C = class_init (), %.loc9_30.2 [template = constants.%C.val]
  1093. // CHECK:STDOUT: %.loc9_30.3: init %C = converted %.loc9_21.1, %.loc9_21.2 [template = constants.%C.val]
  1094. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1]
  1095. // CHECK:STDOUT: %.loc9_30.4: ref %C = array_index %a.var, %int_1
  1096. // CHECK:STDOUT: %.loc9_25.2: init %C = class_init (), %.loc9_30.4 [template = constants.%C.val]
  1097. // CHECK:STDOUT: %.loc9_30.5: init %C = converted %.loc9_25.1, %.loc9_25.2 [template = constants.%C.val]
  1098. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2]
  1099. // CHECK:STDOUT: %.loc9_30.6: ref %C = array_index %a.var, %int_2
  1100. // CHECK:STDOUT: %.loc9_29.2: init %C = class_init (), %.loc9_30.6 [template = constants.%C.val]
  1101. // CHECK:STDOUT: %.loc9_30.7: init %C = converted %.loc9_29.1, %.loc9_29.2 [template = constants.%C.val]
  1102. // CHECK:STDOUT: %.loc9_30.8: init %array_type.002 = array_init (%.loc9_30.3, %.loc9_30.5, %.loc9_30.7) to %a.var [template = constants.%array]
  1103. // CHECK:STDOUT: %.loc9_31: init %array_type.002 = converted %.loc9_30.1, %.loc9_30.8 [template = constants.%array]
  1104. // CHECK:STDOUT: assign %a.var, %.loc9_31
  1105. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F]
  1106. // CHECK:STDOUT: %a.ref: ref %array_type.002 = name_ref a, %a
  1107. // CHECK:STDOUT: return <error>
  1108. // CHECK:STDOUT: }
  1109. // CHECK:STDOUT:
  1110. // CHECK:STDOUT: specific @F(constants.%N.3e4) {
  1111. // CHECK:STDOUT: %N.loc6_6.2 => constants.%N.3e4
  1112. // CHECK:STDOUT: %N.patt.loc6_6.2 => constants.%N.3e4
  1113. // CHECK:STDOUT: %Convert.bound.loc6_22.2 => constants.%Convert.bound
  1114. // CHECK:STDOUT: %Convert.specific_fn.loc6_22.2 => constants.%Convert.specific_fn
  1115. // CHECK:STDOUT: %int.convert_checked.loc6_22.2 => constants.%int.convert_checked
  1116. // CHECK:STDOUT: %array_type.loc6_23.2 => constants.%array_type.044
  1117. // CHECK:STDOUT: }
  1118. // CHECK:STDOUT: