Commit Graph

1518 Commits

Author SHA1 Message Date
KtorZ ad5a393c4d
Add 'docs' and 'assets' to generated gitignore
And also make 'docs' the default folder (instead of doc) to be more aligned with Github's defaults.
2022-12-29 10:54:46 +01:00
Kasey White cce76bbd63 fix issue with constructor clauses and clause props 2022-12-28 18:00:11 -05:00
KtorZ c4c0ace3a6
Align warnings message's style with errors. 2022-12-28 18:45:04 +01:00
KtorZ 7c1b8e8f3b
Map remaining relevant builtins. 2022-12-28 18:27:28 +01:00
KtorZ f2e716dd86
Fix else/if formatter. 2022-12-28 17:55:11 +01:00
KtorZ bae8267f18
Fix formatter for unary operation
Was wrongly converting any unary operation into '!'
2022-12-28 17:51:00 +01:00
KtorZ 013fe886f5
Add new acceptance test scenario: 035
```
  Error:
    × Main thread panicked.
    ├─▶ at /Users/ktorz/Documents/Projects/aiken-lang/aiken/crates/aiken-
    │   project/src/lib.rs:692:36
    ╰─▶ called `Result::unwrap()` on an `Err` value: FreeUnique(Name { text:
        "aiken/dict_do_insert_with_map_bytearray_int_bytearray_int_data",
        unique: Unique(27) })
  ```
2022-12-28 17:03:32 +01:00
KtorZ 77fbb3cbdb
Add new acceptance test scenario: 034
```
  Error:
    × Main thread panicked.
    ├─▶ at /Users/ktorz/Documents/Projects/aiken-lang/aiken/crates/aiken-project/src/lib.rs:670:22
    ╰─▶ called `Result::unwrap()` on an `Err` value: FreeUnique(Name { text: "aiken/list_foldr_list_data_data_list_data", unique: Unique(1) })
  ```
2022-12-28 10:59:42 +01:00
Kasey White 722117bfc4 one minor scope fix 2022-12-27 22:33:09 -05:00
Kasey White 551d4eea93 fix test 28 2022-12-27 22:33:09 -05:00
Kasey White 010024fb95 fix: acceptance test 031
Co-authored-by: rvcas <x@rvcas.dev>
2022-12-27 22:33:09 -05:00
Kasey White 083b7fcb5f feat: support negation of int
* add unary op
* parse, typecheck, and code gen it
* express boolean not as unary op as well, previously called negate

Co-authored-by: rvcas <x@rvcas.dev>
2022-12-27 20:39:03 -05:00
Kasey White 542e39f093 feat: finish up zero arg issues with dependencies 2022-12-27 19:35:08 -05:00
Kasey White 30487cc232 fix test 23 2022-12-27 19:35:08 -05:00
Kasey White 919ea6c723 tuple destructuring nested and not now works 2022-12-27 19:35:08 -05:00
Kasey White a08c615da4 checkpoint 2022-12-27 19:35:08 -05:00
Kasey White b7d506a8db nested lists now work 2022-12-27 19:35:08 -05:00
Kasey White 6126ee4cb4 checkpoint 2022-12-27 19:35:08 -05:00
alessandrokonrad b97570bc00 Fixed clippy issue 2022-12-27 17:08:05 -05:00
alessandrokonrad c6b5380c27 Fixed ex unit budget limit per redeemer 2022-12-27 17:08:05 -05:00
KtorZ 2e17f18846
Rework acceptance test runner
Show less noise, support parallel execution and make it easier to run a single one.
2022-12-27 09:29:13 +01:00
rvcas 0d0536f6c1 fix: rename test module to tests 2022-12-23 22:00:59 -05:00
rvcas 01f2142606 fix: the push was in the wrong place 2022-12-23 22:00:59 -05:00
rvcas cbaf629645 feat: warn if no validators on build 2022-12-23 22:00:59 -05:00
rvcas 38a716d94e feat: allow error to hold a label 2022-12-23 15:52:44 -05:00
rvcas 37196a29ee feat: error keyword 2022-12-23 15:52:44 -05:00
rvcas 22103739c3 chore: some clippy warnings 2022-12-23 15:52:44 -05:00
KtorZ 39f5d1a86d
Make build, check and docs target directory an (optional) argument
Instead of being an option. Feels more natural that way.
2022-12-23 20:23:27 +01:00
KtorZ b1b57406e7
Do not generate placeholder files when creating new projects.
And fix the --lib flag to be a flag.
2022-12-23 20:19:28 +01:00
Matthias Benkort f9ac12c3da
Merge pull request #212 from aiken-lang/better-type-check-errors
Better type check errors
2022-12-23 19:57:25 +01:00
KtorZ 7b9ea5dabb
Add links to the user-manual to errors, when applicable. 2022-12-23 19:50:14 +01:00
KtorZ 69f060e675
Rework all errors to provide better help text. 2022-12-23 19:27:06 +01:00
KtorZ c47c50ffb8
Show most type-checking error on a single line; reads better. 2022-12-23 00:25:18 +01:00
KtorZ ce0c6e0d0f
Use smart-constructor for UnexpectedLabeledArg errors.
Reduce duplications and keep the formatting of the error inside the error module.
2022-12-23 00:24:57 +01:00
KtorZ dca633da48
Refactor 'UnknownVariable' and 'UnknownTypeConstructor' as smart-constructor. 2022-12-23 00:09:07 +01:00
KtorZ aa2a235790
Suggest possible candidate on unknown imports.
## Before

  ```
  × Type-checking
  ╰─▶ Unknown module field 'ValidityRaneg' in module 'aiken/transaction'
  ```

  ## After

  ```
    × Type-checking
    ╰─▶ Unknown import 'ValidityRaneg' from module 'aiken/transaction'

     ╭─[../stdlib/validators/tmp.ak:2:1]
   2 │ use aiken/interval.{Interval, IntervalBound, IntervalBoundType}
   3 │ use aiken/transaction.{ScriptContext, ValidityRaneg}
     ·                                       ─────────────
   4 │
     ╰────
    help: Did you mean to import 'ValidityRange'?
  ```
