mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-10 10:02:38 +03:00
WIP
This commit is contained in:
parent
9ff882751a
commit
edfc96628e
@ -322,8 +322,10 @@ pub fn constrain_expr(
|
||||
arguments,
|
||||
loc_body: boxed,
|
||||
captured_symbols,
|
||||
name,
|
||||
..
|
||||
} => {
|
||||
dbg!(name, &captured_symbols);
|
||||
let loc_body_expr = &**boxed;
|
||||
let mut state = PatternState {
|
||||
headers: SendMap::default(),
|
||||
|
@ -1841,6 +1841,7 @@ pub fn build_proc_header<'a, 'ctx, 'env>(
|
||||
let args = proc.args;
|
||||
let arena = env.arena;
|
||||
let context = &env.context;
|
||||
|
||||
let ret_type = basic_type_from_layout(arena, context, &proc.ret_layout, env.ptr_bytes);
|
||||
let mut arg_basic_types = Vec::with_capacity_in(args.len(), arena);
|
||||
let mut arg_symbols = Vec::new_in(arena);
|
||||
|
@ -972,4 +972,34 @@ mod gen_primitives {
|
||||
i64
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn io_poc() {
|
||||
use roc_std::RocStr;
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
app Test provides [ main ] imports []
|
||||
|
||||
Effect a : [ @Effect ({} -> a) ]
|
||||
|
||||
succeed : a -> Effect a
|
||||
succeed = \x -> @Effect \{} -> x
|
||||
|
||||
foo : Effect Float
|
||||
foo =
|
||||
succeed 3.14
|
||||
|
||||
runEffect : Effect a -> a
|
||||
runEffect = \@Effect thunk -> thunk {}
|
||||
|
||||
main =
|
||||
runEffect foo
|
||||
|
||||
"#
|
||||
),
|
||||
RocStr::from_slice(&"Foo".as_bytes()),
|
||||
RocStr
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -191,6 +191,7 @@ pub fn helper<'a>(
|
||||
// because their bodies may reference each other.
|
||||
let mut scope = Scope::default();
|
||||
for ((symbol, layout), proc) in procedures.drain() {
|
||||
dbg!(&symbol, &layout);
|
||||
let fn_val = build_proc_header(&env, &mut layout_ids, symbol, &layout, &proc);
|
||||
|
||||
if proc.args.is_empty() {
|
||||
@ -229,7 +230,8 @@ pub fn helper<'a>(
|
||||
mode,
|
||||
);
|
||||
|
||||
fn_val.print_to_stderr();
|
||||
// fn_val.print_to_stderr();
|
||||
module.print_to_stderr();
|
||||
|
||||
panic!(
|
||||
"The preceding code was from {:?}, which failed LLVM verification in {} build.",
|
||||
@ -347,7 +349,7 @@ macro_rules! assert_evals_to {
|
||||
assert_llvm_evals_to!($src, $expected, $ty, $transform, $leak);
|
||||
}
|
||||
{
|
||||
assert_opt_evals_to!($src, $expected, $ty, $transform, $leak);
|
||||
// assert_opt_evals_to!($src, $expected, $ty, $transform, $leak);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -1440,7 +1440,7 @@ fn update<'a>(
|
||||
{
|
||||
// state.timings.insert(module_id, module_timing);
|
||||
|
||||
Proc::insert_refcount_operations(arena, &mut state.procedures);
|
||||
// Proc::insert_refcount_operations(arena, &mut state.procedures);
|
||||
|
||||
msg_tx
|
||||
.send(Msg::FinishedAllSpecialization {
|
||||
|
@ -2350,6 +2350,8 @@ pub fn with_hole<'a>(
|
||||
Located::at_zero(roc_can::pattern::Pattern::Identifier(record_symbol)),
|
||||
)];
|
||||
|
||||
dbg!("aaaa");
|
||||
|
||||
match procs.insert_anonymous(
|
||||
env,
|
||||
name,
|
||||
@ -2491,6 +2493,7 @@ pub fn with_hole<'a>(
|
||||
} => {
|
||||
let loc_body = *boxed_body;
|
||||
|
||||
dbg!("bbb");
|
||||
match procs.insert_anonymous(
|
||||
env,
|
||||
name,
|
||||
|
@ -1155,13 +1155,18 @@ fn adjust_rank_content(
|
||||
Func(arg_vars, closure_var, ret_var) => {
|
||||
let mut rank = adjust_rank(subs, young_mark, visit_mark, group_rank, ret_var);
|
||||
|
||||
rank = rank.max(adjust_rank(
|
||||
subs,
|
||||
young_mark,
|
||||
visit_mark,
|
||||
group_rank,
|
||||
closure_var,
|
||||
));
|
||||
// TODO investigate further.
|
||||
//
|
||||
// My theory is that because the closure_var contains variables already
|
||||
// contained in the signature only, it does not need to be part of the rank
|
||||
// calculuation
|
||||
// rank = rank.max(adjust_rank(
|
||||
// subs,
|
||||
// young_mark,
|
||||
// visit_mark,
|
||||
// group_rank,
|
||||
// closure_var,
|
||||
// ));
|
||||
|
||||
for var in arg_vars {
|
||||
rank = rank.max(adjust_rank(subs, young_mark, visit_mark, group_rank, var));
|
||||
|
Loading…
Reference in New Issue
Block a user