Commit Graph

109 Commits

Author SHA1 Message Date
rvcas
a6b230aad4 fix: exhaustiveness on types from other modules 2023-08-01 21:13:50 -04:00
rvcas
1b8e94fe32 feat: expect boolean sugar 2023-07-15 20:50:02 -04:00
rvcas
69fdee9f7e fix: trace expr 2023-07-15 20:08:16 -04:00
rvcas
2edfd33594 fix: some attempted adjustments 2023-07-15 20:08:16 -04:00
rvcas
252b760ca1 test: remove prefix on all format tests 2023-07-14 16:56:27 -04:00
rvcas
03e7d6e944 feat: update syntax for failing test to be more consistent 2023-07-12 09:16:37 -04:00
rvcas
1ab1ff9a1f feat: rename error to fail 2023-07-12 09:16:37 -04:00
Cainã Costa
b80c41b4b7 chore: cargo fmt 2023-07-11 13:06:25 -04:00
Cainã Costa
14652abd4f fix: port last missing test
This test has been added after the first implementation, so we move it
to the new format :)
2023-07-11 13:06:25 -04:00
Cainã Costa
c27ef8ad93 chore: refactor formatting tests
This changes the tests from normal assertions into snapshot tests, as
well as standardizing test names.
2023-07-11 13:06:25 -04:00
KtorZ
126f2ab004 Implement new formatter for 'int'.
This is used for constants and patterns, which can carry negative
   values.
2023-07-06 16:10:46 -04:00
rvcas
5e8edcb340 test(parser): finish moving tests to their correct modules 2023-07-04 17:48:48 -04:00
rvcas
47567c5e6f test(parser): some adjustments after rebase with @ktorz fix 2023-07-04 17:19:30 -04:00
rvcas
b25db429be test(parser): anon binop and ambiguous sequence 2023-07-04 17:19:30 -04:00
rvcas
8a6c81493c test(parser): record create 2023-07-04 17:19:30 -04:00
rvcas
a75bcff5c8 test(parser): type alias, anon fn, record update and more 2023-07-04 17:19:30 -04:00
rvcas
bd8c13c372 test(parser): move over the validator tests and some misc tests to parser 2023-07-04 17:19:29 -04:00
rvcas
6b05d6a91e test(parser): rename definitions to definition and more tests 2023-07-04 17:19:29 -04:00
rvcas
715752718d test: assert_module 2023-07-04 17:19:29 -04:00
rvcas
da0b969865 test: adjust snapshots 2023-07-04 17:19:29 -04:00
Cainã Costa
291dedf4e8 chore: refactor all parse tests to use assert_parse! 2023-07-04 17:19:28 -04:00
rvcas
f878ef7cef feat: move some token processing to the lexer 2023-07-04 17:19:28 -04:00
Cainã Costa
63cdb8aa09 chore: add more details on snapshot tests
We added a macro to add more information about the code that is being
tested, so we can add lots and lots of small snapshot tests.
2023-07-04 17:19:28 -04:00
Cainã Costa
eeaa1a05d2 feat: add first code snapshot test with insta 2023-07-04 17:19:28 -04:00
KtorZ
5a6cc855e6 Use byte count for token span in the lexer.
Somehow, miette doesn't play well with spans when using chars indices.
  So we have to count the number of bytes in strings / chars, so that
  spans align accordingly.
2023-07-04 16:51:59 -04:00
KtorZ
4252ee6373 Implement formatter for anon binop. 2023-06-17 08:44:59 +02:00
KtorZ
91f03abb7b Support all binary operator in the anonymous binop parser. 2023-06-17 08:44:45 +02:00
KtorZ
d0b4c1c3b5 Add remaining boolean comparison operator to anon binop parser.
Nothing to see here as they all have the same signature. Implementing
  arithmetic bin-operators and boolean logic operators will require some
  more logic.
2023-06-17 07:57:37 +02:00
KtorZ
ec94230294 Extend parser to accept anonymous binop as expressions.
This is simply a syntactic sugar which desugarize to a function call with two arguments mapped to the specified binary operator.
  Only works for '>' at this stage as a PoC, extending to all binop in the next commit.
