Commit Graph

1119 Commits

Author SHA1 Message Date
KtorZ a3078adce8
Add succinct README to explain what's going on. 2023-02-14 16:25:48 +01:00
KtorZ 685473ead6
Rename data -> ctx 2023-02-14 16:11:00 +01:00
KtorZ 5369872a3d
Add new script_context acceptance scenario for withdrawals. 2023-02-14 16:11:00 +01:00
KtorZ 34596b3084
Fix collecting withdrawal scripts in eval_phase_one
The current implementation assumed that ALL withdrawals present in a
  transaction had to be locked by a script and failed otherwise. But a
  transaction can actually be composed of both. So instead of failing,
  we should rather just ignore withdrawals that can't be referenced by
  redeemers.
2023-02-14 15:58:34 +01:00
KtorZ 251aa756d9
Make basic script a template, and add more assertions. 2023-02-14 11:37:10 +01:00
KtorZ 545323128c
Write basic e2e validator with evaluation. 2023-02-14 10:39:31 +01:00
KtorZ 4ef1ba69de
Use blueprint in hello-world example. 2023-02-14 09:16:30 +01:00
Kasey White 3b3ec7d95c format fix 2023-02-12 19:12:38 -05:00
Kasey White 765ceefd38 feat: add ability to downcast void to data 2023-02-12 18:56:38 -05:00
Kasey White 4c838defd1 fix issue with final clause producing clauseguard air 2023-02-12 18:43:11 -05:00
Kasey White e9883adf12 fix: scope issue when using when with a function call subject 2023-02-12 18:43:11 -05:00
KtorZ 2bda581fbd Add new acceptance test scenario: 057
```
  Error:
    × Main thread panicked.
    ├─▶ at crates/aiken-lang/src/uplc.rs:4286:48
    ╰─▶ called `Option::unwrap()` on a `None` value
  ```
2023-02-12 18:43:11 -05:00
Kasey White 1c9540ec87 one more test case to add 2023-02-11 22:26:34 -05:00
Kasey White 4b1015e0d4 change how expect works on lists and constructors
Add more coverage to acceptance test 40 on expect
2023-02-11 22:26:34 -05:00
Matthias Benkort deb2ab8f80
Merge pull request #362 from aiken-lang/patterns-improvements
Patterns improvements
2023-02-11 22:46:04 +01:00
KtorZ b83a247ff7
Add slightly more informative note for list pattern on int. 2023-02-11 17:00:32 +01:00
KtorZ 2e8fd6e1c2
Remove patterns on 'String'
There's arguably no use case ever for that in the context of on-chain
  Plutus. Strings are really just meant to be used for tracing. They
  aren't meant to be manipulated as heavily as in classic programming
  languages.
2023-02-11 16:57:14 +01:00
KtorZ 6649821200
Add type-checker sanity tests for list patterns. 2023-02-11 16:54:49 +01:00
KtorZ 56e90fba21
Add missing newlines to 'join' in error messages. 2023-02-11 16:24:56 +01:00
KtorZ 3c7663cd3c
Basic exhaustivness check on list patterns
Before that commit, the type-checker would allow unsafe list patterns
  such as:

  ```
  let [x] = xs

  when xs is {
    [x] -> ...
    [x, ..] ->  ...
  }
  ```

  This is quite unsafe and can lead to confusing situations. Now at
  least the compiler warns about this. It isn't perfect though,
  especially in the presence of clause guards. But that's a start.
