mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 12:18:19 +00:00
Allow suffixed pure functions that are exposed to the host
This commit is contained in:
parent
4217ffa333
commit
6ffc8a507b
8 changed files with 57 additions and 45 deletions
|
@ -51,10 +51,11 @@ pub fn infer_expr(
|
|||
exposed_by_module: &Default::default(),
|
||||
derived_module,
|
||||
function_kind: FunctionKind::LambdaSet,
|
||||
#[cfg(debug_assertions)]
|
||||
checkmate: None,
|
||||
module_params: None,
|
||||
module_params_vars: Default::default(),
|
||||
host_exposed_symbols: None,
|
||||
#[cfg(debug_assertions)]
|
||||
checkmate: None,
|
||||
};
|
||||
|
||||
let RunSolveOutput { solved, .. } =
|
||||
|
|
|
@ -14812,7 +14812,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:
|
||||
|
@ -14829,18 +14829,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!(
|
||||
|
@ -15423,7 +15412,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:
|
||||
|
@ -15438,18 +15427,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!(
|
||||
|
@ -15467,7 +15445,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:
|
||||
|
@ -15482,17 +15460,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?
|
||||
"###
|
||||
"#
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue