Commit graph

27 commits

Author SHA1 Message Date
Luke Boswell
c8467b1fe0
Merge pull request #7454 from roc-lang/ayaz/error-on-invalid-generalized-types
Restrict usages of type variables in non-generalized contexts
2025-01-20 11:30:52 +11:00
Sam Mohr
3a6c622727
Fix failing tests, remove unnecessary NONE bitflag 2025-01-19 15:33:01 -08:00
Ian McLerran
297dd0233e
update internal references to Result.map 2025-01-15 19:55:27 -06:00
Sam Mohr
0edbf16d55
More progress 2025-01-05 05:16:47 -08:00
Agus Zubiaga
057a18573a
New module header
Implements the new `module` header syntax as described in "module and package changes" [1]:

```
module [Request, Response, req]
```

The old syntax should still work fine, and is automatically upgraded to the new one
when running `roc format`.

[1] https://docs.google.com/document/d/1E_77fO-44BtoBtXoVeWyGh1xN2KRTWTu8q6i25RNNx0/edit
2024-05-01 10:39:12 -03:00
Agus Zubiaga
d5a38a26db
Merge branch 'main' into inline-imports 2024-04-20 12:01:11 -03:00
Jonathan Schear
f511c061ab
Add blank line to test_load for Docs 2024-03-24 14:34:40 -04:00
faldor20
899dbdd7ec
cleanup tests and whitespace 2024-03-11 16:25:46 +10:00
faldor20
0b56882785
Unannotated types hover 2024-03-11 11:10:35 +10:00
faldor20
cdf218fe7a
first working version of docs hover 2024-03-11 11:10:34 +10:00
Richard Feldman
7e51dfd526
Update test fixtures to not use Nat indices 2024-01-26 16:06:07 -05: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
Bryce Miller
cb08225bf0
| -> where 2023-06-05 20:19:00 -04:00
Bryce Miller
91e37293a2
abilities syntax has -> implements 2023-05-24 21:29:38 -04:00
Brendan Hansknecht
21d063da26
add load tests from ingested files 2023-04-09 14:03:33 -07:00
Ayaz Hafiz
3d0a0a4a99
Update more dict/set references 2023-01-14 15:33:54 +01:00
Brendan Hansknecht
28835d5bf3
some bug fixes 2022-12-03 13:17:34 -08:00
Ayaz Hafiz
bedb26124d
Update load tests 2022-10-31 09:38:21 -05:00
Ayaz Hafiz
d55dbbf0ae
Update load test to work around constraining bug 2022-10-31 09:37:41 -05:00
Ayaz Hafiz
ccfb85325d
Update load tests 2022-10-12 16:38:37 -05:00
Ayaz Hafiz
c97cdc0753
Fix load tests 2022-09-30 13:40:35 -05:00
Richard Feldman
7908e8c176
roc format examples 2022-07-13 23:16:09 -04:00
Richard Feldman
1364f1e518
Reproduce #3451 2022-07-08 17:25:28 -04:00
Anton-4
eee85fa45d
moved all crates into seperate folder + related path fixes 2022-07-01 17:37:43 +02:00