mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 12:18:19 +00:00
Report unsuffixed record literal field with effectful function
This commit is contained in:
parent
ea35094b28
commit
215de707fa
7 changed files with 121 additions and 21 deletions
|
@ -14934,5 +14934,37 @@ All branches in an `if` must have the same type!
|
|||
"###
|
||||
);
|
||||
|
||||
test_report!(
|
||||
unsuffixed_fx_in_record,
|
||||
indoc!(
|
||||
r#"
|
||||
app [main!] { pf: platform "../../../../../examples/cli/effects-platform/main.roc" }
|
||||
|
||||
import pf.Effect
|
||||
|
||||
main! = \{} ->
|
||||
fx = {
|
||||
putLine: Effect.putLine!
|
||||
}
|
||||
fx.putLine "hello world!"
|
||||
"#
|
||||
),
|
||||
@r###"
|
||||
── MISSING EXCLAMATION in /code/proj/Main.roc ──────────────────────────────────
|
||||
|
||||
This field's value is an effectful function, but its name does not
|
||||
indicate so:
|
||||
|
||||
7│ putLine: Effect.putLine!
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Add an exclamation mark at the end of its name, like:
|
||||
|
||||
{ readFile! : File.read! }
|
||||
|
||||
This will help readers identify it as a source of effects.
|
||||
"###
|
||||
);
|
||||
|
||||
// [purity-inference] TODO: check ! in records, tuples, tags, opaques, and arguments
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue