Commit graph

106 commits

Author SHA1 Message Date
Folkert
dcdaaf4328
enable dev backend repl 2023-09-14 14:38:31 +02:00
Folkert
5ca3d3bcf1
make llvm tests work again 2023-09-13 20:24:15 +02:00
Brian Carroll
ead3c33eb8
Tweak comments and factoring 2023-09-10 11:28:29 +01:00
Brian Carroll
6a47a99114
formatting & clippy 2023-09-09 16:13:17 +01:00
Brian Carroll
aa0e975845
clippy 2023-09-09 15:03:50 +01:00
Brian Carroll
fc7b831285
remove some more duplicated code (format_output) 2023-09-09 14:45:14 +01:00
Brian Carroll
3923dad203
Remove duplicated code from roc_repl_cli and get tests compiling 2023-09-09 13:01:31 +01:00
Brian Carroll
8f59ee9492
Create a new crate roc_repl_ui for shared CLI/web UI code 2023-09-09 11:55:55 +01:00
Richard Feldman
dbf928bc46
Reorganize ReplState logic for cli/wasm compat 2023-09-08 15:37:16 -04:00
Folkert
7fb4b60b21
move around hostexposedalias logic 2023-08-09 15:09:03 +02:00
Ayaz Hafiz
44c4797d9a
Parameterize program solving on a FunctionKind
This new flag determines whether we should introduce a new kind to
represent lambda sets, or whether lambdas should be erased. The latter
is not yet implemented.
2023-07-12 13:53:50 -05:00
Folkert
ef39bad7c6
auto clippy fixes 2023-07-10 18:27:08 +02:00
eiei114
bf3f541331
Merge branch 'main' into fix/replace_panic_with_internal_error 2023-06-27 12:48:34 +09:00
eiei114
486558396f
replace panic 2023-06-25 18:13:44 +09:00
eiei114
c1d4a18c00
Revert "replace"
This reverts commit f43e346897.
2023-06-25 17:50:05 +09:00
eiei114
f43e346897
replace 2023-06-25 17:14:02 +09:00
Ayaz Hafiz
41597cbab7
Do not make LayoutInterner mutable 2023-06-17 18:13:03 -05:00
Gabriel Dertoni
a7640bc0ac
fix: repl panic on empty line 2023-04-27 02:01:17 -03:00
Folkert
4cd8f0a056 clippy --fix fixes 2023-04-21 12:05:51 +02:00
Folkert
454f3c603e
give the new exposed symbols to the surgical linker 2023-02-25 19:35:46 +01:00
Ayaz Hafiz
b60d5c0251
Push wrapped layout interners through 2023-01-03 10:51:33 -06:00
Ayaz Hafiz
759f8d86af
Fix lifetime errors due to interner
In the llvm backend, there are the lifetimes `'a` (lifetime of the
global arena) and `'ctx` (lifetime of constructed LLVM values). `'a`
lives longer than `'ctx`, but the compiler didn't enforce this until
the layout interner was introduced, for some reason. We have to make
sure that containers of lifetime `'a` have no `'ctx` references.
2022-12-29 11:38:34 -06:00
Joshua Warner
a046428ce6
Add fuzzing for the formatter and fix bugs
This commit adds fuzzing for the (expr) formatter, with the same invariants that we use for fmt tests:
  * We start with text, which we parse
  * We format the AST, which must succeed
  * We parse back the AST and make sure it's identical igoring whitespace+comments
  * We format the new AST and assert it's equal to the first formatted version ("idempotency")

Interestingly, while a lot of bugs this found were in the formatter, it also found some parsing bugs.

It then fixes a bunch of bugs that fell out:
* Some small oversights in RemoveSpaces
* Make sure `_a` doesn't parse as an inferred type (`_`) followed by an identifier (parsing bug!)
* Call `extract_spaces` on a parsed expr before matching on it, lest it be Expr::SpaceBefore - when parsing aliases
* A few cases where the formatter generated invalid/different code
* Numerous formatting bugs that caused the formatting to not be idempotent

The last point there is worth talking further about. There were several cases where the old code was trying to enforce strong
opinions about how to insert newlines in function types and defs. In both of those cases, it looked like the goals of
(1) idempotency, (2) giving the user some say in the output, and (3) these strong opinions - were often in conflict.

