Commit graph

5554 commits

Author SHA1 Message Date
Agus Zubiaga
eb68bf943a
Merge branch 'main' into module-params 2024-01-27 09:36:20 -03:00
Brendan Hansknecht
bdbbfb36d1
add ROC_LINK_FLAGS support to linux 2024-01-26 20:55:16 -08: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
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
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