Commit Graph

8321 Commits

Author SHA1 Message Date
Joshua Warner
6080c12ca8
Parse ! suffixes as an Expr::TaskAwaitBang instead of using suffix field in ident 2024-04-28 08:47:07 +10:00
Richard Feldman
f7716188a1
Merge pull request #6676 from roc-lang/ok-err
Allow the names `Ok` and `Err` as type aliases
2024-04-27 06:49:46 -04:00
Agus Zubiaga
46f640ca73
Support ingested files in the REPL 2024-04-26 23:43:36 -03:00
Agus Zubiaga
52f84910a7
Support importing local files in the REPL 2024-04-26 23:33:19 -03:00
Richard Feldman
052862e0c6
Fix some unused warnings 2024-04-26 22:20:23 -04:00
Richard Feldman
9b4cc9f25b
clippy 2024-04-26 20:34:58 -04:00
Richard Feldman
17d761252f
Improve reporting for doc links problems 2024-04-26 16:31:20 -04:00
Richard Feldman
00950d2a0e
Update insta snapshots 2024-04-26 06:59:01 -04:00
Richard Feldman
e895c71dbd
Ignore unused warnings if the module name is Task 2024-04-25 23:13:12 -04:00
Richard Feldman
ce4501c329
Update mono tests 2024-04-25 23:10:54 -04:00
Richard Feldman
6571c18a35
Update tests 2024-04-25 23:10:45 -04:00
Richard Feldman
f557a29090
Don't add Ok and Err as symbols to scope 2024-04-25 20:07:40 -04:00
Richard Feldman
e4bc7147c9
Add test to reproduce Ok and Err alias failure 2024-04-25 20:07:40 -04:00
Agus Zubiaga
e500d664fd
can: Replace AnnotationReferences with plain References
`AnnotationReferences` ignored the fact that within an annotation
the same symbol could be referenced both in a qualified and unqualified
manner.

By using `References` we will properly track all the possible combinations.
2024-04-23 21:16:32 -03:00
Agus Zubiaga
5ca1494df1
Add IdentIds::exposed_values 2024-04-23 20:12:54 -03:00
Agus Zubiaga
0f89d3558a
impl From<ImportedModuleName> for QualifiedModuleName 2024-04-23 20:03:07 -03:00
Luke Boswell
87feeb5135
add abilities for glue types 2024-04-24 08:45:29 +10:00
Agus Zubiaga
6fffaa6dda
Restore disabled roc_cli cli_file_check test 2024-04-23 19:00:10 -03:00
Agus Zubiaga
f69bc2e46f
Merge branch 'main' into inline-imports 2024-04-23 18:57:20 -03:00
Agus Zubiaga
7efc7a4a3e
Canonicalize ingested files directly instead of creating AST nodes 2024-04-23 18:55:41 -03:00
Anton-4
29e59dfec9
upgrade to basic-cli 0.9.1 2024-04-23 19:06:33 +02:00
Anton-4
8902f3e9e3
fix typo
Signed-off-by: Anton-4 <17049058+Anton-4@users.noreply.github.com>
2024-04-23 12:57:04 +02:00
Agus Zubiaga
6006669702
Report unused imports after canonicalizing platform requires ann 2024-04-22 19:53:19 -03:00
Agus Zubiaga
d952d5576a
Handle explicit builtin imports with empty exposing lists
Also includes related style suggestions by Ayaz on #6658
2024-04-22 18:29:48 -03:00
Agus Zubiaga
66bf955a6e
can/def match => if..let 2024-04-22 17:51:51 -03:00
Agus Zubiaga
d17eb8d340
Remove #[inline] ann for can::Env::module_exists_but_not_imported 2024-04-22 17:47:02 -03:00
Agus Zubiaga
4476277a56
Merge branch 'main' into inline-imports 2024-04-22 17:45:25 -03:00
Luke Boswell
84cd4233be
clippy fix 2024-04-22 18:55:34 +10:00
Luke Boswell
aa5dc09900
support for more trailing ! 2024-04-22 18:38:51 +10:00
Luke Boswell
32c4083364
add new tests for trailing ! 2024-04-22 18:38:26 +10:00
Luke Boswell
e4713ce2c5
Merge pull request #6657 from roc-lang/issue-6074
Fix parsing lists in tag patterns
2024-04-22 12:11:31 +10:00
Ayaz Hafiz
2763bc57cb
Some minor cleanup in language_server 2024-04-21 18:19:59 -05:00
Ayaz Hafiz
88c4a3af4e
Rename lang_srv to language_server 2024-04-21 18:03:56 -05:00
Agus Zubiaga
5112e064e5
Add module_path to can env instead of threading it through 2024-04-21 10:30:34 -03:00
Agus Zubiaga
e5789158e5
Remove todo on ingested file handling 2024-04-21 10:13:26 -03:00
Agus Zubiaga
1b3c16e517
Handle import ValueDef in lang_srv tokens 2024-04-21 09:39:39 -03:00
Luke Boswell
d69d2ee940
replace removed comment 2024-04-21 13:45:04 +10:00
Luke Boswell
9ad6d9248c
converge loc_pattern_help_help and loc_parse_tag_pattern_arg 2024-04-21 13:32:38 +10:00
Luke Boswell
6844df6c37
fix parsing lists in tag patterns 2024-04-21 13:27:50 +10:00
Agus Zubiaga
7ebfc6d06d
Support both inline and header imports
Load will now convert header imports to inline import defs, so that
we can support both temporarily.
2024-04-20 19:04:09 -03:00
Luke Boswell
4cf256c6b7
Merge pull request #6654 from joshuawarner32/proposed_check_indent_fix
Remove unnecessary arg to check_indent
2024-04-21 07:49:17 +10:00
Joshua Warner
a24daeaa57
Fix syntax fuzzer cargo config 2024-04-20 11:21:36 -07:00
Anton-4
c1d0c24194
fix expected type
Rust's u128 and Roc's U128 have different alignment. They can not be used interchangebly, that leads to segmentation faults. See also https://roc.zulipchat.com/#narrow/stream/395097-compiler-development/topic/str_to_u128.20segfault/near/434410692
2024-04-20 19:57:47 +02:00
Agus Zubiaga
7a53484479
Report an error when import shadows a symbol in scope 2024-04-20 12:38:17 -03:00
Agus Zubiaga
979aff8bf7
Explicit builtin import warning
We will now show a warning if a builtin is imported explicitly,
since this is unncessary.

