mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 11:11:05 +01:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user