Don't include DelayedAlias in illegal cycle checks

This commit is contained in:
Ayaz Hafiz 2022-07-10 13:53:41 -04:00
parent 25ba744cdd
commit c211ec9790
No known key found for this signature in database
GPG Key ID: 0E2A37416A25EF58
2 changed files with 19 additions and 0 deletions

View File

@ -7324,4 +7324,21 @@ mod solve_expr {
"OList",
);
}
#[test]
fn rosetree_with_result_is_legal_recursive_type() {
infer_eq_without_problem(
indoc!(
r#"
Rose a : [Rose (Result (List (Rose a)) I64)]
x : Rose I64
x = Rose (Ok [])
x
"#
),
"Rose I64",
);
}
}

View File

@ -1482,6 +1482,8 @@ impl Type {
Type::Apply(Symbol::LIST_LIST | Symbol::SET_SET, _, _) => false,
Type::Apply(..) => internal_error!("cannot chase an Apply!"),
Type::Alias { .. } => internal_error!("should be dealiased"),
// Must be conservative here because we don't know what the alias expands to yet
Type::DelayedAlias(..) => false,
// Non-composite types are trivially narrow
_ => true,
}