Commit Graph

150 Commits

Author SHA1 Message Date
KtorZ
ed9f5c6ef7 Preserve TypeAlias in types for better context/feedback. 2024-03-08 15:59:33 +01:00
microproofs
bf429fbdbf remove unused import 2024-03-08 00:12:44 -05:00
microproofs
dcec8ecfe6 remove unused special function 2024-03-08 00:12:44 -05:00
KtorZ
23a22a65cb Handle (recursive) generic types during reification.
Also moved a bunch of functions from code-gen back into _tipo_, as
  they're better suited and generic enough to be reused elsewhere.
2024-03-07 18:07:52 +01:00
microproofs
a3fbe6c155 fix tests 2024-03-06 23:27:10 -05:00
microproofs
bdd84dc952 fixing the tests lead to me create a new function for converting from data 2024-03-06 23:27:10 -05:00
microproofs
892da06e14 add more runtime checking for a few of the data to primitive conversions 2024-03-06 23:27:10 -05:00
microproofs
c9dd281b45 disable assert that was blocking issue #844 2024-03-04 11:48:22 -05:00
KtorZ
c2dc47fa0b Refactor creation of CodeGenerator and management of known data_types and functions.
This was a mess to say to the least. The mess started when we wanted
  to make all definitions in codegen use immutable maps of references --
  which was and still is a good idea. Yet, the population of the data
  types and functions definitions was done somehow in a separate step,
  in a rather ad-hoc manner.

  This commit changes that to ensure the project's data_types and
  functions are populated while type checking the AST such that we need
  not to redo it after.

  The code for registering the data type definitions and function
  definitions was also duplicated in at least 3 places. It is now a
  method of the TypedModule.

  Note: this change isn't only just cosmetic, it's also necessary for
  the commit that follows which aims at adding tests to the set of
  available function definitions, thus allowing to make property tests
  callable.
2024-03-03 19:33:26 +01:00
KtorZ
26e563a9be Hardened property-based testing framework. More tests, less bugs.
Those end-to-end tests are useful. Both for controlling the behavior of the shrinker, but also to double check the reification of Plutus Data back into untyped expressions.
  I had to work-around a few things to get opaque type and private types play nice. Also found a weird bug due to how we apply parameters after unique debruijn indexes have been also applied. A work-around is to re-intern the program.
2024-03-03 19:33:26 +01:00
KtorZ
70ea3c9598 Write boilerplate code for being able to easily test properties.
Loads of plumbing, but we now have at least some nice ways to test property execution and shrinking.
2024-03-03 19:33:26 +01:00
KtorZ
14f1025f0b Display counterexamples as Aiken values instead of raw UPLC. 2024-03-03 19:33:24 +01:00
KtorZ
c766f44601 Allow Fuzzer with type parameter
Also fix shrinker first reduction, as well as passing of List/Tuples to fuzzer.
2024-03-03 19:33:24 +01:00
rvcas
d698f76e3c fix(codegen): builtin calls for g1 and g2 where flipped
closes #840
2024-02-29 12:13:51 -05:00
microproofs
6c6be3f53d got past the errors and warnings 2024-02-07 12:37:37 -05:00
microproofs
51f1da2505 Removed AirStatements and AirExpressions
Still a WIP
2024-02-07 12:37:37 -05:00
microproofs
8702c736d0 fix warning 2024-02-07 12:36:35 -05:00
microproofs
806a74c192 fix all current errors 2024-02-07 12:36:35 -05:00
KtorZ
a12c374258 Start turning AirTree statements into expressions (let)
Still many places to fix, WIP.
2024-02-07 12:36:35 -05:00
microproofs
3b4c6cb2aa fix: missing message error term in one place for type is void 2024-02-07 11:48:52 -05:00
microproofs
551941392e fix: assert had one minor edge case due to final clauses with lists 2024-01-31 00:05:09 -05:00
microproofs
444bccf19c fix: change list_access_to_uplc to properly handle list discards 2024-01-30 23:53:33 -05:00
microproofs
78d2049d7b fix: Using the wrong match string for discards in FieldsExpose
Also need to return a lambda wrapped term from list_access_to_uplc under all conditions
2024-01-25 14:18:36 -05:00
microproofs
36a0b317ad fix condition to account for tail presence 2024-01-24 16:29:40 -05:00
microproofs
3a44c45b48 fix: one builtin error wasn't be caught with a messaged exception 2024-01-24 16:29:40 -05:00
microproofs
eda4e259d6 minor fix and some refactoring on the if statements 2024-01-24 16:29:40 -05:00
microproofs
956c3d6cf0 feat: refactor code gen to avoid builtin errors when tracing is turned on 2024-01-24 16:29:40 -05:00
KtorZ
6fa272bd34 Remove compiler-generated helper 'global' traces in compact mode.
Since there's no line number to show here, we don't have much choice. And the alternative of showing shorter traces as code is just ugly as hell.
2024-01-19 14:30:44 +01:00
KtorZ
59c784778e Convert span's start to line number + col
This requires to make line numbers a first-class citizen in the module
  hierarchy but it is fortunately not _too involved_.
