Pattern guards for functions and switch statements (#339)
* Add case guards to parser * Add pattern guards to infer types and fcode generation * Add functions guards * Add test for patterns guards * Update docs * Update CHANGELOG.md * Remove stateful context from Env for guards * Elaborate on guards * Add failing test for stateful pattern guards * Implement multiple guards * Fix tests * Disable aevm related tests * Split the sentence before if and otherwise * Fix type in docs * Implement multiple exprs in the same guard * Fix pretty printing * Change tests to include multiple guards * Add test for non-boolean guards * Desugar clauses with guards * Fix incomplete patterns bug * Fix docs * Compile to icode when no guards are used * Revert "Disable aevm related tests" This reverts commit e828099bd97dffe11438f2e48f3a92ce3641e85b.
This commit is contained in:
@@ -13,6 +13,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Assign patterns to variables (e.g. `let x::(t = y::_) = [1, 2, 3, 4]` where `t == [2, 3, 4]`)
|
||||
- Add builtin types (`AENS.name, AENS.pointee, Chain.ttl, Chain.base_tx, Chain.ga_meta_tx, Chain.paying_for_tx`) to
|
||||
the calldata and result decoder
|
||||
- Patterns guards
|
||||
```
|
||||
switch(x)
|
||||
a::[] | a > 10 => 1
|
||||
_ => 2
|
||||
```
|
||||
```
|
||||
function
|
||||
f(a::[]) | a > 10 = 1
|
||||
f(_) = 2
|
||||
```
|
||||
### Changed
|
||||
- Fixed the ACI renderer, it shouldn't drop the `stateful` modifier
|
||||
### Removed
|
||||
|
||||
Reference in New Issue
Block a user