Commit Graph

29455 Commits

Author SHA1 Message Date
Aurélien Geron
f21654a78e
Add a test case for List.dropAt at an index located in the middle of the list 2024-09-11 15:34:03 +12:00
Luke Boswell
3d9c4673af
Merge pull request #7063 from ageron/update-tutorial-on-dbg
Add a short paragraph to explain dbg forwarding, fixes #7061
2024-09-11 07:04:38 +10:00
Luke Boswell
af7766f284
Merge pull request #7064 from ageron/update-tutorial-try-op
Update the tutorial to add the ? operator
2024-09-11 07:03:58 +10:00
Anton-4
2936a37a1c
Merge pull request #7069 from svcxc/main
fixed typo in readme
2024-09-10 10:43:23 +02:00
svc
c3891bb211 fixed typo in readme 2024-09-10 10:38:37 +02:00
Aurélien Geron
557b78e784
Update www/content/tutorial.md
Good point, thanks

Co-authored-by: Elias Mulhall <eli.mulhall@gmail.com>
Signed-off-by: Aurélien Geron <ageron@users.noreply.github.com>
2024-09-08 17:21:02 +12:00
Aurélien Geron
931fbd7808
Replace "Tasks" with "a Task" 2024-09-07 18:18:35 +12:00
Aurélien Geron
07cf9eb8e1
Update the tutorial to add the ? operator 2024-09-07 18:07:17 +12:00
Aurélien Geron
723b753178
Add a short paragraph to explain dbg forwarding, fixes #7061 2024-09-07 16:29:05 +12:00
Sam Mohr
9a4d556725
Merge pull request #7060 from snobee/early-return-if-else
Support "early return" version of if-else statements
2024-09-06 20:19:46 -07:00
snobee
6edee521cb
add tests 2024-09-06 19:34:11 -07:00
snobee
e82dd43465
Merge remote-tracking branch 'upstream/MAIN' into early-return-if-else 2024-09-06 17:11:28 -07:00
Sam Mohr
527d1dd7c8
Merge pull request #7040 from jamin-eisenberg/repl-no-color-no-header-flags
Repl no color no header flags
2024-09-06 16:36:14 -07:00
snobee
139f6ae82c
update tests for new Expr::If struct 2024-09-06 16:28:14 -07:00
Sam Mohr
aadc74a37b
Merge branch 'main' into repl-no-color-no-header-flags 2024-09-06 15:52:18 -07:00
snobee
819db7fb44
fix formatting for indented else 2024-09-06 14:37:04 -07:00
snobee
35a0671c52
parse block without indentation after indented else 2024-09-06 14:35:47 -07:00
Sam Mohr
54cd967ec4
Merge pull request #7058 from mulias/em/dbg-expr-pipeline
Support passing values into `dbg` with the pipe operator
2024-09-05 18:26:44 -07:00
Elias Mulhall
85aad0d000
Move comment explaining use of line_info field into can::Env struct definition 2024-09-05 20:13:54 -04:00
Elias Mulhall
25af18daaa
Cleanup unused function param 2024-09-05 20:13:54 -04: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
snobee
a7afac7ac7
Add boolean flag to Expr::If for indented else statement 2024-09-05 16:28:44 -07:00
Sam Mohr
640bd15ca1
Merge pull request #7057 from human154/patch-5
fix typo in "because"
2024-09-05 10:36:28 -07:00
human154
be0c43ebc0
fix typo in "because"
Signed-off-by: human154 <46430360+human154@users.noreply.github.com>
2024-09-05 09:43:01 -04:00
Anton-4
6cec544872
Merge pull request #7054 from mulias/em/dbg-scope
Fix dbg expression desugaring and improve dbg error reporting
2024-09-05 08:38:06 +02:00
Anton-4
00572cbc83
Merge pull request #7055 from roc-lang/fix-roc-dev-hiding
fix #6987
2024-09-04 12:54:54 +02:00
Anton-4
69bbcfeeca
add nullable_unwrapped to exceptions
Signed-off-by: Anton-4 <17049058+Anton-4@users.noreply.github.com>
2024-09-04 12:01:23 +02:00
Anton-4
5b202d3e8f
skip nonnullable_unwrapped
See https://github.com/roc-lang/roc/issues/5924 for context

Signed-off-by: Anton-4 <17049058+Anton-4@users.noreply.github.com>
2024-09-04 11:43:30 +02:00
Luke Boswell
81a149cbdb
Merge pull request #7056 from roc-lang/upgrade-website-platform
Update website to basic-sig 0.5.0
2024-09-04 12:03:45 +10:00
Luke Boswell
4ad514f9f7
roc format 2024-09-04 10:48:19 +10:00
Luke Boswell
fb656dd983
upgrade to basic-ssg 0.5.0 2024-09-04 10:46:30 +10:00
Anton-4
f89f2e8ea7
fix #6987
Signed-off-by: Anton-4 <17049058+Anton-4@users.noreply.github.com>
2024-09-03 20:43:25 +02:00
Elias Mulhall
49a3f2d68e
Extract helper function to get the IdentIds related to a symbol's module 2024-09-03 14:09:16 -04: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
Anton-4
c80eede300
Merge pull request #7053 from roc-lang/ssg-reveal-segfaults
avoid hiding segfaults
2024-09-03 15:03:08 +02:00
Anton-4
f40eac12e9
avoid hiding segfaults
Context: https://github.com/roc-lang/roc/issues/6987

Signed-off-by: Anton-4 <17049058+Anton-4@users.noreply.github.com>
2024-09-03 13:47:31 +02:00
Agus Zubiaga
2469a3aa2d
Merge pull request #7050 from roc-lang/arg-patterns-as 2024-09-02 14:02:17 -03:00
Agus Zubiaga
458878dbea
Fix record as pattern mono test 2024-09-02 12:29:14 -03:00
Agus Zubiaga
e2bd31a549
Add mono tests for opaque pattern with as 2024-09-02 12:23:25 -03:00
Agus Zubiaga
ada24e4fd9
Add mono tests for record pattern with as 2024-09-02 12:17:53 -03:00
Agus Zubiaga
4e19753189
fmt: Use format_with_options Parens for as pattern arguments 2024-09-02 12:02:01 -03:00
Agus Zubiaga
2486ce0e48
fmt: Add parens around as patterns in arguments 2024-09-02 11:54:34 -03:00
Anton-4
2f91688224
test nightly on ubuntu 24
Signed-off-by: Anton-4 <17049058+Anton-4@users.noreply.github.com>
2024-09-02 15:40:55 +02:00
Anton-4
02cf61f985
Merge pull request #7038 from mulias/expr-dbg
Support `dbg` in expressions
2024-09-02 13:30:32 +02:00
Agus Zubiaga
2679ba3e95
Merge pull request #7048 from roc-lang/fix-task-params-threading 2024-09-01 23:45:40 -03:00
Agus Zubiaga
e4079ccb11
Add module_params_pass_task test 2024-09-01 19:18:07 -03:00
Agus Zubiaga
9ce5b8b50b
Fix zero-arity home value def var 2024-09-01 19:11:56 -03:00
Agus Zubiaga
ed931a458e
Use fresh vars for home params destructures 2024-09-01 19:11:09 -03:00