This commit is contained in:
Ayaz Hafiz 2022-05-03 19:38:25 -04:00
parent 5624c492da
commit b05874924f
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
4 changed files with 17 additions and 20 deletions

View file

@ -17,7 +17,7 @@ pub struct Symbol(u64);
// Set it to false if you want to see the raw ModuleId and IdentId ints,
// but please set it back to true before checking in the result!
#[cfg(debug_assertions)]
const PRETTY_PRINT_DEBUG_SYMBOLS: bool = false;
const PRETTY_PRINT_DEBUG_SYMBOLS: bool = true;
/// In Debug builds only, Symbol has a name() method that lets
/// you look up its name in a global intern table. This table is

View file

@ -51,20 +51,12 @@ pub fn deep_copy_type_vars_into_expr<'a>(
match expr {
Num(var, str, val, bound) => Num(sub!(*var), str.clone(), val.clone(), *bound),
Int(v1, v2, str, val, bound) => Int(
sub!(*v1),
sub!(*v2),
str.clone(),
val.clone(),
bound.clone(),
),
Float(v1, v2, str, val, bound) => Float(
sub!(*v1),
sub!(*v2),
str.clone(),
val.clone(),
bound.clone(),
),
Int(v1, v2, str, val, bound) => {
Int(sub!(*v1), sub!(*v2), str.clone(), val.clone(), *bound)
}
Float(v1, v2, str, val, bound) => {
Float(sub!(*v1), sub!(*v2), str.clone(), *val, *bound)
}
Str(str) => Str(str.clone()),
SingleQuote(char) => SingleQuote(*char),
List {
@ -491,7 +483,7 @@ fn deep_copy_type_vars<'a>(
// Everything else is a mechanical descent.
Structure(flat_type) => match flat_type {
EmptyRecord | EmptyTagUnion | Erroneous(_) => Structure(flat_type.clone()),
EmptyRecord | EmptyTagUnion | Erroneous(_) => Structure(flat_type),
Apply(symbol, arguments) => {
descend_slice!(arguments);

View file

@ -3193,6 +3193,7 @@ pub fn with_hole<'a>(
}
LetNonRec(def, cont, _) => {
if let roc_can::pattern::Pattern::Identifier(symbol) = def.loc_pattern.value {
dbg!(symbol);
if let Closure(closure_data) = def.loc_expr.value {
register_noncapturing_closure(env, procs, symbol, closure_data);
@ -3338,6 +3339,7 @@ pub fn with_hole<'a>(
)
}
Var(symbol) => {
dbg!(symbol);
specialize_naked_symbol(env, variable, procs, layout_cache, assigned, hole, symbol)
}
Tag {
@ -5438,6 +5440,7 @@ pub fn from_can<'a>(
}
LetNonRec(def, cont, outer_annotation) => {
if let roc_can::pattern::Pattern::Identifier(symbol) = &def.loc_pattern.value {
dbg!(symbol);
match def.loc_expr.value {
roc_can::expr::Expr::Closure(closure_data) => {
register_capturing_closure(env, procs, layout_cache, *symbol, closure_data);
@ -5572,8 +5575,7 @@ pub fn from_can<'a>(
let needs_def_specializations = procs
.needed_symbol_specializations
.keys()
.find(|(s, _)| s == symbol)
.is_some();
.any(|(s, _)| s == symbol);
if !needs_def_specializations {
return with_hole(
@ -6709,8 +6711,7 @@ fn possible_reuse_symbol_or_spec<'a>(
let needs_fresh_symbol = procs
.needed_symbol_specializations
.keys()
.find(|(s, _)| *s == symbol)
.is_some();
.any(|(s, _)| *s == symbol);
let (_, specialized_symbol) = procs
.needed_symbol_specializations

View file

@ -457,6 +457,10 @@ impl Pools {
self.0.len()
}
pub fn is_empty(&self) -> bool {
self.len() == 0
}
pub fn get_mut(&mut self, rank: Rank) -> &mut Vec<Variable> {
match self.0.get_mut(rank.into_usize()) {
Some(reference) => reference,