Commit graph

78 commits

Author SHA1 Message Date
JRI98
a332acd7bf
Remove unused malformed related variants 2024-11-14 10:23:06 +00:00
Agus Zubiaga
ecc5fa57dd
Check record field suffixes in annotations 2024-11-09 02:06:05 -03:00
Agus Zubiaga
bc0cfef128
Restore UNNCESSARY DEFINITION errors for top-level defs
Non-top-level defs are already covered
2024-11-07 18:54:25 -03:00
Agus Zubiaga
c9f001b041
Allow ignored defs with an effectful RHS 2024-11-07 18:54:22 -03:00
Agus Zubiaga
2cce5ad023
Allow unsuffixed statements in parser
Moves the "STATEMENT AFTER EXPRESSION" error from the parser to canonicalization.
We'll later use this to allow this case in effectful functions.
2024-11-07 18:54:14 -03:00
Sam Mohr
6a2ffb2f5a
Implement most of the recent round of PR feedback 2024-10-26 04:17:50 -07:00
Sam Mohr
b3e60f9d3a
Implement return keyword 2024-10-20 08:58:59 -07:00
Sam Mohr
2da08be8ef
Remove old record builder syntax 2024-09-21 04:44:44 -07:00
Anton-4
02cf61f985
Merge pull request #7038 from mulias/expr-dbg
Support `dbg` in expressions
2024-09-02 13:30:32 +02:00
Elias Mulhall
56c5b790a7 Refactor dbg expression parsing to work more like function application
Instead of parsing dbg with an expression block, parse the dbg keyword
with no additional arguments. This way the parser treats dbg just like a
variable in function application. We desugar by pattern matching on
`Apply(Dbg, args, called_via)` nodes. This changes the output of syntax
tests since the initial AST is different, but does not change the output
of can or mono.

Add two new errors for dbg in expression position with either no args or
too many args. This is similar to the error behavior of `crash`.

Continue to parse dbg statements with an expression block, as before.
2024-08-29 15:36:48 -04:00
Sam Mohr
12df3a04de
Merge attempt 2024-08-19 23:34:05 -07:00
Sam Mohr
50f6e11423
Deprecate backpassing to prepare for eventual removal 2024-08-16 22:36:04 -07:00
Agus Zubiaga
762799052e
Merge branch 'main' into typecheck-module-params 2024-08-07 18:55:33 -03:00
Luke Boswell
b489c44b19
Merge remote-tracking branch 'remote/main' into builtin-task 2024-07-19 19:51:50 +10:00
Sam Mohr
fe1b6d71fc
Update from PR comments 2024-07-07 18:33:20 -07:00
Sam Mohr
f415017c90
Implement new builder syntax alongside old one 2024-07-07 03:28:59 -07:00
Agus Zubiaga
0cbb352a89
Move unexpected params warning to solve 2024-07-06 21:36:26 -03:00
Agus Zubiaga
f80cb341a6
Move ScopeModules to can 2024-07-05 21:35:52 -03:00
Agus Zubiaga
922b1c44ef
Report missing params 2024-07-02 11:10:00 -03:00
Agus Zubiaga
bc6a84a215
Report unexpected params 2024-07-02 11:09:59 -03:00
Sam Mohr
700c7ae9aa
Add Task as a built-in module/type 2024-06-25 00:03:56 -07:00
Richard Feldman
8357bd8c91
Revise errors for undeclared type vars in aliases 2024-05-12 21:20:11 -04:00
Agus Zubiaga
7efc7a4a3e
Canonicalize ingested files directly instead of creating AST nodes 2024-04-23 18:55:41 -03:00
Agus Zubiaga
7a53484479
Report an error when import shadows a symbol in scope 2024-04-20 12:38:17 -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
842a256907
Implement import aliases
Allows a module to be imported with an alias:

    import JsonDecode as JD

Import aliases must be unique and they cannot have the same name
as an imported module.
2024-04-20 12:07:01 -03:00
Luke Boswell
8b9e08bd76
WIP try simplification 2024-04-14 13:45:05 +10:00
Ayaz Hafiz
703ef6608e
Fix errors 2023-10-25 17:14:49 -05:00
Ayaz Hafiz
9d365a8a57
Support basic diagnostic reporting 2023-10-25 17:14:32 -05:00
Richard Feldman
2da41be29f
Merge remote-tracking branch 'origin/main' into abilities-syntax 2023-08-10 20:36:01 -04:00
Folkert
ef39bad7c6
auto clippy fixes 2023-07-10 18:27:08 +02:00
Bryce Miller
e463ccf4a6
merge main 2023-06-07 20:36:54 -04:00
Ajai Nelson
2e5fef5231
Improve error messages involving ignored variables
Fix #3987
2023-06-06 19:46:15 -04:00
Bryce Miller
17c733ec81
has -> implements in roc_problem::can::Problem 2023-05-20 21:12:26 -04:00
Agustin Zubiaga
d2a57112fd Unapplied record builder error 2023-05-08 20:16:38 -03:00
Agustin Zubiaga
6670fbb1ab Multiple record builder error 2023-05-08 19:26:47 -03:00
Brendan Hansknecht
8f4945f286
make file loading errors that happen late in compilation still fatal 2023-04-09 14:03:33 -07:00
Brendan Hansknecht
f42f61e271
run a toml formatter and then clean it up a bit 2023-03-06 19:47:57 -08:00
Brendan Hansknecht
4a89bee0a5
centralize package versions except for vendor and excluded 2023-03-06 19:29:09 -08:00
Brendan Hansknecht
5485c8a5b0
update to using workspace package spec 2023-03-06 16:36:18 -08:00
Ayaz Hafiz
705ce10085
New problem dropped 2022-12-02 14:14:18 -06:00
Ayaz Hafiz
8e2c2e1809
It's an error to expose values that aren't defined 2022-12-02 14:11:58 -06:00
Ayaz Hafiz
e438fbf37c
Enumerate severity on problem variants 2022-12-02 14:11:57 -06:00
Ayaz Hafiz
0a807dc43e
Provide warning for defs that are used only in (mutual) recursion
This patch provides errors for defs that are used only in
possibly-mutual recursion, and are not reachable outside of their
recursive closures. For example:

```
test_report!(
    mutual_recursion_not_reached_nested,
    indoc!(
        r#"
        app "test" provides [main] to "./platform"

        main =
            f = \{} -> if Bool.true then "" else g {}
            g = \{} -> if Bool.true then "" else f {}
            ""
        "#
    ),
@r###"
── DEFINITIONs ONLY USED IN RECURSION ──────────────────── /code/proj/Main.roc ─

These 2 definitions are only used in mutual recursion with themselves:

4│>      f = \{} -> if Bool.true then "" else g {}
5│>      g = \{} -> if Bool.true then "" else f {}

If you don't intend to use or export any of them, they should all be
removed!
"###
);
```
2022-12-02 11:50:12 -06:00
Ayaz Hafiz
e2b30e5301
Constrain + solve crash 2022-11-24 14:46:50 -06:00
Ayaz Hafiz
8dfc9c0367
Inline BadType::BadTypeArguments in canonicalization errors 2022-11-08 14:11:25 -06:00
Ayaz Hafiz
c9953129cb
Remove problem storage in Type::Erroneous 2022-11-08 14:11:24 -06:00
Luke Boswell
cec67721e6
merge upstream/main 2022-11-06 09:27:46 +11:00
Luke Boswell
2c2a70b8e7 Merge remote-tracking branch 'upstream/main' into rust-docs 2022-11-06 09:15:57 +11:00