Commit Graph

2036 Commits

Author SHA1 Message Date
Kasey White 6e5b24a937 refactor the rest of the term builders to use more concise code 2023-03-21 00:50:13 -04:00
Kasey White 7c3750bbb4 fix: apply order on field expose 2023-03-21 00:50:13 -04:00
Kasey White 50db958d06 update codegen to use more streamlined uplc building methods 2023-03-21 00:50:13 -04:00
Kasey White ef3862ade8 refactor: uplc code gen uses shorthand methods 2023-03-21 00:50:13 -04:00
Kasey White 74a7a2f214 commit air changes that expose scope as a mutable pointer 2023-03-21 00:50:13 -04:00
KtorZ 6422027c6c
Fix README template for newly generated projects, and hello, world 2023-03-18 22:23:55 +01:00
KtorZ 0f35675f57
remove wrongly committed println. 2023-03-18 17:33:21 +01:00
KtorZ 0b8c3b05fe
Fill-in test scenario for parsing large integer constants. 2023-03-18 16:17:42 +01:00
KtorZ 8a2af4cd2e
Fix lexer throwing errors when parsing a too large tuple index. 2023-03-18 16:13:50 +01:00
Matthias Benkort df722d6f0f
Merge pull request #457 from aiken-lang/double_validators
Two in one validators
2023-03-18 10:59:11 +01:00
rvcas 2dbc50f098
feat: generate_test doesn't need arguments 2023-03-17 18:41:22 -04:00
rvcas 74c61358ab
feat: new error for when multi-validators have the same arg count 2023-03-17 18:40:50 -04:00
rvcas d753b57c1b
chore: use let-else 🤯 2023-03-17 18:40:49 -04:00
KtorZ a4c7337df2
Add new acceptance scenario 079 (double validators) 2023-03-17 18:40:49 -04:00
KtorZ bc690c5410
Generated wrapped schemas for multi-validators' redeemers 2023-03-17 18:40:49 -04:00
Kasey White bb6fc76971
start on registering redeemer wrapper type in definitions 2023-03-17 18:40:49 -04:00
KtorZ 7e1403a3b2
Complete generation of blueprint multi-validators. 2023-03-17 18:40:49 -04:00
Kasey White fe92b27d50
start on refactoring validator to support multi-validators in blueprint 2023-03-17 18:40:49 -04:00
KtorZ 61113cd7b9
distinguish between multi vs single validator case in blueprint schema generation. 2023-03-17 18:40:48 -04:00
Lucas 22880a300f
Update crates/aiken-lang/src/parser.rs
Co-authored-by: Matthias Benkort <5680256+KtorZ@users.noreply.github.com>
2023-03-17 18:40:48 -04:00
Lucas 950598b534
Update crates/aiken-lang/src/parser.rs
Co-authored-by: Matthias Benkort <5680256+KtorZ@users.noreply.github.com>
2023-03-17 18:40:48 -04:00
Lucas 3d92772d23
Update crates/aiken-lang/src/tipo/infer.rs
Co-authored-by: Matthias Benkort <5680256+KtorZ@users.noreply.github.com>
2023-03-17 18:40:48 -04:00
Lucas bf34324ac0
Update crates/aiken-lang/src/format.rs
Co-authored-by: Matthias Benkort <5680256+KtorZ@users.noreply.github.com>
2023-03-17 18:40:48 -04:00
rvcas c3870e340e
feat(codegen): support multi-validators
* rename force_wrap to force
* add a bunch of builder methods to Term<Name>
* refactor one tiny location to show off builder methods
* split generate into `generate` and `generate_test`
* create wrap_as_multi_validator function

Co-authored-by: Kasey White <kwhitemsg@gmail.com>
2023-03-17 18:40:44 -04:00
rvcas 87493bbba9
feat(register_values): refactor repeated code into register_function and register other_fun 2023-03-17 18:38:24 -04:00
rvcas 15bdb6972d
feat(fmt): better validator formatting with double supported 2023-03-17 18:38:24 -04:00
rvcas ed92869fb9
feat(validator): parsing and typechecking for double validators 2023-03-17 18:38:24 -04:00
Matthias Benkort 3eccc349aa
Merge pull request #459 from aiken-lang/remove-multi-subjects
Cleanup implementation from multi-subjects when/is
2023-03-17 14:58:56 +01:00
KtorZ 660d2199d4
Make blueprint generation deterministic
Sort validators before iterating on them.
2023-03-17 14:57:39 +01:00
rvcas 5e3a902c75 fix: add back some extra info on display 2023-03-17 09:35:10 -04:00
KtorZ 28a3844d54
Cleanup implementation from multi-subjects when/is 2023-03-17 13:06:39 +01:00
KtorZ c113582404 Support multi-clause patterns as syntactic sugar
And disable multi-patterns clauses. I was originally just controlling
  whether we did disable that from the parser but then I figured we
  could actually support multi-patterns clauses quite easily by simply
  desugaring a multi-pattern into multiple clauses.

  This is only a syntactic sugar, which means that the cost of writing
  that on-chain is as expensive as writing the fully expanded form; yet
  it seems like a useful shorthand; especially for short clause
  expressions.

  This commit however disables multi-pattern when clauses, which we do
  not support in the code-generation. Instead, one pattern on tuples for
  that.
