Commit graph

14474 commits

Author SHA1 Message Date
Richard Feldman
7a07c19275 Move src/constrain.rs to src/constrain/mod.rs 2019-12-29 08:26:11 -08:00
Richard Feldman
1b4f7ccfa5
Merge pull request #89 from rtfeldman/const
Replace some functions with consts
2019-12-29 08:14:41 -08:00
Richard Feldman
be7bc99f56 Update a comment 2019-12-29 08:00:44 -08:00
Richard Feldman
e70e72f520 Use iter.chain() instead of two loops 2019-12-29 08:00:44 -08:00
Richard Feldman
b715d3e2f8 Replace Mark:: functions with consts 2019-12-29 08:00:43 -08:00
Richard Feldman
f04d8f5b03 Replace Rank::none() with Rank::NONE 2019-12-29 08:00:24 -08:00
Richard Feldman
cc874f347f
Merge pull request #86 from rtfeldman/empty-record
Remove empty record value
2019-12-25 14:56:31 -08:00
Richard Feldman
eb7adf05cb
Merge branch 'trunk' into empty-record 2019-12-25 14:49:54 -08:00
Richard Feldman
221cb97dd6
Merge pull request #87 from rtfeldman/unconstrained-variables
Unconstrained variables
2019-12-25 14:49:40 -08:00
Folkert
2ad129e6ad re-introduce canonical EmptyRecord
So now canonicalization will emit an EmptyRecord node for a record with
not fields. This means a special case in the second typechecker could be
removed.
2019-12-25 12:28:17 +01:00
Folkert
2baedcb150 rename ext_var -> stored_var 2019-12-25 12:19:11 +01:00
Folkert
31723bfcad remove unused var_store
Because Tag patterns no longer have a variable in them, the var_store isn't needed here.
Because the function is recursive clippy did not notice it was unused (I think it should though...)
2019-12-25 00:34:01 +01:00
Folkert
9a616e3aa4 constrain Variable for records 2019-12-25 00:22:25 +01:00
Folkert
9aee825391 remove EmptyRecord value from can/expr 2019-12-24 23:37:50 +01:00
Folkert
9a20f01257 remove empty record from parser 2019-12-24 21:59:30 +01:00
Richard Feldman
a8febac445
Merge pull request #85 from rtfeldman/tag-var
Remove Variable from Tag patterns
2019-12-24 10:15:38 -08:00
Richard Feldman
aa4bbee3f7 Drop obsolete comment 2019-12-24 10:03:12 -08:00
Richard Feldman
5ff26476fd Rename some things 2019-12-24 10:03:12 -08:00
Richard Feldman
9012cad4c2 Simplify return value 2019-12-24 10:03:12 -08:00
Richard Feldman
bd75a6f1f7 Remove Variable from Tag 2019-12-24 10:03:12 -08:00
Richard Feldman
9c62356732
Merge pull request #84 from rtfeldman/reuse-variables
Uniqueness type updates
2019-12-24 10:02:31 -08:00
Richard Feldman
9ff3928c01
Merge branch 'trunk' into reuse-variables 2019-12-24 08:59:54 -08:00
Richard Feldman
bda1c3ebd0
Merge pull request #81 from rtfeldman/ct/multi-line-if-condition
Tests for multiline if condition and if statement comments
2019-12-24 08:59:32 -08:00
Folkert
09c1e45ad5 use List variable 2019-12-24 17:34:26 +01:00
Folkert
c14120207c implement record patterns 2019-12-24 16:20:34 +01:00
Folkert
42728038c0 implement Access logic 2019-12-24 15:59:07 +01:00
Folkert
606b5ad656 implement Record typecheck logic 2019-12-24 15:11:35 +01:00
Folkert
d377d8ab8b add Accessor to uniqueness typecheck 2019-12-24 13:47:25 +01:00
Folkert
99b3f35ff7 re-use variables in Expr 2019-12-24 13:31:06 +01:00
Folkert
2543e3145b modify second var_store
the second var_store now starts at the index of the var_store of the first.
this will make it possible to re-use variables from the first typecheck
2019-12-24 13:21:21 +01:00
Richard Feldman
34e039bef6
Merge branch 'trunk' into ct/multi-line-if-condition 2019-12-23 23:52:01 -08:00
Richard Feldman
0e04be45ee
Merge pull request #83 from rtfeldman/ct/case-when-to-when-is
"case x when" to "when x is"
2019-12-23 23:51:44 -08: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
Richard Feldman
21365f1b6d
Merge pull request #82 from rtfeldman/canonical-record-patterns
Canonical record patterns
2019-12-23 23:28:58 -08:00
Chad Stearns
589923ddfb Cargo format and clippy 2019-12-23 17:41:59 -05:00
Folkert
2358531a66 clean up comments 2019-12-23 23:41:28 +01: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
9c78d29a2f Fix parsing issue
I made this follow the test, but that may not actually be the desired
approach.

So the question is what the region of an identifier in a pattern is.
Previously this was

    { x }
      ^

Using the new parser it became

    { x }
      ^^

Which this commit corrects to the old state by using the region from an
AssignedField.
2019-12-23 22:39:12 +01:00
Folkert
c4ad367a8a implement RecordField logic 2019-12-23 22:11:38 +01:00
Folkert
1b2636bee6 parse guarded record patterns
e.g.

    case foo when
        { x: 4 } -> ...
        { x, y } -> ...
2019-12-23 21:52:12 +01:00
Folkert
f47c2677ee Use canonicalization constraints for patterns
By using the expected type of an expression that is matched on,
duplicate work can be prevented.

Also fixes a bug where the pattern constraints weren't used for
annotations without bodies.
2019-12-23 20:06:32 +01:00
Chadtech
ab75734b04
Merge branch 'trunk' into ct/multi-line-if-condition 2019-12-23 12:55:06 -05:00
Chad Stearns
239a275bf6 Commented out more tests 2019-12-23 12:45:17 -05:00
Chad Stearns
954f6f7d7e Commented out test for newline and comment formatting in if statements 2019-12-23 12:40:41 -05:00
Folkert
afd70b7ed7 implement record patterns in case 2019-12-23 15:01:43 +01:00
Folkert
d46e2d7d60 implement add_idents_from_pattern for record patterns 2019-12-23 14:13:17 +01:00
Folkert
13ac65ad44 add RecordDestructure to canonical pattern 2019-12-23 14:10:45 +01:00