2023-06-17 07:36:11 +02:00
KtorZ
ba911d48ea Refactor 'is_capture' field on function expressions.
Refactored into an enum to make it easier to extend with a new variant to support binary operators.
2023-06-17 07:26:46 +02:00
rvcas
aeaec6bcd8 fix: record format when module select
- instead of checking the container we need to check
  the FieldAccess label.

closes #601
2023-06-13 00:18:32 -04:00
KtorZ
6bd8e94e17 Preserve numeric underscore and hexadecimal notation through formatting. 2023-06-08 16:37:20 +02:00
KtorZ
0b7682306f Refactor formatter to use new 'self.int' helper function. 2023-06-08 15:34:28 +02:00
KtorZ
79a2174f0a Extend parser to support int as hexadecimal and numeric underscore.
We only allow numeric underscore for decimal numbers as I am not sure how we can define it for non-decimal numbers?
2023-06-08 15:33:50 +02:00
KtorZ
0ea11a4d13 Introduce new test cases for hexadecimal and underscore parsing. 2023-06-08 13:26:22 +02:00
rvcas
3fc9c8e0db chore: re-add empty line handling by @KtorZ
Co-authored-by: KtorZ
2023-06-07 17:21:04 -04:00
rvcas
1747090931 fix: fmt crashing with comment at end of file
closes #568
2023-06-07 15:59:54 -04:00
KtorZ
0afc3aba13 Fix operator precedences, in particular |>
Fixes #571.
2023-06-06 17:17:47 +02:00
rvcas
26a607eb00 fix: bad parsing of comments at end of file closes #551 2023-05-30 11:07:39 -04:00
rvcas
2860bac4c6 fix: bad parsing for module select type annotations closes #550 2023-05-30 10:39:49 -04:00
rvcas
7b3e1c6952 feat: adjust failing test syntax
* also add a formatter test
2023-05-25 18:21:12 -04:00
rvcas
a44b5e1a77 test: adjust formatter tests after latest tweaks 2023-05-25 17:37:53 -04:00
rvcas
a124a16a61 feat(tests): implement a way to express that tests can fail 2023-05-25 16:54:53 -04:00
microproofs
c2ee631d07 feat: new setup for the gen_uplc testing
* new test only module aiken_project::tests
* move TestProject to tests/mod.rs
* new tests go in gen_uplc.rs
2023-04-19 16:08:55 -04:00
microproofs
e4276d7f5a move uplc tests to new location 2023-04-19 16:08:55 -04:00
rvcas
3b351d36fb fix(aiken-lang): assignment as last expr in when and if 2023-04-16 19:55:47 -04:00
rvcas
98c61ca151 feat(aiken-lang): anonymous functions
@MartinSchere noticed a weird error
where an unknown variable wasn't being reported
the type checker was incorrectly scoping
arguments for anonymous function definitions.
Luckily his compilation failed due to a FreeUnique
error during code gen which is good. But this may
have been the source of other mysterious FreeUnique
errors.

I also noticed that anonymous function allowed
arguments with the same name to be defined.

`fn(arg, arg)`

This now returns an error.
2023-04-16 16:38:43 -04:00
rvcas
d8cbcde61d feat(validators): unused param warning
Params being unused were being incorrectly reported.
This was because params need to be initialized
at a scope above both the validator functions. This
manifested when using a multi-validator where one of
the params was not used in both validators.

The easy fix was to add a field called
`is_validator_param` to `ArgName`. Then
when infering a function we don't initialize args
that are validator params. We now handle this
in a scope that is created before in the match branch for
validator in the `infer_definition` function. In there
we call `.in_new_scope` and initialize params for usage
detection.
2023-03-30 21:15:27 -04:00
KtorZ
6a4f62d074 Allow newlines in when clause sequences. 2023-03-30 13:49:00 +02:00
KtorZ
5d4c95d538 Supports commenting validator inner functions. 2023-03-30 13:37:09 +02:00