Commit Graph

1210 Commits

Author SHA1 Message Date
KtorZ
451737237e Fix blueprint generation for recursive types.
This was a bit tricky and I ended up breaking things down a lot and
  trying different path. This commit is the result of the most
  satisfying one.

  It introduces a new 'concept' and types: Definitions and Reference.
  These elements are meant to reflect JSON pointers and JSON-schema
  definitions which we now use for pretty much all user-defined
  data-types.

  In fact, Schemas are no longer inlined, but are always referencing
  some schema under "definitions".

  This indirection is necessary in order to cope with recursive types.
  And while it's only truly necessary for recursive types, using it
  consistently makes it both easier to produce and easier to consume.

  ---

  The blueprint generation for recursive types here also works thanks to
  the 'Definitions' data-structure wrapper around a BTreeMap. This uses
  a strategy where:

  (1) schemas are only generated if they haven't been seen before
  (2) schemas are marked as seen BEFORE actually being generated (to
  effectively stop a recursive generation).

  This relies on one important aspect: the key must be uniquely
  identifying a given schema. Which means that we have to monomorphize
  data-types with generic parameters also here, and use keys that are
  specialized in one data-type.

  ---

  In this large overhaul we've also lost one thing which I didn't bother
  re-introducing yet to keep the work manageable: title for record
  fields. Before, we use to pull those from record constructor when
  available, yet now, every record constructor has been replaced by a
  `$ref`. We could theoritically attach a title to the reference. I'll
  try to quickly add that in a later commit.