2023-03-16 19:45:41 -04:00
KtorZ 660ca3fada Fix comment formatting wrongly assuming false invariant. 2023-03-16 18:44:11 -04:00
KtorZ 57e217e81c Add failing tests (fmt panic) on weird doc comments.
Isolated doc comments causes the compiler to panic with:

  ```
  'no consecutive empty lines'
  ```

  This is reproducible when doc comments are wrapped in sandwich between
  comments and newlines.
2023-03-16 18:44:11 -04:00
KtorZ 0feb2df0a0
Minor error messages fixes. 2023-03-16 23:35:12 +01:00
KtorZ 13890874c0
Fix 'run' script, also do 'check' on modules that have validators. 2023-03-16 23:04:24 +01:00
Lucas 4ed279b30d
Merge pull request #454 from aiken-lang/newline-assignment
Enforce newline after assignment / clause.
2023-03-16 15:32:11 -04:00
Lucas fab6d56bf2
Merge branch 'main' into newline-assignment 2023-03-16 15:30:55 -04:00
KtorZ b2f3b66a96 Fill-in CHANGELOG about let-binding change. 2023-03-16 15:29:44 -04:00
KtorZ 5d3816e984 Improve warning message for UnusedVariable 2023-03-16 15:29:44 -04:00
KtorZ 45575cae96 Fix 'run' script and re-generate blueprint for scenario 077. 2023-03-16 15:29:44 -04:00
KtorZ a5e505e6b0 Remove unused let-binding from type-checking
The typed-AST produced as a result of type-checking the program will
  no longer contain unused let-bindings. They still raise warnings in
  the code so that developers are aware that they are being ignore.

  This is mainly done to prevent mistakes for people coming from an
  imperative background who may think that things like:

  ```
  let _ = foo(...)
  ```

  should have some side-effects. It does not, and it's similar to
  assigned variables that are never used / evaluated. We now properly
  strip those elements from the AST when encountered and raise proper
  warnings, even for discarded values.
2023-03-16 15:29:44 -04:00
KtorZ 45ea7acc6a Refactor infer_assignment code to be more future-proof
It's generally a bad idea to use equality on enum variants because this won't trigger any compiler errors in the future yet could have hazardous effects if adding new variants. So it's usually preferrable to use exauhstive pattern matching and let the compiler warn missing cases in places where it matters.
2023-03-16 15:29:44 -04:00
KtorZ 5bea2d163d Fix comments and remove commented-out code. 2023-03-16 15:29:44 -04:00
KtorZ da8d3fc1fc Removed unused warning variant: UnusedLiteral 2023-03-16 15:29:44 -04:00
KtorZ 20f5baffa7
Enforce newline after assignment / clause.
This leads to more consistent formatting across entire Aiken programs.
  Before that commit, only long expressions would be formatted on a
  newline, causing non-consistent formatting and additional reading
  barrier when looking at source code.

  Programs also now take more vertical space, which is better for more
  friendly diffing in version control systems (especially git).
2023-03-16 19:46:46 +01:00
rvcas bf9297efcf
chore(gift_card): cardano scan url should be preprod as well 2023-03-16 09:45:11 -04:00
Matthias Benkort c4f6ef93bf
Merge pull request #450 from aiken-lang/better-feedback-for-type-holes
Provide better compiler feedback for type holes in annotations.
2023-03-16 14:20:20 +01:00
KtorZ d59305a1b0
Provide better compiler feedback for type holes in annotations.
It is now possible to leave a hole in a type annotation and have the compiler fill-in the expected type of us.
  This is a pretty useful debugging tool when playing with complex functions.
2023-03-16 14:07:06 +01:00
rvcas 0e7494541d
feat: update changelog 2023-03-15 16:46:59 -04:00