Skip to content

Commit e855440

Browse files
committed
fix: distinguish different type parameters in subtyping
1 parent c160774 commit e855440

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/rty/subtyping.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ where
7171
(Type::Int, Type::Int)
7272
| (Type::Bool, Type::Bool)
7373
| (Type::String, Type::String)
74-
| (Type::Never, Type::Never)
75-
| (Type::Param(_), Type::Param(_)) => {}
74+
| (Type::Never, Type::Never) => {}
7675
(Type::Enum(got), Type::Enum(expected)) if got.symbol() == expected.symbol() => {
7776
for (got_ty, expected_ty) in got.args.iter().zip(expected.args.iter()) {
7877
let cs = self.relate_sub_refined_type(got_ty, expected_ty);
@@ -121,6 +120,7 @@ where
121120
let cs2 = self.relate_sub_refined_type(&got.elem, &expected.elem);
122121
clauses.extend(cs2);
123122
}
123+
(Type::Param(got), Type::Param(expected)) if got.idx == expected.idx => {}
124124
_ => panic!(
125125
"inconsistent types: got={}, expected={}",
126126
got.display(),

0 commit comments

Comments
 (0)