Commit graph

159 commits

Author SHA1 Message Date
Richard Feldman
25518a76cf Narrow down test failures 2020-01-18 08:16:59 -05:00
Richard Feldman
7e8ae25c2c Fix some tests 2020-01-18 03:48:03 -05:00
Richard Feldman
99f99380da Got tests compiling 2020-01-18 02:57:20 -05:00
Folkert
83dd87b121 add tests for ext_var and TagUnion matches 2020-01-18 01:12:10 +01:00
Folkert
17afa4bd1a fix typo in tag unification logic 2020-01-17 15:17:14 +01:00
Folkert
4a4f2a2562 canonicalize Tags in types 2020-01-17 14:23:48 +01:00
Folkert
50f8bf1856 Recursive functions must be shared 2020-01-16 23:53:03 +01:00
Folkert
dbe615b4c5 Failing test for LinkedList.map
The rank of the ext_var of Cons is incorrect, it is to high triggering a
panic.
2020-01-16 23:44:08 +01:00
Folkert
3b0610130d Optimize When typechecking
The old code generated constraints twice, which is inefficient. The new
version also sets the variable in the AST to the type of the full
expression in all cases (with and without an annotation).

In lifting annotations to Attr types, int and float are now
special-cased
2020-01-12 17:15:19 +01:00
Folkert
20ae31fb39 move variable testing code to tests/helpers 2020-01-12 11:19:16 +01:00
Folkert
e5a9a016cd prevent duplicate definitions
patterns that bind multiple symbols, like `{ x, y } = someDef` would insert the definition twice (once for x, once for y).
that can lead to problems in codegen, and means the work for this definition is done twice.

Now we use the region of the pattern as a key, to ensure the pattern and its associated expression is only processed once.
2020-01-12 01:20:09 +01:00
Folkert
ceba17ed98 use all variables in uniq infer 2020-01-12 00:58:37 +01:00
Folkert
5bdf1d78cf for infer tests, check declared vs. used variables 2020-01-11 23:37:32 +01:00
Folkert
542114acc4 Fix #134
Another case of a variable not being added to `flex_vars`, which means
it's not copied and may lead to principality issues
2020-01-11 23:37:32 +01:00
Folkert
3168998a2b use pattern from annotation
The symbols from bare annotation patterns weren't added to scope, leading to a panic down the line in solve()
2020-01-11 23:37:32 +01:00
Folkert
1a5684e506 Merge branch 'trunk' into uniq-annotations 2020-01-11 11:04:23 +01:00
Folkert
ca9e86a56a fix typo in tests 2020-01-09 13:48:37 +01:00
Folkert
ca41a0339d tags with arguments in uniq infer 2020-01-09 13:38:47 +01:00
Folkert
dd240cf53a typecheck tags with arguments
also fixes an issue where private tags in patterns would not have the @ symbol in their name
2020-01-09 13:20:21 +01:00
Richard Feldman
e019a4b662
Merge branch 'trunk' into fix-uniq-principality 2020-01-08 22:47:12 -05:00
Folkert
fc81a82472 merge ext fields into the record when printing 2020-01-08 23:45:59 +01:00
Folkert
6c363a7208 restore inference for guards in pattern matches 2020-01-08 20:42:29 +01:00
Folkert
37cf0f940b possible fix for uniq principality
Apparently this fails because a closure would force the fn_var to be equal to the inferred type.
I'm really not sure why this would be a problem though. It works fine for 'normal' inference.
2020-01-08 14:30:14 +01:00
Folkert
34856e620d Merge branch 'trunk' into refactor-uniq-infer 2020-01-07 20:16:41 +01:00
Folkert
2db7c0503f fix uniq record destructure patterns 2020-01-07 20:09:52 +01:00
Richard Feldman
f00bf354aa Update private tag test 2020-01-06 21:36:38 -05:00
Folkert
9c8e316135 add failing private tag application
Private tags are not currently parsed in applications, so in this case parsing fails after `@Foo`
2020-01-06 21:36:38 -05:00
Folkert
864aefb925 constrain If 2020-01-06 14:46:02 +01:00
Folkert
fe35e99518 remove If desugaring
To generate good error messages, this needs to happen after type checking. Otherwise we can get weird things like

if Foo then 1 else 0

Giving some error that the `Foo` tag is not covered in a pattern match.
2020-01-06 00:56:50 +01:00
Folkert
1211686797 canonicalize PrivateTag and If
not totally sure about the if, because we lose information that may be helpful for good error messages. Still it was fun to implement.

PrivateTag can be matched on, but can't currently be applied (an issue with parsing)
2020-01-06 00:44:49 +01:00
Folkert
5ad2823a23 support Tag arguments 2020-01-05 22:49:08 +01:00
Folkert
1d5ceeafe4 constraint Tag patterns 2020-01-05 21:37:06 +01:00
Folkert
26bd52c2a2 scaffolding for tag unions 2020-01-05 20:54:34 +01:00
Folkert
9e94241045 add test case for record update
fix bug in record unification: im-rs difference is symmetric, while in haskell it is asymmetric
2020-01-05 15:48:20 +01:00
Folkert
4147582738 remove RecordFieldLabel enum (now a type alias)
I've kept it a type alias so that we can more easily change this in the future. But removing the alias is also simple
2020-01-04 23:22:40 +01:00
Folkert
4f3f85f064 fix principality 2020-01-02 00:48:02 +01:00
Richard Feldman
a5a4141e7e Reproduce principality bug 2020-01-01 17:02:22 -05:00
Richard Feldman
2f61455061 Merge remote-tracking branch 'origin/trunk' into improve-errors 2020-01-01 04:04:53 -05:00
Richard Feldman
b6ebfb8537 Merge remote-tracking branch 'origin/trunk' into constrain 2019-12-30 21:59:19 -05:00
Richard Feldman
ffd3cc4211 Constrain canonical exprs and modules 2019-12-30 20:33:05 -05:00
Folkert
d47abfb3a6 preparations for unifying optional fields 2019-12-30 16:52:57 +01:00
Folkert
13b3748996 fix record annotations
For literals, the extension variable was free. That is incorrect. so

    foo : { x : Int } -> Int

Would actually have type

    foo : { x : Int }* -> Int

Now the extension variable is `{}`, fixing this issue
2019-12-30 13:59:54 +01:00
Folkert
d8d045d122 parse optional fields 2019-12-30 12:42:24 +01:00
Folkert
9aee825391 remove EmptyRecord value from can/expr 2019-12-24 23:37:50 +01:00
Richard Feldman
5ffd62b9b3 Update record inference test 2019-12-23 23:44:08 -08:00
Richard Feldman
fd36e153ed
Merge branch 'trunk' into ct/case-when-to-when-is 2019-12-23 23:29:43 -08:00
Chad Stearns
844ca0a50e Changed instances of 'Case' in the code to 'When' 2019-12-23 17:41:19 -05:00
Chad Stearns
62a004c103 Case is to when is 2019-12-23 17:17:04 -05:00
Chad Stearns
9a5b6a03b4 case when to case is 2019-12-23 17:08:53 -05:00
Folkert
c4ad367a8a implement RecordField logic 2019-12-23 22:11:38 +01:00