Commit graph

784 commits

Author SHA1 Message Date
Luke Boswell
448c29353e
Merge pull request #6134 from faldor20/lsp_completion
Support for completion in the language server
2024-02-09 18:43:40 +11:00
Folkert de Vries
0e7fee4e7f
Merge pull request #6486 from roc-lang/remove-unused-lowlevel
Remove unused lowlevel StrGetCapacity
2024-02-04 13:57:46 +01:00
JRI98
be30e470a8
Don't skip closure captures when fixing them 2024-02-03 23:19:08 +00:00
Richard Feldman
f79ff6d496
Remove unused lowlevel StrGetCapacity 2024-02-01 21:37:16 -05:00
Richard Feldman
aabd95404f
Merge remote-tracking branch 'origin/main' into remove-nat 2024-01-30 21:42:45 -05:00
Folkert
21b540751a
force interpolated variables to be of type string 2024-01-30 15:04:56 +01:00
Kiryl Dziamura
b3dfdb562b
crash on rem div by zero 2024-01-30 11:12:02 +01:00
Richard Feldman
7c19b42a99
Merge pull request #6457 from roc-lang/division-by-zero
Division by zero
2024-01-29 08:37:31 -05:00
Richard Feldman
3e27e18566
Merge remote-tracking branch 'origin/main' into remove-nat 2024-01-29 07:23:58 -05:00
Eli Dowling
c081bb7016
Removed LatestDocument and replaced it with a OnceLock
Signed-off-by: faldor20 <eli.jambu@yahoo.com>

removed unused imports

Signed-off-by: faldor20 <eli.jambu@yahoo.com>
2024-01-29 21:54:47 +10:00
Eli Dowling
a988ee29ff
scoping all working and patterns too
Signed-off-by: faldor20 <eli.jambu@yahoo.com>
2024-01-29 21:54:45 +10:00
Eli Dowling
049c0e6358
function params and local variables working
Signed-off-by: faldor20 <eli.jambu@yahoo.com>
2024-01-29 21:54:44 +10:00
Folkert
979128cf32
make division by zero (integer) not trap 2024-01-29 01:38:32 +01:00
Agus Zubiaga
eb68bf943a
Merge branch 'main' into module-params 2024-01-27 09:36:20 -03:00
Richard Feldman
fb84c9487d
Remove Num.Natural, Num.toNat, and Num.toNatChecked 2024-01-26 16:23:20 -05:00
Richard Feldman
9518d76cd8
Remove Num.bytesTo___ functions
These may be reintroduced in some form later,
but they don't handle endianness and it's not
clear builtins are the right place for them.
2024-01-26 16:23:19 -05:00
Richard Feldman
c4497f2c1c
Remove Nat from Num 2024-01-26 16:19:51 -05:00
Richard Feldman
ef030ae656
Update a comment 2024-01-26 16:06:06 -05:00
On vacation
4ee3431428
Merge branch 'main' into rust-1-72-upgrade 2024-01-26 13:39:34 +01:00
Richard Feldman
2970fc4384
Merge remote-tracking branch 'origin/main' into str-unicode 2024-01-21 12:30:16 -05:00
Folkert
f1ffc36efe
add List.clone 2024-01-20 20:29:07 +01:00
Agus Zubiaga
002493e32c
Load and can ingested file imports
Moves handling of ingested file imports from load to can, so that they
can be properly introduced in the scope they appear.

Example:

  import "input.txt" as input : Str

  image =
      import "image.png" as bytes : List U8
      # `bytes` is only available under `image`
      decodePng bytes

  ...
2024-01-20 08:43:40 -03:00
Agus Zubiaga
7b3317dbb6
Update unused warnings for inline imports
Now that imports can be limited to smaller scopes than the entire module,
unused import warnings need to work like unused def warnings.

This commit moves unused import warnings discovery and reporting from load
to canonicalization where we can track their usage per scope.

This also fixes a longstanding bug where unused exposed names from an import
were not reported if they were only used in a qualified manner.
2024-01-20 08:43:36 -03:00
Agus Zubiaga
c617963b22
Load and can imports inside defs
After parsing a module, we now recursively traverse the tree to find
all imports inside Defs, not just the top-level ones.

Previously, imported modules were available in the entire file,
but that's no longer the case. Therefore, Scope now keeps track of
imported modules and Env::qualified_lookup checks whether a module
is available in the provided scope.

