mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-10 10:02:38 +03:00
add tests for the rigid issue
This commit is contained in:
parent
22592eff80
commit
21685b6f8f
@ -11,6 +11,7 @@ use roc_region::all::{Located, Region};
|
||||
use roc_types::subs::Variable;
|
||||
use roc_types::types::{Category, PReason, PatternCategory, Reason, RecordField, Type};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct PatternState {
|
||||
pub headers: SendMap<Symbol, Located<Type>>,
|
||||
pub vars: Vec<Variable>,
|
||||
|
@ -1148,7 +1148,7 @@ mod gen_primitives {
|
||||
|
||||
ConsList a : [ Cons a (ConsList a), Nil ]
|
||||
|
||||
# isEmpty : ConsList a -> Bool
|
||||
isEmpty : ConsList a -> Bool
|
||||
isEmpty = \list ->
|
||||
when list is
|
||||
Cons _ _ ->
|
||||
|
@ -3106,4 +3106,33 @@ mod solve_expr {
|
||||
"Dict Int Int",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rbtree_insert() {
|
||||
// exposed an issue where pattern variables were not introduced
|
||||
// at the correct level in the constraint
|
||||
//
|
||||
// see 22592eff805511fbe1da63849771ee5f367a6a16
|
||||
infer_eq_without_problem(
|
||||
indoc!(
|
||||
r#"
|
||||
app Test provides [ main ] imports []
|
||||
|
||||
Dict k : [ Node k (Dict k), Empty ]
|
||||
|
||||
balance : Dict k -> Dict k
|
||||
balance = \left ->
|
||||
when left is
|
||||
Node _ Empty -> Empty
|
||||
|
||||
_ -> Empty
|
||||
|
||||
main : Dict {}
|
||||
main =
|
||||
balance Empty
|
||||
"#
|
||||
),
|
||||
"Dict {}",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user