2024-01-19 14:30:15 +01:00
KtorZ
e67d5863a1 Introduce 'compact' trace level verbosity
For now, it only shows the span start. We'll change that in the next commit to show a line number and a column.
2024-01-19 14:30:15 +01:00
microproofs
f79b37d551 Replace 'bool' with 'TraceLevel' in codegen
Co-authored-by: KtorZ <matthias.benkort@gmail.com>
2024-01-19 14:30:15 +01:00
microproofs
d26524048e fix: headlist builtin on assoc lists
implement chooseunit for 0 args
2024-01-13 19:29:34 -05:00
microproofs
c7af27a6ba fix: generic edge case with tuples that allowed 2 tuples and 3 tuples to use the same monomorphized function.
Also massively reduced the space taken up by generics in scripts when using generics with list and tuples
2024-01-13 17:46:32 -05:00
microproofs
4a8fecb70a fix: satisfy clippy's demands 2024-01-11 14:53:02 -05:00
microproofs
ff462fa8ea don't need clippy macro anymore :) 2024-01-08 18:08:50 -05:00
microproofs
f722af1149 fix: accidentally put quotes around tail_name 2024-01-08 18:08:50 -05:00
microproofs
2216f387c3 refactor: change codegen uplc to have more type safety
Also refactor list_access_to_uplc
2024-01-08 18:08:50 -05:00
KtorZ
30a6b77116 Get rid of 'VoidMsg' in favor of an 'Option'. 2024-01-04 16:03:51 -05:00
microproofs
c50a9cb5bd refactor: convert msgs to use AirMsg type instead of AirTree 2024-01-04 16:03:51 -05:00
microproofs
394cac86b8 feat: expect on a type now can take in a msg when in trace mode 2024-01-04 16:03:51 -05:00
microproofs
c7a1ff0959 refactor how tracing is popped off to be in one location in uplc_gen 2024-01-04 16:03:51 -05:00
microproofs
355e38d6e2 feat: expects now print the line of code that failed 2024-01-04 16:03:51 -05:00
microproofs
aa51ce3e3e feat: add code messages when using expects on constrs 2024-01-04 16:03:51 -05:00
microproofs
71cfb6f6af feat: Add specific messages for using expect with booleans
TODO: fill out the rest of the expects with messages
2024-01-04 16:03:51 -05:00
microproofs
45177cd08b fix: add missing type checks for the new bls primitives 2023-11-23 13:00:24 -05:00
microproofs
8b89ba3b93 feat: implement bls primitives in code gen 2023-11-15 15:55:56 -05:00
microproofs
d51374aac1 feat: add conversion to data and from data for new primitive types 2023-11-15 15:55:56 -05:00
microproofs
0d2ac952d0 feat: implemented the Bls381-12 builtins and types
also implemented Keccak256 and Blake2b_224

TODO: cost model, flat serialization, pretty

Co-authored-by: rvcas <x@rvcas.dev>
2023-11-15 15:55:56 -05:00
microproofs
4dd17dacf3 chore: rename uplc builder builtins 2023-10-22 17:08:48 -04:00
microproofs
4649a5a9d2 fix: don't reset the used special functions 2023-10-07 19:42:24 -04:00