Remove ValueParamPattern case from deduction (#6869)

This case is redundant: when deducing against a runtime parameter
pattern, the type is all that matters, and the type is added to the
deduction earlier. Additionally deducing the same argument against
parameter's subpattern just creates duplicate work, because the
subpattern has the same type.
This commit is contained in:
Geoff Romer authored and GitHub committed 2026-03-10 21:15:38 +00:00
1 parent 6304df1db9
commit ba6257891e
28 files changed
+539 -744

No files matched your search

+2 -5
View File
@@ -290,6 +290,8 @@ auto DeductionContext::Deduce() -> bool {
// If the parameter has a symbolic type, deduce against that.
if (param_type_id.is_symbolic()) {
// TODO: This looks liable to add redundant work (possibly even
// exponential amounts of it) in some of the cases handled below.
Add(context().types().GetTypeInstId(param_type_id),
context().types().GetTypeInstId(
context().insts().Get(arg_id).type_id()));
@@ -401,11 +403,6 @@ auto DeductionContext::Deduce() -> bool {
continue;
}
case CARBON_KIND(SemIR::ValueParamPattern pattern): {
Add(pattern.subpattern_id, arg_id);
continue;
}
case SemIR::StructValue::Kind:
// TODO: Match field name order between param and arg.
break;