Merge branch 'trunk' into refcount

This commit is contained in:
Richard Feldman 2020-08-09 22:32:26 -04:00 committed by GitHub
commit 695408e74e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 6 deletions

View file

@ -202,7 +202,7 @@ pub fn gen(
let proc = PartialProc { let proc = PartialProc {
annotation: def.expr_var, annotation: def.expr_var,
// This is a 0-arity thunk, so it has no arguments. // This is a 0-arity thunk, so it has no arguments.
pattern_symbols: bumpalo::collections::Vec::new_in(arena), pattern_symbols: &[],
body, body,
}; };

View file

@ -1349,7 +1349,17 @@ fn parse_and_constrain<'a>(
); );
let canonicalize_end = SystemTime::now(); let canonicalize_end = SystemTime::now();
let (module, declarations, ident_ids, constraint, problems) = match canonicalized { let (module, declarations, ident_ids, constraint, problems) = match canonicalized {
Ok(module_output) => { Ok(mut module_output) => {
// Add builtin defs (e.g. List.get) to the module's defs
let builtin_defs = roc_can::builtins::builtin_defs(&mut var_store);
let references = &module_output.references;
for (symbol, def) in builtin_defs {
if references.contains(&symbol) {
module_output.declarations.push(Declaration::Builtin(def));
}
}
let constraint = constrain_module(&module_output, module_id, mode, &mut var_store); let constraint = constrain_module(&module_output, module_id, mode, &mut var_store);
// Now that we're done with parsing, canonicalization, and constraint gen, // Now that we're done with parsing, canonicalization, and constraint gen,

View file

@ -15,7 +15,7 @@ use std::collections::HashMap;
#[derive(Clone, Debug, PartialEq)] #[derive(Clone, Debug, PartialEq)]
pub struct PartialProc<'a> { pub struct PartialProc<'a> {
pub annotation: Variable, pub annotation: Variable,
pub pattern_symbols: Vec<'a, Symbol>, pub pattern_symbols: &'a [Symbol],
pub body: roc_can::expr::Expr, pub body: roc_can::expr::Expr,
} }
@ -426,7 +426,7 @@ fn patterns_to_when<'a>(
) -> Result< ) -> Result<
( (
Vec<'a, Variable>, Vec<'a, Variable>,
Vec<'a, Symbol>, &'a [Symbol],
Located<roc_can::expr::Expr>, Located<roc_can::expr::Expr>,
), ),
Located<RuntimeError>, Located<RuntimeError>,
@ -483,7 +483,7 @@ fn patterns_to_when<'a>(
} }
match body { match body {
Ok(body) => Ok((arg_vars, symbols, body)), Ok(body) => Ok((arg_vars, symbols.into_bump_slice(), body)),
Err(loc_error) => Err(loc_error), Err(loc_error) => Err(loc_error),
} }
} }

View file

@ -1,7 +1,7 @@
#[link(name = "roc_app", kind = "static")] #[link(name = "roc_app", kind = "static")]
extern "C" { extern "C" {
#[allow(improper_ctypes)] #[allow(improper_ctypes)]
#[link_name = "$Test.main"] #[link_name = "$main"]
fn list_from_roc() -> Box<[i64]>; fn list_from_roc() -> Box<[i64]>;
} }