Commit Graph

459 Commits

Author SHA1 Message Date
KtorZ
2922c0aa6f Display expected patterns/tokens in parse error when applicable.
We've never been using those 'expected' tokens captured during
  parsing, which is lame because they contain useful information!

  This is much better than merely showing our infamous

    "Try removing it!"
2024-07-19 12:28:08 +02:00
KtorZ
a9d782e206 re-introduce code-gen patch, but with a test.
Actually, this has been a bug for a long time it seems. Calling any
  prelude functions using a qualified import would result in a codegen
  crash. Whoopsie.

  This is now fixed as shown by the regression test.
2024-07-19 12:28:07 +02:00
KtorZ
beb5ac4643 Add 'diagnostic' to the prelude, as well as companion functions.
This is not fully satisfactory as it pollutes a bit the prelude. Ideally, those functions should only be visible
  and usable by the underlying trace code. But for now, we'll just go with it.
2024-07-19 12:28:07 +02:00
microproofs
9907dd6c64 Fix unit tests 2024-06-25 18:50:00 -04:00
microproofs
b5ac5bc949 Add current fixed tests and start working on codegen fix 2024-06-25 18:50:00 -04:00
microproofs
f0f1296906 Fix more tests 2024-06-25 18:50:00 -04:00
microproofs
cc9df04093 Fix missing delay in list_access_to_uplc. Also fix one of the unit tests. 2024-06-25 18:50:00 -04:00
rvcas
8f343abaa1 chore: add new snapshots 2024-06-25 18:50:00 -04:00
Dima S
d99c014bf7 chore: correct the usage of a legacy numeric constant 2024-06-25 17:49:36 -04:00
rvcas
de870e2529 feat: warning on compiler version mismatch 2024-06-13 20:26:44 -04:00
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
4d42c6cb19 Introduce 'ArgBy' to allow defining function arg not only by name. 2024-06-07 11:17:16 +02:00
KtorZ
216dab99d4 chore: Release 2024-06-06 11:19:34 +02:00
KtorZ
e9e26b969a Preserve warning display rework, but without breaking the LSP quickfixes. 2024-05-30 19:20:11 +02:00
KtorZ
5694d9f9cb Introduce 'fail once' and alter behavior of 'fail' keyword for properties. 2024-05-30 17:18:50 +02:00
rvcas
338fc0eba6 chore: Release 2024-05-23 16:45:10 -04:00
rvcas
ff50d4d2cf chore: Release 2024-05-23 16:23:59 -04:00
KtorZ
e2bc3a9fc4 Update blueprint generation to work with Pairs.
Closes #938.
2024-05-23 18:15:46 +02:00
KtorZ
c48f15a957 revert #903 'feat: Emit keyword'
While we agree on the idea of having some ways of emitting events, the
  design hasn't been completely fleshed out and it is unclear whether
  events should have a well-defined format independent of the framework
  / compiler and what this format should be.

  So we need more time discussing and agreeing about what use case we
  are actually trying to solve with that.

  Irrespective of that, some cleanup was also needed on the UPLC side
  anyway since the PR introduced a lot of needless duplications.
2024-05-23 17:22:12 +02:00
KtorZ
5ce30b2632 Rename AList -> Pairs due to popular demand. 2024-05-23 16:45:40 +02:00
rvcas
c3ad52b50f feat: add compiler version to aiken.toml 2024-05-22 15:35:57 -04:00
rvcas
c1a913f420 fix(config): add default for plutus version 2024-05-22 13:59:56 -04:00
microproofs
c16bd06e97 make sure traverse_uplc_with_helper is always passing the arg to lambda before running the with function.
Breaks #945 again
2024-05-22 11:58:05 -04:00
rvcas
edf82f773c chore: update snapshots 2024-05-22 11:30:02 -04:00
rvcas
f5c4f4cb37 chore(plutus_version): use a cuter name in the config field 2024-05-21 17:13:12 -04:00
rvcas
f306f1715a feat: use plutus version in address command
relates to #907
2024-05-21 17:04:25 -04:00
rvcas
3bc3792aa3 feat: add plutus version to aiken.toml
relates to #907
2024-05-21 17:02:20 -04:00
microproofs
c1c2cd97b7 New test 103 and clippy fixes 2024-05-21 11:56:12 -04:00
KtorZ
1ed4fa1c69 Show warning when ignoring modules + restyle warnings slightly
Fixes #916.
2024-05-14 13:27:19 +02:00
KtorZ
c5de9adcd3 Add some log output / feedback to completion --install 2024-05-10 17:31:48 +02:00
rvcas
f8ce46d0f4 chore(ci): run cargo dist init 2024-05-08 11:05:30 -04:00
KtorZ
ef70c6b8a8 Re-use generic id across builtin type-definitions.
This was somehow wrong and corrected by codegen later on, but we should be re-using the same generic id across an entire definition if the variable refers to the same element.
2024-05-06 15:17:01 -04:00
microproofs
68f1dcc65d Add comment as a reminder to future me 2024-05-06 11:48:10 -04:00
microproofs
2f61f59b60 Closes #909 2024-05-06 11:35:05 -04:00
microproofs
a44ed4c1a8 Change prelude Map to AList 2024-05-04 14:04:12 -04:00
KtorZ
03a5a9293c Replace snapshot test for export recursive function
This test contains a pattern match on a 2-tuple, which induced a
  slight code change in UPLC as expected.
2024-05-04 14:04:12 -04:00
KtorZ
7cb548a749 Fix ordinal index on pairs 2024-05-04 14:04:12 -04:00
KtorZ
2cb2c7fa1f Add dedicated 'Pair' typed and untyped expression
Before this commit, we would parse 'Pair' as a user-defined
  data-types, and thus piggybacking on that whole record system. While
  perhaps handy for some things, it's also semantically wrong and
  induces a lot more complexity in codegen which now needs to
  systematically distinguish every data-type access between pairs, and
  others.

  So it's better to have it as a separate expression, and handle it
  similar to tuples (since it's fundamentally a 2-tuple with a special
  serialization).
2024-05-04 14:04:12 -04:00
KtorZ
390bccd406 Fix blueprint validator test snapshot. 2024-05-04 14:04:12 -04:00
microproofs
ebe415cfc9 fix errors 2024-05-04 14:04:12 -04:00
microproofs
d7574e738f fix: remaining cargo tests 2024-05-04 14:04:12 -04:00
microproofs
999e408a28 fix some more tests 2024-05-04 14:04:12 -04:00
microproofs
cb1ca84dad fixing more tests 2024-05-04 14:04:12 -04:00
microproofs
75b076552c feat: Do a major overhaul on how we check types to allow for match patterns instead of if statements
Also fix one more test
2024-05-04 14:04:12 -04:00
microproofs
3c332ca42a Few more places in codegen where we need to be able to deal with Pair records 2024-05-04 14:04:12 -04:00
microproofs
26f68c2fb4 fix: found various unify and type issues while running tests 2024-05-04 14:04:12 -04:00
microproofs
61a021f9e3 update pair to handle alias 2024-05-04 14:04:12 -04:00
microproofs
d05d8e7de6 Start working on separating pairs from 2 tuples in Aiken
co-authored-by: KtorZ <matthias.benkort@gmail.com>
2024-05-04 14:04:12 -04:00
Micah Kendall
d25b8f91c7 feat: Emit keyword 2024-04-12 21:40:27 -04:00
rvcas
17ddbfaafa chore: remove dbg 2024-04-08 14:30:07 -04:00