Commit graph

277 commits

Author SHA1 Message Date
Luke Boswell
8a566dc339
WIP 2024-11-11 10:22:58 +11:00
Agus Zubiaga
ecc5fa57dd
Check record field suffixes in annotations 2024-11-09 02:06:05 -03:00
Agus Zubiaga
12c735644f
Do not warn about pure functions in suffixed record literal fields
Records fields that allow effectful functions, should also accept
pure functions.
2024-11-09 01:05:06 -03:00
Richard Feldman
ed6ad1bc82
Get a failing specialize_expr test 2024-11-08 00:55:04 -05:00
Agus Zubiaga
bc0cfef128
Restore UNNCESSARY DEFINITION errors for top-level defs
Non-top-level defs are already covered
2024-11-07 18:54:25 -03:00
Agus Zubiaga
a4296ca19d
Improve wording in pattern suffix errors 2024-11-07 18:54:25 -03:00
Agus Zubiaga
1e835bbb17
Fix 'right-hand side' typo in errors 2024-11-07 18:54:25 -03:00
Agus Zubiaga
935d460236
Use plural 'effects' in FxInTopLevel error 2024-11-07 18:54:25 -03:00
Agus Zubiaga
c9f001b041
Allow ignored defs with an effectful RHS 2024-11-07 18:54:22 -03:00
Agus Zubiaga
175a2b5683
Add hint about forgetting to call a function 2024-11-07 18:54:21 -03:00
Agus Zubiaga
af6fc6306f
Treat untyped unsuffixed functions as pure 2024-11-07 18:54:21 -03:00
Agus Zubiaga
70fa4d036c
Test opaque destructure suffixes 2024-11-07 18:54:21 -03:00
Agus Zubiaga
a0783c3132
Test tag destructure suffixes 2024-11-07 18:54:21 -03:00
Agus Zubiaga
2c208f9389
Test tuple destructure suffixes 2024-11-07 18:54:20 -03:00
Agus Zubiaga
e75b1cf7a0
Check suffixes of all pattern identifiers 2024-11-07 18:54:20 -03:00
Agus Zubiaga
a31a35100b
Report suffixed pure function in literal record field 2024-11-07 18:54:20 -03:00
Agus Zubiaga
215de707fa
Report unsuffixed record literal field with effectful function 2024-11-07 18:54:20 -03:00
Agus Zubiaga
ea35094b28
Remove flex var case when checking symbol suffix 2024-11-07 18:54:20 -03:00
Agus Zubiaga
89a918cebe
Fix unifying pure with flex vars 2024-11-07 18:54:19 -03:00
Agus Zubiaga
6533e9084d
Add fx to ErrorType 2024-11-07 18:54:19 -03:00
Agus Zubiaga
6adc6d9168
Report ignored statement results 2024-11-07 18:54:18 -03:00
Agus Zubiaga
b01771c5ae
Show effectful function name in mismatches 2024-11-07 18:54:18 -03:00
Agus Zubiaga
f666dba67d
Report effectful top-level exprs 2024-11-07 18:54:17 -03:00
Agus Zubiaga
b62665e49e
Report effectful statement in pure function 2024-11-07 18:54:17 -03:00
Agus Zubiaga
fd2493ee51
Report effect call in pure function 2024-11-07 18:54:17 -03:00
Agus Zubiaga
839078b5d1
Test aliased unsuffixed effectful function 2024-11-07 18:54:17 -03:00
Agus Zubiaga
d22b2a79f5
Suffixed pure function warning 2024-11-07 18:54:17 -03:00
Agus Zubiaga
1da8af390b
Unsuffixed effectul function warning 2024-11-07 18:54:16 -03:00
Agus Zubiaga
69e026f8bb
Leftover statement warning for pure statements 2024-11-07 18:54:16 -03:00
Agus Zubiaga
01c94050c8
Detect fx mode based on hosted module 2024-11-07 18:54:15 -03:00
Agus Zubiaga
2cce5ad023
Allow unsuffixed statements in parser
Moves the "STATEMENT AFTER EXPRESSION" error from the parser to canonicalization.
We'll later use this to allow this case in effectful functions.
2024-11-07 18:54:14 -03:00
Agus Zubiaga
7af05cc6c9
Constrain function annotation fx to body 2024-11-07 18:54:13 -03:00
Agus Zubiaga
5a5abe3bc5
Unify call's fx var with that of the enclosing function 2024-11-07 18:54:12 -03:00
Agus Zubiaga
160dbee943
Nicer message for unhandled expr errors 2024-11-06 12:15:38 -03:00
Agus Zubiaga
f4c8492c1c
Report return syntax errors 2024-11-06 10:50:32 -03:00
Luke Boswell
c00db6da37
Merge remote-tracking branch 'remote/main' into rebuild-platform 2024-11-04 13:57:51 +11:00
Sam Mohr
66cc96edbb
Address PR comments from @ayazhafiz 2024-10-29 15:58:35 -07:00
Sam Mohr
a9cd6ac5fa
Fix tailcalling 2024-10-26 06:48:01 -07:00
Luke Boswell
926014518f
Merge remote-tracking branch 'remote/main' into rebuild-platform 2024-10-24 10:21:08 +11:00
JRI98
511308d4d3
Fix #6240 2024-10-22 12:04:48 +01:00
Luke Boswell
e3afeaa7ff
WIP Merge remote-tracking branch 'remote/main' into rebuild-platform 2024-10-09 09:21:46 +11:00
hrishisd
cb98c45e88
Remove deprecated string interpolation syntax 2024-10-08 16:31:22 -04:00
Nathan Kramer
be4e3b5983
Suggest link to tutorial's operator desugaring table 2024-09-30 18:14:35 +10:00
Anton-4
0a0bc897f6
add final expression tip 2024-09-26 20:17:35 +02:00
Richard Feldman
87b7bb1fac
Fix "opaquees" in error message 2024-09-25 22:11:14 -04:00
Sam Mohr
2da08be8ef
Remove old record builder syntax 2024-09-21 04:44:44 -07:00
Elias Mulhall
b515bfa77e
Use a shared env for desugaring and the rest of canonicalization
This refactor simplifies the desugar pass by reducing the number of
arguments threaded through each recursive function call.

- Add the module src string to `Env`.
- Add `line_info` to `Env` as a lazy-evaled function.
- Refactor desugar functions to take the `can::Env` struct in place of a
  number of params. This is mostly a find-and-replace, but in a few
  places `Vec::from_iter_in` was changed to `Vec::with_capacity_in`
  followed by a `for` loop in order to avoid lifetime issues.
- Remove unnecessary linter annotations for `clippy::too_many_arguments`
2024-09-05 20:13:48 -04:00
Luke Boswell
bb57c4a600
remove unneded basic-cli reference in test_reporting 2024-09-04 21:50:15 +10:00
Elias Mulhall
f356f6f7a0
Do not display generated symbol names in error messages
When an error message reports on a symbol that was generated during
canonicalization, use text like "This value" instead of "This `123`
value". Generated symbols use the identifier index as the symbol name,
since valid Roc variables cannot begin with a number so there's no
chance of collision. We don't want to display generated symbols to the
user, so when building the error message we check if the symbol's name
starts with a digit.
2024-09-03 14:00:46 -04:00
Elias Mulhall
82d0566041
Use module scope instead of var store to generate idents in dbg desugar
Fix a bug in `dbg` expression desugaring by using the module scope to
generate unique identifiers instead of the variable store.

In the initial implementation of `dbg` expressions we used the
`VarStore` to generate unique identifiers for new variables created
during desugaring. We should have instead used the current module's
`Scope`, which handles identifiers within the module. Each scope has its
own incrementing variable count which is independent of the shared
variable store. The scope is used to generate new identifiers at other
points in canonicalization, such as when assigning a global identifier
to closures and `expect`s. It's possible that the identifier generated
for `dbg` could conflict with an identifier generated by the scope,
resulting in a confusing error.
2024-09-03 14:00:39 -04:00