aiken/crates/aiken-lang/src/tests
KtorZ e8d97028ad
Prevent constant evaluating to generic/unbound functions
Constants are like tiny programs, so they are bound by the same rules
  as validators and other programs. In fact, functions are slightly more
  flexible in that they allow generic constant expressions like
  `List<a>`.

  Yet, there is no way to contain such generic structure that contain
  inhabitants in a way that satisfies the type-checker. In the example
  of `List<a>`, the only inhabitant of that type that we can construct
  is the empty list. Anything else would require holding onto some
  generic value.

  In addition, we can't force literal values into generic annotation, as
  something like:

  ```
  const foo: List<a> = [1, 2, 3]
  ```

  wouldn't type-check either since the right-side would unify to
  `List<Int>`. And again, the only right-hand side that can type-check
  is the empty list without any inhabitant.

  The added restriction on generic function is necessary because while
  we allow constants to return lambda, we cannot (easily) generate UPLC
  that is generic in its argument. By the time we generate UPLC, the
  underlying types have to be known.
2024-10-01 18:37:40 +02:00
..
snapshots Fix extraneous space added after multiline alternative patterns 2024-09-19 20:24:59 +02:00
check.rs Prevent constant evaluating to generic/unbound functions 2024-10-01 18:37:40 +02:00
format.rs Fix formatting of long multiline if/is expressions. 2024-09-15 14:59:47 +02:00
lexer.rs chore: make folder names match crate name 2022-12-21 18:11:07 -05:00
mod.rs test(parser): finish moving tests to their correct modules 2023-07-04 17:48:48 -04:00