fix(check): collapse_links on tuple_index access closes #905
This commit is contained in:
parent
7c5b9aa35e
commit
b27fcf38e5
|
@ -2274,3 +2274,24 @@ fn validator_private_everything() {
|
|||
|
||||
assert!(check_validator(parse(source_code)).is_ok())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tuple_access_on_call() {
|
||||
let source_code = r#"
|
||||
use aiken/builtin
|
||||
|
||||
pub fn list_at(xs: List<a>, index: Int) -> a {
|
||||
if index == 0 {
|
||||
builtin.head_list(xs)
|
||||
} else {
|
||||
list_at(builtin.tail_list(xs), index - 1)
|
||||
}
|
||||
}
|
||||
|
||||
fn foo() {
|
||||
[list_at([(1, 2)], 0).2nd, ..[1, 2]]
|
||||
}
|
||||
"#;
|
||||
|
||||
assert!(check(parse(source_code)).is_ok())
|
||||
}
|
||||
|
|
|
@ -2045,7 +2045,7 @@ impl<'a, 'b> ExprTyper<'a, 'b> {
|
|||
) -> Result<TypedExpr, Error> {
|
||||
let tuple = self.infer(tuple)?;
|
||||
|
||||
let tipo = match *tuple.tipo() {
|
||||
let tipo = match *collapse_links(tuple.tipo()) {
|
||||
Type::Tuple {
|
||||
ref elems,
|
||||
alias: _,
|
||||
|
|
Loading…
Reference in New Issue