Expose type mismatches between recursive types and types that aren't

Closes #2166
This commit is contained in:
ayazhafiz 2022-01-30 00:21:45 -05:00
parent ee05d13802
commit e54917a063
2 changed files with 43 additions and 1 deletions

View file

@ -285,7 +285,12 @@ fn unify_structure(
// unify the structure with this unrecursive tag union
unify_pool(subs, pool, ctx.first, *structure, ctx.mode)
}
_ => todo!("rec structure {:?}", &flat_type),
// Only tag unions can be recursive; everything else is an error.
_ => mismatch!(
"trying to unify {:?} with recursive type var {:?}",
&flat_type,
structure
),
},
Structure(ref other_flat_type) => {