Commit Graph

443 Commits

Author SHA1 Message Date
KtorZ 858dfccc82
Authorize complete patterns as function args.
This is mainly a syntactic trick/sugar, but it's been pretty annoying
  to me for a while that we can't simply pattern-match/destructure
  single-variant constructors directly from the args list. A classic
  example is when writing property tests:

  ```ak
  test foo(params via both(bytearray(), int())) {
    let (bytes, ix) = params
    ...
  }
  ```

  Now can be replaced simply with:

  ```
  test foo((bytes, ix) via both(bytearray(), int())) {
    ...
  }
  ```

  If feels natural, especially coming from the JavaScript, Haskell or
  Rust worlds and is mostly convenient. Behind the scene, the compiler
  does nothing more than re-writing the AST as the first form, with
  pre-generated arg names. Then, we fully rely on the existing
  type-checking capabilities and thus, works in a seamless way as if we
  were just pattern matching inline.
2024-06-07 15:42:25 +02:00
KtorZ e1f39ae539
Oversight: fix missing 'AList' -> 'Pairs' conversion. 2024-05-23 17:08:33 +02:00
KtorZ 5ce30b2632
Rename AList -> Pairs due to popular demand. 2024-05-23 16:45:40 +02:00
microproofs 3d06129d9b add test for curry optimization that is a reduced case of #945 2024-05-22 15:46:32 -04:00
rvcas c1a913f420
fix(config): add default for plutus version 2024-05-22 13:59:56 -04:00
microproofs c1c2cd97b7 New test 103 and clippy fixes 2024-05-21 11:56:12 -04:00
KtorZ b546e42766
FML. 2024-05-14 15:27:08 +02:00
KtorZ 8881a88ae3
Also fix multi-validator for gift_card. 2024-05-14 13:28:24 +02:00
KtorZ ff0407a245
Fix stdlib adjustment in gift_card. 2024-05-14 10:44:48 +02:00
KtorZ 6d7b851c70
Fix 077 after yet-another-breaking-change in stdlib. 2024-05-10 19:05:00 +02:00
Dima S 8a6957dfd0 Update fresh 2024-05-10 10:37:35 -04:00
microproofs 893e9c9855 activate test 75 2024-05-06 15:17:01 -04:00
KtorZ 967f4348ed Add new acceptance test 101 capturing type mismatch at runtime. 2024-05-06 15:17:01 -04:00
KtorZ 0a660c6a21 Add new acceptance test illustrating need for fn call ordering 2024-05-06 15:17:01 -04:00
KtorZ 99c35a6459 Add now-necessary type-annotations in tests 2024-05-06 15:17:01 -04:00
microproofs 0e9baf4944 test should fail 2024-05-06 11:35:55 -04:00
microproofs 2f61f59b60 Closes #909 2024-05-06 11:35:05 -04:00
microproofs 14903f7352 update gift card example 2024-05-04 16:08:08 -04:00
microproofs b669db8516 update tests 2024-05-04 15:58:14 -04:00
microproofs b3d0c3ec04 fix: fixing tests to account for the new stdlib main. Also added test 75 but commented out for now until a fix is merged 2024-05-04 14:26:06 -04:00
microproofs a44ed4c1a8 Change prelude Map to AList 2024-05-04 14:04:12 -04:00
microproofs d8d2fb0ebc fix example error 2024-05-04 14:04:12 -04:00
microproofs fc0e88018e Chore:
Refactor get_uplc_type to account for constr types that don't exactly resolve to a uplc type
Check arg_stack in uplc generator has only 1 argument at the end of the generation
warning fixes
2024-05-04 14:04:12 -04:00
KtorZ 1091eba3c3 Review & fix acceptance tests
Temporarily using the 'specialize-dict-key' branch from the stdlib
  which makes use of Pair where relevant. Once this is merged back into
  'main' we should update the acceptance test toml files to keep getting
  them automatically upgraded.

  This commit also fixes an oversight in the reification of data-types
  now properly distinguishing between pairs and 2-tuples.

  Co-authored-by: Microproofs <kasey.white@cardanofoundation.org>
2024-05-04 14:04:12 -04:00
microproofs 7b5ad961e2 fix: found issue with record access on Pairs 2024-05-04 14:04:12 -04:00
microproofs a6003c3be9 chore: push changes in blueprint snapshot test 2024-03-27 15:57:29 -04:00
microproofs a5a0734629 fix: casting a field type to Data with expect and traces on was assuming the raw Data was of type constr 2024-03-27 15:52:23 -04:00
microproofs 61936cb91e fix(codegen): Add tracing when checking for a constr vs another primitive 2024-03-17 16:25:17 -04:00
KtorZ 37627e3527
Fix indentation of pipelines. 2024-03-09 20:44:51 +01:00
microproofs c7dcb2c256 Add tests for zero arg cyclic functions and renamed function aliases 2024-03-09 13:23:27 -05:00
KtorZ d6cc9bdfbe
Allow implicit discard when right-hand side is Void.
This is the most intuitive/expected behavior. Otherwise, it forces a pointless let-binding to 'Void' or into a discard.
2024-03-09 01:28:29 +01:00
microproofs c906501836 add one more test 2024-03-08 12:25:26 -05:00
microproofs eb07365e73 fix tests 2024-03-08 00:12:44 -05:00
microproofs ae396c0224 Fix opaque type destructuring in code gen 2024-03-08 00:12:44 -05:00
microproofs a3fbe6c155 fix tests 2024-03-06 23:27:10 -05:00
rvcas 25ebdc2527
fix: validator args unexpectedly unbound
closes #852
2024-03-06 14:15:00 -05:00
microproofs c9dd281b45 disable assert that was blocking issue #844 2024-03-04 11:48:22 -05:00
microproofs 27eb1a3e04 Change all uses of interning besides the uplc parser to use the new CodeGenInterner 2024-03-04 11:03:23 -05:00
microproofs e14f091b86 add back test 93 2024-03-04 10:52:56 -05:00
KtorZ 775a34bc47
Remove acceptance_test 095, now done directly from Rust.' 2024-03-03 19:33:26 +01:00
KtorZ 93347d8e7b
Add Fuzzer to the prelude. 2024-03-03 19:33:25 +01:00
KtorZ 5b4fedd084
Add PRNG to the Prelude. 2024-03-03 19:33:25 +01:00
KtorZ bfcfc5c41b
Implement reification from Maps. 2024-03-03 19:33:25 +01:00
KtorZ 5272f5ecee
Adjust order in which Bool's constructors are declared in the prelude
True corresponds to Constr=1 and False corresponds to Constr=0; their position in the vector shall reflect that. Note that while this would in principle impact codegen for any other type, it doesn't for bool since we likely never looked up this type definition since it is well-known. It does now as the 'reify' function relies on this. Whoopsie.
2024-03-03 19:33:25 +01:00
KtorZ 14f1025f0b
Display counterexamples as Aiken values instead of raw UPLC. 2024-03-03 19:33:24 +01:00
KtorZ c29d163900
Rename acceptance_test_093 -> acceptance_test_095 2024-03-03 19:33:24 +01:00
KtorZ a703db4d14
Borrow integrated shrinking approach from MiniThesis. 2024-03-03 19:33:24 +01:00
KtorZ 3762473a60
Add preliminary plumbing to run property test through the CLI.
This is very very rough at the moment. But it does a couple of thing:

  1. The 'ArgVia' now contains an Expr/TypedExpr which should unify to a Fuzzer. This is to avoid having to introduce custom logic to handle fuzzer referencing. So this now accepts function call, field access etc.. so long as they unify to the right thing.

  2. I've done quite a lot of cleanup in aiken-project mostly around the tests and the naming surrounding them. What we used to call 'Script' is now called 'Test' and is an enum between UnitTest (ex-Script) and PropertyTest. I've moved some boilerplate and relevant function under those module Impl.

  3. I've completed the end-to-end pipeline of:
     - Compiling the property test
     - Compiling the fuzzer
     - Generating an initial seed
     - Running property tests sequentially, threading the seed through each step.

   An interesting finding is that, I had to wrap the prop test in a similar wrapper that we use for validator, to ensure we convert primitive types wrapped in Data back to UPLC terms. This is necessary because the fuzzer return a ProtoPair (and soon an Array) which holds 'Data'.

  At the moment, we do nothing with the size, though the size should ideally grow after each iteration (up to a certain cap).

  In addition, there are a couple of todo/fixme that I left in the code as reminders of what's left to do beyond the obvious (error and success reporting, testing, etc..)
2024-03-03 19:33:24 +01:00
KtorZ 4ff11f4229
Fix acceptance test 087 following BigInt seralization fix. 2024-03-02 14:11:22 +01:00
KtorZ 2b8e99a1b8
Fix CI script for acceptance tests, and have them run in parallel. 2024-03-02 14:11:22 +01:00