mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-18 09:39:47 +00:00
A couple hacks to get deriving of records working.. but it's working?
This commit is contained in:
parent
801803d813
commit
63adb901b4
8 changed files with 156 additions and 104 deletions
|
@ -162,7 +162,6 @@ impl<'a> DeclarationToIndex<'a> {
|
|||
}
|
||||
}
|
||||
}
|
||||
dbg!(&self.elements);
|
||||
unreachable!(
|
||||
"symbol/layout {:?} {:#?} combo must be in DeclarationToIndex",
|
||||
needle_symbol, needle_layout
|
||||
|
|
|
@ -2932,16 +2932,7 @@ fn specialize_external<'a>(
|
|||
let snapshot = env.subs.snapshot();
|
||||
let cache_snapshot = layout_cache.snapshot();
|
||||
|
||||
let ann = roc_types::subs::SubsFmtContent(
|
||||
env.subs
|
||||
.get_content_without_compacting(partial_proc.annotation),
|
||||
env.subs,
|
||||
);
|
||||
let spec =
|
||||
roc_types::subs::SubsFmtContent(env.subs.get_content_without_compacting(fn_var), env.subs);
|
||||
dbg!(ann, spec);
|
||||
let _unified = env.unify(partial_proc.annotation, fn_var);
|
||||
dbg!("done");
|
||||
|
||||
// This will not hold for programs with type errors
|
||||
// let is_valid = matches!(unified, roc_unify::unify::Unified::Success(_));
|
||||
|
@ -4758,12 +4749,6 @@ pub fn with_hole<'a>(
|
|||
|
||||
match loc_expr.value {
|
||||
roc_can::expr::Expr::Var(proc_name) if is_known(proc_name) => {
|
||||
dbg!(proc_name);
|
||||
dbg!(roc_types::subs::SubsFmtContent(
|
||||
env.subs.get_content_without_compacting(fn_var),
|
||||
&env.subs
|
||||
));
|
||||
|
||||
// a call by a known name
|
||||
call_by_name(
|
||||
env,
|
||||
|
@ -7586,6 +7571,10 @@ fn call_by_name<'a>(
|
|||
hole: &'a Stmt<'a>,
|
||||
) -> Stmt<'a> {
|
||||
// Register a pending_specialization for this function
|
||||
// dbg!(roc_types::subs::SubsFmtContent(
|
||||
// env.subs.get_content_without_compacting(fn_var),
|
||||
// env.subs
|
||||
// ));
|
||||
match layout_cache.raw_from_var(env.arena, fn_var, env.subs) {
|
||||
Err(LayoutProblem::UnresolvedTypeVar(var)) => {
|
||||
let msg = format!(
|
||||
|
@ -7811,7 +7800,11 @@ fn call_by_name_help<'a>(
|
|||
assigned,
|
||||
hole,
|
||||
)
|
||||
} else if env.is_imported_symbol(proc_name.name()) {
|
||||
} else if env.is_imported_symbol(proc_name.name())
|
||||
// TODO HACK FIXME
|
||||
|| (proc_name.name().module_id() == ModuleId::DERIVED
|
||||
&& !procs.partial_procs.contains_key(proc_name.name()))
|
||||
{
|
||||
add_needed_external(procs, env, original_fn_var, proc_name);
|
||||
|
||||
debug_assert_ne!(proc_name.name().module_id(), ModuleId::ATTR);
|
||||
|
|
|
@ -1236,20 +1236,6 @@ impl<'a> Layout<'a> {
|
|||
match content {
|
||||
FlexVar(_) | RigidVar(_) => Err(LayoutProblem::UnresolvedTypeVar(var)),
|
||||
FlexAbleVar(_, _) | RigidAbleVar(_, _) => {
|
||||
unsafe {
|
||||
dbg!(
|
||||
roc_types::subs::SubsFmtContent(
|
||||
env.subs
|
||||
.get_content_without_compacting(Variable::from_index(1217)),
|
||||
&env.subs
|
||||
),
|
||||
roc_types::subs::SubsFmtContent(
|
||||
env.subs
|
||||
.get_content_without_compacting(Variable::from_index(1224)),
|
||||
&env.subs
|
||||
),
|
||||
);
|
||||
}
|
||||
todo_abilities!("Not reachable yet")
|
||||
}
|
||||
RecursionVar { structure, .. } => {
|
||||
|
@ -2115,13 +2101,6 @@ fn layout_from_flat_type<'a>(
|
|||
}
|
||||
}
|
||||
Func(_, closure_var, _) => {
|
||||
dbg!(
|
||||
closure_var,
|
||||
roc_types::subs::SubsFmtContent(
|
||||
env.subs.get_content_without_compacting(closure_var),
|
||||
&subs
|
||||
)
|
||||
);
|
||||
let lambda_set =
|
||||
LambdaSet::from_var(env.arena, env.subs, closure_var, env.target_info)?;
|
||||
|
||||
|
@ -2139,13 +2118,6 @@ fn layout_from_flat_type<'a>(
|
|||
for (label, field) in it {
|
||||
match field {
|
||||
RecordField::Required(field_var) | RecordField::Demanded(field_var) => {
|
||||
dbg!(
|
||||
label,
|
||||
roc_types::subs::SubsFmtContent(
|
||||
subs.get_content_without_compacting(field_var),
|
||||
subs
|
||||
)
|
||||
);
|
||||
sortables.push((label, Layout::from_var(env, field_var)?));
|
||||
}
|
||||
RecordField::Optional(_) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue