Commit graph

127 commits

Author SHA1 Message Date
Sam Mohr
1aff18d47c
Fix PNC + ? suffix interaction 2025-01-25 05:41:59 -08:00
Sam Mohr
fce14d31b0
Move desugaring to new roc_can_solo crate 2025-01-19 07:16:43 -08:00
Sam Mohr
7914f0c7d8
Fix clippy issue 2025-01-17 20:01:54 -08:00
Sam Mohr
1a9668e83a
Add tests for desugaring and formatting 2025-01-17 18:55:58 -08:00
Sam Mohr
5859415e73
Prefix hidden vars with # 2025-01-16 10:49:51 -08:00
Sam Mohr
b73e4387ae
Implement ? binop operator 2025-01-16 02:44:32 -08:00
Anthony Bullard
8e1e1520e3
New Lambda Syntax with |...|
This adds parser support for the new lambda syntax.  It does not remove
the existing syntax, nor will the new syntax be retained in formatting.
That will be done in a separate PR to keep the two respective PRs
relatively small and easy to review.
2025-01-15 05:58:16 -06:00
Sam Mohr
eb1b5ffa26
Move to new interpolation syntax 2025-01-10 10:29:20 -08:00
Sam Mohr
2150ee2219
Remove Task from Roc 2025-01-08 17:00:40 -08:00
Anthony Bullard
898b3f55e5
Move PNC apply to separate Expr/Pattern variant 2025-01-08 14:47:49 -06:00
Sam Mohr
b56fbd38e1
Progress on updating entire compiler for snake_case 2025-01-05 03:48:03 -08:00
Sam Mohr
db1e0a02b4
Update tests 2025-01-04 05:54:44 -08:00
Anthony Bullard
210695ec29
Update can tests with PatternApplyStyle after rebase 2025-01-02 18:11:15 -06:00
Anthony Bullard
3b0db07fa1
PNC for Patterns, stabilize formatting 2025-01-02 17:57:15 -06:00
Anthony Bullard
03641c16f8
Fix unit tests 2024-12-26 10:53:47 -06:00
Anthony Bullard
c70ceb4f98
Issue 7089: ?? operator 2024-12-26 10:53:47 -06:00
Sam Mohr
01f4d4f3da
Merge branch 'main' into cleanup_unused 2024-12-08 10:14:47 -08:00
Sam Mohr
9392742d17
Update tests 2024-12-05 02:33:20 -08:00
Sam Mohr
8c81742abe
Simplify category formatting for try concepts 2024-12-05 02:30:33 -08:00
Sam Mohr
de626102c8
Use new try impl for ? operator 2024-12-05 02:13:13 -08:00
JRI98
90f517712a
Remove unused code 2024-12-05 09:18:52 +00:00
Sam Mohr
eedade8e81
Initial working version of proper try keyword 2024-12-04 02:31:59 -08:00
Agus Zubiaga
1dc9dd0a90
Merge branch 'main' into specialize-exprs 2024-11-27 11:35:14 -03:00
Joshua Warner
b4fdb0a4c2
Make dbg parse strictly as an Apply
This is important in order to fix some formatting bugs found in fuzzing
2024-11-24 14:15:29 -08:00
Agus Zubiaga
2e96aca0fd
Merge branch 'main' into specialize-exprs 2024-11-23 01:48:51 -03:00
Richard Feldman
ed6ad1bc82
Get a failing specialize_expr test 2024-11-08 00:55:04 -05:00
Agus Zubiaga
5641884669
Update regions in suffixed tests 2024-11-07 18:54:25 -03:00
Agus Zubiaga
a0f4b38ee9
Update region when desugaring ! in Task mode 2024-11-07 18:54:24 -03:00
Agus Zubiaga
5f5e123bfd
Expect only one problem in test_can::shadow_annotation
This is because the NoIdentifiersIntroduced error was moved
to the type checker.
2024-11-07 18:54:22 -03:00
Agus Zubiaga
01c94050c8
Detect fx mode based on hosted module 2024-11-07 18:54:15 -03:00
Agus Zubiaga
aeeaab4b99
Desugar idents ending in ! to TrySuffix 2024-11-07 18:54:14 -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
Sam Mohr
de124ecc3e
Finish adding tests 2024-11-02 21:58:25 -07:00
Sam Mohr
71b1fdebc4
Add canonicalization tests 2024-11-02 13:37:10 -07:00
Richard Feldman
d796b3ec74
Update insta tests 2024-10-21 23:09:55 -04:00
Richard Feldman
c9c7156db5
Fix insta tests 2024-10-21 22:10:44 -04:00
Luke Boswell
afb247d4c3
ignore final suffix for annotated top-level defs 2024-09-29 10:57:18 +10:00
Luke Boswell
f1f7dddab7
remove old snap added by mistake in previous PR 2024-09-29 10:56:03 +10:00
Luke Boswell
05f970a826
add snapshot test 2024-09-24 09:17:43 +10:00
Luke Boswell
cce33c03d6
desugar ValueDef::Expect suffixed nodes 2024-09-23 17:57:25 +10:00
Sam Mohr
2da08be8ef
Remove old record builder syntax 2024-09-21 04:44:44 -07:00
snobee
e82dd43465
Merge remote-tracking branch 'upstream/MAIN' into early-return-if-else 2024-09-06 17:11:28 -07:00
snobee
139f6ae82c
update tests for new Expr::If struct 2024-09-06 16:28:14 -07:00
Elias Mulhall
19931ecd43
Support passing values into dbg with the pipe operator
In order to desugar `dbg` in a pipeline we need to allow a bare `dbg`
node in desugaring and only report it as an error if the bare node
survives to the next step of canonicalization. This means we move the
error code out of `desugar_expr` and into `canonicalize_expr`. This is
much simpler to do now that these functions use the same `env` struct,
since previously we would have had to pass down extra args to
`canonicalize_expr`. Sharing the `env` struct means that we also don't
have to worry about calculating `line_info` more than once.
2024-09-05 20:13:54 -04: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
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
Elias Mulhall
7a07f13f31 Test dbg expr desugaring 2024-08-28 12:16:22 -04:00
Elias Mulhall
a16f757164 Pass var_store into desugar_expr so that desugaring may generate fresh vars 2024-08-28 11:53:44 -04:00
Sam Mohr
50f6e11423
Deprecate backpassing to prepare for eventual removal 2024-08-16 22:36:04 -07:00
Aidan
ddb58a2cd5 spaces_middle -> lines_between 2024-07-29 13:06:48 -04:00