Commit graph

57 commits

Author SHA1 Message Date
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
Richard Feldman
c03dc17ab4
Merge remote-tracking branch 'origin/main' into repl 2022-11-05 01:04:44 -04:00
Folkert
66a1ba00eb
1.65 clippy fixes 2022-11-03 16:20:37 +01:00
Luke Boswell
f3bdb5f321
updating rust package documentation 2022-11-03 20:00:06 +11:00
Richard Feldman
0980d2d357
Add Problem::region 2022-11-01 00:23:54 -04:00
Ayaz Hafiz
b0a8b85de3
Canonicalization of list patterns 2022-10-31 17:04:47 -05:00
Ayaz Hafiz
cfe7c8e5ef
Warn on the presence of unnecessary wildcards in output positions 2022-10-31 09:38:20 -05:00
Ayaz Hafiz
603160dae3
Report errors for duplicate bound abilities 2022-10-24 13:59:50 -05:00
Ayaz Hafiz
92aa0912ea
Report unused imports in modules 2022-09-30 13:40:34 -05:00
Ayaz Hafiz
5f117be306
Improve error message when shadowing builtin type
Closes #3109
2022-09-30 13:40:34 -05:00
Ayaz Hafiz
b30c90b500
Don't suggest removing variable when it's bound in a branch pattern
Instead, suggest prefixing it with an underscore, or replacing with an
underscore.

Closes #3820
2022-08-19 22:21:44 -05:00
Richard Feldman
97e2900bf5
s/rtfeldman/roc-lang/g in links to GitHub repos 2022-08-12 15:24:09 -04:00
Ayaz Hafiz
fdb79da5a8
Report anonymous functions as "this function" rather than symbol name
Closes #2453

Thanks for the assist @chris-packett
2022-08-10 15:26:52 -07:00
Anton-4
6a15a7b41b
changed Cargo versions from 0.1.0 to 0.0.1 2022-08-03 11:41:19 +02:00
Ayaz Hafiz
b87f09115c
Report opaques as opaques, not aliases
Closes #3313
Closes #3654
2022-08-01 08:02:56 -05:00
Ayaz
6b6f240acb
Merge pull request #3589 from rtfeldman/can-abilities3
Canonicalize syntactic abilities: Part 3 - solving
2022-07-25 21:48:14 -05:00
Folkert de Vries
d212dffa1a
Merge pull request #3616 from rtfeldman/i3614
Compile branches in the presence of degenerate patterns
2022-07-25 19:45:36 +02:00
Ayaz Hafiz
10db3f8574
Detect ability specializations that overload different opaque types 2022-07-25 11:35:20 -04:00
Ayaz Hafiz
0de32ac5a9
Warn on definitions that introduce no new variables 2022-07-24 16:11:04 -04:00
Ayaz Hafiz
beccc92c87
Support underscores in assignment patterns 2022-07-24 16:11:03 -04:00
Ayaz Hafiz
59ab1da83f
Compile branches in the presence of degenerate patterns
Closes #3614
2022-07-22 18:16:02 -04:00
Ayaz Hafiz
78dc82867a
Report errors for identifiers not bound in all patterns of a branch 2022-07-21 12:15:05 -04:00