Update tests to check eq unbound float is resolved to dec

This commit is contained in:
Ayaz Hafiz 2022-12-01 11:41:42 -06:00
parent ed7d4f8f63
commit 3605008fce
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
3 changed files with 22 additions and 5 deletions

View file

@ -8414,4 +8414,21 @@ mod solve_expr {
"[Ok a]* -> a",
);
}
#[test]
fn resolve_eq_for_float_forces_dec() {
infer_queries!(
indoc!(
r#"
app "test" provides [main] to "./platform"
n : Num *
main = n == 1.
# ^
"#
),
@"n : Dec"
);
}
}

View file

@ -1588,7 +1588,7 @@ fn float_type(
num_binary64,
AliasVariables::default(),
Variable::EMPTY_TAG_UNION,
AliasKind::Structural,
AliasKind::Opaque,
)
});
}

View file

@ -12594,7 +12594,7 @@ I recommend using camelCase. It's the standard style in Roc code!
n : Num *
main = n == 1.
main = n == 1f64
"#
),
@r###"
@ -12602,12 +12602,12 @@ I recommend using camelCase. It's the standard style in Roc code!
This expression has a type that does not implement the abilities it's expected to:
5 main = n == 1.
^^
5 main = n == 1f64
^^^^
I can't generate an implementation of the `Eq` ability for
FloatingPoint *
FloatingPoint ?
Note: I can't derive `Bool.isEq` for floating-point types. That's
because Roc's floating-point numbers cannot be compared for total