We will not show the warning if they expose functions from the builtin:

	import Dict exposing [isEmpty]

However, we will show a special warning if they expose types from it:

	import Dict exposing [Dict, isEmpty]
2024-04-20 12:35:46 -03:00
Agus Zubiaga
3217e5a3f0
Allow dots in import module names
We found some issues with the private submodules part of the proposal [1],
and we decided to keep module directories for now.

[1] https://docs.google.com/document/d/1E_77fO-44BtoBtXoVeWyGh1xN2KRTWTu8q6i25RNNx0/edit#heading=h.x84bh32l37em
2024-04-20 12:33:02 -03:00
Agus Zubiaga
b56f029a09
Fix unqualified unused import false positive
If we exposed a symbol in an import and used it both unqualified
and qualified, we'd produce an unused warning false positive.

This happened because we were using a single bit flag to determine
whether a value was used qualified or unqualified.
2024-04-20 12:18:52 -03:00
Agus Zubiaga
1f347f6ca1
Fix package module resolution in inline imports
We were still passing `ModuleIds` from `load` to `can`, but now
that imports can appear in any scope, we don't know which package
an unqualified module name belongs to from the top level.

We now pass `PackageModuleIds` instead  and keep a Map of `ModuleName` to
`ModuleId` in `Scope`.

This also allow us to import multiple modules with the same name from different
packages as long as a unique alias is provided.
2024-04-20 12:16:37 -03:00
Agus Zubiaga
842a256907
Implement import aliases
Allows a module to be imported with an alias:

    import JsonDecode as JD

