Commit graph

201 commits

Author SHA1 Message Date
Agus Zubiaga
dc18597a0e
Report unfinished exposing in imports 2024-05-06 23:24:56 -03:00
Agus Zubiaga
f81985533c
Report import lowercase alias 2024-05-06 23:16:18 -03:00
Agus Zubiaga
97ed8fdbbd
Report unfinished import as 2024-05-06 23:03:40 -03:00
Agus Zubiaga
bfb77b78cb
Report import ending syntax error 2024-05-06 22:22:00 -03:00
Agus Zubiaga
007e03891e
Report module name / path syntax error in imports 2024-05-06 21:00:17 -03:00
Agus Zubiaga
520dc389f3
Report ingested file annotation syntax error 2024-05-05 17:45:37 -03:00
Agus Zubiaga
8dedd9f03c
New app header syntax
Implements the new app header syntax as discussed in Zulip [1].

    app [main] {
	cli: platform "../platform/main.roc",
	json: "../json/main.roc"
    }

Old headers still parse and are automatically upgraded to the new
syntax by the formatter.

[1] 418444862
2024-05-01 10:49:01 -03: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
a8a829aadd
Merge branch 'main' into inline-imports 2024-04-28 00:11:29 -03:00
Richard Feldman
00950d2a0e
Update insta snapshots 2024-04-26 06:59:01 -04:00
Richard Feldman
6571c18a35
Update tests 2024-04-25 23:10:45 -04:00
Agus Zubiaga
5112e064e5
Add module_path to can env instead of threading it through 2024-04-21 10:30:34 -03:00
Agus Zubiaga
7ebfc6d06d
Support both inline and header imports
Load will now convert header imports to inline import defs, so that
we can support both temporarily.
2024-04-20 19:04:09 -03:00
Agus Zubiaga
979aff8bf7
Explicit builtin import warning
We will now show a warning if a builtin is imported explicitly,
since this is unncessary.

We will not show the warning if they expose functions from the builtin:

	import Dict exposing [isEmpty]

However, we will show a special warning if they expose types from it:

	import Dict exposing [Dict, isEmpty]
2024-04-20 12:35:46 -03:00
Agus Zubiaga
1f347f6ca1
Fix package module resolution in inline imports
We were still passing `ModuleIds` from `load` to `can`, but now
that imports can appear in any scope, we don't know which package
an unqualified module name belongs to from the top level.

We now pass `PackageModuleIds` instead  and keep a Map of `ModuleName` to
`ModuleId` in `Scope`.

This also allow us to import multiple modules with the same name from different
packages as long as a unique alias is provided.
2024-04-20 12:16:37 -03:00
Agus Zubiaga
d5a38a26db
Merge branch 'main' into inline-imports 2024-04-20 12:01:11 -03:00
Luke Boswell
c5cba98381
Merge remote-tracking branch 'remote/main' into suffixed-bang 2024-04-16 06:42:31 +10:00
Luke Boswell
f9771a9983
split test_utils 2024-04-15 20:30:34 +10:00
Luke Boswell
93ef5e42dc
fix tests, make clippy happy 2024-04-14 13:45:07 +10:00
Richard Feldman
ec64da3416
Merge pull request #6627 from roc-lang/default-value-record
Change docs/errors from "optional" to "default value" record fields
2024-04-04 22:25:45 -04:00
Brendan Hansknecht
482c084096
Change docs/errors from "optional" to "default value" record fields
I strongly believe that seeing the word "optional" is priming people wrong when it comes to this feature.
Especially given roc dose not have an `Optional/Option/Maybe` type, so users look for an alternative and find this.

This PR changes the name to "default value record fields".
It updates all docs and errors.
It does not update compiler internal naming.
That can be updated in a follow up PR if we want to, but I am also fine leaving it cause it is not exposed to users.
2024-04-03 08:55:35 -07:00
Brendan Hansknecht
6dc5bfb1b7
Use roc_target over target_lexicon
Tailors a target class for our needs.
Replaces tons of uses across the entire compiler.
This is a base for later adding new targets like thumb.
2024-03-31 10:50:26 -07:00
Luke Boswell
e74501981e
fmt and clippy fixes 2024-03-20 12:31:04 +11:00
Luke Boswell
3b2e9e36b8
rename operator.rs to desugar.rs 2024-03-17 15:57:27 +11:00
Richard Feldman
ffd72b184b
Fix tests 2024-02-27 11:35:06 -05:00
Richard Feldman
6f84e24fa5
Merge remote-tracking branch 'origin/main' into more-dollars 2024-02-26 23:06:23 -05:00
JRI98
acbbdd0f7b
Improve handling of multi pattern unbound variables 2024-02-23 15:22:23 +00:00
Anton-4
b5f68bc020
Merge pull request #6525 from roc-lang/fix_text_contrast
less colors and more contrast in terminal
2024-02-20 15:46:13 +01:00
Anton-4
f66711d53e
re-use strip_colors 2024-02-16 16:32:46 +01:00
Anton-4
719e32e0f0
clippy 2024-02-14 18:18:16 +01:00
Richard Feldman
24a38c4a26
Merge remote-tracking branch 'origin/main' into remove-nat 2024-02-11 12:26:36 -05:00
Anton-4
3c7a834da1
update to new interpolation syntax 2024-02-02 13:39:10 +01:00
Richard Feldman
d84de324d8
Update insta tests 2024-01-28 14:57:39 -05:00
Richard Feldman
bf660ad094
Remove Nat from tests 2024-01-26 16:19:52 -05:00
Richard Feldman
502b0fddf2
Remove Nat from Hash, Inspect, Encode, Decode 2024-01-26 16:17:05 -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
William Barbosa
3882262b70 Fix remaining test cases 2024-01-18 08:15:02 +01:00
Richard Feldman
7189104df8
Update roc code base to use $(...) syntax 2024-01-06 18:03:00 -05:00
Anton-4
1126f85b5a
fix clippy unnecessary hashes 2024-01-01 16:38:36 +01:00
Brendan Hansknecht
3966d63e2f
add src and location to dbg 2023-12-02 21:18:31 -08:00
Brendan Hansknecht
82cda1965c
use INSPECT_INSPECT_ABILITY instead of INSPECT_INSPECT 2023-11-28 16:40:41 -08:00
Anton-4
73597778b9
minor wording change
Signed-off-by: Anton-4 <17049058+Anton-4@users.noreply.github.com>
2023-11-28 11:41:54 +01:00
caryoscelus
2fc8e88cca
Report lacking platform name in app header 2023-11-28 05:52:43 +00:00
caryoscelus
3332503f1d
Test reporting lack of to in app header 2023-11-28 02:18:50 +00:00
Richard Feldman
5e911f14d8
Merge pull request #6057 from lsculv/record-field-error-typo
Fix typo 'I trying' -> 'I am trying'
2023-11-22 09:12:30 -05:00
Lucas Culverhouse
3c05690997
Fix typo 'I trying' -> 'I am trying' 2023-11-21 17:33:57 -08:00
jecaro
57f55dbe7e
Fix typo 2023-11-21 19:47:27 +01:00
Brendan Hansknecht
2de96ed5a8
add spread as test 2023-11-20 21:09:12 -08:00
Brendan Hansknecht
9cf0d5366f
add test case for exhaustiveness checking of list with rest and front and back 2023-11-20 21:09:12 -08:00
jecaro
2ffe2fd2dd
fix golden tests accordingly 2023-11-17 10:51:27 +01:00