mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 12:18:19 +00:00
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:
parent
119663b3e7
commit
12c735644f
6 changed files with 61 additions and 48 deletions
|
@ -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!(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue