Commit graph

6636 commits

Author SHA1 Message Date
Richard Feldman
c4497f2c1c
Remove Nat from Num 2024-01-26 16:19:51 -05:00
Richard Feldman
02bc54292f
Update fmt tests to not use Nat 2024-01-26 16:17:06 -05:00
Richard Feldman
502b0fddf2
Remove Nat from Hash, Inspect, Encode, Decode 2024-01-26 16:17:05 -05:00
Richard Feldman
5b2998966b
Update List.replace to no longer use Nat 2024-01-26 16:06:09 -05:00
Richard Feldman
a8918a4e3b
Update List.dropAt to no longer use Nat 2024-01-26 16:06:09 -05:00
Richard Feldman
4a870c8ee0
Update Nat to U64 in some comments 2024-01-26 16:06:09 -05:00
Richard Feldman
a71188dc30
Update List.sublist to no longer use Nat 2024-01-26 16:06:08 -05:00
Richard Feldman
2cf7b5b5ca
Update List.swap to no longer use Nat 2024-01-26 16:06:08 -05:00
Richard Feldman
27474d4ed8
Update List.reserve to no longer use Nat 2024-01-26 16:06:08 -05:00
Richard Feldman
e207a7ce53
Use Variable::U64 for List.len in file load 2024-01-26 16:06:08 -05:00
Richard Feldman
4a38d3a1af
Remove Nat from some compiler tests that use lists 2024-01-26 16:06:08 -05:00
Richard Feldman
7e51dfd526
Update test fixtures to not use Nat indices 2024-01-26 16:06:07 -05:00
Richard Feldman
70a1def63b
Update some docs to not reference Nat 2024-01-26 16:06:07 -05:00
Richard Feldman
ef030ae656
Update a comment 2024-01-26 16:06:06 -05:00
Richard Feldman
6140c5023b
Remove Nat from TotallyNotJson 2024-01-26 16:05:57 -05:00
Richard Feldman
16ddb16177
Update Dict to no longer use Nat 2024-01-26 16:05:57 -05:00
Richard Feldman
77a10986d6
Update Set to no longer use Nat 2024-01-26 16:05:57 -05:00
Richard Feldman
97f21e65fe
Update ListLen and ListGetUnsafe to not use Nat 2024-01-26 16:05:56 -05:00
Richard Feldman
2e72021a74
Drop some obsolete U64 conversions in Str 2024-01-26 16:05:56 -05:00
Richard Feldman
df5b10e981
Update a readme to no longer mention Nat 2024-01-26 16:05:56 -05:00
Richard Feldman
0a4862da88
Update mono tests 2024-01-26 16:04:16 -05:00
Richard Feldman
09574203ce
Update to basic-cli 0.8.1 2024-01-26 16:02:30 -05:00
Richard Feldman
7f2e2d0803
Fix repro for nasty import bug
The bug reproduces if you go to the commit before this one;
seems to be the problem is importing an un-exposed value
as unqualified (possibly from a package, might be relevant)
2024-01-26 16:01:08 -05:00
Richard Feldman
bca6417a9d
Fix @as and @intCast argument order 2024-01-26 16:00:52 -05:00
Richard Feldman
632903bbde
Fix some tests 2024-01-26 16:00:33 -05:00
Richard Feldman
a1656381c5
Update some Result docs 2024-01-26 16:00:33 -05:00
Richard Feldman
9e3cff61d7
Remove Nat uses from Str 2024-01-26 16:00:33 -05:00
On vacation
4ee3431428
Merge branch 'main' into rust-1-72-upgrade 2024-01-26 13:39:34 +01:00
Brendan Hansknecht
abc4fd18cc
add --fuzz option to roc 2024-01-25 15:42:18 -08:00
Brian Teague
4499f8c6f4
isApproxEq function 2024-01-23 21:06:35 -05:00
Richard Feldman
a8b271c8d5
Copy tweaks to Str docs 2024-01-23 00:05:06 -05:00
Richard Feldman
07ddd272e2
Merge pull request #6361 from faldor20/fix-lang-server-hang
Fix hang from bad imports
2024-01-21 22:06:48 -05:00
Brendan Hansknecht
62c4c2dcb5
Merge branch 'main' into main 2024-01-21 12:17:44 -08:00
Richard Feldman
9cad19d8dc
Merge pull request #6395 from roc-lang/str-unicode
Remove scalars and graphemes from `Str`
2024-01-21 13:34:30 -05:00
Richard Feldman
4716139342
Merge pull request #6407 from lukewilliamboswell/luke-subs
Use subs caching on windows
2024-01-21 13:03:25 -05:00
Richard Feldman
2970fc4384
Merge remote-tracking branch 'origin/main' into str-unicode 2024-01-21 12:30:16 -05:00
Folkert de Vries
f3930d6faf
Merge pull request #6405 from roc-lang/list-clone
add `List.clone`
2024-01-21 12:04:22 +01:00
Luke Boswell
b1ffa5c99b use subs caching on windows 2024-01-21 22:00:17 +11:00
Folkert
8b5269a66c
update mono tests 2024-01-20 22:31:54 +01:00
Folkert
f1ffc36efe
add List.clone 2024-01-20 20:29:07 +01:00
Brendan Hansknecht
b6a5e5367c
build structs directly in the alloca 2024-01-20 09:44:46 -08: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
08e6b79dca
fmt: Simplify ModuleImport is_multiline 2024-01-20 08:39:33 -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
Agus Zubiaga
11e0202eb9
Parse inline imports and ingested files at the expression level
```
numbers =
    import "numbers.json" as numbersJson : Str
    import json.Decode exposing [decode, list, int]

    numbersJson
    |> decode (list int)
    |> Result.withDefault []
```
2024-01-20 08:35:50 -03:00
Agus Zubiaga
2d93f0c3f1
Extract ModuleImport/IngestedFileImport into structs for reuse 2024-01-20 08:35:50 -03:00
Agus Zubiaga
4d6e641864
Parse and format inline ingested file imports 2024-01-20 08:35:50 -03:00
Agus Zubiaga
42e755677c
Simply import parsing and formatting by using header::KeywordItem 2024-01-20 08:35:50 -03:00