Commit graph

29 commits

Author SHA1 Message Date
Folkert
a67bb29a36
remove hashmap 2022-03-22 21:58:49 +01:00
Folkert
bf063d1d57
use all aliases that are in scope (to support imported aliases) 2022-03-18 20:44:13 +01:00
ayazhafiz
86aa0df661 Add constraint generation for opaque types 2022-02-27 00:10:11 -05:00
ayazhafiz
e420ebd023 Add TODOs for opaque type comments that will need to be changed later 2022-02-21 23:21:39 -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
ac680d0750 Aliases should not be public 2022-02-12 21:23:44 -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
0eede1cd86 Generate unique symbols for shadowing identifiers
This code has a shadowing error:

```
b = False
f = \b -> b
f b
```

but prior to this commit, the compiler would hit an internal error
during monomorphization and not even get to report the error. The reason
was that when we entered the closure `\b -> b`, we would try to
introduce the identifier `b` to the scope, see that it shadows an
existing identifier, and not insert the identifier. But this meant that
when checking the body of `\b -> b`, we would think that we captured the
value `b` in the outer scope, but that's incorrect!

The present patch fixes the issue by generating new symbols for
shadowing identifiers, so deeper scopes pick up the correct reference.
This also means in the future we may be able to compile and execute code
with shadows, even though it will still be an error.

Closes #2343
2022-01-23 12:35:31 -05:00
Joshua Warner
f19220473a Rename Located -> Loc 2021-12-22 19:18:22 -08:00
Brendan Hansknecht
d49ac68bcc Update dep with major version changes 2021-11-05 19:19:37 -07:00
Anton-4
f63c276a5f docs flow working with mocked markup to html 2021-10-01 18:22:27 +02:00
Folkert
df83bf0d48 Merge remote-tracking branch 'origin/soa-alias' into alias-nominal-equality 2021-08-13 12:11:36 +02:00
Folkert
ceb5cc66fa use IdentStr 2021-08-03 21:14:36 +02:00
Folkert
13b05e54e8 Merge remote-tracking branch 'origin/clippy-1.54' into alias-nominal-equality 2021-07-30 14:25:50 +02:00
Folkert
899cbeabd7 fix extra ampersands 2021-07-29 17:32:08 +02:00
Folkert
27c3d57e35 BROKEN 2021-07-29 17:22:25 +02:00
Folkert
4cefbec5c7 store lambda set in alias types 2021-07-28 15:26:25 +02:00
Chadtech
12c0067348 Created scope and idents for module docs, but they appear to be empty when the doc links function tries to use them 2021-05-22 14:06:56 -04:00
Folkert
48f392f372 fix bad test examples using unbound type alias variables 2021-05-05 19:54:10 +02:00
Folkert
fa7dec2997 no more boolean algebra 2021-04-04 21:22:59 +02:00
Folkert
7123269f30 successfully load package-qualified host 2020-12-07 23:24:06 +01:00
Folkert
73e0ea2e5d fix some mistakes 2020-10-30 00:35:40 +01:00
Folkert
b75880bed2 expand aliases before/during canonicalization 2020-10-29 22:33:18 +01:00
Folkert
f13c28fe7f collect and instantiate hidden variables 2020-10-25 19:11:03 +01:00
Folkert
e5997c4047 fix mutual recursive types
I'll write a bit more about this in the PR message
2020-06-26 01:03:55 +02:00
Folkert
fd7ca5bcc9 don't add guarded record fields into scope 2020-04-09 01:08:09 +02:00
Richard Feldman
908e485fca Move constrain and its deps into their own crates 2020-03-06 01:43:39 -05:00
Richard Feldman
3b6ed43126 Extract can/ into its own crate, plus its deps 2020-03-05 23:01:32 -05:00
Renamed from compiler/src/can/scope.rs (Browse further)