Note: Unused import warnings are still global and need to be updated.
2024-01-20 08:39:33 -03:00
Agus Zubiaga
710d62f754
Load and can new top-level imports
Previously, all imports were available in the header, so we could start
processing dependencies as soon as we parsed it. However, the new imports
are treated as defs, so we have to parse the whole module to find them.

This commit essentially moves the dependency resolution from the `LoadHeader`
phase to the `Parse` phase, and it updates canonicalization to introduce
module symbols into scope when a `ValueDef::ModuleImport` is encountered.

NOTE:
- The `imports` header still parses, but it's no longer wired up. I will remove
it in an upcoming commit.
- Ingested files and imports that appear in nested expressions are not
yet supported by load
2024-01-20 08:39:31 -03:00
Richard Feldman
b48fa0698a
Remove scalars and graphemes from Str 2024-01-17 21:30:34 -05:00
Brendan Hansknecht
260b94b36d
Merge branch 'main' into rust-1-72-upgrade 2024-01-17 14:36:16 -08:00
Richard Feldman
af8e9c7292
Parse deprecated interpolation syntax differently 2024-01-06 21:49:00 -05:00
Richard Feldman
8ea38d3a04
Parse deprecated interpolation syntax differently 2024-01-06 18:26:27 -05:00
Richard Feldman
7189104df8
Update roc code base to use $(...) syntax 2024-01-06 18:03:00 -05:00
Anton-4
c85a25e320
clippy fixes 2024-01-01 19:19:44 +01:00
Anton-4
cd632fe549
Merge branch 'main' of github.com:roc-lang/roc into clippy-1.74 2023-12-25 17:05:37 +01:00
Brendan Hansknecht
e5a0af5699
make DbgFormatter an unexposed implementation detail 2023-12-03 12:41:04 -08:00
Brendan Hansknecht
b04699acdf
change debug to call Inspect.inspect instead of inlining it
This is to workaround #6167 and can be reverted once it is fixed
2023-12-03 09:51:55 -08:00
Brendan Hansknecht
e8d2deca90
fix off by one in roc_dbg 2023-12-03 08:22:04 -08:00
Brendan Hansknecht
5e8974177c
avoid bloating parse expr size 2023-12-02 21:18:32 -08:00
Brendan Hansknecht
3966d63e2f
add src and location to dbg 2023-12-02 21:18:31 -08:00
Brendan Hansknecht
4072a2a745
attempt to switch to inlined Inspect.inspect in autoderive 2023-12-02 21:18:31 -08:00
Brendan Hansknecht
4c2eb8b378
Change the generated inspect for Opaque types to print (@Opaque payload) 2023-12-02 21:18:30 -08:00
Ayaz
aaba3f4d82
Merge branch 'main' into clippy-1.74 2023-12-02 20:09:06 -06:00
Brendan Hansknecht
1f14aa84a2
misc cleanup suggestions 2023-11-29 21:05:56 -08:00
Brendan Hansknecht
b7f72eff86
add basic Dbg desugaring and LowLevelDbg 2023-11-29 21:05:48 -08:00
Ayaz Hafiz
5c805ce80f
Get first inspect for non-Inspect-implementing opaques specialized 2023-11-28 16:40:39 -08:00
Ayaz Hafiz
c87e3e7413
TODO 2023-11-28 16:40:39 -08:00
Richard Feldman
d0841fb018
Add derive key for Inspect 2023-11-28 16:40:39 -08:00
Elias Mulhall
d924125e6d
remove unnecessary comment 2023-11-26 20:26:42 -05:00
Elias Mulhall
439ce1143c
desugar patterns during canonicalization
Traverse pattern ASTs and desugar two cases

- Desugar optional record field default value expr. This expr might
  contain nodes that need to be desugared, such as binary operations.
  Failing to desugar this expr can cause an internal panic later in
  canonicalization.

- Discard SpaceBefore and SpaceAfter nodes so that patterns can be
  destructured over multiple lines. Keeping these nodes can cause an
  internal panic later in canonicalization. Fixes [1].

[1]: https://github.com/roc-lang/roc/issues/5653.
2023-11-26 20:26:42 -05:00
Elias Mulhall
0a48962abe
replace unreachable! with internal_error! in expr canonicalization
See https://github.com/roc-lang/roc/issues/2046
2023-11-26 20:26:34 -05:00
Folkert
c019ced31d
various 2023-11-18 23:05:55 +01:00
Folkert
d7c1be6a44
redundant closure call 2023-11-18 22:51:45 +01:00