Commit graph

14474 commits

Author SHA1 Message Date
Folkert
963033a1f8 Use signatures in type checking
For now only considers constants, e.g.

    foo : Int -> Int
    foo = \x -> x

But not yet rigid type variables, like `a -> a`

This kind of requires an additional variant of TypeAnnotation:

    TypedDef(
        &'a Loc<Pattern<'a>>,
        Loc<TypeAnnotation<'a>>,
        &'a Loc<Expr<'a>>,
    ),

Because otherwise combining the information from an annotation and its
succeeding body definition is hard. Currently, this variant is created
in an ad-hoc way. Perhaps this can be done during parsing?

Next, like previous commits, I've just copied the code for let, and
effectively added an additional constraint. There should be a way to
reduce the duplication again.
2019-12-18 13:53:45 +01:00
Folkert
4154805e23 print parsing error messages in tests 2019-12-18 13:53:45 +01:00
Folkert
e8d2fadc85 fiddle with whitespace parsing in annotations
This is still not correct for formatting (can drop newlines) but works for now.
Not sure how to do better, perhaps conditionally add the whitespace to the first term?
2019-12-18 13:53:45 +01:00
Folkert
1f84bc091d don't insert a . in type names when they are unqualified 2019-12-18 13:53:45 +01:00
Folkert
a17eea327c parse spaces around first argument 2019-12-18 13:53:45 +01:00
Richard Feldman
273243a58b Use when...is in roc-for-elm-programmers 2019-12-18 07:49:51 -05:00
Richard Feldman
cf602f4690
Merge pull request #67 from rtfeldman/spawn-blocking
Use spawn_blocking for load_module
2019-12-18 07:49:40 -05:00
Richard Feldman
12cd440284 Use spawn_blocking for load() 2019-12-18 07:41:36 -05:00
Richard Feldman
d398f715d6 Follow clippy's advice 2019-12-18 07:41:35 -05:00
Richard Feldman
efb0104adc Use spawn_blocking for load_module 2019-12-18 07:41:15 -05:00
Folkert de Vries
9c87d6aff8
Merge pull request #65 from rtfeldman/canonical-annotation
canonicalize annotations
2019-12-18 13:24:07 +01:00
Folkert
f05734e8c2 return rigid type variables
Turns out this is simpler: we can return a SendMap<Lowercase, Variable>,
replacing the Rigids return value (a ImMap<Lowercase, Type>) which can
be recovered from the SendMap.
2019-12-18 13:14:22 +01:00
Folkert
46af97ebe4 accept LabelOnly in types 2019-12-18 13:01:35 +01:00
Folkert
2acb82ca1a canonicalize annotations 2019-12-18 00:27:41 +01:00
Richard Feldman
094062f2b6
Merge pull request #64 from rtfeldman/records
Infer basic records
2019-12-16 21:51:00 -05:00
Richard Feldman
3e64447c08 Revise a comment 2019-12-16 21:30:24 -05:00
Richard Feldman
fdc6cfc7d2 Test record type variables 2019-12-16 21:29:03 -05:00
Richard Feldman
d081e5e7cc Sort fields before pretty printing 2019-12-16 21:29:03 -05:00
Richard Feldman
07adfafd47 Remove some unnecessary stuff - thanks, clippy! 2019-12-16 21:29:03 -05:00
Richard Feldman
aaeef42071 Fix a record test, and add another. 2019-12-16 21:29:03 -05:00
Richard Feldman
bcf33f168a Pretty print record types 2019-12-16 21:29:03 -05:00
Richard Feldman
bfb7e54ca9 Finish record canonicalization 2019-12-16 21:29:03 -05:00
Richard Feldman
d73b8ca1fc Remove UnqualifiedIdent 2019-12-16 21:29:03 -05:00
Richard Feldman
db6f80f358 Go deeper on UnqualifiedIdent 2019-12-16 21:29:03 -05:00
Richard Feldman
533d68691f Revert "Try a desugared module"
This reverts commit 9a2278e22d.
2019-12-16 21:29:03 -05:00
Richard Feldman
5589875453 Try a desugared module 2019-12-16 21:29:03 -05:00
Richard Feldman
8d5fd55056 First attempt at canonicalizing records 2019-12-16 21:29:03 -05:00
Richard Feldman
04fd945813 Failing record canonicalization test 2019-12-16 21:29:03 -05:00
Richard Feldman
7774857862
Merge pull request #63 from rtfeldman/ct/new-line-mid-lambda-arrow
Multi line pattern formatting
2019-12-16 21:28:51 -05:00
Chad Stearns
582749523d Pulling in trunk 2019-12-16 13:36:11 -05:00
Chad Stearns
faee0a657d Format code 2019-12-16 13:35:30 -05:00
Chadtech
517098ef17
Merge branch 'trunk' into ct/new-line-mid-lambda-arrow 2019-12-16 13:33:39 -05:00
Chad Stearns
01a283c121 Complicated multiline pattern code with comment 2019-12-16 13:33:13 -05:00
Chad Stearns
5a383b81b8 Commented out failing test 2019-12-16 13:29:09 -05:00
Chad Stearns
d6a3f2cfe9 Removed denest and stopped manually newlining 2019-12-16 13:21:25 -05:00
Chad Stearns
728d3a069f Denest pattern inside spaces too 2019-12-16 12:53:57 -05:00
Chad Stearns
bf2b15ad53 Ran formatter and clippy 2019-12-16 12:52:39 -05:00
Chad Stearns
1c64c8088f Handle and format multiline patterns 2019-12-16 12:51:13 -05:00
Folkert de Vries
c4b7b63c31
Merge pull request #59 from rtfeldman/type-signatures
Parse type signatures
2019-12-16 15:49:22 +01:00
Folkert de Vries
dc0fec79ba update cargo lock 2019-12-16 15:42:46 +01:00
Folkert de Vries
d4a7559559 pre-allocate vector 2019-12-16 15:40:51 +01:00
Richard Feldman
c90e90dbc8
Merge branch 'trunk' into type-signatures 2019-12-15 23:53:48 -05:00
Richard Feldman
db41d66285
Merge pull request #62 from rtfeldman/builtins
Update some builtins
2019-12-15 23:53:37 -05:00
Richard Feldman
0343727ae8 Revise roc-for-elm-programmers a bit. 2019-12-15 23:42:38 -05:00
Richard Feldman
6433c6b704 Update a comment 2019-12-15 22:17:47 -05:00
Richard Feldman
a7f954c3fb Update a bunch of builtins 2019-12-15 22:17:47 -05:00
Richard Feldman
c41b42906d
Merge branch 'trunk' into type-signatures 2019-12-15 17:28:04 -05:00
Richard Feldman
57c009f296
Merge pull request #60 from rtfeldman/update-inkwell
Update Inkwell to 0.5.3
2019-12-15 17:27:50 -05:00
Richard Feldman
00221a6d4d Update Inkwell to 0.5.3 2019-12-15 17:17:41 -05:00
Chad Stearns
7714639a45 Added test for when lamda arrow is on new line 2019-12-14 22:24:31 -05:00