Commit graph

5517 commits

Author SHA1 Message Date
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
Agus Zubiaga
65ce811587
Parse and format import package shorthand
The original proposal [1] suggested dropping the package shorthand,
but we later decided to keep it [2] to improve UX.

[1] https://docs.google.com/document/d/1E_77fO-44BtoBtXoVeWyGh1xN2KRTWTu8q6i25RNNx0/edit?usp=sharing
[2] 385104011
2024-01-20 08:35:50 -03:00
Agus Zubiaga
c56091ee3e
Module Params' proposal import syntax
I previously implemented the syntax in "Proposal: Module and Package Changes" [1]:

```
import [map, map2] from JsonDecode as JD
```

However, we decided [2] to use the one that appears in "Proposal: Module Params" [3]:

```
import JsonDecode as JD exposing [map, map2]
```

The new implementation also now supports comments and newlines between all the tokens.

[1] https://docs.google.com/document/d/1E_77fO-44BtoBtXoVeWyGh1xN2KRTWTu8q6i25RNNx0/edit
[2] 405410612
[3] https://docs.google.com/document/d/110MwQi7Dpo1Y69ECFXyyvDWzF4OYv1BLojIm08qDTvg/edit
2024-01-20 08:35:50 -03:00
Agus Zubiaga
5cd084b73c
Parse and format inline import with exposed names 2024-01-20 08:35:50 -03:00
Agus Zubiaga
76d799ea13
Parse and format aliases in import defs 2024-01-20 08:35:50 -03:00
Agus Zubiaga
933fde77a0
Parse and format top-level import defs with no alias or exposed members 2024-01-20 08:35:50 -03:00
Folkert
351c9215fe
dev backend: f32 abs 2024-01-19 15:16:32 +01:00
William Barbosa
3882262b70 Fix remaining test cases 2024-01-18 08:15:02 +01:00
Richard Feldman
443b3c8851
Fix single-quote dollar parsing 2024-01-13 15:41:35 -05:00
Anton-4
79ed84fff3
Merge pull request #6355 from B-Teague/merge-gitignore
Consolidate gitignore
2024-01-12 13:29:32 +01:00
Brian Teague
60c639b60e
Consolidate gitignore
Keep certain files with no file extension

Keep specific files with no file extension

Delete all gitignore files
2024-01-10 22:16:04 -05:00
Luke Boswell
6bdcc4743a
Merge pull request #6363 from roc-lang/windows-llvm-setjmp-longjmp
fix for bugged setjmp/longjmp on windows/llvm
2024-01-09 22:00:15 +11:00
Brendan Hansknecht
3559326996
Set debug info version
We just missed setting it. Set it as specified in the docs: https://thedan64.github.io/inkwell/inkwell/debug_info/index.html#setting-up-the-module-for-holding-debug-info
Not sure why it is 3, but that is the value in the llvm tutorial as well: https://llvm.org/docs/SourceLevelDebugging.html

Fixes #6367
2024-01-08 20:28:42 -08:00
Luke Boswell
6b77aa93d5
force windows_setjmp & windows_longjmp 2024-01-08 12:31:09 +11:00
Folkert
b9b19d6054
fix for bugged setjmp/longjmp on windows/llvm 2024-01-07 23:04:11 +01:00
Richard Feldman
ff2704056e
Fix some tests 2024-01-07 00:00:37 -05:00
Richard Feldman
af8e9c7292
Parse deprecated interpolation syntax differently 2024-01-06 21:49:00 -05:00
Folkert de Vries
08ab7996a0
Merge pull request #6357 from roc-lang/dollar
Add support for $(...) string interpolation syntax
2024-01-06 22:20:19 +01:00
Richard Feldman
163bde0c41
Update tests to use $(...) interpolation 2024-01-06 15:06:30 -05:00
Richard Feldman
25be487977
Add $(...) string interpolation syntax 2024-01-06 15:04:22 -05:00
Anton-4
da741cf8d8
Merge pull request #6359 from roc-lang/output-extension
stop overwritting manually set file extensions
2024-01-06 19:51:41 +01:00
Brendan Hansknecht
2466e2eb3b
Merge pull request #6356 from roc-lang/box-rc
Fix RC for unions with non-refcounted fields
2024-01-06 10:45:30 -08:00
Folkert de Vries
b5f2ac2b6d
Merge pull request #6358 from roc-lang/float-checked-llvm
32-bit float checked float operations assumed f64
2024-01-06 18:32:34 +01:00
Brendan Hansknecht
607d2d6adc
stop overwritting manually set file extensions 2024-01-06 09:10:23 -08:00
Brendan Hansknecht
a2fcf76164
make sure that union refcounting branches to the decrement block 2024-01-06 08:34:46 -08:00
Folkert
9c94930d6a
32-bit float checked float operations assumed f64 2024-01-06 16:05:01 +01:00
Folkert
f3abb3b466
add instructions to the right block 2024-01-06 15:52:53 +01:00
Brendan Hansknecht
88bac5eba7
ensure unions get freed even if they have no RC fields (hit when using box) 2024-01-05 22:20:58 -08:00
Folkert
05c8521211
clippy 2024-01-02 22:39:59 +01:00
Folkert
33dfd5d27d
cleanup 2024-01-02 22:28:57 +01:00
Folkert
7a365eb88f
enable even more dev-backend num tests 2024-01-02 22:23:47 +01:00
Folkert
b7a41bcb3e
enable many more dev-backend num tests 2024-01-02 21:30:49 +01:00
Folkert
6c521555ea
decimal division in dev backend 2024-01-02 19:53:13 +01:00
Folkert
4bcd195b92
implement NumSub (that panics) in the dev backend 2024-01-02 19:47:17 +01:00
Folkert
cfdfbe18a4
implement panic on overflow for mul in the dev backend 2024-01-02 15:56:28 +01:00
Ayaz
865eff1956
Merge pull request #6331 from roc-lang/clippy-unnecessary-hashes
fix clippy (1.72.1) unnecessary hashes
2024-01-01 11:26:07 -06:00
Anton-4
5f1c383aa0
fmt 2024-01-01 17:11:46 +01:00
Anton-4
1126f85b5a
fix clippy unnecessary hashes 2024-01-01 16:38:36 +01:00
Anton-4
728f36cff8
crate upgrades for ahash issue
cli_run::static_site_gen was hitting 'use of unstable library feature stdsimd' when compiling ahash. ahash was a dependency of hashbrown 0.13.2.
2023-12-30 16:16:22 +01:00
Richard Feldman
7952fa2e73
Delete unused arena-pool crate 2023-12-26 10:59:14 -05: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
Anton-4
cf96010543
update to basic-cli 0.7.1 2023-12-23 16:54:59 +01:00
JRI98
689a1ff352
Fix list rest bind in when branch tuple destructure 2023-12-21 11:55:29 +00:00
Bryce Miller
a710dd18ac
Merge branch 'main' into list-walk-with-index-until 2023-12-18 17:25:06 +01:00
Bryce Miller
12d1d7386b
modify test to sidestep wasm gen bug 2023-12-18 11:24:11 -05:00
Brendan Hansknecht
2955b00bb5
Merge branch 'main' into luke-windows 2023-12-14 08:59:53 -08:00