For these cases, I erred on the side of following the user's existing choices about where to put newlines.

We can go back and re-add this strong opinionation later - but this seemed the right approach for now.
2022-12-17 09:52:09 -08:00
Richard Feldman
e3687935a3
Merge remote-tracking branch 'origin/main' into refactor-platform-info 2022-12-09 22:21:25 -05:00
Richard Feldman
63e9f5da8c
Go back to old opt_main_for_host 2022-12-09 22:18:52 -05:00
Folkert
a72556b927
refactor entry point 2022-12-09 15:10:25 +01:00
Richard Feldman
8b463686bc
Propagate multiple entrypoints to alias analysis 2022-12-08 15:31:42 -05:00
Richard Feldman
49f8768271
Parse and format dbg 2022-11-22 21:08:26 -05:00
Joshua Warner
2d9aba2242
Refactor parser methods to not return State as part of ParseError
As previously discovered with #4464, it's easy to accidentally mis-use the State value returned on the Err path.

There were mixed assumptions about what that State represents: (1) the State where the error occurred, or (2) the State at the beginning of the thing we were just parsing.

I fixed this up to always mean (2) - at which point we don't actually need to return the State at all - so it's impossible for further discrepency to creep in.

I also took the liberty to refactor a few more methods to be purely combinator-based, rather than calling `parse` directly.
2022-11-18 19:52:23 -05:00
Anton-4
a6a2b59a79
Merge branch 'main' of github.com:lukewilliamboswell/roc into rust-docs 2022-11-08 15:57:24 +01:00
Luke Boswell
cec67721e6
merge upstream/main 2022-11-06 09:27:46 +11:00
Joshua Warner
5d5b71a083
Refactor several parse methods to use more combinators 2022-11-05 09:44:08 -04:00
Richard Feldman
c2004d9779
Fix incomplete when detection in repl 2022-11-05 01:22:26 -04:00
Richard Feldman
0657c38bb4
Merge branch 'repl' into repl-warnings
Signed-off-by: Richard Feldman <oss@rtfeldman.com>
2022-11-03 20:05:18 -07:00
Luke Boswell
f3bdb5f321
updating rust package documentation 2022-11-03 20:00:06 +11:00
Richard Feldman
e2451c7f22
Drop the gray lines from the repl 2022-11-01 22:05:47 -04:00
Richard Feldman
1499ec5def
Drop termline dependency 2022-11-01 21:42:08 -04:00
Richard Feldman
19ffa61f8f
Add a gray line after each repl output 2022-11-01 15:57:22 -04:00
Richard Feldman
fb799d1d24
clippy 2022-11-01 01:27:15 -04:00
Richard Feldman
afa88bfd41
Don't shadow unnecessarily 2022-11-01 01:24:58 -04:00
Richard Feldman
560c984d30
Fix error filtering region math 2022-11-01 01:20:52 -04:00
Richard Feldman
167e8a40de
Print (filtered) warnings in the repl again 2022-11-01 00:25:11 -04:00
Richard Feldman
9854dceec8
Filter out warnings and errors for past defs 2022-11-01 00:24:49 -04:00
Richard Feldman
220c362671
Merge remote-tracking branch 'origin/main' into repl 2022-10-31 20:49:28 -04:00
Joshua Warner
07be8ec000
Refactor Parser trait to pass min_indent
This removes the need to explicitly pass thru min_indent when using the parser combinators.

My ultimate goal here is to evolve the current parser closer toward a purely combinator-based parser,
at which point we can more easily transition smoothly to a formal(ish) grammar, or expand the meanings of combinators
to include things like:
* Incremental (re)parsing
* Unified parsing and formatting code
* Better error recovery
* Using the main parser directly for syntax highlighting
2022-10-31 13:31:47 -07:00
Richard Feldman
50ebffad5a
Fix Windows Readline error 2022-10-31 07:28:24 -04:00
Richard Feldman
9265d6480d
clippy 2022-10-31 07:12:57 -04:00
Richard Feldman
212090769f
Fix repl handling of invalid layouts 2022-10-31 06:57:52 -04:00
Richard Feldman
d6853519d8
Expand repl TIPS 2022-10-31 06:53:27 -04:00
Richard Feldman
cb7ee6a43a
Have repl error eagerly on confirmed syntax errors 2022-10-31 06:40:38 -04:00