Commit graph

414 commits

Author SHA1 Message Date
Richard Feldman
962e08b10d
Merge pull request #3234 from rtfeldman/toplevel-expect
toplevel expect
2022-06-17 10:06:22 -04:00
Ayaz Hafiz
8cb6121fc3
Exhaustive and redundant marks don't need to be introduced
They are never generalized
2022-06-15 20:37:49 -04:00
Folkert
f7246d2774
typecheck toplevel expects 2022-06-15 23:15:43 +02:00
Ayaz Hafiz
e1f7702982
Clippy 2022-06-13 13:19:09 -04:00
Ayaz Hafiz
bf7d57b23f
Import ability lambda sets from other modules during late solving
We're almost there! Just need a way to re-enter already-monomorphized
modules when abilities demand it now.
2022-06-13 08:37:02 -04:00
Ayaz Hafiz
0deca3ffb5
Resolve specialization lambda sets in abilities store 2022-06-09 14:20:07 -04:00
Ayaz Hafiz
aa9b70a7c8
Distinguish between pending and resolved ability stores
Now that we have unspecialized lambda sets, we need to properly copy
their specialization variables when a module imports another modules'
ability store. I think it will be easier to ensure the correctness if
we distinguish between a "pending" ability store (which may contain
imports whose variables have not been added to subs yet) and "resolved"
abilities stores, which are what we care about for solve and later on.

There is a cost to this since `PendingAbilitiesStore#resolve` destroys
and collects all of the ability member data, rather than in-place
mutating as we did before. However, the resulting `AbilitiesStore` is
now much smaller, so the memory footprint will be better, and also
every field besides `ability_members` will be moved rather than copied.
2022-06-09 12:52:40 -04:00
Richard Feldman
f45d1281f7
Merge pull request #3137 from rtfeldman/expect-report
Expect report
2022-06-08 10:13:35 -04:00
Ayaz Hafiz
790eb8e20c
Lambda sets don't need extension vars 2022-06-01 13:18:03 -05:00
Ayaz Hafiz
c2a2ce690c
Lift lambda sets as their own type
This prepares for unspecialized lambda set in the type system in
general.
2022-06-01 13:17:22 -05:00
Folkert
70df1ff9c7
Merge remote-tracking branch 'origin/trunk' into expect-report 2022-05-26 16:06:34 +02:00
Richard Feldman
4eec34becf
Update to use new square brace formatting 2022-05-22 23:15:54 -04:00
Folkert
d43bda83b4
cleanup 2022-05-21 20:50:06 +02:00
Folkert
98ce9f4d09
remove the snapshots 2022-05-21 20:42:19 +02:00
Folkert
cb40aab21f
refactor number bounds 2022-05-21 18:53:50 +02:00
Folkert
b46721e43b
exit early from range checking 2022-05-21 18:28:11 +02:00
Ayaz Hafiz
f1e09fbe78
Pass ability specializations back down 2022-05-19 18:21:41 -04:00
Ayaz Hafiz
28d6f30cc7
Fix type errors 2022-05-19 18:21:40 -04:00
Ayaz Hafiz
0f4be93e44
Add JSON builtin, pass along solved specializations per module 2022-05-19 18:21:40 -04:00
Ayaz Hafiz
312cdd0b70
Correct imports of Encode and abilities across modules 2022-05-19 18:21:40 -04:00
Richard Feldman
0f3709da6f
Merge pull request #3090 from rtfeldman/expr-blank 2022-05-18 21:25:07 -04:00
Folkert
f285e7ce93
add a TypedHole node to Expr, for use in the editor 2022-05-18 16:39:24 +02:00
Ayaz Hafiz
a8265426df
Simplify ExposedModuleTypes
The `Invalid` variant was never constructed, so we can eliminate it.
2022-05-18 09:59:37 -04:00
Anton-4
0f59f3097a
cargo fix --edition 2022-05-16 17:04:17 +02:00
Folkert
c161140aec
Merge remote-tracking branch 'origin/trunk' into more-tyck 2022-05-14 14:48:54 +02:00
Folkert
7face320eb
move back to one loc_symbols vector 2022-05-14 14:44:37 +02:00
Ayaz Hafiz
c9e8f6130b
Cleanup constrain_def_make_constraint 2022-05-11 19:28:39 -04:00
Ayaz Hafiz
1609a1a48b
Add some comments and tests showing why recursive defs are constrained this way 2022-05-11 19:16:10 -04:00
Ayaz Hafiz
3f0449292d
My bad 2022-05-11 14:57:03 -04:00
Ayaz Hafiz
710a10a29c
Check for invalid cycles after type solving recursive defs
Disallow cycles that pass through a non-function value. Since we
evaluate eagerly, having one such cycle means there is at least one path
in the program that (likely) has unbounded recursion. Of course we can't
be certain (halting problem), but it's very likely, and avoids stuff
like #1926. Also, mono (as it's done today) won't work if things in a
cycle aren't functions.

