Do not warn about pure functions in suffixed record literal fields

Records fields that allow effectful functions, should also accept
pure functions.
This commit is contained in:
Agus Zubiaga 2024-11-09 01:05:06 -03:00
parent 119663b3e7
commit 12c735644f
No known key found for this signature in database
6 changed files with 61 additions and 48 deletions

View file

@ -15006,36 +15006,6 @@ All branches in an `if` must have the same type!
"###
);
test_report!(
suffixed_pure_in_record,
indoc!(
r#"
app [main!] { pf: platform "../../../../../examples/cli/effects-platform/main.roc" }
import pf.Effect
main! = \{} ->
notFx = {
trim!: Str.trim
}
Effect.putLine! (notFx.trim! " hello ")
"#
),
@r###"
UNNECESSARY EXCLAMATION in /code/proj/Main.roc
This field's value is a pure function, but its name suggests
otherwise:
7 trim!: Str.trim
^^^^^^^^^^^^^^^
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!(
unsuffixed_fx_arg,
indoc!(