mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 07:14:46 +00:00
specialize substituted variables
This commit is contained in:
parent
b62de8fc3c
commit
a48f244cc7
1 changed files with 23 additions and 1 deletions
|
@ -14,7 +14,7 @@ use roc_types::subs::{Content, FlatType, Subs, Variable};
|
|||
use std::collections::HashMap;
|
||||
use ven_pretty::{BoxAllocator, DocAllocator, DocBuilder};
|
||||
|
||||
pub const PRETTY_PRINT_IR_SYMBOLS: bool = false;
|
||||
pub const PRETTY_PRINT_IR_SYMBOLS: bool = true;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub enum MonoProblem {
|
||||
|
@ -2173,6 +2173,17 @@ pub fn with_hole<'a>(
|
|||
if let roc_can::expr::Expr::Var(original) = def.loc_expr.value {
|
||||
substitute_in_exprs(env.arena, &mut stmt, symbol, original);
|
||||
|
||||
// if the substituted variable is a function, make sure we specialize it
|
||||
stmt = reuse_function_symbol(
|
||||
env,
|
||||
procs,
|
||||
layout_cache,
|
||||
Some(def.expr_var),
|
||||
original,
|
||||
stmt,
|
||||
original,
|
||||
);
|
||||
|
||||
stmt
|
||||
} else {
|
||||
with_hole(
|
||||
|
@ -3576,6 +3587,17 @@ pub fn from_can<'a>(
|
|||
// a variable is aliased
|
||||
substitute_in_exprs(env.arena, &mut rest, *symbol, original);
|
||||
|
||||
// if the substituted variable is a function, make sure we specialize it
|
||||
rest = reuse_function_symbol(
|
||||
env,
|
||||
procs,
|
||||
layout_cache,
|
||||
Some(def.expr_var),
|
||||
original,
|
||||
rest,
|
||||
original,
|
||||
);
|
||||
|
||||
return rest;
|
||||
}
|
||||
roc_can::expr::Expr::LetNonRec(nested_def, nested_cont, nested_annotation) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue