Merge branch 'acceptance-test-111'
This commit is contained in:
commit
ddfe01ee88
|
@ -1616,10 +1616,17 @@ impl<'a> CodeGenerator<'a> {
|
||||||
|
|
||||||
assert!(inner_pair_types.len() == 2);
|
assert!(inner_pair_types.len() == 2);
|
||||||
|
|
||||||
let map_name = format!("__map_span_{}_{}", location.start, location.end);
|
let map_name = format!("__map_{}_span_{}_{}", depth, location.start, location.end);
|
||||||
let pair_name = format!("__pair_span_{}_{}", location.start, location.end);
|
let pair_name =
|
||||||
let fst_name = format!("__pair_fst_span_{}_{}", location.start, location.end);
|
format!("__pair_{}_span_{}_{}", depth, location.start, location.end);
|
||||||
let snd_name = format!("__pair_snd_span_{}_{}", location.start, location.end);
|
let fst_name = format!(
|
||||||
|
"__pair_fst_{}_span_{}_{}",
|
||||||
|
depth, location.start, location.end
|
||||||
|
);
|
||||||
|
let snd_name = format!(
|
||||||
|
"__pair_snd_{}_span_{}_{}",
|
||||||
|
depth, location.start, location.end
|
||||||
|
);
|
||||||
|
|
||||||
let expect_snd = self.expect_type_assign(
|
let expect_snd = self.expect_type_assign(
|
||||||
&inner_pair_types[1],
|
&inner_pair_types[1],
|
||||||
|
@ -1738,7 +1745,8 @@ impl<'a> CodeGenerator<'a> {
|
||||||
|
|
||||||
assert!(!tuple_inner_types.is_empty());
|
assert!(!tuple_inner_types.is_empty());
|
||||||
|
|
||||||
let tuple_name = format!("__tuple_span_{}_{}", location.start, location.end);
|
let tuple_name =
|
||||||
|
format!("__tuple_{}_span_{}_{}", depth, location.start, location.end);
|
||||||
|
|
||||||
let mut tuple_expect_items = vec![];
|
let mut tuple_expect_items = vec![];
|
||||||
|
|
||||||
|
@ -1748,8 +1756,8 @@ impl<'a> CodeGenerator<'a> {
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.rfold(then, |then, (index, arg)| {
|
.rfold(then, |then, (index, arg)| {
|
||||||
let tuple_index_name = format!(
|
let tuple_index_name = format!(
|
||||||
"__tuple_index_{}_span_{}_{}",
|
"__tuple_{}_index_{}_span_{}_{}",
|
||||||
index, location.start, location.end
|
depth, index, location.start, location.end
|
||||||
);
|
);
|
||||||
|
|
||||||
let expect_tuple_item = self.expect_type_assign(
|
let expect_tuple_item = self.expect_type_assign(
|
||||||
|
@ -1789,8 +1797,10 @@ impl<'a> CodeGenerator<'a> {
|
||||||
if inner_list_type.is_data() {
|
if inner_list_type.is_data() {
|
||||||
then
|
then
|
||||||
} else {
|
} else {
|
||||||
let list_name = format!("__list_span_{}_{}", location.start, location.end);
|
let list_name =
|
||||||
let item_name = format!("__item_span_{}_{}", location.start, location.end);
|
format!("__list_{}_span_{}_{}", depth, location.start, location.end);
|
||||||
|
let item_name =
|
||||||
|
format!("__item_{}_span_{}_{}", depth, location.start, location.end);
|
||||||
|
|
||||||
let unwrap_function = AirTree::anon_func(
|
let unwrap_function = AirTree::anon_func(
|
||||||
vec![
|
vec![
|
||||||
|
@ -1902,10 +1912,17 @@ impl<'a> CodeGenerator<'a> {
|
||||||
|
|
||||||
assert!(tuple_inner_types.len() == 2);
|
assert!(tuple_inner_types.len() == 2);
|
||||||
|
|
||||||
let pair_name = format!("__pair_span_{}_{}", location.start, location.end);
|
let pair_name =
|
||||||
|
format!("__pair_{}_span_{}_{}", depth, location.start, location.end);
|
||||||
|
|
||||||
let fst_name = format!("__pair_fst_span_{}_{}", location.start, location.end);
|
let fst_name = format!(
|
||||||
let snd_name = format!("__pair_snd_span_{}_{}", location.start, location.end);
|
"__pair_fst_{}_span_{}_{}",
|
||||||
|
depth, location.start, location.end
|
||||||
|
);
|
||||||
|
let snd_name = format!(
|
||||||
|
"__pair_snd_{}_span_{}_{}",
|
||||||
|
depth, location.start, location.end
|
||||||
|
);
|
||||||
|
|
||||||
let expect_snd = self.expect_type_assign(
|
let expect_snd = self.expect_type_assign(
|
||||||
&tuple_inner_types[1],
|
&tuple_inner_types[1],
|
||||||
|
|
|
@ -10,7 +10,10 @@ pub const CONSTR_INDEX_EXPOSER: &str = "__constr_index_exposer";
|
||||||
pub const EXPECT_ON_LIST: &str = "__expect_on_list";
|
pub const EXPECT_ON_LIST: &str = "__expect_on_list";
|
||||||
pub const INNER_EXPECT_ON_LIST: &str = "__inner_expect_on_list";
|
pub const INNER_EXPECT_ON_LIST: &str = "__inner_expect_on_list";
|
||||||
|
|
||||||
impl<T> Term<T> {
|
impl<T> Term<T>
|
||||||
|
where
|
||||||
|
T: std::fmt::Debug,
|
||||||
|
{
|
||||||
// Terms
|
// Terms
|
||||||
pub fn apply(self, arg: Self) -> Self {
|
pub fn apply(self, arg: Self) -> Self {
|
||||||
Term::Apply {
|
Term::Apply {
|
||||||
|
@ -391,7 +394,10 @@ impl<T> Term<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Term<T> {
|
impl<T> Term<T>
|
||||||
|
where
|
||||||
|
T: std::fmt::Debug,
|
||||||
|
{
|
||||||
pub fn delayed_choose_data(
|
pub fn delayed_choose_data(
|
||||||
self,
|
self,
|
||||||
constr_case: Self,
|
constr_case: Self,
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
name = "aiken-lang/acceptance_test_111"
|
||||||
|
version = "0.0.0"
|
||||||
|
license = "Apache-2.0"
|
||||||
|
description = "Aiken contracts for project 'aiken-lang/111'"
|
||||||
|
|
||||||
|
[repository]
|
||||||
|
user = "aiken-lang"
|
||||||
|
project = "111"
|
||||||
|
platform = "github"
|
|
@ -0,0 +1,16 @@
|
||||||
|
type Point =
|
||||||
|
(ByteArray, Int)
|
||||||
|
|
||||||
|
type NestedTuples {
|
||||||
|
points: (Point, Point),
|
||||||
|
}
|
||||||
|
|
||||||
|
test boom() {
|
||||||
|
let original = NestedTuples { points: (("", 14), ("foo", 42)) }
|
||||||
|
|
||||||
|
let data: Data = original
|
||||||
|
|
||||||
|
expect recovered: NestedTuples = data
|
||||||
|
|
||||||
|
original == recovered
|
||||||
|
}
|
Loading…
Reference in New Issue