Add new acceptance test scenario: 064
- Type mismatch expected 'data' got 'integer' - Type mismatch expected 'data' got 'list data'
This commit is contained in:
parent
dc001c3745
commit
81e072a14e
|
@ -0,0 +1,5 @@
|
|||
# This file was generated by Aiken
|
||||
# You typically do not need to edit this file
|
||||
|
||||
requirements = []
|
||||
packages = []
|
|
@ -0,0 +1,3 @@
|
|||
name = 'aiken-lang/acceptance_test_064'
|
||||
version = '0.0.0'
|
||||
description = ''
|
|
@ -0,0 +1,30 @@
|
|||
use aiken/builtin
|
||||
|
||||
type Foo {
|
||||
A(Int)
|
||||
B(Int, Int)
|
||||
}
|
||||
|
||||
fn get_constr(data: Data) -> Int {
|
||||
builtin.un_constr_data(data).1st
|
||||
}
|
||||
|
||||
test foo() {
|
||||
get_constr(A(42)) == 0 && get_constr(B(14, 42)) == 1
|
||||
}
|
||||
|
||||
fn map(list: List<a>, f: fn(a) -> b) -> List<b> {
|
||||
when list is {
|
||||
[] -> []
|
||||
[x, ..xs] -> [f(x), ..map(xs, f)]
|
||||
}
|
||||
}
|
||||
|
||||
fn get_fields(data: Data) -> List<Int> {
|
||||
builtin.un_constr_data(data).2nd
|
||||
|> map(builtin.un_i_data)
|
||||
}
|
||||
|
||||
test bar() {
|
||||
get_fields(A(42)) == [42] && get_fields(B(14, 42)) == [14, 42]
|
||||
}
|
Loading…
Reference in New Issue