deduce.carbon 93 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477
  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_34.1: type = value_of_initializer %int.make_type_signed.loc7 [template = constants.%i32]
  248. // CHECK:STDOUT: %.loc7_34.2: type = converted %int.make_type_signed.loc7, %.loc7_34.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_25: type = ptr_type @CallExplicitGenericParamConst.%T.loc6_34.2 (%T) [symbolic = %.loc7_25 (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_25 (%.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: complete_type_witness = %.loc4
  524. // CHECK:STDOUT: }
  525. // CHECK:STDOUT:
  526. // CHECK:STDOUT: generic fn @ExplicitAndAlsoDeduced(%T.loc6_27.1: type) {
  527. // CHECK:STDOUT: %T.loc6_27.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc6_27.2 (constants.%T)]
  528. // CHECK:STDOUT: %T.patt.loc6_27.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_27.2 (constants.%T.patt)]
  529. // CHECK:STDOUT: %.loc6_47.2: type = ptr_type @ExplicitAndAlsoDeduced.%T.loc6_27.2 (%T) [symbolic = %.loc6_47.2 (constants.%.3)]
  530. // CHECK:STDOUT:
  531. // CHECK:STDOUT: !definition:
  532. // CHECK:STDOUT: %.loc7_10.2: <specific function> = specific_function constants.%ExplicitAndAlsoDeduced, @ExplicitAndAlsoDeduced(%T.loc6_27.2) [symbolic = %.loc7_10.2 (constants.%.4)]
  533. // CHECK:STDOUT:
  534. // CHECK:STDOUT: fn(%T.param_patt: type, %x.param_patt: @ExplicitAndAlsoDeduced.%T.loc6_27.2 (%T)) -> @ExplicitAndAlsoDeduced.%.loc6_47.2 (%.3) {
  535. // CHECK:STDOUT: !entry:
  536. // CHECK:STDOUT: %ExplicitAndAlsoDeduced.ref: %ExplicitAndAlsoDeduced.type = name_ref ExplicitAndAlsoDeduced, file.%ExplicitAndAlsoDeduced.decl [template = constants.%ExplicitAndAlsoDeduced]
  537. // CHECK:STDOUT: %T.ref.loc7: type = name_ref T, %T.loc6_27.1 [symbolic = %T.loc6_27.2 (constants.%T)]
  538. // CHECK:STDOUT: %x.ref: @ExplicitAndAlsoDeduced.%T.loc6_27.2 (%T) = name_ref x, %x
  539. // CHECK:STDOUT: %.loc7_10.1: <specific function> = specific_function %ExplicitAndAlsoDeduced.ref, @ExplicitAndAlsoDeduced(constants.%T) [symbolic = %.loc7_10.2 (constants.%.4)]
  540. // CHECK:STDOUT: %ExplicitAndAlsoDeduced.call: init @ExplicitAndAlsoDeduced.%.loc6_47.2 (%.3) = call %.loc7_10.1(%x.ref)
  541. // CHECK:STDOUT: %.loc7_38.1: @ExplicitAndAlsoDeduced.%.loc6_47.2 (%.3) = value_of_initializer %ExplicitAndAlsoDeduced.call
  542. // CHECK:STDOUT: %.loc7_38.2: @ExplicitAndAlsoDeduced.%.loc6_47.2 (%.3) = converted %ExplicitAndAlsoDeduced.call, %.loc7_38.1
  543. // CHECK:STDOUT: return %.loc7_38.2
  544. // CHECK:STDOUT: }
  545. // CHECK:STDOUT: }
  546. // CHECK:STDOUT:
  547. // CHECK:STDOUT: fn @CallExplicitAndAlsoDeduced() -> %.5 {
  548. // CHECK:STDOUT: !entry:
  549. // CHECK:STDOUT: %ExplicitAndAlsoDeduced.ref: %ExplicitAndAlsoDeduced.type = name_ref ExplicitAndAlsoDeduced, file.%ExplicitAndAlsoDeduced.decl [template = constants.%ExplicitAndAlsoDeduced]
  550. // CHECK:STDOUT: %A.ref.loc11: type = name_ref A, file.%A.decl [template = constants.%A]
  551. // CHECK:STDOUT: %.loc11_37.1: %.1 = struct_literal ()
  552. // CHECK:STDOUT: %.loc11_10: <specific function> = specific_function %ExplicitAndAlsoDeduced.ref, @ExplicitAndAlsoDeduced(constants.%A) [template = constants.%.6]
  553. // CHECK:STDOUT: %.loc11_37.2: ref %A = temporary_storage
  554. // CHECK:STDOUT: %.loc11_37.3: init %A = class_init (), %.loc11_37.2 [template = constants.%struct]
  555. // CHECK:STDOUT: %.loc11_37.4: ref %A = temporary %.loc11_37.2, %.loc11_37.3
  556. // CHECK:STDOUT: %.loc11_37.5: ref %A = converted %.loc11_37.1, %.loc11_37.4
  557. // CHECK:STDOUT: %.loc11_37.6: %A = bind_value %.loc11_37.5
  558. // CHECK:STDOUT: %ExplicitAndAlsoDeduced.call: init %.5 = call %.loc11_10(%.loc11_37.6)
  559. // CHECK:STDOUT: %.loc11_39.1: %.5 = value_of_initializer %ExplicitAndAlsoDeduced.call
  560. // CHECK:STDOUT: %.loc11_39.2: %.5 = converted %ExplicitAndAlsoDeduced.call, %.loc11_39.1
  561. // CHECK:STDOUT: return %.loc11_39.2
  562. // CHECK:STDOUT: }
  563. // CHECK:STDOUT:
  564. // CHECK:STDOUT: specific @ExplicitAndAlsoDeduced(constants.%T) {
  565. // CHECK:STDOUT: %T.loc6_27.2 => constants.%T
  566. // CHECK:STDOUT: %T.patt.loc6_27.2 => constants.%T
  567. // CHECK:STDOUT: %.loc6_47.2 => constants.%.3
  568. // CHECK:STDOUT:
  569. // CHECK:STDOUT: !definition:
  570. // CHECK:STDOUT: %.loc7_10.2 => constants.%.4
  571. // CHECK:STDOUT: }
  572. // CHECK:STDOUT:
  573. // CHECK:STDOUT: specific @ExplicitAndAlsoDeduced(%T.loc6_27.2) {
  574. // CHECK:STDOUT: %T.loc6_27.2 => constants.%T
  575. // CHECK:STDOUT: %T.patt.loc6_27.2 => constants.%T
  576. // CHECK:STDOUT: %.loc6_47.2 => constants.%.3
  577. // CHECK:STDOUT: }
  578. // CHECK:STDOUT:
  579. // CHECK:STDOUT: specific @ExplicitAndAlsoDeduced(constants.%A) {
  580. // CHECK:STDOUT: %T.loc6_27.2 => constants.%A
  581. // CHECK:STDOUT: %T.patt.loc6_27.2 => constants.%A
  582. // CHECK:STDOUT: %.loc6_47.2 => constants.%.5
  583. // CHECK:STDOUT:
  584. // CHECK:STDOUT: !definition:
  585. // CHECK:STDOUT: %.loc7_10.2 => constants.%.6
  586. // CHECK:STDOUT: }
  587. // CHECK:STDOUT:
  588. // CHECK:STDOUT: --- deduce_implicit.carbon
  589. // CHECK:STDOUT:
  590. // CHECK:STDOUT: constants {
  591. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  592. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  593. // CHECK:STDOUT: %.1: type = ptr_type %T [symbolic]
  594. // CHECK:STDOUT: %ImplicitGenericParam.type: type = fn_type @ImplicitGenericParam [template]
  595. // CHECK:STDOUT: %ImplicitGenericParam: %ImplicitGenericParam.type = struct_value () [template]
  596. // CHECK:STDOUT: %.2: <specific function> = specific_function %ImplicitGenericParam, @ImplicitGenericParam(%T) [symbolic]
  597. // CHECK:STDOUT: %.3: Core.IntLiteral = int_value 32 [template]
  598. // CHECK:STDOUT: %Int.type: type = fn_type @Int [template]
  599. // CHECK:STDOUT: %Int: %Int.type = struct_value () [template]
  600. // CHECK:STDOUT: %i32: type = int_type signed, %.3 [template]
  601. // CHECK:STDOUT: %.4: type = ptr_type %i32 [template]
  602. // CHECK:STDOUT: %CallImplicitGenericParam.type: type = fn_type @CallImplicitGenericParam [template]
  603. // CHECK:STDOUT: %CallImplicitGenericParam: %CallImplicitGenericParam.type = struct_value () [template]
  604. // CHECK:STDOUT: %.5: <specific function> = specific_function %ImplicitGenericParam, @ImplicitGenericParam(%i32) [template]
  605. // CHECK:STDOUT: }
  606. // CHECK:STDOUT:
  607. // CHECK:STDOUT: imports {
  608. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  609. // CHECK:STDOUT: .Int = %import_ref
  610. // CHECK:STDOUT: import Core//prelude
  611. // CHECK:STDOUT: import Core//prelude/...
  612. // CHECK:STDOUT: }
  613. // CHECK:STDOUT: }
  614. // CHECK:STDOUT:
  615. // CHECK:STDOUT: file {
  616. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  617. // CHECK:STDOUT: .Core = imports.%Core
  618. // CHECK:STDOUT: .ImplicitGenericParam = %ImplicitGenericParam.decl
  619. // CHECK:STDOUT: .CallImplicitGenericParam = %CallImplicitGenericParam.decl
  620. // CHECK:STDOUT: }
  621. // CHECK:STDOUT: %Core.import = import Core
  622. // CHECK:STDOUT: %ImplicitGenericParam.decl: %ImplicitGenericParam.type = fn_decl @ImplicitGenericParam [template = constants.%ImplicitGenericParam] {
  623. // CHECK:STDOUT: %T.patt.loc4_25.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_25.2 (constants.%T.patt)]
  624. // 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)]
  625. // CHECK:STDOUT: %x.patt: @ImplicitGenericParam.%T.loc4_25.2 (%T) = binding_pattern x
  626. // CHECK:STDOUT: %x.param_patt: @ImplicitGenericParam.%T.loc4_25.2 (%T) = value_param_pattern %x.patt, runtime_param0
  627. // CHECK:STDOUT: %return.patt: @ImplicitGenericParam.%.loc4_45.2 (%.1) = return_slot_pattern
  628. // CHECK:STDOUT: %return.param_patt: @ImplicitGenericParam.%.loc4_45.2 (%.1) = out_param_pattern %return.patt, runtime_param1
  629. // CHECK:STDOUT: } {
  630. // CHECK:STDOUT: %T.ref.loc4_38: type = name_ref T, %T.loc4_25.1 [symbolic = %T.loc4_25.2 (constants.%T)]
  631. // CHECK:STDOUT: %T.ref.loc4_44: type = name_ref T, %T.loc4_25.1 [symbolic = %T.loc4_25.2 (constants.%T)]
  632. // CHECK:STDOUT: %.loc4_45.1: type = ptr_type %T [symbolic = %.loc4_45.2 (constants.%.1)]
  633. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  634. // CHECK:STDOUT: %T.loc4_25.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc4_25.2 (constants.%T)]
  635. // CHECK:STDOUT: %x.param: @ImplicitGenericParam.%T.loc4_25.2 (%T) = value_param runtime_param0
  636. // CHECK:STDOUT: %x: @ImplicitGenericParam.%T.loc4_25.2 (%T) = bind_name x, %x.param
  637. // CHECK:STDOUT: %return.param: ref @ImplicitGenericParam.%.loc4_45.2 (%.1) = out_param runtime_param1
  638. // CHECK:STDOUT: %return: ref @ImplicitGenericParam.%.loc4_45.2 (%.1) = return_slot %return.param
  639. // CHECK:STDOUT: }
  640. // CHECK:STDOUT: %CallImplicitGenericParam.decl: %CallImplicitGenericParam.type = fn_decl @CallImplicitGenericParam [template = constants.%CallImplicitGenericParam] {
  641. // CHECK:STDOUT: %n.patt: %i32 = binding_pattern n
  642. // CHECK:STDOUT: %n.param_patt: %i32 = value_param_pattern %n.patt, runtime_param0
  643. // CHECK:STDOUT: %return.patt: %.4 = return_slot_pattern
  644. // CHECK:STDOUT: %return.param_patt: %.4 = out_param_pattern %return.patt, runtime_param1
  645. // CHECK:STDOUT: } {
  646. // CHECK:STDOUT: %.loc6_32.1: Core.IntLiteral = int_value 32 [template = constants.%.3]
  647. // CHECK:STDOUT: %int.make_type_signed.loc6_32: init type = call constants.%Int(%.loc6_32.1) [template = constants.%i32]
  648. // CHECK:STDOUT: %.loc6_32.2: type = value_of_initializer %int.make_type_signed.loc6_32 [template = constants.%i32]
  649. // CHECK:STDOUT: %.loc6_32.3: type = converted %int.make_type_signed.loc6_32, %.loc6_32.2 [template = constants.%i32]
  650. // CHECK:STDOUT: %.loc6_40: Core.IntLiteral = int_value 32 [template = constants.%.3]
  651. // CHECK:STDOUT: %int.make_type_signed.loc6_40: init type = call constants.%Int(%.loc6_40) [template = constants.%i32]
  652. // CHECK:STDOUT: %.loc6_43.1: type = value_of_initializer %int.make_type_signed.loc6_40 [template = constants.%i32]
  653. // CHECK:STDOUT: %.loc6_43.2: type = converted %int.make_type_signed.loc6_40, %.loc6_43.1 [template = constants.%i32]
  654. // CHECK:STDOUT: %.loc6_43.3: type = ptr_type %i32 [template = constants.%.4]
  655. // CHECK:STDOUT: %n.param: %i32 = value_param runtime_param0
  656. // CHECK:STDOUT: %n: %i32 = bind_name n, %n.param
  657. // CHECK:STDOUT: %return.param: ref %.4 = out_param runtime_param1
  658. // CHECK:STDOUT: %return: ref %.4 = return_slot %return.param
  659. // CHECK:STDOUT: }
  660. // CHECK:STDOUT: }
  661. // CHECK:STDOUT:
  662. // CHECK:STDOUT: generic fn @ImplicitGenericParam(%T.loc4_25.1: type) {
  663. // CHECK:STDOUT: %T.loc4_25.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_25.2 (constants.%T)]
  664. // CHECK:STDOUT: %T.patt.loc4_25.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_25.2 (constants.%T.patt)]
  665. // CHECK:STDOUT: %.loc4_45.2: type = ptr_type @ImplicitGenericParam.%T.loc4_25.2 (%T) [symbolic = %.loc4_45.2 (constants.%.1)]
  666. // CHECK:STDOUT:
  667. // CHECK:STDOUT: !definition:
  668. // CHECK:STDOUT: %.loc4_56.2: <specific function> = specific_function constants.%ImplicitGenericParam, @ImplicitGenericParam(%T.loc4_25.2) [symbolic = %.loc4_56.2 (constants.%.2)]
  669. // CHECK:STDOUT:
  670. // CHECK:STDOUT: fn[%T.param_patt: type](%x.param_patt: @ImplicitGenericParam.%T.loc4_25.2 (%T)) -> @ImplicitGenericParam.%.loc4_45.2 (%.1) {
  671. // CHECK:STDOUT: !entry:
  672. // CHECK:STDOUT: %ImplicitGenericParam.ref: %ImplicitGenericParam.type = name_ref ImplicitGenericParam, file.%ImplicitGenericParam.decl [template = constants.%ImplicitGenericParam]
  673. // CHECK:STDOUT: %x.ref: @ImplicitGenericParam.%T.loc4_25.2 (%T) = name_ref x, %x
  674. // CHECK:STDOUT: %.loc4_56.1: <specific function> = specific_function %ImplicitGenericParam.ref, @ImplicitGenericParam(constants.%T) [symbolic = %.loc4_56.2 (constants.%.2)]
  675. // CHECK:STDOUT: %ImplicitGenericParam.call: init @ImplicitGenericParam.%.loc4_45.2 (%.1) = call %.loc4_56.1(%x.ref)
  676. // CHECK:STDOUT: %.loc4_79.1: @ImplicitGenericParam.%.loc4_45.2 (%.1) = value_of_initializer %ImplicitGenericParam.call
  677. // CHECK:STDOUT: %.loc4_79.2: @ImplicitGenericParam.%.loc4_45.2 (%.1) = converted %ImplicitGenericParam.call, %.loc4_79.1
  678. // CHECK:STDOUT: return %.loc4_79.2
  679. // CHECK:STDOUT: }
  680. // CHECK:STDOUT: }
  681. // CHECK:STDOUT:
  682. // CHECK:STDOUT: fn @CallImplicitGenericParam(%n.param_patt: %i32) -> %.4 {
  683. // CHECK:STDOUT: !entry:
  684. // CHECK:STDOUT: %ImplicitGenericParam.ref: %ImplicitGenericParam.type = name_ref ImplicitGenericParam, file.%ImplicitGenericParam.decl [template = constants.%ImplicitGenericParam]
  685. // CHECK:STDOUT: %n.ref: %i32 = name_ref n, %n
  686. // CHECK:STDOUT: %.loc7_10: <specific function> = specific_function %ImplicitGenericParam.ref, @ImplicitGenericParam(constants.%i32) [template = constants.%.5]
  687. // CHECK:STDOUT: %ImplicitGenericParam.call: init %.4 = call %.loc7_10(%n.ref)
  688. // CHECK:STDOUT: %.loc7_33.1: %.4 = value_of_initializer %ImplicitGenericParam.call
  689. // CHECK:STDOUT: %.loc7_33.2: %.4 = converted %ImplicitGenericParam.call, %.loc7_33.1
  690. // CHECK:STDOUT: return %.loc7_33.2
  691. // CHECK:STDOUT: }
  692. // CHECK:STDOUT:
  693. // CHECK:STDOUT: specific @ImplicitGenericParam(constants.%T) {
  694. // CHECK:STDOUT: %T.loc4_25.2 => constants.%T
  695. // CHECK:STDOUT: %T.patt.loc4_25.2 => constants.%T
  696. // CHECK:STDOUT: %.loc4_45.2 => constants.%.1
  697. // CHECK:STDOUT:
  698. // CHECK:STDOUT: !definition:
  699. // CHECK:STDOUT: %.loc4_56.2 => constants.%.2
  700. // CHECK:STDOUT: }
  701. // CHECK:STDOUT:
  702. // CHECK:STDOUT: specific @ImplicitGenericParam(%T.loc4_25.2) {
  703. // CHECK:STDOUT: %T.loc4_25.2 => constants.%T
  704. // CHECK:STDOUT: %T.patt.loc4_25.2 => constants.%T
  705. // CHECK:STDOUT: %.loc4_45.2 => constants.%.1
  706. // CHECK:STDOUT: }
  707. // CHECK:STDOUT:
  708. // CHECK:STDOUT: specific @ImplicitGenericParam(constants.%i32) {
  709. // CHECK:STDOUT: %T.loc4_25.2 => constants.%i32
  710. // CHECK:STDOUT: %T.patt.loc4_25.2 => constants.%i32
  711. // CHECK:STDOUT: %.loc4_45.2 => constants.%.4
  712. // CHECK:STDOUT:
  713. // CHECK:STDOUT: !definition:
  714. // CHECK:STDOUT: %.loc4_56.2 => constants.%.5
  715. // CHECK:STDOUT: }
  716. // CHECK:STDOUT:
  717. // CHECK:STDOUT: --- deduce_nested_tuple.carbon
  718. // CHECK:STDOUT:
  719. // CHECK:STDOUT: constants {
  720. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  721. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  722. // CHECK:STDOUT: %.1: Core.IntLiteral = int_value 32 [template]
  723. // CHECK:STDOUT: %Int.type: type = fn_type @Int [template]
  724. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  725. // CHECK:STDOUT: %Int: %Int.type = struct_value () [template]
  726. // CHECK:STDOUT: %i32: type = int_type signed, %.1 [template]
  727. // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type, type) [template]
  728. // CHECK:STDOUT: %tuple.type.2: type = tuple_type (%T, %i32) [symbolic]
  729. // CHECK:STDOUT: %TupleParam.type: type = fn_type @TupleParam [template]
  730. // CHECK:STDOUT: %TupleParam: %TupleParam.type = struct_value () [template]
  731. // CHECK:STDOUT: %CallTupleParam.type: type = fn_type @CallTupleParam [template]
  732. // CHECK:STDOUT: %CallTupleParam: %CallTupleParam.type = struct_value () [template]
  733. // CHECK:STDOUT: %.3: Core.IntLiteral = int_value 1 [template]
  734. // CHECK:STDOUT: %.4: Core.IntLiteral = int_value 2 [template]
  735. // CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral, Core.IntLiteral) [template]
  736. // CHECK:STDOUT: %tuple.type.4: type = tuple_type (Core.IntLiteral, %i32) [template]
  737. // CHECK:STDOUT: %.5: <specific function> = specific_function %TupleParam, @TupleParam(Core.IntLiteral) [template]
  738. // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template]
  739. // CHECK:STDOUT: %Convert.type.14: type = fn_type @Convert.2, @impl.1(%.1) [template]
  740. // CHECK:STDOUT: %Convert.14: %Convert.type.14 = struct_value () [template]
  741. // CHECK:STDOUT: %.30: <witness> = interface_witness (%Convert.14) [template]
  742. // CHECK:STDOUT: %.31: <bound method> = bound_method %.4, %Convert.14 [template]
  743. // CHECK:STDOUT: %.32: <specific function> = specific_function %.31, @Convert.2(%.1) [template]
  744. // CHECK:STDOUT: %.33: %i32 = int_value 2 [template]
  745. // CHECK:STDOUT: %tuple: %tuple.type.4 = tuple_value (%.3, %.33) [template]
  746. // CHECK:STDOUT: }
  747. // CHECK:STDOUT:
  748. // CHECK:STDOUT: imports {
  749. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  750. // CHECK:STDOUT: .Int = %import_ref.1
  751. // CHECK:STDOUT: .ImplicitAs = %import_ref.2
  752. // CHECK:STDOUT: import Core//prelude
  753. // CHECK:STDOUT: import Core//prelude/...
  754. // CHECK:STDOUT: }
  755. // CHECK:STDOUT: }
  756. // CHECK:STDOUT:
  757. // CHECK:STDOUT: file {
  758. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  759. // CHECK:STDOUT: .Core = imports.%Core
  760. // CHECK:STDOUT: .TupleParam = %TupleParam.decl
  761. // CHECK:STDOUT: .CallTupleParam = %CallTupleParam.decl
  762. // CHECK:STDOUT: }
  763. // CHECK:STDOUT: %Core.import = import Core
  764. // CHECK:STDOUT: %TupleParam.decl: %TupleParam.type = fn_decl @TupleParam [template = constants.%TupleParam] {
  765. // CHECK:STDOUT: %T.patt.loc4_15.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_15.2 (constants.%T.patt)]
  766. // 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)]
  767. // CHECK:STDOUT: %x.patt: @TupleParam.%tuple.type (%tuple.type.2) = binding_pattern x
  768. // CHECK:STDOUT: %x.param_patt: @TupleParam.%tuple.type (%tuple.type.2) = value_param_pattern %x.patt, runtime_param0
  769. // CHECK:STDOUT: } {
  770. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc4_15.1 [symbolic = %T.loc4_15.2 (constants.%T)]
  771. // CHECK:STDOUT: %.loc4_32: Core.IntLiteral = int_value 32 [template = constants.%.1]
  772. // CHECK:STDOUT: %int.make_type_signed: init type = call constants.%Int(%.loc4_32) [template = constants.%i32]
  773. // CHECK:STDOUT: %.loc4_35.1: %tuple.type.1 = tuple_literal (%T.ref, %int.make_type_signed)
  774. // CHECK:STDOUT: %.loc4_35.2: type = value_of_initializer %int.make_type_signed [template = constants.%i32]
  775. // CHECK:STDOUT: %.loc4_35.3: type = converted %int.make_type_signed, %.loc4_35.2 [template = constants.%i32]
  776. // CHECK:STDOUT: %.loc4_35.4: type = converted %.loc4_35.1, constants.%tuple.type.2 [symbolic = %tuple.type (constants.%tuple.type.2)]
  777. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  778. // CHECK:STDOUT: %T.loc4_15.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc4_15.2 (constants.%T)]
  779. // CHECK:STDOUT: %x.param: @TupleParam.%tuple.type (%tuple.type.2) = value_param runtime_param0
  780. // CHECK:STDOUT: %x: @TupleParam.%tuple.type (%tuple.type.2) = bind_name x, %x.param
  781. // CHECK:STDOUT: }
  782. // CHECK:STDOUT: %CallTupleParam.decl: %CallTupleParam.type = fn_decl @CallTupleParam [template = constants.%CallTupleParam] {} {}
  783. // CHECK:STDOUT: }
  784. // CHECK:STDOUT:
  785. // CHECK:STDOUT: generic fn @TupleParam(%T.loc4_15.1: type) {
  786. // CHECK:STDOUT: %T.loc4_15.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_15.2 (constants.%T)]
  787. // CHECK:STDOUT: %T.patt.loc4_15.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_15.2 (constants.%T.patt)]
  788. // CHECK:STDOUT: %tuple.type: type = tuple_type (@TupleParam.%T.loc4_15.2 (%T), %i32) [symbolic = %tuple.type (constants.%tuple.type.2)]
  789. // CHECK:STDOUT:
  790. // CHECK:STDOUT: !definition:
  791. // CHECK:STDOUT:
  792. // CHECK:STDOUT: fn[%T.param_patt: type](%x.param_patt: @TupleParam.%tuple.type (%tuple.type.2)) {
  793. // CHECK:STDOUT: !entry:
  794. // CHECK:STDOUT: return
  795. // CHECK:STDOUT: }
  796. // CHECK:STDOUT: }
  797. // CHECK:STDOUT:
  798. // CHECK:STDOUT: fn @CallTupleParam() {
  799. // CHECK:STDOUT: !entry:
  800. // CHECK:STDOUT: %TupleParam.ref: %TupleParam.type = name_ref TupleParam, file.%TupleParam.decl [template = constants.%TupleParam]
  801. // CHECK:STDOUT: %.loc7_15: Core.IntLiteral = int_value 1 [template = constants.%.3]
  802. // CHECK:STDOUT: %.loc7_18: Core.IntLiteral = int_value 2 [template = constants.%.4]
  803. // CHECK:STDOUT: %.loc7_19.1: %tuple.type.3 = tuple_literal (%.loc7_15, %.loc7_18)
  804. // CHECK:STDOUT: %.loc7_3: <specific function> = specific_function %TupleParam.ref, @TupleParam(Core.IntLiteral) [template = constants.%.5]
  805. // CHECK:STDOUT: %.loc7_19.2: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.14]
  806. // CHECK:STDOUT: %.loc7_19.3: <bound method> = bound_method %.loc7_18, %.loc7_19.2 [template = constants.%.31]
  807. // CHECK:STDOUT: %.loc7_19.4: <specific function> = specific_function %.loc7_19.3, @Convert.2(constants.%.1) [template = constants.%.32]
  808. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %.loc7_19.4(%.loc7_18) [template = constants.%.33]
  809. // CHECK:STDOUT: %.loc7_19.5: %i32 = value_of_initializer %int.convert_checked [template = constants.%.33]
  810. // CHECK:STDOUT: %.loc7_19.6: %i32 = converted %.loc7_18, %.loc7_19.5 [template = constants.%.33]
  811. // CHECK:STDOUT: %tuple: %tuple.type.4 = tuple_value (%.loc7_15, %.loc7_19.6) [template = constants.%tuple]
  812. // CHECK:STDOUT: %.loc7_19.7: %tuple.type.4 = converted %.loc7_19.1, %tuple [template = constants.%tuple]
  813. // CHECK:STDOUT: %TupleParam.call: init %empty_tuple.type = call %.loc7_3(%.loc7_19.7)
  814. // CHECK:STDOUT: return
  815. // CHECK:STDOUT: }
  816. // CHECK:STDOUT:
  817. // CHECK:STDOUT: specific @TupleParam(constants.%T) {
  818. // CHECK:STDOUT: %T.loc4_15.2 => constants.%T
  819. // CHECK:STDOUT: %T.patt.loc4_15.2 => constants.%T
  820. // CHECK:STDOUT: %tuple.type => constants.%tuple.type.2
  821. // CHECK:STDOUT: }
  822. // CHECK:STDOUT:
  823. // CHECK:STDOUT: specific @TupleParam(Core.IntLiteral) {
  824. // CHECK:STDOUT: %T.loc4_15.2 => Core.IntLiteral
  825. // CHECK:STDOUT: %T.patt.loc4_15.2 => Core.IntLiteral
  826. // CHECK:STDOUT: %tuple.type => constants.%tuple.type.4
  827. // CHECK:STDOUT:
  828. // CHECK:STDOUT: !definition:
  829. // CHECK:STDOUT: }
  830. // CHECK:STDOUT:
  831. // CHECK:STDOUT: --- deduce_nested_struct.carbon
  832. // CHECK:STDOUT:
  833. // CHECK:STDOUT: constants {
  834. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  835. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  836. // CHECK:STDOUT: %.1: Core.IntLiteral = int_value 32 [template]
  837. // CHECK:STDOUT: %Int.type: type = fn_type @Int [template]
  838. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  839. // CHECK:STDOUT: %Int: %Int.type = struct_value () [template]
  840. // CHECK:STDOUT: %i32: type = int_type signed, %.1 [template]
  841. // CHECK:STDOUT: %.2: type = struct_type {.a: %T, .b: %i32} [symbolic]
  842. // CHECK:STDOUT: %StructParam.type: type = fn_type @StructParam [template]
  843. // CHECK:STDOUT: %StructParam: %StructParam.type = struct_value () [template]
  844. // CHECK:STDOUT: %CallStructParam.type: type = fn_type @CallStructParam [template]
  845. // CHECK:STDOUT: %CallStructParam: %CallStructParam.type = struct_value () [template]
  846. // CHECK:STDOUT: %.4: Core.IntLiteral = int_value 1 [template]
  847. // CHECK:STDOUT: %.5: Core.IntLiteral = int_value 2 [template]
  848. // CHECK:STDOUT: %.6: type = struct_type {.a: Core.IntLiteral, .b: Core.IntLiteral} [template]
  849. // CHECK:STDOUT: %.7: type = struct_type {.a: Core.IntLiteral, .b: %i32} [template]
  850. // CHECK:STDOUT: %.8: <specific function> = specific_function %StructParam, @StructParam(Core.IntLiteral) [template]
  851. // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template]
  852. // CHECK:STDOUT: %Convert.type.14: type = fn_type @Convert.2, @impl.1(%.1) [template]
  853. // CHECK:STDOUT: %Convert.14: %Convert.type.14 = struct_value () [template]
  854. // CHECK:STDOUT: %.33: <witness> = interface_witness (%Convert.14) [template]
  855. // CHECK:STDOUT: %.34: <bound method> = bound_method %.5, %Convert.14 [template]
  856. // CHECK:STDOUT: %.35: <specific function> = specific_function %.34, @Convert.2(%.1) [template]
  857. // CHECK:STDOUT: %.36: %i32 = int_value 2 [template]
  858. // CHECK:STDOUT: %struct: %.7 = struct_value (%.4, %.36) [template]
  859. // CHECK:STDOUT: }
  860. // CHECK:STDOUT:
  861. // CHECK:STDOUT: imports {
  862. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  863. // CHECK:STDOUT: .Int = %import_ref.1
  864. // CHECK:STDOUT: .ImplicitAs = %import_ref.2
  865. // CHECK:STDOUT: import Core//prelude
  866. // CHECK:STDOUT: import Core//prelude/...
  867. // CHECK:STDOUT: }
  868. // CHECK:STDOUT: }
  869. // CHECK:STDOUT:
  870. // CHECK:STDOUT: file {
  871. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  872. // CHECK:STDOUT: .Core = imports.%Core
  873. // CHECK:STDOUT: .StructParam = %StructParam.decl
  874. // CHECK:STDOUT: .CallStructParam = %CallStructParam.decl
  875. // CHECK:STDOUT: }
  876. // CHECK:STDOUT: %Core.import = import Core
  877. // CHECK:STDOUT: %StructParam.decl: %StructParam.type = fn_decl @StructParam [template = constants.%StructParam] {
  878. // CHECK:STDOUT: %T.patt.loc4_16.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_16.2 (constants.%T.patt)]
  879. // 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)]
  880. // CHECK:STDOUT: %x.patt: @StructParam.%.loc4_44.2 (%.2) = binding_pattern x
  881. // CHECK:STDOUT: %x.param_patt: @StructParam.%.loc4_44.2 (%.2) = value_param_pattern %x.patt, runtime_param0
  882. // CHECK:STDOUT: } {
  883. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc4_16.1 [symbolic = %T.loc4_16.2 (constants.%T)]
  884. // CHECK:STDOUT: %.loc4_41.1: Core.IntLiteral = int_value 32 [template = constants.%.1]
  885. // CHECK:STDOUT: %int.make_type_signed: init type = call constants.%Int(%.loc4_41.1) [template = constants.%i32]
  886. // CHECK:STDOUT: %.loc4_41.2: type = value_of_initializer %int.make_type_signed [template = constants.%i32]
  887. // CHECK:STDOUT: %.loc4_41.3: type = converted %int.make_type_signed, %.loc4_41.2 [template = constants.%i32]
  888. // CHECK:STDOUT: %.loc4_44.1: type = struct_type {.a: %T, .b: %i32} [symbolic = %.loc4_44.2 (constants.%.2)]
  889. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  890. // CHECK:STDOUT: %T.loc4_16.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc4_16.2 (constants.%T)]
  891. // CHECK:STDOUT: %x.param: @StructParam.%.loc4_44.2 (%.2) = value_param runtime_param0
  892. // CHECK:STDOUT: %x: @StructParam.%.loc4_44.2 (%.2) = bind_name x, %x.param
  893. // CHECK:STDOUT: }
  894. // CHECK:STDOUT: %CallStructParam.decl: %CallStructParam.type = fn_decl @CallStructParam [template = constants.%CallStructParam] {} {}
  895. // CHECK:STDOUT: }
  896. // CHECK:STDOUT:
  897. // CHECK:STDOUT: generic fn @StructParam(%T.loc4_16.1: type) {
  898. // CHECK:STDOUT: %T.loc4_16.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_16.2 (constants.%T)]
  899. // CHECK:STDOUT: %T.patt.loc4_16.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_16.2 (constants.%T.patt)]
  900. // CHECK:STDOUT: %.loc4_44.2: type = struct_type {.a: @StructParam.%T.loc4_16.2 (%T), .b: %i32} [symbolic = %.loc4_44.2 (constants.%.2)]
  901. // CHECK:STDOUT:
  902. // CHECK:STDOUT: !definition:
  903. // CHECK:STDOUT:
  904. // CHECK:STDOUT: fn[%T.param_patt: type](%x.param_patt: @StructParam.%.loc4_44.2 (%.2)) {
  905. // CHECK:STDOUT: !entry:
  906. // CHECK:STDOUT: return
  907. // CHECK:STDOUT: }
  908. // CHECK:STDOUT: }
  909. // CHECK:STDOUT:
  910. // CHECK:STDOUT: fn @CallStructParam() {
  911. // CHECK:STDOUT: !entry:
  912. // CHECK:STDOUT: %StructParam.ref: %StructParam.type = name_ref StructParam, file.%StructParam.decl [template = constants.%StructParam]
  913. // CHECK:STDOUT: %.loc7_21: Core.IntLiteral = int_value 1 [template = constants.%.4]
  914. // CHECK:STDOUT: %.loc7_29: Core.IntLiteral = int_value 2 [template = constants.%.5]
  915. // CHECK:STDOUT: %.loc7_30.1: %.6 = struct_literal (%.loc7_21, %.loc7_29)
  916. // CHECK:STDOUT: %.loc7_3: <specific function> = specific_function %StructParam.ref, @StructParam(Core.IntLiteral) [template = constants.%.8]
  917. // CHECK:STDOUT: %.loc7_30.2: %Convert.type.2 = interface_witness_access constants.%.33, element0 [template = constants.%Convert.14]
  918. // CHECK:STDOUT: %.loc7_30.3: <bound method> = bound_method %.loc7_29, %.loc7_30.2 [template = constants.%.34]
  919. // CHECK:STDOUT: %.loc7_30.4: <specific function> = specific_function %.loc7_30.3, @Convert.2(constants.%.1) [template = constants.%.35]
  920. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %.loc7_30.4(%.loc7_29) [template = constants.%.36]
  921. // CHECK:STDOUT: %.loc7_30.5: %i32 = value_of_initializer %int.convert_checked [template = constants.%.36]
  922. // CHECK:STDOUT: %.loc7_30.6: %i32 = converted %.loc7_29, %.loc7_30.5 [template = constants.%.36]
  923. // CHECK:STDOUT: %struct: %.7 = struct_value (%.loc7_21, %.loc7_30.6) [template = constants.%struct]
  924. // CHECK:STDOUT: %.loc7_30.7: %.7 = converted %.loc7_30.1, %struct [template = constants.%struct]
  925. // CHECK:STDOUT: %StructParam.call: init %empty_tuple.type = call %.loc7_3(%.loc7_30.7)
  926. // CHECK:STDOUT: return
  927. // CHECK:STDOUT: }
  928. // CHECK:STDOUT:
  929. // CHECK:STDOUT: specific @StructParam(constants.%T) {
  930. // CHECK:STDOUT: %T.loc4_16.2 => constants.%T
  931. // CHECK:STDOUT: %T.patt.loc4_16.2 => constants.%T
  932. // CHECK:STDOUT: %.loc4_44.2 => constants.%.2
  933. // CHECK:STDOUT: }
  934. // CHECK:STDOUT:
  935. // CHECK:STDOUT: specific @StructParam(Core.IntLiteral) {
  936. // CHECK:STDOUT: %T.loc4_16.2 => Core.IntLiteral
  937. // CHECK:STDOUT: %T.patt.loc4_16.2 => Core.IntLiteral
  938. // CHECK:STDOUT: %.loc4_44.2 => constants.%.7
  939. // CHECK:STDOUT:
  940. // CHECK:STDOUT: !definition:
  941. // CHECK:STDOUT: }
  942. // CHECK:STDOUT:
  943. // CHECK:STDOUT: --- fail_deduce_bigger_struct.carbon
  944. // CHECK:STDOUT:
  945. // CHECK:STDOUT: constants {
  946. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  947. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  948. // CHECK:STDOUT: %.1: Core.IntLiteral = int_value 32 [template]
  949. // CHECK:STDOUT: %Int.type: type = fn_type @Int [template]
  950. // CHECK:STDOUT: %Int: %Int.type = struct_value () [template]
  951. // CHECK:STDOUT: %i32: type = int_type signed, %.1 [template]
  952. // CHECK:STDOUT: %.2: type = struct_type {.c: %T, .d: %i32, .e: %i32} [symbolic]
  953. // CHECK:STDOUT: %BigStructParam.type: type = fn_type @BigStructParam [template]
  954. // CHECK:STDOUT: %BigStructParam: %BigStructParam.type = struct_value () [template]
  955. // CHECK:STDOUT: %CallBigStructParam.type: type = fn_type @CallBigStructParam [template]
  956. // CHECK:STDOUT: %CallBigStructParam: %CallBigStructParam.type = struct_value () [template]
  957. // CHECK:STDOUT: %.4: Core.IntLiteral = int_value 3 [template]
  958. // CHECK:STDOUT: %.5: Core.IntLiteral = int_value 4 [template]
  959. // CHECK:STDOUT: %.6: type = struct_type {.c: Core.IntLiteral, .d: Core.IntLiteral} [template]
  960. // CHECK:STDOUT: }
  961. // CHECK:STDOUT:
  962. // CHECK:STDOUT: imports {
  963. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  964. // CHECK:STDOUT: .Int = %import_ref
  965. // CHECK:STDOUT: import Core//prelude
  966. // CHECK:STDOUT: import Core//prelude/...
  967. // CHECK:STDOUT: }
  968. // CHECK:STDOUT: }
  969. // CHECK:STDOUT:
  970. // CHECK:STDOUT: file {
  971. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  972. // CHECK:STDOUT: .Core = imports.%Core
  973. // CHECK:STDOUT: .BigStructParam = %BigStructParam.decl
  974. // CHECK:STDOUT: .CallBigStructParam = %CallBigStructParam.decl
  975. // CHECK:STDOUT: }
  976. // CHECK:STDOUT: %Core.import = import Core
  977. // CHECK:STDOUT: %BigStructParam.decl: %BigStructParam.type = fn_decl @BigStructParam [template = constants.%BigStructParam] {
  978. // CHECK:STDOUT: %T.patt.loc4_19.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_19.2 (constants.%T.patt)]
  979. // 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)]
  980. // CHECK:STDOUT: %x.patt: @BigStructParam.%.loc4_56.2 (%.2) = binding_pattern x
  981. // CHECK:STDOUT: %x.param_patt: @BigStructParam.%.loc4_56.2 (%.2) = value_param_pattern %x.patt, runtime_param0
  982. // CHECK:STDOUT: } {
  983. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc4_19.1 [symbolic = %T.loc4_19.2 (constants.%T)]
  984. // CHECK:STDOUT: %.loc4_44.1: Core.IntLiteral = int_value 32 [template = constants.%.1]
  985. // CHECK:STDOUT: %int.make_type_signed.loc4_44: init type = call constants.%Int(%.loc4_44.1) [template = constants.%i32]
  986. // CHECK:STDOUT: %.loc4_44.2: type = value_of_initializer %int.make_type_signed.loc4_44 [template = constants.%i32]
  987. // CHECK:STDOUT: %.loc4_44.3: type = converted %int.make_type_signed.loc4_44, %.loc4_44.2 [template = constants.%i32]
  988. // CHECK:STDOUT: %.loc4_53.1: Core.IntLiteral = int_value 32 [template = constants.%.1]
  989. // CHECK:STDOUT: %int.make_type_signed.loc4_53: init type = call constants.%Int(%.loc4_53.1) [template = constants.%i32]
  990. // CHECK:STDOUT: %.loc4_53.2: type = value_of_initializer %int.make_type_signed.loc4_53 [template = constants.%i32]
  991. // CHECK:STDOUT: %.loc4_53.3: type = converted %int.make_type_signed.loc4_53, %.loc4_53.2 [template = constants.%i32]
  992. // CHECK:STDOUT: %.loc4_56.1: type = struct_type {.c: %T, .d: %i32, .e: %i32} [symbolic = %.loc4_56.2 (constants.%.2)]
  993. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  994. // CHECK:STDOUT: %T.loc4_19.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc4_19.2 (constants.%T)]
  995. // CHECK:STDOUT: %x.param: @BigStructParam.%.loc4_56.2 (%.2) = value_param runtime_param0
  996. // CHECK:STDOUT: %x: @BigStructParam.%.loc4_56.2 (%.2) = bind_name x, %x.param
  997. // CHECK:STDOUT: }
  998. // CHECK:STDOUT: %CallBigStructParam.decl: %CallBigStructParam.type = fn_decl @CallBigStructParam [template = constants.%CallBigStructParam] {} {}
  999. // CHECK:STDOUT: }
  1000. // CHECK:STDOUT:
  1001. // CHECK:STDOUT: generic fn @BigStructParam(%T.loc4_19.1: type) {
  1002. // CHECK:STDOUT: %T.loc4_19.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_19.2 (constants.%T)]
  1003. // CHECK:STDOUT: %T.patt.loc4_19.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_19.2 (constants.%T.patt)]
  1004. // 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)]
  1005. // CHECK:STDOUT:
  1006. // CHECK:STDOUT: !definition:
  1007. // CHECK:STDOUT:
  1008. // CHECK:STDOUT: fn[%T.param_patt: type](%x.param_patt: @BigStructParam.%.loc4_56.2 (%.2)) {
  1009. // CHECK:STDOUT: !entry:
  1010. // CHECK:STDOUT: return
  1011. // CHECK:STDOUT: }
  1012. // CHECK:STDOUT: }
  1013. // CHECK:STDOUT:
  1014. // CHECK:STDOUT: fn @CallBigStructParam() {
  1015. // CHECK:STDOUT: !entry:
  1016. // CHECK:STDOUT: %BigStructParam.ref: %BigStructParam.type = name_ref BigStructParam, file.%BigStructParam.decl [template = constants.%BigStructParam]
  1017. // CHECK:STDOUT: %.loc14_24: Core.IntLiteral = int_value 3 [template = constants.%.4]
  1018. // CHECK:STDOUT: %.loc14_32: Core.IntLiteral = int_value 4 [template = constants.%.5]
  1019. // CHECK:STDOUT: %.loc14_33: %.6 = struct_literal (%.loc14_24, %.loc14_32)
  1020. // CHECK:STDOUT: return
  1021. // CHECK:STDOUT: }
  1022. // CHECK:STDOUT:
  1023. // CHECK:STDOUT: specific @BigStructParam(constants.%T) {
  1024. // CHECK:STDOUT: %T.loc4_19.2 => constants.%T
  1025. // CHECK:STDOUT: %T.patt.loc4_19.2 => constants.%T
  1026. // CHECK:STDOUT: %.loc4_56.2 => constants.%.2
  1027. // CHECK:STDOUT: }
  1028. // CHECK:STDOUT:
  1029. // CHECK:STDOUT: --- fail_deduce_smaller_struct.carbon
  1030. // CHECK:STDOUT:
  1031. // CHECK:STDOUT: constants {
  1032. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  1033. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  1034. // CHECK:STDOUT: %.1: Core.IntLiteral = int_value 32 [template]
  1035. // CHECK:STDOUT: %Int.type: type = fn_type @Int [template]
  1036. // CHECK:STDOUT: %Int: %Int.type = struct_value () [template]
  1037. // CHECK:STDOUT: %i32: type = int_type signed, %.1 [template]
  1038. // CHECK:STDOUT: %.2: type = struct_type {.f: %T, .g: %i32} [symbolic]
  1039. // CHECK:STDOUT: %SmallStructParam.type: type = fn_type @SmallStructParam [template]
  1040. // CHECK:STDOUT: %SmallStructParam: %SmallStructParam.type = struct_value () [template]
  1041. // CHECK:STDOUT: %CallSmallStructParam.type: type = fn_type @CallSmallStructParam [template]
  1042. // CHECK:STDOUT: %CallSmallStructParam: %CallSmallStructParam.type = struct_value () [template]
  1043. // CHECK:STDOUT: %.4: Core.IntLiteral = int_value 5 [template]
  1044. // CHECK:STDOUT: %.5: Core.IntLiteral = int_value 6 [template]
  1045. // CHECK:STDOUT: %.6: Core.IntLiteral = int_value 7 [template]
  1046. // CHECK:STDOUT: %.7: type = struct_type {.f: Core.IntLiteral, .g: Core.IntLiteral, .h: Core.IntLiteral} [template]
  1047. // CHECK:STDOUT: }
  1048. // CHECK:STDOUT:
  1049. // CHECK:STDOUT: imports {
  1050. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  1051. // CHECK:STDOUT: .Int = %import_ref
  1052. // CHECK:STDOUT: import Core//prelude
  1053. // CHECK:STDOUT: import Core//prelude/...
  1054. // CHECK:STDOUT: }
  1055. // CHECK:STDOUT: }
  1056. // CHECK:STDOUT:
  1057. // CHECK:STDOUT: file {
  1058. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1059. // CHECK:STDOUT: .Core = imports.%Core
  1060. // CHECK:STDOUT: .SmallStructParam = %SmallStructParam.decl
  1061. // CHECK:STDOUT: .CallSmallStructParam = %CallSmallStructParam.decl
  1062. // CHECK:STDOUT: }
  1063. // CHECK:STDOUT: %Core.import = import Core
  1064. // CHECK:STDOUT: %SmallStructParam.decl: %SmallStructParam.type = fn_decl @SmallStructParam [template = constants.%SmallStructParam] {
  1065. // CHECK:STDOUT: %T.patt.loc4_21.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_21.2 (constants.%T.patt)]
  1066. // 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)]
  1067. // CHECK:STDOUT: %x.patt: @SmallStructParam.%.loc4_49.2 (%.2) = binding_pattern x
  1068. // CHECK:STDOUT: %x.param_patt: @SmallStructParam.%.loc4_49.2 (%.2) = value_param_pattern %x.patt, runtime_param0
  1069. // CHECK:STDOUT: } {
  1070. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc4_21.1 [symbolic = %T.loc4_21.2 (constants.%T)]
  1071. // CHECK:STDOUT: %.loc4_46.1: Core.IntLiteral = int_value 32 [template = constants.%.1]
  1072. // CHECK:STDOUT: %int.make_type_signed: init type = call constants.%Int(%.loc4_46.1) [template = constants.%i32]
  1073. // CHECK:STDOUT: %.loc4_46.2: type = value_of_initializer %int.make_type_signed [template = constants.%i32]
  1074. // CHECK:STDOUT: %.loc4_46.3: type = converted %int.make_type_signed, %.loc4_46.2 [template = constants.%i32]
  1075. // CHECK:STDOUT: %.loc4_49.1: type = struct_type {.f: %T, .g: %i32} [symbolic = %.loc4_49.2 (constants.%.2)]
  1076. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  1077. // CHECK:STDOUT: %T.loc4_21.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc4_21.2 (constants.%T)]
  1078. // CHECK:STDOUT: %x.param: @SmallStructParam.%.loc4_49.2 (%.2) = value_param runtime_param0
  1079. // CHECK:STDOUT: %x: @SmallStructParam.%.loc4_49.2 (%.2) = bind_name x, %x.param
  1080. // CHECK:STDOUT: }
  1081. // CHECK:STDOUT: %CallSmallStructParam.decl: %CallSmallStructParam.type = fn_decl @CallSmallStructParam [template = constants.%CallSmallStructParam] {} {}
  1082. // CHECK:STDOUT: }
  1083. // CHECK:STDOUT:
  1084. // CHECK:STDOUT: generic fn @SmallStructParam(%T.loc4_21.1: type) {
  1085. // CHECK:STDOUT: %T.loc4_21.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_21.2 (constants.%T)]
  1086. // CHECK:STDOUT: %T.patt.loc4_21.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_21.2 (constants.%T.patt)]
  1087. // CHECK:STDOUT: %.loc4_49.2: type = struct_type {.f: @SmallStructParam.%T.loc4_21.2 (%T), .g: %i32} [symbolic = %.loc4_49.2 (constants.%.2)]
  1088. // CHECK:STDOUT:
  1089. // CHECK:STDOUT: !definition:
  1090. // CHECK:STDOUT:
  1091. // CHECK:STDOUT: fn[%T.param_patt: type](%x.param_patt: @SmallStructParam.%.loc4_49.2 (%.2)) {
  1092. // CHECK:STDOUT: !entry:
  1093. // CHECK:STDOUT: return
  1094. // CHECK:STDOUT: }
  1095. // CHECK:STDOUT: }
  1096. // CHECK:STDOUT:
  1097. // CHECK:STDOUT: fn @CallSmallStructParam() {
  1098. // CHECK:STDOUT: !entry:
  1099. // CHECK:STDOUT: %SmallStructParam.ref: %SmallStructParam.type = name_ref SmallStructParam, file.%SmallStructParam.decl [template = constants.%SmallStructParam]
  1100. // CHECK:STDOUT: %.loc14_26: Core.IntLiteral = int_value 5 [template = constants.%.4]
  1101. // CHECK:STDOUT: %.loc14_34: Core.IntLiteral = int_value 6 [template = constants.%.5]
  1102. // CHECK:STDOUT: %.loc14_42: Core.IntLiteral = int_value 7 [template = constants.%.6]
  1103. // CHECK:STDOUT: %.loc14_43: %.7 = struct_literal (%.loc14_26, %.loc14_34, %.loc14_42)
  1104. // CHECK:STDOUT: return
  1105. // CHECK:STDOUT: }
  1106. // CHECK:STDOUT:
  1107. // CHECK:STDOUT: specific @SmallStructParam(constants.%T) {
  1108. // CHECK:STDOUT: %T.loc4_21.2 => constants.%T
  1109. // CHECK:STDOUT: %T.patt.loc4_21.2 => constants.%T
  1110. // CHECK:STDOUT: %.loc4_49.2 => constants.%.2
  1111. // CHECK:STDOUT: }
  1112. // CHECK:STDOUT:
  1113. // CHECK:STDOUT: --- fail_deduce_struct_wrong_name.carbon
  1114. // CHECK:STDOUT:
  1115. // CHECK:STDOUT: constants {
  1116. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  1117. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  1118. // CHECK:STDOUT: %.1: Core.IntLiteral = int_value 32 [template]
  1119. // CHECK:STDOUT: %Int.type: type = fn_type @Int [template]
  1120. // CHECK:STDOUT: %Int: %Int.type = struct_value () [template]
  1121. // CHECK:STDOUT: %i32: type = int_type signed, %.1 [template]
  1122. // CHECK:STDOUT: %.2: type = struct_type {.i: %T, .different: %i32} [symbolic]
  1123. // CHECK:STDOUT: %WrongNameStructParam.type: type = fn_type @WrongNameStructParam [template]
  1124. // CHECK:STDOUT: %WrongNameStructParam: %WrongNameStructParam.type = struct_value () [template]
  1125. // CHECK:STDOUT: %CallWrongNameStructParam.type: type = fn_type @CallWrongNameStructParam [template]
  1126. // CHECK:STDOUT: %CallWrongNameStructParam: %CallWrongNameStructParam.type = struct_value () [template]
  1127. // CHECK:STDOUT: %.4: Core.IntLiteral = int_value 8 [template]
  1128. // CHECK:STDOUT: %.5: Core.IntLiteral = int_value 9 [template]
  1129. // CHECK:STDOUT: %.6: type = struct_type {.i: Core.IntLiteral, .j: Core.IntLiteral} [template]
  1130. // CHECK:STDOUT: }
  1131. // CHECK:STDOUT:
  1132. // CHECK:STDOUT: imports {
  1133. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  1134. // CHECK:STDOUT: .Int = %import_ref
  1135. // CHECK:STDOUT: import Core//prelude
  1136. // CHECK:STDOUT: import Core//prelude/...
  1137. // CHECK:STDOUT: }
  1138. // CHECK:STDOUT: }
  1139. // CHECK:STDOUT:
  1140. // CHECK:STDOUT: file {
  1141. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1142. // CHECK:STDOUT: .Core = imports.%Core
  1143. // CHECK:STDOUT: .WrongNameStructParam = %WrongNameStructParam.decl
  1144. // CHECK:STDOUT: .CallWrongNameStructParam = %CallWrongNameStructParam.decl
  1145. // CHECK:STDOUT: }
  1146. // CHECK:STDOUT: %Core.import = import Core
  1147. // CHECK:STDOUT: %WrongNameStructParam.decl: %WrongNameStructParam.type = fn_decl @WrongNameStructParam [template = constants.%WrongNameStructParam] {
  1148. // CHECK:STDOUT: %T.patt.loc4_25.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_25.2 (constants.%T.patt)]
  1149. // 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)]
  1150. // CHECK:STDOUT: %x.patt: @WrongNameStructParam.%.loc4_61.2 (%.2) = binding_pattern x
  1151. // CHECK:STDOUT: %x.param_patt: @WrongNameStructParam.%.loc4_61.2 (%.2) = value_param_pattern %x.patt, runtime_param0
  1152. // CHECK:STDOUT: } {
  1153. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc4_25.1 [symbolic = %T.loc4_25.2 (constants.%T)]
  1154. // CHECK:STDOUT: %.loc4_58.1: Core.IntLiteral = int_value 32 [template = constants.%.1]
  1155. // CHECK:STDOUT: %int.make_type_signed: init type = call constants.%Int(%.loc4_58.1) [template = constants.%i32]
  1156. // CHECK:STDOUT: %.loc4_58.2: type = value_of_initializer %int.make_type_signed [template = constants.%i32]
  1157. // CHECK:STDOUT: %.loc4_58.3: type = converted %int.make_type_signed, %.loc4_58.2 [template = constants.%i32]
  1158. // CHECK:STDOUT: %.loc4_61.1: type = struct_type {.i: %T, .different: %i32} [symbolic = %.loc4_61.2 (constants.%.2)]
  1159. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  1160. // CHECK:STDOUT: %T.loc4_25.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc4_25.2 (constants.%T)]
  1161. // CHECK:STDOUT: %x.param: @WrongNameStructParam.%.loc4_61.2 (%.2) = value_param runtime_param0
  1162. // CHECK:STDOUT: %x: @WrongNameStructParam.%.loc4_61.2 (%.2) = bind_name x, %x.param
  1163. // CHECK:STDOUT: }
  1164. // CHECK:STDOUT: %CallWrongNameStructParam.decl: %CallWrongNameStructParam.type = fn_decl @CallWrongNameStructParam [template = constants.%CallWrongNameStructParam] {} {}
  1165. // CHECK:STDOUT: }
  1166. // CHECK:STDOUT:
  1167. // CHECK:STDOUT: generic fn @WrongNameStructParam(%T.loc4_25.1: type) {
  1168. // CHECK:STDOUT: %T.loc4_25.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_25.2 (constants.%T)]
  1169. // CHECK:STDOUT: %T.patt.loc4_25.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_25.2 (constants.%T.patt)]
  1170. // CHECK:STDOUT: %.loc4_61.2: type = struct_type {.i: @WrongNameStructParam.%T.loc4_25.2 (%T), .different: %i32} [symbolic = %.loc4_61.2 (constants.%.2)]
  1171. // CHECK:STDOUT:
  1172. // CHECK:STDOUT: !definition:
  1173. // CHECK:STDOUT:
  1174. // CHECK:STDOUT: fn[%T.param_patt: type](%x.param_patt: @WrongNameStructParam.%.loc4_61.2 (%.2)) {
  1175. // CHECK:STDOUT: !entry:
  1176. // CHECK:STDOUT: return
  1177. // CHECK:STDOUT: }
  1178. // CHECK:STDOUT: }
  1179. // CHECK:STDOUT:
  1180. // CHECK:STDOUT: fn @CallWrongNameStructParam() {
  1181. // CHECK:STDOUT: !entry:
  1182. // CHECK:STDOUT: %WrongNameStructParam.ref: %WrongNameStructParam.type = name_ref WrongNameStructParam, file.%WrongNameStructParam.decl [template = constants.%WrongNameStructParam]
  1183. // CHECK:STDOUT: %.loc14_30: Core.IntLiteral = int_value 8 [template = constants.%.4]
  1184. // CHECK:STDOUT: %.loc14_38: Core.IntLiteral = int_value 9 [template = constants.%.5]
  1185. // CHECK:STDOUT: %.loc14_39: %.6 = struct_literal (%.loc14_30, %.loc14_38)
  1186. // CHECK:STDOUT: return
  1187. // CHECK:STDOUT: }
  1188. // CHECK:STDOUT:
  1189. // CHECK:STDOUT: specific @WrongNameStructParam(constants.%T) {
  1190. // CHECK:STDOUT: %T.loc4_25.2 => constants.%T
  1191. // CHECK:STDOUT: %T.patt.loc4_25.2 => constants.%T
  1192. // CHECK:STDOUT: %.loc4_61.2 => constants.%.2
  1193. // CHECK:STDOUT: }
  1194. // CHECK:STDOUT:
  1195. // CHECK:STDOUT: --- fail_todo_deduce_struct_wrong_order.carbon
  1196. // CHECK:STDOUT:
  1197. // CHECK:STDOUT: constants {
  1198. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  1199. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  1200. // CHECK:STDOUT: %.1: Core.IntLiteral = int_value 32 [template]
  1201. // CHECK:STDOUT: %Int.type: type = fn_type @Int [template]
  1202. // CHECK:STDOUT: %Int: %Int.type = struct_value () [template]
  1203. // CHECK:STDOUT: %i32: type = int_type signed, %.1 [template]
  1204. // CHECK:STDOUT: %.2: type = struct_type {.first: %T, .second: %i32} [symbolic]
  1205. // CHECK:STDOUT: %WrongOrderStructParam.type: type = fn_type @WrongOrderStructParam [template]
  1206. // CHECK:STDOUT: %WrongOrderStructParam: %WrongOrderStructParam.type = struct_value () [template]
  1207. // CHECK:STDOUT: %CallWrongOrderStructParam.type: type = fn_type @CallWrongOrderStructParam [template]
  1208. // CHECK:STDOUT: %CallWrongOrderStructParam: %CallWrongOrderStructParam.type = struct_value () [template]
  1209. // CHECK:STDOUT: %.4: Core.IntLiteral = int_value 11 [template]
  1210. // CHECK:STDOUT: %.5: Core.IntLiteral = int_value 10 [template]
  1211. // CHECK:STDOUT: %.6: type = struct_type {.second: Core.IntLiteral, .first: Core.IntLiteral} [template]
  1212. // CHECK:STDOUT: }
  1213. // CHECK:STDOUT:
  1214. // CHECK:STDOUT: imports {
  1215. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  1216. // CHECK:STDOUT: .Int = %import_ref
  1217. // CHECK:STDOUT: import Core//prelude
  1218. // CHECK:STDOUT: import Core//prelude/...
  1219. // CHECK:STDOUT: }
  1220. // CHECK:STDOUT: }
  1221. // CHECK:STDOUT:
  1222. // CHECK:STDOUT: file {
  1223. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1224. // CHECK:STDOUT: .Core = imports.%Core
  1225. // CHECK:STDOUT: .WrongOrderStructParam = %WrongOrderStructParam.decl
  1226. // CHECK:STDOUT: .CallWrongOrderStructParam = %CallWrongOrderStructParam.decl
  1227. // CHECK:STDOUT: }
  1228. // CHECK:STDOUT: %Core.import = import Core
  1229. // CHECK:STDOUT: %WrongOrderStructParam.decl: %WrongOrderStructParam.type = fn_decl @WrongOrderStructParam [template = constants.%WrongOrderStructParam] {
  1230. // CHECK:STDOUT: %T.patt.loc4_26.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_26.2 (constants.%T.patt)]
  1231. // 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)]
  1232. // CHECK:STDOUT: %x.patt: @WrongOrderStructParam.%.loc4_63.2 (%.2) = binding_pattern x
  1233. // CHECK:STDOUT: %x.param_patt: @WrongOrderStructParam.%.loc4_63.2 (%.2) = value_param_pattern %x.patt, runtime_param0
  1234. // CHECK:STDOUT: } {
  1235. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc4_26.1 [symbolic = %T.loc4_26.2 (constants.%T)]
  1236. // CHECK:STDOUT: %.loc4_60.1: Core.IntLiteral = int_value 32 [template = constants.%.1]
  1237. // CHECK:STDOUT: %int.make_type_signed: init type = call constants.%Int(%.loc4_60.1) [template = constants.%i32]
  1238. // CHECK:STDOUT: %.loc4_60.2: type = value_of_initializer %int.make_type_signed [template = constants.%i32]
  1239. // CHECK:STDOUT: %.loc4_60.3: type = converted %int.make_type_signed, %.loc4_60.2 [template = constants.%i32]
  1240. // CHECK:STDOUT: %.loc4_63.1: type = struct_type {.first: %T, .second: %i32} [symbolic = %.loc4_63.2 (constants.%.2)]
  1241. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  1242. // CHECK:STDOUT: %T.loc4_26.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc4_26.2 (constants.%T)]
  1243. // CHECK:STDOUT: %x.param: @WrongOrderStructParam.%.loc4_63.2 (%.2) = value_param runtime_param0
  1244. // CHECK:STDOUT: %x: @WrongOrderStructParam.%.loc4_63.2 (%.2) = bind_name x, %x.param
  1245. // CHECK:STDOUT: }
  1246. // CHECK:STDOUT: %CallWrongOrderStructParam.decl: %CallWrongOrderStructParam.type = fn_decl @CallWrongOrderStructParam [template = constants.%CallWrongOrderStructParam] {} {}
  1247. // CHECK:STDOUT: }
  1248. // CHECK:STDOUT:
  1249. // CHECK:STDOUT: generic fn @WrongOrderStructParam(%T.loc4_26.1: type) {
  1250. // CHECK:STDOUT: %T.loc4_26.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_26.2 (constants.%T)]
  1251. // CHECK:STDOUT: %T.patt.loc4_26.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_26.2 (constants.%T.patt)]
  1252. // CHECK:STDOUT: %.loc4_63.2: type = struct_type {.first: @WrongOrderStructParam.%T.loc4_26.2 (%T), .second: %i32} [symbolic = %.loc4_63.2 (constants.%.2)]
  1253. // CHECK:STDOUT:
  1254. // CHECK:STDOUT: !definition:
  1255. // CHECK:STDOUT:
  1256. // CHECK:STDOUT: fn[%T.param_patt: type](%x.param_patt: @WrongOrderStructParam.%.loc4_63.2 (%.2)) {
  1257. // CHECK:STDOUT: !entry:
  1258. // CHECK:STDOUT: return
  1259. // CHECK:STDOUT: }
  1260. // CHECK:STDOUT: }
  1261. // CHECK:STDOUT:
  1262. // CHECK:STDOUT: fn @CallWrongOrderStructParam() {
  1263. // CHECK:STDOUT: !entry:
  1264. // CHECK:STDOUT: %WrongOrderStructParam.ref: %WrongOrderStructParam.type = name_ref WrongOrderStructParam, file.%WrongOrderStructParam.decl [template = constants.%WrongOrderStructParam]
  1265. // CHECK:STDOUT: %.loc14_36: Core.IntLiteral = int_value 11 [template = constants.%.4]
  1266. // CHECK:STDOUT: %.loc14_49: Core.IntLiteral = int_value 10 [template = constants.%.5]
  1267. // CHECK:STDOUT: %.loc14_51: %.6 = struct_literal (%.loc14_36, %.loc14_49)
  1268. // CHECK:STDOUT: return
  1269. // CHECK:STDOUT: }
  1270. // CHECK:STDOUT:
  1271. // CHECK:STDOUT: specific @WrongOrderStructParam(constants.%T) {
  1272. // CHECK:STDOUT: %T.loc4_26.2 => constants.%T
  1273. // CHECK:STDOUT: %T.patt.loc4_26.2 => constants.%T
  1274. // CHECK:STDOUT: %.loc4_63.2 => constants.%.2
  1275. // CHECK:STDOUT: }
  1276. // CHECK:STDOUT:
  1277. // CHECK:STDOUT: --- fail_deduce_incomplete.carbon
  1278. // CHECK:STDOUT:
  1279. // CHECK:STDOUT: constants {
  1280. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  1281. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  1282. // CHECK:STDOUT: %U: type = bind_symbolic_name U, 1 [symbolic]
  1283. // CHECK:STDOUT: %U.patt: type = symbolic_binding_pattern U, 1 [symbolic]
  1284. // CHECK:STDOUT: %ImplicitNotDeducible.type: type = fn_type @ImplicitNotDeducible [template]
  1285. // CHECK:STDOUT: %ImplicitNotDeducible: %ImplicitNotDeducible.type = struct_value () [template]
  1286. // CHECK:STDOUT: %CallImplicitNotDeducible.type: type = fn_type @CallImplicitNotDeducible [template]
  1287. // CHECK:STDOUT: %CallImplicitNotDeducible: %CallImplicitNotDeducible.type = struct_value () [template]
  1288. // CHECK:STDOUT: %.1: Core.IntLiteral = int_value 42 [template]
  1289. // CHECK:STDOUT: }
  1290. // CHECK:STDOUT:
  1291. // CHECK:STDOUT: imports {
  1292. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  1293. // CHECK:STDOUT: import Core//prelude
  1294. // CHECK:STDOUT: import Core//prelude/...
  1295. // CHECK:STDOUT: }
  1296. // CHECK:STDOUT: }
  1297. // CHECK:STDOUT:
  1298. // CHECK:STDOUT: file {
  1299. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1300. // CHECK:STDOUT: .Core = imports.%Core
  1301. // CHECK:STDOUT: .ImplicitNotDeducible = %ImplicitNotDeducible.decl
  1302. // CHECK:STDOUT: .CallImplicitNotDeducible = %CallImplicitNotDeducible.decl
  1303. // CHECK:STDOUT: }
  1304. // CHECK:STDOUT: %Core.import = import Core
  1305. // CHECK:STDOUT: %ImplicitNotDeducible.decl: %ImplicitNotDeducible.type = fn_decl @ImplicitNotDeducible [template = constants.%ImplicitNotDeducible] {
  1306. // CHECK:STDOUT: %T.patt.loc6_25.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_25.2 (constants.%T.patt)]
  1307. // 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)]
  1308. // CHECK:STDOUT: %U.patt.loc6_35.1: type = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc6_35.2 (constants.%U.patt)]
  1309. // 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)]
  1310. // CHECK:STDOUT: %x.patt: @ImplicitNotDeducible.%T.loc6_25.2 (%T) = binding_pattern x
  1311. // CHECK:STDOUT: %x.param_patt: @ImplicitNotDeducible.%T.loc6_25.2 (%T) = value_param_pattern %x.patt, runtime_param0
  1312. // CHECK:STDOUT: %return.patt: @ImplicitNotDeducible.%U.loc6_35.2 (%U) = return_slot_pattern
  1313. // CHECK:STDOUT: %return.param_patt: @ImplicitNotDeducible.%U.loc6_35.2 (%U) = out_param_pattern %return.patt, runtime_param1
  1314. // CHECK:STDOUT: } {
  1315. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc6_25.1 [symbolic = %T.loc6_25.2 (constants.%T)]
  1316. // CHECK:STDOUT: %U.ref: type = name_ref U, %U.loc6_35.1 [symbolic = %U.loc6_35.2 (constants.%U)]
  1317. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  1318. // CHECK:STDOUT: %T.loc6_25.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc6_25.2 (constants.%T)]
  1319. // CHECK:STDOUT: %U.param: type = value_param runtime_param<invalid>
  1320. // CHECK:STDOUT: %U.loc6_35.1: type = bind_symbolic_name U, 1, %U.param [symbolic = %U.loc6_35.2 (constants.%U)]
  1321. // CHECK:STDOUT: %x.param: @ImplicitNotDeducible.%T.loc6_25.2 (%T) = value_param runtime_param0
  1322. // CHECK:STDOUT: %x: @ImplicitNotDeducible.%T.loc6_25.2 (%T) = bind_name x, %x.param
  1323. // CHECK:STDOUT: %return.param: ref @ImplicitNotDeducible.%U.loc6_35.2 (%U) = out_param runtime_param1
  1324. // CHECK:STDOUT: %return: ref @ImplicitNotDeducible.%U.loc6_35.2 (%U) = return_slot %return.param
  1325. // CHECK:STDOUT: }
  1326. // CHECK:STDOUT: %CallImplicitNotDeducible.decl: %CallImplicitNotDeducible.type = fn_decl @CallImplicitNotDeducible [template = constants.%CallImplicitNotDeducible] {} {}
  1327. // CHECK:STDOUT: }
  1328. // CHECK:STDOUT:
  1329. // CHECK:STDOUT: generic fn @ImplicitNotDeducible(%T.loc6_25.1: type, %U.loc6_35.1: type) {
  1330. // CHECK:STDOUT: %T.loc6_25.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc6_25.2 (constants.%T)]
  1331. // CHECK:STDOUT: %T.patt.loc6_25.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_25.2 (constants.%T.patt)]
  1332. // CHECK:STDOUT: %U.loc6_35.2: type = bind_symbolic_name U, 1 [symbolic = %U.loc6_35.2 (constants.%U)]
  1333. // CHECK:STDOUT: %U.patt.loc6_35.2: type = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc6_35.2 (constants.%U.patt)]
  1334. // CHECK:STDOUT:
  1335. // 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);
  1336. // CHECK:STDOUT: }
  1337. // CHECK:STDOUT:
  1338. // CHECK:STDOUT: fn @CallImplicitNotDeducible() {
  1339. // CHECK:STDOUT: !entry:
  1340. // CHECK:STDOUT: %ImplicitNotDeducible.ref: %ImplicitNotDeducible.type = name_ref ImplicitNotDeducible, file.%ImplicitNotDeducible.decl [template = constants.%ImplicitNotDeducible]
  1341. // CHECK:STDOUT: %.loc16: Core.IntLiteral = int_value 42 [template = constants.%.1]
  1342. // CHECK:STDOUT: return
  1343. // CHECK:STDOUT: }
  1344. // CHECK:STDOUT:
  1345. // CHECK:STDOUT: specific @ImplicitNotDeducible(constants.%T, constants.%U) {
  1346. // CHECK:STDOUT: %T.loc6_25.2 => constants.%T
  1347. // CHECK:STDOUT: %T.patt.loc6_25.2 => constants.%T
  1348. // CHECK:STDOUT: %U.loc6_35.2 => constants.%U
  1349. // CHECK:STDOUT: %U.patt.loc6_35.2 => constants.%U
  1350. // CHECK:STDOUT: }
  1351. // CHECK:STDOUT:
  1352. // CHECK:STDOUT: --- fail_deduce_inconsistent.carbon
  1353. // CHECK:STDOUT:
  1354. // CHECK:STDOUT: constants {
  1355. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  1356. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  1357. // CHECK:STDOUT: %ImplicitNotDeducible.type: type = fn_type @ImplicitNotDeducible [template]
  1358. // CHECK:STDOUT: %ImplicitNotDeducible: %ImplicitNotDeducible.type = struct_value () [template]
  1359. // CHECK:STDOUT: %CallImplicitNotDeducible.type: type = fn_type @CallImplicitNotDeducible [template]
  1360. // CHECK:STDOUT: %CallImplicitNotDeducible: %CallImplicitNotDeducible.type = struct_value () [template]
  1361. // CHECK:STDOUT: %.1: Core.IntLiteral = int_value 42 [template]
  1362. // CHECK:STDOUT: %.2: Core.IntLiteral = int_value 12 [template]
  1363. // CHECK:STDOUT: %.3: type = struct_type {.x: Core.IntLiteral} [template]
  1364. // CHECK:STDOUT: }
  1365. // CHECK:STDOUT:
  1366. // CHECK:STDOUT: imports {
  1367. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  1368. // CHECK:STDOUT: import Core//prelude
  1369. // CHECK:STDOUT: import Core//prelude/...
  1370. // CHECK:STDOUT: }
  1371. // CHECK:STDOUT: }
  1372. // CHECK:STDOUT:
  1373. // CHECK:STDOUT: file {
  1374. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1375. // CHECK:STDOUT: .Core = imports.%Core
  1376. // CHECK:STDOUT: .ImplicitNotDeducible = %ImplicitNotDeducible.decl
  1377. // CHECK:STDOUT: .CallImplicitNotDeducible = %CallImplicitNotDeducible.decl
  1378. // CHECK:STDOUT: }
  1379. // CHECK:STDOUT: %Core.import = import Core
  1380. // CHECK:STDOUT: %ImplicitNotDeducible.decl: %ImplicitNotDeducible.type = fn_decl @ImplicitNotDeducible [template = constants.%ImplicitNotDeducible] {
  1381. // CHECK:STDOUT: %T.patt.loc4_25.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_25.2 (constants.%T.patt)]
  1382. // 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)]
  1383. // CHECK:STDOUT: %x.patt: @ImplicitNotDeducible.%T.loc4_25.2 (%T) = binding_pattern x
  1384. // CHECK:STDOUT: %x.param_patt: @ImplicitNotDeducible.%T.loc4_25.2 (%T) = value_param_pattern %x.patt, runtime_param0
  1385. // CHECK:STDOUT: %y.patt: @ImplicitNotDeducible.%T.loc4_25.2 (%T) = binding_pattern y
  1386. // CHECK:STDOUT: %y.param_patt: @ImplicitNotDeducible.%T.loc4_25.2 (%T) = value_param_pattern %y.patt, runtime_param1
  1387. // CHECK:STDOUT: %return.patt: @ImplicitNotDeducible.%T.loc4_25.2 (%T) = return_slot_pattern
  1388. // CHECK:STDOUT: %return.param_patt: @ImplicitNotDeducible.%T.loc4_25.2 (%T) = out_param_pattern %return.patt, runtime_param2
  1389. // CHECK:STDOUT: } {
  1390. // CHECK:STDOUT: %T.ref.loc4_38: type = name_ref T, %T.loc4_25.1 [symbolic = %T.loc4_25.2 (constants.%T)]
  1391. // CHECK:STDOUT: %T.ref.loc4_44: type = name_ref T, %T.loc4_25.1 [symbolic = %T.loc4_25.2 (constants.%T)]
  1392. // CHECK:STDOUT: %T.ref.loc4_50: type = name_ref T, %T.loc4_25.1 [symbolic = %T.loc4_25.2 (constants.%T)]
  1393. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  1394. // CHECK:STDOUT: %T.loc4_25.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc4_25.2 (constants.%T)]
  1395. // CHECK:STDOUT: %x.param: @ImplicitNotDeducible.%T.loc4_25.2 (%T) = value_param runtime_param0
  1396. // CHECK:STDOUT: %x: @ImplicitNotDeducible.%T.loc4_25.2 (%T) = bind_name x, %x.param
  1397. // CHECK:STDOUT: %y.param: @ImplicitNotDeducible.%T.loc4_25.2 (%T) = value_param runtime_param1
  1398. // CHECK:STDOUT: %y: @ImplicitNotDeducible.%T.loc4_25.2 (%T) = bind_name y, %y.param
  1399. // CHECK:STDOUT: %return.param: ref @ImplicitNotDeducible.%T.loc4_25.2 (%T) = out_param runtime_param2
  1400. // CHECK:STDOUT: %return: ref @ImplicitNotDeducible.%T.loc4_25.2 (%T) = return_slot %return.param
  1401. // CHECK:STDOUT: }
  1402. // CHECK:STDOUT: %CallImplicitNotDeducible.decl: %CallImplicitNotDeducible.type = fn_decl @CallImplicitNotDeducible [template = constants.%CallImplicitNotDeducible] {} {}
  1403. // CHECK:STDOUT: }
  1404. // CHECK:STDOUT:
  1405. // CHECK:STDOUT: generic fn @ImplicitNotDeducible(%T.loc4_25.1: type) {
  1406. // CHECK:STDOUT: %T.loc4_25.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_25.2 (constants.%T)]
  1407. // CHECK:STDOUT: %T.patt.loc4_25.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_25.2 (constants.%T.patt)]
  1408. // CHECK:STDOUT:
  1409. // 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);
  1410. // CHECK:STDOUT: }
  1411. // CHECK:STDOUT:
  1412. // CHECK:STDOUT: fn @CallImplicitNotDeducible() {
  1413. // CHECK:STDOUT: !entry:
  1414. // CHECK:STDOUT: %ImplicitNotDeducible.ref: %ImplicitNotDeducible.type = name_ref ImplicitNotDeducible, file.%ImplicitNotDeducible.decl [template = constants.%ImplicitNotDeducible]
  1415. // CHECK:STDOUT: %.loc13_24: Core.IntLiteral = int_value 42 [template = constants.%.1]
  1416. // CHECK:STDOUT: %.loc13_34: Core.IntLiteral = int_value 12 [template = constants.%.2]
  1417. // CHECK:STDOUT: %.loc13_36: %.3 = struct_literal (%.loc13_34)
  1418. // CHECK:STDOUT: return
  1419. // CHECK:STDOUT: }
  1420. // CHECK:STDOUT:
  1421. // CHECK:STDOUT: specific @ImplicitNotDeducible(constants.%T) {
  1422. // CHECK:STDOUT: %T.loc4_25.2 => constants.%T
  1423. // CHECK:STDOUT: %T.patt.loc4_25.2 => constants.%T
  1424. // CHECK:STDOUT: }
  1425. // CHECK:STDOUT: