aiken/crates/aiken-lang/src
KtorZ 0682781460
Better errors when using unknown data-type constructor.
## Before

  ```
    × Checking
    ╰─▶ Unknown variable

            Finite

      ╭─[../stdlib/validators/tmp.ak:10:1]
   10 │   let now = when context.transaction.validity_range.lower_bound.bound_type is {
   11 │     Finite { t } -> t
      ·     ────────────
   12 │     NegativeInfinity -> 0
      ╰────
  ```

  ## After

  ```
    × Type-checking
    ╰─▶ Unknown data-type constructor 'Finite'

      ╭─[../stdlib/validators/tmp.ak:10:1]
   10 │   let now = when context.transaction.validity_range.lower_bound.bound_type is {
   11 │     Finite { t } -> t
      ·     ────────────
   12 │     NegativeInfinity -> 0
      ╰────
    help: Did you forget to import it?

          Data-type constructors are not automatically imported, even if their type is
          imported. So, if a module `aiken/pet` defines the following type:

           ┍━ aiken/pet.ak ━━━━━━━━
           │ pub type Pet {
           │   Cat
           │   Dog
           │ }

          You must import its constructors explicitly to use them, or prefix them
          with the module's name.

           ┍━ foo.ak ━━━━━━━━
           │ use aiken/pet.{Pet, Dog}
           │
           │ fn foo(pet : Pet) {
           │   when pet is {
           │     pet.Cat -> // ...
           │     Dog -> // ...
           │   }
           │ }
  ```
2022-12-22 19:34:50 +01:00
..
parser Move tuple-index hint as diagnostic's help 2022-12-22 18:52:28 +01:00
tests Sort import alphabetically when formatting. 2022-12-22 18:00:25 +01:00
tipo Better errors when using unknown data-type constructor. 2022-12-22 19:34:50 +01:00
air.rs Implement parser & type-checker for tuple indexes. 2022-12-22 09:14:23 +01:00
ast.rs Rename ArgName::{Discard,NamedLabeled} as ArgName::{Discarded,Named} 2022-12-22 09:36:44 +01:00
builder.rs chore: make folder names match crate name 2022-12-21 18:11:07 -05:00
builtins.rs Rename Unit -> Void 2022-12-22 18:52:28 +01:00
expr.rs Rename Unit -> Void 2022-12-22 18:52:28 +01:00
format.rs Sort import alphabetically when formatting. 2022-12-22 18:00:25 +01:00
lib.rs chore: make folder names match crate name 2022-12-21 18:11:07 -05:00
parser.rs Rename ArgName::{Discard,NamedLabeled} as ArgName::{Discarded,Named} 2022-12-22 09:36:44 +01:00
pretty.rs chore: make folder names match crate name 2022-12-21 18:11:07 -05:00
tipo.rs Rename Unit -> Void 2022-12-22 18:52:28 +01:00
uplc.rs Rename Unit -> Void 2022-12-22 18:52:28 +01:00