mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
clippy fixes
This commit is contained in:
parent
cbe78593c2
commit
defa408e83
5 changed files with 55 additions and 23 deletions
|
@ -256,8 +256,6 @@ pub fn canonicalize_module_defs<'a>(
|
||||||
fix_values_captured_in_closure_defs(defs, &mut MutSet::default())
|
fix_values_captured_in_closure_defs(defs, &mut MutSet::default())
|
||||||
}
|
}
|
||||||
InvalidCycle(_, _) | Builtin(_) => {}
|
InvalidCycle(_, _) | Builtin(_) => {}
|
||||||
|
|
||||||
_ => todo!(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,11 +295,45 @@ fn fix_values_captured_in_closure_defs(
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fix_values_captured_in_closure_pattern(
|
fn fix_values_captured_in_closure_pattern(
|
||||||
expr: &mut crate::pattern::Pattern,
|
pattern: &mut crate::pattern::Pattern,
|
||||||
no_capture_symbols: &mut MutSet<Symbol>,
|
no_capture_symbols: &mut MutSet<Symbol>,
|
||||||
) {
|
) {
|
||||||
// TODO
|
use crate::pattern::Pattern::*;
|
||||||
return ();
|
|
||||||
|
match pattern {
|
||||||
|
AppliedTag {
|
||||||
|
arguments: loc_args,
|
||||||
|
..
|
||||||
|
} => {
|
||||||
|
for (_, loc_arg) in loc_args.iter_mut() {
|
||||||
|
fix_values_captured_in_closure_pattern(&mut loc_arg.value, no_capture_symbols);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RecordDestructure { destructs, .. } => {
|
||||||
|
for loc_destruct in destructs.iter_mut() {
|
||||||
|
use crate::pattern::DestructType::*;
|
||||||
|
match &mut loc_destruct.value.typ {
|
||||||
|
Required => {}
|
||||||
|
Optional(_, loc_expr) => {
|
||||||
|
fix_values_captured_in_closure_expr(&mut loc_expr.value, no_capture_symbols)
|
||||||
|
}
|
||||||
|
Guard(_, loc_pattern) => fix_values_captured_in_closure_pattern(
|
||||||
|
&mut loc_pattern.value,
|
||||||
|
no_capture_symbols,
|
||||||
|
),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Identifier(_)
|
||||||
|
| NumLiteral(_, _)
|
||||||
|
| IntLiteral(_)
|
||||||
|
| FloatLiteral(_)
|
||||||
|
| StrLiteral(_)
|
||||||
|
| Underscore
|
||||||
|
| Shadowed(_, _)
|
||||||
|
| MalformedPattern(_, _)
|
||||||
|
| UnsupportedPattern(_) => (),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fix_values_captured_in_closure_expr(
|
fn fix_values_captured_in_closure_expr(
|
||||||
|
|
|
@ -733,7 +733,6 @@ pub fn constrain_expr(
|
||||||
let ret_type = Type::Variable(ret_var);
|
let ret_type = Type::Variable(ret_var);
|
||||||
let closure_var = *closure_var;
|
let closure_var = *closure_var;
|
||||||
let closure_ext_var = *closure_ext_var;
|
let closure_ext_var = *closure_ext_var;
|
||||||
let closure_type = Type::Variable(closure_var);
|
|
||||||
|
|
||||||
vars.push(ret_var);
|
vars.push(ret_var);
|
||||||
vars.push(closure_var);
|
vars.push(closure_var);
|
||||||
|
|
|
@ -1935,7 +1935,7 @@ fn run_solve<'a>(
|
||||||
..
|
..
|
||||||
} = module;
|
} = module;
|
||||||
|
|
||||||
let (mut solved_subs, solved_env, problems) =
|
let (solved_subs, solved_env, problems) =
|
||||||
roc_solve::module::run_solve(aliases, rigid_variables, constraint, var_store);
|
roc_solve::module::run_solve(aliases, rigid_variables, constraint, var_store);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#![allow(clippy::large_enum_variant)]
|
#![allow(clippy::large_enum_variant)]
|
||||||
|
|
||||||
pub mod borrow;
|
pub mod borrow;
|
||||||
pub mod closures;
|
|
||||||
pub mod inc_dec;
|
pub mod inc_dec;
|
||||||
pub mod ir;
|
pub mod ir;
|
||||||
pub mod layout;
|
pub mod layout;
|
||||||
|
|
|
@ -112,8 +112,8 @@ mod test_mono {
|
||||||
let expected_lines = expected.split("\n").collect::<Vec<&str>>();
|
let expected_lines = expected.split("\n").collect::<Vec<&str>>();
|
||||||
let result_lines = result.split("\n").collect::<Vec<&str>>();
|
let result_lines = result.split("\n").collect::<Vec<&str>>();
|
||||||
|
|
||||||
assert_eq!(expected_lines, result_lines);
|
// assert_eq!(expected_lines, result_lines);
|
||||||
//assert_eq!(0, 1);
|
assert_eq!(0, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2103,23 +2103,25 @@ mod test_mono {
|
||||||
),
|
),
|
||||||
indoc!(
|
indoc!(
|
||||||
r#"
|
r#"
|
||||||
procedure Test.1 (Test.7):
|
procedure Test.1 (Test.5):
|
||||||
let Test.3 = 42i64;
|
let Test.2 = 42i64;
|
||||||
let Test.14 = FunctionPointer Test.4;
|
let Test.14 = FunctionPointer Test.3;
|
||||||
let Test.15 = Struct {Test.3};
|
let Test.15 = Struct {Test.2};
|
||||||
let Test.4 = Struct {Test.14, Test.15};
|
let Test.3 = Struct {Test.14, Test.15};
|
||||||
ret Test.4;
|
|
||||||
|
|
||||||
procedure Test.4 (Test.11, #Attr.12):
|
|
||||||
let Test.3 = Index 0 #Attr.12;
|
|
||||||
ret Test.3;
|
ret Test.3;
|
||||||
|
|
||||||
|
procedure Test.3 (Test.11, #Attr.12):
|
||||||
|
let Test.2 = Index 0 #Attr.12;
|
||||||
|
ret Test.2;
|
||||||
|
|
||||||
procedure Test.0 ():
|
procedure Test.0 ():
|
||||||
let Test.10 = Struct {};
|
let Test.10 = Struct {};
|
||||||
let Test.6 = CallByName Test.1 Test.10;
|
let Test.4 = CallByName Test.1 Test.10;
|
||||||
let Test.9 = Struct {};
|
let Test.7 = Struct {};
|
||||||
let Test.8 = CallByPointer Test.6 Test.9;
|
let Test.8 = Index 1 Test.4;
|
||||||
ret Test.8;
|
let Test.9 = Index 0 Test.4;
|
||||||
|
let Test.6 = CallByPointer Test.9 Test.7 Test.8;
|
||||||
|
ret Test.6;
|
||||||
"#
|
"#
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue