mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 08:11:12 +00:00
Merge remote-tracking branch 'origin/trunk' into num
This commit is contained in:
commit
fb8e8570bc
17 changed files with 320 additions and 192 deletions
|
@ -33,7 +33,12 @@ pub struct Output {
|
|||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub enum Expr {
|
||||
// Literals
|
||||
|
||||
// Num stores the `a` variable in `Num a`. Not the same as the variable
|
||||
// stored in Int and Float below, which is strictly for better error messages
|
||||
Num(Variable, i64),
|
||||
|
||||
// Int and Float store a variable to generate better error messages
|
||||
Int(Variable, i64),
|
||||
Float(Variable, f64),
|
||||
Str(Box<str>),
|
||||
|
|
|
@ -33,6 +33,7 @@ pub fn int_expr_from_result(
|
|||
result: Result<i64, &str>,
|
||||
env: &mut Env,
|
||||
) -> Expr {
|
||||
// Int stores a variable to generate better error messages
|
||||
match result {
|
||||
Ok(int) => Expr::Int(var_store.fresh(), int),
|
||||
Err(raw) => {
|
||||
|
@ -51,6 +52,7 @@ pub fn float_expr_from_result(
|
|||
result: Result<f64, &str>,
|
||||
env: &mut Env,
|
||||
) -> Expr {
|
||||
// Float stores a variable to generate better error messages
|
||||
match result {
|
||||
Ok(float) => Expr::Float(var_store.fresh(), float),
|
||||
Err(raw) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue