Commit graph

9048 commits

Author SHA1 Message Date
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
Folkert
6da37329e7 extract logic for identifiers 2019-12-23 13:52:24 +01:00
Richard Feldman
aaae923e59
Merge pull request #80 from rtfeldman/let-rec-style
"Let Rec" style def constraints
2019-12-22 22:26:53 -08:00
Richard Feldman
f60260a14f
Merge branch 'trunk' into let-rec-style 2019-12-23 01:12:55 -05:00
Richard Feldman
14ded5754b
Merge pull request #79 from rtfeldman/ct/multi-line-if
multi line if statement formatting
2019-12-22 23:28:26 -05:00
Richard Feldman
2bf3238ab6
Merge branch 'trunk' into ct/multi-line-if 2019-12-22 23:20:15 -05:00
Richard Feldman
7a66ee6db9
Merge pull request #75 from rtfeldman/annotations-without-bodies
Annotations without bodies
2019-12-22 23:20:00 -05:00
Richard Feldman
77b71a1b53 Merge remote-tracking branch 'origin/trunk' into annotations-without-bodies 2019-12-22 20:10:30 -08:00
Richard Feldman
302b03cb20 Make defs use "let rec" style; drop Variable 2019-12-22 20:03:45 -08:00
Richard Feldman
760de2f328 Rename Rank::outermost to Rank::toplevel 2019-12-22 20:03:22 -08:00
Richard Feldman
c68f18c6ca
Merge pull request #77 from rtfeldman/register
Use register in more places in solving
2019-12-22 23:00:06 -05:00
Folkert
252d215c03 implement remove_idents for RecordDestructure 2019-12-22 21:41:29 +01:00
Folkert
9d7ce6ff15 parse records with type signatures
{ x, y } : { x : Int, y : Float }
2019-12-22 20:23:12 +01:00
Richard Feldman
c0cf0b64b1 Update some heterogenous list tests 2019-12-21 18:32:34 -05:00
Richard Feldman
c6f14e8db5 Add a type annotation to builtins/Float 2019-12-21 18:26:59 -05:00
Richard Feldman
6df252a54e Improve error message reporting 2019-12-21 18:26:43 -05:00
Folkert
97f2c57a39 fabricate a pattern for function annotations
so

foo : Int -> Bool

turns into

foo : Int -> Bool
foo = \_ -> crash

The effect of that is that function annotations only crash when applied.
2019-12-21 23:08:30 +01:00
Folkert
5254ecd2b9 refactor .union to remove cloning 2019-12-21 22:37:47 +01:00
Chad Stearns
18b6bb4b93 Merge branch 'ct/multi-line-if' of github.com:rtfeldman/roc into ct/multi-line-if 2019-12-21 16:05:46 -05:00
Chad Stearns
74552e58b4 Simplified else-case buffer string pushing 2019-12-21 16:05:01 -05:00
Richard Feldman
2e90cfc184 s/## >/## >>>/g 2019-12-21 15:15:20 -05:00
Chadtech
c8eae2b160
Merge branch 'trunk' into ct/multi-line-if 2019-12-21 13:50:54 -05:00
Chad Stearns
141ad1757b Added test for case with many lines 2019-12-21 13:48:44 -05:00
Chad Stearns
6a6ce63437 Removed some empty lines 2019-12-21 13:37:37 -05:00
Chad Stearns
68236aa10b Combine format_newlines_after and format_newlines_before into just format_newlines 2019-12-21 13:32:14 -05:00
Chad Stearns
48a9d898fc Handle excessive newlines below then and else cases 2019-12-21 13:28:34 -05:00
Chad Stearns
858764ac27 Format changes 2019-12-21 02:11:14 -05:00