Folkert
1fb746757c
pipe module name into canonicalization of modules
2022-02-02 16:01:31 +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
2eb9243942
Add parse tests for hosted modules
2022-01-30 20:40:50 -05:00
Richard Feldman
c68dfdf61e
Drop some unused variants
2022-01-30 20:40:49 -05:00
Richard Feldman
484ce2fbc9
Parse hosted modules
2022-01-30 20:40:49 -05:00
ayazhafiz
b50bb9a4c7
Centralize closure type
2022-01-30 00:48:01 -05:00
ayazhafiz
84f8152514
Remove debug_assert that may legally check a false value
...
This may be false e.g. in the presence of a multiline string. Since the
parser is in a more stable state than when this was introduced, I think
this is OK to remove.
Closes #2398
2022-01-29 23:58:46 -05:00
ayazhafiz
8ae2d9d407
Parse interfaces with leading newlines
...
Closes #2420
2022-01-29 23:58:41 -05:00
Richard Feldman
4fadc775e8
Add parse tests snapshot
2022-01-23 12:20:35 -05:00
Richard Feldman
1ab621dd54
Support optional spaces in app header types
2022-01-23 12:02:34 -05:00
Richard Feldman
01942fd98e
Parse app header provided types
2022-01-23 11:52:59 -05:00
Richard Feldman
c1c0ffb25f
Use UppercaseIdent over PlatformRigids
2022-01-23 11:13:23 -05:00
Richard Feldman
620e3f2913
parse tests for provided/required types in module headers
2022-01-23 10:11:17 -05:00
Jan Van Bruggen
fb66467343
Remove trailing spaces from test snapshots
2022-01-18 22:33:24 -07:00
Jan Van Bruggen
1e9d2d1239
Remove accidental trailing spaces
2022-01-18 22:25:46 -07:00
Joshua Warner
6e67b77fa1
Remove awkward split between header_sources and defs sources
2022-01-13 19:34:17 -08:00
Joshua Warner
d9cfa2b2a5
Remove unused State::fail method
2022-01-03 20:11:01 -08:00
Joshua Warner
352c7979eb
Re-enable debug_assert in State::advance
2022-01-03 20:10:53 -08:00
Joshua Warner
f22f96843e
Refactor ParseProblem
...
* Remove the `pos` field, which was always being assigned Position::default()
* Remove one use of this `pos`, by removing the never-used SyntaxError::ConditionFailed variant
* Adjust the other use to do what was probably intended - which is to say, pointing to the beginning of the def with the error
* Rename to FileError, reuse `SourceError` as an inner field, to avoid duplicating the `bytes`
2022-01-03 20:10:50 -08:00
Joshua Warner
650c29de3c
Change LineColumn::column to u32 to avoid overflow, and remove LineTooLong error
2022-01-02 21:50:42 -08:00
Joshua Warner
9557c234cb
Update recently added tests
2022-01-01 18:20:57 -08:00
Joshua Warner
8092f31a29
fmt
2022-01-01 18:20:05 -08:00
Joshua Warner
f969c7c6d0
Fixup rebase errors
2022-01-01 18:20:05 -08:00
Joshua Warner
5c1084c453
Introduce SourceError to represent an error + original source
2022-01-01 18:20:05 -08:00
Joshua Warner
8d6eb178b1
Fix multiline pattern heuristic
2022-01-01 18:20:05 -08:00
Joshua Warner
e97e5c3bd9
Fixup type annotations
2022-01-01 18:20:05 -08:00
Joshua Warner
cb8cf44596
fmt
2022-01-01 18:20:05 -08:00
Joshua Warner
70156b0a90
Simplify advancing
2022-01-01 18:20:05 -08:00
Joshua Warner
2901549422
Assert new column calculation is correct
2022-01-01 18:20:05 -08:00
Joshua Warner
422cdea112
Track line start separately
2022-01-01 18:20:05 -08:00
Joshua Warner
5ac3394a73
Remove pos tracking
2022-01-01 18:20:05 -08:00
Joshua Warner
08a33aab1b
Remove bytes tracking
2022-01-01 18:20:05 -08:00
Joshua Warner
beb0629e05
Track state in whitespace
2022-01-01 18:20:05 -08:00
Joshua Warner
a13c474f6b
Remove line tracking in parser
2022-01-01 18:20:05 -08:00
Joshua Warner
8e1241adea
Remove line/column fields
2022-01-01 18:20:05 -08:00
Joshua Warner
eb35e9914f
Fix tests
2022-01-01 18:20:05 -08:00
Joshua Warner
4b04ec6bbc
Add Position::offset, and recompute line/column info based on source
2022-01-01 18:20:05 -08:00
Joshua Warner
443d738f9b
Make Position::{line, column} fields private
2022-01-01 18:20:05 -08:00
Joshua Warner
721233f9c8
More incremental changes
2022-01-01 18:20:05 -08:00
Joshua Warner
1b257da356
Make State::xyzlcol a LineColumn, and change everything wanting a Position to use State::pos() instead
2022-01-01 18:20:05 -08:00
Joshua Warner
d2dcb462c7
Rename State::pos -> xyzlcol, temporarily
2022-01-01 18:20:05 -08:00
Joshua Warner
bd7b1e5013
Make Loc::new take Positions
2022-01-01 18:20:05 -08:00
ayazhafiz
0c81302d29
Admit tag destructuring in definitions
2021-12-30 19:50:50 -06:00
Folkert
b924f7e329
use new header type in a spot we missed
2021-12-27 23:58:56 +01: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
0b6d3d2c55
Promote parse tests
2021-12-26 11:35:10 -06:00
ayazhafiz
b66543dd95
into_iter -> iter
2021-12-26 09:55:27 -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