2023-03-12 12:44:49 -04:00
KtorZ
f67e049dc2 Introduce indirection for fields. 2023-03-12 12:44:49 -04:00
KtorZ
3a7aac0a33 Make blueprint code slightly more resilient to changes.
Leverage traits instead of hard-coded type parameters.
2023-03-12 12:44:49 -04:00
KtorZ
e44f18bae5 Add failing test scenario for recursive types. 2023-03-12 12:44:49 -04:00
Kasey White
4a7bbc23df fix: change in scope was applied in wrong place in pattern_ir for constr expect 2023-03-12 00:25:26 -05:00
rvcas
6440c4f498 fix(codegen): tuple pattern scopes
Co-authored-by: Kasey White <kwhitemsg@gmail.com>
2023-03-09 19:30:52 -05:00
Kasey White
f377d60085 ChooseData is now lazy with its branch arguments.
This enables calling the un_data builtins directly from choose_data args
2023-03-09 00:31:57 -05:00
rvcas
553eb88d3d fix(check): record field access properly restricted to single constr types 2023-03-08 23:50:16 -05:00
rvcas
41e725152e feat(unify): cannot cast between string and data closes #432 2023-03-08 22:47:38 -05:00
Kasey White
c85240cbed Fix exception when doing expect boolean = ..
Add new Air Assert Bool
Add acceptance test 76
2023-03-08 22:31:30 -05:00
rvcas
6cde0628a7 fix(check): filter tests before code gen
Co-authored-by: Kasey White <kwhitemsg@gmail.com>
2023-03-08 20:58:27 -05:00
KtorZ
a66c9bd2c3 Remove redundant match on tuple blueprint generation. 2023-03-08 16:40:03 +01:00
KtorZ
2c987e289d Fix 'find_modules_prefix' when generating docs. 2023-03-08 12:28:01 +01:00
KtorZ
ab32302117 Only generate documentation of current package with 'docs'
This was generating documentation for ALL packages including dependencies.
2023-03-08 12:00:59 +01:00
KtorZ
0ea4538cac Fix typo and pluralize message for invalid field arity error. 2023-03-08 11:44:54 +01:00
Matthias Benkort
d8934b3d8d Merge pull request #421 from aiken-lang/monomorph-panic-fix
Functions with only a generic return weren't being properly monomorph…
2023-03-08 11:39:50 +01:00
Kasey White
89373c32e6 Functions with only a generic return weren't being properly monomorphized. Fixed that. 2023-03-08 10:31:05 +01:00
rvcas
f8545854fc feat: json output for uplc eval 2023-03-08 10:19:36 +01:00
rvcas
bd7b8792bf feat: introduce EvalResult type 2023-03-08 10:19:36 +01:00
rvcas
4f1d14f2a0 feat: introduce miette into uplc 2023-03-08 10:19:35 +01:00
KtorZ
cb11b21c9f Update dependencies
In particular, tempfile >= 3.4.0 to remove the vulnerability on remove_dir_all
2023-03-08 10:17:22 +01:00
rvcas
8f765bfd52 fix: some breaking changes from pallas v0.18 2023-03-06 13:17:14 -05:00
rvcas
c3175e2fc9 fix: some breaking changes from clap v4 2023-03-06 13:16:33 -05:00
rvcas
79c2cb3062 fix: toml now have a better way to capture error spans 2023-03-06 13:15:48 -05:00
rvcas
92161bed43 fix: From<&str> for GlobPattern does not exist need to use string 2023-03-06 13:15:12 -05:00
rvcas
1902a2d56c chore: update all deps 2023-03-06 13:13:59 -05:00
rvcas
1f8535e76e chore: update some deps 2023-03-06 11:09:44 -05:00
rvcas
9f587e802c chore: update comment 2023-03-03 20:57:20 -05:00
rvcas
e2dc4ec6c8 feat: implement convert command 2023-03-03 20:57:20 -05:00
rvcas
812ffb30f0 feat(cli): wire together a new command for convert 2023-03-03 20:57:20 -05:00
Kasey White
f230af436c fix: scope issue with expect and function calls
Add acceptance test 72
2023-03-03 01:00:35 -05:00
Kasey White
60bc2ab61d clippy 2023-03-02 21:49:20 -05:00
Kasey White
5779b77ccc fix: Had to also check for generic type in return of a function.
add check to prevent stack overflow error
Add panic to prevent any other occurrences of stack overflow
2023-03-02 21:49:20 -05:00
Kasey White
fe1f200e4d rename find_generics_... to find_and_replace_generics
Other renames as well
2023-03-02 21:49:20 -05:00
KtorZ
6d098a4571 Fix blueprint generation for nested fields with Data
Having the data's schema be optional at the level of the 'Schema' did not allow to represent cases where there would be an opaque data at an arbitrary nesting. So I introduced a new variant 'Opaque' on 'Data' to fill that gap.
2023-03-02 15:25:17 -05:00
rvcas
a40f88b918 fix: test never used Foo 2023-03-02 15:25:17 -05:00
KtorZ
65c336cb82 Update blueprint outputs to reflect latest specification.
Schemas of datums, redeemers and parameters are now nested under a field 'schema'. This allows to define a field 'purpose' at the same level.
2023-03-02 17:17:27 +01:00
KtorZ
70cdf3cb26 Add 'exported_data' test and revert 413a056 2023-03-02 16:09:08 +01:00
Kasey White
413a056c08 fix: Data was not allowed in an interface
Co-authored-by: rvcas <x@rvcas.dev>
2023-03-01 21:34:36 -05:00
Kasey White
d7c33bd62a fix: A unique error was caused by the order in which we insert functions.
These functions relied on the same dependency and had the same scope. So insertion was by encounter rather than order determined by dependency handling. Now we switched to dependency order is prioritized to prevent free unique.
2023-03-01 14:22:59 -05:00
KtorZ
a46a9fca41 Only use colors & text decorations on ANSI-capable terminals.
Fixes #404.
2023-02-26 13:19:03 +01:00
Kasey White
2f2be39813 clippy fixes 2023-02-26 00:13:38 -05:00
Kasey White
665a8dec67 feat: add support for unconstr_data
-Builitins IR now acts like Record IR in terms of argument consumption
-UnConstrData returns as Pair(Data,Data) to conform with how pairs are treated behind the scenes.
2023-02-26 00:13:38 -05:00
rvcas
0066cc61cc Release 0.0.29
aiken@0.0.29
aiken-lang@0.0.29
aiken-lsp@0.0.29
aiken-project@0.0.29
uplc@0.0.29

Generated by cargo-workspaces
2023-02-23 19:04:18 -05:00
KtorZ
539ed2dea4 Fix unicode char parsing in comments. 2023-02-22 17:33:13 +01:00
KtorZ
fbf65de1dc Update default cost models for Aiken
Closes #396
2023-02-22 17:03:48 +01:00
KtorZ
bdee5e7995 Use variable-length threshold for levenshtein distance
Fixes #348
2023-02-22 13:29:39 +01:00
KtorZ
00e9dabe82 Add missing Plutus builtins to Aiken's lang. 2023-02-22 12:53:03 +01:00
KtorZ
0838d48f7c Move module name validation outside of type-checking
And disable it for documentation generation. This way, we can generate documentation for aiken/builtins and aiken (prelude)
2023-02-22 11:51:32 +01:00
KtorZ
6465af3ae2 Add missing keywords to highlightjs for doc generation. 2023-02-22 11:50:31 +01:00