mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 12:18:19 +00:00
Unsuffixed effectul function warning
This commit is contained in:
parent
75856ae804
commit
1da8af390b
5 changed files with 115 additions and 4 deletions
|
@ -14547,11 +14547,11 @@ All branches in an `if` must have the same type!
|
|||
leftover_statement,
|
||||
indoc!(
|
||||
r#"
|
||||
app [main] { pf: platform "../../../../../examples/cli/effects-platform/main.roc" }
|
||||
app [main!] { pf: platform "../../../../../examples/cli/effects-platform/main.roc" }
|
||||
|
||||
import pf.Effect
|
||||
|
||||
main = \{} ->
|
||||
main! = \{} ->
|
||||
identity {}
|
||||
|
||||
Effect.putLine! "hello"
|
||||
|
@ -14689,4 +14689,66 @@ All branches in an `if` must have the same type!
|
|||
Num *
|
||||
"###
|
||||
);
|
||||
|
||||
test_report!(
|
||||
function_def_fx_no_bang,
|
||||
indoc!(
|
||||
r#"
|
||||
app [main!] { pf: platform "../../../../../examples/cli/effects-platform/main.roc" }
|
||||
|
||||
import pf.Effect
|
||||
|
||||
main! = \{} ->
|
||||
printHello {}
|
||||
|
||||
printHello = \{} ->
|
||||
Effect.putLine! "hello"
|
||||
"#
|
||||
),
|
||||
@r###"
|
||||
── MISSING EXCLAMATION in /code/proj/Main.roc ──────────────────────────────────
|
||||
|
||||
This function is effectful, but its name does not indicate so:
|
||||
|
||||
8│ printHello = \{} ->
|
||||
^^^^^^^^^^
|
||||
|
||||
Add an exclamation mark at the end of its name, like:
|
||||
|
||||
printHello!
|
||||
|
||||
This will help readers identify it as a source of effects.
|
||||
"###
|
||||
);
|
||||
|
||||
test_report!(
|
||||
nested_function_def_fx_no_bang,
|
||||
indoc!(
|
||||
r#"
|
||||
app [main!] { pf: platform "../../../../../examples/cli/effects-platform/main.roc" }
|
||||
|
||||
import pf.Effect
|
||||
|
||||
main! = \{} ->
|
||||
printHello = \{} ->
|
||||
Effect.putLine! "hello"
|
||||
|
||||
printHello {}
|
||||
"#
|
||||
),
|
||||
@r###"
|
||||
── MISSING EXCLAMATION in /code/proj/Main.roc ──────────────────────────────────
|
||||
|
||||
This function is effectful, but its name does not indicate so:
|
||||
|
||||
6│ printHello = \{} ->
|
||||
^^^^^^^^^^
|
||||
|
||||
Add an exclamation mark at the end of its name, like:
|
||||
|
||||
printHello!
|
||||
|
||||
This will help readers identify it as a source of effects.
|
||||
"###
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue