Commit Graph

108 Commits

Author SHA1 Message Date
Emi Simpson
7db55e4662
📝️ Add a test for #2422 2022-02-25 11:41:47 -05:00
Emi Simpson
40375adbb0
Merge remote-tracking branch 'upstream/trunk' into fix-panic-on-unimported-module 2022-02-25 09:18:19 -05:00
Emi Simpson
4d10c22442
🐛️ Handle unimported modules properly
helpful error, not panic!

Closes #2422
2022-02-24 20:52:25 -05:00
ayazhafiz
e8867d6355 Add opaques scope-escaping test @rtfeldman suggested 2022-02-21 23:40:00 -05:00
ayazhafiz
321a970215 Add qualified opaque reference reporting test 2022-02-21 18:32:23 -05:00
ayazhafiz
90de82e295 Validation of opaques during canonicalization 2022-02-21 18:25:19 -05:00
ayazhafiz
6b53692aac Canonicalize opaque types 2022-02-20 13:47:01 -05:00
ayazhafiz
6104a27b45 Parse opaque references 2022-02-19 21:30:42 -05:00
ayazhafiz
8c0e39211d Instantiate recursive aliases to their smallest closures
Now, when we have two aliases like

```
T a : [ A, B (U a) ]
U a : [ C, D (T a) ]
```

during the first pass, we simply canonicalize them but add neither to
the scope. This means that `T` will not be instantiated in the
definition of `U`. Only in the second pass, during correction, do we
instantiate both aliases **independently**:

```
T a : [ A, B [ C, D (T a) ] ]
U a : [ C, D [ A, B (U a) ] ]
```

and now we can mark each recursive, individually:

```
T a : [ A, B [ C, D <rec1> ] ] as <rec1>
U a : [ C, D [ A, B <rec2> ] ] as <rec2>
```

This means that the surface types shown to users might be a bit larger,
but it has the benefit that everything needed to understand a layout of
a type in later passes is stored on the type directly, and we don't need
to keep alias mappings.

Since we sort by connected components, this should be complete.

Closes #2458
2022-02-11 08:43:33 -05:00
ayazhafiz
c064c50036 Catch illegal alias cycles more strictly
Part of #2458
2022-02-10 22:12:33 -05:00
ayazhafiz
a863e3cf1b Restore regressions 2022-02-06 15:04:13 -05:00
ayazhafiz
0d241f3c3c Only expand ErrorType::Range's type range when range unification fails 2022-02-06 15:04:13 -05:00
ayazhafiz
680bf8e0b7 Treat rigids as flex vars when checking number range types 2022-02-06 15:04:12 -05:00
ayazhafiz
c5d918e68c Include floats in bounds for unspecified numbers 2022-02-06 15:04:12 -05:00
ayazhafiz
8dc92ccd97 Second pass 2022-02-06 15:04:12 -05:00
ayazhafiz
5e0d90ac53 First pass 2022-02-06 15:04:12 -05:00
Folkert de Vries
d25e891fb0
Merge pull request #2451 from rtfeldman/fix-arc-panic
Fix Arc panic
2022-02-06 16:45:38 +01:00
Richard Feldman
3e388e2651
Don't print "no hints" on Package-Config parse error 2022-02-06 08:05:33 -05:00
Folkert
d9eea360fd formatting 2022-02-06 13:26:32 +01:00
Folkert
e656886861 add test for UnknownGeneratesWith 2022-02-06 12:50:50 +01:00
Folkert
2f453cfea2 add test for UnusedImport 2022-02-06 12:34:23 +01:00
Folkert
5e16515d22 only generate the functions that the user wants 2022-02-06 12:26:34 +01:00
Folkert
f1ebc523b6 Merge remote-tracking branch 'origin/trunk' into hook-up-hosted-modules 2022-02-04 00:07:23 +01:00
Folkert
885500712c remove old Effect module things 2022-02-03 23:55:02 +01:00
Folkert
a98635ed06 update other examples 2022-02-03 22:45:15 +01:00
ayazhafiz
29f733b69b Clippy 2022-02-03 00:19:18 -05:00
ayazhafiz
706640a1fa Add underscore separators for large numbers in reporting 2022-02-03 00:18:24 -05:00
ayazhafiz
097c5afc73 Check lower bounds for numeric literals, and permit 128-bit literals 2022-02-02 23:35:57 -05:00
ayazhafiz
ae5766fdf5 Folkert's suggestions 2022-02-01 23:42:28 -05:00
ayazhafiz
df8113ce32 Typecheck numeric suffixes in patterns 2022-02-01 23:35:14 -05:00
ayazhafiz
a6f7579c07 Parse and expand numeric bounds in canonicalization pass 2022-02-01 22:50:46 -05:00
ayazhafiz
17c5fe0bff Add granular errors regarding numeric literal parsing 2022-02-01 22:50:27 -05:00
ayazhafiz
e03592930f Typecheck numeric literals with suffixes in expressions
Part of #2350
2022-02-01 22:49:50 -05:00
ayazhafiz
4e942b3e5d Make nested datatypes into errors
I was hoping to add nested datatypes into the language, but it turns out
doing so is quite tricky and not all that useful with Roc's current
compilation model. Basically every implementation strategy I could think
of ended up requiring a uniform representation for the data layout
(or some ugly workaround). Furhermore it increased the complexity of the
checker/mono IR generator a little bit - basically, we must always pass
around the alias definitions of nested datatypes and instantiate them
at usage sites, rather than being able to unroll aliases as we currently
do during canonicalization.

So, especially because we don't support polymorphic recursion anyway, I
think it may be better to simply disallow any kind of nested datatypes
in the language. In any case, Stephanie Weirich [seems to think nested
datatypes are not needed](https://www.cis.upenn.edu/~plclub/blog/2020-12-04-nested-datatypes/).

Closes #2293
2022-01-31 22:58:01 -05:00
Richard Feldman
2efe9f9107
Delete some trailing spaces 2022-01-30 21:45:14 -05:00
Richard Feldman
842737297c
fix test 2022-01-30 21:44:44 -05:00
Richard Feldman
02263dbf42
Report hosted module parse errors 2022-01-30 20:40:50 -05:00
Richard Feldman
121e387f5a
Make some errors more specific 2022-01-30 20:40:50 -05:00
ayazhafiz
e54917a063 Expose type mismatches between recursive types and types that aren't
Closes #2166
2022-01-30 00:21:45 -05:00
ayazhafiz
ee05d13802 Add test for type mismatch between optional and required fields
This comes from #2167 which has been fixed on trunk for some time, but
we didn't have a test for.

Closes #2167
2022-01-30 00:11:55 -05:00
Folkert
afd11e1cb1 move target -> roc_target 2022-01-26 23:33:29 +01:00
Folkert
b9c318e9fb update the tests 2022-01-26 15:59:21 +01:00
Folkert
74932a4cab phase 2 2022-01-26 14:30:37 +01:00
Folkert
8aae60ddda fix reporting tests 2022-01-25 10:25:05 +01:00
Folkert de Vries
6dd769aa38
Merge pull request #2393 from rtfeldman/i/2343
Generate unique symbols for shadowing identifiers
2022-01-24 11:49:51 +01:00
Mats Sigge
71f359fbdc Move macros from roc_reporting to new roc_error_macros module
The `internal_error!` and `user_error!´ macros can't be used everywhere
when they live in `roc_reporting` due to circular dependencies.
2022-01-23 18:40:04 +01:00
ayazhafiz
c6d47dbca5 Fix reporting tests 2022-01-23 12:35:31 -05:00
ayazhafiz
48a3e871e8 Report self-recursive aliases at their declaration site, not in usages
Closes #2380
2022-01-22 14:26:32 -05:00
Jan Van Bruggen
1e9d2d1239 Remove accidental trailing spaces 2022-01-18 22:25:46 -07:00
ayazhafiz
5058e3cfc4 Fix panic during reporting
Closes #2326
2022-01-12 22:02:51 -05:00