mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
cleanup
This commit is contained in:
parent
229d98483c
commit
55e1e86dc2
3 changed files with 17 additions and 10 deletions
|
@ -388,7 +388,7 @@ pub fn assert_correct_variable_usage(constraint: &Constraint) {
|
||||||
|
|
||||||
println!("difference: {:?}", &diff);
|
println!("difference: {:?}", &diff);
|
||||||
|
|
||||||
// panic!("variable usage problem (see stdout for details)");
|
panic!("variable usage problem (see stdout for details)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -601,7 +601,8 @@ fn write_boolean(env: &Env, boolean: Bool, subs: &Subs, buf: &mut String, parens
|
||||||
buf.push_str("Shared");
|
buf.push_str("Shared");
|
||||||
}
|
}
|
||||||
Bool::Container(cvar, mvars) if mvars.iter().all(|v| var_is_shared(subs, *v)) => {
|
Bool::Container(cvar, mvars) if mvars.iter().all(|v| var_is_shared(subs, *v)) => {
|
||||||
// Bool::Container(cvar, mvars) if mvars.is_empty() => {
|
debug_assert!(!var_is_shared(subs, cvar));
|
||||||
|
|
||||||
write_content(
|
write_content(
|
||||||
env,
|
env,
|
||||||
subs.get_without_compacting(cvar).content,
|
subs.get_without_compacting(cvar).content,
|
||||||
|
@ -611,8 +612,11 @@ fn write_boolean(env: &Env, boolean: Bool, subs: &Subs, buf: &mut String, parens
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Bool::Container(cvar, mvars) => {
|
Bool::Container(cvar, mvars) => {
|
||||||
|
debug_assert!(!var_is_shared(subs, cvar));
|
||||||
|
|
||||||
let mut buffers = Vec::with_capacity(mvars.len());
|
let mut buffers = Vec::with_capacity(mvars.len());
|
||||||
for v in mvars {
|
for v in mvars {
|
||||||
|
// don't print shared in a container
|
||||||
if var_is_shared(subs, v) {
|
if var_is_shared(subs, v) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -625,11 +629,10 @@ fn write_boolean(env: &Env, boolean: Bool, subs: &Subs, buf: &mut String, parens
|
||||||
&mut inner_buf,
|
&mut inner_buf,
|
||||||
parens,
|
parens,
|
||||||
);
|
);
|
||||||
// buffers_set.insert(inner_buf);
|
|
||||||
buffers.push(inner_buf);
|
buffers.push(inner_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
// let mut buffers: Vec<String> = buffers_set.into_iter().collect();
|
// sort type variables alphabetically
|
||||||
buffers.sort();
|
buffers.sort();
|
||||||
|
|
||||||
let combined = buffers.join(" | ");
|
let combined = buffers.join(" | ");
|
||||||
|
|
|
@ -67,10 +67,10 @@ macro_rules! mismatch {
|
||||||
type Pool = Vec<Variable>;
|
type Pool = Vec<Variable>;
|
||||||
|
|
||||||
pub struct Context {
|
pub struct Context {
|
||||||
pub first: Variable,
|
first: Variable,
|
||||||
pub first_desc: Descriptor,
|
first_desc: Descriptor,
|
||||||
pub second: Variable,
|
second: Variable,
|
||||||
pub second_desc: Descriptor,
|
second_desc: Descriptor,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -668,8 +668,10 @@ fn unify_flat_type(
|
||||||
outcome
|
outcome
|
||||||
}
|
}
|
||||||
(Container(cvar1, mvars1), Container(cvar2, mvars2)) => {
|
(Container(cvar1, mvars1), Container(cvar2, mvars2)) => {
|
||||||
|
let mut outcome = vec![];
|
||||||
|
|
||||||
// unify cvar1 and cvar2?
|
// unify cvar1 and cvar2?
|
||||||
unify_pool(subs, pool, *cvar1, *cvar2);
|
outcome.extend(unify_pool(subs, pool, *cvar1, *cvar2));
|
||||||
|
|
||||||
let mvars: SendSet<Variable> = mvars1
|
let mvars: SendSet<Variable> = mvars1
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
@ -689,7 +691,9 @@ fn unify_flat_type(
|
||||||
let content =
|
let content =
|
||||||
Content::Structure(FlatType::Boolean(Bool::Container(*cvar1, mvars)));
|
Content::Structure(FlatType::Boolean(Bool::Container(*cvar1, mvars)));
|
||||||
|
|
||||||
merge(subs, ctx, content)
|
outcome.extend(merge(subs, ctx, content));
|
||||||
|
|
||||||
|
outcome
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue