Merge branch 'main' into allow-try-in-statements

This commit is contained in:
Sam Mohr 2024-12-01 00:35:18 -08:00
commit 29c8759bc0
No known key found for this signature in database
GPG key ID: EA41D161A3C1BC99
320 changed files with 6977 additions and 2011 deletions

View file

@ -8,40 +8,38 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_can = { path = "../can" }
roc_collections = { path = "../collections" }
roc_load_internal = { path = "../load_internal" }
roc_module = { path = "../module" }
roc_packaging = { path = "../../packaging" }
roc_reporting = { path = "../../reporting" }
roc_solve = { path = "../solve" }
roc_target = { path = "../roc_target" }
roc_types = { path = "../types" }
roc_can.workspace = true
roc_collections.workspace = true
roc_load_internal.workspace = true
roc_module.workspace = true
roc_packaging.workspace = true
roc_reporting.workspace = true
roc_solve.workspace = true
roc_target.workspace = true
roc_types.workspace = true
bumpalo.workspace = true
[build-dependencies]
roc_builtins = { path = "../builtins" }
roc_can = { path = "../can" }
roc_module = { path = "../module" }
roc_packaging = { path = "../../packaging" }
roc_reporting = { path = "../../reporting" }
roc_solve = { path = "../solve" }
roc_target = { path = "../roc_target" }
roc_error_macros = { path = "../../error_macros" }
roc_load_internal = { path = "../load_internal" }
roc_builtins.workspace = true
roc_can.workspace = true
roc_module.workspace = true
roc_packaging.workspace = true
roc_reporting.workspace = true
roc_solve.workspace = true
roc_target.workspace = true
roc_error_macros.workspace = true
roc_load_internal.workspace = true
bumpalo.workspace = true
[dev-dependencies]
roc_constrain = { path = "../constrain" }
roc_derive = { path = "../derive" }
roc_parse = { path = "../parse" }
roc_problem = { path = "../problem" }
roc_region = { path = "../region" }
roc_solve_problem = { path = "../solve_problem" }
ven_pretty = { path = "../../vendor/pretty" }
roc_test_utils_dir = { path = "../../test_utils_dir" }
roc_constrain.workspace = true
roc_derive.workspace = true
roc_parse.workspace = true
roc_problem.workspace = true
roc_region.workspace = true
roc_solve_problem.workspace = true
ven_pretty.workspace = true
roc_test_utils_dir.workspace = true
indoc.workspace = true
insta.workspace = true
pretty_assertions.workspace = true

View file

@ -53,6 +53,7 @@ pub fn infer_expr(
function_kind: FunctionKind::LambdaSet,
module_params: None,
module_params_vars: Default::default(),
host_exposed_symbols: None,
#[cfg(debug_assertions)]
checkmate: None,
};
@ -189,6 +190,24 @@ pub fn can_expr_with<'a>(
// rules multiple times unnecessarily.
let loc_expr = desugar::desugar_expr(&mut env, &mut scope, &loc_expr);
let mut scope = Scope::new(
home,
"TestPath".into(),
IdentIds::default(),
Default::default(),
);
let dep_idents = IdentIds::exposed_builtins(0);
let mut env = Env::new(
arena,
expr_str,
home,
Path::new("Test.roc"),
&dep_idents,
&module_ids,
None,
roc_can::env::FxMode::PurityInference,
);
let (loc_expr, output) = canonicalize_expr(
&mut env,
&mut var_store,

View file

@ -11054,8 +11054,8 @@ All branches in an `if` must have the same type!
4 Recursive := [Infinitely Recursive]
^^^^^^^^^
Recursion in opaquees is only allowed if recursion happens behind a
tagged union, at least one variant of which is not recursive.
Recursion in opaque types is only allowed if recursion happens behind
a tagged union, at least one variant of which is not recursive.
"
);
@ -14975,7 +14975,7 @@ All branches in an `if` must have the same type!
Str.trim msg
"#
),
@r###"
@r#"
EFFECT IN PURE FUNCTION in /code/proj/Main.roc
This call to `Effect.putLine!` might produce an effect:
@ -14992,18 +14992,7 @@ All branches in an `if` must have the same type!
You can still run the program with this error, which can be helpful
when you're debugging.
UNNECESSARY EXCLAMATION in /code/proj/Main.roc
This function is pure, but its name suggests otherwise:
5 main! = \{} ->
^^^^^
The exclamation mark at the end is reserved for effectful functions.
Hint: Did you forget to run an effect? Is the type annotation wrong?
"###
"#
);
test_report!(
@ -15586,7 +15575,7 @@ All branches in an `if` must have the same type!
pureHigherOrder = \f, x -> f x
"#
),
@r###"
@r#"
TYPE MISMATCH in /code/proj/Main.roc
This 1st argument to `pureHigherOrder` has an unexpected type:
@ -15601,18 +15590,7 @@ All branches in an `if` must have the same type!
But `pureHigherOrder` needs its 1st argument to be:
Str -> {}
UNNECESSARY EXCLAMATION in /code/proj/Main.roc
This function is pure, but its name suggests otherwise:
5 main! = \{} ->
^^^^^
The exclamation mark at the end is reserved for effectful functions.
Hint: Did you forget to run an effect? Is the type annotation wrong?
"###
"#
);
test_report!(
@ -15630,7 +15608,7 @@ All branches in an `if` must have the same type!
pureHigherOrder = \f, x -> f x
"#
),
@r###"
@r#"
TYPE MISMATCH in /code/proj/Main.roc
This 1st argument to `pureHigherOrder` has an unexpected type:
@ -15645,17 +15623,6 @@ All branches in an `if` must have the same type!
But `pureHigherOrder` needs its 1st argument to be:
Str -> {}
UNNECESSARY EXCLAMATION in /code/proj/Main.roc
This function is pure, but its name suggests otherwise:
5 main! = \{} ->
^^^^^
The exclamation mark at the end is reserved for effectful functions.
Hint: Did you forget to run an effect? Is the type annotation wrong?
"###
"#
);
}