Commit graph

7030 commits

Author SHA1 Message Date
ayazhafiz
df8113ce32 Typecheck numeric suffixes in patterns 2022-02-01 23:35:14 -05:00
ayazhafiz
a6f7579c07 Parse and expand numeric bounds in canonicalization pass 2022-02-01 22:50:46 -05:00
ayazhafiz
17c5fe0bff Add granular errors regarding numeric literal parsing 2022-02-01 22:50:27 -05:00
ayazhafiz
f55e767035 Fix test_can tests 2022-02-01 22:49:52 -05:00
ayazhafiz
9f72b2710f Run linter 2022-02-01 22:49:52 -05:00
ayazhafiz
f7a055fc78 Fix parser tests 2022-02-01 22:49:52 -05:00
ayazhafiz
e03592930f Typecheck numeric literals with suffixes in expressions
Part of #2350
2022-02-01 22:49:50 -05:00
ayazhafiz
320827167f Parse number literal width suffixes
Supports [u,i][8,16,32,64,128] and [nat,dec]

Part of #2350
2022-02-01 22:48:48 -05:00
Richard Feldman
cd7b219764
Merge remote-tracking branch 'origin/trunk' into expect-dont-panic 2022-02-01 21:43:55 -05:00
Richard Feldman
bfb938914f
Fix some missing indentations 2022-02-01 21:34:18 -05:00
Richard Feldman
200e237393
Add tests for multiline interface and hosted modules 2022-02-01 21:22:35 -05:00
Richard Feldman
34e9b1b73d
Fix module formatting 2022-02-01 21:22:35 -05:00
Richard Feldman
271112fec1
Finish implementing is_multiline for Spaced 2022-02-01 21:18:54 -05:00
Richard Feldman
3b1ca5c310
Refactor is_multiline for collections 2022-02-01 21:18:30 -05:00
Richard Feldman
15969af53c
Use constant over string literal 2022-02-01 20:44:02 -05:00
Richard Feldman
f8eec65229
Drop an obsolete todo 2022-02-01 20:43:43 -05:00
Folkert de Vries
780d6529c8
Merge pull request #2431 from rtfeldman/i/2293
Make nested datatypes into errors
2022-02-01 20:17:33 +01:00
Richard Feldman
5b6d457aa3
Fix typo in Num.roc 2022-02-01 11:52:47 -05:00
Richard Feldman
e65e6c97d1
Use constant instead of hardcoded string 2022-02-01 09:17:28 -05:00
Richard Feldman
65244d6383
Fix unclosed brace 2022-02-01 08:43:47 -05:00
Richard Feldman
c21741a7e0
zig fmt 2022-02-01 08:37:51 -05:00
Richard Feldman
e47e556dda
Merge remote-tracking branch 'origin/trunk' into expect-dont-panic 2022-02-01 08:35:32 -05:00
ayazhafiz
d10eb0f9a3 Fix Apply usage 2022-01-31 23:00:37 -05:00
ayazhafiz
a9ed4ce4ce Removing references 2022-01-31 22:58:15 -05: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
Jan Van Bruggen
2f80d64056
Link macOS with AudioUnit, CoreAudio, IOKit frameworks
AudioUnit & CoreAudio are necessary to get
[Bevy](https://docs.rs/bevy/latest/bevy/)'s "hello world" example
working inside a Roc platform.

IOKit is necessary to get
[Bevy](https://docs.rs/bevy/latest/bevy/)'s "breakout" example
working inside a Roc platform.

Credit to @hafiz for discovering this solution.
2022-01-31 11:17:30 -07:00
Folkert de Vries
00617ebf2a
Merge pull request #2418 from rtfeldman/i/1822
Error when platform package config cannot be found
2022-01-31 12:51:54 +01:00
ayazhafiz
2fa55269f1 Sate clippy 2022-01-30 21:42:41 -05:00
ayazhafiz
f28ca65ac5 Error when platform package config cannot be found
This avoid compiler hangs that occurred before

Closes #1822
2022-01-30 21:42:41 -05:00
Richard Feldman
755f4c01f3
cargo fmt 2022-01-30 20:40:51 -05:00
Richard Feldman
099a0b5d41
Add formatting test for hosted modules 2022-01-30 20:40:51 -05:00
Richard Feldman
270374044f
Make Buf derive Debug 2022-01-30 20:40:50 -05:00
Richard Feldman
ea5365d6cc
Make Newlines optimize better to bool 2022-01-30 20:40:50 -05:00
Richard Feldman
5c6d2a909e
Make Collection formattable 2022-01-30 20:40:50 -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
c3123de737
format hosted modules 2022-01-30 20:40:49 -05:00
Richard Feldman
484ce2fbc9
Parse hosted modules 2022-01-30 20:40:49 -05:00
Richard Feldman
a55ff62e6c
Merge remote-tracking branch 'origin/trunk' into expect-dont-panic 2022-01-30 20:22:26 -05:00
Chelsea Troy
4f8d0776b3 We got a test working for panicking with the appropriate number fo failures. Ultimatly we want:
+ An error maessage that says what the failures were
+ Not panicking (so these are effectively error productions)
2022-01-30 18:55:09 -06:00
Richard Feldman
29caf5d301
Make macOS frameworks link properly 2022-01-30 11:01:31 -05:00
Folkert de Vries
eec0f840bd
Merge pull request #2427 from rtfeldman/assort-parse-fixes
Assorted low-hanging-fruit bug fixes
2022-01-30 13:58:27 +01:00
ayazhafiz
b50bb9a4c7 Centralize closure type 2022-01-30 00:48:01 -05:00
ayazhafiz
e54917a063 Expose type mismatches between recursive types and types that aren't
Closes #2166
2022-01-30 00:21:45 -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
hafiz
2d8bdfd863
Merge pull request #2417 from rtfeldman/i/2322
Inline polymorphic calls at usage sites
2022-01-29 16:13:43 -06:00
ayazhafiz
47a59c560c Make test use an i64 2022-01-29 15:04:22 -05:00
Brian Carroll
d7f10d80ae repl: Change LLVM macro to use address instead of pointer 2022-01-29 11:24:13 +00:00
ayazhafiz
5943873654 Inline polymorphic calls at usage sites
This is a bit.. ugly, or at least seems suboptimal, but I can't think of
a better way to do it currently aside from demanding a uniform
representation, which we probably don't want to do.

Another option is something like the defunctionalization we perform
today, except also capturing potential uses of nested functions in the
closure tag of an encompassing lambda. So for example,

```
f = \x -> \y -> 1
```

would now record a lambdaset with the data `[Test.f
[TypeOfInnerClos1]]`, where `TypeOfInnerClos1` is e.g.
`[Test.f.innerClos1 I8, Test.f.innerClos1 I16]`, symbolizing that the
inner closure may be specialized to take an I8 or I16. Then at the time
that we create the capture set for `f`, we create a tag noting what
specialization should be used for the inner closure, and apply the
current defunctionalization algorithm. So effectively, the type of the
inner closure becomes a capture.

I'm not sure if this is any better, or if it has more problems.
@folkertdev any thoughts?

Closes #2322
2022-01-28 23:49:19 -05:00