deduce.carbon 87 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419
  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/function/generic/deduce.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/generic/deduce.carbon
  10. // --- deduce_explicit.carbon
  11. library "[[@TEST_NAME]]";
  12. fn ExplicitGenericParam(T:! type) -> T* { return ExplicitGenericParam(T); }
  13. fn CallExplicitGenericParam() -> i32* {
  14. return ExplicitGenericParam(i32);
  15. }
  16. fn CallExplicitGenericParamWithGenericArg(T:! type) -> {.a: T}* {
  17. return ExplicitGenericParam({.a: T});
  18. }
  19. // --- fail_deduce_explicit_non_constant.carbon
  20. library "[[@TEST_NAME]]";
  21. fn ExplicitGenericParam(T:! type) -> T* { return ExplicitGenericParam(T); }
  22. fn CallExplicitGenericParamConst(T:! type) {
  23. ExplicitGenericParam(T);
  24. }
  25. fn CallExplicitGenericParamNonConst(T: type) {
  26. // CHECK:STDERR: fail_deduce_explicit_non_constant.carbon:[[@LINE+7]]:3: error: argument for generic parameter is not a compile-time constant [CompTimeArgumentNotConstant]
  27. // CHECK:STDERR: ExplicitGenericParam(T);
  28. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
  29. // CHECK:STDERR: fail_deduce_explicit_non_constant.carbon:[[@LINE-10]]:25: note: initializing generic parameter `T` declared here [InitializingGenericParam]
  30. // CHECK:STDERR: fn ExplicitGenericParam(T:! type) -> T* { return ExplicitGenericParam(T); }
  31. // CHECK:STDERR: ^
  32. // CHECK:STDERR:
  33. ExplicitGenericParam(T);
  34. }
  35. // --- explicit_vs_deduced.carbon
  36. library "[[@TEST_NAME]]";
  37. class A {}
  38. fn ExplicitAndAlsoDeduced(T:! type, x: T) -> T* {
  39. return ExplicitAndAlsoDeduced(T, x);
  40. }
  41. fn CallExplicitAndAlsoDeduced() -> A* {
  42. return ExplicitAndAlsoDeduced(A, {});
  43. }
  44. // --- deduce_implicit.carbon
  45. library "[[@TEST_NAME]]";
  46. fn ImplicitGenericParam[T:! type](x: T) -> T* { return ImplicitGenericParam(x); }
  47. fn CallImplicitGenericParam(n: i32) -> i32* {
  48. return ImplicitGenericParam(n);
  49. }
  50. // --- deduce_nested_tuple.carbon
  51. library "[[@TEST_NAME]]";
  52. fn TupleParam[T:! type](x: (T, i32)) {}
  53. fn CallTupleParam() {
  54. TupleParam((1, 2));
  55. }
  56. // --- deduce_nested_struct.carbon
  57. library "[[@TEST_NAME]]";
  58. fn StructParam[T:! type](x: {.a: T, .b: i32}) {}
  59. fn CallStructParam() {
  60. StructParam({.a = 1, .b = 2});
  61. }
  62. // --- fail_deduce_bigger_struct.carbon
  63. library "[[@TEST_NAME]]";
  64. fn BigStructParam[T:! type](x: {.c: T, .d: i32, .e: i32}) {}
  65. fn CallBigStructParam() {
  66. // CHECK:STDERR: fail_deduce_bigger_struct.carbon:[[@LINE+7]]:3: error: cannot deduce value for generic parameter `T` [DeductionIncomplete]
  67. // CHECK:STDERR: BigStructParam({.c = 3, .d = 4});
  68. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  69. // CHECK:STDERR: fail_deduce_bigger_struct.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
  70. // CHECK:STDERR: fn BigStructParam[T:! type](x: {.c: T, .d: i32, .e: i32}) {}
  71. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  72. // CHECK:STDERR:
  73. BigStructParam({.c = 3, .d = 4});
  74. }
  75. // --- fail_deduce_smaller_struct.carbon
  76. library "[[@TEST_NAME]]";
  77. fn SmallStructParam[T:! type](x: {.f: T, .g: i32}) {}
  78. fn CallSmallStructParam() {
  79. // CHECK:STDERR: fail_deduce_smaller_struct.carbon:[[@LINE+7]]:3: error: cannot deduce value for generic parameter `T` [DeductionIncomplete]
  80. // CHECK:STDERR: SmallStructParam({.f = 5, .g = 6, .h = 7});
  81. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~
  82. // CHECK:STDERR: fail_deduce_smaller_struct.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
  83. // CHECK:STDERR: fn SmallStructParam[T:! type](x: {.f: T, .g: i32}) {}
  84. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  85. // CHECK:STDERR:
  86. SmallStructParam({.f = 5, .g = 6, .h = 7});
  87. }
  88. // --- fail_deduce_struct_wrong_name.carbon
  89. library "[[@TEST_NAME]]";
  90. fn WrongNameStructParam[T:! type](x: {.i: T, .different: i32}) {}
  91. fn CallWrongNameStructParam() {
  92. // CHECK:STDERR: fail_deduce_struct_wrong_name.carbon:[[@LINE+7]]:3: error: cannot deduce value for generic parameter `T` [DeductionIncomplete]
  93. // CHECK:STDERR: WrongNameStructParam({.i = 8, .j = 9});
  94. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
  95. // CHECK:STDERR: fail_deduce_struct_wrong_name.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
  96. // CHECK:STDERR: fn WrongNameStructParam[T:! type](x: {.i: T, .different: i32}) {}
  97. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  98. // CHECK:STDERR:
  99. WrongNameStructParam({.i = 8, .j = 9});
  100. }
  101. // --- fail_todo_deduce_struct_wrong_order.carbon
  102. library "[[@TEST_NAME]]";
  103. fn WrongOrderStructParam[T:! type](x: {.first: T, .second: i32}) {}
  104. fn CallWrongOrderStructParam() {
  105. // CHECK:STDERR: fail_todo_deduce_struct_wrong_order.carbon:[[@LINE+7]]:3: error: cannot deduce value for generic parameter `T` [DeductionIncomplete]
  106. // CHECK:STDERR: WrongOrderStructParam({.second = 11, .first = 10});
  107. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~
  108. // CHECK:STDERR: fail_todo_deduce_struct_wrong_order.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
  109. // CHECK:STDERR: fn WrongOrderStructParam[T:! type](x: {.first: T, .second: i32}) {}
  110. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  111. // CHECK:STDERR:
  112. WrongOrderStructParam({.second = 11, .first = 10});
  113. }
  114. // --- fail_deduce_incomplete.carbon
  115. library "[[@TEST_NAME]]";
  116. // TODO: It would be nice to diagnose this at its point of declaration, because
  117. // U is not deducible.
  118. fn ImplicitNotDeducible[T:! type, U:! type](x: T) -> U;
  119. fn CallImplicitNotDeducible() {
  120. // CHECK:STDERR: fail_deduce_incomplete.carbon:[[@LINE+7]]:3: error: cannot deduce value for generic parameter `U` [DeductionIncomplete]
  121. // CHECK:STDERR: ImplicitNotDeducible(42);
  122. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
  123. // CHECK:STDERR: fail_deduce_incomplete.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
  124. // CHECK:STDERR: fn ImplicitNotDeducible[T:! type, U:! type](x: T) -> U;
  125. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  126. // CHECK:STDERR:
  127. ImplicitNotDeducible(42);
  128. }
  129. // --- fail_deduce_inconsistent.carbon
  130. library "[[@TEST_NAME]]";
  131. fn ImplicitNotDeducible[T:! type](x: T, y: T) -> T;
  132. fn CallImplicitNotDeducible() {
  133. // CHECK:STDERR: fail_deduce_inconsistent.carbon:[[@LINE+6]]:3: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent]
  134. // CHECK:STDERR: ImplicitNotDeducible(42, {.x = 12});
  135. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
  136. // CHECK:STDERR: fail_deduce_inconsistent.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
  137. // CHECK:STDERR: fn ImplicitNotDeducible[T:! type](x: T, y: T) -> T;
  138. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  139. ImplicitNotDeducible(42, {.x = 12});
  140. }
  141. // CHECK:STDOUT: --- deduce_explicit.carbon
  142. // CHECK:STDOUT:
  143. // CHECK:STDOUT: constants {
  144. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  145. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  146. // CHECK:STDOUT: %.1: type = ptr_type %T [symbolic]
  147. // CHECK:STDOUT: %ExplicitGenericParam.type: type = fn_type @ExplicitGenericParam [template]
  148. // CHECK:STDOUT: %ExplicitGenericParam: %ExplicitGenericParam.type = struct_value () [template]
  149. // CHECK:STDOUT: %.2: <specific function> = specific_function %ExplicitGenericParam, @ExplicitGenericParam(%T) [symbolic]
  150. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  151. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  152. // CHECK:STDOUT: %.3: type = ptr_type i32 [template]
  153. // CHECK:STDOUT: %CallExplicitGenericParam.type: type = fn_type @CallExplicitGenericParam [template]
  154. // CHECK:STDOUT: %CallExplicitGenericParam: %CallExplicitGenericParam.type = struct_value () [template]
  155. // CHECK:STDOUT: %.4: <specific function> = specific_function %ExplicitGenericParam, @ExplicitGenericParam(i32) [template]
  156. // CHECK:STDOUT: %.5: type = struct_type {.a: %T} [symbolic]
  157. // CHECK:STDOUT: %.6: type = ptr_type %.5 [symbolic]
  158. // CHECK:STDOUT: %CallExplicitGenericParamWithGenericArg.type: type = fn_type @CallExplicitGenericParamWithGenericArg [template]
  159. // CHECK:STDOUT: %CallExplicitGenericParamWithGenericArg: %CallExplicitGenericParamWithGenericArg.type = struct_value () [template]
  160. // CHECK:STDOUT: %.7: <specific function> = specific_function %ExplicitGenericParam, @ExplicitGenericParam(%.5) [symbolic]
  161. // CHECK:STDOUT: }
  162. // CHECK:STDOUT:
  163. // CHECK:STDOUT: imports {
  164. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  165. // CHECK:STDOUT: .Int32 = %import_ref
  166. // CHECK:STDOUT: import Core//prelude
  167. // CHECK:STDOUT: import Core//prelude/...
  168. // CHECK:STDOUT: }
  169. // CHECK:STDOUT: }
  170. // CHECK:STDOUT:
  171. // CHECK:STDOUT: file {
  172. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  173. // CHECK:STDOUT: .Core = imports.%Core
  174. // CHECK:STDOUT: .ExplicitGenericParam = %ExplicitGenericParam.decl
  175. // CHECK:STDOUT: .CallExplicitGenericParam = %CallExplicitGenericParam.decl
  176. // CHECK:STDOUT: .CallExplicitGenericParamWithGenericArg = %CallExplicitGenericParamWithGenericArg.decl
  177. // CHECK:STDOUT: }
  178. // CHECK:STDOUT: %Core.import = import Core
  179. // CHECK:STDOUT: %ExplicitGenericParam.decl: %ExplicitGenericParam.type = fn_decl @ExplicitGenericParam [template = constants.%ExplicitGenericParam] {
  180. // CHECK:STDOUT: %T.patt.loc4_25.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_25.2 (constants.%T.patt)]
  181. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc4_25.1, runtime_param<invalid> [symbolic = %T.patt.loc4_25.2 (constants.%T.patt)]
  182. // CHECK:STDOUT: %return.patt: @ExplicitGenericParam.%.loc4_39.2 (%.1) = return_slot_pattern
  183. // CHECK:STDOUT: %return.param_patt: @ExplicitGenericParam.%.loc4_39.2 (%.1) = out_param_pattern %return.patt, runtime_param0
  184. // CHECK:STDOUT: } {
  185. // CHECK:STDOUT: %T.ref.loc4_38: type = name_ref T, %T.loc4_25.1 [symbolic = %T.loc4_25.2 (constants.%T)]
  186. // CHECK:STDOUT: %.loc4_39.1: type = ptr_type %T [symbolic = %.loc4_39.2 (constants.%.1)]
  187. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  188. // CHECK:STDOUT: %T.loc4_25.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc4_25.2 (constants.%T)]
  189. // CHECK:STDOUT: %return.param: ref @ExplicitGenericParam.%.loc4_39.2 (%.1) = out_param runtime_param0
  190. // CHECK:STDOUT: %return: ref @ExplicitGenericParam.%.loc4_39.2 (%.1) = return_slot %return.param
  191. // CHECK:STDOUT: }
  192. // CHECK:STDOUT: %CallExplicitGenericParam.decl: %CallExplicitGenericParam.type = fn_decl @CallExplicitGenericParam [template = constants.%CallExplicitGenericParam] {
  193. // CHECK:STDOUT: %return.patt: %.3 = return_slot_pattern
  194. // CHECK:STDOUT: %return.param_patt: %.3 = out_param_pattern %return.patt, runtime_param0
  195. // CHECK:STDOUT: } {
  196. // CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%Int32() [template = i32]
  197. // CHECK:STDOUT: %.loc6_37.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32]
  198. // CHECK:STDOUT: %.loc6_37.2: type = converted %int.make_type_32.loc6, %.loc6_37.1 [template = i32]
  199. // CHECK:STDOUT: %.loc6_37.3: type = ptr_type i32 [template = constants.%.3]
  200. // CHECK:STDOUT: %return.param: ref %.3 = out_param runtime_param0
  201. // CHECK:STDOUT: %return: ref %.3 = return_slot %return.param
  202. // CHECK:STDOUT: }
  203. // CHECK:STDOUT: %CallExplicitGenericParamWithGenericArg.decl: %CallExplicitGenericParamWithGenericArg.type = fn_decl @CallExplicitGenericParamWithGenericArg [template = constants.%CallExplicitGenericParamWithGenericArg] {
  204. // CHECK:STDOUT: %T.patt.loc10_43.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_43.2 (constants.%T.patt)]
  205. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc10_43.1, runtime_param<invalid> [symbolic = %T.patt.loc10_43.2 (constants.%T.patt)]
  206. // CHECK:STDOUT: %return.patt: @CallExplicitGenericParamWithGenericArg.%.loc10_63.2 (%.6) = return_slot_pattern
  207. // CHECK:STDOUT: %return.param_patt: @CallExplicitGenericParamWithGenericArg.%.loc10_63.2 (%.6) = out_param_pattern %return.patt, runtime_param0
  208. // CHECK:STDOUT: } {
  209. // CHECK:STDOUT: %T.ref.loc10: type = name_ref T, %T.loc10_43.1 [symbolic = %T.loc10_43.2 (constants.%T)]
  210. // CHECK:STDOUT: %.loc10_62.1: type = struct_type {.a: %T} [symbolic = %.loc10_62.2 (constants.%.5)]
  211. // CHECK:STDOUT: %.loc10_63.1: type = ptr_type %.5 [symbolic = %.loc10_63.2 (constants.%.6)]
  212. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  213. // CHECK:STDOUT: %T.loc10_43.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc10_43.2 (constants.%T)]
  214. // CHECK:STDOUT: %return.param: ref @CallExplicitGenericParamWithGenericArg.%.loc10_63.2 (%.6) = out_param runtime_param0
  215. // CHECK:STDOUT: %return: ref @CallExplicitGenericParamWithGenericArg.%.loc10_63.2 (%.6) = return_slot %return.param
  216. // CHECK:STDOUT: }
  217. // CHECK:STDOUT: }
  218. // CHECK:STDOUT:
  219. // CHECK:STDOUT: generic fn @ExplicitGenericParam(%T.loc4_25.1: type) {
  220. // CHECK:STDOUT: %T.loc4_25.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_25.2 (constants.%T)]
  221. // CHECK:STDOUT: %T.patt.loc4_25.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_25.2 (constants.%T.patt)]
  222. // CHECK:STDOUT: %.loc4_39.2: type = ptr_type @ExplicitGenericParam.%T.loc4_25.2 (%T) [symbolic = %.loc4_39.2 (constants.%.1)]
  223. // CHECK:STDOUT:
  224. // CHECK:STDOUT: !definition:
  225. // CHECK:STDOUT: %.loc4_50.2: <specific function> = specific_function constants.%ExplicitGenericParam, @ExplicitGenericParam(%T.loc4_25.2) [symbolic = %.loc4_50.2 (constants.%.2)]
  226. // CHECK:STDOUT:
  227. // CHECK:STDOUT: fn(%T.param_patt: type) -> @ExplicitGenericParam.%.loc4_39.2 (%.1) {
  228. // CHECK:STDOUT: !entry:
  229. // CHECK:STDOUT: %ExplicitGenericParam.ref: %ExplicitGenericParam.type = name_ref ExplicitGenericParam, file.%ExplicitGenericParam.decl [template = constants.%ExplicitGenericParam]
  230. // CHECK:STDOUT: %T.ref.loc4_71: type = name_ref T, %T.loc4_25.1 [symbolic = %T.loc4_25.2 (constants.%T)]
  231. // CHECK:STDOUT: %.loc4_50.1: <specific function> = specific_function %ExplicitGenericParam.ref, @ExplicitGenericParam(constants.%T) [symbolic = %.loc4_50.2 (constants.%.2)]
  232. // CHECK:STDOUT: %ExplicitGenericParam.call: init @ExplicitGenericParam.%.loc4_39.2 (%.1) = call %.loc4_50.1()
  233. // CHECK:STDOUT: %.loc4_73.1: @ExplicitGenericParam.%.loc4_39.2 (%.1) = value_of_initializer %ExplicitGenericParam.call
  234. // CHECK:STDOUT: %.loc4_73.2: @ExplicitGenericParam.%.loc4_39.2 (%.1) = converted %ExplicitGenericParam.call, %.loc4_73.1
  235. // CHECK:STDOUT: return %.loc4_73.2
  236. // CHECK:STDOUT: }
  237. // CHECK:STDOUT: }
  238. // CHECK:STDOUT:
  239. // CHECK:STDOUT: fn @CallExplicitGenericParam() -> %.3 {
  240. // CHECK:STDOUT: !entry:
  241. // CHECK:STDOUT: %ExplicitGenericParam.ref: %ExplicitGenericParam.type = name_ref ExplicitGenericParam, file.%ExplicitGenericParam.decl [template = constants.%ExplicitGenericParam]
  242. // CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%Int32() [template = i32]
  243. // CHECK:STDOUT: %.loc7_30.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32]
  244. // CHECK:STDOUT: %.loc7_30.2: type = converted %int.make_type_32.loc7, %.loc7_30.1 [template = i32]
  245. // CHECK:STDOUT: %.loc7_10: <specific function> = specific_function %ExplicitGenericParam.ref, @ExplicitGenericParam(i32) [template = constants.%.4]
  246. // CHECK:STDOUT: %ExplicitGenericParam.call: init %.3 = call %.loc7_10()
  247. // CHECK:STDOUT: %.loc7_35.1: %.3 = value_of_initializer %ExplicitGenericParam.call
  248. // CHECK:STDOUT: %.loc7_35.2: %.3 = converted %ExplicitGenericParam.call, %.loc7_35.1
  249. // CHECK:STDOUT: return %.loc7_35.2
  250. // CHECK:STDOUT: }
  251. // CHECK:STDOUT:
  252. // CHECK:STDOUT: generic fn @CallExplicitGenericParamWithGenericArg(%T.loc10_43.1: type) {
  253. // CHECK:STDOUT: %T.loc10_43.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc10_43.2 (constants.%T)]
  254. // CHECK:STDOUT: %T.patt.loc10_43.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_43.2 (constants.%T.patt)]
  255. // CHECK:STDOUT: %.loc10_62.2: type = struct_type {.a: @CallExplicitGenericParamWithGenericArg.%T.loc10_43.2 (%T)} [symbolic = %.loc10_62.2 (constants.%.5)]
  256. // CHECK:STDOUT: %.loc10_63.2: type = ptr_type @CallExplicitGenericParamWithGenericArg.%.loc10_62.2 (%.5) [symbolic = %.loc10_63.2 (constants.%.6)]
  257. // CHECK:STDOUT:
  258. // CHECK:STDOUT: !definition:
  259. // CHECK:STDOUT: %.loc11_10.2: <specific function> = specific_function constants.%ExplicitGenericParam, @ExplicitGenericParam(%.loc10_62.2) [symbolic = %.loc11_10.2 (constants.%.7)]
  260. // CHECK:STDOUT:
  261. // CHECK:STDOUT: fn(%T.param_patt: type) -> @CallExplicitGenericParamWithGenericArg.%.loc10_63.2 (%.6) {
  262. // CHECK:STDOUT: !entry:
  263. // CHECK:STDOUT: %ExplicitGenericParam.ref: %ExplicitGenericParam.type = name_ref ExplicitGenericParam, file.%ExplicitGenericParam.decl [template = constants.%ExplicitGenericParam]
  264. // CHECK:STDOUT: %T.ref.loc11: type = name_ref T, %T.loc10_43.1 [symbolic = %T.loc10_43.2 (constants.%T)]
  265. // CHECK:STDOUT: %.loc11_37: type = struct_type {.a: %T} [symbolic = %.loc10_62.2 (constants.%.5)]
  266. // CHECK:STDOUT: %.loc11_10.1: <specific function> = specific_function %ExplicitGenericParam.ref, @ExplicitGenericParam(constants.%.5) [symbolic = %.loc11_10.2 (constants.%.7)]
  267. // CHECK:STDOUT: %ExplicitGenericParam.call: init @CallExplicitGenericParamWithGenericArg.%.loc10_63.2 (%.6) = call %.loc11_10.1()
  268. // CHECK:STDOUT: %.loc11_39.1: @CallExplicitGenericParamWithGenericArg.%.loc10_63.2 (%.6) = value_of_initializer %ExplicitGenericParam.call
  269. // CHECK:STDOUT: %.loc11_39.2: @CallExplicitGenericParamWithGenericArg.%.loc10_63.2 (%.6) = converted %ExplicitGenericParam.call, %.loc11_39.1
  270. // CHECK:STDOUT: return %.loc11_39.2
  271. // CHECK:STDOUT: }
  272. // CHECK:STDOUT: }
  273. // CHECK:STDOUT:
  274. // CHECK:STDOUT: specific @ExplicitGenericParam(constants.%T) {
  275. // CHECK:STDOUT: %T.loc4_25.2 => constants.%T
  276. // CHECK:STDOUT: %T.patt.loc4_25.2 => constants.%T
  277. // CHECK:STDOUT: %.loc4_39.2 => constants.%.1
  278. // CHECK:STDOUT:
  279. // CHECK:STDOUT: !definition:
  280. // CHECK:STDOUT: %.loc4_50.2 => constants.%.2
  281. // CHECK:STDOUT: }
  282. // CHECK:STDOUT:
  283. // CHECK:STDOUT: specific @ExplicitGenericParam(%T.loc4_25.2) {
  284. // CHECK:STDOUT: %T.loc4_25.2 => constants.%T
  285. // CHECK:STDOUT: %T.patt.loc4_25.2 => constants.%T
  286. // CHECK:STDOUT: %.loc4_39.2 => constants.%.1
  287. // CHECK:STDOUT: }
  288. // CHECK:STDOUT:
  289. // CHECK:STDOUT: specific @ExplicitGenericParam(i32) {
  290. // CHECK:STDOUT: %T.loc4_25.2 => i32
  291. // CHECK:STDOUT: %T.patt.loc4_25.2 => i32
  292. // CHECK:STDOUT: %.loc4_39.2 => constants.%.3
  293. // CHECK:STDOUT:
  294. // CHECK:STDOUT: !definition:
  295. // CHECK:STDOUT: %.loc4_50.2 => constants.%.4
  296. // CHECK:STDOUT: }
  297. // CHECK:STDOUT:
  298. // CHECK:STDOUT: specific @CallExplicitGenericParamWithGenericArg(constants.%T) {
  299. // CHECK:STDOUT: %T.loc10_43.2 => constants.%T
  300. // CHECK:STDOUT: %T.patt.loc10_43.2 => constants.%T
  301. // CHECK:STDOUT: %.loc10_62.2 => constants.%.5
  302. // CHECK:STDOUT: %.loc10_63.2 => constants.%.6
  303. // CHECK:STDOUT: }
  304. // CHECK:STDOUT:
  305. // CHECK:STDOUT: specific @ExplicitGenericParam(constants.%.5) {
  306. // CHECK:STDOUT: %T.loc4_25.2 => constants.%.5
  307. // CHECK:STDOUT: %T.patt.loc4_25.2 => constants.%.5
  308. // CHECK:STDOUT: %.loc4_39.2 => constants.%.6
  309. // CHECK:STDOUT:
  310. // CHECK:STDOUT: !definition:
  311. // CHECK:STDOUT: %.loc4_50.2 => constants.%.7
  312. // CHECK:STDOUT: }
  313. // CHECK:STDOUT:
  314. // CHECK:STDOUT: specific @ExplicitGenericParam(@CallExplicitGenericParamWithGenericArg.%.loc10_62.2) {
  315. // CHECK:STDOUT: %T.loc4_25.2 => constants.%.5
  316. // CHECK:STDOUT: %T.patt.loc4_25.2 => constants.%.5
  317. // CHECK:STDOUT: %.loc4_39.2 => constants.%.6
  318. // CHECK:STDOUT: }
  319. // CHECK:STDOUT:
  320. // CHECK:STDOUT: --- fail_deduce_explicit_non_constant.carbon
  321. // CHECK:STDOUT:
  322. // CHECK:STDOUT: constants {
  323. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  324. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  325. // CHECK:STDOUT: %.1: type = ptr_type %T [symbolic]
  326. // CHECK:STDOUT: %ExplicitGenericParam.type: type = fn_type @ExplicitGenericParam [template]
  327. // CHECK:STDOUT: %ExplicitGenericParam: %ExplicitGenericParam.type = struct_value () [template]
  328. // CHECK:STDOUT: %.2: <specific function> = specific_function %ExplicitGenericParam, @ExplicitGenericParam(%T) [symbolic]
  329. // CHECK:STDOUT: %CallExplicitGenericParamConst.type: type = fn_type @CallExplicitGenericParamConst [template]
  330. // CHECK:STDOUT: %CallExplicitGenericParamConst: %CallExplicitGenericParamConst.type = struct_value () [template]
  331. // CHECK:STDOUT: %CallExplicitGenericParamNonConst.type: type = fn_type @CallExplicitGenericParamNonConst [template]
  332. // CHECK:STDOUT: %CallExplicitGenericParamNonConst: %CallExplicitGenericParamNonConst.type = struct_value () [template]
  333. // CHECK:STDOUT: }
  334. // CHECK:STDOUT:
  335. // CHECK:STDOUT: imports {
  336. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  337. // CHECK:STDOUT: import Core//prelude
  338. // CHECK:STDOUT: import Core//prelude/...
  339. // CHECK:STDOUT: }
  340. // CHECK:STDOUT: }
  341. // CHECK:STDOUT:
  342. // CHECK:STDOUT: file {
  343. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  344. // CHECK:STDOUT: .Core = imports.%Core
  345. // CHECK:STDOUT: .ExplicitGenericParam = %ExplicitGenericParam.decl
  346. // CHECK:STDOUT: .CallExplicitGenericParamConst = %CallExplicitGenericParamConst.decl
  347. // CHECK:STDOUT: .CallExplicitGenericParamNonConst = %CallExplicitGenericParamNonConst.decl
  348. // CHECK:STDOUT: }
  349. // CHECK:STDOUT: %Core.import = import Core
  350. // CHECK:STDOUT: %ExplicitGenericParam.decl: %ExplicitGenericParam.type = fn_decl @ExplicitGenericParam [template = constants.%ExplicitGenericParam] {
  351. // CHECK:STDOUT: %T.patt.loc4_25.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_25.2 (constants.%T.patt)]
  352. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc4_25.1, runtime_param<invalid> [symbolic = %T.patt.loc4_25.2 (constants.%T.patt)]
  353. // CHECK:STDOUT: %return.patt: @ExplicitGenericParam.%.loc4_39.2 (%.1) = return_slot_pattern
  354. // CHECK:STDOUT: %return.param_patt: @ExplicitGenericParam.%.loc4_39.2 (%.1) = out_param_pattern %return.patt, runtime_param0
  355. // CHECK:STDOUT: } {
  356. // CHECK:STDOUT: %T.ref.loc4_38: type = name_ref T, %T.loc4_25.1 [symbolic = %T.loc4_25.2 (constants.%T)]
  357. // CHECK:STDOUT: %.loc4_39.1: type = ptr_type %T [symbolic = %.loc4_39.2 (constants.%.1)]
  358. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  359. // CHECK:STDOUT: %T.loc4_25.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc4_25.2 (constants.%T)]
  360. // CHECK:STDOUT: %return.param: ref @ExplicitGenericParam.%.loc4_39.2 (%.1) = out_param runtime_param0
  361. // CHECK:STDOUT: %return: ref @ExplicitGenericParam.%.loc4_39.2 (%.1) = return_slot %return.param
  362. // CHECK:STDOUT: }
  363. // CHECK:STDOUT: %CallExplicitGenericParamConst.decl: %CallExplicitGenericParamConst.type = fn_decl @CallExplicitGenericParamConst [template = constants.%CallExplicitGenericParamConst] {
  364. // CHECK:STDOUT: %T.patt.loc6_34.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_34.2 (constants.%T.patt)]
  365. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc6_34.1, runtime_param<invalid> [symbolic = %T.patt.loc6_34.2 (constants.%T.patt)]
  366. // CHECK:STDOUT: } {
  367. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  368. // CHECK:STDOUT: %T.loc6_34.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc6_34.2 (constants.%T)]
  369. // CHECK:STDOUT: }
  370. // CHECK:STDOUT: %CallExplicitGenericParamNonConst.decl: %CallExplicitGenericParamNonConst.type = fn_decl @CallExplicitGenericParamNonConst [template = constants.%CallExplicitGenericParamNonConst] {
  371. // CHECK:STDOUT: %T.patt: type = binding_pattern T
  372. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt, runtime_param0
  373. // CHECK:STDOUT: } {
  374. // CHECK:STDOUT: %T.param: type = value_param runtime_param0
  375. // CHECK:STDOUT: %T: type = bind_name T, %T.param
  376. // CHECK:STDOUT: }
  377. // CHECK:STDOUT: }
  378. // CHECK:STDOUT:
  379. // CHECK:STDOUT: generic fn @ExplicitGenericParam(%T.loc4_25.1: type) {
  380. // CHECK:STDOUT: %T.loc4_25.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_25.2 (constants.%T)]
  381. // CHECK:STDOUT: %T.patt.loc4_25.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_25.2 (constants.%T.patt)]
  382. // CHECK:STDOUT: %.loc4_39.2: type = ptr_type @ExplicitGenericParam.%T.loc4_25.2 (%T) [symbolic = %.loc4_39.2 (constants.%.1)]
  383. // CHECK:STDOUT:
  384. // CHECK:STDOUT: !definition:
  385. // CHECK:STDOUT: %.loc4_50.2: <specific function> = specific_function constants.%ExplicitGenericParam, @ExplicitGenericParam(%T.loc4_25.2) [symbolic = %.loc4_50.2 (constants.%.2)]
  386. // CHECK:STDOUT:
  387. // CHECK:STDOUT: fn(%T.param_patt: type) -> @ExplicitGenericParam.%.loc4_39.2 (%.1) {
  388. // CHECK:STDOUT: !entry:
  389. // CHECK:STDOUT: %ExplicitGenericParam.ref: %ExplicitGenericParam.type = name_ref ExplicitGenericParam, file.%ExplicitGenericParam.decl [template = constants.%ExplicitGenericParam]
  390. // CHECK:STDOUT: %T.ref.loc4_71: type = name_ref T, %T.loc4_25.1 [symbolic = %T.loc4_25.2 (constants.%T)]
  391. // CHECK:STDOUT: %.loc4_50.1: <specific function> = specific_function %ExplicitGenericParam.ref, @ExplicitGenericParam(constants.%T) [symbolic = %.loc4_50.2 (constants.%.2)]
  392. // CHECK:STDOUT: %ExplicitGenericParam.call: init @ExplicitGenericParam.%.loc4_39.2 (%.1) = call %.loc4_50.1()
  393. // CHECK:STDOUT: %.loc4_73.1: @ExplicitGenericParam.%.loc4_39.2 (%.1) = value_of_initializer %ExplicitGenericParam.call
  394. // CHECK:STDOUT: %.loc4_73.2: @ExplicitGenericParam.%.loc4_39.2 (%.1) = converted %ExplicitGenericParam.call, %.loc4_73.1
  395. // CHECK:STDOUT: return %.loc4_73.2
  396. // CHECK:STDOUT: }
  397. // CHECK:STDOUT: }
  398. // CHECK:STDOUT:
  399. // CHECK:STDOUT: generic fn @CallExplicitGenericParamConst(%T.loc6_34.1: type) {
  400. // CHECK:STDOUT: %T.loc6_34.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc6_34.2 (constants.%T)]
  401. // CHECK:STDOUT: %T.patt.loc6_34.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_34.2 (constants.%T.patt)]
  402. // CHECK:STDOUT:
  403. // CHECK:STDOUT: !definition:
  404. // CHECK:STDOUT: %.loc7_3.2: <specific function> = specific_function constants.%ExplicitGenericParam, @ExplicitGenericParam(%T.loc6_34.2) [symbolic = %.loc7_3.2 (constants.%.2)]
  405. // CHECK:STDOUT: %.loc7_23: type = ptr_type @CallExplicitGenericParamConst.%T.loc6_34.2 (%T) [symbolic = %.loc7_23 (constants.%.1)]
  406. // CHECK:STDOUT:
  407. // CHECK:STDOUT: fn(%T.param_patt: type) {
  408. // CHECK:STDOUT: !entry:
  409. // CHECK:STDOUT: %ExplicitGenericParam.ref: %ExplicitGenericParam.type = name_ref ExplicitGenericParam, file.%ExplicitGenericParam.decl [template = constants.%ExplicitGenericParam]
  410. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc6_34.1 [symbolic = %T.loc6_34.2 (constants.%T)]
  411. // CHECK:STDOUT: %.loc7_3.1: <specific function> = specific_function %ExplicitGenericParam.ref, @ExplicitGenericParam(constants.%T) [symbolic = %.loc7_3.2 (constants.%.2)]
  412. // CHECK:STDOUT: %ExplicitGenericParam.call: init @CallExplicitGenericParamConst.%.loc7_23 (%.1) = call %.loc7_3.1()
  413. // CHECK:STDOUT: return
  414. // CHECK:STDOUT: }
  415. // CHECK:STDOUT: }
  416. // CHECK:STDOUT:
  417. // CHECK:STDOUT: fn @CallExplicitGenericParamNonConst(%T.param_patt: type) {
  418. // CHECK:STDOUT: !entry:
  419. // CHECK:STDOUT: %ExplicitGenericParam.ref: %ExplicitGenericParam.type = name_ref ExplicitGenericParam, file.%ExplicitGenericParam.decl [template = constants.%ExplicitGenericParam]
  420. // CHECK:STDOUT: %T.ref: type = name_ref T, %T
  421. // CHECK:STDOUT: return
  422. // CHECK:STDOUT: }
  423. // CHECK:STDOUT:
  424. // CHECK:STDOUT: specific @ExplicitGenericParam(constants.%T) {
  425. // CHECK:STDOUT: %T.loc4_25.2 => constants.%T
  426. // CHECK:STDOUT: %T.patt.loc4_25.2 => constants.%T
  427. // CHECK:STDOUT: %.loc4_39.2 => constants.%.1
  428. // CHECK:STDOUT:
  429. // CHECK:STDOUT: !definition:
  430. // CHECK:STDOUT: %.loc4_50.2 => constants.%.2
  431. // CHECK:STDOUT: }
  432. // CHECK:STDOUT:
  433. // CHECK:STDOUT: specific @ExplicitGenericParam(%T.loc4_25.2) {
  434. // CHECK:STDOUT: %T.loc4_25.2 => constants.%T
  435. // CHECK:STDOUT: %T.patt.loc4_25.2 => constants.%T
  436. // CHECK:STDOUT: %.loc4_39.2 => constants.%.1
  437. // CHECK:STDOUT: }
  438. // CHECK:STDOUT:
  439. // CHECK:STDOUT: specific @CallExplicitGenericParamConst(constants.%T) {
  440. // CHECK:STDOUT: %T.loc6_34.2 => constants.%T
  441. // CHECK:STDOUT: %T.patt.loc6_34.2 => constants.%T
  442. // CHECK:STDOUT: }
  443. // CHECK:STDOUT:
  444. // CHECK:STDOUT: specific @ExplicitGenericParam(@CallExplicitGenericParamConst.%T.loc6_34.2) {
  445. // CHECK:STDOUT: %T.loc4_25.2 => constants.%T
  446. // CHECK:STDOUT: %T.patt.loc4_25.2 => constants.%T
  447. // CHECK:STDOUT: %.loc4_39.2 => constants.%.1
  448. // CHECK:STDOUT: }
  449. // CHECK:STDOUT:
  450. // CHECK:STDOUT: --- explicit_vs_deduced.carbon
  451. // CHECK:STDOUT:
  452. // CHECK:STDOUT: constants {
  453. // CHECK:STDOUT: %A: type = class_type @A [template]
  454. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  455. // CHECK:STDOUT: %.2: <witness> = complete_type_witness %.1 [template]
  456. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  457. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  458. // CHECK:STDOUT: %.3: type = ptr_type %T [symbolic]
  459. // CHECK:STDOUT: %ExplicitAndAlsoDeduced.type: type = fn_type @ExplicitAndAlsoDeduced [template]
  460. // CHECK:STDOUT: %ExplicitAndAlsoDeduced: %ExplicitAndAlsoDeduced.type = struct_value () [template]
  461. // CHECK:STDOUT: %.4: <specific function> = specific_function %ExplicitAndAlsoDeduced, @ExplicitAndAlsoDeduced(%T) [symbolic]
  462. // CHECK:STDOUT: %.5: type = ptr_type %A [template]
  463. // CHECK:STDOUT: %CallExplicitAndAlsoDeduced.type: type = fn_type @CallExplicitAndAlsoDeduced [template]
  464. // CHECK:STDOUT: %CallExplicitAndAlsoDeduced: %CallExplicitAndAlsoDeduced.type = struct_value () [template]
  465. // CHECK:STDOUT: %.6: <specific function> = specific_function %ExplicitAndAlsoDeduced, @ExplicitAndAlsoDeduced(%A) [template]
  466. // CHECK:STDOUT: %struct: %A = struct_value () [template]
  467. // CHECK:STDOUT: }
  468. // CHECK:STDOUT:
  469. // CHECK:STDOUT: imports {
  470. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  471. // CHECK:STDOUT: import Core//prelude
  472. // CHECK:STDOUT: import Core//prelude/...
  473. // CHECK:STDOUT: }
  474. // CHECK:STDOUT: }
  475. // CHECK:STDOUT:
  476. // CHECK:STDOUT: file {
  477. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  478. // CHECK:STDOUT: .Core = imports.%Core
  479. // CHECK:STDOUT: .A = %A.decl
  480. // CHECK:STDOUT: .ExplicitAndAlsoDeduced = %ExplicitAndAlsoDeduced.decl
  481. // CHECK:STDOUT: .CallExplicitAndAlsoDeduced = %CallExplicitAndAlsoDeduced.decl
  482. // CHECK:STDOUT: }
  483. // CHECK:STDOUT: %Core.import = import Core
  484. // CHECK:STDOUT: %A.decl: type = class_decl @A [template = constants.%A] {} {}
  485. // CHECK:STDOUT: %ExplicitAndAlsoDeduced.decl: %ExplicitAndAlsoDeduced.type = fn_decl @ExplicitAndAlsoDeduced [template = constants.%ExplicitAndAlsoDeduced] {
  486. // CHECK:STDOUT: %T.patt.loc6_27.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_27.2 (constants.%T.patt)]
  487. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc6_27.1, runtime_param<invalid> [symbolic = %T.patt.loc6_27.2 (constants.%T.patt)]
  488. // CHECK:STDOUT: %x.patt: @ExplicitAndAlsoDeduced.%T.loc6_27.2 (%T) = binding_pattern x
  489. // CHECK:STDOUT: %x.param_patt: @ExplicitAndAlsoDeduced.%T.loc6_27.2 (%T) = value_param_pattern %x.patt, runtime_param0
  490. // CHECK:STDOUT: %return.patt: @ExplicitAndAlsoDeduced.%.loc6_47.2 (%.3) = return_slot_pattern
  491. // CHECK:STDOUT: %return.param_patt: @ExplicitAndAlsoDeduced.%.loc6_47.2 (%.3) = out_param_pattern %return.patt, runtime_param1
  492. // CHECK:STDOUT: } {
  493. // CHECK:STDOUT: %T.ref.loc6_40: type = name_ref T, %T.loc6_27.1 [symbolic = %T.loc6_27.2 (constants.%T)]
  494. // CHECK:STDOUT: %T.ref.loc6_46: type = name_ref T, %T.loc6_27.1 [symbolic = %T.loc6_27.2 (constants.%T)]
  495. // CHECK:STDOUT: %.loc6_47.1: type = ptr_type %T [symbolic = %.loc6_47.2 (constants.%.3)]
  496. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  497. // CHECK:STDOUT: %T.loc6_27.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc6_27.2 (constants.%T)]
  498. // CHECK:STDOUT: %x.param: @ExplicitAndAlsoDeduced.%T.loc6_27.2 (%T) = value_param runtime_param0
  499. // CHECK:STDOUT: %x: @ExplicitAndAlsoDeduced.%T.loc6_27.2 (%T) = bind_name x, %x.param
  500. // CHECK:STDOUT: %return.param: ref @ExplicitAndAlsoDeduced.%.loc6_47.2 (%.3) = out_param runtime_param1
  501. // CHECK:STDOUT: %return: ref @ExplicitAndAlsoDeduced.%.loc6_47.2 (%.3) = return_slot %return.param
  502. // CHECK:STDOUT: }
  503. // CHECK:STDOUT: %CallExplicitAndAlsoDeduced.decl: %CallExplicitAndAlsoDeduced.type = fn_decl @CallExplicitAndAlsoDeduced [template = constants.%CallExplicitAndAlsoDeduced] {
  504. // CHECK:STDOUT: %return.patt: %.5 = return_slot_pattern
  505. // CHECK:STDOUT: %return.param_patt: %.5 = out_param_pattern %return.patt, runtime_param0
  506. // CHECK:STDOUT: } {
  507. // CHECK:STDOUT: %A.ref.loc10: type = name_ref A, file.%A.decl [template = constants.%A]
  508. // CHECK:STDOUT: %.loc10_37: type = ptr_type %A [template = constants.%.5]
  509. // CHECK:STDOUT: %return.param: ref %.5 = out_param runtime_param0
  510. // CHECK:STDOUT: %return: ref %.5 = return_slot %return.param
  511. // CHECK:STDOUT: }
  512. // CHECK:STDOUT: }
  513. // CHECK:STDOUT:
  514. // CHECK:STDOUT: class @A {
  515. // CHECK:STDOUT: %.loc4: <witness> = complete_type_witness %.1 [template = constants.%.2]
  516. // CHECK:STDOUT:
  517. // CHECK:STDOUT: !members:
  518. // CHECK:STDOUT: .Self = constants.%A
  519. // CHECK:STDOUT: }
  520. // CHECK:STDOUT:
  521. // CHECK:STDOUT: generic fn @ExplicitAndAlsoDeduced(%T.loc6_27.1: type) {
  522. // CHECK:STDOUT: %T.loc6_27.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc6_27.2 (constants.%T)]
  523. // CHECK:STDOUT: %T.patt.loc6_27.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_27.2 (constants.%T.patt)]
  524. // CHECK:STDOUT: %.loc6_47.2: type = ptr_type @ExplicitAndAlsoDeduced.%T.loc6_27.2 (%T) [symbolic = %.loc6_47.2 (constants.%.3)]
  525. // CHECK:STDOUT:
  526. // CHECK:STDOUT: !definition:
  527. // CHECK:STDOUT: %.loc7_10.2: <specific function> = specific_function constants.%ExplicitAndAlsoDeduced, @ExplicitAndAlsoDeduced(%T.loc6_27.2) [symbolic = %.loc7_10.2 (constants.%.4)]
  528. // CHECK:STDOUT:
  529. // CHECK:STDOUT: fn(%T.param_patt: type, %x.param_patt: @ExplicitAndAlsoDeduced.%T.loc6_27.2 (%T)) -> @ExplicitAndAlsoDeduced.%.loc6_47.2 (%.3) {
  530. // CHECK:STDOUT: !entry:
  531. // CHECK:STDOUT: %ExplicitAndAlsoDeduced.ref: %ExplicitAndAlsoDeduced.type = name_ref ExplicitAndAlsoDeduced, file.%ExplicitAndAlsoDeduced.decl [template = constants.%ExplicitAndAlsoDeduced]
  532. // CHECK:STDOUT: %T.ref.loc7: type = name_ref T, %T.loc6_27.1 [symbolic = %T.loc6_27.2 (constants.%T)]
  533. // CHECK:STDOUT: %x.ref: @ExplicitAndAlsoDeduced.%T.loc6_27.2 (%T) = name_ref x, %x
  534. // CHECK:STDOUT: %.loc7_10.1: <specific function> = specific_function %ExplicitAndAlsoDeduced.ref, @ExplicitAndAlsoDeduced(constants.%T) [symbolic = %.loc7_10.2 (constants.%.4)]
  535. // CHECK:STDOUT: %ExplicitAndAlsoDeduced.call: init @ExplicitAndAlsoDeduced.%.loc6_47.2 (%.3) = call %.loc7_10.1(%x.ref)
  536. // CHECK:STDOUT: %.loc7_38.1: @ExplicitAndAlsoDeduced.%.loc6_47.2 (%.3) = value_of_initializer %ExplicitAndAlsoDeduced.call
  537. // CHECK:STDOUT: %.loc7_38.2: @ExplicitAndAlsoDeduced.%.loc6_47.2 (%.3) = converted %ExplicitAndAlsoDeduced.call, %.loc7_38.1
  538. // CHECK:STDOUT: return %.loc7_38.2
  539. // CHECK:STDOUT: }
  540. // CHECK:STDOUT: }
  541. // CHECK:STDOUT:
  542. // CHECK:STDOUT: fn @CallExplicitAndAlsoDeduced() -> %.5 {
  543. // CHECK:STDOUT: !entry:
  544. // CHECK:STDOUT: %ExplicitAndAlsoDeduced.ref: %ExplicitAndAlsoDeduced.type = name_ref ExplicitAndAlsoDeduced, file.%ExplicitAndAlsoDeduced.decl [template = constants.%ExplicitAndAlsoDeduced]
  545. // CHECK:STDOUT: %A.ref.loc11: type = name_ref A, file.%A.decl [template = constants.%A]
  546. // CHECK:STDOUT: %.loc11_37.1: %.1 = struct_literal ()
  547. // CHECK:STDOUT: %.loc11_10: <specific function> = specific_function %ExplicitAndAlsoDeduced.ref, @ExplicitAndAlsoDeduced(constants.%A) [template = constants.%.6]
  548. // CHECK:STDOUT: %.loc11_37.2: ref %A = temporary_storage
  549. // CHECK:STDOUT: %.loc11_37.3: init %A = class_init (), %.loc11_37.2 [template = constants.%struct]
  550. // CHECK:STDOUT: %.loc11_37.4: ref %A = temporary %.loc11_37.2, %.loc11_37.3
  551. // CHECK:STDOUT: %.loc11_37.5: ref %A = converted %.loc11_37.1, %.loc11_37.4
  552. // CHECK:STDOUT: %.loc11_37.6: %A = bind_value %.loc11_37.5
  553. // CHECK:STDOUT: %ExplicitAndAlsoDeduced.call: init %.5 = call %.loc11_10(%.loc11_37.6)
  554. // CHECK:STDOUT: %.loc11_39.1: %.5 = value_of_initializer %ExplicitAndAlsoDeduced.call
  555. // CHECK:STDOUT: %.loc11_39.2: %.5 = converted %ExplicitAndAlsoDeduced.call, %.loc11_39.1
  556. // CHECK:STDOUT: return %.loc11_39.2
  557. // CHECK:STDOUT: }
  558. // CHECK:STDOUT:
  559. // CHECK:STDOUT: specific @ExplicitAndAlsoDeduced(constants.%T) {
  560. // CHECK:STDOUT: %T.loc6_27.2 => constants.%T
  561. // CHECK:STDOUT: %T.patt.loc6_27.2 => constants.%T
  562. // CHECK:STDOUT: %.loc6_47.2 => constants.%.3
  563. // CHECK:STDOUT:
  564. // CHECK:STDOUT: !definition:
  565. // CHECK:STDOUT: %.loc7_10.2 => constants.%.4
  566. // CHECK:STDOUT: }
  567. // CHECK:STDOUT:
  568. // CHECK:STDOUT: specific @ExplicitAndAlsoDeduced(%T.loc6_27.2) {
  569. // CHECK:STDOUT: %T.loc6_27.2 => constants.%T
  570. // CHECK:STDOUT: %T.patt.loc6_27.2 => constants.%T
  571. // CHECK:STDOUT: %.loc6_47.2 => constants.%.3
  572. // CHECK:STDOUT: }
  573. // CHECK:STDOUT:
  574. // CHECK:STDOUT: specific @ExplicitAndAlsoDeduced(constants.%A) {
  575. // CHECK:STDOUT: %T.loc6_27.2 => constants.%A
  576. // CHECK:STDOUT: %T.patt.loc6_27.2 => constants.%A
  577. // CHECK:STDOUT: %.loc6_47.2 => constants.%.5
  578. // CHECK:STDOUT:
  579. // CHECK:STDOUT: !definition:
  580. // CHECK:STDOUT: %.loc7_10.2 => constants.%.6
  581. // CHECK:STDOUT: }
  582. // CHECK:STDOUT:
  583. // CHECK:STDOUT: --- deduce_implicit.carbon
  584. // CHECK:STDOUT:
  585. // CHECK:STDOUT: constants {
  586. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  587. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  588. // CHECK:STDOUT: %.1: type = ptr_type %T [symbolic]
  589. // CHECK:STDOUT: %ImplicitGenericParam.type: type = fn_type @ImplicitGenericParam [template]
  590. // CHECK:STDOUT: %ImplicitGenericParam: %ImplicitGenericParam.type = struct_value () [template]
  591. // CHECK:STDOUT: %.2: <specific function> = specific_function %ImplicitGenericParam, @ImplicitGenericParam(%T) [symbolic]
  592. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  593. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  594. // CHECK:STDOUT: %.3: type = ptr_type i32 [template]
  595. // CHECK:STDOUT: %CallImplicitGenericParam.type: type = fn_type @CallImplicitGenericParam [template]
  596. // CHECK:STDOUT: %CallImplicitGenericParam: %CallImplicitGenericParam.type = struct_value () [template]
  597. // CHECK:STDOUT: %.4: <specific function> = specific_function %ImplicitGenericParam, @ImplicitGenericParam(i32) [template]
  598. // CHECK:STDOUT: }
  599. // CHECK:STDOUT:
  600. // CHECK:STDOUT: imports {
  601. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  602. // CHECK:STDOUT: .Int32 = %import_ref
  603. // CHECK:STDOUT: import Core//prelude
  604. // CHECK:STDOUT: import Core//prelude/...
  605. // CHECK:STDOUT: }
  606. // CHECK:STDOUT: }
  607. // CHECK:STDOUT:
  608. // CHECK:STDOUT: file {
  609. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  610. // CHECK:STDOUT: .Core = imports.%Core
  611. // CHECK:STDOUT: .ImplicitGenericParam = %ImplicitGenericParam.decl
  612. // CHECK:STDOUT: .CallImplicitGenericParam = %CallImplicitGenericParam.decl
  613. // CHECK:STDOUT: }
  614. // CHECK:STDOUT: %Core.import = import Core
  615. // CHECK:STDOUT: %ImplicitGenericParam.decl: %ImplicitGenericParam.type = fn_decl @ImplicitGenericParam [template = constants.%ImplicitGenericParam] {
  616. // CHECK:STDOUT: %T.patt.loc4_25.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_25.2 (constants.%T.patt)]
  617. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc4_25.1, runtime_param<invalid> [symbolic = %T.patt.loc4_25.2 (constants.%T.patt)]
  618. // CHECK:STDOUT: %x.patt: @ImplicitGenericParam.%T.loc4_25.2 (%T) = binding_pattern x
  619. // CHECK:STDOUT: %x.param_patt: @ImplicitGenericParam.%T.loc4_25.2 (%T) = value_param_pattern %x.patt, runtime_param0
  620. // CHECK:STDOUT: %return.patt: @ImplicitGenericParam.%.loc4_45.2 (%.1) = return_slot_pattern
  621. // CHECK:STDOUT: %return.param_patt: @ImplicitGenericParam.%.loc4_45.2 (%.1) = out_param_pattern %return.patt, runtime_param1
  622. // CHECK:STDOUT: } {
  623. // CHECK:STDOUT: %T.ref.loc4_38: type = name_ref T, %T.loc4_25.1 [symbolic = %T.loc4_25.2 (constants.%T)]
  624. // CHECK:STDOUT: %T.ref.loc4_44: type = name_ref T, %T.loc4_25.1 [symbolic = %T.loc4_25.2 (constants.%T)]
  625. // CHECK:STDOUT: %.loc4_45.1: type = ptr_type %T [symbolic = %.loc4_45.2 (constants.%.1)]
  626. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  627. // CHECK:STDOUT: %T.loc4_25.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc4_25.2 (constants.%T)]
  628. // CHECK:STDOUT: %x.param: @ImplicitGenericParam.%T.loc4_25.2 (%T) = value_param runtime_param0
  629. // CHECK:STDOUT: %x: @ImplicitGenericParam.%T.loc4_25.2 (%T) = bind_name x, %x.param
  630. // CHECK:STDOUT: %return.param: ref @ImplicitGenericParam.%.loc4_45.2 (%.1) = out_param runtime_param1
  631. // CHECK:STDOUT: %return: ref @ImplicitGenericParam.%.loc4_45.2 (%.1) = return_slot %return.param
  632. // CHECK:STDOUT: }
  633. // CHECK:STDOUT: %CallImplicitGenericParam.decl: %CallImplicitGenericParam.type = fn_decl @CallImplicitGenericParam [template = constants.%CallImplicitGenericParam] {
  634. // CHECK:STDOUT: %n.patt: i32 = binding_pattern n
  635. // CHECK:STDOUT: %n.param_patt: i32 = value_param_pattern %n.patt, runtime_param0
  636. // CHECK:STDOUT: %return.patt: %.3 = return_slot_pattern
  637. // CHECK:STDOUT: %return.param_patt: %.3 = out_param_pattern %return.patt, runtime_param1
  638. // CHECK:STDOUT: } {
  639. // CHECK:STDOUT: %int.make_type_32.loc6_32: init type = call constants.%Int32() [template = i32]
  640. // CHECK:STDOUT: %.loc6_32.1: type = value_of_initializer %int.make_type_32.loc6_32 [template = i32]
  641. // CHECK:STDOUT: %.loc6_32.2: type = converted %int.make_type_32.loc6_32, %.loc6_32.1 [template = i32]
  642. // CHECK:STDOUT: %int.make_type_32.loc6_40: init type = call constants.%Int32() [template = i32]
  643. // CHECK:STDOUT: %.loc6_43.1: type = value_of_initializer %int.make_type_32.loc6_40 [template = i32]
  644. // CHECK:STDOUT: %.loc6_43.2: type = converted %int.make_type_32.loc6_40, %.loc6_43.1 [template = i32]
  645. // CHECK:STDOUT: %.loc6_43.3: type = ptr_type i32 [template = constants.%.3]
  646. // CHECK:STDOUT: %n.param: i32 = value_param runtime_param0
  647. // CHECK:STDOUT: %n: i32 = bind_name n, %n.param
  648. // CHECK:STDOUT: %return.param: ref %.3 = out_param runtime_param1
  649. // CHECK:STDOUT: %return: ref %.3 = return_slot %return.param
  650. // CHECK:STDOUT: }
  651. // CHECK:STDOUT: }
  652. // CHECK:STDOUT:
  653. // CHECK:STDOUT: generic fn @ImplicitGenericParam(%T.loc4_25.1: type) {
  654. // CHECK:STDOUT: %T.loc4_25.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_25.2 (constants.%T)]
  655. // CHECK:STDOUT: %T.patt.loc4_25.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_25.2 (constants.%T.patt)]
  656. // CHECK:STDOUT: %.loc4_45.2: type = ptr_type @ImplicitGenericParam.%T.loc4_25.2 (%T) [symbolic = %.loc4_45.2 (constants.%.1)]
  657. // CHECK:STDOUT:
  658. // CHECK:STDOUT: !definition:
  659. // CHECK:STDOUT: %.loc4_56.2: <specific function> = specific_function constants.%ImplicitGenericParam, @ImplicitGenericParam(%T.loc4_25.2) [symbolic = %.loc4_56.2 (constants.%.2)]
  660. // CHECK:STDOUT:
  661. // CHECK:STDOUT: fn[%T.param_patt: type](%x.param_patt: @ImplicitGenericParam.%T.loc4_25.2 (%T)) -> @ImplicitGenericParam.%.loc4_45.2 (%.1) {
  662. // CHECK:STDOUT: !entry:
  663. // CHECK:STDOUT: %ImplicitGenericParam.ref: %ImplicitGenericParam.type = name_ref ImplicitGenericParam, file.%ImplicitGenericParam.decl [template = constants.%ImplicitGenericParam]
  664. // CHECK:STDOUT: %x.ref: @ImplicitGenericParam.%T.loc4_25.2 (%T) = name_ref x, %x
  665. // CHECK:STDOUT: %.loc4_56.1: <specific function> = specific_function %ImplicitGenericParam.ref, @ImplicitGenericParam(constants.%T) [symbolic = %.loc4_56.2 (constants.%.2)]
  666. // CHECK:STDOUT: %ImplicitGenericParam.call: init @ImplicitGenericParam.%.loc4_45.2 (%.1) = call %.loc4_56.1(%x.ref)
  667. // CHECK:STDOUT: %.loc4_79.1: @ImplicitGenericParam.%.loc4_45.2 (%.1) = value_of_initializer %ImplicitGenericParam.call
  668. // CHECK:STDOUT: %.loc4_79.2: @ImplicitGenericParam.%.loc4_45.2 (%.1) = converted %ImplicitGenericParam.call, %.loc4_79.1
  669. // CHECK:STDOUT: return %.loc4_79.2
  670. // CHECK:STDOUT: }
  671. // CHECK:STDOUT: }
  672. // CHECK:STDOUT:
  673. // CHECK:STDOUT: fn @CallImplicitGenericParam(%n.param_patt: i32) -> %.3 {
  674. // CHECK:STDOUT: !entry:
  675. // CHECK:STDOUT: %ImplicitGenericParam.ref: %ImplicitGenericParam.type = name_ref ImplicitGenericParam, file.%ImplicitGenericParam.decl [template = constants.%ImplicitGenericParam]
  676. // CHECK:STDOUT: %n.ref: i32 = name_ref n, %n
  677. // CHECK:STDOUT: %.loc7_10: <specific function> = specific_function %ImplicitGenericParam.ref, @ImplicitGenericParam(i32) [template = constants.%.4]
  678. // CHECK:STDOUT: %ImplicitGenericParam.call: init %.3 = call %.loc7_10(%n.ref)
  679. // CHECK:STDOUT: %.loc7_33.1: %.3 = value_of_initializer %ImplicitGenericParam.call
  680. // CHECK:STDOUT: %.loc7_33.2: %.3 = converted %ImplicitGenericParam.call, %.loc7_33.1
  681. // CHECK:STDOUT: return %.loc7_33.2
  682. // CHECK:STDOUT: }
  683. // CHECK:STDOUT:
  684. // CHECK:STDOUT: specific @ImplicitGenericParam(constants.%T) {
  685. // CHECK:STDOUT: %T.loc4_25.2 => constants.%T
  686. // CHECK:STDOUT: %T.patt.loc4_25.2 => constants.%T
  687. // CHECK:STDOUT: %.loc4_45.2 => constants.%.1
  688. // CHECK:STDOUT:
  689. // CHECK:STDOUT: !definition:
  690. // CHECK:STDOUT: %.loc4_56.2 => constants.%.2
  691. // CHECK:STDOUT: }
  692. // CHECK:STDOUT:
  693. // CHECK:STDOUT: specific @ImplicitGenericParam(%T.loc4_25.2) {
  694. // CHECK:STDOUT: %T.loc4_25.2 => constants.%T
  695. // CHECK:STDOUT: %T.patt.loc4_25.2 => constants.%T
  696. // CHECK:STDOUT: %.loc4_45.2 => constants.%.1
  697. // CHECK:STDOUT: }
  698. // CHECK:STDOUT:
  699. // CHECK:STDOUT: specific @ImplicitGenericParam(i32) {
  700. // CHECK:STDOUT: %T.loc4_25.2 => i32
  701. // CHECK:STDOUT: %T.patt.loc4_25.2 => i32
  702. // CHECK:STDOUT: %.loc4_45.2 => constants.%.3
  703. // CHECK:STDOUT:
  704. // CHECK:STDOUT: !definition:
  705. // CHECK:STDOUT: %.loc4_56.2 => constants.%.4
  706. // CHECK:STDOUT: }
  707. // CHECK:STDOUT:
  708. // CHECK:STDOUT: --- deduce_nested_tuple.carbon
  709. // CHECK:STDOUT:
  710. // CHECK:STDOUT: constants {
  711. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  712. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  713. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  714. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  715. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  716. // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type, type) [template]
  717. // CHECK:STDOUT: %tuple.type.2: type = tuple_type (%T, i32) [symbolic]
  718. // CHECK:STDOUT: %TupleParam.type: type = fn_type @TupleParam [template]
  719. // CHECK:STDOUT: %TupleParam: %TupleParam.type = struct_value () [template]
  720. // CHECK:STDOUT: %CallTupleParam.type: type = fn_type @CallTupleParam [template]
  721. // CHECK:STDOUT: %CallTupleParam: %CallTupleParam.type = struct_value () [template]
  722. // CHECK:STDOUT: %.2: i32 = int_value 1 [template]
  723. // CHECK:STDOUT: %.3: i32 = int_value 2 [template]
  724. // CHECK:STDOUT: %tuple.type.3: type = tuple_type (i32, i32) [template]
  725. // CHECK:STDOUT: %.4: <specific function> = specific_function %TupleParam, @TupleParam(i32) [template]
  726. // CHECK:STDOUT: %tuple: %tuple.type.3 = tuple_value (%.2, %.3) [template]
  727. // CHECK:STDOUT: }
  728. // CHECK:STDOUT:
  729. // CHECK:STDOUT: imports {
  730. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  731. // CHECK:STDOUT: .Int32 = %import_ref
  732. // CHECK:STDOUT: import Core//prelude
  733. // CHECK:STDOUT: import Core//prelude/...
  734. // CHECK:STDOUT: }
  735. // CHECK:STDOUT: }
  736. // CHECK:STDOUT:
  737. // CHECK:STDOUT: file {
  738. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  739. // CHECK:STDOUT: .Core = imports.%Core
  740. // CHECK:STDOUT: .TupleParam = %TupleParam.decl
  741. // CHECK:STDOUT: .CallTupleParam = %CallTupleParam.decl
  742. // CHECK:STDOUT: }
  743. // CHECK:STDOUT: %Core.import = import Core
  744. // CHECK:STDOUT: %TupleParam.decl: %TupleParam.type = fn_decl @TupleParam [template = constants.%TupleParam] {
  745. // CHECK:STDOUT: %T.patt.loc4_15.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_15.2 (constants.%T.patt)]
  746. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc4_15.1, runtime_param<invalid> [symbolic = %T.patt.loc4_15.2 (constants.%T.patt)]
  747. // CHECK:STDOUT: %x.patt: @TupleParam.%tuple.type (%tuple.type.2) = binding_pattern x
  748. // CHECK:STDOUT: %x.param_patt: @TupleParam.%tuple.type (%tuple.type.2) = value_param_pattern %x.patt, runtime_param0
  749. // CHECK:STDOUT: } {
  750. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc4_15.1 [symbolic = %T.loc4_15.2 (constants.%T)]
  751. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  752. // CHECK:STDOUT: %.loc4_35.1: %tuple.type.1 = tuple_literal (%T.ref, %int.make_type_32)
  753. // CHECK:STDOUT: %.loc4_35.2: type = value_of_initializer %int.make_type_32 [template = i32]
  754. // CHECK:STDOUT: %.loc4_35.3: type = converted %int.make_type_32, %.loc4_35.2 [template = i32]
  755. // CHECK:STDOUT: %.loc4_35.4: type = converted %.loc4_35.1, constants.%tuple.type.2 [symbolic = %tuple.type (constants.%tuple.type.2)]
  756. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  757. // CHECK:STDOUT: %T.loc4_15.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc4_15.2 (constants.%T)]
  758. // CHECK:STDOUT: %x.param: @TupleParam.%tuple.type (%tuple.type.2) = value_param runtime_param0
  759. // CHECK:STDOUT: %x: @TupleParam.%tuple.type (%tuple.type.2) = bind_name x, %x.param
  760. // CHECK:STDOUT: }
  761. // CHECK:STDOUT: %CallTupleParam.decl: %CallTupleParam.type = fn_decl @CallTupleParam [template = constants.%CallTupleParam] {} {}
  762. // CHECK:STDOUT: }
  763. // CHECK:STDOUT:
  764. // CHECK:STDOUT: generic fn @TupleParam(%T.loc4_15.1: type) {
  765. // CHECK:STDOUT: %T.loc4_15.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_15.2 (constants.%T)]
  766. // CHECK:STDOUT: %T.patt.loc4_15.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_15.2 (constants.%T.patt)]
  767. // CHECK:STDOUT: %tuple.type: type = tuple_type (@TupleParam.%T.loc4_15.2 (%T), i32) [symbolic = %tuple.type (constants.%tuple.type.2)]
  768. // CHECK:STDOUT:
  769. // CHECK:STDOUT: !definition:
  770. // CHECK:STDOUT:
  771. // CHECK:STDOUT: fn[%T.param_patt: type](%x.param_patt: @TupleParam.%tuple.type (%tuple.type.2)) {
  772. // CHECK:STDOUT: !entry:
  773. // CHECK:STDOUT: return
  774. // CHECK:STDOUT: }
  775. // CHECK:STDOUT: }
  776. // CHECK:STDOUT:
  777. // CHECK:STDOUT: fn @CallTupleParam() {
  778. // CHECK:STDOUT: !entry:
  779. // CHECK:STDOUT: %TupleParam.ref: %TupleParam.type = name_ref TupleParam, file.%TupleParam.decl [template = constants.%TupleParam]
  780. // CHECK:STDOUT: %.loc7_15: i32 = int_value 1 [template = constants.%.2]
  781. // CHECK:STDOUT: %.loc7_18: i32 = int_value 2 [template = constants.%.3]
  782. // CHECK:STDOUT: %.loc7_19.1: %tuple.type.3 = tuple_literal (%.loc7_15, %.loc7_18)
  783. // CHECK:STDOUT: %.loc7_3: <specific function> = specific_function %TupleParam.ref, @TupleParam(i32) [template = constants.%.4]
  784. // CHECK:STDOUT: %tuple: %tuple.type.3 = tuple_value (%.loc7_15, %.loc7_18) [template = constants.%tuple]
  785. // CHECK:STDOUT: %.loc7_19.2: %tuple.type.3 = converted %.loc7_19.1, %tuple [template = constants.%tuple]
  786. // CHECK:STDOUT: %TupleParam.call: init %empty_tuple.type = call %.loc7_3(%.loc7_19.2)
  787. // CHECK:STDOUT: return
  788. // CHECK:STDOUT: }
  789. // CHECK:STDOUT:
  790. // CHECK:STDOUT: specific @TupleParam(constants.%T) {
  791. // CHECK:STDOUT: %T.loc4_15.2 => constants.%T
  792. // CHECK:STDOUT: %T.patt.loc4_15.2 => constants.%T
  793. // CHECK:STDOUT: %tuple.type => constants.%tuple.type.2
  794. // CHECK:STDOUT: }
  795. // CHECK:STDOUT:
  796. // CHECK:STDOUT: specific @TupleParam(i32) {
  797. // CHECK:STDOUT: %T.loc4_15.2 => i32
  798. // CHECK:STDOUT: %T.patt.loc4_15.2 => i32
  799. // CHECK:STDOUT: %tuple.type => constants.%tuple.type.3
  800. // CHECK:STDOUT:
  801. // CHECK:STDOUT: !definition:
  802. // CHECK:STDOUT: }
  803. // CHECK:STDOUT:
  804. // CHECK:STDOUT: --- deduce_nested_struct.carbon
  805. // CHECK:STDOUT:
  806. // CHECK:STDOUT: constants {
  807. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  808. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  809. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  810. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  811. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  812. // CHECK:STDOUT: %.1: type = struct_type {.a: %T, .b: i32} [symbolic]
  813. // CHECK:STDOUT: %StructParam.type: type = fn_type @StructParam [template]
  814. // CHECK:STDOUT: %StructParam: %StructParam.type = struct_value () [template]
  815. // CHECK:STDOUT: %CallStructParam.type: type = fn_type @CallStructParam [template]
  816. // CHECK:STDOUT: %CallStructParam: %CallStructParam.type = struct_value () [template]
  817. // CHECK:STDOUT: %.3: i32 = int_value 1 [template]
  818. // CHECK:STDOUT: %.4: i32 = int_value 2 [template]
  819. // CHECK:STDOUT: %.5: type = struct_type {.a: i32, .b: i32} [template]
  820. // CHECK:STDOUT: %.6: <specific function> = specific_function %StructParam, @StructParam(i32) [template]
  821. // CHECK:STDOUT: %struct: %.5 = struct_value (%.3, %.4) [template]
  822. // CHECK:STDOUT: }
  823. // CHECK:STDOUT:
  824. // CHECK:STDOUT: imports {
  825. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  826. // CHECK:STDOUT: .Int32 = %import_ref
  827. // CHECK:STDOUT: import Core//prelude
  828. // CHECK:STDOUT: import Core//prelude/...
  829. // CHECK:STDOUT: }
  830. // CHECK:STDOUT: }
  831. // CHECK:STDOUT:
  832. // CHECK:STDOUT: file {
  833. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  834. // CHECK:STDOUT: .Core = imports.%Core
  835. // CHECK:STDOUT: .StructParam = %StructParam.decl
  836. // CHECK:STDOUT: .CallStructParam = %CallStructParam.decl
  837. // CHECK:STDOUT: }
  838. // CHECK:STDOUT: %Core.import = import Core
  839. // CHECK:STDOUT: %StructParam.decl: %StructParam.type = fn_decl @StructParam [template = constants.%StructParam] {
  840. // CHECK:STDOUT: %T.patt.loc4_16.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_16.2 (constants.%T.patt)]
  841. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc4_16.1, runtime_param<invalid> [symbolic = %T.patt.loc4_16.2 (constants.%T.patt)]
  842. // CHECK:STDOUT: %x.patt: @StructParam.%.loc4_44.2 (%.1) = binding_pattern x
  843. // CHECK:STDOUT: %x.param_patt: @StructParam.%.loc4_44.2 (%.1) = value_param_pattern %x.patt, runtime_param0
  844. // CHECK:STDOUT: } {
  845. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc4_16.1 [symbolic = %T.loc4_16.2 (constants.%T)]
  846. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  847. // CHECK:STDOUT: %.loc4_41.1: type = value_of_initializer %int.make_type_32 [template = i32]
  848. // CHECK:STDOUT: %.loc4_41.2: type = converted %int.make_type_32, %.loc4_41.1 [template = i32]
  849. // CHECK:STDOUT: %.loc4_44.1: type = struct_type {.a: %T, .b: i32} [symbolic = %.loc4_44.2 (constants.%.1)]
  850. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  851. // CHECK:STDOUT: %T.loc4_16.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc4_16.2 (constants.%T)]
  852. // CHECK:STDOUT: %x.param: @StructParam.%.loc4_44.2 (%.1) = value_param runtime_param0
  853. // CHECK:STDOUT: %x: @StructParam.%.loc4_44.2 (%.1) = bind_name x, %x.param
  854. // CHECK:STDOUT: }
  855. // CHECK:STDOUT: %CallStructParam.decl: %CallStructParam.type = fn_decl @CallStructParam [template = constants.%CallStructParam] {} {}
  856. // CHECK:STDOUT: }
  857. // CHECK:STDOUT:
  858. // CHECK:STDOUT: generic fn @StructParam(%T.loc4_16.1: type) {
  859. // CHECK:STDOUT: %T.loc4_16.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_16.2 (constants.%T)]
  860. // CHECK:STDOUT: %T.patt.loc4_16.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_16.2 (constants.%T.patt)]
  861. // CHECK:STDOUT: %.loc4_44.2: type = struct_type {.a: @StructParam.%T.loc4_16.2 (%T), .b: i32} [symbolic = %.loc4_44.2 (constants.%.1)]
  862. // CHECK:STDOUT:
  863. // CHECK:STDOUT: !definition:
  864. // CHECK:STDOUT:
  865. // CHECK:STDOUT: fn[%T.param_patt: type](%x.param_patt: @StructParam.%.loc4_44.2 (%.1)) {
  866. // CHECK:STDOUT: !entry:
  867. // CHECK:STDOUT: return
  868. // CHECK:STDOUT: }
  869. // CHECK:STDOUT: }
  870. // CHECK:STDOUT:
  871. // CHECK:STDOUT: fn @CallStructParam() {
  872. // CHECK:STDOUT: !entry:
  873. // CHECK:STDOUT: %StructParam.ref: %StructParam.type = name_ref StructParam, file.%StructParam.decl [template = constants.%StructParam]
  874. // CHECK:STDOUT: %.loc7_21: i32 = int_value 1 [template = constants.%.3]
  875. // CHECK:STDOUT: %.loc7_29: i32 = int_value 2 [template = constants.%.4]
  876. // CHECK:STDOUT: %.loc7_30.1: %.5 = struct_literal (%.loc7_21, %.loc7_29)
  877. // CHECK:STDOUT: %.loc7_3: <specific function> = specific_function %StructParam.ref, @StructParam(i32) [template = constants.%.6]
  878. // CHECK:STDOUT: %struct: %.5 = struct_value (%.loc7_21, %.loc7_29) [template = constants.%struct]
  879. // CHECK:STDOUT: %.loc7_30.2: %.5 = converted %.loc7_30.1, %struct [template = constants.%struct]
  880. // CHECK:STDOUT: %StructParam.call: init %empty_tuple.type = call %.loc7_3(%.loc7_30.2)
  881. // CHECK:STDOUT: return
  882. // CHECK:STDOUT: }
  883. // CHECK:STDOUT:
  884. // CHECK:STDOUT: specific @StructParam(constants.%T) {
  885. // CHECK:STDOUT: %T.loc4_16.2 => constants.%T
  886. // CHECK:STDOUT: %T.patt.loc4_16.2 => constants.%T
  887. // CHECK:STDOUT: %.loc4_44.2 => constants.%.1
  888. // CHECK:STDOUT: }
  889. // CHECK:STDOUT:
  890. // CHECK:STDOUT: specific @StructParam(i32) {
  891. // CHECK:STDOUT: %T.loc4_16.2 => i32
  892. // CHECK:STDOUT: %T.patt.loc4_16.2 => i32
  893. // CHECK:STDOUT: %.loc4_44.2 => constants.%.5
  894. // CHECK:STDOUT:
  895. // CHECK:STDOUT: !definition:
  896. // CHECK:STDOUT: }
  897. // CHECK:STDOUT:
  898. // CHECK:STDOUT: --- fail_deduce_bigger_struct.carbon
  899. // CHECK:STDOUT:
  900. // CHECK:STDOUT: constants {
  901. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  902. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  903. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  904. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  905. // CHECK:STDOUT: %.1: type = struct_type {.c: %T, .d: i32, .e: i32} [symbolic]
  906. // CHECK:STDOUT: %BigStructParam.type: type = fn_type @BigStructParam [template]
  907. // CHECK:STDOUT: %BigStructParam: %BigStructParam.type = struct_value () [template]
  908. // CHECK:STDOUT: %CallBigStructParam.type: type = fn_type @CallBigStructParam [template]
  909. // CHECK:STDOUT: %CallBigStructParam: %CallBigStructParam.type = struct_value () [template]
  910. // CHECK:STDOUT: %.3: i32 = int_value 3 [template]
  911. // CHECK:STDOUT: %.4: i32 = int_value 4 [template]
  912. // CHECK:STDOUT: %.5: type = struct_type {.c: i32, .d: i32} [template]
  913. // CHECK:STDOUT: }
  914. // CHECK:STDOUT:
  915. // CHECK:STDOUT: imports {
  916. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  917. // CHECK:STDOUT: .Int32 = %import_ref
  918. // CHECK:STDOUT: import Core//prelude
  919. // CHECK:STDOUT: import Core//prelude/...
  920. // CHECK:STDOUT: }
  921. // CHECK:STDOUT: }
  922. // CHECK:STDOUT:
  923. // CHECK:STDOUT: file {
  924. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  925. // CHECK:STDOUT: .Core = imports.%Core
  926. // CHECK:STDOUT: .BigStructParam = %BigStructParam.decl
  927. // CHECK:STDOUT: .CallBigStructParam = %CallBigStructParam.decl
  928. // CHECK:STDOUT: }
  929. // CHECK:STDOUT: %Core.import = import Core
  930. // CHECK:STDOUT: %BigStructParam.decl: %BigStructParam.type = fn_decl @BigStructParam [template = constants.%BigStructParam] {
  931. // CHECK:STDOUT: %T.patt.loc4_19.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_19.2 (constants.%T.patt)]
  932. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc4_19.1, runtime_param<invalid> [symbolic = %T.patt.loc4_19.2 (constants.%T.patt)]
  933. // CHECK:STDOUT: %x.patt: @BigStructParam.%.loc4_56.2 (%.1) = binding_pattern x
  934. // CHECK:STDOUT: %x.param_patt: @BigStructParam.%.loc4_56.2 (%.1) = value_param_pattern %x.patt, runtime_param0
  935. // CHECK:STDOUT: } {
  936. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc4_19.1 [symbolic = %T.loc4_19.2 (constants.%T)]
  937. // CHECK:STDOUT: %int.make_type_32.loc4_44: init type = call constants.%Int32() [template = i32]
  938. // CHECK:STDOUT: %.loc4_44.1: type = value_of_initializer %int.make_type_32.loc4_44 [template = i32]
  939. // CHECK:STDOUT: %.loc4_44.2: type = converted %int.make_type_32.loc4_44, %.loc4_44.1 [template = i32]
  940. // CHECK:STDOUT: %int.make_type_32.loc4_53: init type = call constants.%Int32() [template = i32]
  941. // CHECK:STDOUT: %.loc4_53.1: type = value_of_initializer %int.make_type_32.loc4_53 [template = i32]
  942. // CHECK:STDOUT: %.loc4_53.2: type = converted %int.make_type_32.loc4_53, %.loc4_53.1 [template = i32]
  943. // CHECK:STDOUT: %.loc4_56.1: type = struct_type {.c: %T, .d: i32, .e: i32} [symbolic = %.loc4_56.2 (constants.%.1)]
  944. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  945. // CHECK:STDOUT: %T.loc4_19.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc4_19.2 (constants.%T)]
  946. // CHECK:STDOUT: %x.param: @BigStructParam.%.loc4_56.2 (%.1) = value_param runtime_param0
  947. // CHECK:STDOUT: %x: @BigStructParam.%.loc4_56.2 (%.1) = bind_name x, %x.param
  948. // CHECK:STDOUT: }
  949. // CHECK:STDOUT: %CallBigStructParam.decl: %CallBigStructParam.type = fn_decl @CallBigStructParam [template = constants.%CallBigStructParam] {} {}
  950. // CHECK:STDOUT: }
  951. // CHECK:STDOUT:
  952. // CHECK:STDOUT: generic fn @BigStructParam(%T.loc4_19.1: type) {
  953. // CHECK:STDOUT: %T.loc4_19.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_19.2 (constants.%T)]
  954. // CHECK:STDOUT: %T.patt.loc4_19.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_19.2 (constants.%T.patt)]
  955. // CHECK:STDOUT: %.loc4_56.2: type = struct_type {.c: @BigStructParam.%T.loc4_19.2 (%T), .d: i32, .e: i32} [symbolic = %.loc4_56.2 (constants.%.1)]
  956. // CHECK:STDOUT:
  957. // CHECK:STDOUT: !definition:
  958. // CHECK:STDOUT:
  959. // CHECK:STDOUT: fn[%T.param_patt: type](%x.param_patt: @BigStructParam.%.loc4_56.2 (%.1)) {
  960. // CHECK:STDOUT: !entry:
  961. // CHECK:STDOUT: return
  962. // CHECK:STDOUT: }
  963. // CHECK:STDOUT: }
  964. // CHECK:STDOUT:
  965. // CHECK:STDOUT: fn @CallBigStructParam() {
  966. // CHECK:STDOUT: !entry:
  967. // CHECK:STDOUT: %BigStructParam.ref: %BigStructParam.type = name_ref BigStructParam, file.%BigStructParam.decl [template = constants.%BigStructParam]
  968. // CHECK:STDOUT: %.loc14_24: i32 = int_value 3 [template = constants.%.3]
  969. // CHECK:STDOUT: %.loc14_32: i32 = int_value 4 [template = constants.%.4]
  970. // CHECK:STDOUT: %.loc14_33: %.5 = struct_literal (%.loc14_24, %.loc14_32)
  971. // CHECK:STDOUT: return
  972. // CHECK:STDOUT: }
  973. // CHECK:STDOUT:
  974. // CHECK:STDOUT: specific @BigStructParam(constants.%T) {
  975. // CHECK:STDOUT: %T.loc4_19.2 => constants.%T
  976. // CHECK:STDOUT: %T.patt.loc4_19.2 => constants.%T
  977. // CHECK:STDOUT: %.loc4_56.2 => constants.%.1
  978. // CHECK:STDOUT: }
  979. // CHECK:STDOUT:
  980. // CHECK:STDOUT: --- fail_deduce_smaller_struct.carbon
  981. // CHECK:STDOUT:
  982. // CHECK:STDOUT: constants {
  983. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  984. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  985. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  986. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  987. // CHECK:STDOUT: %.1: type = struct_type {.f: %T, .g: i32} [symbolic]
  988. // CHECK:STDOUT: %SmallStructParam.type: type = fn_type @SmallStructParam [template]
  989. // CHECK:STDOUT: %SmallStructParam: %SmallStructParam.type = struct_value () [template]
  990. // CHECK:STDOUT: %CallSmallStructParam.type: type = fn_type @CallSmallStructParam [template]
  991. // CHECK:STDOUT: %CallSmallStructParam: %CallSmallStructParam.type = struct_value () [template]
  992. // CHECK:STDOUT: %.3: i32 = int_value 5 [template]
  993. // CHECK:STDOUT: %.4: i32 = int_value 6 [template]
  994. // CHECK:STDOUT: %.5: i32 = int_value 7 [template]
  995. // CHECK:STDOUT: %.6: type = struct_type {.f: i32, .g: i32, .h: i32} [template]
  996. // CHECK:STDOUT: }
  997. // CHECK:STDOUT:
  998. // CHECK:STDOUT: imports {
  999. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  1000. // CHECK:STDOUT: .Int32 = %import_ref
  1001. // CHECK:STDOUT: import Core//prelude
  1002. // CHECK:STDOUT: import Core//prelude/...
  1003. // CHECK:STDOUT: }
  1004. // CHECK:STDOUT: }
  1005. // CHECK:STDOUT:
  1006. // CHECK:STDOUT: file {
  1007. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1008. // CHECK:STDOUT: .Core = imports.%Core
  1009. // CHECK:STDOUT: .SmallStructParam = %SmallStructParam.decl
  1010. // CHECK:STDOUT: .CallSmallStructParam = %CallSmallStructParam.decl
  1011. // CHECK:STDOUT: }
  1012. // CHECK:STDOUT: %Core.import = import Core
  1013. // CHECK:STDOUT: %SmallStructParam.decl: %SmallStructParam.type = fn_decl @SmallStructParam [template = constants.%SmallStructParam] {
  1014. // CHECK:STDOUT: %T.patt.loc4_21.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_21.2 (constants.%T.patt)]
  1015. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc4_21.1, runtime_param<invalid> [symbolic = %T.patt.loc4_21.2 (constants.%T.patt)]
  1016. // CHECK:STDOUT: %x.patt: @SmallStructParam.%.loc4_49.2 (%.1) = binding_pattern x
  1017. // CHECK:STDOUT: %x.param_patt: @SmallStructParam.%.loc4_49.2 (%.1) = value_param_pattern %x.patt, runtime_param0
  1018. // CHECK:STDOUT: } {
  1019. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc4_21.1 [symbolic = %T.loc4_21.2 (constants.%T)]
  1020. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  1021. // CHECK:STDOUT: %.loc4_46.1: type = value_of_initializer %int.make_type_32 [template = i32]
  1022. // CHECK:STDOUT: %.loc4_46.2: type = converted %int.make_type_32, %.loc4_46.1 [template = i32]
  1023. // CHECK:STDOUT: %.loc4_49.1: type = struct_type {.f: %T, .g: i32} [symbolic = %.loc4_49.2 (constants.%.1)]
  1024. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  1025. // CHECK:STDOUT: %T.loc4_21.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc4_21.2 (constants.%T)]
  1026. // CHECK:STDOUT: %x.param: @SmallStructParam.%.loc4_49.2 (%.1) = value_param runtime_param0
  1027. // CHECK:STDOUT: %x: @SmallStructParam.%.loc4_49.2 (%.1) = bind_name x, %x.param
  1028. // CHECK:STDOUT: }
  1029. // CHECK:STDOUT: %CallSmallStructParam.decl: %CallSmallStructParam.type = fn_decl @CallSmallStructParam [template = constants.%CallSmallStructParam] {} {}
  1030. // CHECK:STDOUT: }
  1031. // CHECK:STDOUT:
  1032. // CHECK:STDOUT: generic fn @SmallStructParam(%T.loc4_21.1: type) {
  1033. // CHECK:STDOUT: %T.loc4_21.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_21.2 (constants.%T)]
  1034. // CHECK:STDOUT: %T.patt.loc4_21.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_21.2 (constants.%T.patt)]
  1035. // CHECK:STDOUT: %.loc4_49.2: type = struct_type {.f: @SmallStructParam.%T.loc4_21.2 (%T), .g: i32} [symbolic = %.loc4_49.2 (constants.%.1)]
  1036. // CHECK:STDOUT:
  1037. // CHECK:STDOUT: !definition:
  1038. // CHECK:STDOUT:
  1039. // CHECK:STDOUT: fn[%T.param_patt: type](%x.param_patt: @SmallStructParam.%.loc4_49.2 (%.1)) {
  1040. // CHECK:STDOUT: !entry:
  1041. // CHECK:STDOUT: return
  1042. // CHECK:STDOUT: }
  1043. // CHECK:STDOUT: }
  1044. // CHECK:STDOUT:
  1045. // CHECK:STDOUT: fn @CallSmallStructParam() {
  1046. // CHECK:STDOUT: !entry:
  1047. // CHECK:STDOUT: %SmallStructParam.ref: %SmallStructParam.type = name_ref SmallStructParam, file.%SmallStructParam.decl [template = constants.%SmallStructParam]
  1048. // CHECK:STDOUT: %.loc14_26: i32 = int_value 5 [template = constants.%.3]
  1049. // CHECK:STDOUT: %.loc14_34: i32 = int_value 6 [template = constants.%.4]
  1050. // CHECK:STDOUT: %.loc14_42: i32 = int_value 7 [template = constants.%.5]
  1051. // CHECK:STDOUT: %.loc14_43: %.6 = struct_literal (%.loc14_26, %.loc14_34, %.loc14_42)
  1052. // CHECK:STDOUT: return
  1053. // CHECK:STDOUT: }
  1054. // CHECK:STDOUT:
  1055. // CHECK:STDOUT: specific @SmallStructParam(constants.%T) {
  1056. // CHECK:STDOUT: %T.loc4_21.2 => constants.%T
  1057. // CHECK:STDOUT: %T.patt.loc4_21.2 => constants.%T
  1058. // CHECK:STDOUT: %.loc4_49.2 => constants.%.1
  1059. // CHECK:STDOUT: }
  1060. // CHECK:STDOUT:
  1061. // CHECK:STDOUT: --- fail_deduce_struct_wrong_name.carbon
  1062. // CHECK:STDOUT:
  1063. // CHECK:STDOUT: constants {
  1064. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  1065. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  1066. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  1067. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  1068. // CHECK:STDOUT: %.1: type = struct_type {.i: %T, .different: i32} [symbolic]
  1069. // CHECK:STDOUT: %WrongNameStructParam.type: type = fn_type @WrongNameStructParam [template]
  1070. // CHECK:STDOUT: %WrongNameStructParam: %WrongNameStructParam.type = struct_value () [template]
  1071. // CHECK:STDOUT: %CallWrongNameStructParam.type: type = fn_type @CallWrongNameStructParam [template]
  1072. // CHECK:STDOUT: %CallWrongNameStructParam: %CallWrongNameStructParam.type = struct_value () [template]
  1073. // CHECK:STDOUT: %.3: i32 = int_value 8 [template]
  1074. // CHECK:STDOUT: %.4: i32 = int_value 9 [template]
  1075. // CHECK:STDOUT: %.5: type = struct_type {.i: i32, .j: i32} [template]
  1076. // CHECK:STDOUT: }
  1077. // CHECK:STDOUT:
  1078. // CHECK:STDOUT: imports {
  1079. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  1080. // CHECK:STDOUT: .Int32 = %import_ref
  1081. // CHECK:STDOUT: import Core//prelude
  1082. // CHECK:STDOUT: import Core//prelude/...
  1083. // CHECK:STDOUT: }
  1084. // CHECK:STDOUT: }
  1085. // CHECK:STDOUT:
  1086. // CHECK:STDOUT: file {
  1087. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1088. // CHECK:STDOUT: .Core = imports.%Core
  1089. // CHECK:STDOUT: .WrongNameStructParam = %WrongNameStructParam.decl
  1090. // CHECK:STDOUT: .CallWrongNameStructParam = %CallWrongNameStructParam.decl
  1091. // CHECK:STDOUT: }
  1092. // CHECK:STDOUT: %Core.import = import Core
  1093. // CHECK:STDOUT: %WrongNameStructParam.decl: %WrongNameStructParam.type = fn_decl @WrongNameStructParam [template = constants.%WrongNameStructParam] {
  1094. // CHECK:STDOUT: %T.patt.loc4_25.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_25.2 (constants.%T.patt)]
  1095. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc4_25.1, runtime_param<invalid> [symbolic = %T.patt.loc4_25.2 (constants.%T.patt)]
  1096. // CHECK:STDOUT: %x.patt: @WrongNameStructParam.%.loc4_61.2 (%.1) = binding_pattern x
  1097. // CHECK:STDOUT: %x.param_patt: @WrongNameStructParam.%.loc4_61.2 (%.1) = value_param_pattern %x.patt, runtime_param0
  1098. // CHECK:STDOUT: } {
  1099. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc4_25.1 [symbolic = %T.loc4_25.2 (constants.%T)]
  1100. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  1101. // CHECK:STDOUT: %.loc4_58.1: type = value_of_initializer %int.make_type_32 [template = i32]
  1102. // CHECK:STDOUT: %.loc4_58.2: type = converted %int.make_type_32, %.loc4_58.1 [template = i32]
  1103. // CHECK:STDOUT: %.loc4_61.1: type = struct_type {.i: %T, .different: i32} [symbolic = %.loc4_61.2 (constants.%.1)]
  1104. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  1105. // CHECK:STDOUT: %T.loc4_25.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc4_25.2 (constants.%T)]
  1106. // CHECK:STDOUT: %x.param: @WrongNameStructParam.%.loc4_61.2 (%.1) = value_param runtime_param0
  1107. // CHECK:STDOUT: %x: @WrongNameStructParam.%.loc4_61.2 (%.1) = bind_name x, %x.param
  1108. // CHECK:STDOUT: }
  1109. // CHECK:STDOUT: %CallWrongNameStructParam.decl: %CallWrongNameStructParam.type = fn_decl @CallWrongNameStructParam [template = constants.%CallWrongNameStructParam] {} {}
  1110. // CHECK:STDOUT: }
  1111. // CHECK:STDOUT:
  1112. // CHECK:STDOUT: generic fn @WrongNameStructParam(%T.loc4_25.1: type) {
  1113. // CHECK:STDOUT: %T.loc4_25.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_25.2 (constants.%T)]
  1114. // CHECK:STDOUT: %T.patt.loc4_25.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_25.2 (constants.%T.patt)]
  1115. // CHECK:STDOUT: %.loc4_61.2: type = struct_type {.i: @WrongNameStructParam.%T.loc4_25.2 (%T), .different: i32} [symbolic = %.loc4_61.2 (constants.%.1)]
  1116. // CHECK:STDOUT:
  1117. // CHECK:STDOUT: !definition:
  1118. // CHECK:STDOUT:
  1119. // CHECK:STDOUT: fn[%T.param_patt: type](%x.param_patt: @WrongNameStructParam.%.loc4_61.2 (%.1)) {
  1120. // CHECK:STDOUT: !entry:
  1121. // CHECK:STDOUT: return
  1122. // CHECK:STDOUT: }
  1123. // CHECK:STDOUT: }
  1124. // CHECK:STDOUT:
  1125. // CHECK:STDOUT: fn @CallWrongNameStructParam() {
  1126. // CHECK:STDOUT: !entry:
  1127. // CHECK:STDOUT: %WrongNameStructParam.ref: %WrongNameStructParam.type = name_ref WrongNameStructParam, file.%WrongNameStructParam.decl [template = constants.%WrongNameStructParam]
  1128. // CHECK:STDOUT: %.loc14_30: i32 = int_value 8 [template = constants.%.3]
  1129. // CHECK:STDOUT: %.loc14_38: i32 = int_value 9 [template = constants.%.4]
  1130. // CHECK:STDOUT: %.loc14_39: %.5 = struct_literal (%.loc14_30, %.loc14_38)
  1131. // CHECK:STDOUT: return
  1132. // CHECK:STDOUT: }
  1133. // CHECK:STDOUT:
  1134. // CHECK:STDOUT: specific @WrongNameStructParam(constants.%T) {
  1135. // CHECK:STDOUT: %T.loc4_25.2 => constants.%T
  1136. // CHECK:STDOUT: %T.patt.loc4_25.2 => constants.%T
  1137. // CHECK:STDOUT: %.loc4_61.2 => constants.%.1
  1138. // CHECK:STDOUT: }
  1139. // CHECK:STDOUT:
  1140. // CHECK:STDOUT: --- fail_todo_deduce_struct_wrong_order.carbon
  1141. // CHECK:STDOUT:
  1142. // CHECK:STDOUT: constants {
  1143. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  1144. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  1145. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  1146. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  1147. // CHECK:STDOUT: %.1: type = struct_type {.first: %T, .second: i32} [symbolic]
  1148. // CHECK:STDOUT: %WrongOrderStructParam.type: type = fn_type @WrongOrderStructParam [template]
  1149. // CHECK:STDOUT: %WrongOrderStructParam: %WrongOrderStructParam.type = struct_value () [template]
  1150. // CHECK:STDOUT: %CallWrongOrderStructParam.type: type = fn_type @CallWrongOrderStructParam [template]
  1151. // CHECK:STDOUT: %CallWrongOrderStructParam: %CallWrongOrderStructParam.type = struct_value () [template]
  1152. // CHECK:STDOUT: %.3: i32 = int_value 11 [template]
  1153. // CHECK:STDOUT: %.4: i32 = int_value 10 [template]
  1154. // CHECK:STDOUT: %.5: type = struct_type {.second: i32, .first: i32} [template]
  1155. // CHECK:STDOUT: }
  1156. // CHECK:STDOUT:
  1157. // CHECK:STDOUT: imports {
  1158. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  1159. // CHECK:STDOUT: .Int32 = %import_ref
  1160. // CHECK:STDOUT: import Core//prelude
  1161. // CHECK:STDOUT: import Core//prelude/...
  1162. // CHECK:STDOUT: }
  1163. // CHECK:STDOUT: }
  1164. // CHECK:STDOUT:
  1165. // CHECK:STDOUT: file {
  1166. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1167. // CHECK:STDOUT: .Core = imports.%Core
  1168. // CHECK:STDOUT: .WrongOrderStructParam = %WrongOrderStructParam.decl
  1169. // CHECK:STDOUT: .CallWrongOrderStructParam = %CallWrongOrderStructParam.decl
  1170. // CHECK:STDOUT: }
  1171. // CHECK:STDOUT: %Core.import = import Core
  1172. // CHECK:STDOUT: %WrongOrderStructParam.decl: %WrongOrderStructParam.type = fn_decl @WrongOrderStructParam [template = constants.%WrongOrderStructParam] {
  1173. // CHECK:STDOUT: %T.patt.loc4_26.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_26.2 (constants.%T.patt)]
  1174. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc4_26.1, runtime_param<invalid> [symbolic = %T.patt.loc4_26.2 (constants.%T.patt)]
  1175. // CHECK:STDOUT: %x.patt: @WrongOrderStructParam.%.loc4_63.2 (%.1) = binding_pattern x
  1176. // CHECK:STDOUT: %x.param_patt: @WrongOrderStructParam.%.loc4_63.2 (%.1) = value_param_pattern %x.patt, runtime_param0
  1177. // CHECK:STDOUT: } {
  1178. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc4_26.1 [symbolic = %T.loc4_26.2 (constants.%T)]
  1179. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  1180. // CHECK:STDOUT: %.loc4_60.1: type = value_of_initializer %int.make_type_32 [template = i32]
  1181. // CHECK:STDOUT: %.loc4_60.2: type = converted %int.make_type_32, %.loc4_60.1 [template = i32]
  1182. // CHECK:STDOUT: %.loc4_63.1: type = struct_type {.first: %T, .second: i32} [symbolic = %.loc4_63.2 (constants.%.1)]
  1183. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  1184. // CHECK:STDOUT: %T.loc4_26.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc4_26.2 (constants.%T)]
  1185. // CHECK:STDOUT: %x.param: @WrongOrderStructParam.%.loc4_63.2 (%.1) = value_param runtime_param0
  1186. // CHECK:STDOUT: %x: @WrongOrderStructParam.%.loc4_63.2 (%.1) = bind_name x, %x.param
  1187. // CHECK:STDOUT: }
  1188. // CHECK:STDOUT: %CallWrongOrderStructParam.decl: %CallWrongOrderStructParam.type = fn_decl @CallWrongOrderStructParam [template = constants.%CallWrongOrderStructParam] {} {}
  1189. // CHECK:STDOUT: }
  1190. // CHECK:STDOUT:
  1191. // CHECK:STDOUT: generic fn @WrongOrderStructParam(%T.loc4_26.1: type) {
  1192. // CHECK:STDOUT: %T.loc4_26.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_26.2 (constants.%T)]
  1193. // CHECK:STDOUT: %T.patt.loc4_26.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_26.2 (constants.%T.patt)]
  1194. // CHECK:STDOUT: %.loc4_63.2: type = struct_type {.first: @WrongOrderStructParam.%T.loc4_26.2 (%T), .second: i32} [symbolic = %.loc4_63.2 (constants.%.1)]
  1195. // CHECK:STDOUT:
  1196. // CHECK:STDOUT: !definition:
  1197. // CHECK:STDOUT:
  1198. // CHECK:STDOUT: fn[%T.param_patt: type](%x.param_patt: @WrongOrderStructParam.%.loc4_63.2 (%.1)) {
  1199. // CHECK:STDOUT: !entry:
  1200. // CHECK:STDOUT: return
  1201. // CHECK:STDOUT: }
  1202. // CHECK:STDOUT: }
  1203. // CHECK:STDOUT:
  1204. // CHECK:STDOUT: fn @CallWrongOrderStructParam() {
  1205. // CHECK:STDOUT: !entry:
  1206. // CHECK:STDOUT: %WrongOrderStructParam.ref: %WrongOrderStructParam.type = name_ref WrongOrderStructParam, file.%WrongOrderStructParam.decl [template = constants.%WrongOrderStructParam]
  1207. // CHECK:STDOUT: %.loc14_36: i32 = int_value 11 [template = constants.%.3]
  1208. // CHECK:STDOUT: %.loc14_49: i32 = int_value 10 [template = constants.%.4]
  1209. // CHECK:STDOUT: %.loc14_51: %.5 = struct_literal (%.loc14_36, %.loc14_49)
  1210. // CHECK:STDOUT: return
  1211. // CHECK:STDOUT: }
  1212. // CHECK:STDOUT:
  1213. // CHECK:STDOUT: specific @WrongOrderStructParam(constants.%T) {
  1214. // CHECK:STDOUT: %T.loc4_26.2 => constants.%T
  1215. // CHECK:STDOUT: %T.patt.loc4_26.2 => constants.%T
  1216. // CHECK:STDOUT: %.loc4_63.2 => constants.%.1
  1217. // CHECK:STDOUT: }
  1218. // CHECK:STDOUT:
  1219. // CHECK:STDOUT: --- fail_deduce_incomplete.carbon
  1220. // CHECK:STDOUT:
  1221. // CHECK:STDOUT: constants {
  1222. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  1223. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  1224. // CHECK:STDOUT: %U: type = bind_symbolic_name U, 1 [symbolic]
  1225. // CHECK:STDOUT: %U.patt: type = symbolic_binding_pattern U, 1 [symbolic]
  1226. // CHECK:STDOUT: %ImplicitNotDeducible.type: type = fn_type @ImplicitNotDeducible [template]
  1227. // CHECK:STDOUT: %ImplicitNotDeducible: %ImplicitNotDeducible.type = struct_value () [template]
  1228. // CHECK:STDOUT: %CallImplicitNotDeducible.type: type = fn_type @CallImplicitNotDeducible [template]
  1229. // CHECK:STDOUT: %CallImplicitNotDeducible: %CallImplicitNotDeducible.type = struct_value () [template]
  1230. // CHECK:STDOUT: %.1: i32 = int_value 42 [template]
  1231. // CHECK:STDOUT: }
  1232. // CHECK:STDOUT:
  1233. // CHECK:STDOUT: imports {
  1234. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  1235. // CHECK:STDOUT: import Core//prelude
  1236. // CHECK:STDOUT: import Core//prelude/...
  1237. // CHECK:STDOUT: }
  1238. // CHECK:STDOUT: }
  1239. // CHECK:STDOUT:
  1240. // CHECK:STDOUT: file {
  1241. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1242. // CHECK:STDOUT: .Core = imports.%Core
  1243. // CHECK:STDOUT: .ImplicitNotDeducible = %ImplicitNotDeducible.decl
  1244. // CHECK:STDOUT: .CallImplicitNotDeducible = %CallImplicitNotDeducible.decl
  1245. // CHECK:STDOUT: }
  1246. // CHECK:STDOUT: %Core.import = import Core
  1247. // CHECK:STDOUT: %ImplicitNotDeducible.decl: %ImplicitNotDeducible.type = fn_decl @ImplicitNotDeducible [template = constants.%ImplicitNotDeducible] {
  1248. // CHECK:STDOUT: %T.patt.loc6_25.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_25.2 (constants.%T.patt)]
  1249. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc6_25.1, runtime_param<invalid> [symbolic = %T.patt.loc6_25.2 (constants.%T.patt)]
  1250. // CHECK:STDOUT: %U.patt.loc6_35.1: type = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc6_35.2 (constants.%U.patt)]
  1251. // CHECK:STDOUT: %U.param_patt: type = value_param_pattern %U.patt.loc6_35.1, runtime_param<invalid> [symbolic = %U.patt.loc6_35.2 (constants.%U.patt)]
  1252. // CHECK:STDOUT: %x.patt: @ImplicitNotDeducible.%T.loc6_25.2 (%T) = binding_pattern x
  1253. // CHECK:STDOUT: %x.param_patt: @ImplicitNotDeducible.%T.loc6_25.2 (%T) = value_param_pattern %x.patt, runtime_param0
  1254. // CHECK:STDOUT: %return.patt: @ImplicitNotDeducible.%U.loc6_35.2 (%U) = return_slot_pattern
  1255. // CHECK:STDOUT: %return.param_patt: @ImplicitNotDeducible.%U.loc6_35.2 (%U) = out_param_pattern %return.patt, runtime_param1
  1256. // CHECK:STDOUT: } {
  1257. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc6_25.1 [symbolic = %T.loc6_25.2 (constants.%T)]
  1258. // CHECK:STDOUT: %U.ref: type = name_ref U, %U.loc6_35.1 [symbolic = %U.loc6_35.2 (constants.%U)]
  1259. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  1260. // CHECK:STDOUT: %T.loc6_25.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc6_25.2 (constants.%T)]
  1261. // CHECK:STDOUT: %U.param: type = value_param runtime_param<invalid>
  1262. // CHECK:STDOUT: %U.loc6_35.1: type = bind_symbolic_name U, 1, %U.param [symbolic = %U.loc6_35.2 (constants.%U)]
  1263. // CHECK:STDOUT: %x.param: @ImplicitNotDeducible.%T.loc6_25.2 (%T) = value_param runtime_param0
  1264. // CHECK:STDOUT: %x: @ImplicitNotDeducible.%T.loc6_25.2 (%T) = bind_name x, %x.param
  1265. // CHECK:STDOUT: %return.param: ref @ImplicitNotDeducible.%U.loc6_35.2 (%U) = out_param runtime_param1
  1266. // CHECK:STDOUT: %return: ref @ImplicitNotDeducible.%U.loc6_35.2 (%U) = return_slot %return.param
  1267. // CHECK:STDOUT: }
  1268. // CHECK:STDOUT: %CallImplicitNotDeducible.decl: %CallImplicitNotDeducible.type = fn_decl @CallImplicitNotDeducible [template = constants.%CallImplicitNotDeducible] {} {}
  1269. // CHECK:STDOUT: }
  1270. // CHECK:STDOUT:
  1271. // CHECK:STDOUT: generic fn @ImplicitNotDeducible(%T.loc6_25.1: type, %U.loc6_35.1: type) {
  1272. // CHECK:STDOUT: %T.loc6_25.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc6_25.2 (constants.%T)]
  1273. // CHECK:STDOUT: %T.patt.loc6_25.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_25.2 (constants.%T.patt)]
  1274. // CHECK:STDOUT: %U.loc6_35.2: type = bind_symbolic_name U, 1 [symbolic = %U.loc6_35.2 (constants.%U)]
  1275. // CHECK:STDOUT: %U.patt.loc6_35.2: type = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc6_35.2 (constants.%U.patt)]
  1276. // CHECK:STDOUT:
  1277. // CHECK:STDOUT: fn[%T.param_patt: type, %U.param_patt: type](%x.param_patt: @ImplicitNotDeducible.%T.loc6_25.2 (%T)) -> @ImplicitNotDeducible.%U.loc6_35.2 (%U);
  1278. // CHECK:STDOUT: }
  1279. // CHECK:STDOUT:
  1280. // CHECK:STDOUT: fn @CallImplicitNotDeducible() {
  1281. // CHECK:STDOUT: !entry:
  1282. // CHECK:STDOUT: %ImplicitNotDeducible.ref: %ImplicitNotDeducible.type = name_ref ImplicitNotDeducible, file.%ImplicitNotDeducible.decl [template = constants.%ImplicitNotDeducible]
  1283. // CHECK:STDOUT: %.loc16: i32 = int_value 42 [template = constants.%.1]
  1284. // CHECK:STDOUT: return
  1285. // CHECK:STDOUT: }
  1286. // CHECK:STDOUT:
  1287. // CHECK:STDOUT: specific @ImplicitNotDeducible(constants.%T, constants.%U) {
  1288. // CHECK:STDOUT: %T.loc6_25.2 => constants.%T
  1289. // CHECK:STDOUT: %T.patt.loc6_25.2 => constants.%T
  1290. // CHECK:STDOUT: %U.loc6_35.2 => constants.%U
  1291. // CHECK:STDOUT: %U.patt.loc6_35.2 => constants.%U
  1292. // CHECK:STDOUT: }
  1293. // CHECK:STDOUT:
  1294. // CHECK:STDOUT: --- fail_deduce_inconsistent.carbon
  1295. // CHECK:STDOUT:
  1296. // CHECK:STDOUT: constants {
  1297. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  1298. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  1299. // CHECK:STDOUT: %ImplicitNotDeducible.type: type = fn_type @ImplicitNotDeducible [template]
  1300. // CHECK:STDOUT: %ImplicitNotDeducible: %ImplicitNotDeducible.type = struct_value () [template]
  1301. // CHECK:STDOUT: %CallImplicitNotDeducible.type: type = fn_type @CallImplicitNotDeducible [template]
  1302. // CHECK:STDOUT: %CallImplicitNotDeducible: %CallImplicitNotDeducible.type = struct_value () [template]
  1303. // CHECK:STDOUT: %.1: i32 = int_value 42 [template]
  1304. // CHECK:STDOUT: %.2: i32 = int_value 12 [template]
  1305. // CHECK:STDOUT: %.3: type = struct_type {.x: i32} [template]
  1306. // CHECK:STDOUT: }
  1307. // CHECK:STDOUT:
  1308. // CHECK:STDOUT: imports {
  1309. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  1310. // CHECK:STDOUT: import Core//prelude
  1311. // CHECK:STDOUT: import Core//prelude/...
  1312. // CHECK:STDOUT: }
  1313. // CHECK:STDOUT: }
  1314. // CHECK:STDOUT:
  1315. // CHECK:STDOUT: file {
  1316. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1317. // CHECK:STDOUT: .Core = imports.%Core
  1318. // CHECK:STDOUT: .ImplicitNotDeducible = %ImplicitNotDeducible.decl
  1319. // CHECK:STDOUT: .CallImplicitNotDeducible = %CallImplicitNotDeducible.decl
  1320. // CHECK:STDOUT: }
  1321. // CHECK:STDOUT: %Core.import = import Core
  1322. // CHECK:STDOUT: %ImplicitNotDeducible.decl: %ImplicitNotDeducible.type = fn_decl @ImplicitNotDeducible [template = constants.%ImplicitNotDeducible] {
  1323. // CHECK:STDOUT: %T.patt.loc4_25.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_25.2 (constants.%T.patt)]
  1324. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc4_25.1, runtime_param<invalid> [symbolic = %T.patt.loc4_25.2 (constants.%T.patt)]
  1325. // CHECK:STDOUT: %x.patt: @ImplicitNotDeducible.%T.loc4_25.2 (%T) = binding_pattern x
  1326. // CHECK:STDOUT: %x.param_patt: @ImplicitNotDeducible.%T.loc4_25.2 (%T) = value_param_pattern %x.patt, runtime_param0
  1327. // CHECK:STDOUT: %y.patt: @ImplicitNotDeducible.%T.loc4_25.2 (%T) = binding_pattern y
  1328. // CHECK:STDOUT: %y.param_patt: @ImplicitNotDeducible.%T.loc4_25.2 (%T) = value_param_pattern %y.patt, runtime_param1
  1329. // CHECK:STDOUT: %return.patt: @ImplicitNotDeducible.%T.loc4_25.2 (%T) = return_slot_pattern
  1330. // CHECK:STDOUT: %return.param_patt: @ImplicitNotDeducible.%T.loc4_25.2 (%T) = out_param_pattern %return.patt, runtime_param2
  1331. // CHECK:STDOUT: } {
  1332. // CHECK:STDOUT: %T.ref.loc4_38: type = name_ref T, %T.loc4_25.1 [symbolic = %T.loc4_25.2 (constants.%T)]
  1333. // CHECK:STDOUT: %T.ref.loc4_44: type = name_ref T, %T.loc4_25.1 [symbolic = %T.loc4_25.2 (constants.%T)]
  1334. // CHECK:STDOUT: %T.ref.loc4_50: type = name_ref T, %T.loc4_25.1 [symbolic = %T.loc4_25.2 (constants.%T)]
  1335. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  1336. // CHECK:STDOUT: %T.loc4_25.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc4_25.2 (constants.%T)]
  1337. // CHECK:STDOUT: %x.param: @ImplicitNotDeducible.%T.loc4_25.2 (%T) = value_param runtime_param0
  1338. // CHECK:STDOUT: %x: @ImplicitNotDeducible.%T.loc4_25.2 (%T) = bind_name x, %x.param
  1339. // CHECK:STDOUT: %y.param: @ImplicitNotDeducible.%T.loc4_25.2 (%T) = value_param runtime_param1
  1340. // CHECK:STDOUT: %y: @ImplicitNotDeducible.%T.loc4_25.2 (%T) = bind_name y, %y.param
  1341. // CHECK:STDOUT: %return.param: ref @ImplicitNotDeducible.%T.loc4_25.2 (%T) = out_param runtime_param2
  1342. // CHECK:STDOUT: %return: ref @ImplicitNotDeducible.%T.loc4_25.2 (%T) = return_slot %return.param
  1343. // CHECK:STDOUT: }
  1344. // CHECK:STDOUT: %CallImplicitNotDeducible.decl: %CallImplicitNotDeducible.type = fn_decl @CallImplicitNotDeducible [template = constants.%CallImplicitNotDeducible] {} {}
  1345. // CHECK:STDOUT: }
  1346. // CHECK:STDOUT:
  1347. // CHECK:STDOUT: generic fn @ImplicitNotDeducible(%T.loc4_25.1: type) {
  1348. // CHECK:STDOUT: %T.loc4_25.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_25.2 (constants.%T)]
  1349. // CHECK:STDOUT: %T.patt.loc4_25.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_25.2 (constants.%T.patt)]
  1350. // CHECK:STDOUT:
  1351. // CHECK:STDOUT: fn[%T.param_patt: type](%x.param_patt: @ImplicitNotDeducible.%T.loc4_25.2 (%T), %y.param_patt: @ImplicitNotDeducible.%T.loc4_25.2 (%T)) -> @ImplicitNotDeducible.%T.loc4_25.2 (%T);
  1352. // CHECK:STDOUT: }
  1353. // CHECK:STDOUT:
  1354. // CHECK:STDOUT: fn @CallImplicitNotDeducible() {
  1355. // CHECK:STDOUT: !entry:
  1356. // CHECK:STDOUT: %ImplicitNotDeducible.ref: %ImplicitNotDeducible.type = name_ref ImplicitNotDeducible, file.%ImplicitNotDeducible.decl [template = constants.%ImplicitNotDeducible]
  1357. // CHECK:STDOUT: %.loc13_24: i32 = int_value 42 [template = constants.%.1]
  1358. // CHECK:STDOUT: %.loc13_34: i32 = int_value 12 [template = constants.%.2]
  1359. // CHECK:STDOUT: %.loc13_36: %.3 = struct_literal (%.loc13_34)
  1360. // CHECK:STDOUT: return
  1361. // CHECK:STDOUT: }
  1362. // CHECK:STDOUT:
  1363. // CHECK:STDOUT: specific @ImplicitNotDeducible(constants.%T) {
  1364. // CHECK:STDOUT: %T.loc4_25.2 => constants.%T
  1365. // CHECK:STDOUT: %T.patt.loc4_25.2 => constants.%T
  1366. // CHECK:STDOUT: }
  1367. // CHECK:STDOUT: