Commit graph

113 commits

Author SHA1 Message Date
Richard Feldman
4eec34becf
Update to use new square brace formatting 2022-05-22 23:15:54 -04:00
Ayaz Hafiz
9712cfe342
Canonicalize deriving 2022-05-20 15:55:45 -04:00
Ayaz Hafiz
e78b345ee0
Format has-derived clauses 2022-05-19 18:29:31 -04:00
Ayaz Hafiz
fcf464e9da
Parse has-derived clauses 2022-05-19 18:29:31 -04:00
Richard Feldman
85e7969c2d
Replace references to "global tag" with "tag" 2022-04-25 17:04:34 -04:00
Ayaz Hafiz
f1dc9c8298
Opaques take @ : %s/\$\([A-Z]\)/@\1/g 2022-04-25 12:26:38 -04:00
Ayaz Hafiz
1ed9cf551a
Remove private tags from Ast 2022-04-25 11:20:37 -04:00
Ayaz Hafiz
67eb4b9faa
Remove private tags from idents 2022-04-25 11:13:30 -04:00
Ayaz
5188f8f7df
Merge branch 'trunk' into i/2878 2022-04-18 21:46:23 -04:00
Ayaz Hafiz
f129777115
Explicitly disallow ability definitions in nested scopes
Abilities can only be defined on the toplevel of a module. There is a
technical reason to this, which is that during type solving we must
introduce all abilities at the very beginning, and we need to make sure
ranks are correct. But there is a practical reason as well, which is
that nested ability definitions don't seem to be very useful.

Note that specializations can be nested, and are allowed to be. Also, we
can revisit this in the future. I just don't want experiments to break
right now because someone uses an ability in a nested scope where we
don't expect.

Closes #2878
2022-04-18 18:04:46 -04:00
Folkert
1d0f9e9192
Merge remote-tracking branch 'origin/trunk' into builtins-in-roc 2022-04-08 15:47:11 +02:00
Ayaz Hafiz
a3ac68a41f
Split up Defs into TypeDef and ValueDef
Just a refactoring PR. This is useful because during canonicalization
we always process type defs first, then value defs. With abilities this
distinction continues to grow; in that case, we have patterns associated
with types that we want to process before patterns from values.
2022-04-06 22:18:57 -04:00
Ayaz Hafiz
2dc0445f46
s/AbilityDemand/AbilityMember
This is a better name
2022-04-06 11:20:34 -04:00
Folkert
4e1197165b
Merge remote-tracking branch 'origin/trunk' into builtins-in-roc-delayed-alias 2022-03-18 21:25:52 +01:00
ayazhafiz
d7abc3897b Parse abilities 2022-03-12 21:29:06 -06:00
Folkert
bd31503855
Merge remote-tracking branch 'origin/trunk' into builtins-in-roc 2022-02-28 18:55:20 +01:00
Folkert
c0d3543d5a
make Str + Result work 2022-02-26 17:52:24 +01:00
Brendan Hansknecht
f7c0e2ef19 Merge remote-tracking branch 'origin/trunk' into single-quote-literal 2022-02-24 10:13:39 -08:00
ayazhafiz
e420ebd023 Add TODOs for opaque type comments that will need to be changed later 2022-02-21 23:21:39 -05:00
ayazhafiz
6104a27b45 Parse opaque references 2022-02-19 21:30:42 -05:00
ayazhafiz
fa24e51593 Parse opaque types 2022-02-19 18:38:31 -05:00
ayazhafiz
8ce81e4607 AliasHeader -> TypeHeader 2022-02-19 17:51:56 -05:00
Anton-4
d6681f4e0a
Merge pull request #2160 from rtfeldman/editor-comments
support tld comments in docs and editor(reading only)
2022-02-10 11:49:10 +01:00
ayazhafiz
4e942b3e5d Make nested datatypes into errors
I was hoping to add nested datatypes into the language, but it turns out
doing so is quite tricky and not all that useful with Roc's current
compilation model. Basically every implementation strategy I could think
of ended up requiring a uniform representation for the data layout
(or some ugly workaround). Furhermore it increased the complexity of the
checker/mono IR generator a little bit - basically, we must always pass
around the alias definitions of nested datatypes and instantiate them
at usage sites, rather than being able to unroll aliases as we currently
do during canonicalization.

So, especially because we don't support polymorphic recursion anyway, I
think it may be better to simply disallow any kind of nested datatypes
in the language. In any case, Stephanie Weirich [seems to think nested
datatypes are not needed](https://www.cis.upenn.edu/~plclub/blog/2020-12-04-nested-datatypes/).

Closes #2293
2022-01-31 22:58:01 -05:00
Richard Feldman
755f4c01f3
cargo fmt 2022-01-30 20:40:51 -05:00
Richard Feldman
484ce2fbc9
Parse hosted modules 2022-01-30 20:40:49 -05:00
Joshua Warner
8d6eb178b1 Fix multiline pattern heuristic 2022-01-01 18:20:05 -08:00
Anton-4
f941e30b86 Merge branch 'trunk' of github.com:rtfeldman/roc into editor-comments 2022-01-01 11:10:54 +01:00
ayazhafiz
0c81302d29 Admit tag destructuring in definitions 2021-12-30 19:50:50 -06:00
Folkert de Vries
bb935948aa
Merge pull request #2276 from rtfeldman/i/2265
Parse "as" aliases into tag/args rather than arbitrary annotations
2021-12-27 20:56:48 +01:00
ayazhafiz
b3ddfa7515 Parse destructured tag annotations as annotations rather than aliases
Closes #178
2021-12-26 16:11:29 -06:00
ayazhafiz
966198a6e7 Coalesce inline and normal alias headers
Unifies `As` annotations and `Alias` defs to use a common struct for
defining alias header information, i.e. the name and type variables of
the alias.
2021-12-26 09:37:56 -06:00
ayazhafiz
597a1cef3b Attach location to alias header name 2021-12-26 09:17:27 -06:00
ayazhafiz
11da888c07 Pull out alias header as its own struct 2021-12-26 09:07:12 -06:00
ayazhafiz
2cd5bf8c03 Parse "as" aliases into tag/args rather than arbitrary annotations 2021-12-26 08:44:09 -06:00
Joshua Warner
f19220473a Rename Located -> Loc 2021-12-22 19:18:22 -08:00
Joshua Warner
0786e554c6 Extract spacing from parse::header::* items into explicit Spaced enum 2021-12-14 19:53:20 -08:00
Anton-4
9a2187ecd2 fixed newline issues 2021-12-09 13:55:18 +01:00
Joshua Warner
49228c8100 Refactor format_sequence to be a function 2021-12-07 18:53:47 -08:00
Anton-4
5bd776f972 debugging inline comment bug 2021-12-01 16:57:28 +01:00
Chelsea Troy
6cf755ad8d Resolve a bunnnch of merge conflicts 2021-11-29 23:14:29 -06:00
ayazhafiz
8a60162a1e Rename roc_module::operator -> roc_module::called_via
A bit of a nit, but this file is now more general than just keeping
track of operator methods.
2021-11-18 20:20:33 -05:00
Joshua Warner
7f5b873357 Parse _ in type annotations as an 'Inferred' type 2021-11-17 17:59:40 -08:00
Joshua Warner
3ff3695758 Add a manual Debug formatter for Collection to make debugging nicer 2021-11-13 16:24:35 -08:00
Joshua Warner
9bf1674946 Shrink Collection to make parse_expr_size test pass 2021-11-13 16:17:44 -08:00
Joshua Warner
1fabc64fdf Use Collection in Expr::TagUnion 2021-11-13 07:38:39 -08:00
Joshua Warner
d63405d824 Make Expr::List use a Collection 2021-11-13 07:38:11 -08:00
Joshua Warner
a4ca6a31a6 Use Collection in Expr::Record and related places 2021-11-13 07:36:05 -08:00
Joshua Warner
4df0880e7a Commit local changes (whoops!) 2021-11-11 18:57:26 -08:00
Joshua Warner
04d4a8ca79 Introduce Collection as a general abstraction in the ast 2021-11-11 14:49:33 -08:00