2023-02-11 16:20:28 +01:00
rvcas 831a37d094
feat: shouldn't use this warning on list 2023-02-11 09:42:39 -05:00
Kasey White e92d9af3c2 fix: changed how list_access_to_uplc handles discards fixing unit test 55
Also fix incorrect error message in runtime in machine
2023-02-11 04:30:18 -05:00
Kasey White ddef61a855 fix: blueprint tests 2023-02-10 19:45:44 -05:00
Kasey White 0269409fa1 case where removing a lam with 0 occurrences is not safe
Since a function call can have arbitrary other calls that lead to error and that is difficult to detect.
2023-02-10 19:24:47 -05:00
KtorZ 21fbd48b8d
Improve error on duplicate imports. 2023-02-10 17:07:08 +01:00
KtorZ f747ee0aca
Improve error message when finding a non-exhaustive let-binding. 2023-02-10 11:01:13 +01:00
Matthias Benkort 22f5ecc8c6
Merge pull request #358 from aiken-lang/patch/cargo.nix
Update Cargo.nix
2023-02-10 10:15:28 +01:00
KtorZ 22eea92c6f [create-pull-request] automated change 2023-02-10 09:11:55 +00:00
rvcas 9b0fc0b395
chore: fix some weirdness after rebasing with main 2023-02-10 10:09:00 +01:00
Matthias Benkort bf15fece57
Merge pull request #356 from aiken-lang/big_int
Upgrade Term::Constant to use BigInt
2023-02-10 09:49:44 +01:00
rvcas c1d67e95e1
feat: fix errors and add tests for BigInt changes 2023-02-09 15:01:30 -05:00
KtorZ bd4aeb779c
Implement integer_log2 on BigInt
Comparing it with the Haskell's implementation.
2023-02-09 18:14:00 +01:00
KtorZ e76d26eb3c
Fixup: follow compiler. 2023-02-09 16:09:49 +01:00
rvcas cfbe5fd3cc
feat: use BigInt in constant integer 2023-02-09 09:46:42 -05:00
rvcas ec58279424
test(machine): integer overflow 2023-02-09 09:44:06 -05:00
Matthias Benkort 37bd22a0d2
Merge pull request #353 from aiken-lang/rvcas/assert_expect
Rename assert to expect
2023-02-09 15:17:14 +01:00
rvcas 461aaf14bd
chore: no more loose numbers for location offsets 2023-02-09 09:16:54 -05:00
KtorZ b5cf8c78a5
Add Ordering data-type definition to prelude known constructors. 2023-02-09 14:36:39 +01:00
KtorZ 6be2a9ed80
Fix formatting of unary operators applied to binary operators.
Add crucial parenthesis...
2023-02-09 13:58:11 +01:00
KtorZ 83a86e6dc0
Fix logical operator precedence in parser.
Whoopsie... || and && were treated with the same precedence, causing very surprising behavior down the line.

  I noticed this because of the auto-formatter adding parenthesis where it really shouldn't. The problem came actually from the parser and how it constructed the AST.
2023-02-09 13:57:12 +01:00
KtorZ 62fe321ddf
Add 'Ordering' data-type to the Prelude.
Useful to have around to build comparison functions.
2023-02-09 11:07:30 +01:00
Matthias Benkort b803332f99
Update crates/aiken-lang/src/tipo/error.rs 2023-02-09 09:25:33 +01:00
Matthias Benkort efbc3abb95
Delete tests.ak 2023-02-09 09:23:46 +01:00
rvcas 460da20e4a
feat: warn when using expect in a completely safe way 2023-02-09 02:10:22 -05:00
rvcas e9caa710c4
chore: rename assert_parser to expect_parser 2023-02-09 01:05:11 -05:00
rvcas 9348caab2f
feat(expect): update formatter
* Token::Expect should format to expect
* since we still capture assert this means
  we can help users update to the new syntax
2023-02-09 00:57:38 -05:00
rvcas 6f591c633d
chore: fmt most of the acceptance tests 2023-02-09 00:57:14 -05:00
rvcas 3f540c7c99
chore: rename assignment kind 2023-02-09 00:47:38 -05:00
rvcas dbd162e985
feat: handle expect in parser
* map both assert/expect to Token::Expect
* use the new token in the parser
* new unit test to expect
2023-02-09 00:43:29 -05:00
rvcas 5a4a8df727
feat(token): add Token::Expect 2023-02-09 00:25:54 -05:00