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
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
Luke Boswell
5e738a4ab5
fix recursion in top-level def
2024-04-19 10:34:33 +10: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
Anton-4
e4b814ce1c
clippy
2024-04-15 16:50:44 +02:00
Luke Boswell
7c94e4db04
cargo fmt
2024-04-15 14:38:20 +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
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
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
Luke Boswell
0d2afe4111
use # in ident
2024-04-14 13:45:02 +10:00
Luke Boswell
b010e8caba
desugar suffixed If-Then-Else expression
2024-04-14 13:45:02 +10:00
Luke Boswell
d08a51b134
cargo fmt
2024-04-14 13:45:02 +10:00
Luke Boswell
69a3a3c477
cleanup
2024-04-14 13:45:02 +10:00
Luke Boswell
5ae188c08f
cleanup
2024-04-14 13:45:01 +10:00
Luke Boswell
b8ec53738a
fix desugar for suffixed nodes
2024-04-14 13:45:01 +10:00
Luke Boswell
fac52f7408
parse statements correctly
2024-04-14 13:45:01 +10:00
Luke Boswell
997284e113
parse suffixed statements as defs
2024-04-14 13:45:00 +10:00
Luke Boswell
3c3e523b45
add suffixed to Identifer and QualifiedIdentifier
2024-04-14 13:45:00 +10:00