Commit Graph

1074 Commits

Author SHA1 Message Date
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
KtorZ
757428fa7f Add new acceptance test scenario 033
```
  Error:
    × Main thread panicked.
    ├─▶ at crates/lang/src/uplc.rs:523:17
    ╰─▶ not yet implemented: Tuple indexing not implementing yet
  ```
2022-12-22 09:14:23 +01:00
KtorZ
bf7cdfba73 Implement parser & type-checker for tuple indexes.
```aiken
  fn foo() {
    let tuple = #(1, 2, 3, 4)
    tuple.1st + tuple.2nd + tuple.3rd + tuple.4th
  }
  ```
2022-12-22 09:14:23 +01:00
Kasey White
b1dec1259d fix todo and list and tuple not equal comparator 2022-12-22 01:09:06 -05:00
rvcas
7867793bcd feat: on fmt if label and name are the same only print one 2022-12-21 19:17:15 -05:00
rvcas
4c4e454ea3 feat: all function args are now labeled implicitly 2022-12-21 19:17:15 -05:00
rvcas
42204d2d71 chore: make folder names match crate name 2022-12-21 18:11:07 -05:00
rvcas
5694cac1a5 chore: add ktorz to funding 2022-12-21 17:35:56 -05:00
rvcas
9028424a96 feat: rename Nil to Unit 2022-12-21 17:27:20 -05:00
rvcas
9df5005820 feat: add IData and BData builtins 2022-12-21 14:39:46 -05:00
rvcas
429126e38f feat: add trace 2022-12-21 14:39:46 -05:00
KtorZ
9068c89c00 Show trace logs as part of the test output when any.
```
  ┍━ test ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  │ PASS [mem: 6370, cpu: 2591822] trace_1
  │ ↳ is negative
  │ ↳ is non-negative
  ┕━━━━━━━━━ 1 tests | 1 passed | 0 failed
  ```
2022-12-21 14:39:46 -05:00
KtorZ
2fc14c7c1f Make box-drawing code more reusable
- Move it to 'pretty' module.
  - Have function work on colored strings titles and contents
2022-12-21 14:39:46 -05:00
KtorZ
f26737ecb4 Remove the 'trace/try' keyword, use builtin.trace
I am not entirely sure what the intent was for that keyword, but
  nothing really matched between the parser, the formatter and the uplc
  code gen. I don't think there's any need for a keyword here, trace is
  already readily available from the builtins.
2022-12-21 14:39:46 -05:00
KtorZ
5d459b25bd Add new acceptance test scenario 032
```
  Error: aiken::parser

    × Parsing
    ╰─▶ Unexpected "try"

     ╭─[032/lib/test.ak:3:1]
   3 │ test trace_1() {
   4 │   builtin.trace("foo", True)
     ·           ─────
   5 │ }
     ╰────
    help: Try removing it
  ```
2022-12-21 14:39:46 -05:00
KtorZ
2aad1794a1 make dependencies optional in Aiken's manifest. 2022-12-21 14:32:40 +01:00
KtorZ
414a114530 fix acceptance tests manifest. 2022-12-21 14:06:46 +01:00
Matthias Benkort
e6f4b378e1 Merge pull request #146 from aiken-lang/micah/file-errors
Raise more descriptive errors when the `aiken.toml` manifest is missing.
2022-12-21 11:05:02 +01:00
Micah Kendall
bd816615d7 Display more descriptive error on missing manifest
Before:

  ```
  ❯ aiken check
  Error:
    × No such file or directory (os error 2)
  ```

  After:

  ```
  ❯ aiken check
  Error:
    × Missing 'aiken.toml' manifest in /Users/ktorz/Documents/Projects/aiken-lang/aiken
    help: Try running `aiken new <REPOSITORY/PROJECT>` to initialise a project with an example manifest.
  ```

  Co-authored-by: KtorZ <matthias.benkort@gmail.com>
2022-12-21 10:10:17 +01:00
Matthias Benkort
127581a445 Merge pull request #199 from aiken-lang/acceptance-test-021-type-alias-definition
Fix acceptance 021: allow registering type aliases in any order.
2022-12-21 10:07:03 +01:00
KtorZ
28c907d9de Fix acceptance 021: allow registering type aliases in any order.
This is the most intuitive thing I could come up with: since the
  problem is mainly due to the order in which we try declaring the
  aliases, then it suffices to simply try as much as we can, and retry
  on failure until there's no more failure.

  Note that it's important to detect cycles if we do such thing (which
  we can by noticing that a given iteration didn't make any progress).

  It works pretty well in the end and even allow us to define a new kind
  of type error should there be a cyclic definition.