Import aliases must be unique and they cannot have the same name
as an imported module.
2024-04-20 12:07:01 -03:00
Agus Zubiaga
d5a38a26db
Merge branch 'main' into inline-imports 2024-04-20 12:01:11 -03:00
Joshua Warner
50d2111919
Remove unnecessary arg to check_indent
Quick refactoring / follow-up to #6634
2024-04-19 20:25:55 -07:00
Richard Feldman
6059f7afcb
Merge pull request #6651 from roc-lang/fix-nesting-suffix
Fix recursion for suffixed `!` in top-level def
2024-04-19 14:53:34 -04:00
Richard Feldman
da129c9a41
Merge pull request #6650 from nathanielknight/fix-shiftLeftBy-example
Minor fix to the docstring of `Num.shiftLeftBy`
2024-04-19 07:19:48 -04:00
Luke Boswell
5e738a4ab5
fix recursion in top-level def 2024-04-19 10:34:33 +10:00
Nathaniel Knight
02689de797 Minor fix to the docstring of Num.shiftLeftBy 2024-04-17 20:50:17 -07:00
Luke Boswell
ae908f89a9
suffixed when branches 2024-04-18 12:47:11 +10:00
Luke Boswell
a889810dfd
unwrap suffixed when condition 2024-04-18 09:44:57 +10:00
Luke Boswell
0198a683c7
fix unwrapping of trailing expr 2024-04-17 09:54:29 +10:00
Anton-4
99ca3f545f
clippy 2024-04-16 20:02:08 +02:00
Anton-4
1a5e065055
Merge branch 'main' into rust-1-76-0-upgrade 2024-04-16 13:33:27 +02:00
Luke Boswell
7a84dcd39c
don't unwrap intermediate answer if not required 2024-04-16 16:25:20 +10:00
Luke Boswell
c5cba98381
Merge remote-tracking branch 'remote/main' into suffixed-bang 2024-04-16 06:42:31 +10:00
Anton-4
5c45cc9c3e
fmt 2024-04-15 19:38:04 +02:00
Anton-4
dc96e194bd
clippy 2024-04-15 19:36:52 +02:00
Anton-4
a7b843743d
upgrade to rust 1.76.0 2024-04-15 19:20:07 +02:00
Anton-4
8502a37b3c
fmt 2024-04-15 16:51:07 +02:00
Anton-4
e4b814ce1c
clippy 2024-04-15 16:50:44 +02:00
Anton-4
4d9202ec6e
upgrade to rust 1.75.0 2024-04-15 16:29:23 +02:00
Luke Boswell
f9771a9983
split test_utils 2024-04-15 20:30:34 +10:00
Luke Boswell
7c94e4db04
cargo fmt 2024-04-15 14:38:20 +10:00
Luke Boswell
3cd1f13009
update test_syntax snapshot 2024-04-15 14:30:18 +10:00
Luke Boswell
ee42dfc317
add support for if-then-else 2024-04-15 14:20:49 +10:00
Luke Boswell
2a222f3a51
optimise by not unwrapping sometimes 2024-04-15 10:02:03 +10:00
Luke Boswell
7886d30b8e
parse/unwrap nested defs 2024-04-15 09:25:00 +10:00
Luke Boswell
129ca94733
remove unit type from EmptyDefsFinal 2024-04-14 13:45:07 +10:00
Luke Boswell
93ef5e42dc
fix tests, make clippy happy 2024-04-14 13:45:07 +10:00
Luke Boswell
f9fb59f0c2
cleanup and refactor suffixed tests 2024-04-14 13:45:07 +10:00
Luke Boswell
0143035dc0
cleanup, improve docs 2024-04-14 13:45:06 +10:00
Luke Boswell
c32fa5b600
support optional suffied last def 2024-04-14 13:45:06 +10:00
Luke Boswell
4625926486
suffixed tests passing 2024-04-14 13:45:06 +10:00
Luke Boswell
b13adf6898
more flexible statement parsing 2024-04-14 13:45:06 +10:00
Luke Boswell
68c00a1493
fix replace_value_def 2024-04-14 13:45:06 +10:00
Luke Boswell
bd264eb5c3
add new tests 2024-04-14 13:45:06 +10:00
Luke Boswell
5bb44fcce5
most tests passing 2024-04-14 13:45:05 +10:00
Luke Boswell
ed2b9e9703
fix split_defs and replace_def 2024-04-14 13:45:05 +10:00
Luke Boswell
f1d568b848
WIP try simplification 2024-04-14 13:45:05 +10:00
Luke Boswell
8b9e08bd76
WIP try simplification 2024-04-14 13:45:05 +10:00
Luke Boswell
85b76a14b4
cleanup, add some docs 2024-04-14 13:45:05 +10:00
Luke Boswell
0578db8685
move suffixed things into separate file 2024-04-14 13:45:05 +10:00
Luke Boswell
4fa58b60d8
remove excessive hashes in multilin string literal 2024-04-14 13:45:04 +10:00
Luke Boswell
c5ff88e94a
fix for ValueDefs with annotation, test for closures 2024-04-14 13:45:04 +10:00
Luke Boswell
79fc499c31
support multiple defs and statements 2024-04-14 13:45:04 +10:00
Luke Boswell
81aa6a0356
fix test failure 2024-04-14 13:45:04 +10:00
Luke Boswell
78797da661
cargo fmt 2024-04-14 13:45:04 +10:00
Luke Boswell
6f607aba11
WIP support nested suffixes 2024-04-14 13:45:03 +10:00
Luke Boswell
0d7b483c6e
WIP support nested suffixes 2024-04-14 13:45:03 +10:00
Luke Boswell
310b4d1b5a
WIP support nested suffixes 2024-04-14 13:45:03 +10:00
Luke Boswell
5a91a4f78a
WIP support nested suffixes 2024-04-14 13:45:03 +10:00
Luke Boswell
2200916c2b
WIP unwrapping suffixed expression 2024-04-14 13:45:03 +10:00
Luke Boswell
467cdf8226
changes 2024-04-14 13:45:03 +10:00