Closes #1926
2022-05-11 14:57:01 -04:00
Ayaz Hafiz
7420276116
Avoid an allocation 2022-05-11 11:20:17 -04:00
Ayaz Hafiz
d0c6c06ca1
Remove KnownSizeIterator 2022-05-11 09:06:25 -04:00
Ayaz Hafiz
da00c47102
Opportunistically resolve specializations during solving 2022-05-11 08:53:15 -04:00
Richard Feldman
df7df4ccf8
Merge branch 'trunk' into mfonism/rename-num-float-type-to-frac 2022-05-08 20:54:33 -04:00
Ayaz Hafiz
a47dc711f3 Remove a couple vec allocs 2022-05-08 15:08:19 -04:00
Ayaz Hafiz
5cc6727e9f Simplify introduced variables in ability member 2022-05-08 15:08:19 -04:00
Ayaz Hafiz
f208f7b4a1 Ability members are functions too 2022-05-08 15:08:18 -04:00
Ayaz Hafiz
638c446c2f Fix constraints 2022-05-08 15:08:17 -04:00
Ayaz Hafiz
edee222763 Add AbilityMember can variant for resolving ability specializations 2022-05-08 15:08:16 -04:00
Ayaz Hafiz
2e57bf0b6a Permit able variables in aliases, and thread them through 2022-05-08 15:08:14 -04:00
Ayaz Hafiz
01af970b49 Constraining ability members is the same as a usual def 2022-05-08 15:07:27 -04:00
Ayaz Hafiz
c67bc5a8d6 Remove when-related changes 2022-05-08 15:07:27 -04:00
Ayaz Hafiz
c01baa9168 Fix failing reporting tests 2022-05-08 15:07:27 -04:00
Folkert
b21a226281
simplify constraints 2022-05-08 20:11:12 +02:00
Folkert
7be41d8c09
remove unused variables from let/letrec 2022-05-08 20:06:00 +02:00
Mfon Eti-mfon
85c622b169
Update symbols definition 2022-05-08 15:54:34 +01:00
ayazhafiz
ef77ff35cf
Improve expectation for platform requires mismatch
```
── TYPE MISMATCH ───── examples/hello-world/rust-platform/./Package-Config.roc ─

Something is off with the type annotation of the main required symbol:

2│      requires {} { main : a -> a }
                             ^^^^^^

This #UserApp.main value is a:

    Str

But the type annotation on main says it should be:

    a -> a

────────────────────────────────────────────────────────────────────────────────
```
2022-05-06 12:06:27 -04:00
Richard Feldman
388f402a26
remove unnecessary clone (thanks, clippy!) 2022-05-06 12:06:27 -04:00
Ayaz Hafiz
77a1f644a4
Thread error message information for requires 2022-05-06 12:06:27 -04:00
Ayaz Hafiz
c7142da116
Correctly generate type constraints for required symbols in platform 2022-05-06 12:06:27 -04:00