feat: new builtins constr_index and constr_fields for alternative fast ways to take apart Data

This commit is contained in:
microproofs
2024-12-13 14:15:19 +07:00
parent ebc7d89d5d
commit 463b88413e
7 changed files with 227 additions and 77 deletions

View File

@@ -0,0 +1,2 @@
name = "aiken-lang/acceptance_test_116"
version = "0.0.0"

View File

@@ -0,0 +1,12 @@
use aiken/builtin.{constr_index}
test baz() {
let x = Some("bar")
expect [bar] = x |> builtin.constr_fields
and {
constr_index(x) == 0,
builtin.un_b_data(bar) == "bar",
}
}