mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
no more errors
This commit is contained in:
parent
43fc0f87ad
commit
ea62f15ac6
5 changed files with 38 additions and 5 deletions
|
@ -20,7 +20,7 @@ enum FieldVar {
|
||||||
OnlyVar(Variable),
|
OnlyVar(Variable),
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn canonicalize_fields<'a>(
|
pub (crate) fn canonicalize_fields<'a>(
|
||||||
env: &mut Env<'a>,
|
env: &mut Env<'a>,
|
||||||
scope: &mut Scope,
|
scope: &mut Scope,
|
||||||
fields: &'a [Located<roc_parse::ast::AssignedField<'a, roc_parse::ast::Expr<'a>>>],
|
fields: &'a [Located<roc_parse::ast::AssignedField<'a, roc_parse::ast::Expr<'a>>>],
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use bumpalo::Bump;
|
use bumpalo::Bump;
|
||||||
use bumpalo::collections::Vec as BumpVec;
|
use bumpalo::collections::Vec as BumpVec;
|
||||||
use roc_parse::pattern::PatternType;
|
use roc_parse::{parser::SyntaxError, pattern::PatternType};
|
||||||
use roc_region::all::Region;
|
use roc_region::all::Region;
|
||||||
|
|
||||||
use crate::lang::{core::{expr::expr_to_expr2::loc_expr_to_expr2, pattern::to_pattern2}, env::Env, scope::Scope};
|
use crate::lang::{core::{expr::expr_to_expr2::loc_expr_to_expr2, pattern::to_pattern2}, env::Env, scope::Scope};
|
||||||
|
@ -72,4 +72,23 @@ pub fn to_def2_from_def<'a>(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn str_to_def2<'a>(
|
||||||
|
arena: &'a Bump,
|
||||||
|
input: &'a str,
|
||||||
|
env: &mut Env<'a>,
|
||||||
|
scope: &mut Scope,
|
||||||
|
region: Region,
|
||||||
|
) -> Result<Vec<Def2>, SyntaxError<'a>> {
|
||||||
|
match roc_parse::test_helpers::parse_defs_with(arena, input.trim()) {
|
||||||
|
Ok(vec_loc_def) => Ok(defs_to_defs2(
|
||||||
|
arena,
|
||||||
|
env,
|
||||||
|
scope,
|
||||||
|
arena.alloc(vec_loc_def),
|
||||||
|
region,
|
||||||
|
)),
|
||||||
|
Err(fail) => Err(fail),
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -3,6 +3,7 @@ use roc_can::expr::Recursive;
|
||||||
use roc_can::num::{finish_parsing_base, finish_parsing_float, finish_parsing_int};
|
use roc_can::num::{finish_parsing_base, finish_parsing_float, finish_parsing_int};
|
||||||
use roc_can::operator::desugar_expr;
|
use roc_can::operator::desugar_expr;
|
||||||
use roc_collections::all::MutSet;
|
use roc_collections::all::MutSet;
|
||||||
|
use roc_parse::parser::SyntaxError;
|
||||||
use roc_parse::{ast::Expr, pattern::PatternType};
|
use roc_parse::{ast::Expr, pattern::PatternType};
|
||||||
use roc_problem::can::{Problem, RuntimeError};
|
use roc_problem::can::{Problem, RuntimeError};
|
||||||
use roc_module::symbol::Symbol;
|
use roc_module::symbol::Symbol;
|
||||||
|
@ -18,6 +19,19 @@ use crate::{lang::{core::expr::expr2::{ExprId, FloatVal, IntStyle, IntVal}, env:
|
||||||
use crate::canonicalize::canonicalize::{CanonicalizeRecordProblem, canonicalize_fields, canonicalize_lookup, canonicalize_when_branch};
|
use crate::canonicalize::canonicalize::{CanonicalizeRecordProblem, canonicalize_fields, canonicalize_lookup, canonicalize_when_branch};
|
||||||
use super::{expr2::Expr2, output::Output};
|
use super::{expr2::Expr2, output::Output};
|
||||||
|
|
||||||
|
pub fn str_to_expr2<'a>(
|
||||||
|
arena: &'a Bump,
|
||||||
|
input: &'a str,
|
||||||
|
env: &mut Env<'a>,
|
||||||
|
scope: &mut Scope,
|
||||||
|
region: Region,
|
||||||
|
) -> Result<(Expr2, self::Output), SyntaxError<'a>> {
|
||||||
|
match roc_parse::test_helpers::parse_loc_with(arena, input.trim()) {
|
||||||
|
Ok(loc_expr) => Ok(loc_expr_to_expr2(arena, loc_expr, env, scope, region)),
|
||||||
|
Err(fail) => Err(fail),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn loc_expr_to_expr2<'a>(
|
pub fn loc_expr_to_expr2<'a>(
|
||||||
arena: &'a Bump,
|
arena: &'a Bump,
|
||||||
loc_expr: Located<Expr<'a>>,
|
loc_expr: Located<Expr<'a>>,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
pub mod ast;
|
pub mod ast;
|
||||||
mod constrain;
|
pub mod constrain;
|
||||||
pub mod lang;
|
pub mod lang;
|
||||||
mod module;
|
mod module;
|
||||||
pub mod parse;
|
pub mod parse;
|
||||||
|
|
|
@ -60,9 +60,9 @@ pub const NODE_BYTES: usize = 32;
|
||||||
// to see if it was
|
// to see if it was
|
||||||
|
|
||||||
#[derive(Debug, Eq)]
|
#[derive(Debug, Eq)]
|
||||||
pub (crate) struct NodeId<T> {
|
pub struct NodeId<T> {
|
||||||
pub (super) index: u32,
|
pub (super) index: u32,
|
||||||
_phantom: PhantomData<T>,
|
pub (super) _phantom: PhantomData<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Clone for NodeId<T> {
|
impl<T> Clone for NodeId<T> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue