Commit graph

9048 commits

Author SHA1 Message Date
Richard Feldman
1a891d340f Refactor out a .clone() 2019-12-18 20:02:07 -05:00
Richard Feldman
55730949f7 CI: cargo test (without --release) 2019-12-18 19:56:14 -05:00
Richard Feldman
372ceb11f5
Merge pull request #69 from rtfeldman/occurs
Do an occurs check
2019-12-18 19:53:28 -05:00
Richard Feldman
9745459522 Do what clippy suggests 2019-12-18 18:42:24 -05:00
Richard Feldman
e37f10de3f cargo update 2019-12-18 18:42:24 -05:00
Richard Feldman
a4a4ddbfb2 Finish occurs check 2019-12-18 18:42:21 -05:00
Richard Feldman
40db8411aa Add some functionality in can/ident 2019-12-18 18:41:21 -05:00
Richard Feldman
8446d68e96 use with_larger_debug_stack more 2019-12-18 18:41:00 -05:00
Richard Feldman
b297bc2f1c Do an occurs check in solve 2019-12-18 18:40:29 -05:00
Richard Feldman
afd33c2a23 Add Subs::occurs 2019-12-18 18:40:25 -05:00
Richard Feldman
59cf4f7269 Remove superfluous check.
We aren't doing Procedures during canonicalization,
2019-12-18 18:39:57 -05:00
Richard Feldman
c8ea1e4806 Add Subs::set_rank 2019-12-18 18:38:53 -05:00
Richard Feldman
dd5fdd90aa Drop unused import 2019-12-18 18:38:46 -05:00
Richard Feldman
978f498455 Make Rank opaque 2019-12-18 18:38:35 -05:00
Folkert de Vries
c91bb1deb3
Merge branch 'trunk' into type-signatures 2019-12-18 19:04:36 +01:00
Folkert
c7851df5f9 remove unneeded clone 2019-12-18 18:14:40 +01:00
Folkert
c95a389c4f hook up rigid type variables in tests 2019-12-18 18:00:28 +01:00
Folkert
a7a461fd43 hook up rigid type variables 2019-12-18 18:00:13 +01:00
Folkert
a636da456b expose function to create rigid 2019-12-18 17:57:39 +01:00
Folkert
90d344cac3 Don't duplicate rigids
A signature like

    a -> a

Should only create one variable (a rigid one, with name "a")
2019-12-18 17:56:41 +01:00
Folkert
a33faa087b turn sendmap into hashmap of free type variables 2019-12-18 14:15:56 +01:00
Richard Feldman
4165e61950
Merge pull request #66 from rtfeldman/when
Use when...is in roc-for-elm-programmers
2019-12-18 07:56:45 -05:00
Folkert
3598494f85 prepare for rebase 2019-12-18 13:53:45 +01:00
Folkert
4d2e4f7ebc find free rigid type variables in annotations 2019-12-18 13:53:45 +01:00
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