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
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
Richard Feldman
e7c93bad75
Restore » in docs and allow it in highlighter
2024-01-18 22:23:06 -05:00
Richard Feldman
09c0453fc9
Fix HTML build
2024-01-18 21:51:50 -05:00
Luke Boswell
85fdef8a9b
fix doc comments in Str
2024-01-19 09:56:53 +11:00
Richard Feldman
894860118b
roc format
on builtins
2024-01-18 06:34:51 -05:00
William Barbosa
3882262b70
Fix remaining test cases
2024-01-18 08:15:02 +01:00
Richard Feldman
f2bd5efa41
update mono tests
2024-01-17 22:16:10 -05:00
Richard Feldman
88ea8ffb67
fix typo
2024-01-17 21:51:39 -05:00
Richard Feldman
b48fa0698a
Remove scalars and graphemes from Str
2024-01-17 21:30:34 -05:00
Richard Feldman
65738acb26
Update Str docs
2024-01-17 18:42:32 -05:00
Brendan Hansknecht
260b94b36d
Merge branch 'main' into rust-1-72-upgrade
2024-01-17 14:36:16 -08:00
Fabian Schmalzried
946f00e91b
Remove duplicate code in bitcode
...
Signed-off-by: Fabian Schmalzried <fabhof@posteo.de>
2024-01-16 16:19:39 +01:00
Richard Feldman
443b3c8851
Fix single-quote dollar parsing
2024-01-13 15:41:35 -05:00
faldor20
d1f60f9eae
fix formatting
2024-01-13 20:32:31 +10: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
faldor20
7de39df63e
Just stopping typechecking in interfaces when we have a package import
2024-01-09 06:21:35 +10: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
faldor20
ff7c2cf21b
Fixed in interfaces properly
2024-01-07 14:18:32 +10:00
faldor20
1d2ed391c8
formatting, clippy etx
2024-01-07 12:58:35 +10:00
faldor20
d2c3d346ad
added test for package
2024-01-07 12:52:31 +10:00
Richard Feldman
af8e9c7292
Parse deprecated interpolation syntax differently
2024-01-06 21:49:00 -05:00
faldor20
e43ef067b9
oops
2024-01-07 12:34:09 +10:00
faldor20
f4d71a5485
Finialised error and tested
2024-01-07 12:32:21 +10:00
faldor20
f36befdd4c
made nicer error
2024-01-07 11:28:05 +10: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
faldor20
124abc3620
kill process when would hang
2024-01-07 08:26:22 +10: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