2022-12-22 23:46:17 +01:00
KtorZ 70b1ec4324
Add function to calculate lenvenshtein distance of two strings
Will be useful to make import or usage suggestions.
2022-12-22 23:44:15 +01:00
KtorZ 666761efef
Make 'UnexpectedLabelArg' errors more helpful
## Before

  ```
   × Checking
   ╰─▶ Unexpected labeled argument

       t

     ╭─[/Users/mati/Devel/OpenSource/time_lock_aiken/validators/time_lock.ak:13:1]
  13 │   let now = when context.transaction.validity_range.lower_bound.bound_type is {
  14 │     Finite { t } -> t
     ·              ─
  15 │     NegativeInfinity -> 0
     ╰────
  ```

  ## After

  ```
    × Type-checking
    ╰─▶ Unexpected labeled argument 't'

      ╭─[../stdlib/validators/tmp.ak:10:1]
   10 │   let now = when context.transaction.validity_range.lower_bound.bound_type is {
   11 │     interval.Finite { t } -> t
      ·                       ─
   12 │     interval.NegativeInfinity -> 0
      ╰────
    help: The constructor 'Finite' does not have any labeled field. Its fields
          must therefore be matched only by position.

          Perhaps, try the following:

          ╰─▶  interval.Finite(t)
  ```
2022-12-22 21:45:49 +01:00
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
KtorZ 2aa4429231
Rename Unit -> Void 2022-12-22 18:52:28 +01:00
KtorZ 5cf9742e5e
Move tuple-index hint as diagnostic's help 2022-12-22 18:52:28 +01:00
Lucas 168196f903
Merge pull request #210 from aiken-lang/fix-if-expressions 2022-12-22 12:46:24 -05:00
KtorZ 1f15c2ca20
Sort import alphabetically when formatting.
Fixes #211.
2022-12-22 18:00:25 +01:00
rvcas c723f4f796 feat: redo the new command 2022-12-22 10:52:49 -05:00
KtorZ 1ca705005d
Fix formatting of if-expressions
Fixes #129.
2022-12-22 16:51:23 +01:00
Matthias Benkort a129a8a0d3
Merge pull request #208 from aiken-lang/tuple-when2
fix todo and list and tuple not equal operator
2022-12-22 10:28:06 +01:00
KtorZ 7ad8babf17
Rename ArgName::{Discard,NamedLabeled} as ArgName::{Discarded,Named}
Now that the other variants are gone, this is clearer.
2022-12-22 09:36:44 +01:00
KtorZ 8ab05509b1
Remove Named & DiscardLabeled, now unused
And unify everything into either 'Discard' or 'NamedLabeled'
2022-12-22 09:36:44 +01:00
Matthias Benkort 18acd0e65f
Merge pull request #202 from aiken-lang/tuple-indexes
Tuple indexes
2022-12-22 09:35:08 +01:00
KtorZ 4d74deb223
re-generate Cargo.lock 2022-12-22 09:15:26 +01:00