deduce.carbon 93 KB

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