2022-12-21 09:43:37 +01:00
KtorZ
a3591cc7dc Fix 'aiken new', now require project name in specific format. 2022-12-21 00:19:24 +01:00
rvcas
796ac28044 feat: change the printing a little 2022-12-20 16:32:31 -05:00
rvcas
0b204beb58 chore: turn off cargo audit for now 2022-12-20 16:32:31 -05:00
rvcas
e34cbc8e7e feat: compile deps 2022-12-20 16:32:31 -05:00
rvcas
b06bf610b7 feat: dep downloading now works 2022-12-20 16:32:31 -05:00
rvcas
6a0b1ce5c3 feat: start trying to use deps 2022-12-20 16:32:31 -05:00
rvcas
5bd2a9336c feat: tons of boilerplate for fetching packages 2022-12-20 16:32:31 -05:00
rvcas
34f9029a57 chore: fix lock file 2022-12-20 16:32:31 -05:00
rvcas
a6fd8f92a8 feat(deps): start laying out some types and functions 2022-12-20 16:32:31 -05:00
rvcas
b3266fb837 chore: clippy warnings 2022-12-20 16:32:31 -05:00
Kasey White
ac14512706 feat: fix nil equals nil, and fix funcs with discard params 2022-12-20 15:40:01 -05:00
Kasey White
9177267570 feat: test 24 passes
fixed issue with is_tuple in types
minor monomorphize change
2022-12-20 15:40:01 -05:00
Kasey White
17603e8cca checkpoint 2022-12-20 15:40:01 -05:00
KtorZ
f9761e8ade Recommend installing latest git head from README (instead of latest cargo crate) 2022-12-20 09:23:41 +01:00
KtorZ
730c5a3314 Adjust logo's size on README. 2022-12-20 09:20:31 +01:00
KtorZ
b22f9df0d1 Tweak LICENSE
- Make sure to credit the original author of Gleam, from which Aiken gets a lot of inspiration.
  - Adds CF & TxPipe as new maintainers / copyrighters moving on.
2022-12-20 05:47:13 +01:00
KtorZ
102bb7735e Add new integration test scenario 031
```
  × clamp_1 failed
  help: ┍━ left ━━━━━━━━━━┑
        │ (con integer 0) │
        ┕━━━━━━━━━━━━━━━━━┙

        should be equal to

        ┍━ right ━━━━━━━━━━┑
        │ (con integer 10) │
        ┕━━━━━━━━━━━━━━━━━━┙
  ```
2022-12-20 04:48:03 +01:00
KtorZ
030172e1dc Add new acceptance test scenario 030
```
  Error:
    × Main thread panicked.
    ├─▶ at crates/lang/src/uplc.rs:1897:45
    ╰─▶ called `Result::unwrap()` on an `Err` value: ParseIntError { kind: InvalidDigit }
  ```
2022-12-20 04:37:55 +01:00
KtorZ
58c123a930 Add new intgration test scenario 029
```
  Error:
    × Main thread panicked.
    ├─▶ at crates/lang/src/uplc.rs:2395:56
    ╰─▶ called `Result::unwrap()` on an `Err` value: FreeUnique(Name { text: "test_insert", unique:
        Unique(1) })
  ```
2022-12-20 04:21:28 +01:00
KtorZ
daa3fa5d33 Add new acceptance test scenario 028
```
  Error:
    × Main thread panicked.
    ├─▶ at crates/lang/src/builder.rs:1257:30
    ╰─▶ internal error: entered unreachable code
  ```
2022-12-20 02:55:01 +01:00
KtorZ
fec7431d11 Add new acceptance test scenario 027
```
  Error:
    × Main thread panicked.
    ├─▶ at /Users/ktorz/Documents/Projects/aiken-lang/aiken/crates/project/src/lib.rs:640:36
    ╰─▶ called `Result::unwrap()` on an `Err` value: FreeUnique(Name { text: "test_foo", unique:
        Unique(0) })
  ```
2022-12-20 02:32:43 +01:00
KtorZ
8bd4fd0cda Add new acceptance test scenario
```
  Error:
    × Main thread panicked.
    ├─▶ at /Users/ktorz/Documents/Projects/aiken-lang/aiken/crates/project/src/lib.rs:620:22
    ╰─▶ called `Result::unwrap()` on an `Err` value: FreeUnique(Name { text:
        "test_foldr_list_int_data_list_int", unique: Unique(10) })
  ```
2022-12-20 02:22:04 +01:00
KtorZ
fccad9e7dd Add new acceptance test scenario 025
```
  help: ┍━ left ━━━━━━━━┑
        │ (con unit ()) │
        ┕━━━━━━━━━━━━━━━┙

        should be equal to

        ┍━ right ━━━━━━━┑
        │ (con unit ()) │
        ┕━━━━━━━━━━━━━━━┙
  ```
2022-12-20 01:07:15 +01:00
KtorZ
f511b2f71b Add new acceptance test scenario 024
```
  × map2_3 failed
  help: ┍━ left ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┑
        │ Type mismatch expected 'integer' got 'pair data data' │
        ┕━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┙

        should be equal to

        ┍━ right ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┑
        │ Type mismatch expected 'list pair data data' got 'list data' │
        ┕━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┙
  ```
2022-12-19 18:55:50 +01:00