Skip to content

Commit 9c7a310

Browse files
committed
Add match rule for Bound/Implicit
1 parent fcca531 commit 9c7a310

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

compiler-core/checking/src/algorithm/constraint.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,15 @@ fn match_given_type(state: &mut CheckState, wanted: TypeId, given: TypeId) -> Ma
584584
}
585585
}
586586

587+
// Implicit and Bound variables at the same level represent the same
588+
// logical variable. Implicit produces them, Bound consumes them.
589+
(Type::Variable(Variable::Implicit(w_level)), Type::Variable(Variable::Bound(g_level)))
590+
| (Type::Variable(Variable::Bound(w_level)), Type::Variable(Variable::Implicit(g_level)))
591+
if w_level == g_level =>
592+
{
593+
MatchType::Match
594+
}
595+
587596
_ => MatchType::Apart,
588597
}
589598
}

0 commit comments

Comments
 (0)