merge remote/main and update mono tests

This commit is contained in:
Luke Boswell 2023-05-15 16:51:56 +10:00
commit 4d4cfcf981
No known key found for this signature in database
GPG key ID: F6DB3C9DB47377B0
376 changed files with 21515 additions and 9412 deletions

View file

@ -76,7 +76,7 @@ fn promote_expr_to_module(src: &str) -> String {
buffer
}
fn compiles_to_ir(test_name: &str, src: &str, mode: &str, no_check: bool) {
fn compiles_to_ir(test_name: &str, src: &str, mode: &str, allow_type_errors: bool, no_check: bool) {
use roc_packaging::cache::RocCacheDir;
use std::path::PathBuf;
@ -146,7 +146,7 @@ fn compiles_to_ir(test_name: &str, src: &str, mode: &str, no_check: bool) {
println!("Ignoring {} canonicalization problems", can_problems.len());
}
assert!(type_problems.is_empty());
assert!(allow_type_errors || type_problems.is_empty());
let main_fn_symbol = exposed_to_host.top_level_values.keys().copied().next();
@ -2550,7 +2550,6 @@ fn recursively_build_effect() {
}
#[mono_test]
#[ignore = "roc glue code generation cannot handle a type that this test generates"]
fn recursive_lambda_set_has_nested_non_recursive_lambda_sets_issue_5026() {
indoc!(
r#"
@ -2889,3 +2888,38 @@ fn layout_cache_structure_with_multiple_recursive_structures() {
"#
)
}
#[mono_test]
fn issue_4770() {
indoc!(
r#"
app "test" provides [main] to "./platform"
main =
isCorrectOrder { left: IsList [IsInteger 10], right: IsList [IsInteger 20] }
isCorrectOrder = \pair ->
when pair is
{ left: IsInteger left, right: IsInteger right } -> left < right
{ left: IsList l, right: IsList r } ->
if List.map2 l r (\left, right -> { left, right }) |> List.all isCorrectOrder then
List.len l < List.len r
else
Bool.false
{ left: IsList _, right: IsInteger _ } -> isCorrectOrder { left: pair.left, right: IsList [pair.right] }
{ left: IsInteger _, right: IsList _ } -> isCorrectOrder { left: IsList [pair.left], right: pair.right }
"#
)
}
#[mono_test(allow_type_errors = "true")]
fn error_on_erroneous_condition() {
indoc!(
r#"
app "test" provides [main] to "./platform"
main = if True then 1 else 2
"#
)
}